Commit 759850fe authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Add a couple stubs, and implement the undocumented…

crypt32: Add a couple stubs, and implement the undocumented I_CryptReadTrustedPublisherDWORDValueFromRegistry.
parent 2628627e
......@@ -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
......
......@@ -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,
......
......@@ -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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment