From 1795994d53b0d60488a16fde38bd748abba76493 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 1 Mar 2004 21:19:37 +0000 Subject: [PATCH] - correct some prototypes, add some defines - stub a couple more functions --- dlls/crypt32/Makefile.in | 2 +- dlls/crypt32/cert.c | 80 +++++++++++++++++++++++++++++++++++++++ dlls/crypt32/crypt32.spec | 6 +-- dlls/crypt32/main.c | 43 --------------------- include/wincrypt.h | 71 +++++++++++++++++++++++++++++----- 5 files changed, 145 insertions(+), 57 deletions(-) create mode 100644 dlls/crypt32/cert.c diff --git a/dlls/crypt32/Makefile.in b/dlls/crypt32/Makefile.in index 25f0b950414..6ad0b326f99 100644 --- a/dlls/crypt32/Makefile.in +++ b/dlls/crypt32/Makefile.in @@ -7,9 +7,9 @@ MODULE = crypt32.dll IMPORTS = advapi32 kernel32 C_SRCS = \ + cert.c \ main.c @MAKE_DLL_RULES@ ### Dependencies: - diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c new file mode 100644 index 00000000000..89a65881370 --- /dev/null +++ b/dlls/crypt32/cert.c @@ -0,0 +1,80 @@ +/* + * Copyright 2002 Mike McCormack for CodeWeavers + * Copyright (C) 2004 Juan Lang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "wincrypt.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(crypt); + +HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwEncodingType, + HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara) +{ + FIXME("(%s, %ld, %ld, %ld, %p), stub.\n", debugstr_a(lpszStoreProvider), dwEncodingType, hCryptProv, dwFlags, pvPara); + return (HCERTSTORE)1; +} + +HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV hProv, + LPCSTR szSubSystemProtocol) +{ + FIXME("(%ld, %s), stub\n", hProv, debugstr_a(szSubSystemProtocol)); + return (HCERTSTORE)1; +} + +HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV hProv, + LPCWSTR szSubSystemProtocol) +{ + FIXME("(%ld, %s), stub\n", hProv, debugstr_w(szSubSystemProtocol)); + return (HCERTSTORE)1; +} + +PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev) +{ + FIXME("(%p,%p)\n", hCertStore, pPrev); + return NULL; +} + +BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType, + DWORD dwSaveAs, DWORD dwSaveTo, void* pvSaveToPara, DWORD dwFlags) +{ + FIXME("(%p,%ld,%ld,%ld,%p,%08lx) stub!\n", hCertStore, + dwMsgAndCertEncodingType, dwSaveAs, dwSaveTo, pvSaveToPara, dwFlags); + return TRUE; +} + +PCCRL_CONTEXT WINAPI CertCreateCRLContext( DWORD dwCertEncodingType, + const BYTE* pbCrlEncoded, DWORD cbCrlEncoded) +{ + FIXME("%08lx %p %08lx\n", dwCertEncodingType, pbCrlEncoded, cbCrlEncoded); + return NULL; +} + +BOOL WINAPI CertCloseStore( HCERTSTORE hCertStore, DWORD dwFlags ) +{ + FIXME("%p %08lx\n", hCertStore, dwFlags ); + return TRUE; +} + +BOOL WINAPI CertFreeCertificateContext( PCCERT_CONTEXT pCertContext ) +{ + FIXME("%p stub\n", pCertContext); + return TRUE; +} diff --git a/dlls/crypt32/crypt32.spec b/dlls/crypt32/crypt32.spec index edae755d434..1ede7affccd 100644 --- a/dlls/crypt32/crypt32.spec +++ b/dlls/crypt32/crypt32.spec @@ -57,9 +57,9 @@ @ stub CertNameToStrA @ stub CertNameToStrW @ stub CertOIDToAlgId -@ stdcall CertOpenStore(long long long long long) -@ stub CertOpenSystemStoreA -@ stub CertOpenSystemStoreW +@ stdcall CertOpenStore(str long long long ptr) +@ stdcall CertOpenSystemStoreA(long str) +@ stdcall CertOpenSystemStoreW(long wstr) @ stub CertRDNValueToStrA @ stub CertRDNValueToStrW @ stub CertRemoveEnhancedKeyUsageIdentifier diff --git a/dlls/crypt32/main.c b/dlls/crypt32/main.c index 0488ba19c98..98684accfc4 100644 --- a/dlls/crypt32/main.c +++ b/dlls/crypt32/main.c @@ -64,16 +64,6 @@ BOOL WINAPI CryptProtectData(DATA_BLOB* pDataIn, LPCWSTR szDataDescr, DATA_BLOB* return FALSE; } -/* - * (0x1001350, %eax, 0, 0, 9); - * - */ -BOOL WINAPI CertOpenStore(LPSTR dw1, DWORD dw2, DWORD dw3, DWORD dw4, DWORD dw5) -{ - FIXME("(%s, %ld, %ld, %ld, %ld), stub.\n", debugstr_a(dw1), dw2, dw3, dw4, dw5); - return TRUE; -} - BOOL WINAPI CryptSIPRemoveProvider(GUID *pgProv) { FIXME("stub!\n"); @@ -266,36 +256,3 @@ BOOL WINAPI CryptRegisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, return TRUE; } - -PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev) -{ - FIXME("(%p,%p)\n", hCertStore, pPrev); - return NULL; -} - -BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType, - DWORD dwSaveAs, DWORD dwSaveTo, void* pvSaveToPara, DWORD dwFlags) -{ - FIXME("(%p,%ld,%ld,%ld,%p,%08lx) stub!\n", hCertStore, - dwMsgAndCertEncodingType, dwSaveAs, dwSaveTo, pvSaveToPara, dwFlags); - return TRUE; -} - -PCCRL_CONTEXT WINAPI CertCreateCRLContext( DWORD dwCertEncodingType, - const BYTE* pbCrlEncoded, DWORD cbCrlEncoded) -{ - FIXME("%08lx %p %08lx\n", dwCertEncodingType, pbCrlEncoded, cbCrlEncoded); - return NULL; -} - -BOOL WINAPI CertCloseStore( HCERTSTORE hCertStore, DWORD dwFlags ) -{ - FIXME("%p %08lx\n", hCertStore, dwFlags ); - return TRUE; -} - -BOOL WINAPI CertFreeCertificateContext( PCCERT_CONTEXT pCertContext ) -{ - FIXME("%p stub\n", pCertContext); - return TRUE; -} diff --git a/include/wincrypt.h b/include/wincrypt.h index 710ed165b0b..7c9906d5d64 100644 --- a/include/wincrypt.h +++ b/include/wincrypt.h @@ -483,16 +483,45 @@ static const WCHAR MS_SCARD_PROV_W[] = { 'M','i','c','r','o','s','o',' #define PUBLICKEYBLOBEX 0xA #define SYMMETRICWRAPKEYBLOB 0xB -#define CERT_STORE_PROV_MSG ((LPCSTR)1) -#define CERT_STORE_PROV_MEMORY ((LPCSTR)2) -#define CERT_STORE_PROV_FILE ((LPCSTR)3) -#define CERT_STORE_PROV_REG ((LPCSTR)4) -#define CERT_STORE_PROV_PKCS7 ((LPCSTR)5) -#define CERT_STORE_PROV_SERIALIZED ((LPCSTR)6) -#define CERT_STORE_PROV_FILENAME_A ((LPCSTR)7) -#define CERT_STORE_PROV_FILENAME_W ((LPCSTR)8) -#define CERT_STORE_PROV_SYSTEM_A ((LPCSTR)9) -#define CERT_STORE_PROV_SYSTEM_W ((LPCSTR)10) +/* cert store provider types */ +#define CERT_STORE_PROV_MSG ((LPCSTR)1) +#define CERT_STORE_PROV_MEMORY ((LPCSTR)2) +#define CERT_STORE_PROV_FILE ((LPCSTR)3) +#define CERT_STORE_PROV_REG ((LPCSTR)4) +#define CERT_STORE_PROV_PKCS7 ((LPCSTR)5) +#define CERT_STORE_PROV_SERIALIZED ((LPCSTR)6) +#define CERT_STORE_PROV_FILENAME_A ((LPCSTR)7) +#define CERT_STORE_PROV_FILENAME_W ((LPCSTR)8) +#define CERT_STORE_PROV_SYSTEM_A ((LPCSTR)9) +#define CERT_STORE_PROV_SYSTEM_W ((LPCSTR)10) +#define CERT_STORE_PROV_SYSTEM CERT_STORE_PROV_SYSTEM_W +#define CERT_STORE_PROV_COLLECTION ((LPCSTR)11) +#define CERT_STORE_PROV_SYSTEM_REGISTRY_A ((LPCSTR)12) +#define CERT_STORE_PROV_SYSTEM_REGISTRY_W ((LPCSTR)13) +#define CERT_STORE_PROV_SYSTEM_REGISTRY CERT_STORE_PROV_SYSTEM_REGISTRY_W +#define CERT_STORE_PROV_PHYSICAL_W ((LPCSTR)14) +#define CERT_STORE_PROV_PHYSICAL CERT_STORE_PROV_PHYSICAL_W +#define CERT_STORE_PROV_SMART_CARD_W ((LPCSTR)15) +#define CERT_STORE_PROV_SMART_CARD CERT_STORE_PROV_SMART_CARD_W +#define CERT_STORE_PROV_LDAP_W ((LPCSTR)16) +#define CERT_STORE_PROV_LDAP CERT_STORE_PROV_LDAP_W + +#define sz_CERT_STORE_PROV_MEMORY "Memory" +#define sz_CERT_STORE_PROV_FILENAME_W "File" +#define sz_CERT_STORE_PROV_FILENAME sz_CERT_STORE_PROV_FILENAME_W +#define sz_CERT_STORE_PROV_SYSTEM_W "System" +#define sz_CERT_STORE_PROV_SYSTEM sz_CERT_STORE_PROV_SYSTEM_W +#define sz_CERT_STORE_PROV_PKCS7 "PKCS7" +#define sz_CERT_STORE_PROV_SERIALIZED "Serialized" +#define sz_CERT_STORE_PROV_COLLECTION "Collection" +#define sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W "SystemRegistry" +#define sz_CERT_STORE_PROV_SYSTEM_REGISTRY sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W +#define sz_CERT_STORE_PROV_PHYSICAL_W "Physical" +#define sz_CERT_STORE_PROV_PHYSICAL sz_CERT_STORE_PROV_PHYSICAL_W +#define sz_CERT_STORE_PROV_SMART_CARD_W "SmartCard" +#define sz_CERT_STORE_PROV_SMART_CARD sz_CERT_STORE_PROV_SMART_CARD_W +#define sz_CERT_STORE_PROV_LDAP_W "Ldap" +#define sz_CERT_STORE_PROV_LDAP sz_CERT_STORE_PROV_LDAP_W #define X509_ASN_ENCODING 0x00000001 #define X509_NDR_ENCODING 0x00000002 @@ -574,6 +603,28 @@ BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dw HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags); #define CryptVerifySignature WINELIB_NAME_AW(CryptVerifySignature) +/* cert store functions */ +HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwEncodingType, + HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara); + +HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV hProv, + LPCSTR szSubSystemProtocol); +HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV hProv, + LPCWSTR szSubSystemProtocol); +#define CertOpenSystemStore WINELIB_NAME_AW(CertOpenSystemStore) + +PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev); + +BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType, + DWORD dwSaveAs, DWORD dwSaveTo, void* pvSaveToPara, DWORD dwFlags); + +PCCRL_CONTEXT WINAPI CertCreateCRLContext( DWORD dwCertEncodingType, + const BYTE* pbCrlEncoded, DWORD cbCrlEncoded); + +BOOL WINAPI CertCloseStore( HCERTSTORE hCertStore, DWORD dwFlags ); + +BOOL WINAPI CertFreeCertificateContext( PCCERT_CONTEXT pCertContext ); + #ifdef __cplusplus } #endif