{
/* Someone is still holding it, use slow path */
FastMutex->Contention++;
- KeWaitForSingleObject(&FastMutex->Gate,
+ KeWaitForSingleObject(&FastMutex->Event,
WrExecutive,
KernelMode,
FALSE,
if (InterlockedIncrement(&FastMutex->Count) <= 0)
{
/* Someone was waiting for it, signal the waiter */
- KeSetEventBoostPriority(&FastMutex->Gate, IO_NO_INCREMENT);
+ KeSetEventBoostPriority(&FastMutex->Event, IO_NO_INCREMENT);
}
/* Lower IRQL back */
-#ifndef _WDMDDK_
-#define _WDMDDK_
+#pragma once
/* Helper macro to enable gcc's extension. */
#ifndef __GNU_EXTENSION
);
#endif
-#if (NTDDI_VERSION >= NTDDI_WS03SP1)
+/* FIXME : #if (NTDDI_VERSION >= NTDDI_WS03SP1) */
NTKERNELAPI
BOOLEAN
KeAreAllApcsDisabled(
VOID);
+/* #endif (NTDDI_VERSION >= NTDDI_WS03SP1) */
+
+#if (NTDDI_VERSION >= NTDDI_WS03SP1)
/* Guarded Mutex routines */
IN EVENT_TYPE Type,
IN BOOLEAN State);
-FORCEINLINE
-VOID
-ExInitializeFastMutex(
- OUT PFAST_MUTEX FastMutex)
-{
- FastMutex->Count = FM_LOCK_BIT;
- FastMutex->Owner = NULL;
- FastMutex->Contention = 0;
- KeInitializeEvent(&FastMutex->Event, SynchronizationEvent, FALSE);
- return;
-}
-
#if DBG
#if (NTDDI_VERSION >= NTDDI_VISTA)
CHAR EaName[1];
} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
-typedef struct _FAST_MUTEX
-{
- LONG Count;
- PKTHREAD Owner;
- ULONG Contention;
- KEVENT Gate;
- ULONG OldIrql;
+typedef struct _FAST_MUTEX {
+ volatile LONG Count;
+ PKTHREAD Owner;
+ ULONG Contention;
+ KEVENT Event;
+ ULONG OldIrql;
} FAST_MUTEX, *PFAST_MUTEX;
typedef ULONG_PTR ERESOURCE_THREAD, *PERESOURCE_THREAD;
(Item)->List.Flink = NULL; \
}
+FORCEINLINE
+VOID
+ExInitializeFastMutex(
+ OUT PFAST_MUTEX FastMutex)
+{
+ FastMutex->Count = FM_LOCK_BIT;
+ FastMutex->Owner = NULL;
+ FastMutex->Contention = 0;
+ KeInitializeEvent(&FastMutex->Event, SynchronizationEvent, FALSE);
+ return;
+}
+
#if (NTDDI_VERSION >= NTDDI_WIN2K)
NTKERNELAPI
#ifdef __cplusplus
}
#endif
-
-#endif // _WDMDDK_
struct _RTL_RANGE *Range
);
-typedef enum _EVENT_TYPE {
- NotificationEvent,
- SynchronizationEvent
-} EVENT_TYPE;
-
typedef struct _CONFIGURATION_INFORMATION {
ULONG DiskCount;
ULONG FloppyCount;
#endif
#endif // NULL
+typedef enum _EVENT_TYPE {
+ NotificationEvent,
+ SynchronizationEvent
+} EVENT_TYPE;
//
// FIXME
DWORD WINAPI SetCriticalSectionSpinCount(LPCRITICAL_SECTION,DWORD);
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD);
BOOL WINAPI InitializeSid (PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
-#if !defined(__WINDDK_H) && _WIN32_WINNT >= 0x0501
-VOID WINAPI InitializeSListHead(PSLIST_HEADER);
-#endif
+
#if (_WIN32_WINNT >= 0x0600)
VOID WINAPI InitializeSRWLock(PSRWLOCK);
#endif
#endif // !(defined (_M_AMD64) || defined (_M_IA64))
-VOID WINAPI InitializeSListHead(PSLIST_HEADER);
+#if defined(_SLIST_HEADER_) && !defined(_NTOSP_)
+
+WINBASEAPI
+VOID
+WINAPI
+InitializeSListHead (
+ IN OUT PSLIST_HEADER ListHead);
+#endif
+
USHORT WINAPI QueryDepthSList(PSLIST_HEADER);
#ifdef _MSC_VER
if (InterlockedIncrement(&FastMutex->Count) <= 0)
{
/* Someone was waiting for it, signal the waiter */
- KeSetEventBoostPriority(&FastMutex->Gate, NULL);
+ KeSetEventBoostPriority(&FastMutex->Event, NULL);
}
}
if (InterlockedIncrement(&FastMutex->Count) <= 0)
{
/* Someone was waiting for it, signal the waiter */
- KeSetEventBoostPriority(&FastMutex->Gate, NULL);
+ KeSetEventBoostPriority(&FastMutex->Event, NULL);
}
/* Lower IRQL back */
*/
VOID
NTAPI
-KeInitializeEvent(IN PKEVENT Event,
+KeInitializeEvent(OUT PKEVENT Event,
IN EVENT_TYPE Type,
IN BOOLEAN State)
{
FastMutex->Contention++;
/* Wait for the event */
- KeWaitForSingleObject(&FastMutex->Gate,
+ KeWaitForSingleObject(&FastMutex->Event,
WrMutex,
KernelMode,
FALSE,