Commit 6fdfd53e authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Do not overwrite the valid ObjectAttributes->RootDirectory.

Perform case insensitive comparison for the registry paths.
parent 1da43e3e
...@@ -57,31 +57,36 @@ static BOOLEAN _NtKeyToWinKey( ...@@ -57,31 +57,36 @@ static BOOLEAN _NtKeyToWinKey(
'\\','C','L','A','S','S','E','S',0}; '\\','C','L','A','S','S','E','S',0};
int len; int len;
PUNICODE_STRING ObjectName = ObjectAttributes->ObjectName; PUNICODE_STRING ObjectName = ObjectAttributes->ObjectName;
if((ObjectName->Length > (len=lstrlenW(KeyPath_HKLM))) if(ObjectAttributes->RootDirectory)
&& (0==CRTDLL_wcsncmp(ObjectName->Buffer,KeyPath_HKLM,len))) {
len = 0;
*KeyHandle = ObjectAttributes->RootDirectory;
}
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKLM)))
&& (0==CRTDLL__wcsnicmp(ObjectName->Buffer,KeyPath_HKLM,len)))
{ *KeyHandle = HKEY_LOCAL_MACHINE; { *KeyHandle = HKEY_LOCAL_MACHINE;
} }
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKU))) else if((ObjectName->Length > (len=lstrlenW(KeyPath_HKU)))
&& (0==CRTDLL_wcsncmp(ObjectName->Buffer,KeyPath_HKU,len))) && (0==CRTDLL__wcsnicmp(ObjectName->Buffer,KeyPath_HKU,len)))
{ *KeyHandle = HKEY_USERS; { *KeyHandle = HKEY_USERS;
} }
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCR))) else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCR)))
&& (0==CRTDLL_wcsncmp(ObjectName->Buffer,KeyPath_HCR,len))) && (0==CRTDLL__wcsnicmp(ObjectName->Buffer,KeyPath_HCR,len)))
{ *KeyHandle = HKEY_CLASSES_ROOT; { *KeyHandle = HKEY_CLASSES_ROOT;
} }
else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCC))) else if((ObjectName->Length > (len=lstrlenW(KeyPath_HCC)))
&& (0==CRTDLL_wcsncmp(ObjectName->Buffer,KeyPath_HCC,len))) && (0==CRTDLL__wcsnicmp(ObjectName->Buffer,KeyPath_HCC,len)))
{ *KeyHandle = HKEY_CURRENT_CONFIG; { *KeyHandle = HKEY_CURRENT_CONFIG;
} }
else else
{ {
*KeyHandle = ObjectAttributes->RootDirectory; *KeyHandle = 0;
*Offset = 0; *Offset = 0;
return FALSE; return FALSE;
} }
if (ObjectName->Buffer[len] == (WCHAR)'\\') len++; if (len > 0 && ObjectName->Buffer[len] == (WCHAR)'\\') len++;
*Offset = len; *Offset = len;
TRACE("off=%u hkey=0x%08x\n", *Offset, *KeyHandle); TRACE("off=%u hkey=0x%08x\n", *Offset, *KeyHandle);
......
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