mshtml: Add tests for get_scrollLeft.
[wine] / dlls / cryptdlg / main.c
1 /*
2  * Copyright 2008 Maarten Lankhorst
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wincrypt.h"
26 #include "wintrust.h"
27 #include "winuser.h"
28 #include "cryptdlg.h"
29 #include "wine/debug.h"
30
31 WINE_DEFAULT_DEBUG_CHANNEL(cryptdlg);
32
33 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
34 {
35     TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
36
37     switch (fdwReason)
38     {
39         case DLL_WINE_PREATTACH:
40             return FALSE;    /* prefer native version */
41         case DLL_PROCESS_ATTACH:
42             DisableThreadLibraryCalls(hinstDLL);
43             break;
44         case DLL_PROCESS_DETACH:
45             break;
46         default:
47             break;
48     }
49     return TRUE;
50 }
51
52 /***********************************************************************
53  *              GetFriendlyNameOfCertA (CRYPTDLG.@)
54  */
55 DWORD WINAPI GetFriendlyNameOfCertA(PCCERT_CONTEXT pccert, LPSTR pchBuffer,
56                              DWORD cchBuffer)
57 {
58     return CertGetNameStringA(pccert, CERT_NAME_FRIENDLY_DISPLAY_TYPE, 0, NULL,
59      pchBuffer, cchBuffer);
60 }
61
62 /***********************************************************************
63  *              GetFriendlyNameOfCertW (CRYPTDLG.@)
64  */
65 DWORD WINAPI GetFriendlyNameOfCertW(PCCERT_CONTEXT pccert, LPWSTR pchBuffer,
66                              DWORD cchBuffer)
67 {
68     return CertGetNameStringW(pccert, CERT_NAME_FRIENDLY_DISPLAY_TYPE, 0, NULL,
69      pchBuffer, cchBuffer);
70 }
71
72 /***********************************************************************
73  *              CertTrustInit (CRYPTDLG.@)
74  */
75 HRESULT WINAPI CertTrustInit(CRYPT_PROVIDER_DATA *pProvData)
76 {
77     FIXME("(%p)\n", pProvData);
78     return E_NOTIMPL;
79 }
80
81 /***********************************************************************
82  *              CertTrustCertPolicy (CRYPTDLG.@)
83  */
84 BOOL WINAPI CertTrustCertPolicy(CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSignerChain, DWORD idxCounterSigner)
85 {
86     FIXME("(%p, %d, %s, %d)\n", pProvData, idxSigner, fCounterSignerChain ? "TRUE" : "FALSE", idxCounterSigner);
87     return FALSE;
88 }
89
90 /***********************************************************************
91  *              CertTrustCleanup (CRYPTDLG.@)
92  */
93 HRESULT WINAPI CertTrustCleanup(CRYPT_PROVIDER_DATA *pProvData)
94 {
95     FIXME("(%p)\n", pProvData);
96     return E_NOTIMPL;
97 }
98
99 /***********************************************************************
100  *              CertTrustFinalPolicy (CRYPTDLG.@)
101  */
102 HRESULT WINAPI CertTrustFinalPolicy(CRYPT_PROVIDER_DATA *pProvData)
103 {
104     FIXME("(%p)\n", pProvData);
105     return E_NOTIMPL;
106 }
107
108 /***********************************************************************
109  *              CertViewPropertiesA (CRYPTDLG.@)
110  */
111 BOOL WINAPI CertViewPropertiesA(CERT_VIEWPROPERTIES_STRUCT_A *info)
112 {
113     FIXME("(%p): stub\n", info);
114     return FALSE;
115 }
116
117 /***********************************************************************
118  *              CertViewPropertiesW (CRYPTDLG.@)
119  */
120 BOOL WINAPI CertViewPropertiesW(CERT_VIEWPROPERTIES_STRUCT_W *info)
121 {
122     FIXME("(%p): stub\n", info);
123     return FALSE;
124 }
125
126 /***********************************************************************
127  *              DllRegisterServer (CRYPTDLG.@)
128  */
129 HRESULT WINAPI DllRegisterServer(void)
130 {
131     static WCHAR cryptdlg[] = { 'c','r','y','p','t','d','l','g','.',
132      'd','l','l',0 };
133     static WCHAR wintrust[] = { 'w','i','n','t','r','u','s','t','.',
134      'd','l','l',0 };
135     static WCHAR certTrustInit[] = { 'C','e','r','t','T','r','u','s','t',
136      'I','n','i','t',0 };
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;
147     HRESULT hr = S_OK;
148
149     memset(&reg, 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, &reg))
167         hr = GetLastError();
168     return hr;
169 }
170
171 /***********************************************************************
172  *              DllUnregisterServer (CRYPTDLG.@)
173  */
174 HRESULT WINAPI DllUnregisterServer(void)
175 {
176     GUID guid = CERT_CERTIFICATE_ACTION_VERIFY;
177
178     WintrustRemoveActionID(&guid);
179     return S_OK;
180 }