ReactOS 0.4.15-dev-7961-gdcf9eb0
mssip.h File Reference
#include <pshpack8.h>
#include <poppack.h>
Include dependency graph for mssip.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SIP_SUBJECTINFO_
 
struct  MS_ADDINFO_FLAT_
 
struct  MS_ADDINFO_CATALOGMEMBER_
 
struct  MS_ADDINFO_BLOB_
 
struct  SIP_INDIRECT_DATA_
 
struct  SIP_DISPATCH_INFO_
 
struct  SIP_ADD_NEWPROVIDER_
 

Macros

#define MSSIP_FLAGS_PROHIBIT_RESIZE_ON_CREATE   0x00010000
 
#define MSSIP_FLAGS_USE_CATALOG   0x00020000
 
#define SPC_INC_PE_RESOURCES_FLAG   0x80
 
#define SPC_INC_PE_DEBUG_INFO_FLAG   0x40
 
#define SPC_INC_PE_IMPORT_ADDR_TABLE_FLAG   0x20
 
#define MSSIP_ADDINFO_NONE   0
 
#define MSSIP_ADDINFO_FLAT   1
 
#define MSSIP_ADDINFO_CATMEMBER   2
 
#define MSSIP_ADDINFO_BLOB   3
 
#define MSSIP_ADDINFO_NONMSSIP   500
 
#define SIP_MAX_MAGIC_NUMBER   4
 

Typedefs

typedef CRYPT_HASH_BLOB CRYPT_DIGEST_DATA
 
typedef struct SIP_SUBJECTINFO_ SIP_SUBJECTINFO
 
typedef struct SIP_SUBJECTINFO_LPSIP_SUBJECTINFO
 
typedef struct MS_ADDINFO_FLAT_ MS_ADDINFO_FLAT
 
typedef struct MS_ADDINFO_FLAT_PMS_ADDINFO_FLAT
 
typedef struct MS_ADDINFO_CATALOGMEMBER_ MS_ADDINFO_CATALOGMEMBER
 
typedef struct MS_ADDINFO_CATALOGMEMBER_PMS_ADDINFO_CATALOGMEMBER
 
typedef struct MS_ADDINFO_BLOB_ MS_ADDINFO_BLOB
 
typedef struct MS_ADDINFO_BLOB_PMS_ADDINFO_BLOB
 
typedef struct SIP_INDIRECT_DATA_ SIP_INDIRECT_DATA
 
typedef struct SIP_INDIRECT_DATA_PSIP_INDIRECT_DATA
 
typedef BOOL(WINAPIpCryptSIPGetSignedDataMsg) (SIP_SUBJECTINFO *, DWORD *, DWORD, DWORD *, BYTE *)
 
typedef BOOL(WINAPIpCryptSIPPutSignedDataMsg) (SIP_SUBJECTINFO *, DWORD, DWORD *, DWORD, BYTE *)
 
typedef BOOL(WINAPIpCryptSIPCreateIndirectData) (SIP_SUBJECTINFO *, DWORD *, SIP_INDIRECT_DATA *)
 
typedef BOOL(WINAPIpCryptSIPVerifyIndirectData) (SIP_SUBJECTINFO *, SIP_INDIRECT_DATA *)
 
typedef BOOL(WINAPIpCryptSIPRemoveSignedDataMsg) (SIP_SUBJECTINFO *, DWORD)
 
typedef struct SIP_DISPATCH_INFO_ SIP_DISPATCH_INFO
 
typedef struct SIP_DISPATCH_INFO_LPSIP_DISPATCH_INFO
 
typedef BOOL(WINAPIpfnIsFileSupported) (HANDLE, GUID *)
 
typedef BOOL(WINAPIpfnIsFileSupportedName) (WCHAR *, GUID *)
 
typedef struct SIP_ADD_NEWPROVIDER_ SIP_ADD_NEWPROVIDER
 
typedef struct SIP_ADD_NEWPROVIDER_PSIP_ADD_NEWPROVIDER
 

Functions

BOOL WINAPI CryptSIPGetSignedDataMsg (SIP_SUBJECTINFO *, DWORD *, DWORD, DWORD *, BYTE *)
 
BOOL WINAPI CryptSIPPutSignedDataMsg (SIP_SUBJECTINFO *, DWORD, DWORD *, DWORD, BYTE *)
 
BOOL WINAPI CryptSIPCreateIndirectData (SIP_SUBJECTINFO *, DWORD *, SIP_INDIRECT_DATA *)
 
BOOL WINAPI CryptSIPVerifyIndirectData (SIP_SUBJECTINFO *, SIP_INDIRECT_DATA *)
 
BOOL WINAPI CryptSIPRemoveSignedDataMsg (SIP_SUBJECTINFO *, DWORD)
 
BOOL WINAPI CryptSIPLoad (const GUID *, DWORD, SIP_DISPATCH_INFO *)
 
BOOL WINAPI CryptSIPRetrieveSubjectGuid (LPCWSTR, HANDLE, GUID *)
 
BOOL WINAPI CryptSIPRetrieveSubjectGuidForCatalogFile (LPCWSTR, HANDLE, GUID *)
 
BOOL WINAPI CryptSIPAddProvider (SIP_ADD_NEWPROVIDER *)
 
BOOL WINAPI CryptSIPRemoveProvider (GUID *)
 

Macro Definition Documentation

◆ MSSIP_ADDINFO_BLOB

#define MSSIP_ADDINFO_BLOB   3

Definition at line 42 of file mssip.h.

◆ MSSIP_ADDINFO_CATMEMBER

#define MSSIP_ADDINFO_CATMEMBER   2

Definition at line 41 of file mssip.h.

◆ MSSIP_ADDINFO_FLAT

#define MSSIP_ADDINFO_FLAT   1

Definition at line 40 of file mssip.h.

◆ MSSIP_ADDINFO_NONE

#define MSSIP_ADDINFO_NONE   0

Definition at line 39 of file mssip.h.

◆ MSSIP_ADDINFO_NONMSSIP

#define MSSIP_ADDINFO_NONMSSIP   500

Definition at line 43 of file mssip.h.

◆ MSSIP_FLAGS_PROHIBIT_RESIZE_ON_CREATE

#define MSSIP_FLAGS_PROHIBIT_RESIZE_ON_CREATE   0x00010000

Definition at line 32 of file mssip.h.

◆ MSSIP_FLAGS_USE_CATALOG

#define MSSIP_FLAGS_USE_CATALOG   0x00020000

Definition at line 33 of file mssip.h.

◆ SIP_MAX_MAGIC_NUMBER

#define SIP_MAX_MAGIC_NUMBER   4

Definition at line 45 of file mssip.h.

◆ SPC_INC_PE_DEBUG_INFO_FLAG

#define SPC_INC_PE_DEBUG_INFO_FLAG   0x40

Definition at line 36 of file mssip.h.

◆ SPC_INC_PE_IMPORT_ADDR_TABLE_FLAG

#define SPC_INC_PE_IMPORT_ADDR_TABLE_FLAG   0x20

Definition at line 37 of file mssip.h.

◆ SPC_INC_PE_RESOURCES_FLAG

#define SPC_INC_PE_RESOURCES_FLAG   0x80

Definition at line 35 of file mssip.h.

Typedef Documentation

◆ CRYPT_DIGEST_DATA

Definition at line 28 of file mssip.h.

◆ LPSIP_DISPATCH_INFO

◆ LPSIP_SUBJECTINFO

◆ MS_ADDINFO_BLOB

◆ MS_ADDINFO_CATALOGMEMBER

◆ MS_ADDINFO_FLAT

◆ pCryptSIPCreateIndirectData

typedef BOOL(WINAPI * pCryptSIPCreateIndirectData) (SIP_SUBJECTINFO *, DWORD *, SIP_INDIRECT_DATA *)

Definition at line 119 of file mssip.h.

◆ pCryptSIPGetSignedDataMsg

typedef BOOL(WINAPI * pCryptSIPGetSignedDataMsg) (SIP_SUBJECTINFO *, DWORD *, DWORD, DWORD *, BYTE *)

Definition at line 117 of file mssip.h.

◆ pCryptSIPPutSignedDataMsg

typedef BOOL(WINAPI * pCryptSIPPutSignedDataMsg) (SIP_SUBJECTINFO *, DWORD, DWORD *, DWORD, BYTE *)

Definition at line 118 of file mssip.h.

◆ pCryptSIPRemoveSignedDataMsg

typedef BOOL(WINAPI * pCryptSIPRemoveSignedDataMsg) (SIP_SUBJECTINFO *, DWORD)

Definition at line 121 of file mssip.h.

◆ pCryptSIPVerifyIndirectData

typedef BOOL(WINAPI * pCryptSIPVerifyIndirectData) (SIP_SUBJECTINFO *, SIP_INDIRECT_DATA *)

Definition at line 120 of file mssip.h.

◆ pfnIsFileSupported

typedef BOOL(WINAPI * pfnIsFileSupported) (HANDLE, GUID *)

Definition at line 137 of file mssip.h.

◆ pfnIsFileSupportedName

typedef BOOL(WINAPI * pfnIsFileSupportedName) (WCHAR *, GUID *)

Definition at line 138 of file mssip.h.

◆ PMS_ADDINFO_BLOB

◆ PMS_ADDINFO_CATALOGMEMBER

◆ PMS_ADDINFO_FLAT

◆ PSIP_ADD_NEWPROVIDER

◆ PSIP_INDIRECT_DATA

◆ SIP_ADD_NEWPROVIDER

◆ SIP_DISPATCH_INFO

◆ SIP_INDIRECT_DATA

◆ SIP_SUBJECTINFO

Function Documentation

◆ CryptSIPAddProvider()

BOOL WINAPI CryptSIPAddProvider ( SIP_ADD_NEWPROVIDER psNewProv)

Definition at line 207 of file sip.c.

208{
210
211 TRACE("%p\n", psNewProv);
212
213 if (!psNewProv ||
214 psNewProv->cbStruct < FIELD_OFFSET(SIP_ADD_NEWPROVIDER, pwszGetCapFuncName) ||
215 !psNewProv->pwszGetFuncName ||
216 !psNewProv->pwszPutFuncName ||
217 !psNewProv->pwszCreateFuncName ||
218 !psNewProv->pwszVerifyFuncName ||
219 !psNewProv->pwszRemoveFuncName)
220 {
222 return FALSE;
223 }
224
225 TRACE("%s %s %s %s %s\n",
226 debugstr_guid( psNewProv->pgSubject ),
227 debugstr_w( psNewProv->pwszDLLFileName ),
228 debugstr_w( psNewProv->pwszMagicNumber ),
229 debugstr_w( psNewProv->pwszIsFunctionName ),
230 debugstr_w( psNewProv->pwszIsFunctionNameFmt2 ) );
231
232#define CRYPT_SIPADDPROV( key, field ) \
233 r = CRYPT_SIPWriteFunction( psNewProv->pgSubject, key, \
234 psNewProv->pwszDLLFileName, psNewProv->field); \
235 if (r != ERROR_SUCCESS) goto end_function
236
237 CRYPT_SIPADDPROV( szPutSigned, pwszPutFuncName );
238 CRYPT_SIPADDPROV( szGetSigned, pwszGetFuncName );
239 CRYPT_SIPADDPROV( szRemoveSigned, pwszRemoveFuncName );
240 CRYPT_SIPADDPROV( szCreate, pwszCreateFuncName );
241 CRYPT_SIPADDPROV( szVerify, pwszVerifyFuncName );
242 CRYPT_SIPADDPROV( szIsMyFile, pwszIsFunctionName );
243 CRYPT_SIPADDPROV( szIsMyFile2, pwszIsFunctionNameFmt2 );
244
245#undef CRYPT_SIPADDPROV
246
247end_function:
248
249 if (r != ERROR_SUCCESS)
250 {
252 return FALSE;
253 }
254
255 return TRUE;
256}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR szRemoveSigned[]
Definition: sip.c:50
static const WCHAR szVerify[]
Definition: sip.c:54
static const WCHAR szPutSigned[]
Definition: sip.c:46
static const WCHAR szIsMyFile2[]
Definition: sip.c:58
static const WCHAR szIsMyFile[]
Definition: sip.c:56
#define CRYPT_SIPADDPROV(key, field)
static const WCHAR szCreate[]
Definition: sip.c:52
static const WCHAR szGetSigned[]
Definition: sip.c:48
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR * pwszPutFuncName
Definition: mssip.h:153
WCHAR * pwszCreateFuncName
Definition: mssip.h:154
GUID * pgSubject
Definition: mssip.h:145
WCHAR * pwszMagicNumber
Definition: mssip.h:148
WCHAR * pwszRemoveFuncName
Definition: mssip.h:156
WCHAR * pwszIsFunctionName
Definition: mssip.h:150
WCHAR * pwszGetFuncName
Definition: mssip.h:152
WCHAR * pwszIsFunctionNameFmt2
Definition: mssip.h:158
WCHAR * pwszVerifyFuncName
Definition: mssip.h:155
WCHAR * pwszDLLFileName
Definition: mssip.h:147
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by DllRegisterServer(), test_AddRemoveProvider(), and WINTRUST_SIPPAddProvider().

