mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:33:01 +00:00
[ADVAPI32] Fix several corner cases in RegOpenKey* functions
This fixes the remaining RegOpenKey* tests.
This commit is contained in:
parent
a37d9a4e14
commit
1ade494a70
1 changed files with 17 additions and 13 deletions
|
@ -3264,12 +3264,7 @@ RegOpenKeyA(HKEY hKey,
|
||||||
if (!phkResult)
|
if (!phkResult)
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (!hKey && lpSubKey && phkResult)
|
if (!hKey && !lpSubKey)
|
||||||
{
|
|
||||||
return ERROR_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!lpSubKey || !*lpSubKey)
|
|
||||||
{
|
{
|
||||||
*phkResult = hKey;
|
*phkResult = hKey;
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
@ -3303,12 +3298,7 @@ RegOpenKeyW(HKEY hKey,
|
||||||
if (!phkResult)
|
if (!phkResult)
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (!hKey && lpSubKey && phkResult)
|
if (!hKey && !lpSubKey)
|
||||||
{
|
|
||||||
return ERROR_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!lpSubKey || !*lpSubKey)
|
|
||||||
{
|
{
|
||||||
*phkResult = hKey;
|
*phkResult = hKey;
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
@ -3383,6 +3373,17 @@ RegOpenKeyExW(HKEY hKey,
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hKey && lpSubKey && phkResult)
|
||||||
|
{
|
||||||
|
return ERROR_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsPredefKey(hKey) && (!lpSubKey || !*lpSubKey))
|
||||||
|
{
|
||||||
|
*phkResult = hKey;
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
Status = MapDefaultKey(&KeyHandle, hKey);
|
Status = MapDefaultKey(&KeyHandle, hKey);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -3399,7 +3400,10 @@ RegOpenKeyExW(HKEY hKey,
|
||||||
if (ulOptions & REG_OPTION_OPEN_LINK)
|
if (ulOptions & REG_OPTION_OPEN_LINK)
|
||||||
Attributes |= OBJ_OPENLINK;
|
Attributes |= OBJ_OPENLINK;
|
||||||
|
|
||||||
RtlInitUnicodeString(&SubKeyString, lpSubKey ? lpSubKey : L"");
|
if (lpSubKey == NULL || wcscmp(lpSubKey, L"\\") == 0)
|
||||||
|
RtlInitUnicodeString(&SubKeyString, L"");
|
||||||
|
else
|
||||||
|
RtlInitUnicodeString(&SubKeyString, lpSubKey);
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&SubKeyString,
|
&SubKeyString,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue