wine-staging/patches/wineboot-MachineGuid/0001-wineboot-Create-MachineGuid-registry-value.patch
2015-06-11 19:19:47 +02:00

78 lines
2.8 KiB
Diff

From 0c883377270217830a782ba89958c39b25f81da0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 3 May 2015 18:47:30 +0200
Subject: wineboot: Create MachineGuid registry value.
---
programs/wineboot/Makefile.in | 2 +-
programs/wineboot/wineboot.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/programs/wineboot/Makefile.in b/programs/wineboot/Makefile.in
index f6da0f9..525abde 100644
--- a/programs/wineboot/Makefile.in
+++ b/programs/wineboot/Makefile.in
@@ -1,7 +1,7 @@
MODULE = wineboot.exe
APPMODE = -mconsole
IMPORTS = uuid advapi32
-DELAYIMPORTS = shell32 shlwapi version user32
+DELAYIMPORTS = shell32 shlwapi version user32 rpcrt4
C_SRCS = \
shutdown.c \
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
index 4d70ea9..24bc872 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -361,6 +361,38 @@ static void create_environment_registry_keys( void )
RegCloseKey( env_key );
}
+/* create Cryptography registry keys */
+static void create_cryptography_registry_keys( void )
+{
+ static const WCHAR CryptographyW[] = {'S','o','f','t','w','a','r','e','\\',
+ 'M','i','c','r','o','s','o','f','t','\\',
+ 'C','r','y','p','t','o','g','r','a','p','h','y',0};
+ static const WCHAR MachineGuidW[] = {'M','a','c','h','i','n','e','G','u','i','d',0};
+ static const WCHAR formatW[] =
+ {
+ '%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%','0',
+ '2','x','%','0','2','x','-','%','0','2','x','%','0','2','x','%','0','2',
+ 'x','%','0','2','x','%','0','2','x','%','0','2','x',0
+ };
+
+ HKEY crypt_key;
+ WCHAR buffer[37];
+ UUID uuid;
+
+ if (RegCreateKeyW( HKEY_LOCAL_MACHINE, CryptographyW, &crypt_key )) return;
+
+ if (RegQueryValueExW( crypt_key, MachineGuidW, NULL, NULL, NULL, NULL ))
+ {
+ UuidCreate( &uuid );
+ wsprintfW( buffer, formatW, uuid.Data1, uuid.Data2, uuid.Data3,
+ uuid.Data4[0], uuid.Data4[1], uuid.Data4[2], uuid.Data4[3],
+ uuid.Data4[4], uuid.Data4[5], uuid.Data4[6], uuid.Data4[7] );
+ RegSetValueExW( crypt_key, MachineGuidW, 0, REG_SZ, (BYTE *)buffer, sizeof(buffer) );
+ }
+
+ RegCloseKey( crypt_key );
+}
+
static void create_volatile_environment_registry_key(void)
{
static const WCHAR VolatileEnvW[] = {'V','o','l','a','t','i','l','e',' ','E','n','v','i','r','o','n','m','e','n','t',0};
@@ -1236,6 +1268,7 @@ int main( int argc, char *argv[] )
create_hardware_registry_keys();
create_dynamic_registry_keys();
create_environment_registry_keys();
+ create_cryptography_registry_keys();
wininit();
pendingRename();
--
2.4.2