Update the address of the Free Software Foundation.
[wine] / dlls / wintrust / wintrust_main.c
1 /*
2  * Copyright 2001 Rein Klazes
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 "winerror.h"
26 #include "guiddef.h"
27 #include "wintrust.h"
28 #include "softpub.h"
29 #include "mscat.h"
30 #include "objbase.h"
31
32 #include "wine/debug.h"
33
34 WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
35
36
37 /***********************************************************************
38  *              DllMain  (WINTRUST.@)
39  */
40 BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
41 {
42     switch(reason)
43     {
44     case DLL_WINE_PREATTACH:
45         return FALSE;  /* prefer native version */
46     case DLL_PROCESS_ATTACH:
47         DisableThreadLibraryCalls( inst );
48         break;
49     }
50     return TRUE;
51 }
52
53 /***********************************************************************
54  *              CryptCATAdminAcquireContext (WINTRUST.@)
55  */
56 BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN* catAdmin,
57                                         const GUID *sysSystem, DWORD dwFlags )
58 {
59     FIXME("%p %s %lx\n", catAdmin, debugstr_guid(sysSystem), dwFlags);
60     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
61     return FALSE;
62 }
63
64 /***********************************************************************
65  *             CryptCATAdminCalcHashFromFileHandle (WINTRUST.@)
66  */
67 BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE hFile, DWORD* pcbHash,
68                                                 BYTE* pbHash, DWORD dwFlags )
69 {
70     FIXME("%p %p %p %lx\n", hFile, pcbHash, pbHash, dwFlags);
71     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
72     return FALSE;
73 }
74
75 /***********************************************************************
76  *              CryptCATAdminReleaseContext (WINTRUST.@)
77  */
78 BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags )
79 {
80     FIXME("%p %lx\n", hCatAdmin, dwFlags);
81     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
82     return FALSE;
83 }
84
85 /***********************************************************************
86  *              WinVerifyTrust (WINTRUST.@)
87  */
88 LONG WINAPI WinVerifyTrust( HWND hwnd, GUID *ActionID,  WINTRUST_DATA* ActionData )
89 {
90     static const GUID gen_verify_v2 = WINTRUST_ACTION_GENERIC_VERIFY_V2;
91
92     FIXME("%p %s %p\n", hwnd, debugstr_guid(ActionID), ActionData);
93
94     /* Trust providers can be found at:
95      * HKLM\SOFTWARE\Microsoft\Cryptography\Providers\Trust\CertCheck\
96      *
97      * Process Explorer expects a correct implementation, so we 
98      * return TRUST_E_PROVIDER_UNKNOWN.
99      *
100      * Girotel needs ERROR_SUCCESS.
101      *
102      * For now return TRUST_E_PROVIDER_UNKNOWN only when 
103      * ActionID = WINTRUST_ACTION_GENERIC_VERIFY_V2.
104      *
105      */
106
107     if (IsEqualCLSID(ActionID, &gen_verify_v2))
108         return TRUST_E_PROVIDER_UNKNOWN;
109
110     return ERROR_SUCCESS;
111 }
112
113 /***********************************************************************
114  *              WinVerifyTrustEx (WINTRUST.@)
115  */
116 HRESULT WINAPI WinVerifyTrustEx( HWND hwnd, GUID *ActionID,
117  WINTRUST_DATA* ActionData )
118 {
119     FIXME("%p %s %p\n", hwnd, debugstr_guid(ActionID), ActionData);
120     return S_OK;
121 }
122
123 /***********************************************************************
124  *              WTHelperGetProvSignerFromChain (WINTRUST.@)
125  */
126 CRYPT_PROVIDER_SGNR * WINAPI WTHelperGetProvSignerFromChain(
127  CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner, BOOL fCounterSigner,
128  DWORD idxCounterSigner)
129 {
130     FIXME("%p %ld %d %ld\n", pProvData, idxSigner, fCounterSigner,
131      idxCounterSigner);
132     return NULL;
133 }
134
135 /***********************************************************************
136  *              WTHelperProvDataFromStateData (WINTRUST.@)
137  */
138 CRYPT_PROVIDER_DATA * WINAPI WTHelperProvDataFromStateData(HANDLE hStateData)
139 {
140     FIXME("%p\n", hStateData);
141     return NULL;
142 }
143
144 /***********************************************************************
145  *              WintrustAddActionID (WINTRUST.@)
146  */
147 BOOL WINAPI WintrustAddActionID( GUID* pgActionID, DWORD fdwFlags,
148                                  CRYPT_REGISTER_ACTIONID* psProvInfo)
149 {
150     FIXME("%p %lx %p\n", pgActionID, fdwFlags, psProvInfo);
151     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
152     return FALSE;
153 }
154
155 /***********************************************************************
156  *              WintrustGetRegPolicyFlags (WINTRUST.@)
157  */
158 void WINAPI WintrustGetRegPolicyFlags( DWORD* pdwPolicyFlags )
159 {
160     FIXME("%p\n", pdwPolicyFlags);
161     *pdwPolicyFlags = 0;
162 }
163
164 /***********************************************************************
165  *              WintrustSetRegPolicyFlags (WINTRUST.@)
166  */
167 BOOL WINAPI WintrustSetRegPolicyFlags( DWORD dwPolicyFlags)
168 {
169     FIXME("stub: %lx\n", dwPolicyFlags);
170     return TRUE;
171 }
172
173 /***********************************************************************
174   *             DllRegisterServer (WINTRUST.@)
175   */
176 HRESULT WINAPI DllRegisterServer(void)
177 {
178      FIXME("stub\n");
179      return S_OK;
180 }
181
182 /***********************************************************************
183   *             DllUnregisterServer (WINTRUST.@)
184   */
185 HRESULT WINAPI DllUnregisterServer(void)
186 {
187      FIXME("stub\n");
188      return S_OK;
189 }