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

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

Version: ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  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 
 37 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
 38 {
 39     switch (fdwReason)
 40     {
 41         case DLL_PROCESS_ATTACH:
 42             DisableThreadLibraryCalls(hInstance);
 43             crypt_oid_init(hInstance);
 44             break;
 45         case DLL_PROCESS_DETACH:
 46             crypt_oid_free();
 47             crypt_sip_free();
 48             root_store_free();
 49             default_chain_engine_free();
 50             /* Don't release the default provider on process shutdown, there's
 51              * no guarantee the provider dll hasn't already been unloaded.
 52              */
 53             if (hDefProv && !pvReserved) CryptReleaseContext(hDefProv, 0);
 54             break;
 55     }
 56     return TRUE;
 57 }
 58 
 59 HCRYPTPROV CRYPT_GetDefaultProvider(void)
 60 {
 61     if (!hDefProv)
 62     {
 63         HCRYPTPROV prov;
 64 
 65         CryptAcquireContextW(&prov, NULL, MS_ENHANCED_PROV_W, PROV_RSA_FULL,
 66          CRYPT_VERIFYCONTEXT);
 67         InterlockedCompareExchangePointer((PVOID *)&hDefProv, (PVOID)prov,
 68          NULL);
 69         if (hDefProv != prov)
 70             CryptReleaseContext(prov, 0);
 71     }
 72     return hDefProv;
 73 }
 74 
 75 typedef void * HLRUCACHE;
 76 
 77 /* this function is called by Internet Explorer when it is about to verify a
 78  * downloaded component.  The first parameter appears to be a pointer to an
 79  * unknown type, native fails unless it points to a buffer of at least 20 bytes.
 80  * The second parameter appears to be an out parameter, whatever it's set to is
 81  * passed (by cryptnet.dll) to I_CryptFlushLruCache.
 82  */
 83 BOOL WINAPI I_CryptCreateLruCache(void *unknown, HLRUCACHE *out)
 84 {
 85     FIXME("(%p, %p): stub!\n", unknown, out);
 86     *out = (void *)0xbaadf00d;
 87     return TRUE;
 88 }
 89 
 90 BOOL WINAPI I_CryptFindLruEntry(DWORD unk0, DWORD unk1)
 91 {
 92     FIXME("(%08x, %08x): stub!\n", unk0, unk1);
 93     return FALSE;
 94 }
 95 
 96 BOOL WINAPI I_CryptFindLruEntryData(DWORD unk0, DWORD unk1, DWORD unk2)
 97 {
 98     FIXME("(%08x, %08x, %08x): stub!\n", unk0, unk1, unk2);
 99     return FALSE;
100 }
101 
102 BOOL WINAPI I_CryptCreateLruEntry(HLRUCACHE h, DWORD unk0, DWORD unk1)
103 {
104     FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1);
105     return FALSE;
106 }
107 
108 DWORD WINAPI I_CryptFlushLruCache(HLRUCACHE h, DWORD unk0, DWORD unk1)
109 {
110     FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1);
111     return 0;
112 }
113 
114 HLRUCACHE WINAPI I_CryptFreeLruCache(HLRUCACHE h, DWORD unk0, DWORD unk1)
115 {
116     FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1);
117     return h;
118 }
119 
120 LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
121 {
122     return HeapAlloc(GetProcessHeap(), 0, cbSize);
123 }
124 
125 LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize)
126 {
127     return HeapReAlloc(GetProcessHeap(), 0, pv, cbSize);
128 }
129 
130 VOID WINAPI CryptMemFree(LPVOID pv)
131 {
132     HeapFree(GetProcessHeap(), 0, pv);
133 }
134 
135 DWORD WINAPI I_CryptAllocTls(void)
136 {
137     return TlsAlloc();
138 }
139 
140 LPVOID WINAPI I_CryptDetachTls(DWORD dwTlsIndex)
141 {
142     LPVOID ret;
143 
144     ret = TlsGetValue(dwTlsIndex);
145     TlsSetValue(dwTlsIndex, NULL);
146     return ret;
147 }
148 
149 LPVOID WINAPI I_CryptGetTls(DWORD dwTlsIndex)
150 {
151     return TlsGetValue(dwTlsIndex);
152 }
153 
154 BOOL WINAPI I_CryptSetTls(DWORD dwTlsIndex, LPVOID lpTlsValue)
155 {
156     return TlsSetValue(dwTlsIndex, lpTlsValue);
157 }
158 
159 BOOL WINAPI I_CryptFreeTls(DWORD dwTlsIndex, DWORD unknown)
160 {
161     TRACE("(%d, %d)\n", dwTlsIndex, unknown);
162     return TlsFree(dwTlsIndex);
163 }
164 
165 BOOL WINAPI I_CryptGetOssGlobal(DWORD x)
166 {
167     FIXME("%08x\n", x);
168     return FALSE;
169 }
170 
171 HCRYPTPROV WINAPI I_CryptGetDefaultCryptProv(DWORD reserved)
172 {
173     HCRYPTPROV ret;
174 
175     TRACE("(%08x)\n", reserved);
176 
177     if (reserved)
178     {
179         SetLastError(E_INVALIDARG);
180         return (HCRYPTPROV)0;
181     }
182     ret = CRYPT_GetDefaultProvider();
183     CryptContextAddRef(ret, NULL, 0);
184     return ret;
185 }
186 
187 BOOL WINAPI I_CryptReadTrustedPublisherDWORDValueFromRegistry(LPCWSTR name,
188  DWORD *value)
189 {
190     static const WCHAR safer[] = { 
191      'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
192      'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m',
193      'C','e','r','t','i','f','i','c','a','t','e','s','\\',
194      'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r','\\',
195      'S','a','f','e','r',0 };
196     HKEY key;
197     LONG rc;
198     BOOL ret = FALSE;
199 
200     TRACE("(%s, %p)\n", debugstr_w(name), value);
201 
202     *value = 0;
203     rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, safer, &key);
204     if (rc == ERROR_SUCCESS)
205     {
206         DWORD size = sizeof(DWORD);
207 
208         if (!RegQueryValueExW(key, name, NULL, NULL, (LPBYTE)value, &size))
209             ret = TRUE;
210         RegCloseKey(key);
211     }
212     return ret;
213 }
214 
215 DWORD WINAPI I_CryptInstallOssGlobal(DWORD x, DWORD y, DWORD z)
216 {
217     static int ret = 8;
218     ret++;
219     FIXME("%08x %08x %08x, return value %d\n", x, y, z,ret);
220     return ret;
221 }
222 
223 BOOL WINAPI I_CryptInstallAsn1Module(ASN1module_t x, DWORD y, void* z)
224 {
225     FIXME("(%p %08x %p): stub\n", x, y, z);
226     return TRUE;
227 }
228 
229 BOOL WINAPI I_CryptUninstallAsn1Module(HCRYPTASN1MODULE x)
230 {
231     FIXME("(%08x): stub\n", x);
232     return TRUE;
233 }
234 
235 ASN1decoding_t WINAPI I_CryptGetAsn1Decoder(HCRYPTASN1MODULE x)
236 {
237     FIXME("(%08x): stub\n", x);
238     return NULL;
239 }
240 
241 ASN1encoding_t WINAPI I_CryptGetAsn1Encoder(HCRYPTASN1MODULE x)
242 {
243     FIXME("(%08x): stub\n", x);
244     return NULL;
245 }
246 
247 BOOL WINAPI CryptFormatObject(DWORD dwCertEncodingType, DWORD dwFormatType,
248  DWORD dwFormatStrType, void *pFormatStruct, LPCSTR lpszStructType,
249  const BYTE *pbEncoded, DWORD cbEncoded, void *pbFormat, DWORD *pcbFormat)
250 {
251     FIXME("(%08x, %d, %d, %p, %s, %p, %d, %p, %p): stub\n",
252      dwCertEncodingType, dwFormatType, dwFormatStrType, pFormatStruct,
253      debugstr_a(lpszStructType), pbEncoded, cbEncoded, pbFormat, pcbFormat);
254     return FALSE;
255 }
256 

~ [ 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.