From 6d4cf67a56dee87180d447eae3562d35798ba75c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 1 Mar 2010 14:02:16 +0100 Subject: [PATCH] kernel32: Create the hardware registry keys one at a time, and bail out if the main key already exists. --- dlls/kernel32/oldconfig.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dlls/kernel32/oldconfig.c b/dlls/kernel32/oldconfig.c index 0e8cff1a16c..c77e7b2ee22 100644 --- a/dlls/kernel32/oldconfig.c +++ b/dlls/kernel32/oldconfig.c @@ -90,6 +90,25 @@ static void create_scsi_entry( PSCSI_ADDRESS scsi_addr, LPCSTR lpDriver, UINT uD attr.SecurityDescriptor = NULL; attr.SecurityQualityOfService = NULL; + if (!RtlCreateUnicodeStringFromAsciiz( &nameW, "Machine\\HARDWARE" ) || + NtCreateKey( &scsiKey, KEY_ALL_ACCESS, &attr, 0, NULL, REG_OPTION_VOLATILE, &disp )) + { + ERR("Cannot create HARDWARE registry key\n" ); + return; + } + NtClose( scsiKey ); + RtlFreeUnicodeString( &nameW ); + if (disp == REG_OPENED_EXISTING_KEY) return; + + if (!RtlCreateUnicodeStringFromAsciiz( &nameW, "Machine\\HARDWARE\\DEVICEMAP" ) || + NtCreateKey( &scsiKey, KEY_ALL_ACCESS, &attr, 0, NULL, REG_OPTION_VOLATILE, &disp )) + { + ERR("Cannot create DEVICEMAP registry key\n" ); + return; + } + NtClose( scsiKey ); + RtlFreeUnicodeString( &nameW ); + /* Ensure there is Scsi key */ if (!RtlCreateUnicodeStringFromAsciiz( &nameW, "Machine\\HARDWARE\\DEVICEMAP\\Scsi" ) || NtCreateKey( &scsiKey, KEY_ALL_ACCESS, &attr, 0,