ReactOS  0.4.14-dev-593-g1793dcc
wintrust_main.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
#include "guiddef.h"
#include "wintrust.h"
#include "softpub.h"
#include "mscat.h"
#include "objbase.h"
#include "winuser.h"
#include "cryptdlg.h"
#include "cryptuiapi.h"
#include "wintrust_priv.h"
#include "wine/debug.h"
Include dependency graph for wintrust_main.c:

Go to the source code of this file.

Classes

struct  wintrust_step
 

Macros

#define NONAMELESSUNION
 

Typedefs

typedef HRESULT(WINAPIwintrust_step_func) (CRYPT_PROVIDER_DATA *data)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wintrust)
 
void *WINAPI WINTRUST_Alloc (DWORD cb)
 
static voidWINTRUST_ReAlloc (void *ptr, DWORD cb) __WINE_ALLOC_SIZE(2)
 
void WINAPI WINTRUST_Free (void *p)
 
BOOL WINAPI TrustIsCertificateSelfSigned (PCCERT_CONTEXT cert)
 
static DWORD WINTRUST_ExecuteSteps (const struct wintrust_step *steps, DWORD numSteps, CRYPT_PROVIDER_DATA *provData)
 
static CRYPT_PROVIDER_DATAWINTRUST_AllocateProviderData (void)
 
static DWORD WINTRUST_AddTrustStepsFromFunctions (struct wintrust_step *steps, const CRYPT_PROVIDER_FUNCTIONS *psPfns)
 
static LONG WINTRUST_DefaultVerify (HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
 
static LONG WINTRUST_DefaultClose (HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
 
static LONG WINTRUST_DefaultVerifyAndClose (HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
 
static LONG WINTRUST_PublishedSoftware (HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
 
static HRESULT WINAPI WINTRUST_CertVerifyObjTrust (CRYPT_PROVIDER_DATA *data)
 
static LONG WINTRUST_CertVerify (HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
 
static LONG WINTRUST_CertVerifyAndClose (HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
 
static LONG WINTRUST_CertActionVerify (HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
 
static void dump_file_info (WINTRUST_FILE_INFO *pFile)
 
static void dump_catalog_info (WINTRUST_CATALOG_INFO *catalog)
 
static void dump_blob_info (WINTRUST_BLOB_INFO *blob)
 
static void dump_sgnr_info (WINTRUST_SGNR_INFO *sgnr)
 
static void dump_cert_info (WINTRUST_CERT_INFO *cert)
 
static void dump_wintrust_data (WINTRUST_DATA *data)
 
LONG WINAPI WinVerifyTrust (HWND hwnd, GUID *ActionID, LPVOID ActionData)
 
HRESULT WINAPI WinVerifyTrustEx (HWND hwnd, GUID *ActionID, WINTRUST_DATA *ActionData)
 
CRYPT_PROVIDER_SGNR *WINAPI WTHelperGetProvSignerFromChain (CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSigner, DWORD idxCounterSigner)
 
CRYPT_PROVIDER_CERT *WINAPI WTHelperGetProvCertFromChain (CRYPT_PROVIDER_SGNR *pSgnr, DWORD idxCert)
 
CRYPT_PROVIDER_PRIVDATA *WINAPI WTHelperGetProvPrivateDataFromChain (CRYPT_PROVIDER_DATA *pProvData, GUID *pgProviderID)
 
CRYPT_PROVIDER_DATA *WINAPI WTHelperProvDataFromStateData (HANDLE hStateData)
 
LPCWSTR WINAPI WTHelperGetFileName (WINTRUST_DATA *data)
 
HANDLE WINAPI WTHelperGetFileHandle (WINTRUST_DATA *data)
 
static BOOL WINAPI WINTRUST_enumUsages (PCCRYPT_OID_INFO pInfo, void *pvArg)
 
BOOL WINAPI WTHelperGetKnownUsages (DWORD action, PCCRYPT_OID_INFO **usages)
 
void WINAPI WintrustGetRegPolicyFlags (DWORD *pdwPolicyFlags)
 
BOOL WINAPI WintrustSetRegPolicyFlags (DWORD dwPolicyFlags)
 
BOOL WINAPI WINTRUST_AddStore (CRYPT_PROVIDER_DATA *data, HCERTSTORE store)
 
BOOL WINAPI WINTRUST_AddSgnr (CRYPT_PROVIDER_DATA *data, BOOL fCounterSigner, DWORD idxSigner, CRYPT_PROVIDER_SGNR *sgnr)
 
BOOL WINAPI WINTRUST_AddCert (CRYPT_PROVIDER_DATA *data, DWORD idxSigner, BOOL fCounterSigner, DWORD idxCounterSigner, PCCERT_CONTEXT pCert2Add)
 
BOOL WINAPI WINTRUST_AddPrivData (CRYPT_PROVIDER_DATA *data, CRYPT_PROVIDER_PRIVDATA *pPrivData2Add)
 
BOOL WINAPI OpenPersonalTrustDBDialog (HWND hwnd)
 
HRESULT WINAPI WTHelperCertCheckValidSignature (CRYPT_PROVIDER_DATA *pProvData)
 
BOOL WINAPI IsCatalogFile (HANDLE hFile, WCHAR *pwszFileName)
 
HRESULT WINAPI FindCertsByIssuer (PCERT_CHAIN pCertChains, DWORD *pcbCertChains, DWORD *pcCertChains, BYTE *pbEncodedIssuerName, DWORD cbEncodedIssuerName, LPCWSTR pwszPurpose, DWORD dwKeySpec)
 

Variables

static const WCHAR Software_Publishing []
 
static const WCHAR State [] = { 'S','t','a','t','e',0 }
 

Macro Definition Documentation

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 22 of file wintrust_main.c.

Typedef Documentation

◆ wintrust_step_func

typedef HRESULT(WINAPI * wintrust_step_func) (CRYPT_PROVIDER_DATA *data)

Definition at line 179 of file wintrust_main.c.

Function Documentation

◆ dump_blob_info()

static void dump_blob_info ( WINTRUST_BLOB_INFO blob)
static

Definition at line 585 of file wintrust_main.c.

586 {
587  TRACE("%p\n", blob);
588  if (blob)
589  {
590  TRACE("cbStruct: %d\n", blob->cbStruct);
591  TRACE("gSubject: %s\n", debugstr_guid(&blob->gSubject));
592  TRACE("pcwszDisplayName: %s\n", debugstr_w(blob->pcwszDisplayName));
593  TRACE("cbMemObject: %d\n", blob->cbMemObject);
594  TRACE("pbMemObject: %p\n", blob->pbMemObject);
595  TRACE("cbMemSignedMsg: %d\n", blob->cbMemSignedMsg);
596  TRACE("pbMemSignedMsg: %p\n", blob->pbMemSignedMsg);
597  }
598 }
Definition: image.c:133
#define debugstr_w
Definition: kernel32.h:32
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by dump_wintrust_data().

◆ dump_catalog_info()

static void dump_catalog_info ( WINTRUST_CATALOG_INFO catalog)
static

Definition at line 566 of file wintrust_main.c.

567 {
568  TRACE("%p\n", catalog);
569  if (catalog)
570  {
571  TRACE("cbStruct: %d\n", catalog->cbStruct);
572  TRACE("dwCatalogVersion: %d\n", catalog->dwCatalogVersion);
573  TRACE("pcwszCatalogFilePath: %s\n",
574  debugstr_w(catalog->pcwszCatalogFilePath));
575  TRACE("pcwszMemberTag: %s\n", debugstr_w(catalog->pcwszMemberTag));
576  TRACE("pcwszMemberFilePath: %s\n",
577  debugstr_w(catalog->pcwszMemberFilePath));
578  TRACE("hMemberFile: %p\n", catalog->hMemberFile);
579  TRACE("pbCalculatedFileHash: %p\n", catalog->pbCalculatedFileHash);
580  TRACE("cbCalculatedFileHash: %d\n", catalog->cbCalculatedFileHash);
581  TRACE("pcCatalogContext: %p\n", catalog->pcCatalogContext);
582  }
583 }
DWORD cbCalculatedFileHash
Definition: wintrust.h:44
PCCTL_CONTEXT pcCatalogContext
Definition: wintrust.h:45
#define debugstr_w
Definition: kernel32.h:32
LPCWSTR pcwszMemberTag
Definition: wintrust.h:40
LPCWSTR pcwszMemberFilePath
Definition: wintrust.h:41
#define TRACE(s)
Definition: solgame.cpp:4
BYTE * pbCalculatedFileHash
Definition: wintrust.h:43
LPCWSTR pcwszCatalogFilePath
Definition: wintrust.h:39

Referenced by dump_wintrust_data().

◆ dump_cert_info()

static void dump_cert_info ( WINTRUST_CERT_INFO cert)
static

Definition at line 612 of file wintrust_main.c.

613 {
614  TRACE("%p\n", cert);
615  if (cert)
616  {
617  TRACE("cbStruct: %d\n", cert->cbStruct);
618  TRACE("pcwszDisplayName: %s\n", debugstr_w(cert->pcwszDisplayName));
619  TRACE("psCertContext: %p\n", cert->psCertContext);
620  TRACE("chStores: %d\n", cert->chStores);
621  TRACE("dwFlags: %08x\n", cert->dwFlags);
622  TRACE("psftVerifyAsOf: %p\n", cert->psftVerifyAsOf);
623  }
624 }
#define debugstr_w
Definition: kernel32.h:32
static BYTE cert[]
Definition: msg.c:1437
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by dump_wintrust_data().

◆ dump_file_info()

static void dump_file_info ( WINTRUST_FILE_INFO pFile)
static

Definition at line 554 of file wintrust_main.c.

555 {
556  TRACE("%p\n", pFile);
557  if (pFile)
558  {
559  TRACE("cbStruct: %d\n", pFile->cbStruct);
560  TRACE("pcwszFilePath: %s\n", debugstr_w(pFile->pcwszFilePath));
561  TRACE("hFile: %p\n", pFile->hFile);
562  TRACE("pgKnownSubject: %s\n", debugstr_guid(pFile->pgKnownSubject));
563  }
564 }
GUID * pgKnownSubject
Definition: wintrust.h:32
#define debugstr_w
Definition: kernel32.h:32
LPCWSTR pcwszFilePath
Definition: wintrust.h:30
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by dump_wintrust_data().

◆ dump_sgnr_info()

static void dump_sgnr_info ( WINTRUST_SGNR_INFO sgnr)
static

Definition at line 600 of file wintrust_main.c.

601 {
602  TRACE("%p\n", sgnr);
603  if (sgnr)
604  {
605  TRACE("cbStruct: %d\n", sgnr->cbStruct);
606  TRACE("pcwszDisplayName: %s\n", debugstr_w(sgnr->pcwszDisplayName));
607  TRACE("psSignerInfo: %p\n", sgnr->psSignerInfo);
608  TRACE("chStores: %d\n", sgnr->chStores);
609  }
610 }
CMSG_SIGNER_INFO * psSignerInfo
Definition: wintrust.h:63
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
LPCWSTR pcwszDisplayName
Definition: wintrust.h:62

Referenced by dump_wintrust_data().

◆ dump_wintrust_data()

static void dump_wintrust_data ( WINTRUST_DATA data)
static

Definition at line 626 of file wintrust_main.c.

627 {
628  TRACE("%p\n", data);
629  if (data)
630  {
631  TRACE("cbStruct: %d\n", data->cbStruct);
632  TRACE("pPolicyCallbackData: %p\n", data->pPolicyCallbackData);
633  TRACE("pSIPClientData: %p\n", data->pSIPClientData);
634  TRACE("dwUIChoice: %d\n", data->dwUIChoice);
635  TRACE("fdwRevocationChecks: %08x\n", data->fdwRevocationChecks);
636  TRACE("dwUnionChoice: %d\n", data->dwUnionChoice);
637  switch (data->dwUnionChoice)
638  {
639  case WTD_CHOICE_FILE:
640  dump_file_info(data->u.pFile);
641  break;
642  case WTD_CHOICE_CATALOG:
643  dump_catalog_info(data->u.pCatalog);
644  break;
645  case WTD_CHOICE_BLOB:
646  dump_blob_info(data->u.pBlob);
647  break;
648  case WTD_CHOICE_SIGNER:
649  dump_sgnr_info(data->u.pSgnr);
650  break;
651  case WTD_CHOICE_CERT:
652  dump_cert_info(data->u.pCert);
653  break;
654  }
655  TRACE("dwStateAction: %d\n", data->dwStateAction);
656  TRACE("hWVTStateData: %p\n", data->hWVTStateData);
657  TRACE("pwszURLReference: %s\n", debugstr_w(data->pwszURLReference));
658  TRACE("dwProvFlags: %08x\n", data->dwProvFlags);
659  TRACE("dwUIContext: %d\n", data->dwUIContext);
660  }
661 }
static void dump_cert_info(WINTRUST_CERT_INFO *cert)
#define debugstr_w
Definition: kernel32.h:32
#define WTD_CHOICE_FILE
Definition: wintrust.h:91
static void dump_file_info(WINTRUST_FILE_INFO *pFile)
#define TRACE(s)
Definition: solgame.cpp:4
#define WTD_CHOICE_CATALOG
Definition: wintrust.h:92
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define WTD_CHOICE_SIGNER
Definition: wintrust.h:94
static void dump_sgnr_info(WINTRUST_SGNR_INFO *sgnr)
#define WTD_CHOICE_CERT
Definition: wintrust.h:95
static void dump_blob_info(WINTRUST_BLOB_INFO *blob)
#define WTD_CHOICE_BLOB
Definition: wintrust.h:93
static void dump_catalog_info(WINTRUST_CATALOG_INFO *catalog)

Referenced by WinVerifyTrust().

◆ FindCertsByIssuer()

HRESULT WINAPI FindCertsByIssuer ( PCERT_CHAIN  pCertChains,
DWORD pcbCertChains,
DWORD pcCertChains,
BYTE pbEncodedIssuerName,
DWORD  cbEncodedIssuerName,
LPCWSTR  pwszPurpose,
DWORD  dwKeySpec 
)

Definition at line 1203 of file wintrust_main.c.

1206 {
1207  FIXME("(%p, %p, %p, %p, %d, %s, %d): stub\n", pCertChains, pcbCertChains,
1208  pcCertChains, pbEncodedIssuerName, cbEncodedIssuerName,
1209  debugstr_w(pwszPurpose), dwKeySpec);
1210  return E_FAIL;
1211 }
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ IsCatalogFile()

BOOL WINAPI IsCatalogFile ( HANDLE  hFile,
WCHAR pwszFileName 
)

Definition at line 1188 of file wintrust_main.c.

1189 {
1190  static const GUID catGUID = { 0xDE351A43, 0x8E59, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
1191  GUID guid;
1192 
1193  TRACE("(%p, %s)\n", hFile, debugstr_w(pwszFileName));
1194 
1195  if (!CryptSIPRetrieveSubjectGuid(pwszFileName, hFile, &guid))
1196  return FALSE;
1197  return IsEqualGUID(&guid, &catGUID);
1198 }
BOOL WINAPI CryptSIPRetrieveSubjectGuid(LPCWSTR FileName, HANDLE hFileIn, GUID *pgSubject)
Definition: sip.c:310
static const GUID catGUID
Definition: crypt.c:1369
const GUID * guid
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
_In_ HANDLE hFile
Definition: mswsock.h:90
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ OpenPersonalTrustDBDialog()

BOOL WINAPI OpenPersonalTrustDBDialog ( HWND  hwnd)

Definition at line 1164 of file wintrust_main.c.

1165 {
1166  CRYPTUI_CERT_MGR_STRUCT uiCertMgr;
1167 
1168  uiCertMgr.dwSize = sizeof(uiCertMgr);
1169  uiCertMgr.hwndParent = hwnd;
1171  uiCertMgr.pwszTitle = NULL;
1172  uiCertMgr.pszInitUsageOID = NULL;
1173  return CryptUIDlgCertMgr(&uiCertMgr);
1174 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CRYPTUI_CERT_MGR_PUBLISHER_TAB
Definition: cryptuiapi.h:47
BOOL WINAPI CryptUIDlgCertMgr(PCCRYPTUI_CERT_MGR_STRUCT pCryptUICertMgr)
Definition: main.c:1297
smooth NULL
Definition: ftsmooth.c:416

◆ TrustIsCertificateSelfSigned()

BOOL WINAPI TrustIsCertificateSelfSigned ( PCCERT_CONTEXT  cert)

Definition at line 62 of file wintrust_main.c.

63 {
65  DWORD size;
66  BOOL ret;
67 
68  TRACE("%p\n", cert);
70  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
71  {
73 
74  ret = CryptDecodeObjectEx(cert->dwCertEncodingType,
75  X509_AUTHORITY_KEY_ID2, ext->Value.pbData, ext->Value.cbData,
77  &info, &size);
78  if (ret)
79  {
80  if (info->AuthorityCertIssuer.cAltEntry &&
81  info->AuthorityCertSerialNumber.cbData)
82  {
83  PCERT_ALT_NAME_ENTRY directoryName = NULL;
84  DWORD i;
85 
86  for (i = 0; !directoryName &&
87  i < info->AuthorityCertIssuer.cAltEntry; i++)
88  if (info->AuthorityCertIssuer.rgAltEntry[i].dwAltNameChoice
90  directoryName =
91  &info->AuthorityCertIssuer.rgAltEntry[i];
92  if (directoryName)
93  {
94  ret = CertCompareCertificateName(cert->dwCertEncodingType,
95  &directoryName->u.DirectoryName, &cert->pCertInfo->Issuer)
96  && CertCompareIntegerBlob(&info->AuthorityCertSerialNumber,
97  &cert->pCertInfo->SerialNumber);
98  }
99  else
100  {
101  FIXME("no supported name type in authority key id2\n");
102  ret = FALSE;
103  }
104  }
105  else if (info->KeyId.cbData)
106  {
109  if (ret && size == info->KeyId.cbData)
110  {
112 
113  if (buf)
114  {
117  ret = !memcmp(buf, info->KeyId.pbData, size);
118  CryptMemFree(buf);
119  }
120  else
121  ret = FALSE;
122  }
123  else
124  ret = FALSE;
125  }
126  LocalFree(info);
127  }
128  }
130  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
131  {
133 
134  ret = CryptDecodeObjectEx(cert->dwCertEncodingType,
135  X509_AUTHORITY_KEY_ID, ext->Value.pbData, ext->Value.cbData,
137  &info, &size);
138  if (ret)
139  {
140  if (info->CertIssuer.cbData && info->CertSerialNumber.cbData)
141  {
142  ret = CertCompareCertificateName(cert->dwCertEncodingType,
143  &info->CertIssuer, &cert->pCertInfo->Issuer) &&
144  CertCompareIntegerBlob(&info->CertSerialNumber,
145  &cert->pCertInfo->SerialNumber);
146  }
147  else if (info->KeyId.cbData)
148  {
151  if (ret && size == info->KeyId.cbData)
152  {
154 
155  if (buf)
156  {
159  ret = !memcmp(buf, info->KeyId.pbData, size);
160  CryptMemFree(buf);
161  }
162  else
163  ret = FALSE;
164  }
165  else
166  ret = FALSE;
167  }
168  else
169  ret = FALSE;
170  LocalFree(info);
171  }
172  }
173  else
174  ret = CertCompareCertificateName(cert->dwCertEncodingType,
175  &cert->pCertInfo->Subject, &cert->pCertInfo->Issuer);
176  return ret;
177 }
CERT_NAME_BLOB DirectoryName
Definition: wincrypt.h:338
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CERT_ALT_NAME_DIRECTORY_NAME
Definition: wincrypt.h:349
Definition: wincrypt.h:332
BOOL WINAPI CertCompareCertificateName(DWORD dwCertEncodingType, PCERT_NAME_BLOB pCertName1, PCERT_NAME_BLOB pCertName2)
Definition: cert.c:1180
struct _test_info info[]
Definition: SetCursorPos.c:19
#define CERT_KEY_IDENTIFIER_PROP_ID
Definition: wincrypt.h:2706
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData)
Definition: cert.c:551
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
static BYTE cert[]
Definition: msg.c:1437
BOOL WINAPI CertCompareIntegerBlob(PCRYPT_INTEGER_BLOB pInt1, PCRYPT_INTEGER_BLOB pInt2)
Definition: cert.c:1221
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
PCERT_EXTENSION WINAPI CertFindExtension(LPCSTR pszObjId, DWORD cExtensions, CERT_EXTENSION rgExtensions[])
Definition: cert.c:2028
int ret
#define szOID_AUTHORITY_KEY_IDENTIFIER
Definition: wincrypt.h:3175
#define X509_AUTHORITY_KEY_ID
Definition: wincrypt.h:3374
#define CRYPT_DECODE_NOCOPY_FLAG
Definition: wincrypt.h:3450
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define szOID_AUTHORITY_KEY_IDENTIFIER2
Definition: wincrypt.h:3200
#define X509_AUTHORITY_KEY_ID2
Definition: wincrypt.h:3398
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wintrust  )

◆ WINTRUST_AddCert()

BOOL WINAPI WINTRUST_AddCert ( CRYPT_PROVIDER_DATA data,
DWORD  idxSigner,
BOOL  fCounterSigner,
DWORD  idxCounterSigner,
PCCERT_CONTEXT  pCert2Add 
)

Definition at line 1074 of file wintrust_main.c.

1076 {
1077  BOOL ret = FALSE;
1078 
1079  TRACE("(%p, %d, %d, %d, %p)\n", data, idxSigner, fCounterSigner,
1080  idxSigner, pCert2Add);
1081 
1082  if (fCounterSigner)
1083  {
1084  FIXME("unimplemented for counter signers\n");
1086  return FALSE;
1087  }
1088  if (data->pasSigners[idxSigner].csCertChain)
1089  data->pasSigners[idxSigner].pasCertChain =
1090  WINTRUST_ReAlloc(data->pasSigners[idxSigner].pasCertChain,
1091  (data->pasSigners[idxSigner].csCertChain + 1) *
1092  sizeof(CRYPT_PROVIDER_CERT));
1093  else
1094  {
1095  data->pasSigners[idxSigner].pasCertChain =
1097  data->pasSigners[idxSigner].csCertChain = 0;
1098  }
1099  if (data->pasSigners[idxSigner].pasCertChain)
1100  {
1101  CRYPT_PROVIDER_CERT *cert = &data->pasSigners[idxSigner].pasCertChain[
1102  data->pasSigners[idxSigner].csCertChain];
1103 
1104  cert->cbStruct = sizeof(CRYPT_PROVIDER_CERT);
1105  cert->pCert = CertDuplicateCertificateContext(pCert2Add);
1106  data->pasSigners[idxSigner].csCertChain++;
1107  ret = TRUE;
1108  }
1109  else
1111  return ret;
1112 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
struct _CRYPT_PROVIDER_CERT CRYPT_PROVIDER_CERT
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
static BYTE cert[]
Definition: msg.c:1437
#define TRACE(s)
Definition: solgame.cpp:4
void *WINAPI WINTRUST_Alloc(DWORD cb)
Definition: wintrust_main.c:43
#define SetLastError(x)
Definition: compat.h:417
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:360
static void * WINTRUST_ReAlloc(void *ptr, DWORD cb) __WINE_ALLOC_SIZE(2)
Definition: wintrust_main.c:49
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by WintrustLoadFunctionPointers().

◆ WINTRUST_AddPrivData()

BOOL WINAPI WINTRUST_AddPrivData ( CRYPT_PROVIDER_DATA data,
CRYPT_PROVIDER_PRIVDATA pPrivData2Add 
)

Definition at line 1114 of file wintrust_main.c.

1116 {
1117  BOOL ret = FALSE;
1118 
1119  TRACE("(%p, %p)\n", data, pPrivData2Add);
1120 
1121  if (pPrivData2Add->cbStruct > sizeof(CRYPT_PROVIDER_PRIVDATA))
1122  {
1124  WARN("invalid struct size\n");
1125  return FALSE;
1126  }
1127  if (data->csProvPrivData)
1128  data->pasProvPrivData = WINTRUST_ReAlloc(data->pasProvPrivData,
1129  (data->csProvPrivData + 1) * sizeof(CRYPT_PROVIDER_SGNR));
1130  else
1131  {
1132  data->pasProvPrivData = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_SGNR));
1133  data->csProvPrivData = 0;
1134  }
1135  if (data->pasProvPrivData)
1136  {
1137  DWORD i;
1138 
1139  for (i = 0; i < data->csProvPrivData; i++)
1140  if (IsEqualGUID(&pPrivData2Add->gProviderID, &data->pasProvPrivData[i]))
1141  break;
1142 
1143  data->pasProvPrivData[i] = *pPrivData2Add;
1144  if (i == data->csProvPrivData)
1145  data->csProvPrivData++;
1146  }
1147  else
1149  return ret;
1150 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define WARN(fmt,...)
Definition: debug.h:111
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
void *WINAPI WINTRUST_Alloc(DWORD cb)
Definition: wintrust_main.c:43
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static void * WINTRUST_ReAlloc(void *ptr, DWORD cb) __WINE_ALLOC_SIZE(2)
Definition: wintrust_main.c:49
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by WintrustLoadFunctionPointers().

◆ WINTRUST_AddSgnr()

BOOL WINAPI WINTRUST_AddSgnr ( CRYPT_PROVIDER_DATA data,
BOOL  fCounterSigner,
DWORD  idxSigner,
CRYPT_PROVIDER_SGNR sgnr 
)

Definition at line 1021 of file wintrust_main.c.

1023 {
1024  BOOL ret = FALSE;
1025 
1026  TRACE("(%p, %d, %d, %p)\n", data, fCounterSigner, idxSigner, sgnr);
1027 
1028  if (sgnr->cbStruct > sizeof(CRYPT_PROVIDER_SGNR))
1029  {
1031  return FALSE;
1032  }
1033  if (fCounterSigner)
1034  {
1035  FIXME("unimplemented for counter signers\n");
1037  return FALSE;
1038  }
1039  if (data->csSigners)
1040  data->pasSigners = WINTRUST_ReAlloc(data->pasSigners,
1041  (data->csSigners + 1) * sizeof(CRYPT_PROVIDER_SGNR));
1042  else
1043  {
1044  data->pasSigners = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_SGNR));
1045  data->csSigners = 0;
1046  }
1047  if (data->pasSigners)
1048  {
1049  if (idxSigner < data->csSigners)
1050  memmove(&data->pasSigners[idxSigner],
1051  &data->pasSigners[idxSigner + 1],
1052  (data->csSigners - idxSigner) * sizeof(CRYPT_PROVIDER_SGNR));
1053  ret = TRUE;
1054  if (sgnr->cbStruct == sizeof(CRYPT_PROVIDER_SGNR))
1055  {
1056  /* The PSDK says psSigner should be allocated using pfnAlloc, but
1057  * it doesn't say anything about ownership. Since callers are
1058  * internal, assume ownership is passed, and just store the
1059  * pointer.
1060  */
1061  memcpy(&data->pasSigners[idxSigner], sgnr,
1062  sizeof(CRYPT_PROVIDER_SGNR));
1063  }
1064  else
1065  memset(&data->pasSigners[idxSigner], 0,
1066  sizeof(CRYPT_PROVIDER_SGNR));
1067  data->csSigners++;
1068  }
1069  else
1071  return ret;
1072 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
void *WINAPI WINTRUST_Alloc(DWORD cb)
Definition: wintrust_main.c:43
#define SetLastError(x)
Definition: compat.h:417
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memset(x, y, z)
Definition: compat.h:39
static void * WINTRUST_ReAlloc(void *ptr, DWORD cb) __WINE_ALLOC_SIZE(2)
Definition: wintrust_main.c:49
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by WintrustLoadFunctionPointers().

◆ WINTRUST_AddStore()

BOOL WINAPI WINTRUST_AddStore ( CRYPT_PROVIDER_DATA data,
HCERTSTORE  store 
)

Definition at line 997 of file wintrust_main.c.

998 {
999  BOOL ret = FALSE;
1000 
1001  TRACE("(%p, %p)\n", data, store);
1002 
1003  if (data->chStores)
1004  data->pahStores = WINTRUST_ReAlloc(data->pahStores,
1005  (data->chStores + 1) * sizeof(HCERTSTORE));
1006  else
1007  {
1008  data->pahStores = WINTRUST_Alloc(sizeof(HCERTSTORE));
1009  data->chStores = 0;
1010  }
1011  if (data->pahStores)
1012  {
1013  data->pahStores[data->chStores++] = CertDuplicateStore(store);
1014  ret = TRUE;
1015  }
1016  else
1018  return ret;
1019 }
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
HCERTSTORE WINAPI CertDuplicateStore(HCERTSTORE hCertStore)
Definition: store.c:1116
#define TRACE(s)
Definition: solgame.cpp:4
void *WINAPI WINTRUST_Alloc(DWORD cb)
Definition: wintrust_main.c:43
#define SetLastError(x)
Definition: compat.h:417
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
static void * WINTRUST_ReAlloc(void *ptr, DWORD cb) __WINE_ALLOC_SIZE(2)
Definition: wintrust_main.c:49
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by WintrustLoadFunctionPointers().

◆ WINTRUST_AddTrustStepsFromFunctions()

static DWORD WINTRUST_AddTrustStepsFromFunctions ( struct wintrust_step steps,
const CRYPT_PROVIDER_FUNCTIONS psPfns 
)
static

Definition at line 241 of file wintrust_main.c.

243 {
244  DWORD numSteps = 0;
245 
246  if (psPfns->pfnInitialize)
247  {
248  steps[numSteps].func = psPfns->pfnInitialize;
249  steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_WVTINIT;
250  }
251  if (psPfns->pfnObjectTrust)
252  {
253  steps[numSteps].func = psPfns->pfnObjectTrust;
254  steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_OBJPROV;
255  }
256  if (psPfns->pfnSignatureTrust)
257  {
258  steps[numSteps].func = psPfns->pfnSignatureTrust;
259  steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_SIGPROV;
260  }
261  if (psPfns->pfnCertificateTrust)
262  {
263  steps[numSteps].func = psPfns->pfnCertificateTrust;
264  steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_CERTPROV;
265  }
266  if (psPfns->pfnFinalPolicy)
267  {
268  steps[numSteps].func = psPfns->pfnFinalPolicy;
269  steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_POLICYPROV;
270  }
271  return numSteps;
272 }
#define TRUSTERROR_STEP_FINAL_CERTPROV
Definition: wintrust.h:277
static DWORD DWORD DWORD DWORD * steps
Definition: cursoricon.c:1638
#define TRUSTERROR_STEP_FINAL_WVTINIT
Definition: wintrust.h:273
#define TRUSTERROR_STEP_FINAL_POLICYPROV
Definition: wintrust.h:279
unsigned long DWORD
Definition: ntddk_ex.h:95
PFN_PROVIDER_OBJTRUST_CALL pfnObjectTrust
Definition: wintrust.h:322
#define TRUSTERROR_STEP_FINAL_SIGPROV
Definition: wintrust.h:276
#define TRUSTERROR_STEP_FINAL_OBJPROV
Definition: wintrust.h:275
PFN_PROVIDER_INIT_CALL pfnInitialize
Definition: wintrust.h:321
PFN_PROVIDER_SIGTRUST_CALL pfnSignatureTrust
Definition: wintrust.h:323
PFN_PROVIDER_CERTTRUST_CALL pfnCertificateTrust
Definition: wintrust.h:324
PFN_PROVIDER_FINALPOLICY_CALL pfnFinalPolicy
Definition: wintrust.h:325

Referenced by WINTRUST_CertVerify(), and WINTRUST_DefaultVerify().

◆ WINTRUST_Alloc()

void* WINAPI WINTRUST_Alloc ( DWORD  cb)

◆ WINTRUST_AllocateProviderData()

static CRYPT_PROVIDER_DATA* WINTRUST_AllocateProviderData ( void  )
static

Definition at line 201 of file wintrust_main.c.

202 {
203  CRYPT_PROVIDER_DATA *provData;
204 
205  provData = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_DATA));
206  if (!provData)
207  goto oom;
208  provData->cbStruct = sizeof(CRYPT_PROVIDER_DATA);
209 
210  provData->padwTrustStepErrors =
212  if (!provData->padwTrustStepErrors)
213  goto oom;
215 
216  provData->u.pPDSip = WINTRUST_Alloc(sizeof(PROVDATA_SIP));
217  if (!provData->u.pPDSip)
218  goto oom;
219  provData->u.pPDSip->cbStruct = sizeof(PROVDATA_SIP);
220 
221  provData->psPfns = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_FUNCTIONS));
222  if (!provData->psPfns)
223  goto oom;
224  provData->psPfns->cbStruct = sizeof(CRYPT_PROVIDER_FUNCTIONS);
225  return provData;
226 
227 oom:
228  if (provData)
229  {
231  WINTRUST_Free(provData->u.pPDSip);
232  WINTRUST_Free(provData->psPfns);
233  WINTRUST_Free(provData);
234  }
235  return NULL;
236 }
CRYPT_PROVIDER_FUNCTIONS * psPfns
Definition: wintrust.h:356
struct _PROVDATA_SIP * pPDSip
Definition: wintrust.h:369
struct _CRYPT_PROVIDER_DATA CRYPT_PROVIDER_DATA
DWORD cdwTrustStepErrors
Definition: wintrust.h:357
#define TRUSTERROR_MAX_STEPS
Definition: wintrust.h:282
smooth NULL
Definition: ftsmooth.c:416
void WINAPI WINTRUST_Free(void *p)
Definition: wintrust_main.c:54
void *WINAPI WINTRUST_Alloc(DWORD cb)
Definition: wintrust_main.c:43
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _PROVDATA_SIP PROVDATA_SIP
DWORD * padwTrustStepErrors
Definition: wintrust.h:358
struct _CRYPT_PROVIDER_FUNCTIONS CRYPT_PROVIDER_FUNCTIONS

Referenced by WINTRUST_CertVerify(), and WINTRUST_DefaultVerify().

◆ WINTRUST_CertActionVerify()

static LONG WINTRUST_CertActionVerify ( HWND  hwnd,
GUID actionID,
WINTRUST_DATA data 
)
static

Definition at line 524 of file wintrust_main.c.

526 {
527  DWORD stateAction;
529 
530  if (WVT_ISINSTRUCT(WINTRUST_DATA, data->cbStruct, dwStateAction))
531  stateAction = data->dwStateAction;
532  else
533  {
534  TRACE("no dwStateAction, assuming WTD_STATEACTION_IGNORE\n");
535  stateAction = WTD_STATEACTION_IGNORE;
536  }
537  switch (stateAction)
538  {
541  break;
543  err = WINTRUST_CertVerify(hwnd, actionID, data);
544  break;
546  err = WINTRUST_DefaultClose(hwnd, actionID, data);
547  break;
548  default:
549  FIXME("unimplemented for %d\n", data->dwStateAction);
550  }
551  return err;
552 }
#define WTD_STATEACTION_VERIFY
Definition: wintrust.h:123
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD cbStruct
Definition: wintrust.h:99
long LONG
Definition: pedump.c:60
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define err(...)
static LONG WINTRUST_CertVerify(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
#define WVT_ISINSTRUCT(t, s, f)
Definition: wintrust.h:433
#define WTD_STATEACTION_CLOSE
Definition: wintrust.h:124
static LONG WINTRUST_DefaultClose(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
#define WTD_STATEACTION_IGNORE
Definition: wintrust.h:122
static LONG WINTRUST_CertVerifyAndClose(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)

Referenced by WinVerifyTrust().

◆ WINTRUST_CertVerify()

static LONG WINTRUST_CertVerify ( HWND  hwnd,
GUID actionID,
WINTRUST_DATA data 
)
static

Definition at line 461 of file wintrust_main.c.

463 {
464  DWORD err = ERROR_SUCCESS, numSteps = 0;
465  CRYPT_PROVIDER_DATA *provData;
466  BOOL ret;
467  struct wintrust_step verifySteps[5];
468 
469  TRACE("(%p, %s, %p)\n", hwnd, debugstr_guid(actionID), data);
470 
471  provData = WINTRUST_AllocateProviderData();
472  if (!provData)
473  return ERROR_OUTOFMEMORY;
474 
475  ret = WintrustLoadFunctionPointers(actionID, provData->psPfns);
476  if (!ret)
477  {
478  err = GetLastError();
479  goto error;
480  }
481  if (!provData->psPfns->pfnObjectTrust)
483  /* Not sure why, but native skips the policy check */
484  provData->psPfns->pfnCertCheckPolicy = NULL;
485 
486  data->hWVTStateData = provData;
487  provData->pWintrustData = data;
488  if (hwnd == INVALID_HANDLE_VALUE)
489  provData->hWndParent = GetDesktopWindow();
490  else
491  provData->hWndParent = hwnd;
492  provData->pgActionID = actionID;
494 
495  numSteps = WINTRUST_AddTrustStepsFromFunctions(verifySteps,
496  provData->psPfns);
497  err = WINTRUST_ExecuteSteps(verifySteps, numSteps, provData);
498  goto done;
499 
500 error:
502  WINTRUST_Free(provData->u.pPDSip);
503  WINTRUST_Free(provData->psPfns);
504  WINTRUST_Free(provData);
505 
506 done:
507  TRACE("returning %08x\n", err);
508  return err;
509 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
CRYPT_PROVIDER_FUNCTIONS * psPfns
Definition: wintrust.h:356
struct _PROVDATA_SIP * pPDSip
Definition: wintrust.h:369
WINTRUST_DATA * pWintrustData
Definition: wintrust.h:348
static HRESULT WINAPI WINTRUST_CertVerifyObjTrust(CRYPT_PROVIDER_DATA *data)
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD WINTRUST_AddTrustStepsFromFunctions(struct wintrust_step *steps, const CRYPT_PROVIDER_FUNCTIONS *psPfns)
PFN_PROVIDER_CERTCHKPOLICY_CALL pfnCertCheckPolicy
Definition: wintrust.h:326
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define debugstr_guid
Definition: kernel32.h:35
void WINAPI WINTRUST_Free(void *p)
Definition: wintrust_main.c:54
static DWORD WINTRUST_ExecuteSteps(const struct wintrust_step *steps, DWORD numSteps, CRYPT_PROVIDER_DATA *provData)
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwRegPolicySettings
Definition: wintrust.h:355
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void WINAPI WintrustGetRegPolicyFlags(DWORD *pdwPolicyFlags)
PFN_PROVIDER_OBJTRUST_CALL pfnObjectTrust
Definition: wintrust.h:322
int ret
BOOL WINAPI WintrustLoadFunctionPointers(GUID *pgActionID, CRYPT_PROVIDER_FUNCTIONS *pPfns)
Definition: register.c:841
DWORD * padwTrustStepErrors
Definition: wintrust.h:358
#define err(...)
static CRYPT_PROVIDER_DATA * WINTRUST_AllocateProviderData(void)
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by WINTRUST_CertActionVerify(), and WINTRUST_CertVerifyAndClose().

◆ WINTRUST_CertVerifyAndClose()

static LONG WINTRUST_CertVerifyAndClose ( HWND  hwnd,
GUID actionID,
WINTRUST_DATA data 
)
static

Definition at line 511 of file wintrust_main.c.

513 {
514  LONG err;
515 
516  TRACE("(%p, %s, %p)\n", hwnd, debugstr_guid(actionID), data);
517 
518  err = WINTRUST_CertVerify(hwnd, actionID, data);
519  WINTRUST_DefaultClose(hwnd, actionID, data);
520  TRACE("returning %08x\n", err);
521  return err;
522 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
long LONG
Definition: pedump.c:60
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define err(...)
static LONG WINTRUST_CertVerify(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
static LONG WINTRUST_DefaultClose(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)

Referenced by WINTRUST_CertActionVerify().

◆ WINTRUST_CertVerifyObjTrust()

static HRESULT WINAPI WINTRUST_CertVerifyObjTrust ( CRYPT_PROVIDER_DATA data)
static

Definition at line 382 of file wintrust_main.c.

383 {
384  BOOL ret;
385 
386  TRACE("(%p)\n", data);
387 
388  if (!data->padwTrustStepErrors)
389  return S_FALSE;
390 
391  switch (data->pWintrustData->dwUnionChoice)
392  {
393  case WTD_CHOICE_BLOB:
394  if (data->pWintrustData->u.pBlob &&
396  data->pWintrustData->u.pBlob->cbStruct, pbMemObject) &&
397  data->pWintrustData->u.pBlob->cbMemObject ==
399  data->pWintrustData->u.pBlob->pbMemObject)
400  {
403  data->pWintrustData->u.pBlob->pbMemObject;
404 
405  if (pCert->cbSize == sizeof(CERT_VERIFY_CERTIFICATE_TRUST) &&
406  pCert->pccert)
407  {
408  CRYPT_PROVIDER_SGNR signer = { sizeof(signer), { 0 } };
409  DWORD i;
410  SYSTEMTIME sysTime;
411 
412  /* Add a signer with nothing but the time to verify, so we can
413  * add a cert to it
414  */
415  GetSystemTime(&sysTime);
416  SystemTimeToFileTime(&sysTime, &signer.sftVerifyAsOf);
417  ret = data->psPfns->pfnAddSgnr2Chain(data, FALSE, 0, &signer);
418  if (!ret)
419  goto error;
420  ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
421  pCert->pccert);
422  if (!ret)
423  goto error;
424  for (i = 0; ret && i < pCert->cRootStores; i++)
425  ret = data->psPfns->pfnAddStore2Chain(data,
426  pCert->rghstoreRoots[i]);
427  for (i = 0; ret && i < pCert->cStores; i++)
428  ret = data->psPfns->pfnAddStore2Chain(data,
429  pCert->rghstoreCAs[i]);
430  for (i = 0; ret && i < pCert->cTrustStores; i++)
431  ret = data->psPfns->pfnAddStore2Chain(data,
432  pCert->rghstoreTrust[i]);
433  }
434  else
435  {
437  ret = FALSE;
438  }
439  }
440  else
441  {
443  ret = FALSE;
444  }
445  break;
446  default:
447  FIXME("unimplemented for %d\n", data->pWintrustData->dwUnionChoice);
449  ret = FALSE;
450  }
451 
452 error:
453  if (!ret)
454  data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] =
455  GetLastError();
456  TRACE("returning %d (%08x)\n", ret ? S_OK : S_FALSE,
457  data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
458  return ret ? S_OK : S_FALSE;
459 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define error(str)
Definition: mkdosfs.c:1605
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357
VOID WINAPI GetSystemTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:327
#define TRACE(s)
Definition: solgame.cpp:4
FILETIME sftVerifyAsOf
Definition: wintrust.h:233
if(!(yy_init))
Definition: macro.lex.yy.c:714
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:158
#define TRUSTERROR_STEP_FINAL_OBJPROV
Definition: wintrust.h:275
#define WTD_CHOICE_BLOB
Definition: wintrust.h:93
#define WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(t, s, f)
Definition: wintrust.h:434

Referenced by WINTRUST_CertVerify().

◆ WINTRUST_DefaultClose()

static LONG WINTRUST_DefaultClose ( HWND  hwnd,
GUID actionID,
WINTRUST_DATA data 
)
static

Definition at line 320 of file wintrust_main.c.

322 {
324  CRYPT_PROVIDER_DATA *provData = data->hWVTStateData;
325 
326  TRACE("(%p, %s, %p)\n", hwnd, debugstr_guid(actionID), data);
327 
328  if (provData)
329  {
330  if (provData->psPfns->pfnCleanupPolicy)
331  err = provData->psPfns->pfnCleanupPolicy(provData);
332 
334  WINTRUST_Free(provData->u.pPDSip);
335  WINTRUST_Free(provData->psPfns);
336  WINTRUST_Free(provData);
337  data->hWVTStateData = NULL;
338  }
339  TRACE("returning %08x\n", err);
340  return err;
341 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ERROR_SUCCESS
Definition: deptool.c:10
CRYPT_PROVIDER_FUNCTIONS * psPfns
Definition: wintrust.h:356
struct _PROVDATA_SIP * pPDSip
Definition: wintrust.h:369
PFN_PROVIDER_CLEANUP_CALL pfnCleanupPolicy
Definition: wintrust.h:329
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
void WINAPI WINTRUST_Free(void *p)
Definition: wintrust_main.c:54
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
DWORD * padwTrustStepErrors
Definition: wintrust.h:358
#define err(...)

Referenced by WINTRUST_CertActionVerify(), WINTRUST_CertVerifyAndClose(), WINTRUST_DefaultVerifyAndClose(), and WinVerifyTrust().

◆ WINTRUST_DefaultVerify()

static LONG WINTRUST_DefaultVerify ( HWND  hwnd,
GUID actionID,
WINTRUST_DATA data 
)
static

Definition at line 274 of file wintrust_main.c.

276 {
277  DWORD err = ERROR_SUCCESS, numSteps = 0;
278  CRYPT_PROVIDER_DATA *provData;
279  BOOL ret;
280  struct wintrust_step verifySteps[5];
281 
282  TRACE("(%p, %s, %p)\n", hwnd, debugstr_guid(actionID), data);
283 
284  provData = WINTRUST_AllocateProviderData();
285  if (!provData)
286  return ERROR_OUTOFMEMORY;
287 
288  ret = WintrustLoadFunctionPointers(actionID, provData->psPfns);
289  if (!ret)
290  {
291  err = GetLastError();
292  goto error;
293  }
294 
295  data->hWVTStateData = provData;
296  provData->pWintrustData = data;
297  if (hwnd == INVALID_HANDLE_VALUE)
298  provData->hWndParent = GetDesktopWindow();
299  else
300  provData->hWndParent = hwnd;
301  provData->pgActionID = actionID;
303 
304  numSteps = WINTRUST_AddTrustStepsFromFunctions(verifySteps,
305  provData->psPfns);
306  err = WINTRUST_ExecuteSteps(verifySteps, numSteps, provData);
307  goto done;
308 
309 error:
311  WINTRUST_Free(provData->u.pPDSip);
312  WINTRUST_Free(provData->psPfns);
313  WINTRUST_Free(provData);
314 
315 done:
316  TRACE("returning %08x\n", err);
317  return err;
318 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
CRYPT_PROVIDER_FUNCTIONS * psPfns
Definition: wintrust.h:356
struct _PROVDATA_SIP * pPDSip
Definition: wintrust.h:369
WINTRUST_DATA * pWintrustData
Definition: wintrust.h:348
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD WINTRUST_AddTrustStepsFromFunctions(struct wintrust_step *steps, const CRYPT_PROVIDER_FUNCTIONS *psPfns)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
#define debugstr_guid
Definition: kernel32.h:35
void WINAPI WINTRUST_Free(void *p)
Definition: wintrust_main.c:54
static DWORD WINTRUST_ExecuteSteps(const struct wintrust_step *steps, DWORD numSteps, CRYPT_PROVIDER_DATA *provData)
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwRegPolicySettings
Definition: wintrust.h:355
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void WINAPI WintrustGetRegPolicyFlags(DWORD *pdwPolicyFlags)
int ret
BOOL WINAPI WintrustLoadFunctionPointers(GUID *pgActionID, CRYPT_PROVIDER_FUNCTIONS *pPfns)
Definition: register.c:841
DWORD * padwTrustStepErrors
Definition: wintrust.h:358
#define err(...)
static CRYPT_PROVIDER_DATA * WINTRUST_AllocateProviderData(void)
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by WINTRUST_DefaultVerifyAndClose(), and WinVerifyTrust().

◆ WINTRUST_DefaultVerifyAndClose()

static LONG WINTRUST_DefaultVerifyAndClose ( HWND  hwnd,
GUID actionID,
WINTRUST_DATA data 
)
static

Definition at line 343 of file wintrust_main.c.

345 {
346  LONG err;
347 
348  TRACE("(%p, %s, %p)\n", hwnd, debugstr_guid(actionID), data);
349 
350  err = WINTRUST_DefaultVerify(hwnd, actionID, data);
351  WINTRUST_DefaultClose(hwnd, actionID, data);
352  TRACE("returning %08x\n", err);
353  return err;
354 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
long LONG
Definition: pedump.c:60
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define err(...)
static LONG WINTRUST_DefaultClose(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)

Referenced by WINTRUST_PublishedSoftware(), and WinVerifyTrust().

◆ WINTRUST_enumUsages()

static BOOL WINAPI WINTRUST_enumUsages ( PCCRYPT_OID_INFO  pInfo,
void pvArg 
)
static

Definition at line 843 of file wintrust_main.c.

844 {
845  PCCRYPT_OID_INFO **usages = pvArg;
846  DWORD cUsages;
847  BOOL ret;
848 
849  if (!*usages)
850  {
851  cUsages = 0;
852  *usages = WINTRUST_Alloc(2 * sizeof(PCCRYPT_OID_INFO));
853  }
854  else
855  {
857 
858  /* Count the existing usages.
859  * FIXME: make sure the new usage doesn't duplicate any in the list?
860  */
861  for (cUsages = 0, ptr = *usages; *ptr; ptr++, cUsages++)
862  ;
864  (cUsages + 2) * sizeof(PCCRYPT_OID_INFO));
865  }
866  if (*usages)
867  {
868  (*usages)[cUsages] = pInfo;
869  (*usages)[cUsages + 1] = NULL;
870  ret = TRUE;
871  }
872  else
873  {
875  ret = FALSE;
876  }
877  return ret;
878 }
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
void *WINAPI WINTRUST_Alloc(DWORD cb)
Definition: wintrust_main.c:43
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
static PCCRYPT_OID_INFO ** usages
Definition: softpub.c:81
static void * WINTRUST_ReAlloc(void *ptr, DWORD cb) __WINE_ALLOC_SIZE(2)
Definition: wintrust_main.c:49
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by WTHelperGetKnownUsages().

◆ WINTRUST_ExecuteSteps()

static DWORD WINTRUST_ExecuteSteps ( const struct wintrust_step steps,
DWORD  numSteps,
CRYPT_PROVIDER_DATA provData 
)
static

Definition at line 187 of file wintrust_main.c.

189 {
191 
192  for (i = 0; !err && i < numSteps; i++)
193  {
194  err = steps[i].func(provData);
195  if (err)
196  err = provData->padwTrustStepErrors[steps[i].error_index];
197  }
198  return err;
199 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static DWORD DWORD DWORD DWORD * steps
Definition: cursoricon.c:1638
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD * padwTrustStepErrors
Definition: wintrust.h:358
#define err(...)

Referenced by WINTRUST_CertVerify(), and WINTRUST_DefaultVerify().

◆ WINTRUST_Free()

◆ WINTRUST_PublishedSoftware()

static LONG WINTRUST_PublishedSoftware ( HWND  hwnd,
GUID actionID,
WINTRUST_DATA data 
)
static

Definition at line 356 of file wintrust_main.c.

358 {
359  WINTRUST_DATA wintrust_data = { sizeof(wintrust_data), 0 };
360  /* Undocumented: the published software action is passed a path,
361  * and pSIPClientData points to a WIN_TRUST_SUBJECT_FILE.
362  */
363  LPWIN_TRUST_SUBJECT_FILE subjectFile = data->pSIPClientData;
364  WINTRUST_FILE_INFO fileInfo = { sizeof(fileInfo), 0 };
365 
366  TRACE("subjectFile->hFile: %p\n", subjectFile->hFile);
367  TRACE("subjectFile->lpPath: %s\n", debugstr_w(subjectFile->lpPath));
368  fileInfo.pcwszFilePath = subjectFile->lpPath;
369  fileInfo.hFile = subjectFile->hFile;
370  wintrust_data.u.pFile = &fileInfo;
371  wintrust_data.dwUnionChoice = WTD_CHOICE_FILE;
372  wintrust_data.dwUIChoice = WTD_UI_NONE;
373 
374  return WINTRUST_DefaultVerifyAndClose(hwnd, actionID, &wintrust_data);
375 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static LONG WINTRUST_DefaultVerifyAndClose(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
#define debugstr_w
Definition: kernel32.h:32
#define WTD_CHOICE_FILE
Definition: wintrust.h:91
LPCWSTR pcwszFilePath
Definition: wintrust.h:30
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct WINTRUST_FILE_INFO_ * pFile
Definition: wintrust.h:107
DWORD dwUIChoice
Definition: wintrust.h:102
#define WTD_UI_NONE
Definition: wintrust.h:84
DWORD dwUnionChoice
Definition: wintrust.h:104

Referenced by WinVerifyTrust().

◆ WINTRUST_ReAlloc()

static void * WINTRUST_ReAlloc ( void ptr,
DWORD  cb 
)
static

Definition at line 49 of file wintrust_main.c.

50 {
52 }
static PVOID ptr
Definition: dispmode.c:27
#define GetProcessHeap()
Definition: compat.h:403
#define HeapReAlloc
Definition: compat.h:401
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32

Referenced by WINTRUST_AddCert(), WINTRUST_AddPrivData(), WINTRUST_AddSgnr(), WINTRUST_AddStore(), and WINTRUST_enumUsages().

◆ WintrustGetRegPolicyFlags()

void WINAPI WintrustGetRegPolicyFlags ( DWORD pdwPolicyFlags)

Definition at line 943 of file wintrust_main.c.

944 {
945  HKEY key;
946  LONG r;
947 
948  TRACE("%p\n", pdwPolicyFlags);
949 
950  *pdwPolicyFlags = 0;
952  KEY_READ, NULL, &key, NULL);
953  if (!r)
954  {
955  DWORD size = sizeof(DWORD);
956 
957  r = RegQueryValueExW(key, State, NULL, NULL, (LPBYTE)pdwPolicyFlags,
958  &size);
959  RegCloseKey(key);
960  if (r)
961  {
962  /* Failed to query, create and return default value */
963  *pdwPolicyFlags = WTPF_IGNOREREVOCATIONONTS |
968  WintrustSetRegPolicyFlags(*pdwPolicyFlags);
969  }
970  }
971 }
#define KEY_READ
Definition: nt_native.h:1023
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define WTPF_IGNOREREVOCATIONONTS
Definition: wintrust.h:445
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define DWORD
Definition: nt_native.h:44
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
#define WTPF_OFFLINEOKNBU_IND
Definition: wintrust.h:442
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define WTPF_OFFLINEOKNBU_COM
Definition: wintrust.h:443
#define TRACE(s)
Definition: solgame.cpp:4
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
static const WCHAR Software_Publishing[]
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WTPF_OFFLINEOK_COM
Definition: wintrust.h:441
HKEY key
Definition: reg.c:42
#define WTPF_OFFLINEOK_IND
Definition: wintrust.h:440
BOOL WINAPI WintrustSetRegPolicyFlags(DWORD dwPolicyFlags)
Definition: path.c:41

Referenced by InitFunctionPtrs(), WINTRUST_CertVerify(), and WINTRUST_DefaultVerify().

◆ WintrustSetRegPolicyFlags()

BOOL WINAPI WintrustSetRegPolicyFlags ( DWORD  dwPolicyFlags)

Definition at line 976 of file wintrust_main.c.

977 {
978  HKEY key;
979  LONG r;
980 
981  TRACE("%x\n", dwPolicyFlags);
982 
984  NULL, 0, KEY_WRITE, NULL, &key, NULL);
985  if (!r)
986  {
987  r = RegSetValueExW(key, State, 0, REG_DWORD, (LPBYTE)&dwPolicyFlags,
988  sizeof(DWORD));
989  RegCloseKey(key);
990  }
991  if (r) SetLastError(r);
992  return r == ERROR_SUCCESS;
993 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WRITE
Definition: nt_native.h:1031
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
static const WCHAR Software_Publishing[]
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
HKEY key
Definition: reg.c:42
#define REG_DWORD
Definition: sdbapi.c:596
Definition: path.c:41

Referenced by InitFunctionPtrs(), and WintrustGetRegPolicyFlags().

◆ WinVerifyTrust()

LONG WINAPI WinVerifyTrust ( HWND  hwnd,
GUID ActionID,
LPVOID  ActionData 
)

Definition at line 681 of file wintrust_main.c.

682 {
683  static const GUID unknown = { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,
684  0x00,0xC0,0x4F,0xC2,0x95,0xEE } };
685  static const GUID published_software = WIN_SPUB_ACTION_PUBLISHED_SOFTWARE;
686  static const GUID generic_verify_v2 = WINTRUST_ACTION_GENERIC_VERIFY_V2;
687  static const GUID generic_cert_verify = WINTRUST_ACTION_GENERIC_CERT_VERIFY;
688  static const GUID generic_chain_verify = WINTRUST_ACTION_GENERIC_CHAIN_VERIFY;
689  static const GUID cert_action_verify = CERT_CERTIFICATE_ACTION_VERIFY;
691  WINTRUST_DATA *actionData = ActionData;
692 
693  TRACE("(%p, %s, %p)\n", hwnd, debugstr_guid(ActionID), ActionData);
694  dump_wintrust_data(ActionData);
695 
696  /* Support for known old-style callers: */
697  if (IsEqualGUID(ActionID, &published_software))
698  err = WINTRUST_PublishedSoftware(hwnd, ActionID, ActionData);
699  else if (IsEqualGUID(ActionID, &cert_action_verify))
700  err = WINTRUST_CertActionVerify(hwnd, ActionID, ActionData);
701  else
702  {
703  DWORD stateAction;
704 
705  /* Check known actions to warn of possible problems */
706  if (!IsEqualGUID(ActionID, &unknown) &&
707  !IsEqualGUID(ActionID, &generic_verify_v2) &&
708  !IsEqualGUID(ActionID, &generic_cert_verify) &&
709  !IsEqualGUID(ActionID, &generic_chain_verify))
710  WARN("unknown action %s, default behavior may not be right\n",
711  debugstr_guid(ActionID));
712  if (WVT_ISINSTRUCT(WINTRUST_DATA, actionData->cbStruct, dwStateAction))
713  stateAction = actionData->dwStateAction;
714  else
715  {
716  TRACE("no dwStateAction, assuming WTD_STATEACTION_IGNORE\n");
717  stateAction = WTD_STATEACTION_IGNORE;
718  }
719  switch (stateAction)
720  {
722  err = WINTRUST_DefaultVerifyAndClose(hwnd, ActionID, ActionData);
723  break;
725  err = WINTRUST_DefaultVerify(hwnd, ActionID, ActionData);
726  break;
728  err = WINTRUST_DefaultClose(hwnd, ActionID, ActionData);
729  break;
730  default:
731  FIXME("unimplemented for %d\n", actionData->dwStateAction);
732  }
733  }
734 
735  TRACE("returning %08x\n", err);
736  return err;
737 }
#define WTD_STATEACTION_VERIFY
Definition: wintrust.h:123
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ERROR_SUCCESS
Definition: deptool.c:10
static LONG WINTRUST_PublishedSoftware(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
DWORD cbStruct
Definition: wintrust.h:99
#define WARN(fmt,...)
Definition: debug.h:111
#define WIN_SPUB_ACTION_PUBLISHED_SOFTWARE
Definition: wintrust.h:661
static LONG WINTRUST_DefaultVerifyAndClose(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
#define WINTRUST_ACTION_GENERIC_VERIFY_V2
Definition: softpub.h:108
long LONG
Definition: pedump.c:60
static LONG WINTRUST_CertActionVerify(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
#define FIXME(fmt,...)
Definition: debug.h:110
DWORD dwStateAction
Definition: wintrust.h:114
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: id3.c:18
#define CERT_CERTIFICATE_ACTION_VERIFY
Definition: cryptdlg.h:236
#define WINTRUST_ACTION_GENERIC_CERT_VERIFY
Definition: softpub.h:24
#define err(...)
#define WVT_ISINSTRUCT(t, s, f)
Definition: wintrust.h:433
#define WTD_STATEACTION_CLOSE
Definition: wintrust.h:124
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static LONG WINTRUST_DefaultClose(HWND hwnd, GUID *actionID, WINTRUST_DATA *data)
static void dump_wintrust_data(WINTRUST_DATA *data)
#define WINTRUST_ACTION_GENERIC_CHAIN_VERIFY
Definition: softpub.h:37
#define WTD_STATEACTION_IGNORE
Definition: wintrust.h:122

Referenced by call_winverify(), CertViewPropertiesW(), CryptUIDlgViewCertificateW(), test_wintrust(), and WinVerifyTrustEx().

◆ WinVerifyTrustEx()

HRESULT WINAPI WinVerifyTrustEx ( HWND  hwnd,
GUID ActionID,
WINTRUST_DATA ActionData 
)

Definition at line 742 of file wintrust_main.c.

744 {
745  return WinVerifyTrust(hwnd, ActionID, ActionData);
746 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LONG WINAPI WinVerifyTrust(HWND hwnd, GUID *ActionID, LPVOID ActionData)

Referenced by MsiGetFileSignatureInformationW(), and test_wintrust().

◆ WTHelperCertCheckValidSignature()

HRESULT WINAPI WTHelperCertCheckValidSignature ( CRYPT_PROVIDER_DATA pProvData)

Definition at line 1179 of file wintrust_main.c.

1180 {
1181  FIXME("Stub\n");
1182  return S_OK;
1183 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ WTHelperGetFileHandle()

HANDLE WINAPI WTHelperGetFileHandle ( WINTRUST_DATA data)

Definition at line 834 of file wintrust_main.c.

835 {
836  TRACE("%p\n",data);
837  if (data->dwUnionChoice == WTD_CHOICE_FILE)
838  return data->u.pFile->hFile;
839  else
840  return INVALID_HANDLE_VALUE;
841 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define WTD_CHOICE_FILE
Definition: wintrust.h:91
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ WTHelperGetFileName()

LPCWSTR WINAPI WTHelperGetFileName ( WINTRUST_DATA data)

Definition at line 822 of file wintrust_main.c.

823 {
824  TRACE("%p\n",data);
825  if (data->dwUnionChoice == WTD_CHOICE_FILE)
826  return data->u.pFile->pcwszFilePath;
827  else
828  return NULL;
829 }
#define WTD_CHOICE_FILE
Definition: wintrust.h:91
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ WTHelperGetKnownUsages()

BOOL WINAPI WTHelperGetKnownUsages ( DWORD  action,
PCCRYPT_OID_INFO **  usages 
)

Definition at line 896 of file wintrust_main.c.

897 {
898  BOOL ret;
899 
900  TRACE("(%d, %p)\n", action, usages);
901 
902  if (!usages)
903  {
905  return FALSE;
906  }
907 
908  if (action == 1)
909  {
910  *usages = NULL;
913  }
914  else if (action == 2)
915  {
917  *usages = NULL;
918  ret = TRUE;
919  }
920  else
921  {
922  WARN("unknown action %d\n", action);
924  ret = FALSE;
925  }
926  return ret;
927 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
void WINAPI WINTRUST_Free(void *p)
Definition: wintrust_main.c:54
BOOL WINAPI CryptEnumOIDInfo(DWORD dwGroupId, DWORD dwFlags, void *pvArg, PFN_CRYPT_ENUM_OID_INFO pfnEnumOIDInfo)
Definition: oid.c:1776
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:417
int ret
#define CRYPT_ENHKEY_USAGE_OID_GROUP_ID
Definition: wincrypt.h:1690
const WCHAR * action
Definition: action.c:7783
static PCCRYPT_OID_INFO ** usages
Definition: softpub.c:81
static BOOL WINAPI WINTRUST_enumUsages(PCCRYPT_OID_INFO pInfo, void *pvArg)

Referenced by add_known_usages_to_list(), create_advanced_filter(), and InitFunctionPtrs().

◆ WTHelperGetProvCertFromChain()

CRYPT_PROVIDER_CERT* WINAPI WTHelperGetProvCertFromChain ( CRYPT_PROVIDER_SGNR pSgnr,
DWORD  idxCert 
)

Definition at line 777 of file wintrust_main.c.

779 {
781 
782  TRACE("(%p %d)\n", pSgnr, idxCert);
783 
784  if (!pSgnr || idxCert >= pSgnr->csCertChain || !pSgnr->pasCertChain)
785  return NULL;
786  cert = &pSgnr->pasCertChain[idxCert];
787  TRACE("returning %p\n", cert);
788  return cert;
789 }
smooth NULL
Definition: ftsmooth.c:416
static BYTE cert[]
Definition: msg.c:1437
#define TRACE(s)
Definition: solgame.cpp:4
CRYPT_PROVIDER_CERT * pasCertChain
Definition: wintrust.h:235

Referenced by CRYPTDLG_CopyChain(), CryptUIDlgViewCertificateW(), MsiGetFileSignatureInformationW(), set_certificate_status_for_end_cert(), and test_WTHelperGetProvCertFromChain().

◆ WTHelperGetProvPrivateDataFromChain()

CRYPT_PROVIDER_PRIVDATA* WINAPI WTHelperGetProvPrivateDataFromChain ( CRYPT_PROVIDER_DATA pProvData,
GUID pgProviderID 
)

Definition at line 791 of file wintrust_main.c.

794 {
795  CRYPT_PROVIDER_PRIVDATA *privdata = NULL;
796  DWORD i;
797 
798  TRACE("(%p, %s)\n", pProvData, debugstr_guid(pgProviderID));
799 
800  for (i = 0; i < pProvData->csProvPrivData; i++)
801  if (IsEqualGUID(pgProviderID, &pProvData->pasProvPrivData[i].gProviderID))
802  {
803  privdata = &pProvData->pasProvPrivData[i];
804  break;
805  }
806 
807  return privdata;
808 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
CRYPT_PROVIDER_PRIVDATA * pasProvPrivData
Definition: wintrust.h:366
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ WTHelperGetProvSignerFromChain()

CRYPT_PROVIDER_SGNR* WINAPI WTHelperGetProvSignerFromChain ( CRYPT_PROVIDER_DATA pProvData,
DWORD  idxSigner,
BOOL  fCounterSigner,
DWORD  idxCounterSigner 
)

Definition at line 751 of file wintrust_main.c.

754 {
755  CRYPT_PROVIDER_SGNR *sgnr;
756 
757  TRACE("(%p %d %d %d)\n", pProvData, idxSigner, fCounterSigner,
758  idxCounterSigner);
759 
760  if (idxSigner >= pProvData->csSigners || !pProvData->pasSigners)
761  return NULL;
762  sgnr = &pProvData->pasSigners[idxSigner];
763  if (fCounterSigner)
764  {
765  if (idxCounterSigner >= sgnr->csCounterSigners ||
766  !sgnr->pasCounterSigners)
767  return NULL;
768  sgnr = &sgnr->pasCounterSigners[idxCounterSigner];
769  }
770  TRACE("returning %p\n", sgnr);
771  return sgnr;
772 }
CRYPT_PROVIDER_SGNR * pasSigners
Definition: wintrust.h:364
smooth NULL
Definition: ftsmooth.c:416
struct _CRYPT_PROVIDER_SGNR * pasCounterSigners
Definition: wintrust.h:240
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by CRYPTDLG_CopyChain(), CryptUIDlgViewCertificateW(), hierarchy_dlg_proc(), index_to_lparam(), lparam_to_index(), MsiGetFileSignatureInformationW(), set_cert_info(), set_certificate_status_for_end_cert(), show_cert_chain(), and show_dialog_for_selected_cert().

◆ WTHelperProvDataFromStateData()

CRYPT_PROVIDER_DATA* WINAPI WTHelperProvDataFromStateData ( HANDLE  hStateData)

Definition at line 813 of file wintrust_main.c.

814 {
815  TRACE("%p\n", hStateData);
816  return hStateData;
817 }
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by CryptUIDlgViewCertificateW().

Variable Documentation

◆ Software_Publishing

const WCHAR Software_Publishing[]
static
Initial value:
= {
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
'W','i','n','d','o','w','s','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'W','i','n','t','r','u','s','t','\\',
'T','r','u','s','t',' ','P','r','o','v','i','d','e','r','s','\\',
'S','o','f','t','w','a','r','e',' ',
'P','u','b','l','i','s','h','i','n','g',0 }

Definition at line 929 of file wintrust_main.c.

Referenced by test_RegPolicyFlags(), WintrustGetRegPolicyFlags(), and WintrustSetRegPolicyFlags().

◆ State

const WCHAR State[] = { 'S','t','a','t','e',0 }
static

Definition at line 938 of file wintrust_main.c.