Commit 07a627b1 authored by Alexandre Julliard's avatar Alexandre Julliard

rsaenh: Convert dll registration to the IRegistrar mechanism.

parent c0be1ec8
...@@ -16,6 +16,6 @@ C_SRCS = \ ...@@ -16,6 +16,6 @@ C_SRCS = \
rsaenh.c \ rsaenh.c \
sha2.c sha2.c
RC_SRCS = version.rc RC_SRCS = rsrc.rc
@MAKE_DLL_RULES@ @MAKE_DLL_RULES@
...@@ -37,9 +37,12 @@ ...@@ -37,9 +37,12 @@
#include "handle.h" #include "handle.h"
#include "implglue.h" #include "implglue.h"
#include "objbase.h" #include "objbase.h"
#include "rpcproxy.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt); WINE_DEFAULT_DEBUG_CHANNEL(crypt);
static HINSTANCE instance;
/****************************************************************************** /******************************************************************************
* CRYPTHASH - hash objects * CRYPTHASH - hash objects
*/ */
...@@ -358,6 +361,7 @@ int WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved) ...@@ -358,6 +361,7 @@ int WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
switch (fdwReason) switch (fdwReason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
instance = hInstance;
DisableThreadLibraryCalls(hInstance); DisableThreadLibraryCalls(hInstance);
init_handle_table(&handle_table); init_handle_table(&handle_table);
break; break;
...@@ -4440,133 +4444,16 @@ static const WCHAR szDefaultKeys[3][65] = { ...@@ -4440,133 +4444,16 @@ static const WCHAR szDefaultKeys[3][65] = {
/****************************************************************************** /******************************************************************************
* DllRegisterServer (RSAENH.@) * DllRegisterServer (RSAENH.@)
*
* Dll self registration.
*
* PARAMS
*
* RETURNS
* Success: S_OK.
* Failure: != S_OK
*
* NOTES
* Registers the following keys:
* - HKLM\Software\Microsoft\Cryptography\Defaults\Provider\
* Microsoft Base Cryptographic Provider v1.0
* - HKLM\Software\Microsoft\Cryptography\Defaults\Provider\
* Microsoft Enhanced Cryptographic Provider
* - HKLM\Software\Microsoft\Cryptography\Defaults\Provider\
* Microsoft Strong Cryptographpic Provider
* - HKLM\Software\Microsoft\Cryptography\Defaults\Provider Types\Type 001
*/ */
HRESULT WINAPI DllRegisterServer(void) HRESULT WINAPI DllRegisterServer(void)
{ {
HKEY key; return __wine_register_resources( instance, NULL );
DWORD dp;
long apiRet;
int i;
for (i=0; i<6; i++) {
apiRet = RegCreateKeyExW(HKEY_LOCAL_MACHINE, szProviderKeys[i], 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, &dp);
if (apiRet == ERROR_SUCCESS)
{
if (dp == REG_CREATED_NEW_KEY)
{
static const WCHAR szImagePath[] = { 'I','m','a','g','e',' ','P','a','t','h',0 };
static const WCHAR szRSABase[] = { 'r','s','a','e','n','h','.','d','l','l',0 };
static const WCHAR szType[] = { 'T','y','p','e',0 };
static const WCHAR szSignature[] = { 'S','i','g','n','a','t','u','r','e',0 };
DWORD type, sign;
switch(i)
{
case 3:
type=PROV_RSA_SCHANNEL;
break;
case 4:
case 5:
type=PROV_RSA_AES;
break;
default:
type=PROV_RSA_FULL;
break;
}
sign = 0xdeadbeef;
RegSetValueExW(key, szImagePath, 0, REG_SZ, (const BYTE *)szRSABase,
(lstrlenW(szRSABase) + 1) * sizeof(WCHAR));
RegSetValueExW(key, szType, 0, REG_DWORD, (LPBYTE)&type, sizeof(type));
RegSetValueExW(key, szSignature, 0, REG_BINARY, (LPBYTE)&sign, sizeof(sign));
}
RegCloseKey(key);
}
}
for (i=0; i<3; i++) {
apiRet = RegCreateKeyExW(HKEY_LOCAL_MACHINE, szDefaultKeys[i], 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, &dp);
if (apiRet == ERROR_SUCCESS)
{
if (dp == REG_CREATED_NEW_KEY)
{
static const WCHAR szName[] = { 'N','a','m','e',0 };
static const WCHAR szRSAName[3][54] = {
{ 'M','i','c','r','o','s','o','f','t',' ',
'E','n','h','a','n','c','e','d',' ',
'C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 },
{ 'M','i','c','r','o','s','o','f','t',' ','R','S','A',' ',
'S','C','h','a','n','n','e','l',' ',
'C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
'P','r','o','v','i','d','e','r',0 },
{ 'M','i','c','r','o','s','o','f','t',' ','E','n','h','a','n','c','e','d',' ',
'R','S','A',' ','a','n','d',' ','A','E','S',' ',
'C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
'P','r','o','v','i','d','e','r',0 } };
static const WCHAR szTypeName[] = { 'T','y','p','e','N','a','m','e',0 };
static const WCHAR szRSATypeName[3][38] = {
{ 'R','S','A',' ','F','u','l','l',' ',
'(','S','i','g','n','a','t','u','r','e',' ','a','n','d',' ',
'K','e','y',' ','E','x','c','h','a','n','g','e',')',0 },
{ 'R','S','A',' ','S','C','h','a','n','n','e','l',0 },
{ 'R','S','A',' ','F','u','l','l',' ','a','n','d',' ','A','E','S',0 } };
RegSetValueExW(key, szName, 0, REG_SZ,
(const BYTE *)szRSAName[i], lstrlenW(szRSAName[i])*sizeof(WCHAR)+sizeof(WCHAR));
RegSetValueExW(key, szTypeName, 0, REG_SZ,
(const BYTE *)szRSATypeName[i], lstrlenW(szRSATypeName[i])*sizeof(WCHAR)+sizeof(WCHAR));
}
}
RegCloseKey(key);
}
return HRESULT_FROM_WIN32(apiRet);
} }
/****************************************************************************** /******************************************************************************
* DllUnregisterServer (RSAENH.@) * DllUnregisterServer (RSAENH.@)
*
* Dll self unregistration.
*
* PARAMS
*
* RETURNS
* Success: S_OK
*
* NOTES
* For the relevant keys see DllRegisterServer.
*/ */
HRESULT WINAPI DllUnregisterServer(void) HRESULT WINAPI DllUnregisterServer(void)
{ {
RegDeleteKeyW(HKEY_LOCAL_MACHINE, szProviderKeys[0]); return __wine_unregister_resources( instance, NULL );
RegDeleteKeyW(HKEY_LOCAL_MACHINE, szProviderKeys[1]);
RegDeleteKeyW(HKEY_LOCAL_MACHINE, szProviderKeys[2]);
RegDeleteKeyW(HKEY_LOCAL_MACHINE, szProviderKeys[3]);
RegDeleteKeyW(HKEY_LOCAL_MACHINE, szProviderKeys[4]);
RegDeleteKeyW(HKEY_LOCAL_MACHINE, szProviderKeys[5]);
RegDeleteKeyW(HKEY_LOCAL_MACHINE, szDefaultKeys[0]);
RegDeleteKeyW(HKEY_LOCAL_MACHINE, szDefaultKeys[1]);
RegDeleteKeyW(HKEY_LOCAL_MACHINE, szDefaultKeys[2]);
return S_OK;
} }
HKLM
{
NoRemove Software
{
NoRemove Microsoft
{
NoRemove Cryptography
{
NoRemove Defaults
{
NoRemove Provider
{
ForceRemove 'Microsoft Base Cryptographic Provider v1.0'
{
val 'Image Path' = s '%MODULE%'
val 'Signature' = b deadbeef
val 'Type' = d 1
}
ForceRemove 'Microsoft Enhanced Cryptographic Provider v1.0'
{
val 'Image Path' = s '%MODULE%'
val 'Signature' = b deadbeef
val 'Type' = d 1
}
ForceRemove 'Microsoft Enhanced RSA and AES Cryptographic Provider'
{
val 'Image Path' = s '%MODULE%'
val 'Signature' = b deadbeef
val 'Type' = d 24
}
ForceRemove 'Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)'
{
val 'Image Path' = s '%MODULE%'
val 'Signature' = b deadbeef
val 'Type' = d 24
}
ForceRemove 'Microsoft RSA SChannel Cryptographic Provider'
{
val 'Image Path' = s '%MODULE%'
val 'Signature' = b deadbeef
val 'Type' = d 12
}
ForceRemove 'Microsoft Strong Cryptographic Provider'
{
val 'Image Path' = s '%MODULE%'
val 'Signature' = b deadbeef
val 'Type' = d 1
}
}
NoRemove 'Provider Types'
{
ForceRemove 'Type 001'
{
val 'Name' = s 'Microsoft Enhanced Cryptographic Provider v1.0'
val 'TypeName' = s 'RSA Full (Signature and Key Exchange)'
}
ForceRemove 'Type 012'
{
val 'Name' = s 'Microsoft RSA SChannel Cryptographic Provider'
val 'TypeName' = s 'RSA SChannel'
}
ForceRemove 'Type 024'
{
val 'Name' = s 'Microsoft Enhanced RSA and AES Cryptographic Provider'
val 'TypeName' = s 'RSA Full and AES'
}
}
}
}
}
}
}
/* /*
* Resources for rsaenh
*
* Copyright (c) 2007 Alexandre Julliard * Copyright (c) 2007 Alexandre Julliard
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -16,6 +18,9 @@ ...@@ -16,6 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/* @makedep: rsaenh.rgs */
1 WINE_REGISTRY rsaenh.rgs
#define WINE_FILEDESCRIPTION_STR "Wine rsaenh" #define WINE_FILEDESCRIPTION_STR "Wine rsaenh"
#define WINE_FILENAME_STR "rsaenh.dll" #define WINE_FILENAME_STR "rsaenh.dll"
#define WINE_FILEVERSION 5,1,2600,2180 #define WINE_FILEVERSION 5,1,2600,2180
......
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