mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 08:00:11 +00:00
kernelbase: Call open_key() from open_subkey().
This commit is contained in:
parent
8b327eee5e
commit
35b56daf1f
|
@ -140,20 +140,15 @@ static HKEY get_perflib_key( HANDLE key )
|
|||
return key;
|
||||
}
|
||||
|
||||
static NTSTATUS open_key( HKEY *retkey, HKEY root, UNICODE_STRING name, DWORD options, ACCESS_MASK access );
|
||||
|
||||
static NTSTATUS open_subkey( HKEY *subkey, HKEY root, UNICODE_STRING *name, DWORD options, ACCESS_MASK access )
|
||||
{
|
||||
ACCESS_MASK access_64 = access & ~KEY_WOW64_32KEY;
|
||||
DWORD i = 0, len = name->Length / sizeof(WCHAR);
|
||||
WCHAR *buffer = name->Buffer;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING str;
|
||||
NTSTATUS status = 0;
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = root;
|
||||
attr.ObjectName = &str;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
if (len > 0 && buffer[0] == '\\') return STATUS_OBJECT_PATH_INVALID;
|
||||
while (i < len && buffer[i] != '\\') i++;
|
||||
|
@ -161,23 +156,10 @@ static NTSTATUS open_subkey( HKEY *subkey, HKEY root, UNICODE_STRING *name, DWOR
|
|||
str.Buffer = name->Buffer;
|
||||
str.Length = i * sizeof(WCHAR);
|
||||
|
||||
if (i == len)
|
||||
{
|
||||
if (options & REG_OPTION_OPEN_LINK) attr.Attributes |= OBJ_OPENLINK;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(options & REG_OPTION_OPEN_LINK)) attr.Attributes &= ~OBJ_OPENLINK;
|
||||
if (i < len)
|
||||
options &= ~REG_OPTION_OPEN_LINK;
|
||||
}
|
||||
|
||||
status = NtOpenKeyEx( (HANDLE *)subkey, access, &attr, options );
|
||||
if (status == STATUS_PREDEFINED_HANDLE)
|
||||
{
|
||||
*subkey = get_perflib_key( *subkey );
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
status = open_key( subkey, root, str, options, access_64 );
|
||||
if (!status)
|
||||
{
|
||||
while (i < len && buffer[i] == '\\') i++;
|
||||
|
|
Loading…
Reference in a new issue