Fix RegOpen/CloseKey.

This commit is contained in:
James Hawkins 2005-02-25 16:52:10 +00:00 committed by Alexandre Julliard
parent 541e14f7ef
commit e8d1e2f745
2 changed files with 12 additions and 12 deletions

View File

@ -277,11 +277,6 @@ DWORD WINAPI RegOpenKeyExW( HKEY hkey, LPCWSTR name, DWORD reserved, REGSAM acce
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
if (!name || !*name) {
*retkey = hkey;
return ERROR_SUCCESS;
}
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
attr.Length = sizeof(attr);
@ -321,11 +316,6 @@ DWORD WINAPI RegOpenKeyExA( HKEY hkey, LPCSTR name, DWORD reserved, REGSAM acces
STRING nameA;
NTSTATUS status;
if (!name || !*name) {
*retkey = hkey;
return ERROR_SUCCESS;
}
if (!is_version_nt()) access = KEY_ALL_ACCESS; /* Win95 ignores the access mask */
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
@ -354,6 +344,11 @@ DWORD WINAPI RegOpenKeyExA( HKEY hkey, LPCSTR name, DWORD reserved, REGSAM acces
*/
DWORD WINAPI RegOpenKeyW( HKEY hkey, LPCWSTR name, PHKEY retkey )
{
if (!name || !*name)
{
*retkey = hkey;
return ERROR_SUCCESS;
}
return RegOpenKeyExW( hkey, name, 0, KEY_ALL_ACCESS, retkey );
}
@ -374,6 +369,11 @@ DWORD WINAPI RegOpenKeyW( HKEY hkey, LPCWSTR name, PHKEY retkey )
*/
DWORD WINAPI RegOpenKeyA( HKEY hkey, LPCSTR name, PHKEY retkey )
{
if (!name || !*name)
{
*retkey = hkey;
return ERROR_SUCCESS;
}
return RegOpenKeyExA( hkey, name, 0, KEY_ALL_ACCESS, retkey );
}
@ -855,7 +855,7 @@ DWORD WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDWOR
*/
DWORD WINAPI RegCloseKey( HKEY hkey )
{
if (!hkey) return ERROR_INVALID_PARAMETER;
if (!hkey) return ERROR_INVALID_HANDLE;
if (hkey >= (HKEY)0x80000000) return ERROR_SUCCESS;
return RtlNtStatusToDosError( NtClose( hkey ) );
}

View File

@ -341,7 +341,7 @@ static void test_reg_close_key()
/* try to close a NULL handle */
ret = RegCloseKey(NULL);
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret);
ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", ret);
}
START_TEST(registry)