Author: pschweitzer
Date: Tue May 30 21:39:50 2017
New Revision: 74705
URL:
http://svn.reactos.org/svn/reactos?rev=74705&view=rev
Log:
[KERNEL32_VISTA]
Add Kernel32 implementation for SRW locks and condition variables.
This is based on Wine implementation.
CORE-7546
CORE-8204
Added:
trunk/reactos/dll/win32/kernel32_vista/sync.c (with props)
Modified:
trunk/reactos/dll/win32/kernel32_vista/CMakeLists.txt
trunk/reactos/dll/win32/kernel32_vista/kernel32_vista.spec
Modified: trunk/reactos/dll/win32/kernel32_vista/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32_vista/C…
==============================================================================
--- trunk/reactos/dll/win32/kernel32_vista/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32_vista/CMakeLists.txt [iso-8859-1] Tue May 30 21:39:50
2017
@@ -10,10 +10,11 @@
GetFileInformationByHandleEx.c
GetTickCount64.c
InitOnceExecuteOnce.c
+ sync.c
${CMAKE_CURRENT_BINARY_DIR}/kernel32_vista.def)
add_library(kernel32_vista SHARED ${SOURCE})
set_module_type(kernel32_vista win32dll ENTRYPOINT DllMain 12)
-add_importlibs(kernel32_vista kernel32 ntdll)
+add_importlibs(kernel32_vista kernel32 ntdll_vista ntdll)
add_dependencies(kernel32_vista psdk)
add_cd_file(TARGET kernel32_vista DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/win32/kernel32_vista/kernel32_vista.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32_vista/k…
==============================================================================
--- trunk/reactos/dll/win32/kernel32_vista/kernel32_vista.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32_vista/kernel32_vista.spec [iso-8859-1] Tue May 30
21:39:50 2017
@@ -2,3 +2,15 @@
@ stdcall InitOnceExecuteOnce(ptr ptr ptr ptr)
@ stdcall GetFileInformationByHandleEx(long long ptr long)
@ stdcall -ret64 GetTickCount64()
+
+@ stdcall InitializeSRWLock(ptr)
+@ stdcall AcquireSRWLockExclusive(ptr)
+@ stdcall AcquireSRWLockShared(ptr)
+@ stdcall ReleaseSRWLockExclusive(ptr)
+@ stdcall ReleaseSRWLockShared(ptr)
+
+@ stdcall InitializeConditionVariable(ptr)
+@ stdcall SleepConditionVariableCS(ptr ptr long)
+@ stdcall SleepConditionVariableSRW(ptr ptr long long)
+@ stdcall WakeAllConditionVariable(ptr)
+@ stdcall WakeConditionVariable(ptr)
Added: trunk/reactos/dll/win32/kernel32_vista/sync.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32_vista/s…
==============================================================================
--- trunk/reactos/dll/win32/kernel32_vista/sync.c (added)
+++ trunk/reactos/dll/win32/kernel32_vista/sync.c [iso-8859-1] Tue May 30 21:39:50 2017
@@ -0,0 +1,150 @@
+#include "k32_vista.h"
+
+#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);
+
+ULONG
+NTAPI
+RtlNtStatusToDosError(IN NTSTATUS Status);
+
+VOID
+WINAPI
+AcquireSRWLockExclusive(PSRWLOCK Lock)
+{
+ RtlAcquireSRWLockExclusive((PRTL_SRWLOCK)Lock);
+}
+
+VOID
+WINAPI
+AcquireSRWLockShared(PSRWLOCK Lock)
+{
+ RtlAcquireSRWLockShared((PRTL_SRWLOCK)Lock);
+}
+
+VOID
+WINAPI
+InitializeConditionVariable(PCONDITION_VARIABLE ConditionVariable)
+{
+ RtlInitializeConditionVariable((PRTL_CONDITION_VARIABLE)ConditionVariable);
+}
+
+VOID
+WINAPI
+InitializeSRWLock(PSRWLOCK Lock)
+{
+ RtlInitializeSRWLock((PRTL_SRWLOCK)Lock);
+}
+
+VOID
+WINAPI
+ReleaseSRWLockExclusive(PSRWLOCK Lock)
+{
+ RtlReleaseSRWLockExclusive((PRTL_SRWLOCK)Lock);
+}
+
+VOID
+WINAPI
+ReleaseSRWLockShared(PSRWLOCK Lock)
+{
+ RtlReleaseSRWLockShared((PRTL_SRWLOCK)Lock);
+}
+
+FORCEINLINE
+PLARGE_INTEGER
+GetNtTimeout(PLARGE_INTEGER Time, DWORD Timeout)
+{
+ if (Timeout == INFINITE) return NULL;
+ Time->QuadPart = (ULONGLONG)Timeout * -10000;
+ return Time;
+}
+
+BOOL
+WINAPI
+SleepConditionVariableCS(PCONDITION_VARIABLE ConditionVariable, PCRITICAL_SECTION
CriticalSection, DWORD Timeout)
+{
+ NTSTATUS Status;
+ LARGE_INTEGER Time;
+
+ Status = RtlSleepConditionVariableCS(ConditionVariable,
(PRTL_CRITICAL_SECTION)CriticalSection, GetNtTimeout(&Time, Timeout));
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
+ return TRUE;
+}
+
+BOOL
+WINAPI
+SleepConditionVariableSRW(PCONDITION_VARIABLE ConditionVariable, PSRWLOCK Lock, DWORD
Timeout, ULONG Flags)
+{
+ NTSTATUS Status;
+ LARGE_INTEGER Time;
+
+ Status = RtlSleepConditionVariableSRW(ConditionVariable, Lock,
GetNtTimeout(&Time, Timeout), Flags);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
+ }
+ return TRUE;
+}
+
+VOID
+WINAPI
+WakeAllConditionVariable(PCONDITION_VARIABLE ConditionVariable)
+{
+ RtlWakeAllConditionVariable((PRTL_CONDITION_VARIABLE)ConditionVariable);
+}
+
+VOID
+WINAPI
+WakeConditionVariable(PCONDITION_VARIABLE ConditionVariable)
+{
+ RtlWakeConditionVariable((PRTL_CONDITION_VARIABLE)ConditionVariable);
+}
Propchange: trunk/reactos/dll/win32/kernel32_vista/sync.c
------------------------------------------------------------------------------
svn:eol-style = native