~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/crypt32/main.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Copyright 2002 Mike McCormack for CodeWeavers
  3  * Copyright 2005 Juan Lang
  4  *
  5  * This library is free software; you can redistribute it and/or
  6  * modify it under the terms of the GNU Lesser General Public
  7  * License as published by the Free Software Foundation; either
  8  * version 2.1 of the License, or (at your option) any later version.
  9  *
 10  * This library is distributed in the hope that it will be useful,
 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13  * Lesser General Public License for more details.
 14  *
 15  * You should have received a copy of the GNU Lesser General Public
 16  * License along with this library; if not, write to the Free Software
 17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 18  */
 19 
 20 #include "config.h"
 21 #include <stdarg.h>
 22 #include <stdio.h>
 23 
 24 #include "windef.h"
 25 #include "winbase.h"
 26 #include "wincrypt.h"
 27 #include "winreg.h"
 28 #include "winuser.h"
 29 #include "i_cryptasn1tls.h"
 30 #include "crypt32_private.h"
 31 #include "wine/debug.h"
 32 
 33 WINE_DEFAULT_DEBUG_CHANNEL(crypt);
 34 
 35 static HCRYPTPROV hDefProv;
 36 HINSTANCE hInstance;
 37 
 38 BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved)
 39 {
 40     switch (fdwReason)
 41     {
 42         case DLL_PROCESS_ATTACH:
 43             hInstance = hInst;
 44             DisableThreadLibraryCalls(hInst);
 45             crypt_oid_init();
 46             break;
 47         case DLL_PROCESS_DETACH:
 48             crypt_oid_free();
 49             crypt_sip_free();
 50             root_store_free();
 51             default_chain_engine_free();
 52             /* Don't release the default provider on process shutdown, there's
 53              * no guarantee the provider dll hasn't already been unloaded.
 54              */
 55             if (hDefProv && !pvReserved) CryptReleaseContext(hDefProv, 0);
 56             break;
 57     }
 58     return TRUE;
 59 }
 60 
 61 HCRYPTPROV CRYPT_GetDefaultProvider(void)
 62 {
 63     if (!hDefProv)
 64     {
 65         HCRYPTPROV prov;
 66 
 67         if (!CryptAcquireContextW(&prov, NULL, MS_ENHANCED_PROV_W, PROV_RSA_FULL,
 68          CRYPT_VERIFYCONTEXT))
 69             return hDefProv;
 70         InterlockedCompareExchangePointer((PVOID *)&hDefProv, (PVOID)prov,
 71          NULL);
 72         if (hDefProv != prov)
 73             CryptReleaseContext(prov, 0);
 74     }
 75     return hDefProv;
 76 }
 77 
 78 typedef void * HLRUCACHE;
 79 
 80 /* this function is called by Internet Explorer when it is about to verify a
 81  * downloaded component.  The first parameter appears to be a pointer to an
 82  * unknown type, native fails unless it points to a buffer of at least 20 bytes.
 83  * The second parameter appears to be an out parameter, whatever it's set to is
 84  * passed (by cryptnet.dll) to I_CryptFlushLruCache.
 85  */
 86 BOOL WINAPI I_CryptCreateLruCache(void *unknown, HLRUCACHE *out)
 87 {
 88     FIXME("(%p, %p): stub!\n", unknown, out);
 89     *out = (void *)0xbaadf00d;
 90     return TRUE;
 91 }
 92 
 93 BOOL WINAPI I_CryptFindLruEntry(DWORD unk0, DWORD unk1)
 94 {
 95     FIXME("(%08x, %08x): stub!\n", unk0, unk1);
 96     return FALSE;
 97 }
 98 
 99 BOOL WINAPI I_CryptFindLruEntryData(DWORD unk0, DWORD unk1, DWORD unk2)
100 {
101     FIXME("(%08x, %08x, %08x): stub!\n", unk0, unk1, unk2);
102     return FALSE;
103 }
104 
105 BOOL WINAPI I_CryptCreateLruEntry(HLRUCACHE h, DWORD unk0, DWORD unk1)
106 {
107     FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1);
108     return FALSE;
109 }
110 
111 DWORD WINAPI I_CryptFlushLruCache(HLRUCACHE h, DWORD unk0, DWORD unk1)
112 {
113     FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1);
114     return 0;
115 }
116 
117 HLRUCACHE WINAPI I_CryptFreeLruCache(HLRUCACHE h, DWORD unk0, DWORD unk1)
118 {
119     FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1);
120     return h;
121 }
122 
123 LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
124 {
125     return HeapAlloc(GetProcessHeap(), 0, cbSize);
126 }
127 
128 LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize)
129 {
130     return HeapReAlloc(GetProcessHeap(), 0, pv, cbSize);
131 }
132 
133 VOID WINAPI CryptMemFree(LPVOID pv)
134 {
135     HeapFree(GetProcessHeap(), 0, pv);
136 }
137 
138 DWORD WINAPI I_CryptAllocTls(void)
139 {
140     return TlsAlloc();
141 }
142 
143 LPVOID WINAPI I_CryptDetachTls(DWORD dwTlsIndex)
144 {
145     LPVOID ret;
146 
147     ret = TlsGetValue(dwTlsIndex);
148     TlsSetValue(dwTlsIndex, NULL);
149     return ret;
150 }
151 
152 LPVOID WINAPI I_CryptGetTls(DWORD dwTlsIndex)
153 {
154     return TlsGetValue(dwTlsIndex);
155 }
156 
157 BOOL WINAPI I_CryptSetTls(DWORD dwTlsIndex, LPVOID lpTlsValue)
158 {
159     return TlsSetValue(dwTlsIndex, lpTlsValue);
160 }
161 
162 BOOL WINAPI I_CryptFreeTls(DWORD dwTlsIndex, DWORD unknown)
163 {
164     TRACE("(%d, %d)\n", dwTlsIndex, unknown);
165     return TlsFree(dwTlsIndex);
166 }
167 
168 BOOL WINAPI I_CryptGetOssGlobal(DWORD x)
169 {
170     FIXME("%08x\n", x);
171     return FALSE;
172 }
173 
174 HCRYPTPROV WINAPI I_CryptGetDefaultCryptProv(DWORD reserved)
175 {
176     HCRYPTPROV ret;
177 
178     TRACE("(%08x)\n", reserved);
179 
180     if (reserved)
181     {
182         SetLastError(E_INVALIDARG);
183         return 0;
184     }
185     ret = CRYPT_GetDefaultProvider();
186     CryptContextAddRef(ret, NULL, 0);
187     return ret;
188 }
189 
190 BOOL WINAPI I_CryptReadTrustedPublisherDWORDValueFromRegistry(LPCWSTR name,
191  DWORD *value)
192 {
193     static const WCHAR safer[] = { 
194      'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
195      'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m',
196      'C','e','r','t','i','f','i','c','a','t','e','s','\\',
197      'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r','\\',
198      'S','a','f','e','r',0 };
199     HKEY key;
200     LONG rc;
201     BOOL ret = FALSE;
202 
203     TRACE("(%s, %p)\n", debugstr_w(name), value);
204 
205     *value = 0;
206     rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, safer, &key);
207     if (rc == ERROR_SUCCESS)
208     {
209         DWORD size = sizeof(DWORD);
210 
211         if (!RegQueryValueExW(key, name, NULL, NULL, (LPBYTE)value, &size))
212             ret = TRUE;
213         RegCloseKey(key);
214     }
215     return ret;
216 }
217 
218 DWORD WINAPI I_CryptInstallOssGlobal(DWORD x, DWORD y, DWORD z)
219 {
220     static int ret = 8;
221     ret++;
222     FIXME("%08x %08x %08x, return value %d\n", x, y, z,ret);
223     return ret;
224 }
225 
226 BOOL WINAPI I_CryptInstallAsn1Module(ASN1module_t x, DWORD y, void* z)
227 {
228     FIXME("(%p %08x %p): stub\n", x, y, z);
229     return TRUE;
230 }
231 
232 BOOL WINAPI I_CryptUninstallAsn1Module(HCRYPTASN1MODULE x)
233 {
234     FIXME("(%08x): stub\n", x);
235     return TRUE;
236 }
237 
238 ASN1decoding_t WINAPI I_CryptGetAsn1Decoder(HCRYPTASN1MODULE x)
239 {
240     FIXME("(%08x): stub\n", x);
241     return NULL;
242 }
243 
244 ASN1encoding_t WINAPI I_CryptGetAsn1Encoder(HCRYPTASN1MODULE x)
245 {
246     FIXME("(%08x): stub\n", x);
247     return NULL;
248 }
249 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.