2 * Copyright 2008 Maarten Lankhorst
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(cryptdlg
);
33 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
35 TRACE("(0x%p, %d, %p)\n", hinstDLL
, fdwReason
, lpvReserved
);
39 case DLL_WINE_PREATTACH
:
40 return FALSE
; /* prefer native version */
41 case DLL_PROCESS_ATTACH
:
42 DisableThreadLibraryCalls(hinstDLL
);
44 case DLL_PROCESS_DETACH
:
52 /***********************************************************************
53 * GetFriendlyNameOfCertA (CRYPTDLG.@)
55 DWORD WINAPI
GetFriendlyNameOfCertA(PCCERT_CONTEXT pccert
, LPSTR pchBuffer
,
58 return CertGetNameStringA(pccert
, CERT_NAME_FRIENDLY_DISPLAY_TYPE
, 0, NULL
,
59 pchBuffer
, cchBuffer
);
62 /***********************************************************************
63 * GetFriendlyNameOfCertW (CRYPTDLG.@)
65 DWORD WINAPI
GetFriendlyNameOfCertW(PCCERT_CONTEXT pccert
, LPWSTR pchBuffer
,
68 return CertGetNameStringW(pccert
, CERT_NAME_FRIENDLY_DISPLAY_TYPE
, 0, NULL
,
69 pchBuffer
, cchBuffer
);
72 /***********************************************************************
73 * CertTrustInit (CRYPTDLG.@)
75 HRESULT WINAPI
CertTrustInit(CRYPT_PROVIDER_DATA
*pProvData
)
77 FIXME("(%p)\n", pProvData
);
81 /***********************************************************************
82 * CertTrustCertPolicy (CRYPTDLG.@)
84 BOOL WINAPI
CertTrustCertPolicy(CRYPT_PROVIDER_DATA
*pProvData
, DWORD idxSigner
, BOOL fCounterSignerChain
, DWORD idxCounterSigner
)
86 FIXME("(%p, %d, %s, %d)\n", pProvData
, idxSigner
, fCounterSignerChain
? "TRUE" : "FALSE", idxCounterSigner
);
90 /***********************************************************************
91 * CertTrustCleanup (CRYPTDLG.@)
93 HRESULT WINAPI
CertTrustCleanup(CRYPT_PROVIDER_DATA
*pProvData
)
95 FIXME("(%p)\n", pProvData
);
99 /***********************************************************************
100 * CertTrustFinalPolicy (CRYPTDLG.@)
102 HRESULT WINAPI
CertTrustFinalPolicy(CRYPT_PROVIDER_DATA
*pProvData
)
104 FIXME("(%p)\n", pProvData
);
108 /***********************************************************************
109 * CertViewPropertiesA (CRYPTDLG.@)
111 BOOL WINAPI
CertViewPropertiesA(CERT_VIEWPROPERTIES_STRUCT_A
*info
)
113 FIXME("(%p): stub\n", info
);
117 /***********************************************************************
118 * CertViewPropertiesW (CRYPTDLG.@)
120 BOOL WINAPI
CertViewPropertiesW(CERT_VIEWPROPERTIES_STRUCT_W
*info
)
122 FIXME("(%p): stub\n", info
);
126 /***********************************************************************
127 * DllRegisterServer (CRYPTDLG.@)
129 HRESULT WINAPI
DllRegisterServer(void)
131 static WCHAR cryptdlg
[] = { 'c','r','y','p','t','d','l','g','.',
133 static WCHAR wintrust
[] = { 'w','i','n','t','r','u','s','t','.',
135 static WCHAR certTrustInit
[] = { 'C','e','r','t','T','r','u','s','t',
137 static WCHAR wintrustCertificateTrust
[] = { 'W','i','n','t','r','u','s','t',
138 'C','e','r','t','i','f','i','c','a','t','e','T','r','u','s','t',0 };
139 static WCHAR certTrustCertPolicy
[] = { 'C','e','r','t','T','r','u','s','t',
140 'C','e','r','t','P','o','l','i','c','y',0 };
141 static WCHAR certTrustFinalPolicy
[] = { 'C','e','r','t','T','r','u','s','t',
142 'F','i','n','a','l','P','o','l','i','c','y',0 };
143 static WCHAR certTrustCleanup
[] = { 'C','e','r','t','T','r','u','s','t',
144 'C','l','e','a','n','u','p',0 };
145 CRYPT_REGISTER_ACTIONID reg
;
146 GUID guid
= CERT_CERTIFICATE_ACTION_VERIFY
;
149 memset(®
, 0, sizeof(reg
));
150 reg
.cbStruct
= sizeof(reg
);
151 reg
.sInitProvider
.cbStruct
= sizeof(CRYPT_TRUST_REG_ENTRY
);
152 reg
.sInitProvider
.pwszDLLName
= cryptdlg
;
153 reg
.sInitProvider
.pwszFunctionName
= certTrustInit
;
154 reg
.sCertificateProvider
.cbStruct
= sizeof(CRYPT_TRUST_REG_ENTRY
);
155 reg
.sCertificateProvider
.pwszDLLName
= wintrust
;
156 reg
.sCertificateProvider
.pwszFunctionName
= wintrustCertificateTrust
;
157 reg
.sCertificatePolicyProvider
.cbStruct
= sizeof(CRYPT_TRUST_REG_ENTRY
);
158 reg
.sCertificatePolicyProvider
.pwszDLLName
= cryptdlg
;
159 reg
.sCertificatePolicyProvider
.pwszFunctionName
= certTrustCertPolicy
;
160 reg
.sFinalPolicyProvider
.cbStruct
= sizeof(CRYPT_TRUST_REG_ENTRY
);
161 reg
.sFinalPolicyProvider
.pwszDLLName
= cryptdlg
;
162 reg
.sFinalPolicyProvider
.pwszFunctionName
= certTrustFinalPolicy
;
163 reg
.sCleanupProvider
.cbStruct
= sizeof(CRYPT_TRUST_REG_ENTRY
);
164 reg
.sCleanupProvider
.pwszDLLName
= cryptdlg
;
165 reg
.sCleanupProvider
.pwszFunctionName
= certTrustCleanup
;
166 if (!WintrustAddActionID(&guid
, WT_ADD_ACTION_ID_RET_RESULT_FLAG
, ®
))
171 /***********************************************************************
172 * DllUnregisterServer (CRYPTDLG.@)
174 HRESULT WINAPI
DllUnregisterServer(void)
176 GUID guid
= CERT_CERTIFICATE_ACTION_VERIFY
;
178 WintrustRemoveActionID(&guid
);