quartz: Pass the media sample to the individual transform filter callbacks.
[wine/wine64.git] / dlls / crypt32 / main.c
blobf5d68d55f88739de44802c0119a55fb94d5670e3
1 /*
2 * Copyright 2002 Mike McCormack for CodeWeavers
3 * Copyright 2005 Juan Lang
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.
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.
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
20 #include "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "wincrypt.h"
27 #include "winreg.h"
28 #include "winnls.h"
29 #include "mssip.h"
30 #include "winuser.h"
31 #include "advpub.h"
32 #include "crypt32_private.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(crypt);
37 static HCRYPTPROV hDefProv;
39 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
41 switch (fdwReason)
43 case DLL_PROCESS_ATTACH:
44 DisableThreadLibraryCalls(hInstance);
45 crypt_oid_init(hInstance);
46 break;
47 case DLL_PROCESS_DETACH:
48 crypt_oid_free();
49 if (hDefProv) CryptReleaseContext(hDefProv, 0);
50 break;
52 return TRUE;
55 HCRYPTPROV CRYPT_GetDefaultProvider(void)
57 if (!hDefProv)
58 CryptAcquireContextW(&hDefProv, NULL, MS_ENHANCED_PROV_W,
59 PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
60 return hDefProv;
63 typedef void * HLRUCACHE;
65 /* this function is called by Internet Explorer when it is about to verify a
66 * downloaded component. The first parameter appears to be a pointer to an
67 * unknown type, native fails unless it points to a buffer of at least 20 bytes.
68 * The second parameter appears to be an out parameter, whatever it's set to is
69 * passed (by cryptnet.dll) to I_CryptFlushLruCache.
71 BOOL WINAPI I_CryptCreateLruCache(void *unknown, HLRUCACHE *out)
73 FIXME("(%p, %p): stub!\n", unknown, out);
74 *out = (void *)0xbaadf00d;
75 return TRUE;
78 BOOL WINAPI I_CryptFindLruEntryData(DWORD unk0, DWORD unk1, DWORD unk2)
80 FIXME("(%08x, %08x, %08x): stub!\n", unk0, unk1, unk2);
81 return FALSE;
84 DWORD WINAPI I_CryptFlushLruCache(HLRUCACHE h, DWORD unk0, DWORD unk1)
86 FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1);
87 return 0;
90 HLRUCACHE WINAPI I_CryptFreeLruCache(HLRUCACHE h, DWORD unk0, DWORD unk1)
92 FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1);
93 return h;
96 LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
98 return HeapAlloc(GetProcessHeap(), 0, cbSize);
101 LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize)
103 return HeapReAlloc(GetProcessHeap(), 0, pv, cbSize);
106 VOID WINAPI CryptMemFree(LPVOID pv)
108 HeapFree(GetProcessHeap(), 0, pv);
111 DWORD WINAPI I_CryptAllocTls(void)
113 return TlsAlloc();
116 LPVOID WINAPI I_CryptDetachTls(DWORD dwTlsIndex)
118 LPVOID ret;
120 ret = TlsGetValue(dwTlsIndex);
121 TlsSetValue(dwTlsIndex, NULL);
122 return ret;
125 LPVOID WINAPI I_CryptGetTls(DWORD dwTlsIndex)
127 return TlsGetValue(dwTlsIndex);
130 BOOL WINAPI I_CryptSetTls(DWORD dwTlsIndex, LPVOID lpTlsValue)
132 return TlsSetValue(dwTlsIndex, lpTlsValue);
135 BOOL WINAPI I_CryptFreeTls(DWORD dwTlsIndex, DWORD unknown)
137 TRACE("(%d, %d)\n", dwTlsIndex, unknown);
138 return TlsFree(dwTlsIndex);
141 BOOL WINAPI I_CryptGetOssGlobal(DWORD x)
143 FIXME("%08x\n", x);
144 return FALSE;
147 HCRYPTPROV WINAPI I_CryptGetDefaultCryptProv(DWORD reserved)
149 HCRYPTPROV ret;
151 TRACE("(%08x)\n", reserved);
153 if (reserved)
155 SetLastError(E_INVALIDARG);
156 return (HCRYPTPROV)0;
158 ret = CRYPT_GetDefaultProvider();
159 CryptContextAddRef(ret, NULL, 0);
160 return ret;
163 BOOL WINAPI I_CryptReadTrustedPublisherDWORDValueFromRegistry(LPCWSTR name,
164 DWORD *value)
166 static const WCHAR safer[] = {
167 'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
168 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m',
169 'C','e','r','t','i','f','i','c','a','t','e','s','\\',
170 'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r','\\',
171 'S','a','f','e','r',0 };
172 HKEY key;
173 LONG rc;
174 BOOL ret = FALSE;
176 TRACE("(%s, %p)\n", debugstr_w(name), value);
178 *value = 0;
179 rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, safer, &key);
180 if (rc == ERROR_SUCCESS)
182 DWORD size = sizeof(DWORD);
184 if (!RegQueryValueExW(key, name, NULL, NULL, (LPBYTE)value, &size))
185 ret = TRUE;
186 RegCloseKey(key);
188 return ret;
191 int WINAPI I_CryptInstallOssGlobal(DWORD x, DWORD y, DWORD z)
193 static int ret = 8;
194 ret++;
195 FIXME("%08x %08x %08x, return value %d\n", x, y, z,ret);
196 return ret;
199 BOOL WINAPI I_CryptInstallAsn1Module(void *x, DWORD y, DWORD z)
201 FIXME("%p %08x %08x\n", x, y, z);
202 return TRUE;
205 BOOL WINAPI I_CryptUninstallAsn1Module(void *x)
207 FIXME("%p\n", x);
208 return TRUE;
211 BOOL WINAPI CryptFormatObject(DWORD dwCertEncodingType, DWORD dwFormatType,
212 DWORD dwFormatStrType, void *pFormatStruct, LPCSTR lpszStructType,
213 const BYTE *pbEncoded, DWORD cbEncoded, void *pbFormat, DWORD *pcbFormat)
215 FIXME("(%08x, %d, %d, %p, %s, %p, %d, %p, %p): stub\n",
216 dwCertEncodingType, dwFormatType, dwFormatStrType, pFormatStruct,
217 debugstr_a(lpszStructType), pbEncoded, cbEncoded, pbFormat, pcbFormat);
218 return FALSE;
221 BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void* pvObject,
222 DWORD dwExpectedContentTypeFlags, DWORD dwExpectedFormatTypeFlags,
223 DWORD dwFlags, DWORD* pdwMsgAndCertEncodingType, DWORD* pdwContentType,
224 DWORD* pdwFormatType, HCERTSTORE* phCertStore, HCRYPTMSG* phMsg,
225 const void** ppvContext)
227 FIXME( "%08x %p %08x %08x %08x %p %p %p %p %p %p\n", dwObjectType,
228 pvObject, dwExpectedContentTypeFlags, dwExpectedFormatTypeFlags,
229 dwFlags, pdwMsgAndCertEncodingType, pdwContentType, pdwFormatType,
230 phCertStore, phMsg, ppvContext);
231 return FALSE;
234 BOOL WINAPI CryptVerifyMessageSignature(PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
235 DWORD dwSignerIndex, const BYTE* pbSignedBlob, DWORD cbSignedBlob,
236 BYTE* pbDecoded, DWORD* pcbDecoded, PCCERT_CONTEXT* ppSignerCert)
238 FIXME("stub: %p, %d, %p, %d, %p, %p, %p\n",
239 pVerifyPara, dwSignerIndex, pbSignedBlob, cbSignedBlob,
240 pbDecoded, pcbDecoded, ppSignerCert);
241 if (ppSignerCert)
242 *ppSignerCert = NULL;
243 return FALSE;