[KERNEL32_VISTA][SDK] Move SRW definitions to NDK (#6806)
authorJustin Miller <justin.miller@reactos.org>
Tue, 11 Jun 2024 20:03:57 +0000 (20:03 +0000)
committerGitHub <noreply@github.com>
Tue, 11 Jun 2024 20:03:57 +0000 (22:03 +0200)
Move SRW and condition variable definitions out of kernel32_vista and into the NDK.

Essentially grabbed from PR #1190
Trying to reduce diff needed for Rtl/ntdll sync.

dll/win32/kernel32/kernel32_vista/sync.c
sdk/include/ndk/rtlfuncs.h
sdk/include/xdk/rtltypes.h
sdk/lib/rtl/condvar.c

index d8be19c..6feb641 100644 (file)
@@ -3,52 +3,6 @@
 #define NDEBUG
 #include <debug.h>
 
-VOID
-NTAPI
-RtlInitializeConditionVariable(OUT PRTL_CONDITION_VARIABLE ConditionVariable);
-
-VOID
-NTAPI
-RtlWakeConditionVariable(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable);
-
-VOID
-NTAPI
-RtlWakeAllConditionVariable(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable);
-
-NTSTATUS
-NTAPI
-RtlSleepConditionVariableCS(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable,
-                            IN OUT PRTL_CRITICAL_SECTION CriticalSection,
-                            IN PLARGE_INTEGER TimeOut OPTIONAL);
-
-NTSTATUS
-NTAPI
-RtlSleepConditionVariableSRW(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable,
-                             IN OUT PRTL_SRWLOCK SRWLock,
-                             IN PLARGE_INTEGER TimeOut OPTIONAL,
-                             IN ULONG Flags);
-
-VOID
-NTAPI
-RtlInitializeSRWLock(OUT PRTL_SRWLOCK SRWLock);
-
-VOID
-NTAPI
-RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock);
-
-VOID
-NTAPI
-RtlReleaseSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock);
-
-VOID
-NTAPI
-RtlAcquireSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock);
-
-VOID
-NTAPI
-RtlReleaseSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock);
-
-
 VOID
 WINAPI
 AcquireSRWLockExclusive(PSRWLOCK Lock)
index f85b93b..1d285f7 100644 (file)
@@ -4693,6 +4693,46 @@ BOOLEAN
 NTAPI
 RtlGetNtProductType(_Out_ PNT_PRODUCT_TYPE ProductType);
 
+#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+//
+// Synchronization functions
+//
+NTSYSAPI
+VOID
+NTAPI
+RtlInitializeConditionVariable(
+    _Out_ PRTL_CONDITION_VARIABLE ConditionVariable);
+
+NTSYSAPI
+VOID
+NTAPI
+RtlWakeConditionVariable(
+    _Inout_ PRTL_CONDITION_VARIABLE ConditionVariable);
+
+NTSYSAPI
+VOID
+NTAPI
+RtlWakeAllConditionVariable(
+    _Inout_ PRTL_CONDITION_VARIABLE ConditionVariable);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlSleepConditionVariableCS(
+    _Inout_ PRTL_CONDITION_VARIABLE ConditionVariable,
+    _Inout_ PRTL_CRITICAL_SECTION CriticalSection,
+    _In_opt_ PLARGE_INTEGER TimeOut);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlSleepConditionVariableSRW(
+    _Inout_ PRTL_CONDITION_VARIABLE ConditionVariable,
+    _Inout_ PRTL_SRWLOCK SRWLock,
+    _In_opt_ PLARGE_INTEGER TimeOut,
+    _In_ ULONG Flags);
+#endif
+
 //
 // Secure Memory Functions
 //
index f248232..1cf957b 100644 (file)
@@ -279,6 +279,19 @@ typedef struct _OSVERSIONINFOEXW {
   UCHAR wReserved;
 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
 
+#define RTL_CONDITION_VARIABLE_INIT {0}
+#define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1
+
+typedef struct _RTL_CONDITION_VARIABLE {
+  PVOID Ptr;
+} RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE;
+
+#define RTL_SRWLOCK_INIT {0}
+
+typedef struct _RTL_SRWLOCK {
+  PVOID Ptr;
+} RTL_SRWLOCK, *PRTL_SRWLOCK;
+
 #ifdef UNICODE
 typedef OSVERSIONINFOEXW OSVERSIONINFOEX;
 typedef POSVERSIONINFOEXW POSVERSIONINFOEX;
index f7f9d01..010df25 100644 (file)
@@ -499,7 +499,7 @@ NTSTATUS
 NTAPI
 RtlSleepConditionVariableCS(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable,
                             IN OUT PRTL_CRITICAL_SECTION CriticalSection,
-                            IN const LARGE_INTEGER * TimeOut OPTIONAL)
+                            IN PLARGE_INTEGER TimeOut OPTIONAL)
 {
     return InternalSleep(ConditionVariable,
                          CriticalSection,
@@ -512,7 +512,7 @@ NTSTATUS
 NTAPI
 RtlSleepConditionVariableSRW(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable,
                              IN OUT PRTL_SRWLOCK SRWLock,
-                             IN const LARGE_INTEGER * TimeOut OPTIONAL,
+                             IN PLARGE_INTEGER TimeOut OPTIONAL,
                              IN ULONG Flags)
 {
     return InternalSleep(ConditionVariable,