◆ CryptSIPCreateIndirectData()

BOOL WINAPI CryptSIPCreateIndirectData ( SIP_SUBJECTINFO pSubjectInfo,
DWORD pcbIndirectData,
SIP_INDIRECT_DATA pIndirectData 
)

Definition at line 715 of file sip.c.

717{
719 BOOL ret = FALSE;
720
721 TRACE("(%p %p %p)\n", pSubjectInfo, pcbIndirectData, pIndirectData);
722
723 if (!pSubjectInfo || !pSubjectInfo->pgSubjectType || !pcbIndirectData)
724 {
726 return FALSE;
727 }
728 if ((sip = CRYPT_GetCachedSIP(pSubjectInfo->pgSubjectType)))
729 ret = sip->info.pfCreate(pSubjectInfo, pcbIndirectData, pIndirectData);
730 TRACE("returning %d\n", ret);
731 return ret;
732}
static WINE_SIP_PROVIDER * CRYPT_GetCachedSIP(const GUID *pgSubject)
Definition: sip.c:589
unsigned int BOOL
Definition: ntddk_ex.h:94
pCryptSIPCreateIndirectData pfCreate
Definition: mssip.h:131
GUID * pgSubjectType
Definition: mssip.h:52
SIP_DISPATCH_INFO info
Definition: sip.c:560
int ret

Referenced by CryptSIPLoad(), InitFunctionPtrs(), and WINTRUST_SIPPAddProvider().

◆ CryptSIPGetSignedDataMsg()

BOOL WINAPI CryptSIPGetSignedDataMsg ( SIP_SUBJECTINFO pSubjectInfo,
DWORD pdwEncodingType,
DWORD  dwIndex,
DWORD pcbSignedDataMsg,
BYTE pbSignedDataMsg 
)

Definition at line 737 of file sip.c.

739{
741 BOOL ret = FALSE;
742
743 TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
744 pcbSignedDataMsg, pbSignedDataMsg);
745
746 if ((sip = CRYPT_GetCachedSIP(pSubjectInfo->pgSubjectType)))
747 ret = sip->info.pfGet(pSubjectInfo, pdwEncodingType, dwIndex,
748 pcbSignedDataMsg, pbSignedDataMsg);
749 TRACE("returning %d\n", ret);
750 return ret;
751}
pCryptSIPGetSignedDataMsg pfGet
Definition: mssip.h:129

Referenced by CryptSIPLoad(), and WINTRUST_SIPPAddProvider().

◆ CryptSIPLoad()

BOOL WINAPI CryptSIPLoad ( const GUID pgSubject,
DWORD  dwFlags,
SIP_DISPATCH_INFO pSipDispatch 
)

Definition at line 689 of file sip.c.

691{
692 TRACE("(%s %d %p)\n", debugstr_guid(pgSubject), dwFlags, pSipDispatch);
693
694 if (!pgSubject || dwFlags != 0 || !pSipDispatch)
695 {
697 return FALSE;
698 }
699 if (!CRYPT_IsSIPCached(pgSubject) && !CRYPT_LoadSIP(pgSubject))
700 return FALSE;
701
702 pSipDispatch->hSIP = NULL;
703 pSipDispatch->pfGet = CryptSIPGetSignedDataMsg;
704 pSipDispatch->pfPut = CryptSIPPutSignedDataMsg;
705 pSipDispatch->pfCreate = CryptSIPCreateIndirectData;
706 pSipDispatch->pfVerify = CryptSIPVerifyIndirectData;
708
709 return TRUE;
710}
#define NULL
Definition: types.h:112
BOOL WINAPI CryptSIPPutSignedDataMsg(SIP_SUBJECTINFO *pSubjectInfo, DWORD pdwEncodingType, DWORD *pdwIndex, DWORD cbSignedDataMsg, BYTE *pbSignedDataMsg)
Definition: sip.c:756
BOOL WINAPI CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO *pSubjectInfo, DWORD dwIndex)
Definition: sip.c:775
static BOOL CRYPT_IsSIPCached(const GUID *pgSubject)
Definition: sip.c:605
BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO *pSubjectInfo, DWORD *pdwEncodingType, DWORD dwIndex, DWORD *pcbSignedDataMsg, BYTE *pbSignedDataMsg)
Definition: sip.c:737
BOOL WINAPI CryptSIPCreateIndirectData(SIP_SUBJECTINFO *pSubjectInfo, DWORD *pcbIndirectData, SIP_INDIRECT_DATA *pIndirectData)
Definition: sip.c:715
static BOOL CRYPT_LoadSIP(const GUID *pgSubject)
Definition: sip.c:626
BOOL WINAPI CryptSIPVerifyIndirectData(SIP_SUBJECTINFO *pSubjectInfo, SIP_INDIRECT_DATA *pIndirectData)
Definition: sip.c:792
pCryptSIPVerifyIndirectData pfVerify
Definition: mssip.h:132
pCryptSIPRemoveSignedDataMsg pfRemove
Definition: mssip.h:133
pCryptSIPPutSignedDataMsg pfPut
Definition: mssip.h:130
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by CRYPT_QueryEmbeddedMessageObject(), SOFTPUB_GetSIP(), and test_SIPLoad().

◆ CryptSIPPutSignedDataMsg()

BOOL WINAPI CryptSIPPutSignedDataMsg ( SIP_SUBJECTINFO pSubjectInfo,
DWORD  pdwEncodingType,
DWORD pdwIndex,
DWORD  cbSignedDataMsg,
BYTE pbSignedDataMsg 
)

Definition at line 756 of file sip.c.

758{
760 BOOL ret = FALSE;
761
762 TRACE("(%p %d %p %d %p)\n", pSubjectInfo, pdwEncodingType, pdwIndex,
763 cbSignedDataMsg, pbSignedDataMsg);
764
765 if ((sip = CRYPT_GetCachedSIP(pSubjectInfo->pgSubjectType)))
766 ret = sip->info.pfPut(pSubjectInfo, pdwEncodingType, pdwIndex,
767 cbSignedDataMsg, pbSignedDataMsg);
768 TRACE("returning %d\n", ret);
769 return ret;
770}

Referenced by CryptSIPLoad(), and WINTRUST_SIPPAddProvider().

◆ CryptSIPRemoveProvider()

BOOL WINAPI CryptSIPRemoveProvider ( GUID pgProv)

Definition at line 112 of file sip.c.

113{
115 LONG remove_error = ERROR_SUCCESS;
116
117 TRACE("%s\n", debugstr_guid(pgProv));
118
119 if (!pgProv)
120 {
122 return FALSE;
123 }
124
125
126#define CRYPT_SIPREMOVEPROV( key ) \
127 r = CRYPT_SIPDeleteFunction( pgProv, key); \
128 if (r != ERROR_SUCCESS) remove_error = r
129
137
138#undef CRYPT_SIPREMOVEPROV
139
140 if (remove_error != ERROR_SUCCESS)
141 {
142 SetLastError(remove_error);
143 return FALSE;
144 }
145
146 return TRUE;
147}
#define CRYPT_SIPREMOVEPROV(key)

Referenced by DllUnregisterServer(), and test_AddRemoveProvider().

◆ CryptSIPRemoveSignedDataMsg()

BOOL WINAPI CryptSIPRemoveSignedDataMsg ( SIP_SUBJECTINFO pSubjectInfo,
DWORD  dwIndex 
)

Definition at line 775 of file sip.c.

777{
779 BOOL ret = FALSE;
780
781 TRACE("(%p %d)\n", pSubjectInfo, dwIndex);
782
783 if ((sip = CRYPT_GetCachedSIP(pSubjectInfo->pgSubjectType)))
784 ret = sip->info.pfRemove(pSubjectInfo, dwIndex);
785 TRACE("returning %d\n", ret);
786 return ret;
787}

Referenced by CryptSIPLoad(), and WINTRUST_SIPPAddProvider().

◆ CryptSIPRetrieveSubjectGuid()

BOOL WINAPI CryptSIPRetrieveSubjectGuid ( LPCWSTR  FileName,
HANDLE  hFileIn,
GUID pgSubject 
)

Definition at line 309 of file sip.c.

311{
313 BOOL bRet = FALSE;
314 DWORD count;
315 LARGE_INTEGER zero, oldPos;
316 /* FIXME, find out if there is a name for this GUID */
317 static const GUID unknown = { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
318 static const GUID cabGUID = { 0xc689aaba, 0x8e78, 0x11d0, {0x8c,0x47,0x00,0xc0,0x4f,0xc2,0x95,0xee }};
319 static const GUID catGUID = { 0xDE351A43, 0x8E59, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
320 static const WORD dosHdr = IMAGE_DOS_SIGNATURE;
321 static const BYTE cabHdr[] = { 'M','S','C','F' };
323 WCHAR szFullKey[ 0x100 ];
325 HKEY key;
326
327 TRACE("(%s %p %p)\n", wine_dbgstr_w(FileName), hFileIn, pgSubject);
328
329 if (!pgSubject || (!FileName && !hFileIn))
330 {
332 return FALSE;
333 }
334
335 /* Set pgSubject to zero's */
336 memset(pgSubject, 0 , sizeof(GUID));
337
338 if (hFileIn)
339 /* Use the given handle, make sure not to close this one ourselves */
340 hFile = hFileIn;
341 else
342 {
344 /* Last error is set by CreateFile */
345 if (hFile == INVALID_HANDLE_VALUE) return FALSE;
346 }
347
348 zero.QuadPart = 0;
351 if (!ReadFile(hFile, hdr, sizeof(hdr), &count, NULL))
352 goto cleanup;
353
355 {
357 goto cleanup;
358 }
359
360 TRACE("file magic = 0x%02x%02x%02x%02x\n", hdr[0], hdr[1], hdr[2], hdr[3]);
361 /* As everything is in place now we start looking at the file header */
362 if (!memcmp(hdr, &dosHdr, sizeof(dosHdr)))
363 {
364 *pgSubject = unknown;
366 bRet = TRUE;
367 goto cleanup;
368 }
369 /* Quick-n-dirty check for a cab file. */
370 if (!memcmp(hdr, cabHdr, sizeof(cabHdr)))
371 {
372 *pgSubject = cabGUID;
374 bRet = TRUE;
375 goto cleanup;
376 }
377 /* If it's asn.1-encoded, it's probably a .cat file. */
378 if (hdr[0] == 0x30)
379 {
380 DWORD fileLen = GetFileSize(hFile, NULL);
381
382 TRACE("fileLen = %d\n", fileLen);
383 /* Sanity-check length */
384 if (hdr[1] < 0x80 && fileLen == 2 + hdr[1])
385 {
386 *pgSubject = catGUID;
388 bRet = TRUE;
389 goto cleanup;
390 }
391 else if (hdr[1] == 0x80)
392 {
393 /* Indefinite length, can't verify with just the header, assume it
394 * is.
395 */
396 *pgSubject = catGUID;
398 bRet = TRUE;
399 goto cleanup;
400 }
401 else
402 {
403 BYTE lenBytes = hdr[1] & 0x7f;
404
405 if (lenBytes == 1 && fileLen == 2 + lenBytes + hdr[2])
406 {
407 *pgSubject = catGUID;
409 bRet = TRUE;
410 goto cleanup;
411 }
412 else if (lenBytes == 2 && fileLen == 2 + lenBytes +
413 (hdr[2] << 8 | hdr[3]))
414 {
415 *pgSubject = catGUID;
417 bRet = TRUE;
418 goto cleanup;
419 }
420 else if (fileLen > 0xffff)
421 {
422 /* The file size must be greater than 2 bytes in length, so
423 * assume it is a .cat file
424 */
425 *pgSubject = catGUID;
427 bRet = TRUE;
428 goto cleanup;
429 }
430 }
431 }
432
433 /* Check for supported functions using CryptSIPDllIsMyFileType */
434 /* max length of szFullKey depends on our code only, so we won't overrun */
435 lstrcpyW(szFullKey, szOID);
436 lstrcatW(szFullKey, szIsMyFile);
437 r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szFullKey, 0, KEY_READ, &key);
438 if (r == ERROR_SUCCESS)
439 {
440 DWORD index = 0, size;
441 WCHAR subKeyName[MAX_PATH];
442
443 do {
444 size = ARRAY_SIZE(subKeyName);
445 r = RegEnumKeyExW(key, index++, subKeyName, &size, NULL, NULL,
446 NULL, NULL);
447 if (r == ERROR_SUCCESS)
448 {
449 HKEY subKey;
450
451 r = RegOpenKeyExW(key, subKeyName, 0, KEY_READ, &subKey);
452 if (r == ERROR_SUCCESS)
453 {
454 HMODULE lib;
456 &lib);
457
458 if (isMy)
459 {
460 bRet = isMy(hFile, pgSubject);
461 FreeLibrary(lib);
462 }
463 RegCloseKey(subKey);
464 }
465 }
466 } while (!bRet && r == ERROR_SUCCESS);
468 }
469
470 /* Check for supported functions using CryptSIPDllIsMyFileType2 */
471 if (!bRet)
472 {
473 lstrcpyW(szFullKey, szOID);
474 lstrcatW(szFullKey, szIsMyFile2);
475 r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szFullKey, 0, KEY_READ, &key);
476 if (r == ERROR_SUCCESS)
477 {
478 DWORD index = 0, size;
479 WCHAR subKeyName[MAX_PATH];
480
481 do {
482 size = ARRAY_SIZE(subKeyName);
483 r = RegEnumKeyExW(key, index++, subKeyName, &size, NULL, NULL,
484 NULL, NULL);
485 if (r == ERROR_SUCCESS)
486 {
487 HKEY subKey;
488
489 r = RegOpenKeyExW(key, subKeyName, 0, KEY_READ, &subKey);
490 if (r == ERROR_SUCCESS)
491 {
492 HMODULE lib;
494 CRYPT_LoadSIPFuncFromKey(subKey, &lib);
495
496 if (isMy2)
497 {
498 bRet = isMy2((LPWSTR)FileName, pgSubject);
499 FreeLibrary(lib);
500 }
501 RegCloseKey(subKey);
502 }
503 }
504 } while (!bRet && r == ERROR_SUCCESS);
506 }
507 }
508
509 if (!bRet)
511
512cleanup:
513 /* If we didn't open this one we shouldn't close it (hFile is a copy),
514 * but we should reset the file pointer to its original position.
515 */
516 if (!hFileIn)
518 else
520
521 return bRet;
522}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ARRAY_SIZE(A)
Definition: main.h:33
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
static void * CRYPT_LoadSIPFuncFromKey(HKEY key, HMODULE *pLib)
Definition: sip.c:258
static const WCHAR szOID[]
Definition: sip.c:38
#define CloseHandle
Definition: compat.h:739
#define FILE_BEGIN
Definition: compat.h:761
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetFilePointer
Definition: compat.h:743
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define FreeLibrary(x)
Definition: compat.h:748
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define lstrcpyW
Definition: compat.h:749
#define FILE_SHARE_READ
Definition: compat.h:136
static void cleanup(void)
Definition: main.c:1335
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
BOOL WINAPI SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod)
Definition: fileinfo.c:177
static const GUID catGUID
Definition: crypt.c:1369
static const GUID cabGUID
Definition: crypt.c:1367
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
#define S_OK
Definition: intsafe.h:52
char hdr[14]
Definition: iptest.cpp:33
#define wine_dbgstr_w
Definition: kernel32.h:34
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
BOOL(WINAPI * pfnIsFileSupportedName)(WCHAR *, GUID *)
Definition: mssip.h:138
BOOL(WINAPI * pfnIsFileSupported)(HANDLE, GUID *)
Definition: mssip.h:137
#define SIP_MAX_MAGIC_NUMBER
Definition: mssip.h:45
_In_ HANDLE hFile
Definition: mswsock.h:90
#define KEY_READ
Definition: nt_native.h:1023
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
#define memset(x, y, z)
Definition: compat.h:39
int zero
Definition: sehframes.cpp:29
Definition: copy.c:22
#define FILE_CURRENT
Definition: winbase.h:113
#define TRUST_E_SUBJECT_FORM_UNKNOWN
Definition: winerror.h:3114
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
unsigned char BYTE
Definition: xxhash.c:193

Referenced by CRYPT_QueryEmbeddedMessageObject(), CryptCATOpen(), IsCatalogFile(), SOFTPUB_GetFileSubject(), SOFTPUB_LoadCatalogMessage(), test_sip(), and test_SIPRetrieveSubjectGUID().

◆ CryptSIPRetrieveSubjectGuidForCatalogFile()

BOOL WINAPI CryptSIPRetrieveSubjectGuidForCatalogFile ( LPCWSTR  filename,
HANDLE  handle,
GUID subject 
)

Definition at line 809 of file sip.c.

810{
811 FIXME("(%s %p %p)\n", debugstr_w(filename), handle, subject);
813 return FALSE;
814}
#define FIXME(fmt,...)
Definition: debug.h:111
const char * filename
Definition: ioapi.h:137

◆ CryptSIPVerifyIndirectData()

BOOL WINAPI CryptSIPVerifyIndirectData ( SIP_SUBJECTINFO pSubjectInfo,
SIP_INDIRECT_DATA pIndirectData 
)

Definition at line 792 of file sip.c.

794{
796 BOOL ret = FALSE;
797
798 TRACE("(%p %p)\n", pSubjectInfo, pIndirectData);
799
800 if ((sip = CRYPT_GetCachedSIP(pSubjectInfo->pgSubjectType)))
801 ret = sip->info.pfVerify(pSubjectInfo, pIndirectData);
802 TRACE("returning %d\n", ret);
803 return ret;
804}

Referenced by CryptSIPLoad(), and WINTRUST_SIPPAddProvider().