diff --git a/reactos/dll/ntdll/def/ntdll.def b/reactos/dll/ntdll/def/ntdll.def index bbae1c3f4fa..c49bf964235 100644 --- a/reactos/dll/ntdll/def/ntdll.def +++ b/reactos/dll/ntdll/def/ntdll.def @@ -404,6 +404,8 @@ RtlDeleteSecurityObject@4 RtlDeleteTimer@12 RtlDeleteTimerQueue@4 RtlDeleteTimerQueueEx@8 +RtlDeregisterWait@4 +RtlDeregisterWaitEx@8 RtlDestroyAtomTable@4 RtlDestroyEnvironment@4 RtlDestroyHandleTable@4 @@ -622,6 +624,7 @@ RtlRandomEx=RtlRandom@4 RtlReAllocateHeap@16 RtlRealPredecessor@4 RtlRealSuccessor@4 +RtlRegisterWait@24 RtlReleasePebLock@0 RtlReleaseRelativeName@4 RtlReleaseResource@4 diff --git a/reactos/dll/win32/kernel32/misc/stubs.c b/reactos/dll/win32/kernel32/misc/stubs.c index def1e727fe1..bffd6ba4c05 100644 --- a/reactos/dll/win32/kernel32/misc/stubs.c +++ b/reactos/dll/win32/kernel32/misc/stubs.c @@ -8,6 +8,10 @@ #define NDEBUG #include +NTSTATUS NTAPI RtlRegisterWait(PHANDLE, HANDLE, WAITORTIMERCALLBACKFUNC, PVOID, ULONG, ULONG); +NTSTATUS NTAPI RtlDeregisterWaitEx(HANDLE, HANDLE); +NTSTATUS NTAPI RtlDeregisterWait(HANDLE); + #define STUB \ SetLastError(ERROR_CALL_NOT_IMPLEMENTED); \ @@ -657,8 +661,18 @@ RegisterWaitForSingleObject( ULONG dwFlags ) { - STUB; - return 0; + NTSTATUS status; + +// TRACE("%p %p %p %p %d %d\n", +// phNewWaitObject,hObject,Callback,Context,dwMilliseconds,dwFlags); + + status = RtlRegisterWait( phNewWaitObject, hObject, Callback, Context, dwMilliseconds, dwFlags ); + if (status != STATUS_SUCCESS) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + return TRUE; } /* @@ -674,8 +688,19 @@ RegisterWaitForSingleObjectEx( ULONG dwFlags ) { - STUB; - return 0; + NTSTATUS status; + HANDLE hNewWaitObject; + +// TRACE("%p %p %p %d %d\n", +// hObject,Callback,Context,dwMilliseconds,dwFlags); + + status = RtlRegisterWait( &hNewWaitObject, hObject, Callback, Context, dwMilliseconds, dwFlags ); + if (status != STATUS_SUCCESS) + { + SetLastError( RtlNtStatusToDosError(status) ); + return NULL; + } + return hNewWaitObject; } /* @@ -794,8 +819,17 @@ UnregisterWait( HANDLE WaitHandle ) { - STUB; - return 0; + NTSTATUS status; + +// TRACE("%p\n",WaitHandle); + + status = RtlDeregisterWaitEx( WaitHandle, NULL ); + if (status != STATUS_SUCCESS) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + return TRUE; } /* @@ -808,8 +842,17 @@ UnregisterWaitEx( HANDLE CompletionEvent ) { - STUB; - return 0; + NTSTATUS status; + +// TRACE("%p\n",WaitHandle); + + status = RtlDeregisterWaitEx( WaitHandle, CompletionEvent ); + if (status != STATUS_SUCCESS) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + return TRUE; } /* diff --git a/reactos/lib/rtl/thread.c b/reactos/lib/rtl/thread.c index a6396b79e8f..9cadffaa158 100644 --- a/reactos/lib/rtl/thread.c +++ b/reactos/lib/rtl/thread.c @@ -274,4 +274,83 @@ _NtCurrentTeb(VOID) return NtCurrentTeb(); } + +/*********************************************************************** + * RtlRegisterWait + * + * Registers a wait for a handle to become signaled. + * + * PARAMS + * NewWaitObject [I] Handle to the new wait object. Use RtlDeregisterWait() to free it. + * Object [I] Object to wait to become signaled. + * Callback [I] Callback function to execute when the wait times out or the handle is signaled. + * Context [I] Context to pass to the callback function when it is executed. + * Milliseconds [I] Number of milliseconds to wait before timing out. + * Flags [I] Flags. See notes. + * + * RETURNS + * Success: STATUS_SUCCESS. + * Failure: Any NTSTATUS code. + * + * NOTES + * Flags can be one or more of the following: + *|WT_EXECUTEDEFAULT - Executes the work item in a non-I/O worker thread. + *|WT_EXECUTEINIOTHREAD - Executes the work item in an I/O worker thread. + *|WT_EXECUTEINPERSISTENTTHREAD - Executes the work item in a thread that is persistent. + *|WT_EXECUTELONGFUNCTION - Hints that the execution can take a long time. + *|WT_TRANSFER_IMPERSONATION - Executes the function with the current access token. + */ +NTSTATUS +NTAPI +RtlRegisterWait(PHANDLE NewWaitObject, + HANDLE Object, + WAITORTIMERCALLBACKFUNC Callback, + PVOID Context, + ULONG Milliseconds, + ULONG Flags) +{ + return STATUS_SUCCESS; +} + +/*********************************************************************** + * RtlDeregisterWaitEx + * + * Cancels a wait operation and frees the resources associated with calling + * RtlRegisterWait(). + * + * PARAMS + * WaitObject [I] Handle to the wait object to free. + * + * RETURNS + * Success: STATUS_SUCCESS. + * Failure: Any NTSTATUS code. + */ +NTSTATUS +NTAPI +RtlDeregisterWaitEx(HANDLE WaitHandle, + HANDLE CompletionEvent) +{ + return STATUS_SUCCESS; +} + +/*********************************************************************** + * RtlDeregisterWait + * + * Cancels a wait operation and frees the resources associated with calling + * RtlRegisterWait(). + * + * PARAMS + * WaitObject [I] Handle to the wait object to free. + * + * RETURNS + * Success: STATUS_SUCCESS. + * Failure: Any NTSTATUS code. + */ +NTSTATUS +NTAPI +RtlDeregisterWait(HANDLE WaitHandle) +{ + return RtlDeregisterWaitEx(WaitHandle, NULL); +} + /* EOF */