Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenmain.c
Go to the documentation of this file.
00001 /* 00002 * Copyright 2002 Mike McCormack for CodeWeavers 00003 * Copyright 2005 Juan Lang 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00018 */ 00019 00020 #include "config.h" 00021 #include <stdarg.h> 00022 #include <stdio.h> 00023 00024 #include "windef.h" 00025 #include "winbase.h" 00026 #include "wincrypt.h" 00027 #include "winreg.h" 00028 #include "winuser.h" 00029 #include "i_cryptasn1tls.h" 00030 #include "crypt32_private.h" 00031 #include "wine/debug.h" 00032 00033 WINE_DEFAULT_DEBUG_CHANNEL(crypt); 00034 00035 static HCRYPTPROV hDefProv; 00036 HINSTANCE hInstance; 00037 00038 BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved) 00039 { 00040 switch (fdwReason) 00041 { 00042 case DLL_PROCESS_ATTACH: 00043 hInstance = hInst; 00044 DisableThreadLibraryCalls(hInst); 00045 crypt_oid_init(); 00046 break; 00047 case DLL_PROCESS_DETACH: 00048 crypt_oid_free(); 00049 crypt_sip_free(); 00050 root_store_free(); 00051 default_chain_engine_free(); 00052 /* Don't release the default provider on process shutdown, there's 00053 * no guarantee the provider dll hasn't already been unloaded. 00054 */ 00055 if (hDefProv && !pvReserved) CryptReleaseContext(hDefProv, 0); 00056 break; 00057 } 00058 return TRUE; 00059 } 00060 00061 HCRYPTPROV CRYPT_GetDefaultProvider(void) 00062 { 00063 if (!hDefProv) 00064 { 00065 HCRYPTPROV prov; 00066 00067 if (!CryptAcquireContextW(&prov, NULL, MS_ENH_RSA_AES_PROV_W, 00068 PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) 00069 return hDefProv; 00070 InterlockedCompareExchangePointer((PVOID *)&hDefProv, (PVOID)prov, 00071 NULL); 00072 if (hDefProv != prov) 00073 CryptReleaseContext(prov, 0); 00074 } 00075 return hDefProv; 00076 } 00077 00078 typedef void * HLRUCACHE; 00079 00080 /* this function is called by Internet Explorer when it is about to verify a 00081 * downloaded component. The first parameter appears to be a pointer to an 00082 * unknown type, native fails unless it points to a buffer of at least 20 bytes. 00083 * The second parameter appears to be an out parameter, whatever it's set to is 00084 * passed (by cryptnet.dll) to I_CryptFlushLruCache. 00085 */ 00086 BOOL WINAPI I_CryptCreateLruCache(void *unknown, HLRUCACHE *out) 00087 { 00088 FIXME("(%p, %p): stub!\n", unknown, out); 00089 *out = (void *)0xbaadf00d; 00090 return TRUE; 00091 } 00092 00093 BOOL WINAPI I_CryptFindLruEntry(DWORD unk0, DWORD unk1) 00094 { 00095 FIXME("(%08x, %08x): stub!\n", unk0, unk1); 00096 return FALSE; 00097 } 00098 00099 BOOL WINAPI I_CryptFindLruEntryData(DWORD unk0, DWORD unk1, DWORD unk2) 00100 { 00101 FIXME("(%08x, %08x, %08x): stub!\n", unk0, unk1, unk2); 00102 return FALSE; 00103 } 00104 00105 BOOL WINAPI I_CryptCreateLruEntry(HLRUCACHE h, DWORD unk0, DWORD unk1) 00106 { 00107 FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1); 00108 return FALSE; 00109 } 00110 00111 DWORD WINAPI I_CryptFlushLruCache(HLRUCACHE h, DWORD unk0, DWORD unk1) 00112 { 00113 FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1); 00114 return 0; 00115 } 00116 00117 HLRUCACHE WINAPI I_CryptFreeLruCache(HLRUCACHE h, DWORD unk0, DWORD unk1) 00118 { 00119 FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1); 00120 return h; 00121 } 00122 00123 LPVOID WINAPI CryptMemAlloc(ULONG cbSize) 00124 { 00125 return HeapAlloc(GetProcessHeap(), 0, cbSize); 00126 } 00127 00128 LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize) 00129 { 00130 return HeapReAlloc(GetProcessHeap(), 0, pv, cbSize); 00131 } 00132 00133 VOID WINAPI CryptMemFree(LPVOID pv) 00134 { 00135 HeapFree(GetProcessHeap(), 0, pv); 00136 } 00137 00138 DWORD WINAPI I_CryptAllocTls(void) 00139 { 00140 return TlsAlloc(); 00141 } 00142 00143 LPVOID WINAPI I_CryptDetachTls(DWORD dwTlsIndex) 00144 { 00145 LPVOID ret; 00146 00147 ret = TlsGetValue(dwTlsIndex); 00148 TlsSetValue(dwTlsIndex, NULL); 00149 return ret; 00150 } 00151 00152 LPVOID WINAPI I_CryptGetTls(DWORD dwTlsIndex) 00153 { 00154 return TlsGetValue(dwTlsIndex); 00155 } 00156 00157 BOOL WINAPI I_CryptSetTls(DWORD dwTlsIndex, LPVOID lpTlsValue) 00158 { 00159 return TlsSetValue(dwTlsIndex, lpTlsValue); 00160 } 00161 00162 BOOL WINAPI I_CryptFreeTls(DWORD dwTlsIndex, DWORD unknown) 00163 { 00164 BOOL ret; 00165 00166 TRACE("(%d, %d)\n", dwTlsIndex, unknown); 00167 00168 ret = TlsFree(dwTlsIndex); 00169 if (!ret) SetLastError( E_INVALIDARG ); 00170 return ret; 00171 } 00172 00173 BOOL WINAPI I_CryptGetOssGlobal(DWORD x) 00174 { 00175 FIXME("%08x\n", x); 00176 return FALSE; 00177 } 00178 00179 HCRYPTPROV WINAPI I_CryptGetDefaultCryptProv(DWORD reserved) 00180 { 00181 HCRYPTPROV ret; 00182 00183 TRACE("(%08x)\n", reserved); 00184 00185 if (reserved) 00186 { 00187 SetLastError(E_INVALIDARG); 00188 return 0; 00189 } 00190 ret = CRYPT_GetDefaultProvider(); 00191 CryptContextAddRef(ret, NULL, 0); 00192 return ret; 00193 } 00194 00195 BOOL WINAPI I_CryptReadTrustedPublisherDWORDValueFromRegistry(LPCWSTR name, 00196 DWORD *value) 00197 { 00198 static const WCHAR safer[] = { 00199 'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\', 00200 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m', 00201 'C','e','r','t','i','f','i','c','a','t','e','s','\\', 00202 'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r','\\', 00203 'S','a','f','e','r',0 }; 00204 HKEY key; 00205 LONG rc; 00206 BOOL ret = FALSE; 00207 00208 TRACE("(%s, %p)\n", debugstr_w(name), value); 00209 00210 *value = 0; 00211 rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, safer, &key); 00212 if (rc == ERROR_SUCCESS) 00213 { 00214 DWORD size = sizeof(DWORD); 00215 00216 if (!RegQueryValueExW(key, name, NULL, NULL, (LPBYTE)value, &size)) 00217 ret = TRUE; 00218 RegCloseKey(key); 00219 } 00220 return ret; 00221 } 00222 00223 DWORD WINAPI I_CryptInstallOssGlobal(DWORD x, DWORD y, DWORD z) 00224 { 00225 static int ret = 8; 00226 ret++; 00227 FIXME("%08x %08x %08x, return value %d\n", x, y, z,ret); 00228 return ret; 00229 } 00230 00231 BOOL WINAPI I_CryptInstallAsn1Module(ASN1module_t x, DWORD y, void* z) 00232 { 00233 FIXME("(%p %08x %p): stub\n", x, y, z); 00234 return TRUE; 00235 } 00236 00237 BOOL WINAPI I_CryptUninstallAsn1Module(HCRYPTASN1MODULE x) 00238 { 00239 FIXME("(%08x): stub\n", x); 00240 return TRUE; 00241 } 00242 00243 ASN1decoding_t WINAPI I_CryptGetAsn1Decoder(HCRYPTASN1MODULE x) 00244 { 00245 FIXME("(%08x): stub\n", x); 00246 return NULL; 00247 } 00248 00249 ASN1encoding_t WINAPI I_CryptGetAsn1Encoder(HCRYPTASN1MODULE x) 00250 { 00251 FIXME("(%08x): stub\n", x); 00252 return NULL; 00253 } Generated on Sun May 27 2012 04:16:39 for ReactOS by
1.7.6.1
|