wintrust(6/6): Move WIN_CERTIFICATE types to wintrust.h, and rename a type, to match PSDK

Juan Lang juan.lang at gmail.com
Fri Aug 24 17:27:00 CDT 2007


--Juan
-------------- next part --------------
From b8cac745c657630a2512c80e851126c1c3c555a7 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Fri, 24 Aug 2007 15:17:00 -0700
Subject: [PATCH] Move WIN_CERTIFICATE types to wintrust.h, and rename a type, to match PSDK
---
 dlls/imagehlp/integrity.c |    6 +++---
 include/imagehlp.h        |   20 +++-----------------
 include/wintrust.h        |   19 +++++++++++++++++++
 3 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/dlls/imagehlp/integrity.c b/dlls/imagehlp/integrity.c
index fb228f4..df6de0f 100644
--- a/dlls/imagehlp/integrity.c
+++ b/dlls/imagehlp/integrity.c
@@ -144,7 +144,7 @@ static BOOL IMAGEHLP_GetCertificateOffse
  */
 
 BOOL WINAPI ImageAddCertificate(
-  HANDLE FileHandle, PWIN_CERTIFICATE Certificate, PDWORD Index)
+  HANDLE FileHandle, LPWIN_CERTIFICATE Certificate, PDWORD Index)
 {
   FIXME("(%p, %p, %p): stub\n",
     FileHandle, Certificate, Index
@@ -220,7 +220,7 @@ BOOL WINAPI ImageEnumerateCertificates(
  */
 BOOL WINAPI ImageGetCertificateData(
                 HANDLE handle, DWORD Index,
-                PWIN_CERTIFICATE Certificate, PDWORD RequiredLength)
+                LPWIN_CERTIFICATE Certificate, PDWORD RequiredLength)
 {
     DWORD r, offset, ofs, size, count;
 
@@ -263,7 +263,7 @@ BOOL WINAPI ImageGetCertificateData(
  *		ImageGetCertificateHeader (IMAGEHLP.@)
  */
 BOOL WINAPI ImageGetCertificateHeader(
-    HANDLE handle, DWORD index, PWIN_CERTIFICATE pCert)
+    HANDLE handle, DWORD index, LPWIN_CERTIFICATE pCert)
 {
     DWORD r, offset, ofs, size, count;
     const size_t cert_hdr_size = sizeof *pCert - sizeof pCert->bCertificate;
diff --git a/include/imagehlp.h b/include/imagehlp.h
index 6e9ac51..93bbaee 100644
--- a/include/imagehlp.h
+++ b/include/imagehlp.h
@@ -71,13 +71,6 @@ #define CERT_PE_IMAGE_DIGEST_NON_PE_INFO
 
 #define CERT_SECTION_TYPE_ANY 0xFF
 
-#define WIN_CERT_REVISION_1_0 0x0100
-#define WIN_CERT_REVISION_2_0 0x0200
-
-#define WIN_CERT_TYPE_X509             0x0001 /* X.509 Certificate */
-#define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002 /* PKCS SignedData */
-#define WIN_CERT_TYPE_RESERVED_1       0x0003 /* Reserved */
-
 #define SPLITSYM_REMOVE_PRIVATE    0x00000001
 #define SPLITSYM_EXTRACT_ALL       0x00000002
 #define SPLITSYM_SYMBOLPATH_IS_SRC 0x00000004
@@ -179,13 +172,6 @@ typedef struct _LOADED_IMAGE
     ULONG                       SizeOfImage;
 } LOADED_IMAGE, *PLOADED_IMAGE;
 
-typedef struct _WIN_CERTIFICATE {
-  DWORD dwLength;
-  WORD  wRevision;                   /*  WIN_CERT_REVISON_xxx */
-  WORD  wCertificateType;            /*  WIN_CERT_TYPE_xxx */
-  BYTE  bCertificate[ANYSIZE_ARRAY];
-} WIN_CERTIFICATE, *PWIN_CERTIFICATE;
-
 typedef struct _API_VERSION {
   USHORT  MajorVersion;
   USHORT  MinorVersion;
@@ -841,7 +827,7 @@ DWORD WINAPI GetTimestampForLoadedLibrar
   HMODULE Module
 );
 BOOL WINAPI ImageAddCertificate(
-  HANDLE FileHandle, PWIN_CERTIFICATE Certificate, PDWORD Index
+  HANDLE FileHandle, LPWIN_CERTIFICATE Certificate, PDWORD Index
 );
 PVOID WINAPI ImageDirectoryEntryToData(
   PVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, PULONG Size
@@ -852,11 +838,11 @@ BOOL WINAPI ImageEnumerateCertificates(
 );
 BOOL WINAPI ImageGetCertificateData(
   HANDLE FileHandle, DWORD CertificateIndex,
-  PWIN_CERTIFICATE Certificate, PDWORD RequiredLength
+  LPWIN_CERTIFICATE Certificate, PDWORD RequiredLength
 );
 BOOL WINAPI ImageGetCertificateHeader(
   HANDLE FileHandle, DWORD CertificateIndex,
-  PWIN_CERTIFICATE Certificateheader
+  LPWIN_CERTIFICATE Certificateheader
 );
 BOOL WINAPI ImageGetDigestStream(
   HANDLE FileHandle, DWORD DigestLevel,
diff --git a/include/wintrust.h b/include/wintrust.h
index 0fb9838..3290e31 100644
--- a/include/wintrust.h
+++ b/include/wintrust.h
@@ -533,6 +533,25 @@ typedef struct _CAT_MEMBERINFO
     DWORD  dwCertVersion;
 } CAT_MEMBERINFO, *PCAT_MEMBERINFO;
 
+/* PSDK protects the remaining defines with WT_DEFINE_ALL_APIS, but it's
+ * defined by default.  No need to protect against bad headers from old PSDKs.
+ */
+
+typedef struct _WIN_CERTIFICATE {
+  DWORD dwLength;
+  WORD  wRevision;                   /*  WIN_CERT_REVISON_xxx */
+  WORD  wCertificateType;            /*  WIN_CERT_TYPE_xxx */
+  BYTE  bCertificate[ANYSIZE_ARRAY];
+} WIN_CERTIFICATE, *LPWIN_CERTIFICATE;
+
+#define WIN_CERT_REVISION_1_0 0x0100
+#define WIN_CERT_REVISION_2_0 0x0200
+
+#define WIN_CERT_TYPE_X509             0x0001 /* X.509 Certificate */
+#define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002 /* PKCS SignedData */
+#define WIN_CERT_TYPE_RESERVED_1       0x0003 /* Reserved */
+#define WIN_CERT_TYPE_TS_STACK_SIGNED  0x0004
+
 #define WIN_SPUB_ACTION_PUBLISHED_SOFTWARE \
      { 0x64b9d180, 0x8da2, 0x11cf, { 0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb }}
 
-- 
1.4.1


More information about the wine-patches mailing list