Get rid of a magic number, and improve stubs of

CertOpenSystemStoreA/W.
This commit is contained in:
Juan Lang 2005-06-03 11:25:38 +00:00 committed by Alexandre Julliard
parent 5af64e4869
commit 5b3499de68

View File

@ -1,6 +1,6 @@
/* /*
* Copyright 2002 Mike McCormack for CodeWeavers * Copyright 2002 Mike McCormack for CodeWeavers
* Copyright (C) 2004 Juan Lang * Copyright 2004,2005 Juan Lang
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -54,10 +54,14 @@ HCERTSTORE WINAPI CertOpenStore( LPCSTR lpszStoreProvider,
FIXME("%s %08lx %08lx %08lx %p stub\n", debugstr_a(lpszStoreProvider), FIXME("%s %08lx %08lx %08lx %p stub\n", debugstr_a(lpszStoreProvider),
dwMsgAndCertEncodingType, hCryptProv, dwFlags, pvPara); dwMsgAndCertEncodingType, hCryptProv, dwFlags, pvPara);
if( lpszStoreProvider == (LPCSTR) 0x0009 ) if( lpszStoreProvider == CERT_STORE_PROV_SYSTEM_A )
{ {
FIXME("pvPara = %s\n", debugstr_a( (LPCSTR) pvPara ) ); FIXME("pvPara = %s\n", debugstr_a( (LPCSTR) pvPara ) );
} }
else if ( lpszStoreProvider == CERT_STORE_PROV_SYSTEM_W )
{
FIXME("pvPara = %s\n", debugstr_w( (LPCWSTR) pvPara ) );
}
hcs = HeapAlloc( GetProcessHeap(), 0, sizeof (WINECRYPT_CERTSTORE) ); hcs = HeapAlloc( GetProcessHeap(), 0, sizeof (WINECRYPT_CERTSTORE) );
if( !hcs ) if( !hcs )
@ -71,15 +75,17 @@ HCERTSTORE WINAPI CertOpenStore( LPCSTR lpszStoreProvider,
HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV hProv, HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV hProv,
LPCSTR szSubSystemProtocol) LPCSTR szSubSystemProtocol)
{ {
FIXME("(%ld, %s), stub\n", hProv, debugstr_a(szSubSystemProtocol)); return CertOpenStore( CERT_STORE_PROV_SYSTEM_A, 0, 0,
return (HCERTSTORE)1; CERT_SYSTEM_STORE_CURRENT_USER | CERT_SYSTEM_STORE_LOCAL_MACHINE |
CERT_SYSTEM_STORE_USERS, szSubSystemProtocol );
} }
HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV hProv, HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV hProv,
LPCWSTR szSubSystemProtocol) LPCWSTR szSubSystemProtocol)
{ {
FIXME("(%ld, %s), stub\n", hProv, debugstr_w(szSubSystemProtocol)); return CertOpenStore( CERT_STORE_PROV_SYSTEM_W, 0, 0,
return (HCERTSTORE)1; CERT_SYSTEM_STORE_CURRENT_USER | CERT_SYSTEM_STORE_LOCAL_MACHINE |
CERT_SYSTEM_STORE_USERS, szSubSystemProtocol );
} }
PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev) PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev)
@ -142,10 +148,16 @@ BOOL WINAPI CertFreeCRLContext( PCCRL_CONTEXT pCrlContext)
BOOL WINAPI CertCloseStore( HCERTSTORE hCertStore, DWORD dwFlags ) BOOL WINAPI CertCloseStore( HCERTSTORE hCertStore, DWORD dwFlags )
{ {
WINECRYPT_CERTSTORE *hcs = (WINECRYPT_CERTSTORE *) hCertStore;
FIXME("%p %08lx\n", hCertStore, dwFlags ); FIXME("%p %08lx\n", hCertStore, dwFlags );
if( ! hCertStore ) if( ! hCertStore )
return FALSE; return FALSE;
if ( hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC )
return FALSE;
hcs->dwMagic = 0;
HeapFree( GetProcessHeap(), 0, hCertStore ); HeapFree( GetProcessHeap(), 0, hCertStore );
return TRUE; return TRUE;