mirror of
https://github.com/reactos/reactos.git
synced 2024-07-12 15:45:20 +00:00
[ADVAPI32]
- Implement RegQueryValueEx for HKCR subkeys CORE-8582 svn path=/trunk/; revision=64443
This commit is contained in:
parent
bd4da28f08
commit
b0408707b8
|
@ -268,6 +268,7 @@ OpenHKCRKey(
|
|||
return ErrorCode;
|
||||
}
|
||||
|
||||
/* HKCR version of RegDeleteKeyExW */
|
||||
LONG
|
||||
WINAPI
|
||||
DeleteHKCRKey(
|
||||
|
@ -329,3 +330,68 @@ DeleteHKCRKey(
|
|||
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
/* HKCR version of RegQueryValueExW */
|
||||
LONG
|
||||
WINAPI
|
||||
QueryHKCRValue(
|
||||
_In_ HKEY hKey,
|
||||
_In_ LPCWSTR Name,
|
||||
_In_ LPDWORD Reserved,
|
||||
_In_ LPDWORD Type,
|
||||
_In_ LPBYTE Data,
|
||||
_In_ LPDWORD Count)
|
||||
{
|
||||
HKEY QueriedKey;
|
||||
LONG ErrorCode;
|
||||
|
||||
ASSERT(IsHKCRKey(hKey));
|
||||
|
||||
/* Remove the HKCR flag while we're working */
|
||||
hKey = (HKEY)(((ULONG_PTR)hKey) & ~0x2);
|
||||
|
||||
ErrorCode = GetPreferredHKCRKey(hKey, &QueriedKey);
|
||||
|
||||
if (ErrorCode == ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
/* The key doesn't exist on HKCU side, no chance for a value in it */
|
||||
return RegQueryValueExW(hKey, Name, Reserved, Type, Data, Count);
|
||||
}
|
||||
|
||||
if (ErrorCode != ERROR_SUCCESS)
|
||||
{
|
||||
/* Somehow we failed for another reason (maybe deleted key or whatever) */
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
ErrorCode = RegQueryValueExW(QueriedKey, Name, Reserved, Type, Data, Count);
|
||||
|
||||
/* Close it if we must */
|
||||
if (QueriedKey != hKey)
|
||||
{
|
||||
/* The original key is on the machine view */
|
||||
RegCloseKey(QueriedKey);
|
||||
}
|
||||
|
||||
/* Anything else than ERROR_FILE_NOT_FOUND means that we found it, even if it is with failures. */
|
||||
if (ErrorCode != ERROR_FILE_NOT_FOUND)
|
||||
return ErrorCode;
|
||||
|
||||
/* If we're here, we must open from HKLM key. */
|
||||
ErrorCode = GetFallbackHKCRKey(hKey, &QueriedKey);
|
||||
if (ErrorCode != ERROR_SUCCESS)
|
||||
{
|
||||
/* Maybe the key doesn't exist in the HKLM view */
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
ErrorCode = RegQueryValueExW(QueriedKey, Name, Reserved, Type, Data, Count);
|
||||
|
||||
/* Close it if we must */
|
||||
if (QueriedKey != hKey)
|
||||
{
|
||||
RegCloseKey(QueriedKey);
|
||||
}
|
||||
|
||||
return ErrorCode;
|
||||
}
|
||||
|
|
|
@ -4082,12 +4082,13 @@ RegQueryValueExA(
|
|||
*/
|
||||
LONG
|
||||
WINAPI
|
||||
RegQueryValueExW(HKEY hkeyorg,
|
||||
LPCWSTR name,
|
||||
LPDWORD reserved,
|
||||
LPDWORD type,
|
||||
LPBYTE data,
|
||||
LPDWORD count)
|
||||
RegQueryValueExW(
|
||||
_In_ HKEY hkeyorg,
|
||||
_In_ LPCWSTR name,
|
||||
_In_ LPDWORD reserved,
|
||||
_In_ LPDWORD type,
|
||||
_In_ LPBYTE data,
|
||||
_In_ LPDWORD count)
|
||||
{
|
||||
HANDLE hkey;
|
||||
NTSTATUS status;
|
||||
|
@ -4109,6 +4110,13 @@ RegQueryValueExW(HKEY hkeyorg,
|
|||
return RtlNtStatusToDosError(status);
|
||||
}
|
||||
|
||||
if (IsHKCRKey(hkey))
|
||||
{
|
||||
LONG ErrorCode = QueryHKCRValue(hkey, name, reserved, type, data, count);
|
||||
ClosePredefKey(hkey);
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
RtlInitUnicodeString( &name_str, name );
|
||||
|
||||
if (data) total_size = min( sizeof(buffer), *count + info_size );
|
||||
|
|
|
@ -39,3 +39,13 @@ DeleteHKCRKey(
|
|||
_In_ REGSAM RegSam,
|
||||
_In_ DWORD Reserved);
|
||||
|
||||
LONG
|
||||
WINAPI
|
||||
QueryHKCRValue(
|
||||
_In_ HKEY hKey,
|
||||
_In_ LPCWSTR Name,
|
||||
_In_ LPDWORD Reserved,
|
||||
_In_ LPDWORD Type,
|
||||
_In_ LPBYTE Data,
|
||||
_In_ LPDWORD Count);
|
||||
|
||||
|
|
Loading…
Reference in a new issue