From: Jérôme Gardou Date: Tue, 30 Sep 2014 20:00:17 +0000 (+0000) Subject: [ADVAPI32] X-Git-Tag: backups/0.3.17@66124~331 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=ccc1a83dcab4609fd3c3e4738df8cde848229b12;hp=fff76a1d0e929afd764f9f0a3556d8cd6325b5e0 [ADVAPI32] - Mark the HKEY_CLASSES_ROOT key as belonging to the HKEY_CLASSES_ROOT tree. CORE-8582 svn path=/trunk/; revision=64417 --- diff --git a/reactos/dll/win32/advapi32/reg/reg.c b/reactos/dll/win32/advapi32/reg/reg.c index 88e6049c1c1..8fef9981112 100644 --- a/reactos/dll/win32/advapi32/reg/reg.c +++ b/reactos/dll/win32/advapi32/reg/reg.c @@ -18,6 +18,8 @@ #include #include +#include "reg.h" + WINE_DEFAULT_DEBUG_CHANNEL(reg); /* DEFINES ******************************************************************/ @@ -231,10 +233,11 @@ CloseDefaultKeys(VOID) static NTSTATUS -OpenClassesRootKey(PHANDLE KeyHandle) +OpenClassesRootKey(_Out_ PHANDLE KeyHandle) { OBJECT_ATTRIBUTES Attributes; UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\CLASSES"); + NTSTATUS Status; TRACE("OpenClassesRootKey()\n"); @@ -243,9 +246,17 @@ OpenClassesRootKey(PHANDLE KeyHandle) OBJ_CASE_INSENSITIVE, NULL, NULL); - return NtOpenKey(KeyHandle, - MAXIMUM_ALLOWED, - &Attributes); + Status = NtOpenKey(KeyHandle, + MAXIMUM_ALLOWED, + &Attributes); + + if (!NT_SUCCESS(Status)) + return Status; + + /* Mark it as HKCR */ + MakeHKCRKey((HKEY*)KeyHandle); + + return Status; } diff --git a/reactos/dll/win32/advapi32/reg/reg.h b/reactos/dll/win32/advapi32/reg/reg.h new file mode 100644 index 00000000000..8228be4e846 --- /dev/null +++ b/reactos/dll/win32/advapi32/reg/reg.h @@ -0,0 +1,23 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/advapi32/reg/reg.c + * PURPOSE: Registry functions + */ + +#pragma once + +/* FUNCTIONS ****************************************************************/ +FORCEINLINE +BOOL +IsHKCRKey(_In_ HKEY hKey) +{ + return ((ULONG_PTR)hKey & 0x2) != 0; +} + +FORCEINLINE +void +MakeHKCRKey(_Inout_ HKEY* hKey) +{ + *hKey = (HKEY)((ULONG_PTR)*hKey | 0x2); +}