2 * Copyright 2002 Mike McCormack for CodeWeavers
3 * Copyright 2004,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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(crypt);
28 #define WINE_CRYPTCERTSTORE_MAGIC 0x74726563
30 typedef struct WINE_CRYPTCERTSTORE
33 } WINECRYPT_CERTSTORE;
40 * HKLM\\Software\\Microsoft\\SystemCertificates\\CA\\
41 * Certificates\\<compressed guid>
43 * CRLs\\<compressed guid>
45 * CTLs\\<compressed guid>
48 HCERTSTORE WINAPI CertOpenStore( LPCSTR lpszStoreProvider,
49 DWORD dwMsgAndCertEncodingType, HCRYPTPROV hCryptProv,
50 DWORD dwFlags, const void* pvPara )
52 WINECRYPT_CERTSTORE *hcs;
54 FIXME("%s %08lx %08lx %08lx %p stub\n", debugstr_a(lpszStoreProvider),
55 dwMsgAndCertEncodingType, hCryptProv, dwFlags, pvPara);
57 if( lpszStoreProvider == CERT_STORE_PROV_SYSTEM_A )
59 FIXME("pvPara = %s\n", debugstr_a( (LPCSTR) pvPara ) );
61 else if ( lpszStoreProvider == CERT_STORE_PROV_SYSTEM_W )
63 FIXME("pvPara = %s\n", debugstr_w( (LPCWSTR) pvPara ) );
66 hcs = HeapAlloc( GetProcessHeap(), 0, sizeof (WINECRYPT_CERTSTORE) );
70 hcs->dwMagic = WINE_CRYPTCERTSTORE_MAGIC;
72 return (HCERTSTORE) hcs;
75 HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV hProv,
76 LPCSTR szSubSystemProtocol)
78 return CertOpenStore( CERT_STORE_PROV_SYSTEM_A, 0, 0,
79 CERT_SYSTEM_STORE_CURRENT_USER | CERT_SYSTEM_STORE_LOCAL_MACHINE |
80 CERT_SYSTEM_STORE_USERS, szSubSystemProtocol );
83 HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV hProv,
84 LPCWSTR szSubSystemProtocol)
86 return CertOpenStore( CERT_STORE_PROV_SYSTEM_W, 0, 0,
87 CERT_SYSTEM_STORE_CURRENT_USER | CERT_SYSTEM_STORE_LOCAL_MACHINE |
88 CERT_SYSTEM_STORE_USERS, szSubSystemProtocol );
91 PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev)
93 FIXME("(%p,%p)\n", hCertStore, pPrev);
97 BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType,
98 DWORD dwSaveAs, DWORD dwSaveTo, void* pvSaveToPara, DWORD dwFlags)
100 FIXME("(%p,%ld,%ld,%ld,%p,%08lx) stub!\n", hCertStore,
101 dwMsgAndCertEncodingType, dwSaveAs, dwSaveTo, pvSaveToPara, dwFlags);
105 PCCRL_CONTEXT WINAPI CertCreateCRLContext( DWORD dwCertEncodingType,
106 const BYTE* pbCrlEncoded, DWORD cbCrlEncoded)
111 TRACE("%08lx %p %08lx\n", dwCertEncodingType, pbCrlEncoded, cbCrlEncoded);
113 pcrl = HeapAlloc( GetProcessHeap(), 0, sizeof (CRL_CONTEXT) );
117 data = HeapAlloc( GetProcessHeap(), 0, cbCrlEncoded );
120 HeapFree( GetProcessHeap(), 0, pcrl );
124 pcrl->dwCertEncodingType = dwCertEncodingType;
125 pcrl->pbCrlEncoded = data;
126 pcrl->cbCrlEncoded = cbCrlEncoded;
127 pcrl->pCrlInfo = NULL;
128 pcrl->hCertStore = 0;
133 BOOL WINAPI CertAddCRLContextToStore( HCERTSTORE hCertStore,
134 PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition,
135 PCCRL_CONTEXT* ppStoreContext )
137 FIXME("%p %p %08lx %p\n", hCertStore, pCrlContext,
138 dwAddDisposition, ppStoreContext);
142 BOOL WINAPI CertFreeCRLContext( PCCRL_CONTEXT pCrlContext)
144 FIXME("%p\n", pCrlContext );
149 BOOL WINAPI CertCloseStore( HCERTSTORE hCertStore, DWORD dwFlags )
151 WINECRYPT_CERTSTORE *hcs = (WINECRYPT_CERTSTORE *) hCertStore;
153 FIXME("%p %08lx\n", hCertStore, dwFlags );
157 if ( hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC )
161 HeapFree( GetProcessHeap(), 0, hCertStore );
166 BOOL WINAPI CertFreeCertificateContext( PCCERT_CONTEXT pCertContext )
168 FIXME("%p stub\n", pCertContext);
172 PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE hCertStore,
173 DWORD dwCertEncodingType, DWORD dwFlags, DWORD dwType,
174 const void *pvPara, PCCERT_CONTEXT pPrevCertContext)
176 FIXME("stub: %p %ld %ld %ld %p %p\n", hCertStore, dwCertEncodingType,
177 dwFlags, dwType, pvPara, pPrevCertContext);
178 SetLastError(CRYPT_E_NOT_FOUND);