ReactOS  0.4.14-dev-98-gb0d4763
sip.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wincrypt.h"
#include "winreg.h"
#include "winnls.h"
#include "mssip.h"
#include "winuser.h"
#include "crypt32_private.h"
#include "wine/debug.h"
#include "wine/list.h"
Include dependency graph for sip.c:

Go to the source code of this file.

Classes

struct  _WINE_SIP_PROVIDER
 

Macros

#define CRYPT_SIPREMOVEPROV(key)
 
#define CRYPT_SIPADDPROV(key, field)
 

Typedefs

typedef struct _WINE_SIP_PROVIDER WINE_SIP_PROVIDER
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (crypt)
 
static void CRYPT_guid2wstr (const GUID *guid, LPWSTR wstr)
 
static LONG CRYPT_SIPDeleteFunction (const GUID *guid, LPCWSTR szKey)
 
BOOL WINAPI CryptSIPRemoveProvider (GUID *pgProv)
 
static LONG CRYPT_SIPWriteFunction (const GUID *guid, LPCWSTR szKey, LPCWSTR szDll, LPCWSTR szFunction)
 
BOOL WINAPI CryptSIPAddProvider (SIP_ADD_NEWPROVIDER *psNewProv)
 
static voidCRYPT_LoadSIPFuncFromKey (HKEY key, HMODULE *pLib)
 
BOOL WINAPI CryptSIPRetrieveSubjectGuid (LPCWSTR FileName, HANDLE hFileIn, GUID *pgSubject)
 
static LONG CRYPT_OpenSIPFunctionKey (const GUID *guid, LPCWSTR function, HKEY *key)
 
static voidCRYPT_LoadSIPFunc (const GUID *pgSubject, LPCWSTR function, HMODULE *pLib)
 
static void CRYPT_CacheSIP (const GUID *pgSubject, SIP_DISPATCH_INFO *info)
 
static WINE_SIP_PROVIDERCRYPT_GetCachedSIP (const GUID *pgSubject)
 
static BOOL CRYPT_IsSIPCached (const GUID *pgSubject)
 
void crypt_sip_free (void)
 
static BOOL CRYPT_LoadSIP (const GUID *pgSubject)
 
BOOL WINAPI CryptSIPLoad (const GUID *pgSubject, DWORD dwFlags, SIP_DISPATCH_INFO *pSipDispatch)
 
BOOL WINAPI CryptSIPCreateIndirectData (SIP_SUBJECTINFO *pSubjectInfo, DWORD *pcbIndirectData, SIP_INDIRECT_DATA *pIndirectData)
 
BOOL WINAPI CryptSIPGetSignedDataMsg (SIP_SUBJECTINFO *pSubjectInfo, DWORD *pdwEncodingType, DWORD dwIndex, DWORD *pcbSignedDataMsg, BYTE *pbSignedDataMsg)
 
BOOL WINAPI CryptSIPPutSignedDataMsg (SIP_SUBJECTINFO *pSubjectInfo, DWORD pdwEncodingType, DWORD *pdwIndex, DWORD cbSignedDataMsg, BYTE *pbSignedDataMsg)
 
BOOL WINAPI CryptSIPRemoveSignedDataMsg (SIP_SUBJECTINFO *pSubjectInfo, DWORD dwIndex)
 
BOOL WINAPI CryptSIPVerifyIndirectData (SIP_SUBJECTINFO *pSubjectInfo, SIP_INDIRECT_DATA *pIndirectData)
 
BOOL WINAPI CryptSIPRetrieveSubjectGuidForCatalogFile (LPCWSTR filename, HANDLE handle, GUID *subject)
 

Variables

static const WCHAR szOID []
 
static const WCHAR szPutSigned []
 
static const WCHAR szGetSigned []
 
static const WCHAR szRemoveSigned []
 
static const WCHAR szCreate []
 
static const WCHAR szVerify []
 
static const WCHAR szIsMyFile []
 
static const WCHAR szIsMyFile2 []
 
static const WCHAR szDllName [] = { 'D','l','l',0 }
 
static const WCHAR szFuncName [] = { 'F','u','n','c','N','a','m','e',0 }
 
static struct list providers = { &providers, &providers }
 
static CRITICAL_SECTION providers_cs = { &providers_cs_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG providers_cs_debug
 

Macro Definition Documentation

◆ CRYPT_SIPADDPROV

#define CRYPT_SIPADDPROV (   key,
  field 
)
Value:
r = CRYPT_SIPWriteFunction( psNewProv->pgSubject, key, \
psNewProv->pwszDLLFileName, psNewProv->field); \
if (r != ERROR_SUCCESS) goto end_function
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static LONG CRYPT_SIPWriteFunction(const GUID *guid, LPCWSTR szKey, LPCWSTR szDll, LPCWSTR szFunction)
Definition: sip.c:155
Definition: path.c:42

◆ CRYPT_SIPREMOVEPROV

#define CRYPT_SIPREMOVEPROV (   key)
Value:
if (r != ERROR_SUCCESS) remove_error = r
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static LONG CRYPT_SIPDeleteFunction(const GUID *guid, LPCWSTR szKey)
Definition: sip.c:81
Definition: path.c:42

Typedef Documentation

◆ WINE_SIP_PROVIDER

Function Documentation

◆ CRYPT_CacheSIP()

static void CRYPT_CacheSIP ( const GUID pgSubject,
SIP_DISPATCH_INFO info 
)
static

Definition at line 575 of file sip.c.

576 {
578 
579  if (prov)
580  {
581  prov->subject = *pgSubject;
582  prov->info = *info;
584  list_add_tail(&providers, &prov->entry);
586  }
587 }
SIP_DISPATCH_INFO info
Definition: sip.c:560
static struct list providers
Definition: sip.c:564
static CRITICAL_SECTION providers_cs
Definition: sip.c:565
struct list entry
Definition: sip.c:561
GUID subject
Definition: sip.c:559
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct _test_info info[]
Definition: SetCursorPos.c:19
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by CRYPT_LoadSIP().

◆ CRYPT_GetCachedSIP()

static WINE_SIP_PROVIDER* CRYPT_GetCachedSIP ( const GUID pgSubject)
static

Definition at line 589 of file sip.c.

590 {
591  WINE_SIP_PROVIDER *provider = NULL, *ret = NULL;
592 
595  {
596  if (IsEqualGUID(pgSubject, &provider->subject))
597  break;
598  }
599  if (provider && IsEqualGUID(pgSubject, &provider->subject))
600  ret = provider;
602  return ret;
603 }
static struct list providers
Definition: sip.c:564
static CRITICAL_SECTION providers_cs
Definition: sip.c:565
GUID subject
Definition: sip.c:559
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
int ret
uint32_t entry
Definition: isohybrid.c:63
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by CRYPT_IsSIPCached(), CryptSIPCreateIndirectData(), CryptSIPGetSignedDataMsg(), CryptSIPPutSignedDataMsg(), CryptSIPRemoveSignedDataMsg(), and CryptSIPVerifyIndirectData().

◆ CRYPT_guid2wstr()

static void CRYPT_guid2wstr ( const GUID guid,
LPWSTR  wstr 
)
static

Definition at line 65 of file sip.c.

66 {
67  char str[40];
68 
69  sprintf(str, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
70  guid->Data1, guid->Data2, guid->Data3,
71  guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
72  guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
73  MultiByteToWideChar( CP_ACP, 0, str, -1, wstr, 40 );
74 }
#define CP_ACP
Definition: compat.h:99
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const GUID * guid
const WCHAR * str
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by CRYPT_OpenSIPFunctionKey(), CRYPT_SIPDeleteFunction(), and CRYPT_SIPWriteFunction().

◆ CRYPT_IsSIPCached()

static BOOL CRYPT_IsSIPCached ( const GUID pgSubject)
inlinestatic

Definition at line 605 of file sip.c.

606 {
607  return CRYPT_GetCachedSIP(pgSubject) != NULL;
608 }
smooth NULL
Definition: ftsmooth.c:416
static WINE_SIP_PROVIDER * CRYPT_GetCachedSIP(const GUID *pgSubject)
Definition: sip.c:589

Referenced by CryptSIPLoad().

◆ CRYPT_LoadSIP()

static BOOL CRYPT_LoadSIP ( const GUID pgSubject)
static

Definition at line 626 of file sip.c.

627 {
628  SIP_DISPATCH_INFO sip = { 0 };
629  HMODULE lib = NULL, temp = NULL;
630 
631  sip.pfGet = CRYPT_LoadSIPFunc(pgSubject, szGetSigned, &lib);
632  if (!sip.pfGet)
633  goto error;
634  sip.pfPut = CRYPT_LoadSIPFunc(pgSubject, szPutSigned, &temp);
635  if (!sip.pfPut || temp != lib)
636  goto error;
637  FreeLibrary(temp);
638  temp = NULL;
639  sip.pfCreate = CRYPT_LoadSIPFunc(pgSubject, szCreate, &temp);
640  if (!sip.pfCreate || temp != lib)
641  goto error;
642  FreeLibrary(temp);
643  temp = NULL;
644  sip.pfVerify = CRYPT_LoadSIPFunc(pgSubject, szVerify, &temp);
645  if (!sip.pfVerify || temp != lib)
646  goto error;
647  FreeLibrary(temp);
648  temp = NULL;
649  sip.pfRemove = CRYPT_LoadSIPFunc(pgSubject, szRemoveSigned, &temp);
650  if (!sip.pfRemove || temp != lib)
651  goto error;
652  FreeLibrary(temp);
653  sip.hSIP = lib;
654  CRYPT_CacheSIP(pgSubject, &sip);
655  return TRUE;
656 
657 error:
658  FreeLibrary(lib);
659  FreeLibrary(temp);
661  return FALSE;
662 }
#define TRUE
Definition: types.h:120
#define error(str)
Definition: mkdosfs.c:1605
pCryptSIPGetSignedDataMsg pfGet
Definition: mssip.h:129
pCryptSIPCreateIndirectData pfCreate
Definition: mssip.h:131
static const WCHAR szGetSigned[]
Definition: sip.c:48
pCryptSIPPutSignedDataMsg pfPut
Definition: mssip.h:130
static const WCHAR szRemoveSigned[]
Definition: sip.c:50
static const WCHAR szPutSigned[]
Definition: sip.c:46
pCryptSIPVerifyIndirectData pfVerify
Definition: mssip.h:132
smooth NULL
Definition: ftsmooth.c:416
static void * CRYPT_LoadSIPFunc(const GUID *pgSubject, LPCWSTR function, HMODULE *pLib)
Definition: sip.c:539
#define FreeLibrary(x)
Definition: compat.h:405
#define SetLastError(x)
Definition: compat.h:409
static void CRYPT_CacheSIP(const GUID *pgSubject, SIP_DISPATCH_INFO *info)
Definition: sip.c:575
#define TRUST_E_SUBJECT_FORM_UNKNOWN
Definition: winerror.h:3114
static calc_node_t temp
Definition: rpn_ieee.c:38
pCryptSIPRemoveSignedDataMsg pfRemove
Definition: mssip.h:133
static const WCHAR szCreate[]
Definition: sip.c:52
static const WCHAR szVerify[]
Definition: sip.c:54

Referenced by CryptSIPLoad().

◆ CRYPT_LoadSIPFunc()

static void* CRYPT_LoadSIPFunc ( const GUID pgSubject,
LPCWSTR  function,
HMODULE pLib 
)
static

Definition at line 539 of file sip.c.

541 {
542  LONG r;
543  HKEY key;
544  void *func = NULL;
545 
546  TRACE("(%s, %s)\n", debugstr_guid(pgSubject), debugstr_w(function));
547 
548  r = CRYPT_OpenSIPFunctionKey(pgSubject, function, &key);
549  if (!r)
550  {
552  RegCloseKey(key);
553  }
554  TRACE("returning %p\n", func);
555  return func;
556 }
GLenum func
Definition: glext.h:6028
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
static LONG CRYPT_OpenSIPFunctionKey(const GUID *guid, LPCWSTR function, HKEY *key)
Definition: sip.c:524
#define TRACE(s)
Definition: solgame.cpp:4
static void * CRYPT_LoadSIPFuncFromKey(HKEY key, HMODULE *pLib)
Definition: sip.c:258
HKEY key
Definition: reg.c:42
Definition: path.c:42

Referenced by CRYPT_LoadSIP().

◆ CRYPT_LoadSIPFuncFromKey()

static void* CRYPT_LoadSIPFuncFromKey ( HKEY  key,
HMODULE pLib 
)
static

Definition at line 258 of file sip.c.

259 {
260  LONG r;
261  DWORD size;
262  WCHAR dllName[MAX_PATH];
263  char functionName[MAX_PATH];
264  HMODULE lib;
265  void *func = NULL;
266 
267  /* Read the DLL entry */
268  size = sizeof(dllName);
269  r = RegQueryValueExW(key, szDllName, NULL, NULL, (LPBYTE)dllName, &size);
270  if (r) goto end;
271 
272  /* Read the Function entry */
273  size = sizeof(functionName);
274  r = RegQueryValueExA(key, "FuncName", NULL, NULL, (LPBYTE)functionName,
275  &size);
276  if (r) goto end;
277 
278  lib = LoadLibraryW(dllName);
279  if (!lib)
280  goto end;
281  func = GetProcAddress(lib, functionName);
282  if (func)
283  *pLib = lib;
284  else
285  FreeLibrary(lib);
286 
287 end:
288  return func;
289 }
GLenum func
Definition: glext.h:6028
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
static const WCHAR szDllName[]
Definition: sip.c:61
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint end
Definition: gl.h:1545
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:405
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GetProcAddress(x, y)
Definition: compat.h:410
Definition: path.c:42

Referenced by CRYPT_LoadSIPFunc(), and CryptSIPRetrieveSubjectGuid().

◆ CRYPT_OpenSIPFunctionKey()

static LONG CRYPT_OpenSIPFunctionKey ( const GUID guid,
LPCWSTR  function,
HKEY key 
)
static

Definition at line 524 of file sip.c.

526 {
527  WCHAR szFullKey[ 0x100 ];
528 
529  lstrcpyW(szFullKey, szOID);
530  lstrcatW(szFullKey, function);
531  CRYPT_guid2wstr(guid, &szFullKey[lstrlenW(szFullKey)]);
532  return RegOpenKeyExW(HKEY_LOCAL_MACHINE, szFullKey, 0, KEY_READ, key);
533 }
#define KEY_READ
Definition: nt_native.h:1023
static const WCHAR szOID[]
Definition: sip.c:38
#define lstrlenW
Definition: compat.h:407
const GUID * guid
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define lstrcpyW
Definition: compat.h:406
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static void CRYPT_guid2wstr(const GUID *guid, LPWSTR wstr)
Definition: sip.c:65
Definition: path.c:42
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CRYPT_LoadSIPFunc().

◆ crypt_sip_free()

void crypt_sip_free ( void  )

Definition at line 610 of file sip.c.

611 {
612  WINE_SIP_PROVIDER *prov, *next;
613 
615  {
616  list_remove(&prov->entry);
617  FreeLibrary(prov->info.hSIP);
618  CryptMemFree(prov);
619  }
621 }
SIP_DISPATCH_INFO info
Definition: sip.c:560
static struct list providers
Definition: sip.c:564
static CRITICAL_SECTION providers_cs
Definition: sip.c:565
struct list entry
Definition: sip.c:561
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define FreeLibrary(x)
Definition: compat.h:405
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
uint32_t entry
Definition: isohybrid.c:63
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141

Referenced by DllMain().

◆ CRYPT_SIPDeleteFunction()

static LONG CRYPT_SIPDeleteFunction ( const GUID guid,
LPCWSTR  szKey 
)
static

Definition at line 81 of file sip.c.

82 {
83  WCHAR szFullKey[ 0x100 ];
85 
86  /* max length of szFullKey depends on our code only, so we won't overrun */
87  lstrcpyW( szFullKey, szOID );
88  lstrcatW( szFullKey, szKey );
89  CRYPT_guid2wstr( guid, &szFullKey[ lstrlenW( szFullKey ) ] );
90 
91  r = RegDeleteKeyW(HKEY_LOCAL_MACHINE, szFullKey);
92 
93  return r;
94 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
static const WCHAR szOID[]
Definition: sip.c:38
#define lstrlenW
Definition: compat.h:407
const GUID * guid
long LONG
Definition: pedump.c:60
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define lstrcpyW
Definition: compat.h:406
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static void CRYPT_guid2wstr(const GUID *guid, LPWSTR wstr)
Definition: sip.c:65
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

◆ CRYPT_SIPWriteFunction()

static LONG CRYPT_SIPWriteFunction ( const GUID guid,
LPCWSTR  szKey,
LPCWSTR  szDll,
LPCWSTR  szFunction 
)
static

Definition at line 155 of file sip.c.

157 {
158  WCHAR szFullKey[ 0x100 ];
159  LONG r = ERROR_SUCCESS;
160  HKEY hKey;
161 
162  if( !szFunction )
163  return ERROR_SUCCESS;
164 
165  /* max length of szFullKey depends on our code only, so we won't overrun */
166  lstrcpyW( szFullKey, szOID );
167  lstrcatW( szFullKey, szKey );
168  CRYPT_guid2wstr( guid, &szFullKey[ lstrlenW( szFullKey ) ] );
169 
170  TRACE("key is %s\n", debugstr_w( szFullKey ) );
171 
172  r = RegCreateKeyW( HKEY_LOCAL_MACHINE, szFullKey, &hKey );
173  if( r != ERROR_SUCCESS ) goto error_close_key;
174 
175  /* write the values */
176  r = RegSetValueExW( hKey, szFuncName, 0, REG_SZ, (const BYTE*) szFunction,
177  ( lstrlenW( szFunction ) + 1 ) * sizeof (WCHAR) );
178  if( r != ERROR_SUCCESS ) goto error_close_key;
179  r = RegSetValueExW( hKey, szDllName, 0, REG_SZ, (const BYTE*) szDll,
180  ( lstrlenW( szDll ) + 1) * sizeof (WCHAR) );
181 
182 error_close_key:
183 
184  RegCloseKey( hKey );
185 
186  return r;
187 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szDllName[]
Definition: sip.c:61
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const WCHAR szOID[]
Definition: sip.c:38
#define lstrlenW
Definition: compat.h:407
const GUID * guid
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: mem.h:68
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define lstrcpyW
Definition: compat.h:406
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static void CRYPT_guid2wstr(const GUID *guid, LPWSTR wstr)
Definition: sip.c:65
static const WCHAR szFuncName[]
Definition: sip.c:62
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

◆ CryptSIPAddProvider()

BOOL WINAPI CryptSIPAddProvider ( SIP_ADD_NEWPROVIDER psNewProv)

Definition at line 207 of file sip.c.

208 {
209  LONG r = ERROR_SUCCESS;
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 
247 end_function:
248 
249  if (r != ERROR_SUCCESS)
250  {
251  SetLastError(r);
252  return FALSE;
253  }
254 
255  return TRUE;
256 }
static const WCHAR szIsMyFile2[]
Definition: sip.c:58
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
WCHAR * pwszGetFuncName
Definition: mssip.h:152
WCHAR * pwszVerifyFuncName
Definition: mssip.h:155
#define CRYPT_SIPADDPROV(key, field)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
WCHAR * pwszDLLFileName
Definition: mssip.h:147
static const WCHAR szGetSigned[]
Definition: sip.c:48
static const WCHAR szRemoveSigned[]
Definition: sip.c:50
static const WCHAR szIsMyFile[]
Definition: sip.c:56
GUID * pgSubject
Definition: mssip.h:145
WCHAR * pwszPutFuncName
Definition: mssip.h:153
long LONG
Definition: pedump.c:60
static const WCHAR szPutSigned[]
Definition: sip.c:46
#define debugstr_w
Definition: kernel32.h:32
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:409
WCHAR * pwszIsFunctionNameFmt2
Definition: mssip.h:158
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
WCHAR * pwszRemoveFuncName
Definition: mssip.h:156
WCHAR * pwszCreateFuncName
Definition: mssip.h:154
WCHAR * pwszMagicNumber
Definition: mssip.h:148
static const WCHAR szCreate[]
Definition: sip.c:52
static const WCHAR szVerify[]
Definition: sip.c:54
WCHAR * pwszIsFunctionName
Definition: mssip.h:150

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 {
718  WINE_SIP_PROVIDER *sip;
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 }
SIP_DISPATCH_INFO info
Definition: sip.c:560
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
pCryptSIPCreateIndirectData pfCreate
Definition: mssip.h:131
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
GUID * pgSubjectType
Definition: mssip.h:52
#define SetLastError(x)
Definition: compat.h:409
int ret
static WINE_SIP_PROVIDER * CRYPT_GetCachedSIP(const GUID *pgSubject)
Definition: sip.c:589

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 {
740  WINE_SIP_PROVIDER *sip;
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 }
SIP_DISPATCH_INFO info
Definition: sip.c:560
pCryptSIPGetSignedDataMsg pfGet
Definition: mssip.h:129
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
GUID * pgSubjectType
Definition: mssip.h:52
int ret
static WINE_SIP_PROVIDER * CRYPT_GetCachedSIP(const GUID *pgSubject)
Definition: sip.c:589

Referenced by CryptSIPLoad(), and WINTRUST_SIPPAddProvider().

◆ CryptSIPLoad()

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

Definition at line 690 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;
707  pSipDispatch->pfRemove = CryptSIPRemoveSignedDataMsg;
708 
709  return TRUE;
710 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
BOOL WINAPI CryptSIPVerifyIndirectData(SIP_SUBJECTINFO *pSubjectInfo, SIP_INDIRECT_DATA *pIndirectData)
Definition: sip.c:792
pCryptSIPGetSignedDataMsg pfGet
Definition: mssip.h:129
pCryptSIPCreateIndirectData pfCreate
Definition: mssip.h:131
pCryptSIPPutSignedDataMsg pfPut
Definition: mssip.h:130
BOOL WINAPI CryptSIPPutSignedDataMsg(SIP_SUBJECTINFO *pSubjectInfo, DWORD pdwEncodingType, DWORD *pdwIndex, DWORD cbSignedDataMsg, BYTE *pbSignedDataMsg)
Definition: sip.c:756
pCryptSIPVerifyIndirectData pfVerify
Definition: mssip.h:132
BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO *pSubjectInfo, DWORD *pdwEncodingType, DWORD dwIndex, DWORD *pcbSignedDataMsg, BYTE *pbSignedDataMsg)
Definition: sip.c:737
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:409
BOOL WINAPI CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO *pSubjectInfo, DWORD dwIndex)
Definition: sip.c:775
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL WINAPI CryptSIPCreateIndirectData(SIP_SUBJECTINFO *pSubjectInfo, DWORD *pcbIndirectData, SIP_INDIRECT_DATA *pIndirectData)
Definition: sip.c:715
pCryptSIPRemoveSignedDataMsg pfRemove
Definition: mssip.h:133
static BOOL CRYPT_LoadSIP(const GUID *pgSubject)
Definition: sip.c:626
static BOOL CRYPT_IsSIPCached(const GUID *pgSubject)
Definition: sip.c:605

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 {
759  WINE_SIP_PROVIDER *sip;
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 }
SIP_DISPATCH_INFO info
Definition: sip.c:560
pCryptSIPPutSignedDataMsg pfPut
Definition: mssip.h:130
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
GUID * pgSubjectType
Definition: mssip.h:52
int ret
static WINE_SIP_PROVIDER * CRYPT_GetCachedSIP(const GUID *pgSubject)
Definition: sip.c:589

Referenced by CryptSIPLoad(), and WINTRUST_SIPPAddProvider().

◆ CryptSIPRemoveProvider()

BOOL WINAPI CryptSIPRemoveProvider ( GUID pgProv)

Definition at line 112 of file sip.c.

113 {
114  LONG r = ERROR_SUCCESS;
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 }
static const WCHAR szIsMyFile2[]
Definition: sip.c:58
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const WCHAR szGetSigned[]
Definition: sip.c:48
static const WCHAR szRemoveSigned[]
Definition: sip.c:50
static const WCHAR szIsMyFile[]
Definition: sip.c:56
long LONG
Definition: pedump.c:60
static const WCHAR szPutSigned[]
Definition: sip.c:46
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:409
#define CRYPT_SIPREMOVEPROV(key)
static const WCHAR szCreate[]
Definition: sip.c:52
static const WCHAR szVerify[]
Definition: sip.c:54

Referenced by DllUnregisterServer(), and test_AddRemoveProvider().

◆ CryptSIPRemoveSignedDataMsg()

BOOL WINAPI CryptSIPRemoveSignedDataMsg ( SIP_SUBJECTINFO pSubjectInfo,
DWORD  dwIndex 
)

Definition at line 775 of file sip.c.

777 {
778  WINE_SIP_PROVIDER *sip;
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 }
SIP_DISPATCH_INFO info
Definition: sip.c:560
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
GUID * pgSubjectType
Definition: mssip.h:52
int ret
static WINE_SIP_PROVIDER * CRYPT_GetCachedSIP(const GUID *pgSubject)
Definition: sip.c:589
pCryptSIPRemoveSignedDataMsg pfRemove
Definition: mssip.h:133

Referenced by CryptSIPLoad(), and WINTRUST_SIPPAddProvider().

◆ CryptSIPRetrieveSubjectGuid()

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

Definition at line 310 of file sip.c.

311 {
312  HANDLE hFile;
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 ];
324  LONG r = ERROR_SUCCESS;
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);
467  RegCloseKey(key);
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;
493  pfnIsFileSupportedName isMy2 =
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);
505  RegCloseKey(key);
506  }
507  }
508 
509  if (!bRet)
511 
512 cleanup:
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 }
static const WCHAR szIsMyFile2[]
Definition: sip.c:58
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod)
Definition: fileinfo.c:327
#define SIP_MAX_MAGIC_NUMBER
Definition: mssip.h:45
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
char hdr[14]
Definition: iptest.cpp:33
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FILE_CURRENT
Definition: winbase.h:113
BOOL(WINAPI * pfnIsFileSupported)(HANDLE, GUID *)
Definition: mssip.h:137
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
static const WCHAR szOID[]
Definition: sip.c:38
#define FILE_SHARE_READ
Definition: compat.h:125
static const WCHAR szIsMyFile[]
Definition: sip.c:56
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
static const GUID catGUID
Definition: crypt.c:1359
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define OPEN_EXISTING
Definition: compat.h:426
static const GUID cabGUID
Definition: crypt.c:1357
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:405
GLsizeiptr size
Definition: glext.h:5919
static void * CRYPT_LoadSIPFuncFromKey(HKEY key, HMODULE *pLib)
Definition: sip.c:258
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
#define SetLastError(x)
Definition: compat.h:409
Definition: id3.c:18
static double zero
Definition: j0_y0.c:96
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
HKEY key
Definition: reg.c:42
unsigned char BYTE
Definition: mem.h:68
#define GENERIC_READ
Definition: compat.h:124
_In_ HANDLE hFile
Definition: mswsock.h:90
#define S_OK
Definition: intsafe.h:59
#define FILE_BEGIN
Definition: winbase.h:112
#define lstrcpyW
Definition: compat.h:406
#define TRUST_E_SUBJECT_FORM_UNKNOWN
Definition: winerror.h:3114
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL(WINAPI * pfnIsFileSupportedName)(WCHAR *, GUID *)
Definition: mssip.h:138
#define CreateFileW
Definition: compat.h:400
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
char * cleanup(char *str)
Definition: wpickclick.c:99
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:2527
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define memset(x, y, z)
Definition: compat.h:39
Definition: path.c:42
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

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 ERROR_INVALID_PARAMETER
Definition: compat.h:91
const char * filename
Definition: ioapi.h:135
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409

