kernel32: Create the hardware registry keys one at a time, and bail out if the main key already exists.

This commit is contained in:
Alexandre Julliard 2010-03-01 14:02:16 +01:00
parent 61812d17f8
commit 6d4cf67a56
1 changed files with 19 additions and 0 deletions

View File

@ -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,