crypt32: Add a couple stubs, and implement the undocumented I_CryptReadTrustedPublisherDWORDValueFromRegistry.

This commit is contained in:
Juan Lang 2006-08-09 14:45:34 -07:00 committed by Alexandre Julliard
parent 2628627e79
commit 759850feff
3 changed files with 94 additions and 1 deletions

View File

@ -186,15 +186,17 @@
@ stdcall I_CryptFlushLruCache(ptr long long)
@ stdcall I_CryptFreeLruCache(ptr long long)
@ stdcall I_CryptFreeTls(long long)
@ stub I_CryptGetDefaultCryptProv
@ stdcall I_CryptGetDefaultCryptProv(long long long)
@ stub I_CryptGetDefaultCryptProvForEncrypt
@ stdcall I_CryptGetOssGlobal(long)
@ stdcall I_CryptGetTls(long)
@ stub I_CryptInsertLruEntry
@ stdcall I_CryptInstallAsn1Module(long long long)
@ stdcall I_CryptInstallOssGlobal(long long long)
@ stdcall I_CryptReadTrustedPublisherDWORDValueFromRegistry(wstr ptr)
@ stub I_CryptReleaseLruEntry
@ stdcall I_CryptSetTls(long ptr)
@ stdcall I_CryptUninstallAsn1Module(ptr)
@ stub I_CryptUninstallOssGlobal
@ stub PFXExportCertStore
@ stub PFXImportCertStore

View File

@ -27,6 +27,8 @@
#include "winreg.h"
#include "winnls.h"
#include "mssip.h"
#include "winuser.h"
#include "advpub.h"
#include "crypt32_private.h"
#include "wine/debug.h"
@ -269,6 +271,39 @@ BOOL WINAPI I_CryptGetOssGlobal(DWORD x)
return FALSE;
}
BOOL WINAPI I_CryptGetDefaultCryptProv(DWORD x, DWORD y, DWORD z)
{
FIXME("%08lx %08lx %08lx\n", x, y, z);
return FALSE;
}
BOOL WINAPI I_CryptReadTrustedPublisherDWORDValueFromRegistry(LPCWSTR name,
DWORD *value)
{
static const WCHAR safer[] = {
'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m',
'C','e','r','t','i','f','i','c','a','t','e','s','\\',
'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r','\\',
'S','a','f','e','r',0 };
HKEY key;
LONG rc;
BOOL ret = FALSE;
TRACE("(%s, %p)\n", debugstr_w(name), value);
rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, safer, &key);
if (rc == ERROR_SUCCESS)
{
DWORD size = sizeof(DWORD);
if (!RegQueryValueExW(key, name, NULL, NULL, (LPBYTE)value, &size))
ret = TRUE;
RegCloseKey(key);
}
return ret;
}
BOOL WINAPI I_CryptInstallOssGlobal(DWORD x, DWORD y, DWORD z)
{
FIXME("%08lx %08lx %08lx\n", x, y, z);
@ -281,6 +316,12 @@ BOOL WINAPI I_CryptInstallAsn1Module(void *x, DWORD y, DWORD z)
return TRUE;
}
BOOL WINAPI I_CryptUninstallAsn1Module(void *x)
{
FIXME("%p\n", x);
return TRUE;
}
BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void* pvObject,
DWORD dwExpectedContentTypeFlags, DWORD dwExpectedFormatTypeFlags,
DWORD dwFlags, DWORD* pdwMsgAndCertEncodingType, DWORD* pdwContentType,

View File

@ -24,6 +24,7 @@
#include <winbase.h>
#include <winerror.h>
#include <wincrypt.h>
#include <winreg.h>
#include "wine/test.h"
@ -272,6 +273,54 @@ static void test_cryptTls(void)
}
}
typedef BOOL (WINAPI *I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc)
(LPCWSTR, DWORD *);
static void test_readTrustedPublisherDWORD(void)
{
HMODULE lib = LoadLibraryA("crypt32.dll");
if (lib)
{
I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc pReadDWORD =
(I_CryptReadTrustedPublisherDWORDValueFromRegistryFunc)GetProcAddress(
lib, "I_CryptReadTrustedPublisherDWORDValueFromRegistry");
if (pReadDWORD)
{
static const WCHAR safer[] = {
'S','o','f','t','w','a','r','e','\\',
'P','o','l','i','c','i','e','s','\\',
'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m',
'C','e','r','t','i','f','i','c','a','t','e','s','\\',
'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r',
'\\','S','a','f','e','r',0 };
static const WCHAR authenticodeFlags[] = { 'A','u','t','h','e','n',
't','i','c','o','d','e','F','l','a','g','s',0 };
BOOL ret, exists = FALSE;
DWORD size, readFlags, returnedFlags;
HKEY key;
LONG rc;
rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, safer, &key);
if (rc == ERROR_SUCCESS)
{
size = sizeof(readFlags);
rc = RegQueryValueExW(key, authenticodeFlags, NULL, NULL,
(LPBYTE)&readFlags, &size);
if (rc == ERROR_SUCCESS)
exists = TRUE;
}
ret = pReadDWORD(authenticodeFlags, &returnedFlags);
ok(ret == exists, "Unexpected return value\n");
if (exists)
ok(readFlags == returnedFlags,
"Expected flags %08lx, got %08lx\n", readFlags, returnedFlags);
}
FreeLibrary(lib);
}
}
START_TEST(main)
{
test_findAttribute();
@ -280,4 +329,5 @@ START_TEST(main)
test_verifyTimeValidity();
test_cryptAllocate();
test_cryptTls();
test_readTrustedPublisherDWORD();
}