◆ CryptSIPVerifyIndirectData()

BOOL WINAPI CryptSIPVerifyIndirectData ( SIP_SUBJECTINFO pSubjectInfo,
SIP_INDIRECT_DATA pIndirectData 
)

Definition at line 792 of file sip.c.

794 {
795  WINE_SIP_PROVIDER *sip;
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 }
SIP_DISPATCH_INFO info
Definition: sip.c:560
unsigned int BOOL
Definition: ntddk_ex.h:94
pCryptSIPVerifyIndirectData pfVerify
Definition: mssip.h:132
#define TRACE(s)
Definition: solgame.cpp:4
GUID * pgSubjectType
Definition: mssip.h:52
int ret
static WINE_SIP_PROVIDER * CRYPT_GetCachedSIP(const GUID *pgSubject)
Definition: sip.c:589

Referenced by CryptSIPLoad(), and WINTRUST_SIPPAddProvider().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( crypt  )

Variable Documentation

◆ providers

struct list providers = { &providers, &providers }
static

Definition at line 564 of file sip.c.

Referenced by CRYPT_CacheSIP(), CRYPT_GetCachedSIP(), crypt_sip_free(), and wnetInit().

◆ providers_cs

static CRITICAL_SECTION providers_cs = { &providers_cs_debug, -1, 0, 0, 0, 0 }
static

Definition at line 565 of file sip.c.

Referenced by CRYPT_CacheSIP(), CRYPT_GetCachedSIP(), and crypt_sip_free().

◆ providers_cs_debug

CRITICAL_SECTION_DEBUG providers_cs_debug
static
Initial value:
=
{
0, 0, &providers_cs,
0, 0, { (DWORD_PTR)(__FILE__ ": providers_cs") }
}
static CRITICAL_SECTION providers_cs
Definition: sip.c:565
#define DWORD_PTR
Definition: treelist.c:76
static CRITICAL_SECTION_DEBUG providers_cs_debug
Definition: sip.c:566
LIST_ENTRY ProcessLocksList
Definition: winbase.h:855

Definition at line 566 of file sip.c.

◆ szCreate

const WCHAR szCreate[]
static
Initial value:
= {
'C','r','e','a','t','e','I','n','d','i','r','e','c','t','D','a','t','a','\\',0}

Definition at line 52 of file sip.c.

Referenced by CRYPT_LoadSIP(), CryptSIPAddProvider(), and CryptSIPRemoveProvider().

◆ szDllName

const WCHAR szDllName[] = { 'D','l','l',0 }
static

◆ szFuncName

const WCHAR szFuncName[] = { 'F','u','n','c','N','a','m','e',0 }
static

Definition at line 62 of file sip.c.

Referenced by CRYPT_GetFuncFromReg(), and CRYPT_SIPWriteFunction().

◆ szGetSigned

const WCHAR szGetSigned[]
static
Initial value:
= {
'G','e','t','S','i','g','n','e','d','D','a','t','a','M','s','g','\\',0}

Definition at line 48 of file sip.c.

Referenced by CRYPT_LoadSIP(), CryptSIPAddProvider(), and CryptSIPRemoveProvider().

◆ szIsMyFile

const WCHAR szIsMyFile[]
static
Initial value:
= {
'I','s','M','y','F','i','l','e','T','y','p','e','\\',0}

Definition at line 56 of file sip.c.

Referenced by CryptSIPAddProvider(), CryptSIPRemoveProvider(), and CryptSIPRetrieveSubjectGuid().

◆ szIsMyFile2

const WCHAR szIsMyFile2[]
static
Initial value:
= {
'I','s','M','y','F','i','l','e','T','y','p','e','2','\\',0}

Definition at line 58 of file sip.c.

Referenced by CryptSIPAddProvider(), CryptSIPRemoveProvider(), and CryptSIPRetrieveSubjectGuid().

◆ szOID

const WCHAR szOID[]
static
Initial value:
= {
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
'C','r','y','p','t','o','g','r','a','p','h','y','\\',
'O','I','D','\\',
'E','n','c','o','d','i','n','g','T','y','p','e',' ','0','\\',
'C','r','y','p','t','S','I','P','D','l','l', 0 }

Definition at line 38 of file sip.c.

Referenced by CRYPT_OpenSIPFunctionKey(), CRYPT_SIPDeleteFunction(), CRYPT_SIPWriteFunction(), and CryptSIPRetrieveSubjectGuid().

◆ szPutSigned

const WCHAR szPutSigned[]
static
Initial value:
= {
'P','u','t','S','i','g','n','e','d','D','a','t','a','M','s','g','\\',0}

Definition at line 46 of file sip.c.

Referenced by CRYPT_LoadSIP(), CryptSIPAddProvider(), and CryptSIPRemoveProvider().

◆ szRemoveSigned

const WCHAR szRemoveSigned[]
static
Initial value:
= {
'R','e','m','o','v','e','S','i','g','n','e','d','D','a','t','a','M','s','g','\\',0}

Definition at line 50 of file sip.c.

Referenced by CRYPT_LoadSIP(), CryptSIPAddProvider(), and CryptSIPRemoveProvider().

◆ szVerify

const WCHAR szVerify[]
static
Initial value:
= {
'V','e','r','i','f','y','I','n','d','i','r','e','c','t','D','a','t','a','\\',0}

Definition at line 54 of file sip.c.

Referenced by CRYPT_LoadSIP(), CryptSIPAddProvider(), and CryptSIPRemoveProvider().