sync wintrust and cryptui to wine 1.1.11

svn path=/trunk/; revision=38484
This commit is contained in:
Christoph von Wittich 2008-12-31 09:26:01 +00:00
parent d921149f3f
commit 66af77a707
22 changed files with 5782 additions and 232 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -8,8 +8,18 @@
<include base="ReactOS">include/reactos/wine</include>
<define name="__WINESRC__" />
<file>main.c</file>
<file>cryptui.rc</file>
<library>wine</library>
<library>unicode</library>
<library>kernel32</library>
<library>user32</library>
<library>ole32</library>
<library>crypt32</library>
<library>gdi32</library>
<library>uuid</library>
<library>urlmon</library>
<library>wintrust</library>
<library>comctl32</library>
<library>ntdll</library>
</module>
</group>

View file

@ -0,0 +1,43 @@
/*
* cryptui dll resources
*
* Copyright 2008 Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "commctrl.h"
#include "dlgs.h"
#include "cryptuires.h"
/* @makedep: smallicons.bmp */
IDB_SMALL_ICONS BITMAP LOADONCALL DISCARDABLE smallicons.bmp
/* @makedep: cert.bmp */
IDB_CERT BITMAP LOADONCALL DISCARDABLE cert.bmp
/* @makedep: certerror.bmp */
IDB_CERT_ERROR BITMAP LOADONCALL DISCARDABLE certerror.bmp
/* @makedep: certwarning.bmp */
IDB_CERT_WARNING BITMAP LOADONCALL DISCARDABLE certwarning.bmp
/* @makedep: checks.bmp */
IDB_CHECKS BITMAP LOADONCALL DISCARDABLE checks.bmp
#include "cryptui_En.rc"

View file

@ -11,11 +11,11 @@
11 stub CryptUIDlgViewCRLW
12 stub CryptUIDlgViewCTLA
13 stub CryptUIDlgViewCTLW
14 stub CryptUIDlgViewCertificateA
14 stdcall CryptUIDlgViewCertificateA(ptr ptr)
15 stub CryptUIDlgViewCertificatePropertiesA
16 stub CryptUIDlgViewCertificatePropertiesW
17 stub CryptUIDlgViewCertificateW
18 stub CryptUIDlgViewContext
17 stdcall CryptUIDlgViewCertificateW(ptr ptr)
18 stdcall CryptUIDlgViewContext(long ptr ptr wstr long ptr)
19 stub CryptUIDlgViewSignerInfoA
20 stub CryptUIDlgViewSignerInfoW
21 stub CryptUIFreeCertificatePropertiesPagesA
@ -34,7 +34,7 @@
34 stub CryptUIWizExport
35 stub CryptUIWizFreeCertRequestNoDS
36 stub CryptUIWizFreeDigitalSignContext
37 stub CryptUIWizImport
37 stdcall CryptUIWizImport(long ptr wstr ptr ptr)
38 stub CryptUIWizQueryCertRequestNoDS
39 stub CryptUIWizSubmitCertRequestNoDS
40 stub DllRegisterServer

View file

@ -0,0 +1,185 @@
/*
* cryptui dll resources
*
* Copyright 2008 Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_CERTIFICATE "Certificate"
IDS_CERTIFICATEINFORMATION "Certificate Information"
IDS_CERT_INFO_BAD_SIG "This certificate has an invalid signature. The certificate may have been altered or corrupted."
IDS_CERT_INFO_UNTRUSTED_CA "This root certificate is not trusted. To trust it, add it to your system's trusted root certificate store."
IDS_CERT_INFO_UNTRUSTED_ROOT "This certificate could not be validated to a trusted root certificate."
IDS_CERT_INFO_PARTIAL_CHAIN "This certificate's issuer could not be found."
IDS_CERT_INFO_BAD_PURPOSES "All the intended purposes of this certificate could not be verified."
IDS_CERT_INFO_PURPOSES "This cerificate is intended for the following purposes:"
IDS_SUBJECT_HEADING "Issued to: "
IDS_ISSUER_HEADING "Issued by: "
IDS_VALID_FROM "Valid from "
IDS_VALID_TO " to "
IDS_CERTIFICATE_BAD_SIGNATURE "This certificate has an invalid signature."
IDS_CERTIFICATE_BAD_TIME "This certificate has expired or is not yet valid."
IDS_CERTIFICATE_BAD_TIMENEST "This certificate's validity period exceeds that of its issuer."
IDS_CERTIFICATE_REVOKED "This certificate was revoked by its issuer."
IDS_CERTIFICATE_VALID "This certificate is OK."
IDS_FIELD "Field"
IDS_VALUE "Value"
IDS_FIELDS_ALL "<All>"
IDS_FIELDS_V1 "Version 1 Fields Only"
IDS_FIELDS_EXTENSIONS "Extensions Only"
IDS_FIELDS_CRITICAL_EXTENSIONS "Critical Extensions Only"
IDS_FIELDS_PROPERTIES "Properties Only"
IDS_FIELD_VERSION "Version"
IDS_FIELD_SERIAL_NUMBER "Serial number"
IDS_FIELD_ISSUER "Issuer"
IDS_FIELD_VALID_FROM "Valid from"
IDS_FIELD_VALID_TO "Valid to"
IDS_FIELD_SUBJECT "Subject"
IDS_FIELD_PUBLIC_KEY "Public key"
IDS_FIELD_PUBLIC_KEY_FORMAT "%s (%d bits)"
IDS_PROP_HASH "SHA1 hash"
IDS_PROP_ENHKEY_USAGE "Enhanced key usage (property)"
IDS_PROP_FRIENDLY_NAME "Friendly name"
IDS_PROP_DESCRIPTION "Description"
IDS_CERTIFICATE_PROPERTIES "Certificate Properties"
IDS_CERTIFICATE_PURPOSE_ERROR "Please enter an OID in the form 1.2.3.4"
IDS_CERTIFICATE_PURPOSE_EXISTS "The OID you entered already exists."
IDS_PURPOSE_SERVER_AUTH "Ensures the identify of a remote computer"
IDS_PURPOSE_CLIENT_AUTH "Proves your identity to a remote computer"
IDS_PURPOSE_CODE_SIGNING "Ensures software came from software publisher\nProtects software from alteration after publication"
IDS_PURPOSE_EMAIL_PROTECTION "Protects e-mail messges"
IDS_PURPOSE_IPSEC "Allows secure communication over the Internet"
IDS_PURPOSE_TIMESTAMP_SIGNING "Allows data to be signed with the current time"
IDS_PURPOSE_CTL_USAGE_SIGNING "Allows you to digitally sign a certificate trust list"
IDS_PURPOSE_EFS "Allows data on disk to be encrypted"
IDS_PURPOSE_EFS_RECOVERY "File Recovery"
IDS_PURPOSE_WHQL "Windows Hardware Driver Verification"
IDS_PURPOSE_NT5 "Windows System Component Verification"
IDS_PURPOSE_OEM_WHQL "OEM Windows System Component Verification"
IDS_PURPOSE_EMBEDDED_NT "Embedded Windows System Component Verification"
IDS_PURPOSE_ROOT_LIST_SIGNER "Root List Signer"
IDS_PURPOSE_QUALIFIED_SUBORDINATION "Qualified Subordination"
IDS_PURPOSE_KEY_RECOVERY "Key Recovery"
IDS_PURPOSE_DOCUMENT_SIGNING "Document Signing"
IDS_PURPOSE_LIFETIME_SIGNING "Lifetime Signing"
IDS_PURPOSE_DRM "Digital Rights"
IDS_PURPOSE_LICENSES "Key Pack Licenses"
IDS_PURPOSE_LICENSE_SERVER "License Server Verification"
IDS_PURPOSE_ENROLLMENT_AGENT "Certificate Request Agent"
IDS_PURPOSE_SMARTCARD_LOGON "Smart Card Logon"
IDS_PURPOSE_CA_EXCHANGE "Private Key Archival"
IDS_PURPOSE_KEY_RECOVERY_AGENT "Key Recovery Agent"
IDS_PURPOSE_DS_EMAIL_REPLICATION "Directory Service Email Replication"
}
IDD_GENERAL DIALOG DISCARDABLE 0, 0, 255, 236
CAPTION "General"
STYLE WS_VISIBLE
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "", IDC_STATIC, "Static", WS_BORDER|SS_WHITERECT, 6,10,241,200
CONTROL "", IDC_CERTIFICATE_ICON,"RichEdit20W",
ES_READONLY|WS_DISABLED,8,11,26,26
CONTROL "", IDC_CERTIFICATE_INFO,"RichEdit20W",
ES_READONLY|WS_DISABLED,34,11,212,26
CONTROL "", IDC_STATIC, "Static", SS_BLACKFRAME, 16,37,222,1
CONTROL "", IDC_CERTIFICATE_STATUS,"RichEdit20W",
ES_READONLY|ES_MULTILINE|WS_DISABLED,8,38,238,78
CONTROL "", IDC_STATIC, "Static", SS_BLACKFRAME, 16,116,222,1
CONTROL "", IDC_CERTIFICATE_NAMES,"RichEdit20W",
ES_READONLY|ES_MULTILINE|WS_DISABLED,8,117,238,91
PUSHBUTTON "&Install Certificate...", IDC_ADDTOSTORE,103,216,70,14
PUSHBUTTON "Issuer &Statement", IDC_ISSUERSTATEMENT,177,216,70,14
END
IDD_DETAIL DIALOG DISCARDABLE 0, 0, 255, 236
CAPTION "Details"
STYLE WS_VISIBLE
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Show:", stc1, 6,12,40,14
COMBOBOX IDC_DETAIL_SELECT, 28,10,100,14,
CBS_DROPDOWNLIST|WS_BORDER|WS_VSCROLL|WS_TABSTOP
CONTROL "", IDC_DETAIL_LIST, "SysListView32",
LVS_REPORT|LVS_SINGLESEL|WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER,
6,28,241,100
CONTROL "", IDC_DETAIL_VALUE, "RichEdit20W",
ES_READONLY|ES_MULTILINE|WS_TABSTOP, 6,136,241,70
PUSHBUTTON "&Edit Properties...", IDC_EDITPROPERTIES,103,216,70,14
PUSHBUTTON "&Copy to File...", IDC_EXPORT,177,216,70,14
END
IDD_HIERARCHY DIALOG DISCARDABLE 0, 0, 255, 236
CAPTION "Certification Path"
STYLE WS_VISIBLE
FONT 8, "MS Shell Dlg"
BEGIN
GROUPBOX "Certification &path", grp1,6,10,245,165, BS_GROUPBOX
CONTROL "",IDC_CERTPATH, "SysTreeView32", TVS_HASLINES|WS_BORDER,
13,22,231,130
PUSHBUTTON "&View Certificate", IDC_VIEWCERTIFICATE,175,156,70,14
LTEXT "Certificate &status:", IDC_CERTIFICATESTATUS,6,183,70,14
CONTROL "", IDC_CERTIFICATESTATUSTEXT,"RichEdit20W",
WS_BORDER|ES_READONLY|ES_MULTILINE|WS_DISABLED,6,195,245,36
END
IDD_USERNOTICE DIALOG DISCARDABLE 0, 0, 255, 256
CAPTION "Disclaimer"
STYLE WS_VISIBLE
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "", IDC_USERNOTICE,"RichEdit20W",
WS_BORDER|ES_READONLY|ES_MULTILINE|WS_DISABLED,6,10,241,200
PUSHBUTTON "Close", IDOK,103,216,70,14
PUSHBUTTON "More &Info", IDC_CPS,177,216,70,14
END
IDD_CERT_PROPERTIES_GENERAL DIALOG DISCARDABLE 0, 0, 255, 236
CAPTION "General"
STYLE WS_VISIBLE
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Friendly name:", stc1, 6,14,60,14
EDITTEXT IDC_FRIENDLY_NAME, 60,12,191,14, ES_AUTOHSCROLL|WS_TABSTOP
LTEXT "&Description:", stc2, 6,32,60,14
EDITTEXT IDC_DESCRIPTION, 60,30,191,14, ES_AUTOVSCROLL|ES_MULTILINE|WS_TABSTOP|WS_VSCROLL
GROUPBOX "Certificate purposes", grp1,6,48,245,165, BS_GROUPBOX
AUTORADIOBUTTON "&Enable all purposes for this certificate",
IDC_ENABLE_ALL_PURPOSES, 12,58,180,14, BS_AUTORADIOBUTTON|WS_TABSTOP
AUTORADIOBUTTON "D&isable all purposes for this certificate",
IDC_DISABLE_ALL_PURPOSES, 12,70,180,14, BS_AUTORADIOBUTTON
AUTORADIOBUTTON "Enable &only the following purposes for this certificate:",
IDC_ENABLE_SELECTED_PURPOSES, 12,82,180,14, BS_AUTORADIOBUTTON
CONTROL "", IDC_CERTIFICATE_USAGES,"SysListView32",
LVS_REPORT|LVS_NOCOLUMNHEADER|LVS_SINGLESEL|WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER,
24,100,220,90
PUSHBUTTON "Add &Purpose...", IDC_ADD_PURPOSE,184,194,60,14
END
IDD_ADD_CERT_PURPOSE DIALOG DISCARDABLE 0,0,200,68
CAPTION "Add Purpose"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Add the object identifier (OID) for the certificate purpose you wish to add:",
stc1, 6,6,190,28
EDITTEXT IDC_NEW_PURPOSE, 6,28,190,14, ES_AUTOVSCROLL|ES_MULTILINE|WS_TABSTOP|WS_VSCROLL
PUSHBUTTON "OK", IDOK, 33,48,60,14
PUSHBUTTON "Cancel", IDCANCEL, 100,48,60,14
END

View file

@ -0,0 +1,134 @@
/*
* Copyright 2008 Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __CRYPTUIRES_H_
#define __CRYPTUIRES_H_
#define IDS_CERTIFICATE 1000
#define IDS_CERTIFICATEINFORMATION 1001
#define IDS_CERT_INFO_BAD_SIG 1002
#define IDS_CERT_INFO_UNTRUSTED_CA 1003
#define IDS_CERT_INFO_UNTRUSTED_ROOT 1004
#define IDS_CERT_INFO_PARTIAL_CHAIN 1005
#define IDS_CERT_INFO_BAD_PURPOSES 1006
#define IDS_CERT_INFO_PURPOSES 1007
#define IDS_SUBJECT_HEADING 1010
#define IDS_ISSUER_HEADING 1011
#define IDS_VALID_FROM 1012
#define IDS_VALID_TO 1013
#define IDS_CERTIFICATE_BAD_SIGNATURE 1014
#define IDS_CERTIFICATE_BAD_TIME 1015
#define IDS_CERTIFICATE_BAD_TIMENEST 1016
#define IDS_CERTIFICATE_REVOKED 1017
#define IDS_CERTIFICATE_VALID 1018
#define IDS_FIELD 1019
#define IDS_VALUE 1020
#define IDS_FIELDS_ALL 1021
#define IDS_FIELDS_V1 1022
#define IDS_FIELDS_EXTENSIONS 1023
#define IDS_FIELDS_CRITICAL_EXTENSIONS 1024
#define IDS_FIELDS_PROPERTIES 1025
#define IDS_FIELD_VERSION 1026
#define IDS_FIELD_SERIAL_NUMBER 1027
#define IDS_FIELD_ISSUER 1028
#define IDS_FIELD_VALID_FROM 1029
#define IDS_FIELD_VALID_TO 1030
#define IDS_FIELD_SUBJECT 1031
#define IDS_FIELD_PUBLIC_KEY 1032
#define IDS_FIELD_PUBLIC_KEY_FORMAT 1033
#define IDS_PROP_HASH 1034
#define IDS_PROP_ENHKEY_USAGE 1035
#define IDS_PROP_FRIENDLY_NAME 1036
#define IDS_PROP_DESCRIPTION 1037
#define IDS_CERTIFICATE_PROPERTIES 1038
#define IDS_CERTIFICATE_PURPOSE_ERROR 1039
#define IDS_CERTIFICATE_PURPOSE_EXISTS 1040
#define IDS_PURPOSE_SERVER_AUTH 1100
#define IDS_PURPOSE_CLIENT_AUTH 1101
#define IDS_PURPOSE_CODE_SIGNING 1102
#define IDS_PURPOSE_EMAIL_PROTECTION 1103
#define IDS_PURPOSE_IPSEC 1104
#define IDS_PURPOSE_TIMESTAMP_SIGNING 1105
#define IDS_PURPOSE_CTL_USAGE_SIGNING 1106
#define IDS_PURPOSE_EFS 1107
#define IDS_PURPOSE_EFS_RECOVERY 1108
#define IDS_PURPOSE_WHQL 1109
#define IDS_PURPOSE_NT5 1110
#define IDS_PURPOSE_OEM_WHQL 1111
#define IDS_PURPOSE_EMBEDDED_NT 1112
#define IDS_PURPOSE_ROOT_LIST_SIGNER 1113
#define IDS_PURPOSE_QUALIFIED_SUBORDINATION 1114
#define IDS_PURPOSE_KEY_RECOVERY 1115
#define IDS_PURPOSE_DOCUMENT_SIGNING 1116
#define IDS_PURPOSE_LIFETIME_SIGNING 1117
#define IDS_PURPOSE_DRM 1118
#define IDS_PURPOSE_LICENSES 1119
#define IDS_PURPOSE_LICENSE_SERVER 1120
#define IDS_PURPOSE_ENROLLMENT_AGENT 1121
#define IDS_PURPOSE_SMARTCARD_LOGON 1122
#define IDS_PURPOSE_CA_EXCHANGE 1123
#define IDS_PURPOSE_KEY_RECOVERY_AGENT 1124
#define IDS_PURPOSE_DS_EMAIL_REPLICATION 1125
#define IDD_GENERAL 100
#define IDD_DETAIL 101
#define IDD_HIERARCHY 102
#define IDD_USERNOTICE 103
#define IDD_CERT_PROPERTIES_GENERAL 104
#define IDD_ADD_CERT_PURPOSE 105
#define IDB_SMALL_ICONS 200
#define IDB_CERT 201
#define IDB_CERT_ERROR 202
#define IDB_CERT_WARNING 203
#define IDB_CHECKS 204
#define IDC_STATIC 2000
#define IDC_CERTIFICATE_ICON 2001
#define IDC_CERTIFICATE_INFO 2002
#define IDC_CERTIFICATE_STATUS 2003
#define IDC_CERTIFICATE_NAMES 2004
#define IDC_ADDTOSTORE 2005
#define IDC_ISSUERSTATEMENT 2006
#define IDC_DETAIL_SELECT 2100
#define IDC_DETAIL_LIST 2101
#define IDC_DETAIL_VALUE 2102
#define IDC_EDITPROPERTIES 2103
#define IDC_EXPORT 2104
#define IDC_VIEWCERTIFICATE 2200
#define IDC_CERTPATH 2201
#define IDC_CERTIFICATESTATUS 2202
#define IDC_CERTIFICATESTATUSTEXT 2203
#define IDC_USERNOTICE 2300
#define IDC_CPS 2301
#define IDC_FRIENDLY_NAME 2400
#define IDC_DESCRIPTION 2401
#define IDC_ENABLE_ALL_PURPOSES 2402
#define IDC_DISABLE_ALL_PURPOSES 2403
#define IDC_ENABLE_SELECTED_PURPOSES 2404
#define IDC_CERTIFICATE_USAGES 2405
#define IDC_ADD_PURPOSE 2406
#define IDC_NEW_PURPOSE 2500
#endif /* ndef __CRYPTUIRES_H_ */

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -49,7 +49,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(cryptasn);
#endif
#define ASN_BOOL (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x01)
#define ASN_BITSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x03)
#define ASN_BMPSTRING (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x1e)
static BOOL CRYPT_EncodeLen(DWORD len, BYTE *pbEncoded, DWORD *pcbEncoded)
{
@ -290,7 +292,7 @@ struct AsnEncodeSequenceItem
DWORD size; /* used during encoding, not for your use */
};
static BOOL WINAPI CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType,
static BOOL CRYPT_AsnEncodeSequence(DWORD dwCertEncodingType,
struct AsnEncodeSequenceItem items[], DWORD cItem, BYTE *pbEncoded,
DWORD *pcbEncoded)
{
@ -738,6 +740,362 @@ BOOL WINAPI WVTAsn1SpcIndirectDataContentEncode(DWORD dwCertEncodingType,
return ret;
}
static BOOL WINAPI CRYPT_AsnEncodeBMPString(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded,
DWORD *pcbEncoded)
{
BOOL ret = TRUE;
LPCWSTR str = (LPCWSTR)pvStructInfo;
DWORD bytesNeeded, lenBytes, strLen;
if (str)
strLen = lstrlenW(str);
else
strLen = 0;
CRYPT_EncodeLen(strLen * 2, NULL, &lenBytes);
bytesNeeded = 1 + lenBytes + strLen * 2;
if (!pbEncoded)
*pcbEncoded = bytesNeeded;
else if (*pcbEncoded < bytesNeeded)
{
*pcbEncoded = bytesNeeded;
SetLastError(ERROR_MORE_DATA);
ret = FALSE;
}
else
{
DWORD i;
*pcbEncoded = bytesNeeded;
*pbEncoded++ = ASN_BMPSTRING;
CRYPT_EncodeLen(strLen * 2, pbEncoded, &lenBytes);
pbEncoded += lenBytes;
for (i = 0; i < strLen; i++)
{
*pbEncoded++ = (str[i] & 0xff00) >> 8;
*pbEncoded++ = str[i] & 0x00ff;
}
}
return ret;
}
struct AsnEncodeTagSwappedItem
{
BYTE tag;
const void *pvStructInfo;
CryptEncodeObjectFunc encodeFunc;
};
/* Sort of a wacky hack, it encodes something using the struct
* AsnEncodeTagSwappedItem's encodeFunc, then replaces the tag byte with the tag
* given in the struct AsnEncodeTagSwappedItem.
*/
static BOOL WINAPI CRYPT_AsnEncodeSwapTag(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded,
DWORD *pcbEncoded)
{
BOOL ret;
const struct AsnEncodeTagSwappedItem *item = pvStructInfo;
ret = item->encodeFunc(dwCertEncodingType, lpszStructType,
item->pvStructInfo, pbEncoded, pcbEncoded);
if (ret && pbEncoded)
*pbEncoded = item->tag;
return ret;
}
BOOL WINAPI WVTAsn1SpcSpOpusInfoEncode(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded,
DWORD *pcbEncoded)
{
BOOL ret = FALSE;
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
debugstr_a(lpszStructType), pvStructInfo, pbEncoded, pcbEncoded);
__TRY
{
const SPC_SP_OPUS_INFO *info = pvStructInfo;
if (info->pMoreInfo &&
info->pMoreInfo->dwLinkChoice != SPC_URL_LINK_CHOICE &&
info->pMoreInfo->dwLinkChoice != SPC_MONIKER_LINK_CHOICE &&
info->pMoreInfo->dwLinkChoice != SPC_FILE_LINK_CHOICE)
SetLastError(E_INVALIDARG);
else if (info->pPublisherInfo &&
info->pPublisherInfo->dwLinkChoice != SPC_URL_LINK_CHOICE &&
info->pPublisherInfo->dwLinkChoice != SPC_MONIKER_LINK_CHOICE &&
info->pPublisherInfo->dwLinkChoice != SPC_FILE_LINK_CHOICE)
SetLastError(E_INVALIDARG);
else
{
struct AsnEncodeSequenceItem items[3] = { { 0 } };
struct AsnConstructedItem constructed[3] = { { 0 } };
struct AsnEncodeTagSwappedItem swapped;
DWORD cItem = 0, cConstructed = 0;
if (info->pwszProgramName)
{
swapped.tag = ASN_CONTEXT;
swapped.pvStructInfo = info->pwszProgramName;
swapped.encodeFunc = CRYPT_AsnEncodeBMPString;
constructed[cConstructed].tag = 0;
constructed[cConstructed].pvStructInfo = &swapped;
constructed[cConstructed].encodeFunc = CRYPT_AsnEncodeSwapTag;
items[cItem].pvStructInfo = &constructed[cConstructed];
items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed;
cConstructed++;
cItem++;
}
if (info->pMoreInfo)
{
constructed[cConstructed].tag = 1;
constructed[cConstructed].pvStructInfo = info->pMoreInfo;
constructed[cConstructed].encodeFunc = WVTAsn1SpcLinkEncode;
items[cItem].pvStructInfo = &constructed[cConstructed];
items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed;
cConstructed++;
cItem++;
}
if (info->pPublisherInfo)
{
constructed[cConstructed].tag = 2;
constructed[cConstructed].pvStructInfo = info->pPublisherInfo;
constructed[cConstructed].encodeFunc = WVTAsn1SpcLinkEncode;
items[cItem].pvStructInfo = &constructed[cConstructed];
items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed;
cConstructed++;
cItem++;
}
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
items, cItem, pbEncoded, pcbEncoded);
}
}
__EXCEPT_PAGE_FAULT
{
SetLastError(STATUS_ACCESS_VIOLATION);
}
__ENDTRY
return ret;
}
static BOOL CRYPT_AsnEncodeInteger(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded,
DWORD *pcbEncoded)
{
BOOL ret;
__TRY
{
DWORD significantBytes, lenBytes, bytesNeeded;
BYTE padByte = 0;
BOOL pad = FALSE;
const CRYPT_INTEGER_BLOB *blob =
(const CRYPT_INTEGER_BLOB *)pvStructInfo;
significantBytes = blob->cbData;
if (significantBytes)
{
if (blob->pbData[significantBytes - 1] & 0x80)
{
/* negative, lop off leading (little-endian) 0xffs */
for (; significantBytes > 0 &&
blob->pbData[significantBytes - 1] == 0xff; significantBytes--)
;
if (blob->pbData[significantBytes - 1] < 0x80)
{
padByte = 0xff;
pad = TRUE;
}
}
else
{
/* positive, lop off leading (little-endian) zeroes */
for (; significantBytes > 0 &&
!blob->pbData[significantBytes - 1]; significantBytes--)
;
if (significantBytes == 0)
significantBytes = 1;
if (blob->pbData[significantBytes - 1] > 0x7f)
{
padByte = 0;
pad = TRUE;
}
}
}
if (pad)
CRYPT_EncodeLen(significantBytes + 1, NULL, &lenBytes);
else
CRYPT_EncodeLen(significantBytes, NULL, &lenBytes);
bytesNeeded = 1 + lenBytes + significantBytes;
if (pad)
bytesNeeded++;
if (!pbEncoded)
{
*pcbEncoded = bytesNeeded;
ret = TRUE;
}
else if (*pcbEncoded < bytesNeeded)
{
*pcbEncoded = bytesNeeded;
SetLastError(ERROR_MORE_DATA);
ret = FALSE;
}
else
{
*pcbEncoded = bytesNeeded;
*pbEncoded++ = ASN_INTEGER;
if (pad)
{
CRYPT_EncodeLen(significantBytes + 1, pbEncoded, &lenBytes);
pbEncoded += lenBytes;
*pbEncoded++ = padByte;
}
else
{
CRYPT_EncodeLen(significantBytes, pbEncoded, &lenBytes);
pbEncoded += lenBytes;
}
for (; significantBytes > 0; significantBytes--)
*(pbEncoded++) = blob->pbData[significantBytes - 1];
ret = TRUE;
}
}
__EXCEPT_PAGE_FAULT
{
SetLastError(STATUS_ACCESS_VIOLATION);
ret = FALSE;
}
__ENDTRY
return ret;
}
BOOL WINAPI CRYPT_AsnEncodeInt(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded,
DWORD *pcbEncoded)
{
CRYPT_INTEGER_BLOB blob = { sizeof(INT), (BYTE *)pvStructInfo };
return CRYPT_AsnEncodeInteger(dwCertEncodingType, X509_MULTI_BYTE_INTEGER,
&blob, pbEncoded, pcbEncoded);
}
BOOL WINAPI WVTAsn1CatMemberInfoEncode(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded,
DWORD *pcbEncoded)
{
BOOL ret = FALSE;
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
debugstr_a(lpszStructType), pvStructInfo, pbEncoded, pcbEncoded);
__TRY
{
const CAT_MEMBERINFO *info = (const CAT_MEMBERINFO *)pvStructInfo;
struct AsnEncodeSequenceItem items[] = {
{ info->pwszSubjGuid, CRYPT_AsnEncodeBMPString, 0 },
{ &info->dwCertVersion, CRYPT_AsnEncodeInt, 0 },
};
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
}
__EXCEPT_PAGE_FAULT
{
SetLastError(STATUS_ACCESS_VIOLATION);
}
__ENDTRY
return ret;
}
BOOL WINAPI WVTAsn1CatNameValueEncode(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded,
DWORD *pcbEncoded)
{
BOOL ret = FALSE;
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
debugstr_a(lpszStructType), pvStructInfo, pbEncoded, pcbEncoded);
__TRY
{
const CAT_NAMEVALUE *value = (const CAT_NAMEVALUE *)pvStructInfo;
struct AsnEncodeSequenceItem items[] = {
{ value->pwszTag, CRYPT_AsnEncodeBMPString, 0 },
{ &value->fdwFlags, CRYPT_AsnEncodeInt, 0 },
{ &value->Value, CRYPT_AsnEncodeOctets, 0 },
};
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
}
__EXCEPT_PAGE_FAULT
{
SetLastError(STATUS_ACCESS_VIOLATION);
}
__ENDTRY
return ret;
}
static BOOL WINAPI CRYPT_AsnEncodeBool(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded,
DWORD *pcbEncoded)
{
BOOL val = *(const BOOL *)pvStructInfo, ret;
TRACE("%d\n", val);
if (!pbEncoded)
{
*pcbEncoded = 3;
ret = TRUE;
}
else if (*pcbEncoded < 3)
{
*pcbEncoded = 3;
SetLastError(ERROR_MORE_DATA);
ret = FALSE;
}
else
{
*pcbEncoded = 3;
*pbEncoded++ = ASN_BOOL;
*pbEncoded++ = 1;
*pbEncoded++ = val ? 0xff : 0;
ret = TRUE;
}
TRACE("returning %d (%08x)\n", ret, GetLastError());
return ret;
}
BOOL WINAPI WVTAsn1SpcFinancialCriteriaInfoEncode(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded,
DWORD *pcbEncoded)
{
BOOL ret = FALSE;
TRACE("(0x%08x, %s, %p, %p, %p)\n", dwCertEncodingType,
debugstr_a(lpszStructType), pvStructInfo, pbEncoded, pcbEncoded);
__TRY
{
const SPC_FINANCIAL_CRITERIA *criteria = pvStructInfo;
struct AsnEncodeSequenceItem items[] = {
{ &criteria->fFinancialInfoAvailable, CRYPT_AsnEncodeBool, 0 },
{ &criteria->fMeetsCriteria, CRYPT_AsnEncodeBool, 0 },
};
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
}
__EXCEPT_PAGE_FAULT
{
SetLastError(STATUS_ACCESS_VIOLATION);
}
__ENDTRY
return ret;
}
/* Gets the number of length bytes from the given (leading) length byte */
#define GET_LEN_BYTES(b) ((b) <= 0x7f ? 1 : 1 + ((b) & 0x7f))
@ -868,7 +1226,7 @@ static BOOL WINAPI CRYPT_AsnDecodeOctets(DWORD dwCertEncodingType,
return ret;
}
static BOOL WINAPI CRYPT_AsnDecodeSPCLinkInternal(DWORD dwCertEncodingType,
static BOOL CRYPT_AsnDecodeSPCLinkInternal(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
void *pvStructInfo, DWORD *pcbStructInfo)
{
@ -1733,3 +2091,271 @@ BOOL WINAPI WVTAsn1SpcSpOpusInfoDecode(DWORD dwCertEncodingType,
pvStructInfo, *pcbStructInfo);
return FALSE;
}
static BOOL WINAPI CRYPT_AsnDecodeBMPString(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
void *pvStructInfo, DWORD *pcbStructInfo)
{
BOOL ret;
DWORD bytesNeeded, dataLen;
if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
{
BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
bytesNeeded = dataLen + 2 + sizeof(LPWSTR);
if (!pvStructInfo)
*pcbStructInfo = bytesNeeded;
else if (*pcbStructInfo < bytesNeeded)
{
*pcbStructInfo = bytesNeeded;
SetLastError(ERROR_MORE_DATA);
ret = FALSE;
}
else
{
LPWSTR str;
DWORD i;
*pcbStructInfo = bytesNeeded;
assert(pvStructInfo);
str = *(LPWSTR *)pvStructInfo;
for (i = 0; i < dataLen / 2; i++)
str[i] = (pbEncoded[1 + lenBytes + 2 * i] << 8) |
pbEncoded[1 + lenBytes + 2 * i + 1];
/* Decoded string is always NULL-terminated */
str[i] = '\0';
}
}
return ret;
}
static BOOL CRYPT_AsnDecodeInteger(const BYTE *pbEncoded,
DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo)
{
BOOL ret;
DWORD bytesNeeded, dataLen;
if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen)))
{
BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
bytesNeeded = dataLen + sizeof(CRYPT_INTEGER_BLOB);
if (!pvStructInfo)
*pcbStructInfo = bytesNeeded;
else if (*pcbStructInfo < bytesNeeded)
{
*pcbStructInfo = bytesNeeded;
SetLastError(ERROR_MORE_DATA);
ret = FALSE;
}
else
{
CRYPT_INTEGER_BLOB *blob = (CRYPT_INTEGER_BLOB *)pvStructInfo;
*pcbStructInfo = bytesNeeded;
blob->cbData = dataLen;
assert(blob->pbData);
if (blob->cbData)
{
DWORD i;
for (i = 0; i < blob->cbData; i++)
{
blob->pbData[i] = *(pbEncoded + 1 + lenBytes +
dataLen - i - 1);
}
}
}
}
return ret;
}
/* Ignores tag. Only allows integers 4 bytes or smaller in size. */
static BOOL WINAPI CRYPT_AsnDecodeInt(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
void *pvStructInfo, DWORD *pcbStructInfo)
{
BOOL ret;
BYTE buf[sizeof(CRYPT_INTEGER_BLOB) + sizeof(int)];
CRYPT_INTEGER_BLOB *blob = (CRYPT_INTEGER_BLOB *)buf;
DWORD size = sizeof(buf);
blob->pbData = buf + sizeof(CRYPT_INTEGER_BLOB);
ret = CRYPT_AsnDecodeInteger(pbEncoded, cbEncoded, 0, buf, &size);
if (ret)
{
if (!pvStructInfo)
*pcbStructInfo = sizeof(int);
else if (*pcbStructInfo < sizeof(int))
{
*pcbStructInfo = sizeof(int);
SetLastError(ERROR_MORE_DATA);
ret = FALSE;
}
else
{
int val;
DWORD i;
*pcbStructInfo = sizeof(int);
if (blob->pbData[blob->cbData - 1] & 0x80)
{
/* initialize to a negative value to sign-extend */
val = -1;
}
else
val = 0;
for (i = 0; i < blob->cbData; i++)
{
val <<= 8;
val |= blob->pbData[blob->cbData - i - 1];
}
memcpy(pvStructInfo, &val, sizeof(int));
}
}
else if (GetLastError() == ERROR_MORE_DATA)
SetLastError(CRYPT_E_ASN1_LARGE);
return ret;
}
BOOL WINAPI WVTAsn1CatMemberInfoDecode(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
void *pvStructInfo, DWORD *pcbStructInfo)
{
BOOL ret = FALSE;
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo);
__TRY
{
struct AsnDecodeSequenceItem items[] = {
{ ASN_BMPSTRING, offsetof(CAT_MEMBERINFO, pwszSubjGuid),
CRYPT_AsnDecodeBMPString, sizeof(LPWSTR), FALSE, TRUE,
offsetof(CAT_MEMBERINFO, pwszSubjGuid), 0 },
{ ASN_INTEGER, offsetof(CAT_MEMBERINFO, dwCertVersion),
CRYPT_AsnDecodeInt, sizeof(DWORD),
FALSE, FALSE, 0, 0 },
};
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo, NULL);
}
__EXCEPT_PAGE_FAULT
{
SetLastError(STATUS_ACCESS_VIOLATION);
}
__ENDTRY
TRACE("returning %d\n", ret);
return ret;
}
BOOL WINAPI WVTAsn1CatNameValueDecode(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
void *pvStructInfo, DWORD *pcbStructInfo)
{
BOOL ret = FALSE;
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo);
__TRY
{
struct AsnDecodeSequenceItem items[] = {
{ ASN_BMPSTRING, offsetof(CAT_NAMEVALUE, pwszTag),
CRYPT_AsnDecodeBMPString, sizeof(LPWSTR), FALSE, TRUE,
offsetof(CAT_NAMEVALUE, pwszTag), 0 },
{ ASN_INTEGER, offsetof(CAT_NAMEVALUE, fdwFlags),
CRYPT_AsnDecodeInt, sizeof(DWORD), FALSE, FALSE, 0, 0 },
{ ASN_OCTETSTRING, offsetof(CAT_NAMEVALUE, Value),
CRYPT_AsnDecodeOctets, sizeof(CRYPT_DER_BLOB), FALSE, TRUE,
offsetof(CAT_NAMEVALUE, Value.pbData), 0 },
};
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo, NULL);
}
__EXCEPT_PAGE_FAULT
{
SetLastError(STATUS_ACCESS_VIOLATION);
}
__ENDTRY
TRACE("returning %d\n", ret);
return ret;
}
static BOOL WINAPI CRYPT_AsnDecodeBool(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
void *pvStructInfo, DWORD *pcbStructInfo)
{
BOOL ret;
if (cbEncoded < 3)
{
SetLastError(CRYPT_E_ASN1_CORRUPT);
return FALSE;
}
if (GET_LEN_BYTES(pbEncoded[1]) > 1)
{
SetLastError(CRYPT_E_ASN1_CORRUPT);
return FALSE;
}
if (pbEncoded[1] > 1)
{
SetLastError(CRYPT_E_ASN1_CORRUPT);
return FALSE;
}
if (!pvStructInfo)
{
*pcbStructInfo = sizeof(BOOL);
ret = TRUE;
}
else if (*pcbStructInfo < sizeof(BOOL))
{
*pcbStructInfo = sizeof(BOOL);
SetLastError(ERROR_MORE_DATA);
ret = FALSE;
}
else
{
*pcbStructInfo = sizeof(BOOL);
*(BOOL *)pvStructInfo = pbEncoded[2] ? TRUE : FALSE;
ret = TRUE;
}
TRACE("returning %d (%08x)\n", ret, GetLastError());
return ret;
}
BOOL WINAPI WVTAsn1SpcFinancialCriteriaInfoDecode(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
void *pvStructInfo, DWORD *pcbStructInfo)
{
BOOL ret = FALSE;
TRACE("(%p, %d, %08x, %p, %d)\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo);
__TRY
{
struct AsnDecodeSequenceItem items[] = {
{ ASN_BOOL, offsetof(SPC_FINANCIAL_CRITERIA, fFinancialInfoAvailable),
CRYPT_AsnDecodeBool, sizeof(BOOL), FALSE, FALSE, 0, 0 },
{ ASN_BOOL, offsetof(SPC_FINANCIAL_CRITERIA, fMeetsCriteria),
CRYPT_AsnDecodeBool, sizeof(BOOL), FALSE, FALSE, 0, 0 },
};
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo, NULL);
}
__EXCEPT_PAGE_FAULT
{
SetLastError(STATUS_ACCESS_VIOLATION);
}
__ENDTRY
TRACE("returning %d\n", ret);
return ret;
}

View file

@ -32,9 +32,25 @@
#include "imagehlp.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
#define CATADMIN_MAGIC 0x43415441 /* 'CATA' */
#define CATINFO_MAGIC 0x43415449 /* 'CATI' */
struct catadmin
{
DWORD magic;
WCHAR path[MAX_PATH];
};
struct catinfo
{
DWORD magic;
WCHAR file[MAX_PATH];
};
/***********************************************************************
* CryptCATAdminAcquireContext (WINTRUST.@)
*
@ -42,7 +58,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
*
* PARAMS
* catAdmin [O] Pointer to the context handle.
* sysSystem [I] Pointer to a GUID for the needed subsystem.
* sys [I] Pointer to a GUID for the needed subsystem.
* dwFlags [I] Reserved.
*
* RETURNS
@ -50,31 +66,108 @@ WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
* Failure: FALSE.
*
*/
BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN* catAdmin,
const GUID *sysSystem, DWORD dwFlags )
BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin,
const GUID *sys, DWORD dwFlags)
{
FIXME("%p %s %x\n", catAdmin, debugstr_guid(sysSystem), dwFlags);
static const WCHAR catroot[] =
{'\\','c','a','t','r','o','o','t',0};
static const WCHAR fmt[] =
{'%','s','\\','{','%','0','8','x','-','%','0','4','x','-','%','0',
'4','x','-','%','0','2','x','%','0','2','x','-','%','0','2','x',
'%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x',
'%','0','2','x','}',0};
static const GUID defsys =
{0x127d0a1d,0x4ef2,0x11d1,{0x86,0x08,0x00,0xc0,0x4f,0xc2,0x95,0xee}};
WCHAR catroot_dir[MAX_PATH];
struct catadmin *ca;
TRACE("%p %s %x\n", catAdmin, debugstr_guid(sys), dwFlags);
if (!catAdmin)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!(ca = HeapAlloc(GetProcessHeap(), 0, sizeof(*ca))))
{
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
*catAdmin = (HCATADMIN)0xdeadbeef;
GetSystemDirectoryW(catroot_dir, MAX_PATH);
strcatW(catroot_dir, catroot);
/* create the directory if it doesn't exist */
CreateDirectoryW(catroot_dir, NULL);
if (!sys) sys = &defsys;
sprintfW(ca->path, fmt, catroot_dir, sys->Data1, sys->Data2,
sys->Data3, sys->Data4[0], sys->Data4[1], sys->Data4[2],
sys->Data4[3], sys->Data4[4], sys->Data4[5], sys->Data4[6],
sys->Data4[7]);
/* create the directory if it doesn't exist */
CreateDirectoryW(ca->path, NULL);
ca->magic = CATADMIN_MAGIC;
*catAdmin = ca;
return TRUE;
}
/***********************************************************************
* CryptCATAdminAddCatalog (WINTRUST.@)
*/
BOOL WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
PWSTR selectBaseName, DWORD flags)
HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
PWSTR selectBaseName, DWORD flags)
{
FIXME("%p %s %s %d\n", catAdmin, debugstr_w(catalogFile),
static const WCHAR slashW[] = {'\\',0};
struct catadmin *ca = catAdmin;
struct catinfo *ci;
WCHAR *target;
DWORD len;
TRACE("%p %s %s %d\n", catAdmin, debugstr_w(catalogFile),
debugstr_w(selectBaseName), flags);
return TRUE;
if (!selectBaseName)
{
FIXME("NULL basename not handled\n");
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!ca || ca->magic != CATADMIN_MAGIC || !catalogFile || flags)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
len = strlenW(ca->path) + strlenW(selectBaseName) + 2;
if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
{
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
strcpyW(target, ca->path);
strcatW(target, slashW);
strcatW(target, selectBaseName);
if (!CopyFileW(catalogFile, target, FALSE))
{
HeapFree(GetProcessHeap(), 0, target);
return NULL;
}
if (!(ci = HeapAlloc(GetProcessHeap(), 0, sizeof(*ci))))
{
HeapFree(GetProcessHeap(), 0, target);
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
ci->magic = CATINFO_MAGIC;
strcpyW(ci->file, selectBaseName);
HeapFree(GetProcessHeap(), 0, target);
return ci;
}
/***********************************************************************
@ -83,10 +176,59 @@ BOOL WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE hFile, DWORD* pcbHash,
BYTE* pbHash, DWORD dwFlags )
{
FIXME("%p %p %p %x\n", hFile, pcbHash, pbHash, dwFlags);
BOOL ret = FALSE;
if (pbHash && pcbHash) memset(pbHash, 0, *pcbHash);
return TRUE;
TRACE("%p %p %p %x\n", hFile, pcbHash, pbHash, dwFlags);
if (!hFile || !pcbHash || dwFlags)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (*pcbHash < 20)
{
*pcbHash = 20;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return TRUE;
}
*pcbHash = 20;
if (pbHash)
{
HCRYPTPROV prov;
HCRYPTHASH hash;
DWORD bytes_read;
BYTE *buffer;
if (!(buffer = HeapAlloc(GetProcessHeap(), 0, 4096)))
{
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
ret = CryptAcquireContextW(&prov, NULL, MS_DEF_PROV_W, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
if (!ret)
{
HeapFree(GetProcessHeap(), 0, buffer);
return FALSE;
}
ret = CryptCreateHash(prov, CALG_SHA1, 0, 0, &hash);
if (!ret)
{
HeapFree(GetProcessHeap(), 0, buffer);
CryptReleaseContext(prov, 0);
return FALSE;
}
while ((ret = ReadFile(hFile, buffer, 4096, &bytes_read, NULL)) && bytes_read)
{
CryptHashData(hash, buffer, bytes_read, 0);
}
if (ret) ret = CryptGetHashParam(hash, HP_HASHVAL, pbHash, pcbHash, 0);
HeapFree(GetProcessHeap(), 0, buffer);
CryptDestroyHash(hash);
CryptReleaseContext(prov, 0);
}
return ret;
}
/***********************************************************************
@ -114,15 +256,25 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin,
*
* RETURNS
* Success: TRUE.
* Failure: FAIL.
* Failure: FALSE.
*
*/
BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN hCatAdmin,
HCATINFO hCatInfo,
DWORD dwFlags)
{
FIXME("%p %p %x\n", hCatAdmin, hCatInfo, dwFlags);
return TRUE;
struct catinfo *ci = hCatInfo;
struct catadmin *ca = hCatAdmin;
TRACE("%p %p %x\n", hCatAdmin, hCatInfo, dwFlags);
if (!ca || ca->magic != CATADMIN_MAGIC || !ci || ci->magic != CATINFO_MAGIC)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
ci->magic = 0;
return HeapFree(GetProcessHeap(), 0, ci);
}
/***********************************************************************
@ -136,13 +288,22 @@ BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN hCatAdmin,
*
* RETURNS
* Success: TRUE.
* Failure: FAIL.
* Failure: FALSE.
*
*/
BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags )
{
FIXME("%p %x\n", hCatAdmin, dwFlags);
return TRUE;
struct catadmin *ca = hCatAdmin;
TRACE("%p %x\n", hCatAdmin, dwFlags);
if (!ca || ca->magic != CATADMIN_MAGIC)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
ca->magic = 0;
return HeapFree(GetProcessHeap(), 0, ca);
}
/***********************************************************************
@ -162,7 +323,15 @@ BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags )
*/
BOOL WINAPI CryptCATAdminRemoveCatalog(HCATADMIN hCatAdmin, LPCWSTR pwszCatalogFile, DWORD dwFlags)
{
FIXME("%p %s %x\n", hCatAdmin, debugstr_w(pwszCatalogFile), dwFlags);
struct catadmin *ca = hCatAdmin;
TRACE("%p %s %x\n", hCatAdmin, debugstr_w(pwszCatalogFile), dwFlags);
if (!ca || ca->magic != CATADMIN_MAGIC)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return DeleteFileW(pwszCatalogFile);
}
@ -349,7 +518,7 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
/* get basic offset & size info */
base_offset = SetFilePointer(pSubjectInfo->hFile, 0L, NULL, SEEK_CUR);
if (SetFilePointer(pSubjectInfo->hFile, 0, NULL, SEEK_END) == -1)
if (SetFilePointer(pSubjectInfo->hFile, 0, NULL, SEEK_END) == INVALID_SET_FILE_POINTER)
{
TRACE("seek error\n");
return FALSE;
@ -357,7 +526,7 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
cabsize = SetFilePointer(pSubjectInfo->hFile, 0L, NULL, SEEK_CUR);
if ((cabsize == -1) || (base_offset == -1) ||
(SetFilePointer(pSubjectInfo->hFile, base_offset, NULL, SEEK_SET) == -1))
(SetFilePointer(pSubjectInfo->hFile, base_offset, NULL, SEEK_SET) == INVALID_SET_FILE_POINTER))
{
TRACE("seek error\n");
return FALSE;
@ -453,7 +622,7 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
if (SetFilePointer(pSubjectInfo->hFile, cert_offset, NULL, SEEK_SET) == -1)
if (SetFilePointer(pSubjectInfo->hFile, cert_offset, NULL, SEEK_SET) == INVALID_SET_FILE_POINTER)
{
ERR("couldn't seek to cert location\n");
return FALSE;
@ -472,6 +641,41 @@ static BOOL WINTRUST_GetSignedMsgFromCabFile(SIP_SUBJECTINFO *pSubjectInfo,
return TRUE;
}
static BOOL WINTRUST_GetSignedMsgFromCatFile(SIP_SUBJECTINFO *pSubjectInfo,
DWORD *pdwEncodingType, DWORD dwIndex, DWORD *pcbSignedDataMsg,
BYTE *pbSignedDataMsg)
{
BOOL ret;
TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
pcbSignedDataMsg, pbSignedDataMsg);
if (!pbSignedDataMsg)
{
*pcbSignedDataMsg = GetFileSize(pSubjectInfo->hFile, NULL);
ret = TRUE;
}
else
{
DWORD len = GetFileSize(pSubjectInfo->hFile, NULL);
if (*pcbSignedDataMsg < len)
{
*pcbSignedDataMsg = len;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
ret = FALSE;
}
else
{
ret = ReadFile(pSubjectInfo->hFile, pbSignedDataMsg, len,
pcbSignedDataMsg, NULL);
if (ret)
*pdwEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
}
}
return ret;
}
/***********************************************************************
* CryptSIPGetSignedDataMsg (WINTRUST.@)
*/
@ -482,6 +686,8 @@ BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pdwEn
0x00,0xC0,0x4F,0xC2,0x95,0xEE } };
static const GUID cabGUID = { 0xC689AABA, 0x8E78, 0x11D0, { 0x8C,0x47,
0x00,0xC0,0x4F,0xC2,0x95,0xEE } };
static const GUID catGUID = { 0xDE351A43, 0x8E59, 0x11D0, { 0x8C,0x47,
0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
BOOL ret;
TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex,
@ -493,6 +699,9 @@ BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pdwEn
else if (!memcmp(pSubjectInfo->pgSubjectType, &cabGUID, sizeof(cabGUID)))
ret = WINTRUST_GetSignedMsgFromCabFile(pSubjectInfo, pdwEncodingType,
dwIndex, pcbSignedDataMsg, pbSignedDataMsg);
else if (!memcmp(pSubjectInfo->pgSubjectType, &catGUID, sizeof(catGUID)))
ret = WINTRUST_GetSignedMsgFromCatFile(pSubjectInfo, pdwEncodingType,
dwIndex, pcbSignedDataMsg, pbSignedDataMsg);
else
{
FIXME("unimplemented for subject type %s\n",

View file

@ -128,7 +128,8 @@ static BOOL SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data)
/* Assumes data->u.pPDSip has been loaded, and data->u.pPDSip->pSip allocated.
* Calls data->u.pPDSip->pSip->pfGet to construct data->hMsg.
*/
static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data)
static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
LPCWSTR filePath)
{
BOOL ret;
LPBYTE buf = NULL;
@ -144,9 +145,8 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data)
data->u.pPDSip->psSipSubjectInfo->cbSize = sizeof(SIP_SUBJECTINFO);
data->u.pPDSip->psSipSubjectInfo->pgSubjectType = &data->u.pPDSip->gSubject;
data->u.pPDSip->psSipSubjectInfo->hFile = data->pWintrustData->u.pFile->hFile;
data->u.pPDSip->psSipSubjectInfo->pwsFileName =
data->pWintrustData->u.pFile->pcwszFilePath;
data->u.pPDSip->psSipSubjectInfo->hFile = file;
data->u.pPDSip->psSipSubjectInfo->pwsFileName = filePath;
data->u.pPDSip->psSipSubjectInfo->hProv = data->hProv;
ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo,
&data->dwEncoding, 0, &size, 0);
@ -198,10 +198,25 @@ static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data)
{
BOOL ret;
DWORD size;
LPSTR oid = NULL;
LPBYTE buf = NULL;
ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, NULL,
&size);
if (!ret)
goto error;
oid = data->psPfns->pfnAlloc(size);
if (!oid)
{
SetLastError(ERROR_OUTOFMEMORY);
ret = FALSE;
goto error;
}
ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, oid,
&size);
if (!ret)
goto error;
ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, NULL, &size);
if (!ret)
goto error;
buf = data->psPfns->pfnAlloc(size);
@ -211,51 +226,143 @@ static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data)
ret = FALSE;
goto error;
}
ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, buf,
&size);
ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, buf, &size);
if (!ret)
goto error;
if (!strcmp((LPCSTR)buf, SPC_INDIRECT_DATA_OBJID))
ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0, NULL, &size);
if (!ret)
goto error;
data->u.pPDSip->psIndirectData = data->psPfns->pfnAlloc(size);
if (!data->u.pPDSip->psIndirectData)
{
data->psPfns->pfnFree(buf);
buf = NULL;
ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, NULL, &size);
if (!ret)
goto error;
buf = data->psPfns->pfnAlloc(size);
if (!buf)
{
SetLastError(ERROR_OUTOFMEMORY);
ret = FALSE;
goto error;
}
ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, buf, &size);
if (!ret)
goto error;
ret = CryptDecodeObject(data->dwEncoding,
SPC_INDIRECT_DATA_CONTENT_STRUCT, buf, size, 0, NULL, &size);
if (!ret)
goto error;
data->u.pPDSip->psIndirectData = data->psPfns->pfnAlloc(size);
if (!data->u.pPDSip->psIndirectData)
{
SetLastError(ERROR_OUTOFMEMORY);
ret = FALSE;
goto error;
}
ret = CryptDecodeObject(data->dwEncoding,
SPC_INDIRECT_DATA_CONTENT_STRUCT, buf, size, 0,
data->u.pPDSip->psIndirectData, &size);
}
else
{
FIXME("unimplemented for OID %s\n", (LPCSTR)buf);
SetLastError(TRUST_E_SUBJECT_FORM_UNKNOWN);
SetLastError(ERROR_OUTOFMEMORY);
ret = FALSE;
goto error;
}
ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0,
data->u.pPDSip->psIndirectData, &size);
error:
TRACE("returning %d\n", ret);
data->psPfns->pfnFree(oid);
data->psPfns->pfnFree(buf);
return ret;
}
static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
{
BOOL ret;
if (data->pWintrustData->u.pCert &&
data->pWintrustData->u.pCert->cbStruct == sizeof(WINTRUST_CERT_INFO))
{
if (data->psPfns)
{
CRYPT_PROVIDER_SGNR signer = { sizeof(signer), { 0 } };
DWORD i;
/* Add a signer with nothing but the time to verify, so we can
* add a cert to it
*/
if (data->pWintrustData->u.pCert->psftVerifyAsOf)
data->sftSystemTime = signer.sftVerifyAsOf;
else
{
SYSTEMTIME sysTime;
GetSystemTime(&sysTime);
SystemTimeToFileTime(&sysTime, &signer.sftVerifyAsOf);
}
ret = data->psPfns->pfnAddSgnr2Chain(data, FALSE, 0, &signer);
if (ret)
{
ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
data->pWintrustData->u.pCert->psCertContext);
for (i = 0; ret && i < data->pWintrustData->u.pCert->chStores;
i++)
ret = data->psPfns->pfnAddStore2Chain(data,
data->pWintrustData->u.pCert->pahStores[i]);
}
}
else
{
/* Do nothing!? See the tests */
ret = TRUE;
}
}
else
{
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
}
return ret;
}
static BOOL SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data)
{
BOOL ret;
if (!data->pWintrustData->u.pFile)
{
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
goto error;
}
ret = SOFTPUB_OpenFile(data);
if (!ret)
goto error;
ret = SOFTPUB_GetFileSubject(data);
if (!ret)
goto error;
ret = SOFTPUB_GetSIP(data);
if (!ret)
goto error;
ret = SOFTPUB_GetMessageFromFile(data, data->pWintrustData->u.pFile->hFile,
data->pWintrustData->u.pFile->pcwszFilePath);
if (!ret)
goto error;
ret = SOFTPUB_CreateStoreFromMessage(data);
if (!ret)
goto error;
ret = SOFTPUB_DecodeInnerContent(data);
error:
return ret;
}
static BOOL SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data)
{
BOOL ret;
HANDLE catalog = INVALID_HANDLE_VALUE;
if (!data->pWintrustData->u.pCatalog)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
catalog = CreateFileW(data->pWintrustData->u.pCatalog->pcwszCatalogFilePath,
GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL);
if (catalog == INVALID_HANDLE_VALUE)
return FALSE;
ret = CryptSIPRetrieveSubjectGuid(
data->pWintrustData->u.pCatalog->pcwszCatalogFilePath, catalog,
&data->u.pPDSip->gSubject);
if (!ret)
goto error;
ret = SOFTPUB_GetSIP(data);
if (!ret)
goto error;
ret = SOFTPUB_GetMessageFromFile(data, catalog,
data->pWintrustData->u.pCatalog->pcwszCatalogFilePath);
if (!ret)
goto error;
ret = SOFTPUB_CreateStoreFromMessage(data);
if (!ret)
goto error;
ret = SOFTPUB_DecodeInnerContent(data);
/* FIXME: this loads the catalog file, but doesn't validate the member. */
error:
CloseHandle(catalog);
return ret;
}
@ -271,73 +378,13 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
switch (data->pWintrustData->dwUnionChoice)
{
case WTD_CHOICE_CERT:
if (data->pWintrustData->u.pCert &&
data->pWintrustData->u.pCert->cbStruct == sizeof(WINTRUST_CERT_INFO))
{
if (data->psPfns)
{
CRYPT_PROVIDER_SGNR signer = { sizeof(signer), { 0 } };
DWORD i;
/* Add a signer with nothing but the time to verify, so we can
* add a cert to it
*/
if (data->pWintrustData->u.pCert->psftVerifyAsOf)
data->sftSystemTime = signer.sftVerifyAsOf;
else
{
SYSTEMTIME sysTime;
GetSystemTime(&sysTime);
SystemTimeToFileTime(&sysTime, &signer.sftVerifyAsOf);
}
ret = data->psPfns->pfnAddSgnr2Chain(data, FALSE, 0, &signer);
if (!ret)
goto error;
ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
data->pWintrustData->u.pCert->psCertContext);
if (!ret)
goto error;
for (i = 0; ret && i < data->pWintrustData->u.pCert->chStores;
i++)
ret = data->psPfns->pfnAddStore2Chain(data,
data->pWintrustData->u.pCert->pahStores[i]);
}
else
{
/* Do nothing!? See the tests */
ret = TRUE;
}
}
else
{
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
}
ret = SOFTPUB_LoadCertMessage(data);
break;
case WTD_CHOICE_FILE:
if (!data->pWintrustData->u.pFile)
{
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
goto error;
}
ret = SOFTPUB_OpenFile(data);
if (!ret)
goto error;
ret = SOFTPUB_GetFileSubject(data);
if (!ret)
goto error;
ret = SOFTPUB_GetSIP(data);
if (!ret)
goto error;
ret = SOFTPUB_GetMessageFromFile(data);
if (!ret)
goto error;
ret = SOFTPUB_CreateStoreFromMessage(data);
if (!ret)
goto error;
ret = SOFTPUB_DecodeInnerContent(data);
ret = SOFTPUB_LoadFileMessage(data);
break;
case WTD_CHOICE_CATALOG:
ret = SOFTPUB_LoadCatalogMessage(data);
break;
default:
FIXME("unimplemented for %d\n", data->pWintrustData->dwUnionChoice);
@ -345,7 +392,6 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
ret = FALSE;
}
error:
if (!ret)
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] =
GetLastError();
@ -501,6 +547,20 @@ HRESULT WINAPI SoftpubLoadSignature(CRYPT_PROVIDER_DATA *data)
return ret ? S_OK : S_FALSE;
}
static DWORD WINTRUST_TrustStatusToConfidence(DWORD errorStatus)
{
DWORD confidence = 0;
confidence = 0;
if (!(errorStatus & CERT_TRUST_IS_NOT_SIGNATURE_VALID))
confidence |= CERT_CONFIDENCE_SIG;
if (!(errorStatus & CERT_TRUST_IS_NOT_TIME_VALID))
confidence |= CERT_CONFIDENCE_TIME;
if (!(errorStatus & CERT_TRUST_IS_NOT_TIME_NESTED))
confidence |= CERT_CONFIDENCE_TIMENEST;
return confidence;
}
BOOL WINAPI SoftpubCheckCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
BOOL fCounterSignerChain, DWORD idxCounterSigner)
{
@ -524,19 +584,9 @@ BOOL WINAPI SoftpubCheckCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
for (i = 0; i < simpleChain->cElement; i++)
{
/* Set confidence */
data->pasSigners[idxSigner].pasCertChain[i].dwConfidence = 0;
if (!(simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus &
CERT_TRUST_IS_NOT_TIME_VALID))
data->pasSigners[idxSigner].pasCertChain[i].dwConfidence
|= CERT_CONFIDENCE_TIME;
if (!(simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus &
CERT_TRUST_IS_NOT_TIME_NESTED))
data->pasSigners[idxSigner].pasCertChain[i].dwConfidence
|= CERT_CONFIDENCE_TIMENEST;
if (!(simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus &
CERT_TRUST_IS_NOT_SIGNATURE_VALID))
data->pasSigners[idxSigner].pasCertChain[i].dwConfidence
|= CERT_CONFIDENCE_SIG;
data->pasSigners[idxSigner].pasCertChain[i].dwConfidence =
WINTRUST_TrustStatusToConfidence(
simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus);
/* Set additional flags */
if (!(simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus &
CERT_TRUST_IS_UNTRUSTED_ROOT))
@ -552,6 +602,51 @@ BOOL WINAPI SoftpubCheckCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
return ret;
}
static DWORD WINTRUST_TrustStatusToError(DWORD errorStatus)
{
DWORD error;
if (errorStatus & CERT_TRUST_IS_NOT_SIGNATURE_VALID)
error = TRUST_E_CERT_SIGNATURE;
else if (errorStatus & CERT_TRUST_IS_UNTRUSTED_ROOT)
error = CERT_E_UNTRUSTEDROOT;
else if (errorStatus & CERT_TRUST_IS_NOT_TIME_VALID)
error = CERT_E_EXPIRED;
else if (errorStatus & CERT_TRUST_IS_NOT_TIME_NESTED)
error = CERT_E_VALIDITYPERIODNESTING;
else if (errorStatus & CERT_TRUST_IS_REVOKED)
error = CERT_E_REVOKED;
else if (errorStatus & CERT_TRUST_IS_OFFLINE_REVOCATION ||
errorStatus & CERT_TRUST_REVOCATION_STATUS_UNKNOWN)
error = CERT_E_REVOCATION_FAILURE;
else if (errorStatus & CERT_TRUST_IS_NOT_VALID_FOR_USAGE)
error = CERT_E_WRONG_USAGE;
else if (errorStatus & CERT_TRUST_IS_CYCLIC)
error = CERT_E_CHAINING;
else if (errorStatus & CERT_TRUST_INVALID_EXTENSION)
error = CERT_E_CRITICAL;
else if (errorStatus & CERT_TRUST_INVALID_POLICY_CONSTRAINTS)
error = CERT_E_INVALID_POLICY;
else if (errorStatus & CERT_TRUST_INVALID_BASIC_CONSTRAINTS)
error = TRUST_E_BASIC_CONSTRAINTS;
else if (errorStatus & CERT_TRUST_INVALID_NAME_CONSTRAINTS ||
errorStatus & CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT ||
errorStatus & CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT ||
errorStatus & CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT ||
errorStatus & CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT)
error = CERT_E_INVALID_NAME;
else if (errorStatus & CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY)
error = CERT_E_INVALID_POLICY;
else if (errorStatus)
{
FIXME("unknown error status %08x\n", errorStatus);
error = TRUST_E_SYSTEM_ERROR;
}
else
error = S_OK;
return error;
}
static BOOL WINTRUST_CopyChain(CRYPT_PROVIDER_DATA *data, DWORD signerIdx)
{
BOOL ret;
@ -559,6 +654,9 @@ static BOOL WINTRUST_CopyChain(CRYPT_PROVIDER_DATA *data, DWORD signerIdx)
data->pasSigners[signerIdx].pChainContext->rgpChain[0];
DWORD i;
data->pasSigners[signerIdx].pasCertChain[0].dwConfidence =
WINTRUST_TrustStatusToConfidence(
simpleChain->rgpElement[0]->TrustStatus.dwErrorStatus);
data->pasSigners[signerIdx].pasCertChain[0].pChainElement =
simpleChain->rgpElement[0];
ret = TRUE;
@ -567,9 +665,18 @@ static BOOL WINTRUST_CopyChain(CRYPT_PROVIDER_DATA *data, DWORD signerIdx)
ret = data->psPfns->pfnAddCert2Chain(data, signerIdx, FALSE, 0,
simpleChain->rgpElement[i]->pCertContext);
if (ret)
{
data->pasSigners[signerIdx].pasCertChain[i].pChainElement =
simpleChain->rgpElement[i];
data->pasSigners[signerIdx].pasCertChain[i].dwConfidence =
WINTRUST_TrustStatusToConfidence(
simpleChain->rgpElement[i]->TrustStatus.dwErrorStatus);
}
}
data->pasSigners[signerIdx].pasCertChain[simpleChain->cElement - 1].dwError
= WINTRUST_TrustStatusToError(
simpleChain->rgpElement[simpleChain->cElement - 1]->
TrustStatus.dwErrorStatus);
return ret;
}
@ -580,6 +687,11 @@ static void WINTRUST_CreateChainPolicyCreateInfo(
chainPara->cbSize = sizeof(CERT_CHAIN_PARA);
if (data->pRequestUsage)
chainPara->RequestedUsage = *data->pRequestUsage;
else
{
chainPara->RequestedUsage.dwType = 0;
chainPara->RequestedUsage.Usage.cUsageIdentifier = 0;
}
info->u.cbSize = sizeof(WTD_GENERIC_CHAIN_POLICY_CREATE_INFO);
info->hChainEngine = NULL;
info->pChainPara = chainPara;
@ -599,7 +711,20 @@ static BOOL WINTRUST_CreateChainForSigner(CRYPT_PROVIDER_DATA *data,
PCERT_CHAIN_PARA chainPara)
{
BOOL ret = TRUE;
HCERTSTORE store = NULL;
if (data->chStores)
{
store = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
if (store)
{
DWORD i;
for (i = 0; i < data->chStores; i++)
CertAddStoreToCollection(store, data->pahStores[i], 0, 0);
}
}
/* Expect the end certificate for each signer to be the only cert in the
* chain:
*/
@ -608,8 +733,7 @@ static BOOL WINTRUST_CreateChainForSigner(CRYPT_PROVIDER_DATA *data,
/* Create a certificate chain for each signer */
ret = CertGetCertificateChain(createInfo->hChainEngine,
data->pasSigners[signer].pasCertChain[0].pCert,
&data->pasSigners[signer].sftVerifyAsOf,
data->chStores ? data->pahStores[0] : NULL,
&data->pasSigners[signer].sftVerifyAsOf, store,
chainPara, createInfo->dwFlags, createInfo->pvReserved,
&data->pasSigners[signer].pChainContext);
if (ret)
@ -622,11 +746,17 @@ static BOOL WINTRUST_CreateChainForSigner(CRYPT_PROVIDER_DATA *data,
else
{
if ((ret = WINTRUST_CopyChain(data, signer)))
ret = data->psPfns->pfnCertCheckPolicy(data, signer, FALSE,
0);
{
if (data->psPfns->pfnCertCheckPolicy)
ret = data->psPfns->pfnCertCheckPolicy(data, signer,
FALSE, 0);
else
TRACE("no cert check policy, skipping policy check\n");
}
}
}
}
CertCloseStore(store, 0);
return ret;
}
@ -735,27 +865,60 @@ HRESULT WINAPI SoftpubAuthenticode(CRYPT_PROVIDER_DATA *data)
ret = TRUE;
for (i = 0; ret && i < data->csSigners; i++)
{
CERT_CHAIN_POLICY_PARA policyPara = { sizeof(policyPara), 0 };
BYTE hash[20];
DWORD size = sizeof(hash);
if (data->dwRegPolicySettings & WTPF_TRUSTTEST)
policyPara.dwFlags |= CERT_CHAIN_POLICY_TRUST_TESTROOT_FLAG;
if (data->dwRegPolicySettings & WTPF_TESTCANBEVALID)
policyPara.dwFlags |= CERT_CHAIN_POLICY_ALLOW_TESTROOT_FLAG;
if (data->dwRegPolicySettings & WTPF_IGNOREEXPIRATION)
policyPara.dwFlags |=
CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG |
CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG |
CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG;
if (data->dwRegPolicySettings & WTPF_IGNOREREVOKATION)
policyPara.dwFlags |=
CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG |
CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG |
CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG |
CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG;
CertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_AUTHENTICODE,
data->pasSigners[i].pChainContext, &policyPara, &policyStatus);
if (policyStatus.dwError != NO_ERROR)
ret = FALSE;
/* First make sure cert isn't disallowed */
if ((ret = CertGetCertificateContextProperty(
data->pasSigners[i].pasCertChain[0].pCert,
CERT_SIGNATURE_HASH_PROP_ID, hash, &size)))
{
static const WCHAR disallowedW[] =
{ 'D','i','s','a','l','l','o','w','e','d',0 };
HCERTSTORE disallowed = CertOpenStore(CERT_STORE_PROV_SYSTEM_W,
X509_ASN_ENCODING, 0, CERT_SYSTEM_STORE_CURRENT_USER,
disallowedW);
if (disallowed)
{
PCCERT_CONTEXT found = CertFindCertificateInStore(
disallowed, X509_ASN_ENCODING, 0, CERT_FIND_SIGNATURE_HASH,
hash, NULL);
if (found)
{
/* Disallowed! Can't verify it. */
policyStatus.dwError = TRUST_E_SUBJECT_NOT_TRUSTED;
ret = FALSE;
CertFreeCertificateContext(found);
}
CertCloseStore(disallowed, 0);
}
}
if (ret)
{
CERT_CHAIN_POLICY_PARA policyPara = { sizeof(policyPara), 0 };
if (data->dwRegPolicySettings & WTPF_TRUSTTEST)
policyPara.dwFlags |= CERT_CHAIN_POLICY_TRUST_TESTROOT_FLAG;
if (data->dwRegPolicySettings & WTPF_TESTCANBEVALID)
policyPara.dwFlags |= CERT_CHAIN_POLICY_ALLOW_TESTROOT_FLAG;
if (data->dwRegPolicySettings & WTPF_IGNOREEXPIRATION)
policyPara.dwFlags |=
CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG |
CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG |
CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG;
if (data->dwRegPolicySettings & WTPF_IGNOREREVOKATION)
policyPara.dwFlags |=
CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG |
CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG |
CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG |
CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG;
CertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_AUTHENTICODE,
data->pasSigners[i].pChainContext, &policyPara, &policyStatus);
if (policyStatus.dwError != NO_ERROR)
ret = FALSE;
}
}
}
if (!ret)
@ -849,14 +1012,14 @@ HRESULT WINAPI GenericChainFinalProv(CRYPT_PROVIDER_DATA *data)
else
err = ERROR_OUTOFMEMORY;
}
if (!err)
if (err == NO_ERROR)
err = policyCallback(data, TRUSTERROR_STEP_FINAL_POLICYPROV,
data->dwRegPolicySettings, data->csSigners, signers, policyArg);
data->psPfns->pfnFree(signers);
}
if (err)
if (err != NO_ERROR)
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_POLICYPROV] = err;
TRACE("returning %d (%08x)\n", !err ? S_OK : S_FALSE,
TRACE("returning %d (%08x)\n", err == NO_ERROR ? S_OK : S_FALSE,
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_POLICYPROV]);
return err == NO_ERROR ? S_OK : S_FALSE;
}

View file

@ -6,6 +6,7 @@
<define name="__WINESRC__" />
<library>wine</library>
<library>crypt32</library>
<library>cryptui</library>
<library>user32</library>
<library>advapi32</library>
<library>kernel32</library>

View file

@ -55,7 +55,7 @@
@ stub MsCatFreeHashTag
@ stub OfficeCleanupPolicy
@ stub OfficeInitializePolicy
@ stub OpenPersonalTrustDBDialog
@ stdcall OpenPersonalTrustDBDialog(ptr)
@ stdcall SoftpubAuthenticode(ptr)
@ stdcall SoftpubCheckCert(ptr long long long)
@ stdcall SoftpubCleanup(ptr)
@ -79,19 +79,19 @@
@ stub WTHelperGetAgencyInfo
@ stdcall WTHelperGetFileHandle(ptr)
@ stdcall WTHelperGetFileName(ptr)
@ stub WTHelperGetKnownUsages
@ stdcall WTHelperGetKnownUsages(long ptr)
@ stdcall WTHelperGetProvCertFromChain(ptr long)
@ stdcall WTHelperGetProvPrivateDataFromChain(ptr ptr)
@ stdcall WTHelperGetProvSignerFromChain(ptr long long long)
@ stub WTHelperIsInRootStore
@ stub WTHelperOpenKnownStores
@ stdcall WTHelperProvDataFromStateData(ptr)
@ stub WVTAsn1CatMemberInfoDecode
@ stub WVTAsn1CatMemberInfoEncode
@ stub WVTAsn1CatNameValueDecode
@ stub WVTAsn1CatNameValueEncode
@ stub WVTAsn1SpcFinancialCriteriaInfoDecode
@ stub WVTAsn1SpcFinancialCriteriaInfoEncode
@ stdcall WVTAsn1CatMemberInfoDecode(long str ptr long long ptr ptr)
@ stdcall WVTAsn1CatMemberInfoEncode(long str ptr ptr ptr)
@ stdcall WVTAsn1CatNameValueDecode(long str ptr long long ptr ptr)
@ stdcall WVTAsn1CatNameValueEncode(long str ptr ptr ptr)
@ stdcall WVTAsn1SpcFinancialCriteriaInfoDecode(long str ptr long long ptr ptr)
@ stdcall WVTAsn1SpcFinancialCriteriaInfoEncode(long str ptr ptr ptr)
@ stdcall WVTAsn1SpcIndirectDataContentDecode(long str ptr long long ptr ptr)
@ stdcall WVTAsn1SpcIndirectDataContentEncode(long str ptr ptr ptr)
@ stdcall WVTAsn1SpcLinkDecode(long str ptr long long ptr ptr)
@ -105,7 +105,7 @@
@ stub WVTAsn1SpcSpAgencyInfoDecode
@ stub WVTAsn1SpcSpAgencyInfoEncode
@ stdcall WVTAsn1SpcSpOpusInfoDecode(long str ptr long long ptr ptr)
@ stub WVTAsn1SpcSpOpusInfoEncode
@ stdcall WVTAsn1SpcSpOpusInfoEncode(long str ptr ptr ptr)
@ stub WVTAsn1SpcStatementTypeDecode
@ stub WVTAsn1SpcStatementTypeEncode
@ stdcall WinVerifyTrust(long ptr ptr)

View file

@ -33,6 +33,8 @@
#include "mscat.h"
#include "objbase.h"
#include "winuser.h"
#include "cryptdlg.h"
#include "cryptuiapi.h"
#include "wintrust_priv.h"
#include "wine/debug.h"
@ -88,15 +90,9 @@ static DWORD WINTRUST_ExecuteSteps(const struct wintrust_step *steps,
return err;
}
static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID,
WINTRUST_DATA *data)
static CRYPT_PROVIDER_DATA *WINTRUST_AllocateProviderData(void)
{
DWORD err = ERROR_SUCCESS, numSteps = 0;
CRYPT_PROVIDER_DATA *provData;
BOOL ret;
struct wintrust_step verifySteps[5];
TRACE("(%p, %s, %p)\n", hwnd, debugstr_guid(actionID), data);
provData = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_DATA));
if (!provData)
@ -118,6 +114,69 @@ static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID,
if (!provData->psPfns)
goto oom;
provData->psPfns->cbStruct = sizeof(CRYPT_PROVIDER_FUNCTIONS);
return provData;
oom:
if (provData)
{
WINTRUST_Free(provData->padwTrustStepErrors);
WINTRUST_Free(provData->u.pPDSip);
WINTRUST_Free(provData->psPfns);
WINTRUST_Free(provData);
}
return NULL;
}
/* Adds trust steps for each function in psPfns. Assumes steps has at least
* 5 entries. Returns the number of steps added.
*/
static DWORD WINTRUST_AddTrustStepsFromFunctions(struct wintrust_step *steps,
const CRYPT_PROVIDER_FUNCTIONS *psPfns)
{
DWORD numSteps = 0;
if (psPfns->pfnInitialize)
{
steps[numSteps].func = psPfns->pfnInitialize;
steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_WVTINIT;
}
if (psPfns->pfnObjectTrust)
{
steps[numSteps].func = psPfns->pfnObjectTrust;
steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_OBJPROV;
}
if (psPfns->pfnSignatureTrust)
{
steps[numSteps].func = psPfns->pfnSignatureTrust;
steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_SIGPROV;
}
if (psPfns->pfnCertificateTrust)
{
steps[numSteps].func = psPfns->pfnCertificateTrust;
steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_CERTPROV;
}
if (psPfns->pfnFinalPolicy)
{
steps[numSteps].func = psPfns->pfnFinalPolicy;
steps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_POLICYPROV;
}
return numSteps;
}
static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID,
WINTRUST_DATA *data)
{
DWORD err = ERROR_SUCCESS, numSteps = 0;
CRYPT_PROVIDER_DATA *provData;
BOOL ret;
struct wintrust_step verifySteps[5];
TRACE("(%p, %s, %p)\n", hwnd, debugstr_guid(actionID), data);
provData = WINTRUST_AllocateProviderData();
if (!provData)
return ERROR_OUTOFMEMORY;
ret = WintrustLoadFunctionPointers(actionID, provData->psPfns);
if (!ret)
{
@ -134,36 +193,11 @@ static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID,
provData->pgActionID = actionID;
WintrustGetRegPolicyFlags(&provData->dwRegPolicySettings);
if (provData->psPfns->pfnInitialize)
{
verifySteps[numSteps].func = provData->psPfns->pfnInitialize;
verifySteps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_WVTINIT;
}
if (provData->psPfns->pfnObjectTrust)
{
verifySteps[numSteps].func = provData->psPfns->pfnObjectTrust;
verifySteps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_OBJPROV;
}
if (provData->psPfns->pfnSignatureTrust)
{
verifySteps[numSteps].func = provData->psPfns->pfnSignatureTrust;
verifySteps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_SIGPROV;
}
if (provData->psPfns->pfnCertificateTrust)
{
verifySteps[numSteps].func = provData->psPfns->pfnCertificateTrust;
verifySteps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_CERTPROV;
}
if (provData->psPfns->pfnFinalPolicy)
{
verifySteps[numSteps].func = provData->psPfns->pfnFinalPolicy;
verifySteps[numSteps++].error_index = TRUSTERROR_STEP_FINAL_POLICYPROV;
}
numSteps = WINTRUST_AddTrustStepsFromFunctions(verifySteps,
provData->psPfns);
err = WINTRUST_ExecuteSteps(verifySteps, numSteps, provData);
goto done;
oom:
err = ERROR_OUTOFMEMORY;
error:
if (provData)
{
@ -235,6 +269,184 @@ static LONG WINTRUST_PublishedSoftware(HWND hwnd, GUID *actionID,
return WINTRUST_DefaultVerifyAndClose(hwnd, actionID, &wintrust_data);
}
/* Sadly, the function to load the cert for the CERT_CERTIFICATE_ACTION_VERIFY
* action is not stored in the registry and is located in wintrust, not in
* cryptdlg along with the rest of the implementation (verified by running the
* action with a native wintrust.dll.)
*/
static HRESULT WINAPI WINTRUST_CertVerifyObjTrust(CRYPT_PROVIDER_DATA *data)
{
BOOL ret;
TRACE("(%p)\n", data);
if (!data->padwTrustStepErrors)
return S_FALSE;
switch (data->pWintrustData->dwUnionChoice)
{
case WTD_CHOICE_BLOB:
if (data->pWintrustData->u.pBlob &&
data->pWintrustData->u.pBlob->cbStruct == sizeof(WINTRUST_BLOB_INFO) &&
data->pWintrustData->u.pBlob->cbMemObject ==
sizeof(CERT_VERIFY_CERTIFICATE_TRUST) &&
data->pWintrustData->u.pBlob->pbMemObject)
{
CERT_VERIFY_CERTIFICATE_TRUST *pCert =
(CERT_VERIFY_CERTIFICATE_TRUST *)
data->pWintrustData->u.pBlob->pbMemObject;
if (pCert->cbSize == sizeof(CERT_VERIFY_CERTIFICATE_TRUST) &&
pCert->pccert)
{
CRYPT_PROVIDER_SGNR signer = { sizeof(signer), { 0 } };
DWORD i;
SYSTEMTIME sysTime;
/* Add a signer with nothing but the time to verify, so we can
* add a cert to it
*/
GetSystemTime(&sysTime);
SystemTimeToFileTime(&sysTime, &signer.sftVerifyAsOf);
ret = data->psPfns->pfnAddSgnr2Chain(data, FALSE, 0, &signer);
if (!ret)
goto error;
ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
pCert->pccert);
if (!ret)
goto error;
for (i = 0; ret && i < pCert->cRootStores; i++)
ret = data->psPfns->pfnAddStore2Chain(data,
pCert->rghstoreRoots[i]);
for (i = 0; ret && i < pCert->cStores; i++)
ret = data->psPfns->pfnAddStore2Chain(data,
pCert->rghstoreCAs[i]);
for (i = 0; ret && i < pCert->cTrustStores; i++)
ret = data->psPfns->pfnAddStore2Chain(data,
pCert->rghstoreTrust[i]);
}
else
{
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
}
}
else
{
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
}
break;
default:
FIXME("unimplemented for %d\n", data->pWintrustData->dwUnionChoice);
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
}
error:
if (!ret)
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] =
GetLastError();
TRACE("returning %d (%08x)\n", ret ? S_OK : S_FALSE,
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
return ret ? S_OK : S_FALSE;
}
static LONG WINTRUST_CertVerify(HWND hwnd, GUID *actionID,
WINTRUST_DATA *data)
{
DWORD err = ERROR_SUCCESS, numSteps = 0;
CRYPT_PROVIDER_DATA *provData;
BOOL ret;
struct wintrust_step verifySteps[5];
TRACE("(%p, %s, %p)\n", hwnd, debugstr_guid(actionID), data);
provData = WINTRUST_AllocateProviderData();
if (!provData)
return ERROR_OUTOFMEMORY;
ret = WintrustLoadFunctionPointers(actionID, provData->psPfns);
if (!ret)
{
err = GetLastError();
goto error;
}
if (!provData->psPfns->pfnObjectTrust)
provData->psPfns->pfnObjectTrust = WINTRUST_CertVerifyObjTrust;
/* Not sure why, but native skips the policy check */
provData->psPfns->pfnCertCheckPolicy = NULL;
data->hWVTStateData = (HANDLE)provData;
provData->pWintrustData = data;
if (hwnd == INVALID_HANDLE_VALUE)
provData->hWndParent = GetDesktopWindow();
else
provData->hWndParent = hwnd;
provData->pgActionID = actionID;
WintrustGetRegPolicyFlags(&provData->dwRegPolicySettings);
numSteps = WINTRUST_AddTrustStepsFromFunctions(verifySteps,
provData->psPfns);
err = WINTRUST_ExecuteSteps(verifySteps, numSteps, provData);
goto done;
error:
if (provData)
{
WINTRUST_Free(provData->padwTrustStepErrors);
WINTRUST_Free(provData->u.pPDSip);
WINTRUST_Free(provData->psPfns);
WINTRUST_Free(provData);
}
done:
TRACE("returning %08x\n", err);
return err;
}
static LONG WINTRUST_CertVerifyAndClose(HWND hwnd, GUID *actionID,
WINTRUST_DATA *data)
{
LONG err;
TRACE("(%p, %s, %p)\n", hwnd, debugstr_guid(actionID), data);
err = WINTRUST_CertVerify(hwnd, actionID, data);
WINTRUST_DefaultClose(hwnd, actionID, data);
TRACE("returning %08x\n", err);
return err;
}
static LONG WINTRUST_CertActionVerify(HWND hwnd, GUID *actionID,
WINTRUST_DATA *data)
{
DWORD stateAction;
LONG err = ERROR_SUCCESS;
if (WVT_ISINSTRUCT(WINTRUST_DATA, data->cbStruct, dwStateAction))
stateAction = data->dwStateAction;
else
{
TRACE("no dwStateAction, assuming WTD_STATEACTION_IGNORE\n");
stateAction = WTD_STATEACTION_IGNORE;
}
switch (stateAction)
{
case WTD_STATEACTION_IGNORE:
err = WINTRUST_CertVerifyAndClose(hwnd, actionID, data);
break;
case WTD_STATEACTION_VERIFY:
err = WINTRUST_CertVerify(hwnd, actionID, data);
break;
case WTD_STATEACTION_CLOSE:
err = WINTRUST_DefaultClose(hwnd, actionID, data);
break;
default:
FIXME("unimplemented for %d\n", data->dwStateAction);
}
return err;
}
static void dump_file_info(WINTRUST_FILE_INFO *pFile)
{
TRACE("%p\n", pFile);
@ -370,6 +582,7 @@ LONG WINAPI WinVerifyTrust( HWND hwnd, GUID *ActionID, LPVOID ActionData )
static const GUID generic_verify_v2 = WINTRUST_ACTION_GENERIC_VERIFY_V2;
static const GUID generic_cert_verify = WINTRUST_ACTION_GENERIC_CERT_VERIFY;
static const GUID generic_chain_verify = WINTRUST_ACTION_GENERIC_CHAIN_VERIFY;
static const GUID cert_action_verify = CERT_CERTIFICATE_ACTION_VERIFY;
LONG err = ERROR_SUCCESS;
WINTRUST_DATA *actionData = (WINTRUST_DATA *)ActionData;
@ -379,8 +592,12 @@ LONG WINAPI WinVerifyTrust( HWND hwnd, GUID *ActionID, LPVOID ActionData )
/* Support for known old-style callers: */
if (IsEqualGUID(ActionID, &published_software))
err = WINTRUST_PublishedSoftware(hwnd, ActionID, ActionData);
else if (IsEqualGUID(ActionID, &cert_action_verify))
err = WINTRUST_CertActionVerify(hwnd, ActionID, ActionData);
else
{
DWORD stateAction;
/* Check known actions to warn of possible problems */
if (!IsEqualGUID(ActionID, &unknown) &&
!IsEqualGUID(ActionID, &generic_verify_v2) &&
@ -388,7 +605,14 @@ LONG WINAPI WinVerifyTrust( HWND hwnd, GUID *ActionID, LPVOID ActionData )
!IsEqualGUID(ActionID, &generic_chain_verify))
WARN("unknown action %s, default behavior may not be right\n",
debugstr_guid(ActionID));
switch (actionData->dwStateAction)
if (WVT_ISINSTRUCT(WINTRUST_DATA, actionData->cbStruct, dwStateAction))
stateAction = actionData->dwStateAction;
else
{
TRACE("no dwStateAction, assuming WTD_STATEACTION_IGNORE\n");
stateAction = WTD_STATEACTION_IGNORE;
}
switch (stateAction)
{
case WTD_STATEACTION_IGNORE:
err = WINTRUST_DefaultVerifyAndClose(hwnd, ActionID, ActionData);
@ -512,6 +736,92 @@ HANDLE WINAPI WTHelperGetFileHandle(WINTRUST_DATA *data)
return INVALID_HANDLE_VALUE;
}
static BOOL WINAPI WINTRUST_enumUsages(PCCRYPT_OID_INFO pInfo, void *pvArg)
{
PCCRYPT_OID_INFO **usages = (PCCRYPT_OID_INFO **)pvArg;
DWORD cUsages;
BOOL ret;
if (!*usages)
{
cUsages = 0;
*usages = WINTRUST_Alloc(2 * sizeof(PCCRYPT_OID_INFO));
}
else
{
PCCRYPT_OID_INFO *ptr;
/* Count the existing usages.
* FIXME: make sure the new usage doesn't duplicate any in the list?
*/
for (cUsages = 0, ptr = *usages; *ptr; ptr++, cUsages++)
;
*usages = WINTRUST_ReAlloc((CRYPT_OID_INFO *)*usages,
(cUsages + 2) * sizeof(PCCRYPT_OID_INFO));
}
if (*usages)
{
(*usages)[cUsages] = pInfo;
(*usages)[cUsages + 1] = NULL;
ret = TRUE;
}
else
{
SetLastError(ERROR_OUTOFMEMORY);
ret = FALSE;
}
return ret;
}
/***********************************************************************
* WTHelperGetKnownUsages(WINTRUST.@)
*
* Enumerates the known enhanced key usages as an array of PCCRYPT_OID_INFOs.
*
* PARAMS
* action [In] 1 => allocate and return known usages, 2 => free previously
* allocated usages.
* usages [In/Out] If action == 1, *usages is set to an array of
* PCCRYPT_OID_INFO *. The array is terminated with a NULL
* pointer.
* If action == 2, *usages is freed.
*
* RETURNS
* TRUE on success, FALSE on failure.
*/
BOOL WINAPI WTHelperGetKnownUsages(DWORD action, PCCRYPT_OID_INFO **usages)
{
BOOL ret;
TRACE("(%d, %p)\n", action, usages);
if (!usages)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (action == 1)
{
*usages = NULL;
ret = CryptEnumOIDInfo(CRYPT_ENHKEY_USAGE_OID_GROUP_ID, 0, usages,
WINTRUST_enumUsages);
}
else if (action == 2)
{
WINTRUST_Free((CRYPT_OID_INFO *)*usages);
*usages = NULL;
ret = TRUE;
}
else
{
WARN("unknown action %d\n", action);
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
}
return ret;
}
static const WCHAR Software_Publishing[] = {
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
@ -598,6 +908,8 @@ BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store)
{
BOOL ret = FALSE;
TRACE("(%p, %p)\n", data, store);
if (data->chStores)
data->pahStores = WINTRUST_ReAlloc(data->pahStores,
(data->chStores + 1) * sizeof(HCERTSTORE));
@ -621,6 +933,8 @@ BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data,
{
BOOL ret = FALSE;
TRACE("(%p, %d, %d, %p)\n", data, fCounterSigner, idxSigner, sgnr);
if (sgnr->cbStruct > sizeof(CRYPT_PROVIDER_SGNR))
{
SetLastError(ERROR_INVALID_PARAMETER);
@ -672,6 +986,9 @@ BOOL WINAPI WINTRUST_AddCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
{
BOOL ret = FALSE;
TRACE("(%p, %d, %d, %d, %p)\n", data, idxSigner, fCounterSigner,
idxSigner, pCert2Add);
if (fCounterSigner)
{
FIXME("unimplemented for counter signers\n");
@ -741,3 +1058,27 @@ BOOL WINAPI WINTRUST_AddPrivData(CRYPT_PROVIDER_DATA *data,
SetLastError(ERROR_OUTOFMEMORY);
return ret;
}
/***********************************************************************
* OpenPersonalTrustDBDialog (WINTRUST.@)
*
* Opens the certificate manager dialog, showing only the stores that
* contain trusted software publishers.
*
* PARAMS
* hwnd [I] handle of parent window
*
* RETURNS
* TRUE if the dialog could be opened, FALSE if not.
*/
BOOL WINAPI OpenPersonalTrustDBDialog(HWND hwnd)
{
CRYPTUI_CERT_MGR_STRUCT uiCertMgr;
uiCertMgr.dwSize = sizeof(uiCertMgr);
uiCertMgr.hwndParent = hwnd;
uiCertMgr.dwFlags = CRYPTUI_CERT_MGR_PUBLISHER_TAB;
uiCertMgr.pwszTitle = NULL;
uiCertMgr.pszInitUsageOID = NULL;
return CryptUIDlgCertMgr(&uiCertMgr);
}

View file

@ -18,8 +18,8 @@
#ifndef __WINTRUST_PRIV_H__
#define __WINTRUST_PRIV_H__
void * WINAPI WINTRUST_Alloc(DWORD cb);
void * WINAPI WINTRUST_ReAlloc(void *ptr, DWORD cb);
void * WINAPI WINTRUST_Alloc(DWORD cb) __WINE_ALLOC_SIZE(1);
void * WINAPI WINTRUST_ReAlloc(void *ptr, DWORD cb) __WINE_ALLOC_SIZE(2);
void WINAPI WINTRUST_Free(void *p);
BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store);
BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data,

View file

@ -0,0 +1,313 @@
/*
* Copyright (C) 2008 Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __CRYPTDLG_H__
#define __CRYPTDLG_H__
#include <prsht.h>
#ifdef __cplusplus
extern "C" {
#endif
#define CRYPTDLG_FLAGS_MASK 0xff000000
#define CRYPTDLG_REVOCATION_DEFAULT 0x00000000
#define CRYPTDLG_REVOCATION_ONLINE 0x80000000
#define CRYPTDLG_REVOCATION_CACHE 0x40000000
#define CRYPTDLG_REVOCATION_NONE 0x20000000
#define CRYPTDLG_POLICY_MASK 0x0000ffff
#define POLICY_IGNORE_NON_CRITICAL_BC 0x00000001
#define CRYPTDLG_ACTION_MASK 0xffff0000
#define ACTION_REVOCATION_DEFAULT_ONLINE 0x00010000
#define ACTION_REVOCATION_DEFAULT_CACHE 0x00020000
typedef BOOL (WINAPI *PFNCMFILTERPROC)(PCCERT_CONTEXT, DWORD, DWORD, DWORD);
#define CERT_DISPWELL_SELECT 1
#define CERT_DISPWELL_TRUST_CA_CERT 2
#define CERT_DISPWELL_TRUST_LEAF_CERT 3
#define CERT_DISPWELL_TRUST_ADD_CA_CERT 4
#define CERT_DISPWELL_TRUST_ADD_LEAF_CERT 5
#define CERT_DISPWELL_DISTRUST_CA_CERT 6
#define CERT_DISPWELL_DISTRUST_LEAF_CERT 7
#define CERT_DISPWELL_DISTRUST_ADD_CA_CERT 8
#define CERT_DISPWELL_DISTRUST_ADD_LEAF_CERT 9
typedef UINT (WINAPI *PFNCMHOOKPROC)(HWND, UINT, WPARAM, LPARAM);
#define CSS_SELECTCERT_MASK 0x00ffffff
#define CSS_HIDE_PROPERTIES 0x00000001
#define CSS_ENABLEHOOK 0x00000002
#define CSS_ALLOWMULTISELECT 0x00000004
#define CSS_SHOW_HELP 0x00000010
#define CSS_ENABLETEMPLATE 0x00000020
#define CSS_ENABLETEMPLATEHANDLE 0x00000040
#define SELCERT_OK IDOK
#define SELCERT_CANCEL IDCANCEL
#define SELCERT_PROPERTIES 100
#define SELCERT_FINEPRINT 101
#define SELCERT_CERTLIST 102
#define SELCERT_HELP IDHELP
#define SELCERT_ISSUED_TO 103
#define SELCERT_VALIDITY 104
#define SELCERT_ALGORITHM 105
#define SELCERT_SERIAL_NUM 106
#define SELCERT_THUMBPRINT 107
typedef struct tagCSSA
{
DWORD dwSize;
HWND hwndParent;
HINSTANCE hInstance;
LPCSTR pTemplateName;
DWORD dwFlags;
LPCSTR szTitle;
DWORD cCertStore;
HCERTSTORE *arrayCertStore;
LPCSTR szPurposeOid;
DWORD cCertContext;
PCCERT_CONTEXT *arrayCertContext;
DWORD lCustData;
PFNCMHOOKPROC pfnHook;
PFNCMFILTERPROC pfnFilter;
LPCSTR szHelpFileName;
DWORD dwHelpId;
HCRYPTPROV hprov;
} CERT_SELECT_STRUCT_A, *PCERT_SELECT_STRUCT_A;
typedef struct tagCSSW
{
DWORD dwSize;
HWND hwndParent;
HINSTANCE hInstance;
LPCWSTR pTemplateName;
DWORD dwFlags;
LPCWSTR szTitle;
DWORD cCertStore;
HCERTSTORE *arrayCertStore;
LPCSTR szPurposeOid;
DWORD cCertContext;
PCCERT_CONTEXT *arrayCertContext;
DWORD lCustData;
PFNCMHOOKPROC pfnHook;
PFNCMFILTERPROC pfnFilter;
LPCWSTR szHelpFileName;
DWORD dwHelpId;
HCRYPTPROV hprov;
} CERT_SELECT_STRUCT_W, *PCERT_SELECT_STRUCT_W;
#define CERT_SELECT_STRUCT WINELIB_NAME_AW(CERT_SELECT_STRUCT_)
BOOL WINAPI CertSelectCertificateA(PCERT_SELECT_STRUCT_A pCertSelectInfo);
BOOL WINAPI CertSelectCertificateW(PCERT_SELECT_STRUCT_W pCertSelectInfo);
#define CertSelectCertificate WINELIB_NAME_AW(CertSelectCertificate)
#define CM_VIEWFLAGS_MASK 0x00ffffff
#define CM_ENABLEHOOK 0x00000001
#define CM_SHOW_HELP 0x00000002
#define CM_SHOW_HELPICON 0x00000004
#define CM_ENABLETEMPLATE 0x00000008
#define CM_HIDE_ADVANCEPAGE 0x00000010
#define CM_HIDE_TRUSTPAGE 0x00000020
#define CM_NO_NAMECHANGE 0x00000040
#define CM_NO_EDITTRUST 0x00000080
#define CM_HIDE_DETAILPAGE 0x00000100
#define CM_ADD_CERT_STORES 0x00000200
#define CERTVIEW_CRYPTUI_LPARAM 0x00800000
typedef struct tagCERT_VIEWPROPERTIES_STRUCT_A
{
DWORD dwSize;
HWND hwndParent;
HINSTANCE hInstance;
DWORD dwFlags;
LPCSTR szTitle;
PCCERT_CONTEXT pCertContext;
LPSTR *arrayPurposes;
DWORD cArrayPurposes;
DWORD cRootStores;
HCERTSTORE *rghstoreRoots;
DWORD cStores;
HCERTSTORE *rghstoreCAs;
DWORD cTrustStores;
HCERTSTORE *rghstoreTrust;
HCRYPTPROV hprov;
DWORD lCustData;
DWORD dwPad;
LPCSTR szHelpFileName;
DWORD dwHelpId;
DWORD nStartPage;
DWORD cArrayPropSheetPages;
/* FIXME: PSDK declares arrayPropSheetPages as a PROPSHEETPAGE *, which we
* don't allow in our own headers. It's probably wrong, but we're not
* compatible.
*/
PROPSHEETPAGEA *arrayPropSheetPages;
} CERT_VIEWPROPERTIES_STRUCT_A, *PCERT_VIEWPROPERTIES_STRUCT_A;
typedef struct tagCERT_VIEWPROPERTIES_STRUCT_W
{
DWORD dwSize;
HWND hwndParent;
HINSTANCE hInstance;
DWORD dwFlags;
LPCWSTR szTitle;
PCCERT_CONTEXT pCertContext;
LPSTR *arrayPurposes;
DWORD cArrayPurposes;
DWORD cRootStores;
HCERTSTORE *rghstoreRoots;
DWORD cStores;
HCERTSTORE *rghstoreCAs;
DWORD cTrustStores;
HCERTSTORE *rghstoreTrust;
HCRYPTPROV hprov;
DWORD lCustData;
DWORD dwPad;
LPCWSTR szHelpFileName;
DWORD dwHelpId;
DWORD nStartPage;
DWORD cArrayPropSheetPages;
/* FIXME: PSDK declares arrayPropSheetPages as a PROPSHEETPAGE *, which we
* don't allow in our own headers. It's probably wrong, but we're not
* compatible.
*/
PROPSHEETPAGEW *arrayPropSheetPages;
} CERT_VIEWPROPERTIES_STRUCT_W, *PCERT_VIEWPROPERTIES_STRUCT_W;
#define CERT_VIEWPROPERTIES_STRUCT WINELIB_NAME_AW(CERT_VIEWPROPERTIES_STRUCT_)
#define PCERT_VIEWPROPERTIES_STRUCT \
WINELIB_NAME_AW(PCERT_VIEWPROPERTIES_STRUCT_)
BOOL WINAPI CertViewPropertiesA(PCERT_VIEWPROPERTIES_STRUCT_A pCertViewInfo);
BOOL WINAPI CertViewPropertiesW(PCERT_VIEWPROPERTIES_STRUCT_W pCertViewInfo);
#define CertViewProperties WINELIB_NAME_AW(CertViewProperties)
#define CERT_FILTER_OP_EXISTS 1
#define CERT_FILTER_OP_NOT_EXISTS 2
#define CERT_FILTER_OP_EQUALITY 3
typedef struct tagCMOID
{
LPCSTR szExtensionOID;
DWORD dwTestOperation;
LPBYTE pbTestData;
DWORD cbTestData;
} CERT_FILTER_EXTENSION_MATCH;
#define CERT_FILTER_INCLUDE_V1_CERTS 0x0001
#define CERT_FILTER_VALID_TIME_RANGE 0x0002
#define CERT_FILTER_VALID_SIGNATURE 0x0004
#define CERT_FILTER_LEAF_CERTS_ONLY 0x0008
#define CERT_FILTER_ISSUER_CERTS_ONLY 0x0010
#define CERT_FILTER_KEY_EXISTS 0x0020
typedef struct tagCMFLTR
{
DWORD dwSize;
DWORD cExtensionChecks;
CERT_FILTER_EXTENSION_MATCH *arrayExtensionChecks;
DWORD dwCheckingFlags;
} CERT_FILTER_DATA;
DWORD WINAPI GetFriendlyNameOfCertA(PCCERT_CONTEXT pccert, LPSTR pchBuffer,
DWORD cchBuffer);
DWORD WINAPI GetFriendlyNameOfCertW(PCCERT_CONTEXT pccert, LPWSTR pchBuffer,
DWORD cchBuffer);
#define GetFriendlyNameOfCert WINELIB_NAME_AW(GetFriendlyNameOfCert)
#define CERT_CERTIFICATE_ACTION_VERIFY \
{ 0x7801ebd0, 0xcf4b, 0x11d0, { 0x85,0x1f,0x00,0x60,0x97,0x93,0x87,0xea }}
#define szCERT_CERTIFICATE_ACTION_VERIFY \
"{7801ebd0-cf4b-11d0-851f-0060979387ea}"
typedef HRESULT (WINAPI *PFNTRUSTHELPER)(PCCERT_CONTEXT, DWORD, BOOL, LPBYTE);
#define CERT_VALIDITY_MASK_VALIDITY 0x0000ffff
#define CERT_VALIDITY_BEFORE_START 0x00000001
#define CERT_VALIDITY_AFTER_END 0x00000002
#define CERT_VALIDITY_SIGNATURE_FAILS 0x00000004
#define CERT_VALIDITY_CERTIFICATE_REVOKED 0x00000008
#define CERT_VALIDITY_KEY_USAGE_EXT_FAILURE 0x00000010
#define CERT_VALIDITY_EXTENDED_USAGE_FAILURE 0x00000020
#define CERT_VALIDITY_NAME_CONSTRAINTS_FAILURE 0x00000040
#define CERT_VALIDITY_UNKNOWN_CRITICAL_EXTENSION 0x00000080
#define CERT_VALIDITY_ISSUER_INVALID 0x00000100
#define CERT_VALIDITY_OTHER_EXTENSION_FAILURE 0x00000200
#define CERT_VALIDITY_PERIOD_NESTING_FAILURE 0x00000400
#define CERT_VALIDITY_OTHER_ERROR 0x00000800
#define CERT_VALIDITY_MASK_TRUST 0xffff0000
#define CERT_VALIDITY_EXPLICITLY_DISTRUSTED 0x01000000
#define CERT_VALIDITY_ISSUER_DISTRUST 0x02000000
#define CERT_VALIDITY_NO_ISSUER_CERT_FOUND 0x10000000
#define CERT_VALIDITY_NO_CRL_FOUND 0x20000000
#define CERT_VALIDITY_CRL_OUT_OF_DATE 0x40000000
#define CERT_VALIDITY_NO_TRUST_DATA 0x80000000
#define CERT_TRUST_MASK 0x00ffffff
#define CERT_TRUST_DO_FULL_SEARCH 0x00000001
#define CERT_TRUST_PERMIT_MISSING_CRLS 0x00000002
#define CERT_TRUST_DO_FULL_TRUST 0x00000005
#define CERT_TRUST_ADD_CERT_STORES CM_ADD_CERT_STORES
typedef struct _CERT_VERIFY_CERTIFICATE_TRUST
{
DWORD cbSize;
PCCERT_CONTEXT pccert;
DWORD dwFlags;
DWORD dwIgnoreErr;
DWORD *pdwErrors;
LPSTR pszUsageOid;
HCRYPTPROV hprov;
DWORD cRootStores;
HCERTSTORE *rghstoreRoots;
DWORD cStores;
HCERTSTORE *rghstoreCAs;
DWORD cTrustStores;
HCERTSTORE *rghstoreTrust;
DWORD lCustData;
PFNTRUSTHELPER pfnTrustHelper;
DWORD *pcchain;
PCCERT_CONTEXT **prgChain;
DWORD **prgdwErrors;
DATA_BLOB **prgpbTrustInfo;
} CERT_VERIFY_CERTIFICATE_TRUST, *PCERT_VERIFY_CERTIFICATE_TRUST;
#define CTL_MODIFY_REQUEST_ADD_NOT_TRUSTED 1
#define CTL_MODIFY_REQUEST_REMOVE 2
#define CTL_MODIFY_REQUEST_ADD_TRUSTED 3
typedef struct _CTL_MODIFY_REQUEST
{
PCCERT_CONTEXT pccert;
DWORD dwOperation;
DWORD dwError;
} CTL_MODIFY_REQUEST, *PCTL_MODIFY_REQUEST;
HRESULT WINAPI CertModifyCertificatesToTrust(int cCertStore,
PCTL_MODIFY_REQUEST rgCerts, LPCSTR szPurpose, HWND hwnd,
HCERTSTORE hcertstoreTrust);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,13 +1,431 @@
/*
* Copyright (C) 2008 Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __CRYPTUIAPI_H__
#define __CRYPTUIAPI_H__
typedef struct _CRYPTUI_CERT_MGR_STRUCT {
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCWSTR pwszTitle;
LPCSTR pszInitUsageOID;
} CRYPTUI_CERT_MGR_STRUCT,
*PCRYPTUI_CERT_MGR_STRUCT;
#include <wintrust.h>
#include <wincrypt.h>
#include <prsht.h>
typedef const CRYPTUI_CERT_MGR_STRUCT *PCCRYPTUI_CERT_MGR_STRUCT;
#ifdef __cplusplus
extern "C" {
#endif
#include <pshpack8.h>
BOOL WINAPI CryptUIDlgViewContext(DWORD dwContextType, LPVOID pvContext,
HWND hwnd, LPCWSTR pwszTitle, DWORD dwFlags, LPVOID pvReserved);
/* Values for dwDontUseColumn */
#define CRYPTUI_SELECT_ISSUEDTO_COLUMN 0x00000001
#define CRYPTUI_SELECT_ISSUEDBY_COLUMN 0x00000002
#define CRYPTUI_SELECT_INTENDEDUSE_COLUMN 0x00000004
#define CRYPTUI_SELECT_FRIENDLYNAME_COLUMN 0x00000008
#define CRYPTUI_SELECT_LOCATION_COLUMN 0x00000010
#define CRYPTUI_SELECT_EXPIRATION_COLUMN 0x00000020
PCCERT_CONTEXT WINAPI CryptUIDlgSelectCertificateFromStore(
HCERTSTORE hCertStore, HWND hwnd, LPCWSTR pwszTitle, LPCWSTR pwszDisplayString,
DWORD dwDontUseColumn, DWORD dwFlags, LPVOID pvReserved);
/* Values for CRYPTUI_CERT_MGR_STRUCT's dwFlags */
#define CRYPTUI_CERT_MGR_PUBLISHER_TAB 0x00000004
#define CRYPTUI_CERT_MGR_TAB_MASK 0x0000000f
#define CRYPTUI_CERT_MGR_SINGLE_TAB_FLAG 0x00008000
typedef struct _CRYPTUI_CERT_MGR_STRUCT
{
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCWSTR pwszTitle;
LPCSTR pszInitUsageOID;
} CRYPTUI_CERT_MGR_STRUCT, *PCRYPTUI_CERT_MGR_STRUCT;
typedef const struct _CRYPTUI_CERT_MGR_STRUCT *PCCRYPTUI_CERT_MGR_STRUCT;
BOOL WINAPI CryptUIDlgCertMgr(PCCRYPTUI_CERT_MGR_STRUCT pCryptUICertMgr);
typedef BOOL (WINAPI *PFNCFILTERPROC)(PCCERT_CONTEXT pCertContext,
BOOL *pfInitialSelectedCert, void *pvCallbackData);
typedef struct tagCRYPTUI_INITDIALOG_STRUCT
{
LPARAM lParam;
PCCERT_CONTEXT pCertContext;
} CRYPTUI_INITDIALOG_STRUCT, *PCRYPTUI_INITDIALOG_STRUCT;
/* Values for CRYPTUI_VIEWCERTIFICATE_STRUCT's dwFlags */
#define CRYPTUI_HIDE_HIERARCHYPAGE 0x00000001
#define CRYPTUI_HIDE_DETAILPAGE 0x00000002
#define CRYPTUI_DISABLE_EDITPROPERTIES 0x00000004
#define CRYPTUI_ENABLE_EDITPROPERTIES 0x00000008
#define CRYPTUI_DISABLE_ADDTOSTORE 0x00000010
#define CRYPTUI_ENABLE_ADDTOSTORE 0x00000020
#define CRYPTUI_ACCEPT_DECLINE_STYLE 0x00000040
#define CRYPTUI_IGNORE_UNTRUSTED_ROOT 0x00000080
#define CRYPTUI_DONT_OPEN_STORES 0x00000100
#define CRYPTUI_ONLY_OPEN_ROOT_STORE 0x00000200
#define CRYPTUI_WARN_UNTRUSTED_ROOT 0x00000400
#define CRYPTUI_ENABLE_REVOCATION_CHECKING 0x00000800
#define CRYPTUI_WARN_REMOTE_TRUST 0x00001000
#define CRYPTUI_DISABLE_EXPORT 0x00002000
#define CRYPTUI_ENABLE_REVOCATION_CHECK_END_CERT 0x00004000
#define CRYPTUI_ENABLE_REVOCATION_CHECK_CHAIN 0x00008000
#define CRYPTUI_ENABLE_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT CRYPTUI_ENABLE_REVOCATION_CHECKING
#define CRYPTUI_DISABLE_HTMLLINK 0x00010000
#define CRYPTUI_DISABLE_ISSUERSTATEMENT 0x00020000
typedef struct tagCRYPTUI_VIEWCERTIFICATE_STRUCTA
{
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCSTR szTitle;
PCCERT_CONTEXT pCertContext;
LPCSTR *rgszPurposes;
DWORD cPurposes;
union {
CRYPT_PROVIDER_DATA const *pCryptProviderData;
HANDLE hWVTStateData;
} DUMMYUNIONNAME;
BOOL fpCryptProviderDataTrustedUsage;
DWORD idxSigner;
DWORD idxCert;
BOOL fCounterSigner;
DWORD idxCounterSigner;
DWORD cStores;
HCERTSTORE *rghStores;
DWORD cPropSheetPages;
LPCPROPSHEETPAGEA rgPropSheetPages;
DWORD nStartPage;
} CRYPTUI_VIEWCERTIFICATE_STRUCTA, *PCRYPTUI_VIEWCERTIFICATE_STRUCTA;
typedef const CRYPTUI_VIEWCERTIFICATE_STRUCTA *PCCRYPTUI_VIEWCERTIFICATE_STRUCTA;
typedef struct tagCRYPTUI_VIEWCERTIFICATE_STRUCTW
{
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCWSTR szTitle;
PCCERT_CONTEXT pCertContext;
LPCSTR *rgszPurposes;
DWORD cPurposes;
union {
CRYPT_PROVIDER_DATA const *pCryptProviderData;
HANDLE hWVTStateData;
} DUMMYUNIONNAME;
BOOL fpCryptProviderDataTrustedUsage;
DWORD idxSigner;
DWORD idxCert;
BOOL fCounterSigner;
DWORD idxCounterSigner;
DWORD cStores;
HCERTSTORE *rghStores;
DWORD cPropSheetPages;
LPCPROPSHEETPAGEW rgPropSheetPages;
DWORD nStartPage;
} CRYPTUI_VIEWCERTIFICATE_STRUCTW, *PCRYPTUI_VIEWCERTIFICATE_STRUCTW;
typedef const CRYPTUI_VIEWCERTIFICATE_STRUCTW *PCCRYPTUI_VIEWCERTIFICATE_STRUCTW;
#define CRYPTUI_VIEWCERTIFICATE_STRUCT WINELIB_NAME_AW(CRYPTUI_VIEWCERTIFICATE_STRUCT)
#define PCCRYPTUI_VIEWCERTIFICATE_STRUCT WINELIB_NAME_AW(PCCRYPTUI_VIEWCERTIFICATE_STRUCT)
BOOL WINAPI CryptUIDlgViewCertificateA(
PCCRYPTUI_VIEWCERTIFICATE_STRUCTA pCertViewInfo, BOOL *pfPropertiesChanged);
BOOL WINAPI CryptUIDlgViewCertificateW(
PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, BOOL *pfPropertiesChanged);
#define CryptUIDlgViewCertificate WINELIB_NAME_AW(CryptUIDlgViewCertificate)
typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO
{
DWORD dwSize;
GUID *pGuidSubject;
DWORD cbBlob;
BYTE *pbBlob;
LPCWSTR pwszDisplayName;
} CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO, *PCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO;
typedef const CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO *
PCCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO;
typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO
{
DWORD dwSize;
DWORD cCertStore;
HCERTSTORE *rghCertStore;
PFNCFILTERPROC pFilterCallback;
void *pvCallbackData;
} CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO, *PCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO;
typedef const CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO *
PCCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO;
typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO
{
DWORD dwSize;
LPWSTR pwszPvkFileName;
LPWSTR pwszProvName;
DWORD dwProvType;
} CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO,
*PCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO;
typedef const CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO *
PCCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO;
typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO
{
DWORD dwSize;
LPWSTR pwszSigningCertFileName;
DWORD dwPvkChoice;
union {
PCCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO pPvkFileInfo;
PCRYPT_KEY_PROV_INFO pPvkProvInfo;
} DUMMYUNIONNAME;
} CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO,
*PCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO;
typedef const CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO *
PCCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO;
typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO
{
DWORD dwSize;
DWORD dwAttrFlags;
LPCWSTR pwszDescription;
LPCWSTR pwszMoreInfoLocation;
LPCSTR pszHashAlg;
LPCWSTR pwszSigningCertDisplayString;
HCERTSTORE hAdditionalCertStore;
PCRYPT_ATTRIBUTES psAuthenticated;
PCRYPT_ATTRIBUTES psUnauthenticated;
} CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO,
*PCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO;
typedef const CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO *
PCCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO;
typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_INFO
{
DWORD dwSize;
DWORD dwSubjectChoice;
union {
LPCWSTR pwszFileName;
PCCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO pSignBlobInfo;
} DUMMYUNIONNAME1;
DWORD dwSigningCertChoice;
union {
PCCERT_CONTEXT pSigningCertContext;
PCCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO pSigningCertStore;
PCCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO pSigningCertPvkInfo;
} DUMMYUNIONNAME2;
LPCWSTR pwszTimestampURL;
DWORD dwAdditionalCertChoice;
PCCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO pSignExtInfo;
} CRYPTUI_WIZ_DIGITAL_SIGN_INFO, *PCRYPTUI_WIZ_DIGITAL_SIGN_INFO;
typedef const CRYPTUI_WIZ_DIGITAL_SIGN_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_INFO;
typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT
{
DWORD dwSize;
DWORD cbBlob;
BYTE *pbBlob;
} CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT, *PCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT;
/* Values for CryptUIWizDigitalSign's dwFlags */
#define CRYPTUI_WIZ_NO_UI 0x00000001
#define CRYPTUI_WIZ_DIGITAL_SIGN_EXCLUDE_PAGE_HASHES 0x00000002
#define CRYPTUI_WIZ_DIGITAL_SIGN_INCLUDE_PAGE_HASHES 0x00000004
BOOL WINAPI CryptUIWizDigitalSign(DWORD dwFlags, HWND hwndParent,
LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_DIGITAL_SIGN_INFO pDigitalSignInfo,
PCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT *ppSignContext);
BOOL WINAPI CryptUIWizFreeDigitalSignContext(
PCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT pSignContext);
/* Values for CRYPTUI_WIZ_EXPORT_INFO's dwSubjectChoice */
#define CRYPTUI_WIZ_EXPORT_CERT_CONTEXT 1
#define CRYPTUI_WIZ_EXPORT_CTL_CONTEXT 2
#define CRYPTUI_WIZ_EXPORT_CRL_CONTEXT 3
#define CRYPTUI_WIZ_EXPORT_CERT_STORE 4
#define CRYPTUI_WIZ_EXPORT_CERT_STORE_CERTIFICATES_ONLY 5
#define CRYPTUI_WIZ_EXPORT_FORMAT_CRL 6
#define CRYPTUI_WIZ_EXPORT_FORMAT_CTL 7
typedef struct _CRYPTUI_WIZ_EXPORT_INFO
{
DWORD dwSize;
LPCWSTR pwszExportFileName;
DWORD dwSubjectChoice;
union {
PCCERT_CONTEXT pCertContext;
PCCTL_CONTEXT pCTLContext;
PCCRL_CONTEXT pCRLContext;
} DUMMYUNIONNAME;
DWORD cStores;
HCERTSTORE *rghStores;
} CRYPTUI_WIZ_EXPORT_INFO, *PCRYPTUI_WIZ_EXPORT_INFO;
typedef const CRYPTUI_WIZ_EXPORT_INFO *PCCRYPTUI_WIZ_EXPORT_INFO;
/* Values for CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO's dwExportFormat */
#define CRYPTUI_WIZ_EXPORT_FORMAT_DER 1
#define CRYPTUI_WIZ_EXPORT_FORMAT_PFX 2
#define CRYPTUI_WIZ_EXPORT_FORMAT_PKCS7 3
#define CRYPTUI_WIZ_EXPORT_FORMAT_BASE64 4
#define CRYPTUI_WIZ_EXPORT_FORMAT_SERIALIZED_CERT_STORE 5
typedef struct _CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO
{
DWORD dwSize;
DWORD dwExportFormat;
BOOL fExportChain;
BOOL fExportPrivateKeys;
LPCWSTR pwszPassword;
BOOL fStrongEncryption;
} CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO, *PCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO;
typedef const CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO *
PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO;
BOOL WINAPI CryptUIWizExport(DWORD dwFlags, HWND hwndParent,
LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo, void *pvoid);
/* Values for CRYPTUI_WIZ_IMPORT_SRC_INFO's dwSubjectChoice */
#define CRYPTUI_WIZ_IMPORT_SUBJECT_FILE 1
#define CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT 2
#define CRYPTUI_WIZ_IMPORT_SUBJECT_CTL_CONTEXT 3
#define CRYPTUI_WIZ_IMPORT_SUBJECT_CRL_CONTEXT 4
#define CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE 5
typedef struct _CRYPTUI_WIZ_IMPORT_SUBJECT_INFO
{
DWORD dwSize;
DWORD dwSubjectChoice;
union {
LPCWSTR pwszFileName;
PCCERT_CONTEXT pCertContext;
PCCTL_CONTEXT pCTLContext;
PCCRL_CONTEXT pCRLContext;
HCERTSTORE hCertStore;
} DUMMYUNIONNAME;
DWORD dwFlags;
LPCWSTR pwszPassword;
} CRYPTUI_WIZ_IMPORT_SRC_INFO, *PCRYPTUI_WIZ_IMPORT_SRC_INFO;
typedef const CRYPTUI_WIZ_IMPORT_SRC_INFO *PCCRYPTUI_WIZ_IMPORT_SRC_INFO;
/* Values for CryptUIWizImport's dwFlags */
#define CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE 0x00010000
#define CRYPTUI_WIZ_IMPORT_ALLOW_CERT 0x00020000
#define CRYPTUI_WIZ_IMPORT_ALLOW_CRL 0x00040000
#define CRYPTUI_WIZ_IMPORT_ALLOW_CTL 0x00080000
#define CRYPTUI_WIZ_IMPORT_TO_LOCALMACHINE 0x00100000
#define CRYPTUI_WIZ_IMPORT_TO_CURRENTUSER 0x00200000
#define CRYPTUI_WIZ_IMPORT_REMOTE_DEST_STORE 0x00400000
BOOL WINAPI CryptUIWizImport(DWORD dwFlags, HWND hwndParent,
LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_IMPORT_SRC_INFO pImportSrc,
HCERTSTORE hDestCertStore);
/* Definitions missing from PSDK's cryptuiapi.h, but documented on MSDN. */
typedef BOOL (WINAPI *PFNCCERTDISPLAYPROC)(PCCERT_CONTEXT pCertContext,
HWND hWndSelCertDlg, void *pvCallbackData);
/* Values for CRYPTUI_SELECTCERTIFICATE_STRUCT's dwFlags */
#define CRYPTUI_SELECTCERT_MULTISELECT 0x00000001
typedef struct _CRYPTUI_SELECTCERTIFICATE_STRUCTA
{
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCWSTR szTitle;
DWORD dwDontUseColumn;
LPCWSTR szDisplayString;
PFNCFILTERPROC pFilterCallback;
PFNCCERTDISPLAYPROC pDisplayCallback;
void *pvCallbackData;
DWORD cStores;
HCERTSTORE *rghStores;
DWORD cPropSheetPages;
LPCPROPSHEETPAGEW rgPropSheetPages;
HCERTSTORE hSelectedCertStore;
} CRYPTUI_SELECTCERTIFICATE_STRUCTA, *PCRYPTUI_SELECTCERTIFICATE_STRUCTA;
typedef const CRYPTUI_SELECTCERTIFICATE_STRUCTA *
PCCRYPTUI_SELECTCERTIFICATE_STRUCTA;
typedef struct _CRYPTUI_SELECTCERTIFICATE_STRUCTW
{
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCWSTR szTitle;
DWORD dwDontUseColumn;
LPCWSTR szDisplayString;
PFNCFILTERPROC pFilterCallback;
PFNCCERTDISPLAYPROC pDisplayCallback;
void *pvCallbackData;
DWORD cStores;
HCERTSTORE *rghStores;
DWORD cPropSheetPages;
LPCPROPSHEETPAGEW rgPropSheetPages;
HCERTSTORE hSelectedCertStore;
} CRYPTUI_SELECTCERTIFICATE_STRUCTW, *PCRYPTUI_SELECTCERTIFICATE_STRUCTW;
typedef const CRYPTUI_SELECTCERTIFICATE_STRUCTW *
PCCRYPTUI_SELECTCERTIFICATE_STRUCTW;
PCCERT_CONTEXT WINAPI CryptUIDlgSelectCertificateA(
PCCRYPTUI_SELECTCERTIFICATE_STRUCTA pcsc);
PCCERT_CONTEXT WINAPI CryptUIDlgSelectCertificateW(
PCCRYPTUI_SELECTCERTIFICATE_STRUCTW pcsc);
typedef struct tagCRYPTUI_VIEWSIGNERINFO_STRUCTA
{
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCSTR szTitle;
CMSG_SIGNER_INFO *pSignerInfo;
HCRYPTMSG hMsg;
LPCSTR pszOID;
DWORD_PTR dwReserved;
DWORD cStores;
HCERTSTORE *rghStores;
DWORD cPropSheetPages;
LPCPROPSHEETPAGEA rgPropSheetPages;
} CRYPTUI_VIEWSIGNERINFO_STRUCTA, *PCRYPTUI_VIEWSIGNERINFO_STRUCTA;
typedef struct tagCRYPTUI_VIEWSIGNERINFO_STRUCTW
{
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCWSTR szTitle;
CMSG_SIGNER_INFO *pSignerInfo;
HCRYPTMSG hMsg;
LPCSTR pszOID;
DWORD_PTR dwReserved;
DWORD cStores;
HCERTSTORE *rghStores;
DWORD cPropSheetPages;
LPCPROPSHEETPAGEW rgPropSheetPages;
} CRYPTUI_VIEWSIGNERINFO_STRUCTW, *PCRYPTUI_VIEWSIGNERINFO_STRUCTW;
BOOL WINAPI CryptUIDlgViewSignerInfoA(CRYPTUI_VIEWSIGNERINFO_STRUCTA *pcvsi);
BOOL WINAPI CryptUIDlgViewSignerInfoW(CRYPTUI_VIEWSIGNERINFO_STRUCTW *pcvsi);
#include <poppack.h>
#ifdef __cplusplus
}
#endif
#endif

View file

@ -71,7 +71,7 @@ typedef struct CATALOG_INFO_
#include <poppack.h>
BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN*,const GUID*,DWORD);
BOOL WINAPI CryptCATAdminAddCatalog(HCATADMIN,PWSTR,PWSTR,DWORD);
HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN,PWSTR,PWSTR,DWORD);
BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE,DWORD*,BYTE*,DWORD);
HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN,BYTE*,DWORD,DWORD,HCATINFO*);
BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN,HCATINFO,DWORD);

View file

@ -260,7 +260,7 @@ struct _CRYPT_PROVIDER_DATA;
#define TRUSTERROR_MAX_STEPS 38
typedef void * (WINAPI *PFN_CPD_MEM_ALLOC)(DWORD cbSize);
typedef void * (__WINE_ALLOC_SIZE(1) WINAPI *PFN_CPD_MEM_ALLOC)(DWORD cbSize);
typedef void (WINAPI *PFN_CPD_MEM_FREE)(void *pvMem2Free);
typedef BOOL (WINAPI *PFN_CPD_ADD_STORE)(struct _CRYPT_PROVIDER_DATA *pProvData,
HCERTSTORE hStore2Add);
@ -385,6 +385,10 @@ typedef struct _CRYPT_PROVUI_FUNCS {
#include <poppack.h>
#define WVT_OFFSETOF(t,f) ((ULONG)((ULONG_PTR)(&((t*)0)->f)))
#define WVT_ISINSTRUCT(t,s,f) (WVT_OFFSETOF(t,f) + sizeof(((t*)0)->f) <= (s))
#define WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(t,s,f) WVT_ISINSTRUCT(t,s,f)
#define WTPF_TRUSTTEST 0x00000020
#define WTPF_TESTCANBEVALID 0x00000080
#define WTPF_IGNOREEXPIRATION 0x00000100