Commit 7d66a01f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntdll: Return STATUS_PENDING in NtNotifyChangeKey if async notify is performed.

parent cd785109
...@@ -678,12 +678,12 @@ NTSTATUS WINAPI NtNotifyChangeKey( ...@@ -678,12 +678,12 @@ NTSTATUS WINAPI NtNotifyChangeKey(
if (!Asynchronous) if (!Asynchronous)
{ {
if (ret == STATUS_SUCCESS) if (ret == STATUS_PENDING)
NtWaitForSingleObject( Event, FALSE, NULL ); ret = NtWaitForSingleObject( Event, FALSE, NULL );
NtClose( Event ); NtClose( Event );
} }
return STATUS_SUCCESS; return ret;
} }
/****************************************************************************** /******************************************************************************
......
...@@ -147,6 +147,7 @@ static LPVOID (WINAPI * pRtlAllocateHeap)(PVOID,ULONG,ULONG); ...@@ -147,6 +147,7 @@ static LPVOID (WINAPI * pRtlAllocateHeap)(PVOID,ULONG,ULONG);
static NTSTATUS (WINAPI * pRtlZeroMemory)(PVOID, ULONG); static NTSTATUS (WINAPI * pRtlZeroMemory)(PVOID, ULONG);
static NTSTATUS (WINAPI * pRtlpNtQueryValueKey)(HANDLE,ULONG*,PBYTE,DWORD*,void *); static NTSTATUS (WINAPI * pRtlpNtQueryValueKey)(HANDLE,ULONG*,PBYTE,DWORD*,void *);
static NTSTATUS (WINAPI * pNtNotifyChangeKey)(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN); static NTSTATUS (WINAPI * pNtNotifyChangeKey)(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN);
static NTSTATUS (WINAPI * pNtWaitForSingleObject)(HANDLE,BOOLEAN,const LARGE_INTEGER*);
static HMODULE hntdll = 0; static HMODULE hntdll = 0;
static int CurrentTest = 0; static int CurrentTest = 0;
...@@ -195,6 +196,7 @@ static BOOL InitFunctionPtrs(void) ...@@ -195,6 +196,7 @@ static BOOL InitFunctionPtrs(void)
NTDLL_GET_PROC(RtlZeroMemory) NTDLL_GET_PROC(RtlZeroMemory)
NTDLL_GET_PROC(RtlpNtQueryValueKey) NTDLL_GET_PROC(RtlpNtQueryValueKey)
NTDLL_GET_PROC(RtlOpenCurrentUser) NTDLL_GET_PROC(RtlOpenCurrentUser)
NTDLL_GET_PROC(NtWaitForSingleObject)
/* optional functions */ /* optional functions */
pNtQueryLicenseValue = (void *)GetProcAddress(hntdll, "NtQueryLicenseValue"); pNtQueryLicenseValue = (void *)GetProcAddress(hntdll, "NtQueryLicenseValue");
...@@ -1507,9 +1509,11 @@ static void test_NtQueryKey(void) ...@@ -1507,9 +1509,11 @@ static void test_NtQueryKey(void)
static void test_notify(void) static void test_notify(void)
{ {
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
LARGE_INTEGER timeout;
IO_STATUS_BLOCK iosb; IO_STATUS_BLOCK iosb;
UNICODE_STRING str;
HANDLE key, event, subkey;
NTSTATUS status; NTSTATUS status;
HANDLE key, event;
InitializeObjectAttributes(&attr, &winetestpath, 0, 0, 0); InitializeObjectAttributes(&attr, &winetestpath, 0, 0, 0);
...@@ -1520,7 +1524,25 @@ static void test_notify(void) ...@@ -1520,7 +1524,25 @@ static void test_notify(void)
ok(event != NULL, "CreateEvent failed: %u\n", GetLastError()); ok(event != NULL, "CreateEvent failed: %u\n", GetLastError());
status = pNtNotifyChangeKey(key, event, NULL, NULL, &iosb, REG_NOTIFY_CHANGE_NAME, FALSE, NULL, 0, TRUE); status = pNtNotifyChangeKey(key, event, NULL, NULL, &iosb, REG_NOTIFY_CHANGE_NAME, FALSE, NULL, 0, TRUE);
todo_wine ok(status == STATUS_PENDING, "NtNotifyChangeKey returned %x\n", status); ok(status == STATUS_PENDING, "NtNotifyChangeKey returned %x\n", status);
timeout.QuadPart = 0;
status = pNtWaitForSingleObject(event, FALSE, &timeout);
ok(status == STATUS_TIMEOUT, "NtWaitForSingleObject returned %x\n", status);
attr.RootDirectory = key;
attr.ObjectName = &str;
pRtlCreateUnicodeStringFromAsciiz(&str, "test_subkey");
status = pNtCreateKey(&subkey, GENERIC_ALL, &attr, 0, 0, 0, 0);
ok(status == STATUS_SUCCESS, "NtCreateKey failed: 0x%08x\n", status);
status = pNtWaitForSingleObject(event, FALSE, &timeout);
todo_wine ok(status == STATUS_SUCCESS, "NtWaitForSingleObject returned %x\n", status);
status = pNtDeleteKey(subkey);
ok(status == STATUS_SUCCESS, "NtDeleteSubkey failed: %x\n", status);
pNtClose(subkey);
pNtClose(key); pNtClose(key);
pNtClose(event); pNtClose(event);
......
...@@ -2289,6 +2289,8 @@ DECL_HANDLER(set_registry_notification) ...@@ -2289,6 +2289,8 @@ DECL_HANDLER(set_registry_notification)
list_add_head( &key->notify_list, &notify->entry ); list_add_head( &key->notify_list, &notify->entry );
} }
} }
if (notify)
set_error( STATUS_PENDING );
release_object( event ); release_object( event );
} }
release_object( key ); release_object( key );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment