Author: jimtabor
Date: Fri Mar 28 22:46:17 2008
New Revision: 32778
URL:
http://svn.reactos.org/svn/reactos?rev=32778&view=rev
Log:
Phase 1:
- Implement RegisterWaitForSingleObject/Ex and UnregisterWait/Ex in stubs.c. I'm not
sure where to place the exports. So ATM it is here.
- Stub RtlRegisterWait and RtlDeregisterWait/Ex.
- Import from Wine source and is LGPL.
- Ref:
http://source.winehq.org/WineAPI/RtlRegisterWait.html
http://source.winehq.org/WineAPI/RtlDeregisterWait.html
Modified:
trunk/reactos/dll/ntdll/def/ntdll.def
trunk/reactos/dll/win32/kernel32/misc/stubs.c
trunk/reactos/lib/rtl/thread.c
Modified: trunk/reactos/dll/ntdll/def/ntdll.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.def?re…
==============================================================================
--- trunk/reactos/dll/ntdll/def/ntdll.def [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/def/ntdll.def [iso-8859-1] Fri Mar 28 22:46:17 2008
@@ -404,6 +404,8 @@
RtlDeleteTimer@12
RtlDeleteTimerQueue@4
RtlDeleteTimerQueueEx@8
+RtlDeregisterWait@4
+RtlDeregisterWaitEx@8
RtlDestroyAtomTable@4
RtlDestroyEnvironment@4
RtlDestroyHandleTable@4
@@ -622,6 +624,7 @@
RtlReAllocateHeap@16
RtlRealPredecessor@4
RtlRealSuccessor@4
+RtlRegisterWait@24
RtlReleasePebLock@0
RtlReleaseRelativeName@4
RtlReleaseResource@4
Modified: trunk/reactos/dll/win32/kernel32/misc/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/st…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] Fri Mar 28 22:46:17 2008
@@ -7,6 +7,10 @@
#define NDEBUG
#include <debug.h>
+
+NTSTATUS NTAPI RtlRegisterWait(PHANDLE, HANDLE, WAITORTIMERCALLBACKFUNC, PVOID, ULONG,
ULONG);
+NTSTATUS NTAPI RtlDeregisterWaitEx(HANDLE, HANDLE);
+NTSTATUS NTAPI RtlDeregisterWait(HANDLE);
#define STUB \
@@ -657,8 +661,18 @@
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 @@
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 @@
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 @@
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;
}
/*
Modified: trunk/reactos/lib/rtl/thread.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/thread.c?rev=32778…
==============================================================================
--- trunk/reactos/lib/rtl/thread.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/thread.c [iso-8859-1] Fri Mar 28 22:46:17 2008
@@ -274,4 +274,83 @@
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 */