ReactOS 0.4.16-dev-973-g9a0ff8b
ex.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  _EXHANDLE
 
struct  _ETIMER
 
struct  SYSTEM_CALLBACKS
 
struct  _HARDERROR_USER_PARAMETERS
 
struct  _UUID_CACHED_VALUES_STRUCT
 

Macros

#define HANDLE_LOW_BITS   (PAGE_SHIFT - 3)
 
#define HANDLE_HIGH_BITS   (PAGE_SHIFT - 2)
 
#define HANDLE_TAG_BITS   2
 
#define HANDLE_INDEX_BITS   (HANDLE_LOW_BITS + 2 * HANDLE_HIGH_BITS)
 
#define KERNEL_FLAG_BITS   (sizeof(ULONG_PTR) * 8 - HANDLE_INDEX_BITS - HANDLE_TAG_BITS)
 
#define MAX_FAST_REFS   7
 
#define ExAcquireRundownProtection   _ExAcquireRundownProtection
 
#define ExReleaseRundownProtection   _ExReleaseRundownProtection
 
#define ExInitializeRundownProtection   _ExInitializeRundownProtection
 
#define ExWaitForRundownProtectionRelease   _ExWaitForRundownProtectionRelease
 
#define ExRundownCompleted   _ExRundownCompleted
 
#define ExGetPreviousMode   KeGetPreviousMode
 
#define EXHANDLE_TABLE_ENTRY_LOCK_BIT   1
 
#define FREE_HANDLE_MASK   -1
 
#define LOW_LEVEL_ENTRIES   (PAGE_SIZE / sizeof(HANDLE_TABLE_ENTRY))
 
#define MID_LEVEL_ENTRIES   (PAGE_SIZE / sizeof(PHANDLE_TABLE_ENTRY))
 
#define HIGH_LEVEL_ENTRIES   (16777216 / (LOW_LEVEL_ENTRIES * MID_LEVEL_ENTRIES))
 
#define MAX_LOW_INDEX   LOW_LEVEL_ENTRIES
 
#define MAX_MID_INDEX   (MID_LEVEL_ENTRIES * LOW_LEVEL_ENTRIES)
 
#define MAX_HIGH_INDEX   (MID_LEVEL_ENTRIES * MID_LEVEL_ENTRIES * LOW_LEVEL_ENTRIES)
 
#define ExpChangeRundown(x, y, z)   (ULONG_PTR)InterlockedCompareExchangePointer(&(x)->Ptr, (PVOID)(y), (PVOID)(z))
 
#define ExpChangePushlock(x, y, z)   InterlockedCompareExchangePointer((PVOID*)(x), (PVOID)(y), (PVOID)(z))
 
#define ExpSetRundown(x, y)   InterlockedExchangePointer(&(x)->Ptr, (PVOID)(y))
 
#define ExInitializePushLock   _ExInitializePushLock
 
#define InterlockedDecrementUL(Addend)    (ULONG)InterlockedDecrement((PLONG)(Addend))
 
#define InterlockedIncrementUL(Addend)    (ULONG)InterlockedIncrement((PLONG)(Addend))
 
#define InterlockedExchangeUL(Target, Value)    (ULONG)InterlockedExchange((PLONG)(Target), (LONG)(Value))
 
#define InterlockedExchangeAddUL(Addend, Value)    (ULONG)InterlockedExchangeAdd((PLONG)(Addend), (LONG)(Value))
 
#define InterlockedCompareExchangeUL(Destination, Exchange, Comperand)    (ULONG)InterlockedCompareExchange((PLONG)(Destination), (LONG)(Exchange), (LONG)(Comperand))
 
#define InterlockedCompareExchangeSizeT(Destination, Exchange, Comperand)    (SIZE_T)InterlockedCompareExchangePointer((PVOID*)(Destination), (PVOID)(SIZE_T)(Exchange), (PVOID)(SIZE_T)(Comperand))
 
#define InterlockedExchangeSizeT(Target, Value)    (SIZE_T)InterlockedExchange((PLONG)(Target), (LONG)(Value))
 
#define ExfInterlockedCompareExchange64UL(Destination, Exchange, Comperand)    (ULONGLONG)ExfInterlockedCompareExchange64((PLONGLONG)(Destination), (PLONGLONG)(Exchange), (PLONGLONG)(Comperand))
 

Typedefs

typedef enum _WINKD_WORKER_STATE WINKD_WORKER_STATE
 
typedef union _EXHANDLE EXHANDLE
 
typedef union _EXHANDLEPEXHANDLE
 
typedef struct _ETIMER ETIMER
 
typedef struct _ETIMERPETIMER
 
typedef struct _HARDERROR_USER_PARAMETERS HARDERROR_USER_PARAMETERS
 
typedef struct _HARDERROR_USER_PARAMETERSPHARDERROR_USER_PARAMETERS
 
typedef struct _UUID_CACHED_VALUES_STRUCT UUID_CACHED_VALUES_STRUCT
 
typedef struct _UUID_CACHED_VALUES_STRUCTPUUID_CACHED_VALUES_STRUCT
 
typedef BOOLEAN(NTAPIPEX_SWEEP_HANDLE_CALLBACK) (PHANDLE_TABLE_ENTRY HandleTableEntry, HANDLE Handle, PVOID Context)
 
typedef BOOLEAN(NTAPIPEX_DUPLICATE_HANDLE_CALLBACK) (IN PEPROCESS Process, IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry, IN PHANDLE_TABLE_ENTRY NewEntry)
 
typedef BOOLEAN(NTAPIPEX_CHANGE_HANDLE_CALLBACK) (PHANDLE_TABLE_ENTRY HandleTableEntry, ULONG_PTR Context)
 

Enumerations

enum  _WINKD_WORKER_STATE { WinKdWorkerReady = 0 , WinKdWorkerStart , WinKdWorkerInitialized }
 

Functions

VOID NTAPI ExpDebuggerWorker (_In_ PVOID Context)
 
NTSTATUS NTAPI ExGetPoolTagInfo (IN PSYSTEM_POOLTAG_INFORMATION SystemInformation, IN ULONG SystemInformationLength, IN OUT PULONG ReturnLength OPTIONAL)
 
 C_ASSERT (RTL_FIELD_SIZE(UUID_CACHED_VALUES_STRUCT, GuidInit)==RTL_FIELD_SIZE(UUID, Data4))
 
BOOLEAN NTAPI ExpWin32kInit (VOID)
 
VOID NTAPI ExInit2 (VOID)
 
VOID NTAPI Phase1Initialization (IN PVOID Context)
 
VOID NTAPI ExpInitializePushLocks (VOID)
 
BOOLEAN NTAPI ExRefreshTimeZoneInformation (IN PLARGE_INTEGER SystemBootTime)
 
VOID NTAPI ExpInitializeWorkerThreads (VOID)
 
VOID NTAPI ExSwapinWorkerThreads (IN BOOLEAN AllowSwap)
 
VOID NTAPI ExpInitLookasideLists (VOID)
 
VOID NTAPI ExInitializeSystemLookasideList (IN PGENERAL_LOOKASIDE List, IN POOL_TYPE Type, IN ULONG Size, IN ULONG Tag, IN USHORT MaximumDepth, IN PLIST_ENTRY ListHead)
 
BOOLEAN NTAPI ExpInitializeCallbacks (VOID)
 
BOOLEAN NTAPI ExpUuidInitialization (VOID)
 
BOOLEAN NTAPI ExLuidInitialization (VOID)
 
VOID NTAPI ExpInitializeExecutive (IN ULONG Cpu, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID NTAPI ExShutdownSystem (VOID)
 
BOOLEAN NTAPI ExpInitializeEventImplementation (VOID)
 
BOOLEAN NTAPI ExpInitializeKeyedEventImplementation (VOID)
 
BOOLEAN NTAPI ExpInitializeEventPairImplementation (VOID)
 
BOOLEAN NTAPI ExpInitializeSemaphoreImplementation (VOID)
 
BOOLEAN NTAPI ExpInitializeMutantImplementation (VOID)
 
BOOLEAN NTAPI ExpInitializeTimerImplementation (VOID)
 
BOOLEAN NTAPI ExpInitializeProfileImplementation (VOID)
 
VOID NTAPI ExpResourceInitialization (VOID)
 
VOID NTAPI ExInitPoolLookasidePointers (VOID)
 
VOID NTAPI ExInitializeCallBack (IN OUT PEX_CALLBACK Callback)
 
PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExAllocateCallBack (IN PEX_CALLBACK_FUNCTION Function, IN PVOID Context)
 
VOID NTAPI ExFreeCallBack (IN PEX_CALLBACK_ROUTINE_BLOCK CallbackRoutineBlock)
 
BOOLEAN NTAPI ExCompareExchangeCallBack (IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK NewBlock, IN PEX_CALLBACK_ROUTINE_BLOCK OldBlock)
 
PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExReferenceCallBackBlock (IN OUT PEX_CALLBACK CallBack)
 
VOID NTAPI ExDereferenceCallBackBlock (IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK CallbackRoutineBlock)
 
PEX_CALLBACK_FUNCTION NTAPI ExGetCallBackBlockRoutine (IN PEX_CALLBACK_ROUTINE_BLOCK CallbackRoutineBlock)
 
PVOID NTAPI ExGetCallBackBlockContext (IN PEX_CALLBACK_ROUTINE_BLOCK CallbackRoutineBlock)
 
VOID NTAPI ExWaitForCallBacks (IN PEX_CALLBACK_ROUTINE_BLOCK CallbackRoutineBlock)
 
VOID FASTCALL ExfInitializeRundownProtection (OUT PEX_RUNDOWN_REF RunRef)
 
VOID FASTCALL ExfReInitializeRundownProtection (OUT PEX_RUNDOWN_REF RunRef)
 
BOOLEAN FASTCALL ExfAcquireRundownProtection (IN OUT PEX_RUNDOWN_REF RunRef)
 
BOOLEAN FASTCALL ExfAcquireRundownProtectionEx (IN OUT PEX_RUNDOWN_REF RunRef, IN ULONG Count)
 
VOID FASTCALL ExfReleaseRundownProtection (IN OUT PEX_RUNDOWN_REF RunRef)
 
VOID FASTCALL ExfReleaseRundownProtectionEx (IN OUT PEX_RUNDOWN_REF RunRef, IN ULONG Count)
 
VOID FASTCALL ExfRundownCompleted (OUT PEX_RUNDOWN_REF RunRef)
 
VOID FASTCALL ExfWaitForRundownProtectionRelease (IN OUT PEX_RUNDOWN_REF RunRef)
 
VOID NTAPI ExpInitializeHandleTables (VOID)
 
PHANDLE_TABLE NTAPI ExCreateHandleTable (IN PEPROCESS Process OPTIONAL)
 
VOID NTAPI ExUnlockHandleTableEntry (IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
 
HANDLE NTAPI ExCreateHandle (IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
 
VOID NTAPI ExDestroyHandleTable (IN PHANDLE_TABLE HandleTable, IN PVOID DestroyHandleProcedure OPTIONAL)
 
BOOLEAN NTAPI ExDestroyHandle (IN PHANDLE_TABLE HandleTable, IN HANDLE Handle, IN PHANDLE_TABLE_ENTRY HandleTableEntry OPTIONAL)
 
PHANDLE_TABLE_ENTRY NTAPI ExMapHandleToPointer (IN PHANDLE_TABLE HandleTable, IN HANDLE Handle)
 
PHANDLE_TABLE NTAPI ExDupHandleTable (IN PEPROCESS Process, IN PHANDLE_TABLE HandleTable, IN PEX_DUPLICATE_HANDLE_CALLBACK DupHandleProcedure, IN ULONG_PTR Mask)
 
BOOLEAN NTAPI ExChangeHandle (IN PHANDLE_TABLE HandleTable, IN HANDLE Handle, IN PEX_CHANGE_HANDLE_CALLBACK ChangeRoutine, IN ULONG_PTR Context)
 
VOID NTAPI ExSweepHandleTable (IN PHANDLE_TABLE HandleTable, IN PEX_SWEEP_HANDLE_CALLBACK EnumHandleProcedure, IN PVOID Context)
 
PHANDLE_TABLE_ENTRY NTAPI ExpLookupHandleTableEntry (IN PHANDLE_TABLE HandleTable, IN EXHANDLE Handle)
 
BOOLEAN NTAPI ExpLockHandleTableEntry (IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
 
LONG NTAPI ExSystemExceptionFilter (VOID)
 
FORCEINLINE VOID ExDoCallBack (IN OUT PEX_CALLBACK Callback, IN PVOID Context, IN PVOID Argument1, IN PVOID Argument2)
 
FORCEINLINE PVOID ExGetObjectFastReference (IN EX_FAST_REF FastRef)
 
FORCEINLINE ULONG ExGetCountFastReference (IN EX_FAST_REF FastRef)
 
FORCEINLINE VOID ExInitializeFastReference (OUT PEX_FAST_REF FastRef, IN OPTIONAL PVOID Object)
 
FORCEINLINE EX_FAST_REF ExAcquireFastReference (IN OUT PEX_FAST_REF FastRef)
 
FORCEINLINE BOOLEAN ExInsertFastReference (IN OUT PEX_FAST_REF FastRef, IN PVOID Object)
 
FORCEINLINE BOOLEAN ExReleaseFastReference (IN PEX_FAST_REF FastRef, IN PVOID Object)
 
FORCEINLINE EX_FAST_REF ExSwapFastReference (IN PEX_FAST_REF FastRef, IN PVOID Object)
 
FORCEINLINE EX_FAST_REF ExCompareSwapFastReference (IN PEX_FAST_REF FastRef, IN PVOID Object, IN PVOID OldObject)
 
FORCEINLINE PEX_RUNDOWN_REF ExGetRunRefForGivenProcessor (IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware, IN ULONG ProcNumber)
 
FORCEINLINE BOOLEAN _ExAcquireRundownProtection (IN PEX_RUNDOWN_REF RunRef)
 
FORCEINLINE VOID _ExReleaseRundownProtection (IN PEX_RUNDOWN_REF RunRef)
 
FORCEINLINE VOID _ExInitializeRundownProtection (IN PEX_RUNDOWN_REF RunRef)
 
FORCEINLINE VOID _ExWaitForRundownProtectionRelease (IN PEX_RUNDOWN_REF RunRef)
 
FORCEINLINE VOID _ExRundownCompleted (IN PEX_RUNDOWN_REF RunRef)
 
VOID FASTCALL ExBlockPushLock (IN PEX_PUSH_LOCK PushLock, IN PVOID WaitBlock)
 
VOID FASTCALL ExfUnblockPushLock (IN PEX_PUSH_LOCK PushLock, IN PVOID CurrentWaitBlock)
 
VOID FASTCALL ExWaitForUnblockPushLock (IN PEX_PUSH_LOCK PushLock, IN PVOID WaitBlock)
 
FORCEINLINE VOID _ExInitializePushLock (OUT PEX_PUSH_LOCK PushLock)
 
FORCEINLINE VOID ExAcquirePushLockExclusive (PEX_PUSH_LOCK PushLock)
 
FORCEINLINE BOOLEAN ExTryToAcquirePushLockExclusive (PEX_PUSH_LOCK PushLock)
 
FORCEINLINE VOID ExAcquirePushLockShared (PEX_PUSH_LOCK PushLock)
 
FORCEINLINE BOOLEAN ExConvertPushLockSharedToExclusive (IN PEX_PUSH_LOCK PushLock)
 
FORCEINLINE VOID ExWaitOnPushLock (PEX_PUSH_LOCK PushLock)
 
FORCEINLINE VOID ExReleasePushLockShared (PEX_PUSH_LOCK PushLock)
 
FORCEINLINE VOID ExReleasePushLockExclusive (PEX_PUSH_LOCK PushLock)
 
FORCEINLINE VOID ExReleasePushLock (PEX_PUSH_LOCK PushLock)
 
FORCEINLINE VOID _ExAcquireFastMutexUnsafe (IN PFAST_MUTEX FastMutex)
 
FORCEINLINE VOID _ExReleaseFastMutexUnsafe (IN OUT PFAST_MUTEX FastMutex)
 
FORCEINLINE VOID _ExAcquireFastMutex (IN PFAST_MUTEX FastMutex)
 
FORCEINLINE VOID _ExReleaseFastMutex (IN OUT PFAST_MUTEX FastMutex)
 
FORCEINLINE BOOLEAN _ExTryToAcquireFastMutex (IN OUT PFAST_MUTEX FastMutex)
 
FORCEINLINE VOID _ExEnterCriticalRegionAndAcquireFastMutexUnsafe (IN OUT PFAST_MUTEX FastMutex)
 
FORCEINLINE VOID _ExReleaseFastMutexUnsafeAndLeaveCriticalRegion (IN OUT PFAST_MUTEX FastMutex)
 
BOOLEAN NTAPI ExTryToAcquireResourceExclusiveLite (IN PERESOURCE Resource)
 
NTSTATUS ExpSetTimeZoneInformation (IN PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
 
BOOLEAN NTAPI ExAcquireTimeRefreshLock (IN BOOLEAN Wait)
 
VOID NTAPI ExReleaseTimeRefreshLock (VOID)
 
VOID NTAPI ExUpdateSystemTimeFromCmos (IN BOOLEAN UpdateInterruptTime, IN ULONG MaxSepInSeconds)
 
VOID NTAPI ExAllocateLocallyUniqueId (OUT LUID *LocallyUniqueId)
 
VOID NTAPI ExTimerRundown (VOID)
 
VOID NTAPI ExUnlockUserBuffer (PMDL Mdl)
 
NTSTATUS NTAPI ExLockUserBuffer (PVOID BaseAddress, ULONG Length, KPROCESSOR_MODE AccessMode, LOCK_OPERATION Operation, PVOID *MappedSystemVa, PMDL *OutMdl)
 
VOID NTAPI HeadlessInit (IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID NTAPI XIPInit (IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 

Variables

RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo
 
LARGE_INTEGER ExpTimeZoneBias
 
ULONG ExpTimeZoneId
 
ULONG ExpTickCountMultiplier
 
ULONG ExpLastTimeZoneBias
 
POBJECT_TYPE ExEventPairObjectType
 
POBJECT_TYPE _ExEventObjectType
 
POBJECT_TYPE _ExSemaphoreObjectType
 
FAST_MUTEX ExpEnvironmentLock
 
ERESOURCE ExpFirmwareTableResource
 
ERESOURCE ExpTimeRefreshLock
 
LIST_ENTRY ExpFirmwareTableProviderListHead
 
BOOLEAN ExpIsWinPEMode
 
ULONG ExpResourceTimeoutCount
 
LIST_ENTRY ExpSystemResourcesList
 
ULONG ExpAnsiCodePageDataOffset
 
ULONG ExpOemCodePageDataOffset
 
ULONG ExpUnicodeCaseTableDataOffset
 
PVOID ExpNlsSectionPointer
 
ULONG NtGlobalFlag
 
UNICODE_STRING NtSystemRoot
 
ULONG ExpInitializationPhase
 
ULONG ExpAltTimeZoneBias
 
LIST_ENTRY ExSystemLookasideListHead
 
PCALLBACK_OBJECT PowerStateCallback
 
LIST_ENTRY ExPoolLookasideListHead
 
LIST_ENTRY ExpNonPagedLookasideListHead
 
LIST_ENTRY ExpPagedLookasideListHead
 
KSPIN_LOCK ExpNonPagedLookasideListLock
 
KSPIN_LOCK ExpPagedLookasideListLock
 
ULONG ExCriticalWorkerThreads
 
ULONG ExDelayedWorkerThreads
 
PVOID ExpDefaultErrorPort
 
PEPROCESS ExpDefaultErrorPortProcess
 
ULONG NtMajorVersion
 
ULONG NtMinorVersion
 
ULONG NtBuildNumber
 
ULONG CmNtSpBuildNumber
 
ULONG CmNtCSDVersion
 
ULONG CmNtCSDReleaseType
 
UNICODE_STRING CmVersionString
 
UNICODE_STRING CmCSDVersionString
 
CHAR NtBuildLab []
 
WORK_QUEUE_ITEM ExpDebuggerWorkItem
 
WINKD_WORKER_STATE ExpDebuggerWork
 
PEPROCESS ExpDebuggerProcessAttach
 
PEPROCESS ExpDebuggerProcessKill
 
ULONG_PTR ExpDebuggerPageIn
 

Macro Definition Documentation

◆ ExAcquireRundownProtection

#define ExAcquireRundownProtection   _ExAcquireRundownProtection

Definition at line 138 of file ex.h.

◆ ExfInterlockedCompareExchange64UL

#define ExfInterlockedCompareExchange64UL (   Destination,
  Exchange,
  Comperand 
)     (ULONGLONG)ExfInterlockedCompareExchange64((PLONGLONG)(Destination), (PLONGLONG)(Exchange), (PLONGLONG)(Comperand))

Definition at line 1567 of file ex.h.

◆ ExGetPreviousMode

#define ExGetPreviousMode   KeGetPreviousMode

Definition at line 143 of file ex.h.

◆ EXHANDLE_TABLE_ENTRY_LOCK_BIT

#define EXHANDLE_TABLE_ENTRY_LOCK_BIT   1

Definition at line 149 of file ex.h.

◆ ExInitializePushLock

#define ExInitializePushLock   _ExInitializePushLock

Definition at line 1016 of file ex.h.

◆ ExInitializeRundownProtection

#define ExInitializeRundownProtection   _ExInitializeRundownProtection

Definition at line 140 of file ex.h.

◆ ExpChangePushlock

#define ExpChangePushlock (   x,
  y,
  z 
)    InterlockedCompareExchangePointer((PVOID*)(x), (PVOID)(y), (PVOID)(z))

Definition at line 167 of file ex.h.

◆ ExpChangeRundown

#define ExpChangeRundown (   x,
  y,
  z 
)    (ULONG_PTR)InterlockedCompareExchangePointer(&(x)->Ptr, (PVOID)(y), (PVOID)(z))

Definition at line 166 of file ex.h.

◆ ExpSetRundown

#define ExpSetRundown (   x,
  y 
)    InterlockedExchangePointer(&(x)->Ptr, (PVOID)(y))

Definition at line 168 of file ex.h.

◆ ExReleaseRundownProtection

#define ExReleaseRundownProtection   _ExReleaseRundownProtection

Definition at line 139 of file ex.h.

◆ ExRundownCompleted

#define ExRundownCompleted   _ExRundownCompleted

Definition at line 142 of file ex.h.

◆ ExWaitForRundownProtectionRelease

#define ExWaitForRundownProtectionRelease   _ExWaitForRundownProtectionRelease

Definition at line 141 of file ex.h.

◆ FREE_HANDLE_MASK

#define FREE_HANDLE_MASK   -1

Definition at line 150 of file ex.h.

◆ HANDLE_HIGH_BITS

#define HANDLE_HIGH_BITS   (PAGE_SHIFT - 2)

Definition at line 83 of file ex.h.

◆ HANDLE_INDEX_BITS

#define HANDLE_INDEX_BITS   (HANDLE_LOW_BITS + 2 * HANDLE_HIGH_BITS)

Definition at line 86 of file ex.h.

◆ HANDLE_LOW_BITS

#define HANDLE_LOW_BITS   (PAGE_SHIFT - 3)

Definition at line 82 of file ex.h.

◆ HANDLE_TAG_BITS

#define HANDLE_TAG_BITS   2

Definition at line 85 of file ex.h.

◆ HIGH_LEVEL_ENTRIES

#define HIGH_LEVEL_ENTRIES   (16777216 / (LOW_LEVEL_ENTRIES * MID_LEVEL_ENTRIES))

Definition at line 157 of file ex.h.

◆ InterlockedCompareExchangeSizeT

#define InterlockedCompareExchangeSizeT (   Destination,
  Exchange,
  Comperand 
)     (SIZE_T)InterlockedCompareExchangePointer((PVOID*)(Destination), (PVOID)(SIZE_T)(Exchange), (PVOID)(SIZE_T)(Comperand))

Definition at line 1556 of file ex.h.

◆ InterlockedCompareExchangeUL

#define InterlockedCompareExchangeUL (   Destination,
  Exchange,
  Comperand 
)     (ULONG)InterlockedCompareExchange((PLONG)(Destination), (LONG)(Exchange), (LONG)(Comperand))

Definition at line 1553 of file ex.h.

◆ InterlockedDecrementUL

#define InterlockedDecrementUL (   Addend)     (ULONG)InterlockedDecrement((PLONG)(Addend))

Definition at line 1541 of file ex.h.

◆ InterlockedExchangeAddUL

#define InterlockedExchangeAddUL (   Addend,
  Value 
)     (ULONG)InterlockedExchangeAdd((PLONG)(Addend), (LONG)(Value))

Definition at line 1550 of file ex.h.

◆ InterlockedExchangeSizeT

#define InterlockedExchangeSizeT (   Target,
  Value 
)     (SIZE_T)InterlockedExchange((PLONG)(Target), (LONG)(Value))

Definition at line 1563 of file ex.h.

◆ InterlockedExchangeUL

#define InterlockedExchangeUL (   Target,
  Value 
)     (ULONG)InterlockedExchange((PLONG)(Target), (LONG)(Value))

Definition at line 1547 of file ex.h.

◆ InterlockedIncrementUL

#define InterlockedIncrementUL (   Addend)     (ULONG)InterlockedIncrement((PLONG)(Addend))

Definition at line 1544 of file ex.h.

◆ KERNEL_FLAG_BITS

#define KERNEL_FLAG_BITS   (sizeof(ULONG_PTR) * 8 - HANDLE_INDEX_BITS - HANDLE_TAG_BITS)

Definition at line 87 of file ex.h.

◆ LOW_LEVEL_ENTRIES

#define LOW_LEVEL_ENTRIES   (PAGE_SIZE / sizeof(HANDLE_TABLE_ENTRY))

Definition at line 155 of file ex.h.

◆ MAX_FAST_REFS

#define MAX_FAST_REFS   7

Definition at line 136 of file ex.h.

◆ MAX_HIGH_INDEX

Definition at line 164 of file ex.h.

◆ MAX_LOW_INDEX

#define MAX_LOW_INDEX   LOW_LEVEL_ENTRIES

Definition at line 162 of file ex.h.

◆ MAX_MID_INDEX

#define MAX_MID_INDEX   (MID_LEVEL_ENTRIES * LOW_LEVEL_ENTRIES)

Definition at line 163 of file ex.h.

◆ MID_LEVEL_ENTRIES

#define MID_LEVEL_ENTRIES   (PAGE_SIZE / sizeof(PHANDLE_TABLE_ENTRY))

Definition at line 156 of file ex.h.

Typedef Documentation

◆ ETIMER

◆ EXHANDLE

typedef union _EXHANDLE EXHANDLE

◆ HARDERROR_USER_PARAMETERS

◆ PETIMER

typedef struct _ETIMER * PETIMER

◆ PEX_CHANGE_HANDLE_CALLBACK

typedef BOOLEAN(NTAPI * PEX_CHANGE_HANDLE_CALLBACK) (PHANDLE_TABLE_ENTRY HandleTableEntry, ULONG_PTR Context)

Definition at line 451 of file ex.h.

◆ PEX_DUPLICATE_HANDLE_CALLBACK

typedef BOOLEAN(NTAPI * PEX_DUPLICATE_HANDLE_CALLBACK) (IN PEPROCESS Process, IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry, IN PHANDLE_TABLE_ENTRY NewEntry)

Definition at line 443 of file ex.h.

◆ PEX_SWEEP_HANDLE_CALLBACK

typedef BOOLEAN(NTAPI * PEX_SWEEP_HANDLE_CALLBACK) (PHANDLE_TABLE_ENTRY HandleTableEntry, HANDLE Handle, PVOID Context)

Definition at line 436 of file ex.h.

◆ PEXHANDLE

typedef union _EXHANDLE * PEXHANDLE

◆ PHARDERROR_USER_PARAMETERS

◆ PUUID_CACHED_VALUES_STRUCT

◆ UUID_CACHED_VALUES_STRUCT

◆ WINKD_WORKER_STATE

Enumeration Type Documentation

◆ _WINKD_WORKER_STATE

Enumerator
WinKdWorkerReady 
WinKdWorkerStart 
WinKdWorkerInitialized 

Definition at line 60 of file ex.h.

61{
enum _WINKD_WORKER_STATE WINKD_WORKER_STATE
@ WinKdWorkerStart
Definition: ex.h:63
@ WinKdWorkerReady
Definition: ex.h:62
@ WinKdWorkerInitialized
Definition: ex.h:64

Function Documentation

◆ _ExAcquireFastMutex()

FORCEINLINE VOID _ExAcquireFastMutex ( IN PFAST_MUTEX  FastMutex)

Definition at line 1378 of file ex.h.

1379{
1380 KIRQL OldIrql;
1382
1383 /* Raise IRQL to APC */
1385
1386 /* Decrease the count */
1387 if (InterlockedDecrement(&FastMutex->Count))
1388 {
1389 /* Someone is still holding it, use slow path */
1390 KiAcquireFastMutex(FastMutex);
1391 }
1392
1393 /* Set the owner and IRQL */
1394 FastMutex->Owner = KeGetCurrentThread();
1395 FastMutex->OldIrql = OldIrql;
1396}
#define InterlockedDecrement
Definition: armddk.h:52
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define KeGetCurrentThread
Definition: hal.h:55
#define ASSERT(a)
Definition: mode.c:44
VOID FASTCALL KiAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: wait.c:107
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

Referenced by ExAcquireFastMutex().

◆ _ExAcquireFastMutexUnsafe()

FORCEINLINE VOID _ExAcquireFastMutexUnsafe ( IN PFAST_MUTEX  FastMutex)

Definition at line 1333 of file ex.h.

1334{
1336
1337 /* Sanity check */
1339 (Thread->CombinedApcDisable != 0) ||
1340 (Thread->Teb == NULL) ||
1341 (Thread->Teb >= (PTEB)MM_SYSTEM_RANGE_START));
1342 ASSERT(FastMutex->Owner != Thread);
1343
1344 /* Decrease the count */
1345 if (InterlockedDecrement(&FastMutex->Count))
1346 {
1347 /* Someone is still holding it, use slow path */
1348 KiAcquireFastMutex(FastMutex);
1349 }
1350
1351 /* Set the owner */
1352 FastMutex->Owner = Thread;
1353}
#define MM_SYSTEM_RANGE_START
Definition: armddk.h:18
#define NULL
Definition: types.h:112
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
Definition: compat.h:836

Referenced by _ExEnterCriticalRegionAndAcquireFastMutexUnsafe(), and ExAcquireFastMutexUnsafe().

◆ _ExAcquireRundownProtection()

FORCEINLINE BOOLEAN _ExAcquireRundownProtection ( IN PEX_RUNDOWN_REF  RunRef)

Definition at line 823 of file ex.h.

824{
825 ULONG_PTR Value, NewValue;
826
827 /* Get the current value and mask the active bit */
828 Value = RunRef->Count &~ EX_RUNDOWN_ACTIVE;
829
830 /* Add a reference */
831 NewValue = Value + EX_RUNDOWN_COUNT_INC;
832
833 /* Change the value */
834 NewValue = ExpChangeRundown(RunRef, NewValue, Value);
835 if (NewValue != Value)
836 {
837 /* Rundown was active, use long path */
838 return ExfAcquireRundownProtection(RunRef);
839 }
840
841 /* Success */
842 return TRUE;
843}
#define TRUE
Definition: types.h:120
#define ExpChangeRundown(x, y, z)
Definition: ex.h:166
BOOLEAN FASTCALL ExfAcquireRundownProtection(IN OUT PEX_RUNDOWN_REF RunRef)
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define EX_RUNDOWN_COUNT_INC

Referenced by ExfAcquireRundownProtectionCacheAware().

◆ _ExEnterCriticalRegionAndAcquireFastMutexUnsafe()

FORCEINLINE VOID _ExEnterCriticalRegionAndAcquireFastMutexUnsafe ( IN OUT PFAST_MUTEX  FastMutex)

Definition at line 1449 of file ex.h.

1450{
1451 /* Enter the Critical Region */
1453
1454 /* Acquire the mutex unsafely */
1455 _ExAcquireFastMutexUnsafe(FastMutex);
1456}
FORCEINLINE VOID _ExAcquireFastMutexUnsafe(IN PFAST_MUTEX FastMutex)
Definition: ex.h:1333
#define KeEnterCriticalRegion()
Definition: ke_x.h:88

Referenced by ExEnterCriticalRegionAndAcquireFastMutexUnsafe().

◆ _ExInitializePushLock()

FORCEINLINE VOID _ExInitializePushLock ( OUT PEX_PUSH_LOCK  PushLock)

Definition at line 1011 of file ex.h.

1012{
1013 /* Set the value to 0 */
1014 PushLock->Ptr = 0;
1015}

◆ _ExInitializeRundownProtection()

FORCEINLINE VOID _ExInitializeRundownProtection ( IN PEX_RUNDOWN_REF  RunRef)

Definition at line 907 of file ex.h.

908{
909 /* Set the count to zero */
910 RunRef->Count = 0;
911}

Referenced by ExAllocateCacheAwareRundownProtection(), and ExInitializeRundownProtectionCacheAware().

◆ _ExReleaseFastMutex()

FORCEINLINE VOID _ExReleaseFastMutex ( IN OUT PFAST_MUTEX  FastMutex)

Definition at line 1400 of file ex.h.

1401{
1402 KIRQL OldIrql;
1404
1405 /* Erase the owner */
1406 FastMutex->Owner = NULL;
1407 OldIrql = (KIRQL)FastMutex->OldIrql;
1408
1409 /* Increase the count */
1410 if (InterlockedIncrement(&FastMutex->Count) <= 0)
1411 {
1412 /* Someone was waiting for it, signal the waiter */
1413 KeSetEventBoostPriority(&FastMutex->Event, NULL);
1414 }
1415
1416 /* Lower IRQL back */
1418}
#define InterlockedIncrement
Definition: armddk.h:53
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
VOID NTAPI KeSetEventBoostPriority(IN PKEVENT Event, IN PKTHREAD *WaitingThread OPTIONAL)
Definition: eventobj.c:229
if(dx< 0)
Definition: linetemp.h:194

Referenced by ExReleaseFastMutex().

◆ _ExReleaseFastMutexUnsafe()

FORCEINLINE VOID _ExReleaseFastMutexUnsafe ( IN OUT PFAST_MUTEX  FastMutex)

Definition at line 1357 of file ex.h.

1358{
1360 (KeGetCurrentThread()->CombinedApcDisable != 0) ||
1361 (KeGetCurrentThread()->Teb == NULL) ||
1363 ASSERT(FastMutex->Owner == KeGetCurrentThread());
1364
1365 /* Erase the owner */
1366 FastMutex->Owner = NULL;
1367
1368 /* Increase the count */
1369 if (InterlockedIncrement(&FastMutex->Count) <= 0)
1370 {
1371 /* Someone was waiting for it, signal the waiter */
1372 KeSetEventBoostPriority(&FastMutex->Event, NULL);
1373 }
1374}

Referenced by _ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(), and ExReleaseFastMutexUnsafe().

◆ _ExReleaseFastMutexUnsafeAndLeaveCriticalRegion()

FORCEINLINE VOID _ExReleaseFastMutexUnsafeAndLeaveCriticalRegion ( IN OUT PFAST_MUTEX  FastMutex)

Definition at line 1460 of file ex.h.

1461{
1462 /* Release the mutex unsafely */
1463 _ExReleaseFastMutexUnsafe(FastMutex);
1464
1465 /* Leave the critical region */
1467}
FORCEINLINE VOID _ExReleaseFastMutexUnsafe(IN OUT PFAST_MUTEX FastMutex)
Definition: ex.h:1357
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119

Referenced by ExReleaseFastMutexUnsafeAndLeaveCriticalRegion().

◆ _ExReleaseRundownProtection()

FORCEINLINE VOID _ExReleaseRundownProtection ( IN PEX_RUNDOWN_REF  RunRef)

Definition at line 864 of file ex.h.

865{
866 ULONG_PTR Value, NewValue;
867
868 /* Get the current value and mask the active bit */
869 Value = RunRef->Count &~ EX_RUNDOWN_ACTIVE;
870
871 /* Remove a reference */
872 NewValue = Value - EX_RUNDOWN_COUNT_INC;
873
874 /* Change the value */
875 NewValue = ExpChangeRundown(RunRef, NewValue, Value);
876
877 /* Check if the rundown was active */
878 if (NewValue != Value)
879 {
880 /* Rundown was active, use long path */
882 }
883 else
884 {
885 /* Sanity check */
887 }
888}
VOID FASTCALL ExfReleaseRundownProtection(IN OUT PEX_RUNDOWN_REF RunRef)
CCHAR KeNumberProcessors
Definition: processor.c:19

Referenced by ExfReleaseRundownProtectionCacheAware().

◆ _ExRundownCompleted()

FORCEINLINE VOID _ExRundownCompleted ( IN PEX_RUNDOWN_REF  RunRef)

Definition at line 961 of file ex.h.

962{
963 /* Sanity check */
964 ASSERT((RunRef->Count & EX_RUNDOWN_ACTIVE) != 0);
965
966 /* Mark the counter as active */
968}
#define ExpSetRundown(x, y)
Definition: ex.h:168
#define EX_RUNDOWN_ACTIVE

◆ _ExTryToAcquireFastMutex()

FORCEINLINE BOOLEAN _ExTryToAcquireFastMutex ( IN OUT PFAST_MUTEX  FastMutex)

Definition at line 1422 of file ex.h.

1423{
1424 KIRQL OldIrql;
1426
1427 /* Raise to APC_LEVEL */
1429
1430 /* Check if we can quickly acquire it */
1431 if (InterlockedCompareExchange(&FastMutex->Count, 0, 1) == 1)
1432 {
1433 /* We have, set us as owners */
1434 FastMutex->Owner = KeGetCurrentThread();
1435 FastMutex->OldIrql = OldIrql;
1436 return TRUE;
1437 }
1438 else
1439 {
1440 /* Acquire attempt failed */
1443 return FALSE;
1444 }
1445}
#define FALSE
Definition: types.h:117
#define InterlockedCompareExchange
Definition: interlocked.h:104
#define YieldProcessor
Definition: ke.h:48

Referenced by ExTryToAcquireFastMutex().

◆ _ExWaitForRundownProtectionRelease()

FORCEINLINE VOID _ExWaitForRundownProtectionRelease ( IN PEX_RUNDOWN_REF  RunRef)

Definition at line 931 of file ex.h.

932{
934
935 /* Set the active bit */
937 if ((Value) && (Value != EX_RUNDOWN_ACTIVE))
938 {
939 /* If the the rundown wasn't already active, then take the long path */
941 }
942}
VOID FASTCALL ExfWaitForRundownProtectionRelease(IN OUT PEX_RUNDOWN_REF RunRef)

◆ C_ASSERT()

C_ASSERT ( RTL_FIELD_SIZE(UUID_CACHED_VALUES_STRUCT, GuidInit)  = =RTL_FIELD_SIZE(UUID, Data4))

◆ ExAcquireFastReference()

FORCEINLINE EX_FAST_REF ExAcquireFastReference ( IN OUT PEX_FAST_REF  FastRef)

Definition at line 620 of file ex.h.

621{
622 EX_FAST_REF OldValue, NewValue;
623
624 /* Start reference loop */
625 for (;;)
626 {
627 /* Get the current reference count */
628 OldValue = *FastRef;
629 if (OldValue.RefCnt)
630 {
631 /* Increase the reference count */
632 NewValue.Value = OldValue.Value - 1;
633 NewValue.Object = ExpChangePushlock(&FastRef->Object,
634 NewValue.Object,
635 OldValue.Object);
636 if (NewValue.Object != OldValue.Object) continue;
637 }
638
639 /* We are done */
640 break;
641 }
642
643 /* Return the old value */
644 return OldValue;
645}
#define ExpChangePushlock(x, y, z)
Definition: ex.h:167
PVOID Object
Definition: extypes.h:422
ULONG_PTR Value
Definition: extypes.h:424
ULONG_PTR RefCnt
Definition: extypes.h:423

Referenced by ExReferenceCallBackBlock(), ObFastReferenceObject(), and ObpReferenceSecurityDescriptor().

◆ ExAcquirePushLockExclusive()

FORCEINLINE VOID ExAcquirePushLockExclusive ( PEX_PUSH_LOCK  PushLock)

◆ ExAcquirePushLockShared()

FORCEINLINE VOID ExAcquirePushLockShared ( PEX_PUSH_LOCK  PushLock)

Definition at line 1108 of file ex.h.

1109{
1110 EX_PUSH_LOCK NewValue;
1111
1112 /* Try acquiring the lock */
1114 if (ExpChangePushlock(PushLock, NewValue.Ptr, 0))
1115 {
1116 /* Someone changed it, use the slow path */
1117 ExfAcquirePushLockShared(PushLock);
1118 }
1119
1120 /* Sanity checks */
1121 ASSERT(PushLock->Locked);
1122}
#define EX_PUSH_LOCK_SHARE_INC
Definition: Object.c:33
#define EX_PUSH_LOCK_LOCK
Definition: Object.c:29
VOID FASTCALL ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: pushlock.c:645
ULONG_PTR Value
Definition: extypes.h:465
PVOID Ptr
Definition: extypes.h:466
ULONG_PTR Locked
Definition: extypes.h:459

Referenced by CmpDoFlushAll(), CmpDoFlushNextHive(), ExpAllocateHandleTableEntry(), MiLockProcessWorkingSetShared(), MiLockWorkingSetShared(), NtSetInformationProcess(), NtSetInformationThread(), ObpAcquireDirectoryLockShared(), ObpSdAcquireLockShared(), PsGetNextProcessThread(), PspLockProcessSecurityShared(), PspLockThreadSecurityShared(), and QSI_DEF().

◆ ExAcquireTimeRefreshLock()

BOOLEAN NTAPI ExAcquireTimeRefreshLock ( IN BOOLEAN  Wait)

Definition at line 145 of file time.c.

146{
147 /* Block APCs */
149
150 /* Attempt lock acquisition */
152 {
153 /* Lock was not acquired, enable APCs and fail */
155 return FALSE;
156 }
157
158 /* Lock has been acquired */
159 return TRUE;
160}
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
ERESOURCE ExpTimeRefreshLock
Definition: time.c:27
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170

Referenced by ExSetTimerResolution(), and KdpTimeSlipWork().

◆ ExAllocateCallBack()

PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExAllocateCallBack ( IN PEX_CALLBACK_FUNCTION  Function,
IN PVOID  Context 
)

Definition at line 54 of file callback.c.

56{
57 PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock;
58
59 /* Allocate a callback */
60 CallbackBlock = ExAllocatePoolWithTag(PagedPool,
63 if (CallbackBlock)
64 {
65 /* Initialize it */
66 CallbackBlock->Function = Function;
67 CallbackBlock->Context = Context;
69 }
70
71 /* Return it */
72 return CallbackBlock;
73}
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
Definition: cdrom.h:1156
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define ExInitializeRundownProtection
Definition: ex.h:140
PEX_CALLBACK_FUNCTION Function
Definition: extypes.h:538
EX_RUNDOWN_REF RundownProtect
Definition: extypes.h:537
#define TAG_CALLBACK_ROUTINE_BLOCK
Definition: tag.h:21

Referenced by PsSetCreateProcessNotifyRoutine(), PsSetCreateThreadNotifyRoutine(), PsSetLoadImageNotifyRoutine(), and TestPrivateFunctions().

◆ ExAllocateLocallyUniqueId()

VOID NTAPI ExAllocateLocallyUniqueId ( OUT LUID LocallyUniqueId)

Definition at line 335 of file uuid.c.

336{
337 /* Atomically increment the luid */
338 *(LONG64*)LocallyUniqueId = InterlockedExchangeAdd64(&ExpLuid.QuadPart,
340}
#define InterlockedExchangeAdd64
Definition: interlocked.h:186
ULONG ExpLuidIncrement
Definition: uuid.c:42
LARGE_INTEGER ExpLuid
Definition: uuid.c:43
int64_t LONG64
Definition: typedefs.h:68
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by NtAdjustGroupsToken(), NtAdjustPrivilegesToken(), NtAllocateLocallyUniqueId(), NtSetInformationToken(), SeCreateAccessStateEx(), SepCreateToken(), SepDuplicateToken(), and SepPerformTokenFiltering().

◆ ExBlockPushLock()

VOID FASTCALL ExBlockPushLock ( IN PEX_PUSH_LOCK  PushLock,
IN PVOID  WaitBlock 
)

◆ ExChangeHandle()

BOOLEAN NTAPI ExChangeHandle ( IN PHANDLE_TABLE  HandleTable,
IN HANDLE  Handle,
IN PEX_CHANGE_HANDLE_CALLBACK  ChangeRoutine,
IN ULONG_PTR  Context 
)

Definition at line 1189 of file handle.c.

1193{
1194 EXHANDLE ExHandle;
1195 PHANDLE_TABLE_ENTRY HandleTableEntry;
1197 PAGED_CODE();
1198
1199 /* Set the handle value */
1200 ExHandle.GenericHandleOverlay = Handle;
1201
1202 /* Find the entry for this handle */
1203 HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, ExHandle);
1204
1205 /* Make sure that we found an entry, and that it's valid */
1206 if (!(HandleTableEntry) ||
1207 !(HandleTableEntry->Object) ||
1208 (HandleTableEntry->NextFreeTableEntry == -2))
1209 {
1210 /* It isn't, fail */
1211 return FALSE;
1212 }
1213
1214 /* Enter a critical region */
1216
1217 /* Try locking the handle entry */
1218 if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1219 {
1220 /* Call the change routine and unlock the entry */
1221 Result = ChangeRoutine(HandleTableEntry, Context);
1222 ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
1223 }
1224
1225 /* Leave the critical region and return the callback result */
1227 return Result;
1228}
#define PAGED_CODE()
unsigned char BOOLEAN
ULONG Handle
Definition: gdb_input.c:15
static XMS_HANDLE HandleTable[XMS_MAX_HANDLES]
Definition: himem.c:83
PHANDLE_TABLE_ENTRY NTAPI ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN EXHANDLE Handle)
Definition: handle.c:43
BOOLEAN NTAPI ExpLockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:884
VOID NTAPI ExUnlockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:923
Definition: extypes.h:596
PVOID Object
Definition: extypes.h:599
LONG NextFreeTableEntry
Definition: extypes.h:612
Definition: ex.h:90
HANDLE GenericHandleOverlay
Definition: ex.h:105
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by NtSetInformationObject(), and ObSetHandleAttributes().

◆ ExCompareExchangeCallBack()

BOOLEAN NTAPI ExCompareExchangeCallBack ( IN OUT PEX_CALLBACK  CallBack,
IN PEX_CALLBACK_ROUTINE_BLOCK  NewBlock,
IN PEX_CALLBACK_ROUTINE_BLOCK  OldBlock 
)

Definition at line 170 of file callback.c.

173{
174 EX_FAST_REF OldValue;
175 PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock;
176 ULONG Count;
177
178 /* Check that we have a new block */
179 if (NewBlock)
180 {
181 /* Acquire rundown */
182 if (!ExfAcquireRundownProtectionEx(&NewBlock->RundownProtect,
183 MAX_FAST_REFS + 1))
184 {
185 /* This should never happen */
186 ASSERTMSG("Callback block is already undergoing rundown\n", FALSE);
187 return FALSE;
188 }
189 }
190
191 /* Do the swap */
192 OldValue = ExCompareSwapFastReference(&CallBack->RoutineBlock,
193 NewBlock,
194 OldBlock);
195
196 /* Get the routine block */
197 CallbackBlock = ExGetObjectFastReference(OldValue);
198 Count = ExGetCountFastReference(OldValue);
199
200 /* Make sure the swap worked */
201 if (CallbackBlock == OldBlock)
202 {
203 /* Make sure we replaced a valid pointer */
204 if (CallbackBlock)
205 {
206 /* Acquire the flush lock and immediately release it */
209
210 /* Release rundown protection */
213 Count + 1);
214 }
215
216 /* Compare worked */
217 return TRUE;
218 }
219 else
220 {
221 /* It failed, check if we had a block */
222 if (NewBlock)
223 {
224 /* We did, remove the references that we had added */
225 ExfReleaseRundownProtectionEx(&NewBlock->RundownProtect,
226 MAX_FAST_REFS + 1);
227 }
228
229 /* Return failure */
230 return FALSE;
231 }
232}
#define MAX_FAST_REFS
Definition: ex.h:136
FORCEINLINE ULONG ExGetCountFastReference(IN EX_FAST_REF FastRef)
Definition: ex.h:591
FORCEINLINE EX_FAST_REF ExCompareSwapFastReference(IN PEX_FAST_REF FastRef, IN PVOID Object, IN PVOID OldObject)
Definition: ex.h:750
FORCEINLINE PVOID ExGetObjectFastReference(IN EX_FAST_REF FastRef)
Definition: ex.h:583
FORCEINLINE VOID ExWaitOnPushLock(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1181
int Count
Definition: noreturn.cpp:7
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
EX_PUSH_LOCK ExpCallBackFlush
Definition: callback.c:40
BOOLEAN FASTCALL ExfAcquireRundownProtectionEx(IN PEX_RUNDOWN_REF RunRef, IN ULONG Count)
Definition: rundown.c:78
VOID FASTCALL ExfReleaseRundownProtectionEx(IN PEX_RUNDOWN_REF RunRef, IN ULONG Count)
Definition: rundown.c:260
uint32_t ULONG
Definition: typedefs.h:59

Referenced by PsRemoveCreateThreadNotifyRoutine(), PsRemoveLoadImageNotifyRoutine(), PsSetCreateProcessNotifyRoutine(), PsSetCreateThreadNotifyRoutine(), and PsSetLoadImageNotifyRoutine().

◆ ExCompareSwapFastReference()

FORCEINLINE EX_FAST_REF ExCompareSwapFastReference ( IN PEX_FAST_REF  FastRef,
IN PVOID  Object,
IN PVOID  OldObject 
)

Definition at line 750 of file ex.h.

753{
754 EX_FAST_REF OldValue, NewValue;
755
756 /* Sanity check and start swap loop */
758 for (;;)
759 {
760 /* Get the current value */
761 OldValue = *FastRef;
762
763 /* Make sure there's enough references to swap */
764 if (!((OldValue.Value ^ (ULONG_PTR)OldObject) <= MAX_FAST_REFS)) break;
765
766 /* Check if we have an object to swap */
767 if (Object)
768 {
769 /* Set up the value with maximum fast references */
770 NewValue.Value = (ULONG_PTR)Object | MAX_FAST_REFS;
771 }
772 else
773 {
774 /* Write the object address itself (which is empty) */
775 NewValue.Value = (ULONG_PTR)Object;
776 }
777
778 /* Do the actual compare exchange */
779 NewValue.Object = ExpChangePushlock(&FastRef->Object,
780 NewValue.Object,
781 OldValue.Object);
782 if (NewValue.Object != OldValue.Object) continue;
783
784 /* All done */
785 break;
786 }
787
788 /* Return the old value */
789 return OldValue;
790}
#define ULONG_PTR
Definition: config.h:101
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

Referenced by ExCompareExchangeCallBack(), and ObSetSecurityDescriptorInfo().

◆ ExConvertPushLockSharedToExclusive()

FORCEINLINE BOOLEAN ExConvertPushLockSharedToExclusive ( IN PEX_PUSH_LOCK  PushLock)

Definition at line 1142 of file ex.h.

1143{
1144 EX_PUSH_LOCK OldValue;
1145
1146 /* Set the expected old value */
1148
1149 /* Try converting the lock */
1150 if (ExpChangePushlock(PushLock, EX_PUSH_LOCK_LOCK, OldValue.Value) !=
1151 OldValue.Ptr)
1152 {
1153 /* Conversion failed */
1154 return FALSE;
1155 }
1156
1157 /* Sanity check */
1158 ASSERT(PushLock->Locked);
1159 return TRUE;
1160}

Referenced by CmpTryToConvertKcbSharedToExclusive(), MiConvertSharedWorkingSetLockToExclusive(), and ObpLookupEntryDirectory().

◆ ExCreateHandle()

HANDLE NTAPI ExCreateHandle ( IN PHANDLE_TABLE  HandleTable,
IN PHANDLE_TABLE_ENTRY  HandleTableEntry 
)

Definition at line 827 of file handle.c.

829{
831 PHANDLE_TABLE_ENTRY NewEntry;
832 PAGED_CODE();
833
834 /* Start with a clean handle */
835 Handle.GenericHandleOverlay = NULL;
836
837 /* Allocate a new entry */
839 if (NewEntry)
840 {
841 /* Enter a critical region */
843
844 /* Write the entry */
845 *NewEntry = *HandleTableEntry;
846
847 /* Unlock it and leave the critical region */
850 }
851
852 /* Return the handle value */
853 return Handle.GenericHandleOverlay;
854}
PHANDLE_TABLE_ENTRY NTAPI ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable, OUT PEXHANDLE NewHandle)
Definition: handle.c:683

Referenced by ObDuplicateObject(), ObpCreateHandle(), ObpCreateUnnamedHandle(), PspCreateProcess(), PspCreateThread(), and RtlpCreateAtomHandle().

◆ ExCreateHandleTable()

PHANDLE_TABLE NTAPI ExCreateHandleTable ( IN PEPROCESS Process  OPTIONAL)

Definition at line 801 of file handle.c.

802{
804 PAGED_CODE();
805
806 /* Allocate the handle table */
808 if (!HandleTable) return NULL;
809
810 /* Acquire the handle table lock */
813
814 /* Insert it into the list */
816
817 /* Release the lock */
820
821 /* Return the handle table */
822 return HandleTable;
823}
#define InsertTailList(ListHead, Entry)
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1039
FORCEINLINE VOID ExReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1255
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
PHANDLE_TABLE NTAPI ExpAllocateHandleTable(IN PEPROCESS Process OPTIONAL, IN BOOLEAN NewTable)
Definition: handle.c:331
EX_PUSH_LOCK HandleTableListLock
Definition: handle.c:19
LIST_ENTRY HandleTableListHead
Definition: handle.c:18

Referenced by ObInitProcess(), ObInitSystem(), PspInitPhase0(), and RtlpCreateAtomHandleTable().

◆ ExDereferenceCallBackBlock()

VOID NTAPI ExDereferenceCallBackBlock ( IN OUT PEX_CALLBACK  CallBack,
IN PEX_CALLBACK_ROUTINE_BLOCK  CallbackRoutineBlock 
)

Definition at line 109 of file callback.c.

111{
112 /* Release a fast reference */
113 if (!ExReleaseFastReference(&CallBack->RoutineBlock, CallbackBlock))
114 {
115 /* Take slow path */
116 ExReleaseRundownProtection(&CallbackBlock->RundownProtect);
117 }
118}
FORCEINLINE BOOLEAN ExReleaseFastReference(IN PEX_FAST_REF FastRef, IN PVOID Object)
Definition: ex.h:688
#define ExReleaseRundownProtection
Definition: ex.h:139

Referenced by ExDoCallBack(), PsRemoveCreateThreadNotifyRoutine(), PsRemoveLoadImageNotifyRoutine(), and PsSetCreateProcessNotifyRoutine().

◆ ExDestroyHandle()

BOOLEAN NTAPI ExDestroyHandle ( IN PHANDLE_TABLE  HandleTable,
IN HANDLE  Handle,
IN PHANDLE_TABLE_ENTRY HandleTableEntry  OPTIONAL 
)

Definition at line 984 of file handle.c.

987{
988 EXHANDLE ExHandle;
990 PAGED_CODE();
991
992 /* Setup the actual handle value */
993 ExHandle.GenericHandleOverlay = Handle;
994
995 /* Enter a critical region and check if we have to lookup the handle */
997 if (!HandleTableEntry)
998 {
999 /* Lookup the entry */
1000 HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, ExHandle);
1001
1002 /* Make sure that we found an entry, and that it's valid */
1003 if (!(HandleTableEntry) ||
1004 !(HandleTableEntry->Object) ||
1005 (HandleTableEntry->NextFreeTableEntry == -2))
1006 {
1007 /* Invalid handle, fail */
1009 return FALSE;
1010 }
1011
1012 /* Lock the entry */
1013 if (!ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1014 {
1015 /* Couldn't lock, fail */
1017 return FALSE;
1018 }
1019 }
1020 else
1021 {
1022 /* Make sure the handle is locked */
1023 ASSERT((HandleTableEntry->Value & EXHANDLE_TABLE_ENTRY_LOCK_BIT) == 0);
1024 }
1025
1026 /* Clear the handle */
1027 Object = InterlockedExchangePointer((PVOID*)&HandleTableEntry->Object, NULL);
1028
1029 /* Sanity checks */
1030 ASSERT(Object != NULL);
1032
1033 /* Unblock the pushlock */
1034 ExfUnblockPushLock(&HandleTable->HandleContentionEvent, NULL);
1035
1036 /* Free the actual entry */
1037 ExpFreeHandleTableEntry(HandleTable, ExHandle, HandleTableEntry);
1038
1039 /* If we got here, return success */
1041 return TRUE;
1042}
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
#define EXHANDLE_TABLE_ENTRY_LOCK_BIT
Definition: ex.h:149
VOID NTAPI ExpFreeHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN EXHANDLE Handle, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:279
VOID FASTCALL ExfUnblockPushLock(PEX_PUSH_LOCK PushLock, PVOID CurrentWaitBlock)
Definition: pushlock.c:1205

Referenced by ObpCloseHandleTableEntry(), PspDeleteProcess(), PspDeleteThread(), RtlpCloseHandleCallback(), RtlpCreateAtomHandle(), and RtlpFreeAtomHandle().

◆ ExDestroyHandleTable()

VOID NTAPI ExDestroyHandleTable ( IN PHANDLE_TABLE  HandleTable,
IN PVOID DestroyHandleProcedure  OPTIONAL 
)

Definition at line 963 of file handle.c.

965{
966 PAGED_CODE();
967
968 /* Remove the handle from the list */
970
971 /* Check if we have a destroy callback */
972 if (DestroyHandleProcedure)
973 {
974 /* FIXME: */
975 ASSERT(FALSE);
976 }
977
978 /* Free the handle table */
980}
VOID NTAPI ExRemoveHandleTable(IN PHANDLE_TABLE HandleTable)
Definition: handle.c:944
VOID NTAPI ExpFreeHandleTable(IN PHANDLE_TABLE HandleTable)
Definition: handle.c:202

Referenced by ObKillProcess(), and RtlpDestroyAtomHandleTable().

◆ ExDoCallBack()

FORCEINLINE VOID ExDoCallBack ( IN OUT PEX_CALLBACK  Callback,
IN PVOID  Context,
IN PVOID  Argument1,
IN PVOID  Argument2 
)

Definition at line 556 of file ex.h.

560{
561 PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock;
563
564 /* Reference the block */
565 CallbackBlock = ExReferenceCallBackBlock(Callback);
566 if (CallbackBlock)
567 {
568 /* Get the function */
569 Function = ExGetCallBackBlockRoutine(CallbackBlock);
570
571 /* Do the callback */
573
574 /* Now dereference it */
575 ExDereferenceCallBackBlock(Callback, CallbackBlock);
576 }
577}
_In_ PVOID Argument2
Definition: classpnp.h:721
PEX_CALLBACK_FUNCTION NTAPI ExGetCallBackBlockRoutine(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackRoutineBlock)
Definition: callback.c:93
PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExReferenceCallBackBlock(IN OUT PEX_CALLBACK CallBack)
Definition: callback.c:122
VOID NTAPI ExDereferenceCallBackBlock(IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK CallbackRoutineBlock)
Definition: callback.c:109
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_IRQL_requires_same_ _In_opt_ PVOID Argument1
Definition: cmtypes.h:696
EX_CALLBACK_FUNCTION * PEX_CALLBACK_FUNCTION
Definition: cmtypes.h:698

Referenced by PspRunCreateProcessNotifyRoutines(), PspRunCreateThreadNotifyRoutines(), and PspRunLoadImageNotifyRoutines().

◆ ExDupHandleTable()

PHANDLE_TABLE NTAPI ExDupHandleTable ( IN PEPROCESS  Process,
IN PHANDLE_TABLE  HandleTable,
IN PEX_DUPLICATE_HANDLE_CALLBACK  DupHandleProcedure,
IN ULONG_PTR  Mask 
)

Definition at line 1072 of file handle.c.

1076{
1077 PHANDLE_TABLE NewTable;
1079 PHANDLE_TABLE_ENTRY HandleTableEntry, NewEntry;
1081 PAGED_CODE();
1082
1083 /* Allocate the duplicated copy */
1085 if (!NewTable) return NULL;
1086
1087 /* Loop each entry */
1088 while (NewTable->NextHandleNeedingPool <
1089 HandleTable->NextHandleNeedingPool)
1090 {
1091 /* Insert it into the duplicated copy */
1092 if (!ExpAllocateHandleTableEntrySlow(NewTable, FALSE))
1093 {
1094 /* Insert failed, free the new copy and return */
1095 ExpFreeHandleTable(NewTable);
1096 return NULL;
1097 }
1098 }
1099
1100 /* Setup the initial handle table data */
1101 NewTable->HandleCount = 0;
1102 NewTable->ExtraInfoPages = 0;
1103 NewTable->FirstFree = 0;
1104
1105 /* Setup the first handle value */
1106 Handle.Value = INDEX_TO_HANDLE_VALUE(1);
1107
1108 /* Enter a critical region and lookup the new entry */
1110 while ((NewEntry = ExpLookupHandleTableEntry(NewTable, Handle)))
1111 {
1112 /* Lookup the old entry */
1113 HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle);
1114
1115 /* Loop each entry */
1116 do
1117 {
1118 /* Check if it doesn't match the audit mask */
1119 if (!(HandleTableEntry->Value & Mask))
1120 {
1121 /* Free it since we won't use it */
1122 Failed = TRUE;
1123 }
1124 else
1125 {
1126 /* Lock the entry */
1127 if (!ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1128 {
1129 /* Free it since we can't lock it, so we won't use it */
1130 Failed = TRUE;
1131 }
1132 else
1133 {
1134 /* Copy the handle value */
1135 *NewEntry = *HandleTableEntry;
1136
1137 /* Call the duplicate callback */
1138 if (DupHandleProcedure(Process,
1140 HandleTableEntry,
1141 NewEntry))
1142 {
1143 /* Clear failure flag */
1144 Failed = FALSE;
1145
1146 /* Lock the entry, increase the handle count */
1148 NewTable->HandleCount++;
1149 }
1150 else
1151 {
1152 /* Duplication callback refused, fail */
1153 Failed = TRUE;
1154 }
1155 }
1156 }
1157
1158 /* Check if we failed earlier and need to free */
1159 if (Failed)
1160 {
1161 /* Free this entry */
1162 NewEntry->Object = NULL;
1163 NewEntry->NextFreeTableEntry = NewTable->FirstFree;
1164 NewTable->FirstFree = (ULONG)Handle.Value;
1165 }
1166
1167 /* Increase the handle value and move to the next entry */
1168 Handle.Value += INDEX_TO_HANDLE_VALUE(1);
1169 NewEntry++;
1170 HandleTableEntry++;
1172
1173 /* We're done, skip the last entry */
1174 Handle.Value += INDEX_TO_HANDLE_VALUE(1);
1175 }
1176
1177 /* Acquire the table lock and insert this new table into the list */
1181
1182 /* Leave the critical region we entered previously and return the table */
1184 return NewTable;
1185}
#define LOW_LEVEL_ENTRIES
Definition: ex.h:155
unsigned int Mask
Definition: fpcontrol.c:82
BOOLEAN NTAPI ExpAllocateHandleTableEntrySlow(IN PHANDLE_TABLE HandleTable, IN BOOLEAN DoInit)
Definition: handle.c:502
#define INDEX_TO_HANDLE_VALUE(x)
Definition: handle.c:21
@ Failed
Definition: arc.h:79
ULONG_PTR Value
Definition: extypes.h:602
LONG HandleCount
Definition: extypes.h:644
LONG ExtraInfoPages
Definition: extypes.h:635
ULONG NextHandleNeedingPool
Definition: extypes.h:645
LIST_ENTRY HandleTableList
Definition: extypes.h:627

Referenced by ObInitProcess().

◆ ExfAcquireRundownProtection()

BOOLEAN FASTCALL ExfAcquireRundownProtection ( IN OUT PEX_RUNDOWN_REF  RunRef)

◆ ExfAcquireRundownProtectionEx()

BOOLEAN FASTCALL ExfAcquireRundownProtectionEx ( IN OUT PEX_RUNDOWN_REF  RunRef,
IN ULONG  Count 
)

◆ ExfInitializeRundownProtection()

VOID FASTCALL ExfInitializeRundownProtection ( OUT PEX_RUNDOWN_REF  RunRef)

◆ ExFreeCallBack()

VOID NTAPI ExFreeCallBack ( IN PEX_CALLBACK_ROUTINE_BLOCK  CallbackRoutineBlock)

◆ ExfReInitializeRundownProtection()

VOID FASTCALL ExfReInitializeRundownProtection ( OUT PEX_RUNDOWN_REF  RunRef)

◆ ExfReleaseRundownProtection()

VOID FASTCALL ExfReleaseRundownProtection ( IN OUT PEX_RUNDOWN_REF  RunRef)

◆ ExfReleaseRundownProtectionEx()

VOID FASTCALL ExfReleaseRundownProtectionEx ( IN OUT PEX_RUNDOWN_REF  RunRef,
IN ULONG  Count 
)

◆ ExfRundownCompleted()

VOID FASTCALL ExfRundownCompleted ( OUT PEX_RUNDOWN_REF  RunRef)

◆ ExfUnblockPushLock()

VOID FASTCALL ExfUnblockPushLock ( IN PEX_PUSH_LOCK  PushLock,
IN PVOID  CurrentWaitBlock 
)

◆ ExfWaitForRundownProtectionRelease()

VOID FASTCALL ExfWaitForRundownProtectionRelease ( IN OUT PEX_RUNDOWN_REF  RunRef)

◆ ExGetCallBackBlockContext()

PVOID NTAPI ExGetCallBackBlockContext ( IN PEX_CALLBACK_ROUTINE_BLOCK  CallbackRoutineBlock)

Definition at line 101 of file callback.c.

102{
103 /* Return the context */
104 return CallbackBlock->Context;
105}

◆ ExGetCallBackBlockRoutine()

PEX_CALLBACK_FUNCTION NTAPI ExGetCallBackBlockRoutine ( IN PEX_CALLBACK_ROUTINE_BLOCK  CallbackRoutineBlock)

Definition at line 93 of file callback.c.

94{
95 /* Return the function */
96 return CallbackBlock->Function;
97}

Referenced by ExDoCallBack(), PsRemoveCreateThreadNotifyRoutine(), PsRemoveLoadImageNotifyRoutine(), and PsSetCreateProcessNotifyRoutine().

◆ ExGetCountFastReference()

FORCEINLINE ULONG ExGetCountFastReference ( IN EX_FAST_REF  FastRef)

Definition at line 591 of file ex.h.

592{
593 /* Return the reference count */
594 return (ULONG)FastRef.RefCnt;
595}

Referenced by ExCompareExchangeCallBack(), ExReferenceCallBackBlock(), ObDeassignSecurity(), ObFastReferenceObject(), ObFastReplaceObject(), ObpReferenceSecurityDescriptor(), and ObSetSecurityDescriptorInfo().

◆ ExGetObjectFastReference()

FORCEINLINE PVOID ExGetObjectFastReference ( IN EX_FAST_REF  FastRef)

Definition at line 583 of file ex.h.

584{
585 /* Return the unbiased pointer */
586 return (PVOID)(FastRef.Value & ~MAX_FAST_REFS);
587}

Referenced by ExCompareExchangeCallBack(), ExReferenceCallBackBlock(), ObDeassignSecurity(), ObFastReferenceObject(), ObFastReferenceObjectLocked(), ObFastReplaceObject(), ObpReferenceSecurityDescriptor(), and ObSetSecurityDescriptorInfo().

◆ ExGetPoolTagInfo()

NTSTATUS NTAPI ExGetPoolTagInfo ( IN PSYSTEM_POOLTAG_INFORMATION  SystemInformation,
IN ULONG  SystemInformationLength,
IN OUT PULONG ReturnLength  OPTIONAL 
)

Definition at line 1356 of file expool.c.

1359{
1360 ULONG TableSize, CurrentLength;
1361 ULONG EntryCount;
1363 PSYSTEM_POOLTAG TagEntry;
1364 PPOOL_TRACKER_TABLE Buffer, TrackerEntry;
1367
1368 //
1369 // Keep track of how much data the caller's buffer must hold
1370 //
1371 CurrentLength = FIELD_OFFSET(SYSTEM_POOLTAG_INFORMATION, TagInfo);
1372
1373 //
1374 // Initialize the caller's buffer
1375 //
1376 TagEntry = &SystemInformation->TagInfo[0];
1377 SystemInformation->Count = 0;
1378
1379 //
1380 // Capture the number of entries, and the total size needed to make a copy
1381 // of the table
1382 //
1383 EntryCount = (ULONG)PoolTrackTableSize;
1384 TableSize = EntryCount * sizeof(POOL_TRACKER_TABLE);
1385
1386 //
1387 // Allocate the "Generic DPC" temporary buffer
1388 //
1391
1392 //
1393 // Do a "Generic DPC" to atomically retrieve the tag and allocation data
1394 //
1395 Context.PoolTrackTable = Buffer;
1396 Context.PoolTrackTableSize = PoolTrackTableSize;
1397 Context.PoolTrackTableExpansion = NULL;
1398 Context.PoolTrackTableSizeExpansion = 0;
1400
1401 //
1402 // Now parse the results
1403 //
1404 for (TrackerEntry = Buffer; TrackerEntry < (Buffer + EntryCount); TrackerEntry++)
1405 {
1406 //
1407 // If the entry is empty, skip it
1408 //
1409 if (!TrackerEntry->Key) continue;
1410
1411 //
1412 // Otherwise, add one more entry to the caller's buffer, and ensure that
1413 // enough space has been allocated in it
1414 //
1415 SystemInformation->Count++;
1416 CurrentLength += sizeof(*TagEntry);
1417 if (SystemInformationLength < CurrentLength)
1418 {
1419 //
1420 // The caller's buffer is too small, so set a failure code. The
1421 // caller will know the count, as well as how much space is needed.
1422 //
1423 // We do NOT break out of the loop, because we want to keep incrementing
1424 // the Count as well as CurrentLength so that the caller can know the
1425 // final numbers
1426 //
1428 }
1429 else
1430 {
1431 //
1432 // Small sanity check that our accounting is working correctly
1433 //
1434 ASSERT(TrackerEntry->PagedAllocs >= TrackerEntry->PagedFrees);
1435 ASSERT(TrackerEntry->NonPagedAllocs >= TrackerEntry->NonPagedFrees);
1436
1437 //
1438 // Return the data into the caller's buffer
1439 //
1440 TagEntry->TagUlong = TrackerEntry->Key;
1441 TagEntry->PagedAllocs = TrackerEntry->PagedAllocs;
1442 TagEntry->PagedFrees = TrackerEntry->PagedFrees;
1443 TagEntry->PagedUsed = TrackerEntry->PagedBytes;
1444 TagEntry->NonPagedAllocs = TrackerEntry->NonPagedAllocs;
1445 TagEntry->NonPagedFrees = TrackerEntry->NonPagedFrees;
1446 TagEntry->NonPagedUsed = TrackerEntry->NonPagedBytes;
1447 TagEntry++;
1448 }
1449 }
1450
1451 //
1452 // Free the "Generic DPC" temporary buffer, return the buffer length and status
1453 //
1454 ExFreePoolWithTag(Buffer, 'ofnI');
1455 if (ReturnLength) *ReturnLength = CurrentLength;
1456 return Status;
1457}
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG ReturnLength
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
VOID NTAPI KeGenericCallDpc(IN PKDEFERRED_ROUTINE Routine, IN PVOID Context)
Definition: dpc.c:1002
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define NonPagedPool
Definition: env_spec_w32.h:307
VOID NTAPI ExpGetPoolTagInfoTarget(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: expool.c:1321
SIZE_T PoolTrackTableSize
Definition: expool.c:46
Status
Definition: gdiplustypes.h:25
struct _POOL_TRACKER_TABLE POOL_TRACKER_TABLE
#define STATUS_SUCCESS
Definition: shellext.h:65
LONG NonPagedAllocs
Definition: miarm.h:384
SIZE_T NonPagedBytes
Definition: miarm.h:386
LONG NonPagedFrees
Definition: miarm.h:385
SIZE_T PagedBytes
Definition: miarm.h:389
SIZE_T PagedUsed
Definition: extypes.h:1147
ULONG TagUlong
Definition: extypes.h:1143
ULONG PagedFrees
Definition: extypes.h:1146
ULONG PagedAllocs
Definition: extypes.h:1145
ULONG NonPagedAllocs
Definition: extypes.h:1148
SIZE_T NonPagedUsed
Definition: extypes.h:1150
ULONG NonPagedFrees
Definition: extypes.h:1149
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:4327

Referenced by QSI_DEF().

◆ ExGetRunRefForGivenProcessor()

◆ ExInit2()

VOID NTAPI ExInit2 ( VOID  )

◆ ExInitializeCallBack()

VOID NTAPI ExInitializeCallBack ( IN OUT PEX_CALLBACK  Callback)

Definition at line 46 of file callback.c.

47{
48 /* Initialize the fast reference */
50}
FORCEINLINE VOID ExInitializeFastReference(OUT PEX_FAST_REF FastRef, IN OPTIONAL PVOID Object)
Definition: ex.h:599

Referenced by CmpInitCallback(), and PspInitPhase0().

◆ ExInitializeFastReference()

FORCEINLINE VOID ExInitializeFastReference ( OUT PEX_FAST_REF  FastRef,
IN OPTIONAL PVOID  Object 
)

Definition at line 599 of file ex.h.

601{
602 /* Sanity check */
604
605 /* Check if an object is being set */
606 if (!Object)
607 {
608 /* Clear the field */
609 FastRef->Object = NULL;
610 }
611 else
612 {
613 /* Otherwise, we assume the object was referenced and is ready */
614 FastRef->Value = (ULONG_PTR)Object | MAX_FAST_REFS;
615 }
616}

Referenced by ExInitializeCallBack(), ObAssignObjectSecurityDescriptor(), and ObInitializeFastReference().

◆ ExInitializeSystemLookasideList()

VOID NTAPI ExInitializeSystemLookasideList ( IN PGENERAL_LOOKASIDE  List,
IN POOL_TYPE  Type,
IN ULONG  Size,
IN ULONG  Tag,
IN USHORT  MaximumDepth,
IN PLIST_ENTRY  ListHead 
)

Definition at line 31 of file lookas.c.

37{
38 /* Initialize the list */
39 List->Tag = Tag;
40 List->Type = Type;
41 List->Size = Size;
42 InsertHeadList(ListHead, &List->ListEntry);
43 List->MaximumDepth = MaximumDepth;
44 List->Depth = 2;
45 List->Allocate = ExAllocatePoolWithTag;
46 List->Free = ExFreePool;
47 InitializeSListHead(&List->ListHead);
48 List->TotalAllocates = 0;
49 List->AllocateHits = 0;
50 List->TotalFrees = 0;
51 List->FreeHits = 0;
52 List->LastTotalAllocates = 0;
53 List->LastAllocateHits = 0;
54}
Type
Definition: Type.h:7
#define InsertHeadList(ListHead, Entry)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
FORCEINLINE VOID InitializeSListHead(_Out_ PSLIST_HEADER SListHead)
Definition: rtlfuncs.h:3368

Referenced by ExpInitLookasideLists(), IopInitLookasideLists(), ObInit2(), and ObInitSystem().

◆ ExInitPoolLookasidePointers()

VOID NTAPI ExInitPoolLookasidePointers ( VOID  )

Definition at line 59 of file lookas.c.

60{
61 ULONG i;
62 PKPRCB Prcb = KeGetCurrentPrcb();
64
65 /* Loop for all pool lists */
66 for (i = 0; i < NUMBER_POOL_LOOKASIDE_LISTS; i++)
67 {
68 /* Initialize the non-paged list */
70 InitializeSListHead(&Entry->ListHead);
71
72 /* Bind to PRCB */
73 Prcb->PPNPagedLookasideList[i].P = Entry;
74 Prcb->PPNPagedLookasideList[i].L = Entry;
75
76 /* Initialize the paged list */
78 InitializeSListHead(&Entry->ListHead);
79
80 /* Bind to PRCB */
81 Prcb->PPPagedLookasideList[i].P = Entry;
82 Prcb->PPPagedLookasideList[i].L = Entry;
83 }
84}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GENERAL_LOOKASIDE ExpSmallNPagedPoolLookasideLists[NUMBER_POOL_LOOKASIDE_LISTS]
Definition: lookas.c:23
GENERAL_LOOKASIDE ExpSmallPagedPoolLookasideLists[NUMBER_POOL_LOOKASIDE_LISTS]
Definition: lookas.c:24
#define NUMBER_POOL_LOOKASIDE_LISTS
Definition: ketypes.h:380
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1182
base of all file and directory entries
Definition: entries.h:83
GENERAL_LOOKASIDE_POOL PPPagedLookasideList[NUMBER_POOL_LOOKASIDE_LISTS]
Definition: ketypes.h:719
GENERAL_LOOKASIDE_POOL PPNPagedLookasideList[NUMBER_POOL_LOOKASIDE_LISTS]
Definition: ketypes.h:718
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE * PGENERAL_LOOKASIDE

Referenced by ExpInitializeExecutive(), and KiSystemStartupBootStack().

◆ ExInsertFastReference()

FORCEINLINE BOOLEAN ExInsertFastReference ( IN OUT PEX_FAST_REF  FastRef,
IN PVOID  Object 
)

Definition at line 649 of file ex.h.

651{
652 EX_FAST_REF OldValue, NewValue;
653
654 /* Sanity checks */
656
657 /* Start update loop */
658 for (;;)
659 {
660 /* Get the current reference count */
661 OldValue = *FastRef;
662
663 /* Check if the current count is too high or if the pointer changed */
664 if (((OldValue.RefCnt + MAX_FAST_REFS) > MAX_FAST_REFS) ||
665 ((OldValue.Value &~ MAX_FAST_REFS) != (ULONG_PTR)Object))
666 {
667 /* Fail */
668 return FALSE;
669 }
670
671 /* Update the reference count */
672 NewValue.Value = OldValue.Value + MAX_FAST_REFS;
673 NewValue.Object = ExpChangePushlock(&FastRef->Object,
674 NewValue.Object,
675 OldValue.Object);
676 if (NewValue.Object != OldValue.Object) continue;
677
678 /* We are done */
679 break;
680 }
681
682 /* Return success */
683 return TRUE;
684}

Referenced by ExReferenceCallBackBlock(), ObFastReferenceObject(), and ObpReferenceSecurityDescriptor().

◆ ExLockUserBuffer()

NTSTATUS NTAPI ExLockUserBuffer ( PVOID  BaseAddress,
ULONG  Length,
KPROCESSOR_MODE  AccessMode,
LOCK_OPERATION  Operation,
PVOID MappedSystemVa,
PMDL OutMdl 
)

Definition at line 202 of file sysinfo.c.

209{
210 PMDL Mdl;
212
213 *MappedSystemVa = NULL;
214 *OutMdl = NULL;
215
216 /* Allocate an MDL for the buffer */
218 if (Mdl == NULL)
219 {
221 }
222
223 /* Enter SEH for probing */
225 {
227 }
229 {
232 }
233 _SEH2_END;
234
235 /* Return the safe kernel mode buffer */
237 if (*MappedSystemVa == NULL)
238 {
241 }
242
243 /* Return the MDL */
244 *OutMdl = Mdl;
245 return STATUS_SUCCESS;
246}
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
FP_OP Operation
Definition: fpcontrol.c:150
#define IoAllocateMdl
Definition: fxmdl.h:88
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:931
@ NormalPagePriority
Definition: imports.h:54
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
VOID NTAPI ExUnlockUserBuffer(PMDL Mdl)
Definition: sysinfo.c:194
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:181
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184
#define TAG_MDL
Definition: tag.h:88
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396

Referenced by KdSystemDebugControl(), and QSI_DEF().

◆ ExLuidInitialization()

BOOLEAN NTAPI ExLuidInitialization ( VOID  )

Definition at line 325 of file uuid.c.

326{
327 return TRUE;
328}

Referenced by SepInitializationPhase0().

◆ ExMapHandleToPointer()

PHANDLE_TABLE_ENTRY NTAPI ExMapHandleToPointer ( IN PHANDLE_TABLE  HandleTable,
IN HANDLE  Handle 
)

Definition at line 1046 of file handle.c.

1048{
1049 EXHANDLE ExHandle;
1050 PHANDLE_TABLE_ENTRY HandleTableEntry;
1051 PAGED_CODE();
1052
1053 /* Set the handle value */
1054 ExHandle.GenericHandleOverlay = Handle;
1055
1056 /* Fail if we got an invalid index */
1057 if (!(ExHandle.Index & (LOW_LEVEL_ENTRIES - 1))) return NULL;
1058
1059 /* Do the lookup */
1060 HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, ExHandle);
1061 if (!HandleTableEntry) return NULL;
1062
1063 /* Lock it */
1064 if (!ExpLockHandleTableEntry(HandleTable, HandleTableEntry)) return NULL;
1065
1066 /* Return the entry */
1067 return HandleTableEntry;
1068}
ULONG_PTR Index
Definition: ex.h:94

Referenced by NtWaitForMultipleObjects(), ObpCloseHandle(), ObpReferenceProcessObjectByHandle(), ObQueryObjectAuditingByHandle(), ObReferenceFileObjectForWrite(), ObReferenceObjectByHandle(), PsLookupProcessByProcessId(), PsLookupProcessThreadByCid(), PsLookupThreadByThreadId(), and RtlpGetAtomEntry().

◆ ExpDebuggerWorker()

VOID NTAPI ExpDebuggerWorker ( _In_ PVOID  Context)

Definition at line 52 of file dbgctrl.c.

54{
55 PEPROCESS ProcessToAttach, ProcessToKill;
56 ULONG_PTR PageInAddress;
59
61
62 /* Be sure we were started in an initialized state */
63 ASSERTMSG("ExpDebuggerWorker being entered in non-initialized state!\n",
66 {
67 /* An error happened, so get a chance to restart proper */
69 return;
70 }
71
72 /* Get the processes to be attached or killed, and the address to page in */
73 ProcessToAttach = ExpDebuggerProcessAttach;
74 ProcessToKill = ExpDebuggerProcessKill;
75 PageInAddress = ExpDebuggerPageIn;
76
77 /* Reset the state machine to its ready state */
82
83 /* Default to the current process if we don't find the process to be attached or killed */
84 Process = NULL;
85
86 /* Check if we need to attach or kill some process */
87 if (ProcessToAttach || ProcessToKill)
88 {
89 /* Find the process in the list */
91 {
92 /* Is this the process we want to attach to? */
93 if (Process == ProcessToAttach)
94 {
95 /* Yes, attach ourselves to it */
97 break;
98 }
99 /* Or is this the process we want to kill? */
100 else if (Process == ProcessToKill)
101 {
102 /* Yes, kill and dereference it, then return */
105 return;
106 }
107 }
108
109 if (!Process)
110 {
112 "EX debug work: Unable to find process %p\n",
113 ProcessToAttach ? ProcessToAttach : ProcessToKill);
114 }
115
116 /* We either have found a process, or we default to the current one */
117 }
118
119 /* If we have an address to page in... */
120 if (PageInAddress)
121 {
122 /* ... try to do it by attempting to read at this address */
124 {
125 ProbeForReadUchar(PageInAddress);
126 }
128 {
130 "EX page in: Failed to page-in address 0x%p, Status 0x%08lx\n",
131 PageInAddress, _SEH2_GetExceptionCode());
132 }
133 _SEH2_END;
134 }
135
136 /* Break into the process (or the current one if Process == NULL) */
138
139 /* If we are attached to a process, not the current one... */
140 if (Process)
141 {
142 /* ... we can detach from the process */
144 /* Dereference the process referenced by PsGetNextProcess() */
146 }
147}
#define DPFLTR_ERROR_LEVEL
Definition: main.cpp:32
PEPROCESS ExpDebuggerProcessAttach
Definition: dbgctrl.c:26
PEPROCESS ExpDebuggerProcessKill
Definition: dbgctrl.c:27
WINKD_WORKER_STATE ExpDebuggerWork
Definition: dbgctrl.c:25
ULONG_PTR ExpDebuggerPageIn
Definition: dbgctrl.c:28
@ DPFLTR_SYSTEM_ID
Definition: dpfilter.h:28
#define DbgPrintEx(cmpid, lvl, fmt,...)
Definition: kdinit.c:24
#define DBG_STATUS_WORKER
Definition: kdtypes.h:45
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1777
#define DBG_TERMINATE_PROCESS
Definition: ntstatus.h:51
VOID NTAPI KeStackAttachProcess(IN PKPROCESS Process, OUT PRKAPC_STATE ApcState)
Definition: procobj.c:704
VOID NTAPI KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
Definition: procobj.c:756
NTSTATUS NTAPI PsTerminateProcess(IN PEPROCESS Process, IN NTSTATUS ExitStatus)
Definition: kill.c:126
PEPROCESS NTAPI PsGetNextProcess(IN PEPROCESS OldProcess OPTIONAL)
Definition: process.c:128
#define ProbeForReadUchar(Ptr)
Definition: probe.h:61
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)
KAPC_STATE
Definition: ketypes.h:1409
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by ExpWorkerThreadBalanceManager().

◆ ExpInitializeCallbacks()

BOOLEAN NTAPI ExpInitializeCallbacks ( VOID  )

Definition at line 256 of file callback.c.

257{
261 UNICODE_STRING CallbackName;
263 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
265 ULONG i;
266
267 /* Setup lightweight callback lock */
269
270 /* Initialize the Callback Object type */
271 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
272 RtlInitUnicodeString(&Name, L"Callback");
273 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
274 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
275 ObjectTypeInitializer.GenericMapping = ExpCallbackMapping;
276 ObjectTypeInitializer.PoolType = NonPagedPool;
277 ObjectTypeInitializer.DeleteProcedure = ExpDeleteCallback;
278 ObjectTypeInitializer.ValidAccessMask = CALLBACK_ALL_ACCESS;
280 &ObjectTypeInitializer,
281 NULL,
283 if (!NT_SUCCESS(Status)) return FALSE;
284
285 /* Initialize the Object */
287 &DirName,
289 NULL,
291
292 /* Create the Object Directory */
296 if (!NT_SUCCESS(Status)) return FALSE;
297
298 /* Close Handle... */
300
301 /* Initialize Event used when unregistering */
303
304 /* Default NT Kernel Callbacks. */
306 {
307 /* Create the name from the structure */
309
310 /* Initialize the Object Attributes Structure */
312 &CallbackName,
314 NULL,
315 NULL);
316
317 /* Create the Callback Object */
320 TRUE,
321 TRUE);
322 if (!NT_SUCCESS(Status)) return FALSE;
323 }
324
325 /* Everything successful */
326 return TRUE;
327}
static HANDLE DirectoryHandle
Definition: ObType.c:48
_In_ PFCB _In_ PCD_NAME DirName
Definition: cdprocs.h:737
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
LPWSTR Name
Definition: desk.c:124
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define OBJ_OPENLINK
Definition: winternl.h:230
#define OBJ_PERMANENT
Definition: winternl.h:226
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define CALLBACK_ALL_ACCESS
Definition: extypes.h:90
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define DIRECTORY_ALL_ACCESS
Definition: nt_native.h:1259
@ NotificationEvent
VOID NTAPI ExpDeleteCallback(IN PVOID Object)
Definition: callback.c:236
KEVENT ExpCallbackEvent
Definition: callback.c:39
GENERIC_MAPPING ExpCallbackMapping
Definition: callback.c:18
NTSTATUS NTAPI ExCreateCallback(OUT PCALLBACK_OBJECT *CallbackObject, IN POBJECT_ATTRIBUTES ObjectAttributes, IN BOOLEAN Create, IN BOOLEAN AllowMultipleCallbacks)
Definition: callback.c:361
POBJECT_TYPE ExCallbackObjectType
Definition: callback.c:38
SYSTEM_CALLBACKS ExpInitializeCallback[]
Definition: callback.c:30
PSECURITY_DESCRIPTOR SePublicDefaultSd
Definition: sd.c:16
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI NtCreateDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: obdir.c:765
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
Definition: oblife.c:1136
PCALLBACK_OBJECT * CallbackObject
Definition: ex.h:125
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
OB_DELETE_METHOD DeleteProcedure
Definition: obtypes.h:369
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by ExpInitSystemPhase1().

◆ ExpInitializeEventImplementation()

BOOLEAN NTAPI ExpInitializeEventImplementation ( VOID  )

Definition at line 39 of file event.c.

40{
41 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
44 DPRINT("Creating Event Object Type\n");
45
46 /* Create the Event Object Type */
47 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
48 RtlInitUnicodeString(&Name, L"Event");
49 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
50 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KEVENT);
51 ObjectTypeInitializer.GenericMapping = ExpEventMapping;
52 ObjectTypeInitializer.PoolType = NonPagedPool;
53 ObjectTypeInitializer.ValidAccessMask = EVENT_ALL_ACCESS;
54 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
55 Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExEventObjectType);
56 if (!NT_SUCCESS(Status)) return FALSE;
57 return TRUE;
58}
#define KEVENT
Definition: env_spec_w32.h:69
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
GENERIC_MAPPING ExpEventMapping
Definition: event.c:20
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
#define DPRINT
Definition: sndvol32.h:73
ULONG DefaultNonPagedPoolCharge
Definition: obtypes.h:365

Referenced by ExpInitSystemPhase1().

◆ ExpInitializeEventPairImplementation()

BOOLEAN NTAPI ExpInitializeEventPairImplementation ( VOID  )

Definition at line 33 of file evtpair.c.

34{
35 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
38 DPRINT("Creating Event Pair Object Type\n");
39
40 /* Create the Event Pair Object Type */
41 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
42 RtlInitUnicodeString(&Name, L"EventPair");
43 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
44 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KEVENT_PAIR);
45 ObjectTypeInitializer.GenericMapping = ExEventPairMapping;
46 ObjectTypeInitializer.PoolType = NonPagedPool;
47 ObjectTypeInitializer.ValidAccessMask = EVENT_PAIR_ALL_ACCESS;
48 ObjectTypeInitializer.UseDefaultObject = TRUE;
49 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
50 Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExEventPairObjectType);
51 if (!NT_SUCCESS(Status)) return FALSE;
52 return TRUE;
53}
POBJECT_TYPE ExEventPairObjectType
Definition: evtpair.c:18
GENERIC_MAPPING ExEventPairMapping
Definition: evtpair.c:20
#define EVENT_PAIR_ALL_ACCESS
Definition: extypes.h:125
struct _KEVENT_PAIR KEVENT_PAIR

Referenced by ExpInitSystemPhase1().

◆ ExpInitializeExecutive()

VOID NTAPI ExpInitializeExecutive ( IN ULONG  Cpu,
IN PLOADER_PARAMETER_BLOCK  LoaderBlock 
)

Definition at line 928 of file init.c.

930{
931 PNLS_DATA_BLOCK NlsData;
932 CHAR Buffer[256];
933 ANSI_STRING AnsiPath;
935 PCHAR CommandLine, PerfMem;
936 ULONG PerfMemUsed;
937 PLDR_DATA_TABLE_ENTRY NtosEntry;
939 ANSI_STRING CSDString;
940 size_t Remaining = 0;
941 PCHAR RcEnd = NULL;
942 CHAR VersionBuffer[65];
943
944 /* Validate Loader */
945 if (!ExpIsLoaderValid(LoaderBlock))
946 {
947 /* Invalid loader version */
948 KeBugCheckEx(MISMATCHED_HAL,
949 3,
950 LoaderBlock->Extension->Size,
951 LoaderBlock->Extension->MajorVersion,
952 LoaderBlock->Extension->MinorVersion);
953 }
954
955 /* Initialize PRCB pool lookaside pointers */
957
958 /* Check if this is an application CPU */
959 if (Cpu)
960 {
961 /* Then simply initialize it with HAL */
962 if (!HalInitSystem(ExpInitializationPhase, LoaderBlock))
963 {
964 /* Initialization failed */
965 KeBugCheck(HAL_INITIALIZATION_FAILED);
966 }
967
968 /* We're done */
969 return;
970 }
971
972 /* Assume no text-mode or remote boot */
975
976 /* Check if we have a setup loader block */
977 if (LoaderBlock->SetupLdrBlock)
978 {
979 /* Check if this is text-mode setup */
980 if (LoaderBlock->SetupLdrBlock->Flags & SETUPLDR_TEXT_MODE)
982
983 /* Check if this is network boot */
984 if (LoaderBlock->SetupLdrBlock->Flags & SETUPLDR_REMOTE_BOOT)
985 {
986 /* Set variable */
988
989 /* Make sure we're actually booting off the network */
990 ASSERT(!_memicmp(LoaderBlock->ArcBootDeviceName, "net(0)", 6));
991 }
992 }
993
994 /* Set phase to 0 */
996
997 /* Get boot command line */
998 CommandLine = LoaderBlock->LoadOptions;
999 if (CommandLine)
1000 {
1001 /* Upcase it for comparison and check if we're in performance mode */
1002 _strupr(CommandLine);
1003 PerfMem = strstr(CommandLine, "PERFMEM");
1004 if (PerfMem)
1005 {
1006 /* Check if the user gave a number of bytes to use */
1007 PerfMem = strstr(PerfMem, "=");
1008 if (PerfMem)
1009 {
1010 /* Read the number of pages we'll use */
1011 PerfMemUsed = atol(PerfMem + 1) * (1024 * 1024 / PAGE_SIZE);
1012 if (PerfMemUsed)
1013 {
1014 /* FIXME: TODO */
1015 DPRINT1("BBT performance mode not yet supported."
1016 "/PERFMEM option ignored.\n");
1017 }
1018 }
1019 }
1020
1021 /* Check if we're burning memory */
1022 PerfMem = strstr(CommandLine, "BURNMEMORY");
1023 if (PerfMem)
1024 {
1025 /* Check if the user gave a number of bytes to use */
1026 PerfMem = strstr(PerfMem, "=");
1027 if (PerfMem)
1028 {
1029 /* Read the number of pages we'll use */
1030 PerfMemUsed = atol(PerfMem + 1) * (1024 * 1024 / PAGE_SIZE);
1031 if (PerfMemUsed) ExBurnMemory(LoaderBlock, PerfMemUsed, LoaderBad);
1032 }
1033 }
1034 }
1035
1036 /* Setup NLS Base and offsets */
1037 NlsData = LoaderBlock->NlsData;
1041 (ULONG_PTR)NlsData->AnsiCodePageData);
1043 (ULONG_PTR)NlsData->AnsiCodePageData);
1044
1045 /* Initialize the NLS Tables */
1054
1055 /* Now initialize the HAL */
1056 if (!HalInitSystem(ExpInitializationPhase, LoaderBlock))
1057 {
1058 /* HAL failed to initialize, bugcheck */
1059 KeBugCheck(HAL_INITIALIZATION_FAILED);
1060 }
1061
1062 /* Make sure interrupts are active now */
1063 _enable();
1064
1065 /* Clear the crypto exponent */
1066 SharedUserData->CryptoExponent = 0;
1067
1068 /* Set global flags for the checked build */
1069#if DBG
1072#endif
1073
1074 /* Setup NT System Root Path */
1075 sprintf(Buffer, "C:%s", LoaderBlock->NtBootPathName);
1076
1077 /* Convert to ANSI_STRING and null-terminate it */
1078 RtlInitString(&AnsiPath, Buffer);
1079 Buffer[--AnsiPath.Length] = ANSI_NULL;
1080
1081 /* Get the string from KUSER_SHARED_DATA's buffer */
1082 RtlInitEmptyUnicodeString(&NtSystemRoot,
1083 SharedUserData->NtSystemRoot,
1084 sizeof(SharedUserData->NtSystemRoot));
1085
1086 /* Now fill it in */
1088 if (!NT_SUCCESS(Status)) KeBugCheck(SESSION3_INITIALIZATION_FAILED);
1089
1090 /* Setup bugcheck messages */
1092
1093 /* Setup initial system settings */
1094 CmGetSystemControlValues(LoaderBlock->RegistryBase, CmControlVector);
1095
1096 /* Set the Service Pack Number and add it to the CSD Version number if needed */
1098 if (((CmNtCSDVersion & 0xFFFF0000) == 0) && (CmNtCSDReleaseType == 1))
1099 {
1101 }
1102
1103 /* Add loaded CmNtGlobalFlag value */
1105
1106 /* Initialize the executive at phase 0 */
1107 if (!ExInitSystem()) KeBugCheck(PHASE0_INITIALIZATION_FAILED);
1108
1109 /* Initialize the memory manager at phase 0 */
1110 if (!MmArmInitSystem(0, LoaderBlock)) KeBugCheck(PHASE0_INITIALIZATION_FAILED);
1111
1112 /* Load boot symbols */
1113 ExpLoadBootSymbols(LoaderBlock);
1114
1115 /* Check if we should break after symbol load */
1118
1119 /* Check if this loader is compatible with NT 5.2 */
1120 if (LoaderBlock->Extension->Size >= sizeof(LOADER_PARAMETER_EXTENSION))
1121 {
1122 /* Setup headless terminal settings */
1123 HeadlessInit(LoaderBlock);
1124 }
1125
1126 /* Set system ranges */
1127#ifdef _M_AMD64
1130#else
1133#endif
1134
1135 /* Make a copy of the NLS Tables */
1136 ExpInitNls(LoaderBlock);
1137
1138 /* Get the kernel's load entry */
1139 NtosEntry = CONTAINING_RECORD(LoaderBlock->LoadOrderListHead.Flink,
1141 InLoadOrderLinks);
1142
1143 /* Check if this is a service pack */
1144 if (CmNtCSDVersion & 0xFFFF)
1145 {
1146 /* Get the service pack string */
1147 Status = RtlFindMessage(NtosEntry->DllBase,
1150 WINDOWS_NT_CSD_STRING,
1151 &MsgEntry);
1152 if (NT_SUCCESS(Status))
1153 {
1154 /* Setup the string */
1155 RtlInitAnsiString(&CSDString, (PCHAR)MsgEntry->Text);
1156
1157 /* Remove trailing newline */
1158 while ((CSDString.Length > 0) &&
1159 ((CSDString.Buffer[CSDString.Length - 1] == '\r') ||
1160 (CSDString.Buffer[CSDString.Length - 1] == '\n')))
1161 {
1162 /* Skip the trailing character */
1163 CSDString.Length--;
1164 }
1165
1166 /* Fill the buffer with version information */
1168 sizeof(Buffer),
1169 "%Z %u%c",
1170 &CSDString,
1171 (CmNtCSDVersion & 0xFF00) >> 8,
1172 (CmNtCSDVersion & 0xFF) ?
1173 'A' + (CmNtCSDVersion & 0xFF) - 1 :
1174 ANSI_NULL);
1175 }
1176 else
1177 {
1178 /* Build default string */
1180 sizeof(Buffer),
1181 "CSD %04x",
1183 }
1184
1185 /* Check for success */
1186 if (!NT_SUCCESS(Status))
1187 {
1188 /* Fail */
1189 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1190 }
1191 }
1192 else
1193 {
1194 /* Then this is a beta */
1196 sizeof(Buffer),
1198 NULL,
1199 &Remaining,
1200 0);
1201 if (!NT_SUCCESS(Status))
1202 {
1203 /* Fail */
1204 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1205 }
1206
1207 /* Update length */
1208 CmCSDVersionString.MaximumLength = sizeof(Buffer) - (USHORT)Remaining;
1209 }
1210
1211 /* Check if we have an RC number */
1212 if ((CmNtCSDVersion & 0xFFFF0000) && (CmNtCSDReleaseType == 1))
1213 {
1214 /* Check if we have no version data yet */
1215 if (!(*Buffer))
1216 {
1217 /* Set defaults */
1218 Remaining = sizeof(Buffer);
1219 RcEnd = Buffer;
1220 }
1221 else
1222 {
1223 /* Add comma and space */
1225 sizeof(Buffer),
1226 ", ",
1227 &RcEnd,
1228 &Remaining,
1229 0);
1230 if (!NT_SUCCESS(Status))
1231 {
1232 /* Fail */
1233 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1234 }
1235 }
1236
1237 /* Add the version format string */
1238 Status = RtlStringCbPrintfA(RcEnd,
1239 Remaining,
1240 "v.%u",
1241 (CmNtCSDVersion & 0xFFFF0000) >> 16);
1242 if (!NT_SUCCESS(Status))
1243 {
1244 /* Fail */
1245 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1246 }
1247 }
1248
1249 /* Now setup the final string */
1250 RtlInitAnsiString(&CSDString, Buffer);
1252 &CSDString,
1253 TRUE);
1254 if (!NT_SUCCESS(Status))
1255 {
1256 /* Fail */
1257 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1258 }
1259
1260 /* Add our version */
1261 Status = RtlStringCbPrintfA(VersionBuffer,
1262 sizeof(VersionBuffer),
1263 "%u.%u",
1266 if (!NT_SUCCESS(Status))
1267 {
1268 /* Fail */
1269 KeBugCheckEx(PHASE0_INITIALIZATION_FAILED, Status, 0, 0, 0);
1270 }
1271
1272 /* Build the final version string */
1274
1275 /* Check if the user wants a kernel stack trace database */
1277 {
1278 /* FIXME: TODO */
1279 DPRINT1("Kernel-mode stack trace support not yet present."
1280 "FLG_KERNEL_STACK_TRACE_DB flag ignored.\n");
1281 }
1282
1283 /* Check if he wanted exception logging */
1285 {
1286 /* FIXME: TODO */
1287 DPRINT1("Kernel-mode exception logging support not yet present."
1288 "FLG_ENABLE_EXCEPTION_LOGGING flag ignored.\n");
1289 }
1290
1291 /* Initialize the Handle Table */
1293
1294#if DBG
1295 /* On checked builds, allocate the system call count table */
1298 KiServiceLimit * sizeof(ULONG),
1299 'llaC');
1300
1301 /* Use it for the shadow table too */
1303
1304 /* Make sure allocation succeeded */
1306 {
1307 /* Zero the call counts to 0 */
1309 KiServiceLimit * sizeof(ULONG));
1310 }
1311#endif
1312
1313 /* Create the Basic Object Manager Types to allow new Object Types */
1314 if (!ObInitSystem()) KeBugCheck(OBJECT_INITIALIZATION_FAILED);
1315
1316 /* Load basic Security for other Managers */
1317 if (!SeInitSystem()) KeBugCheck(SECURITY_INITIALIZATION_FAILED);
1318
1319 /* Initialize the Process Manager */
1320 if (!PsInitSystem(LoaderBlock)) KeBugCheck(PROCESS_INITIALIZATION_FAILED);
1321
1322 /* Initialize the PnP Manager */
1323 if (!PpInitSystem()) KeBugCheck(PP0_INITIALIZATION_FAILED);
1324
1325 /* Initialize the User-Mode Debugging Subsystem */
1327
1328 /* Calculate the tick count multiplier */
1330 SharedUserData->TickCountMultiplier = ExpTickCountMultiplier;
1331
1332 /* Set the OS Version */
1333 SharedUserData->NtMajorVersion = NtMajorVersion;
1334 SharedUserData->NtMinorVersion = NtMinorVersion;
1335
1336 /* Set the machine type */
1337 SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_NATIVE;
1338 SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_NATIVE;
1339
1340 /* ReactOS magic */
1341 *(PULONG)(KI_USER_SHARED_DATA + PAGE_SIZE - sizeof(ULONG)) = 0x8eac705;
1342}
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define DPRINT1
Definition: precomp.h:8
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1434
CM_SYSTEM_CONTROL_VECTOR CmControlVector[]
VOID NTAPI CmGetSystemControlValues(IN PVOID SystemHiveData, IN PCM_SYSTEM_CONTROL_VECTOR ControlVector)
Definition: cmcontrl.c:104
ULONG CmNtGlobalFlag
Definition: cmdata.c:19
VOID NTAPI DbgkInitialize(VOID)
Definition: dbgkobj.c:1498
#define PAGE_SIZE
Definition: env_spec_w32.h:49
BOOLEAN NTAPI HalInitSystem(_In_ ULONG BootPhase, _In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: halinit.c:45
VOID NTAPI HeadlessInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: hdlsterm.c:189
#define VER_PRODUCTBETA_STR
Definition: ieverp.h:10
_Check_return_ long __cdecl atol(_In_z_ const char *_Str)
#define FLG_KERNEL_STACK_TRACE_DB
Definition: pstypes.h:68
#define FLG_ENABLE_EXCEPTION_LOGGING
Definition: pstypes.h:82
#define FLG_ENABLE_CLOSE_EXCEPTIONS
Definition: pstypes.h:81
#define FLG_ENABLE_KDEBUG_SYMBOL_LOAD
Definition: pstypes.h:73
void __cdecl _enable(void)
Definition: intrin_arm.h:373
BOOLEAN KdBreakAfterSymbolLoad
Definition: kddata.c:79
VOID NTAPI ExInitPoolLookasidePointers(VOID)
Definition: lookas.c:59
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define DBG_STATUS_CONTROL_C
Definition: kdtypes.h:39
NTSYSAPI VOID NTAPI RtlInitNlsTables(_In_ PUSHORT AnsiTableBase, _In_ PUSHORT OemTableBase, _In_ PUSHORT CaseTableBase, _Out_ PNLSTABLEINFO NlsTable)
NTSYSAPI VOID NTAPI RtlResetRtlTranslations(_In_ PNLSTABLEINFO NlsTable)
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI NTSTATUS NTAPI RtlFindMessage(_In_ PVOID BaseAddress, _In_ ULONG Type, _In_ ULONG Language, _In_ ULONG MessageId, _Out_ PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry)
NTSYSAPI VOID NTAPI RtlInitString(PSTRING DestinationString, PCSZ SourceString)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define ANSI_NULL
VOID NTAPI ExpInitializeHandleTables(VOID)
Definition: handle.c:34
ULONG ExpInitializationPhase
Definition: init.c:68
VOID NTAPI ExBurnMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG_PTR PagesToDestroy, IN TYPE_OF_MEMORY MemoryType)
Definition: init.c:882
ULONG CmNtCSDReleaseType
Definition: init.c:60
PVOID ExpNlsTableBase
Definition: init.c:85
ULONG NTAPI ExComputeTickCountMultiplier(IN ULONG ClockIncrement)
Definition: init.c:606
BOOLEAN IoRemoteBootClient
Definition: init.c:70
UNICODE_STRING NtSystemRoot
Definition: init.c:76
ULONG ExpOemCodePageDataOffset
Definition: init.c:86
NLSTABLEINFO ExpNlsTableInfo
Definition: init.c:88
BOOLEAN NTAPI ExpIsLoaderValid(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: init.c:770
ULONG NtMajorVersion
Definition: init.c:45
ULONG ExpUnicodeCaseTableDataOffset
Definition: init.c:87
BOOLEAN NTAPI MmArmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: mminit.c:2037
ULONG NtGlobalFlag
Definition: init.c:54
UNICODE_STRING CmVersionString
Definition: init.c:61
ULONG CmNtSpBuildNumber
Definition: init.c:58
BOOLEAN ExpInTextModeSetup
Definition: init.c:69
ULONG ExpAnsiCodePageDataOffset
Definition: init.c:86
ULONG NtMinorVersion
Definition: init.c:46
ULONG CmNtCSDVersion
Definition: init.c:59
VOID NTAPI ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: init.c:213
UNICODE_STRING CmCSDVersionString
Definition: init.c:62
BOOLEAN NTAPI ExInitSystem(VOID)
Definition: init.c:744
ULONG ExpTickCountMultiplier
Definition: time.c:26
#define MM_HIGHEST_USER_ADDRESS_WOW64
Definition: mm.h:35
#define MM_SYSTEM_RANGE_START_WOW64
Definition: mm.h:36
#define MmSystemRangeStart
Definition: mm.h:32
BOOLEAN NTAPI PpInitSystem(VOID)
Definition: pnpmgr.c:1142
VOID NTAPI KiInitializeBugCheck(VOID)
Definition: bug.c:300
ULONG KiServiceLimit
Definition: krnlinit.c:25
BOOLEAN NTAPI SeInitSystem(VOID)
Main security manager initialization function.
Definition: semgr.c:285
ULONG KeMaximumIncrement
Definition: clock.c:20
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
NTSTRSAFEAPI RtlStringCbCatExA(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc, _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PSTR *ppszDestEnd, _Out_opt_ size_t *pcbRemaining, _In_ STRSAFE_DWORD dwFlags)
Definition: ntstrsafe.h:718
NTSTRSAFEAPI RtlStringCbCopyExA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc, _Outptr_opt_result_bytebuffer_(*pcbRemaining) STRSAFE_LPSTR *ppszDestEnd, _Out_opt_ size_t *pcbRemaining, _In_ STRSAFE_DWORD dwFlags)
Definition: ntstrsafe.h:270
#define VER_PRODUCTMAJORVERSION
Definition: ntverp.h:25
#define VER_PRODUCTBUILD_QFE
Definition: ntverp.h:20
#define VER_PRODUCTMINORVERSION
Definition: ntverp.h:26
BOOLEAN NTAPI ObInitSystem(VOID)
Definition: obinit.c:203
#define RT_MESSAGETABLE
Definition: pedump.c:373
unsigned short USHORT
Definition: pedump.c:61
KSERVICE_TABLE_DESCRIPTOR KeServiceDescriptorTable[SSDT_MAX_ENTRIES]
Definition: procobj.c:23
KSERVICE_TABLE_DESCRIPTOR KeServiceDescriptorTableShadow[SSDT_MAX_ENTRIES]
Definition: procobj.c:24
BOOLEAN NTAPI PsInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: psmgr.c:532
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108
PVOID MmHighestUserAddress
Definition: rtlcompat.c:29
_Check_return_ _CRTIMP int __cdecl _memicmp(_In_reads_bytes_opt_(_Size) const void *_Buf1, _In_reads_bytes_opt_(_Size) const void *_Buf2, _In_ size_t _Size)
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_NEUTRAL
Definition: nls.h:167
@ LoaderBad
Definition: arc.h:177
_strupr
Definition: string.h:453
#define KI_USER_SHARED_DATA
#define SharedUserData
#define SETUPLDR_REMOTE_BOOT
Definition: setupblk.h:8
#define SETUPLDR_TEXT_MODE
Definition: setupblk.h:7
Definition: btrfs_drv.h:1876
PVOID DllBase
Definition: btrfs_drv.h:1880
Definition: rtltypes.h:1923
UCHAR Text[ANYSIZE_ARRAY]
Definition: rtltypes.h:1926
PVOID UnicodeCodePageData
Definition: arc.h:325
PVOID AnsiCodePageData
Definition: arc.h:323
PVOID OemCodePageData
Definition: arc.h:324
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint32_t * PULONG
Definition: typedefs.h:59
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
char * PCHAR
Definition: typedefs.h:51
char CHAR
Definition: xmlstorage.h:175

Referenced by KiInitializeKernel().

◆ ExpInitializeHandleTables()

VOID NTAPI ExpInitializeHandleTables ( VOID  )

Definition at line 34 of file handle.c.

35{
36 /* Initialize the list of handle tables and the lock */
39}
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ExInitializePushLock
Definition: ex.h:1016

Referenced by ExpInitializeExecutive().

◆ ExpInitializeKeyedEventImplementation()

BOOLEAN NTAPI ExpInitializeKeyedEventImplementation ( VOID  )

Referenced by ExpInitSystemPhase1().

◆ ExpInitializeMutantImplementation()

BOOLEAN NTAPI ExpInitializeMutantImplementation ( VOID  )

Definition at line 52 of file mutant.c.

53{
54 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
57 DPRINT("Creating Mutant Object Type\n");
58
59 /* Create the Event Pair Object Type */
60 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
61 RtlInitUnicodeString(&Name, L"Mutant");
62 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
63 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KMUTANT);
64 ObjectTypeInitializer.GenericMapping = ExpMutantMapping;
65 ObjectTypeInitializer.PoolType = NonPagedPool;
66 ObjectTypeInitializer.DeleteProcedure = ExpDeleteMutant;
67 ObjectTypeInitializer.ValidAccessMask = MUTANT_ALL_ACCESS;
68 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
69 Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExMutantObjectType);
70 if (!NT_SUCCESS(Status)) return FALSE;
71 return TRUE;
72}
VOID NTAPI ExpDeleteMutant(PVOID ObjectBody)
Definition: mutant.c:38
GENERIC_MAPPING ExpMutantMapping
Definition: mutant.c:20
POBJECT_TYPE ExMutantObjectType
Definition: mutant.c:18
#define MUTANT_ALL_ACCESS
Definition: extypes.h:110
struct _KMUTANT KMUTANT

Referenced by ExpInitSystemPhase1().

◆ ExpInitializeProfileImplementation()

BOOLEAN NTAPI ExpInitializeProfileImplementation ( VOID  )

Definition at line 62 of file profile.c.

63{
64 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
67 DPRINT("Creating Profile Object Type\n");
68
69 /* Initialize the Mutex to lock the States */
71
72 /* Create the Event Pair Object Type */
73 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
74 RtlInitUnicodeString(&Name, L"Profile");
75 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
76 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KPROFILE);
77 ObjectTypeInitializer.GenericMapping = ExpProfileMapping;
78 ObjectTypeInitializer.PoolType = NonPagedPool;
79 ObjectTypeInitializer.DeleteProcedure = ExpDeleteProfile;
80 ObjectTypeInitializer.ValidAccessMask = PROFILE_ALL_ACCESS;
81 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
82 Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExProfileObjectType);
83 if (!NT_SUCCESS(Status)) return FALSE;
84 return TRUE;
85}
#define PROFILE_ALL_ACCESS
Definition: extypes.h:131
struct _KPROFILE KPROFILE
POBJECT_TYPE ExProfileObjectType
Definition: profile.c:18
VOID NTAPI ExpDeleteProfile(PVOID ObjectBody)
Definition: profile.c:33
KMUTEX ExpProfileMutex
Definition: profile.c:19
GENERIC_MAPPING ExpProfileMapping
Definition: profile.c:21
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67

Referenced by ExpInitSystemPhase1().

◆ ExpInitializePushLocks()

VOID NTAPI ExpInitializePushLocks ( VOID  )

Definition at line 45 of file pushlock.c.

46{
47#ifdef CONFIG_SMP
48 /* Initialize an internal 1024-iteration spin for MP CPUs */
49 if (KeNumberProcessors > 1)
51#endif
52}
ULONG ExPushLockSpinCount
Definition: pushlock.c:17

Referenced by ExpInitSystemPhase1().

◆ ExpInitializeSemaphoreImplementation()

BOOLEAN NTAPI ExpInitializeSemaphoreImplementation ( VOID  )

Definition at line 43 of file sem.c.

44{
45 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
48 DPRINT("Creating Semaphore Object Type\n");
49
50 /* Create the Event Pair Object Type */
51 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
52 RtlInitUnicodeString(&Name, L"Semaphore");
53 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
54 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KSEMAPHORE);
55 ObjectTypeInitializer.GenericMapping = ExSemaphoreMapping;
56 ObjectTypeInitializer.PoolType = NonPagedPool;
57 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
58 ObjectTypeInitializer.ValidAccessMask = SEMAPHORE_ALL_ACCESS;
59 Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExSemaphoreObjectType);
60 if (!NT_SUCCESS(Status)) return FALSE;
61 return TRUE;
62}
GENERIC_MAPPING ExSemaphoreMapping
Definition: sem.c:24
POBJECT_TYPE ExSemaphoreObjectType
Definition: sem.c:22
#define SEMAPHORE_ALL_ACCESS
Definition: winbase.h:161
struct _KSEMAPHORE KSEMAPHORE

Referenced by ExpInitSystemPhase1().

◆ ExpInitializeTimerImplementation()

BOOLEAN NTAPI ExpInitializeTimerImplementation ( VOID  )

Definition at line 223 of file timer.c.

224{
225 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
228
229 /* Create the Timer Object Type */
230 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
231 RtlInitUnicodeString(&Name, L"Timer");
232 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
233 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
234 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(ETIMER);
235 ObjectTypeInitializer.GenericMapping = ExpTimerMapping;
236 ObjectTypeInitializer.PoolType = NonPagedPool;
237 ObjectTypeInitializer.ValidAccessMask = TIMER_ALL_ACCESS;
238 ObjectTypeInitializer.DeleteProcedure = ExpDeleteTimer;
239 Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExTimerType);
240 if (!NT_SUCCESS(Status)) return FALSE;
241
242 /* Initialize the Wait List and Lock */
245 return TRUE;
246}
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
struct _ETIMER ETIMER
#define TIMER_ALL_ACCESS
Definition: extypes.h:116
POBJECT_TYPE ExTimerType
Definition: timer.c:18
VOID NTAPI ExpDeleteTimer(IN PVOID ObjectBody)
Definition: timer.c:108
static GENERIC_MAPPING ExpTimerMapping
Definition: timer.c:24
LIST_ENTRY ExpWakeList
Definition: timer.c:21
KSPIN_LOCK ExpWakeListLock
Definition: timer.c:20

Referenced by ExpInitSystemPhase1().

◆ ExpInitializeWorkerThreads()

VOID NTAPI ExpInitializeWorkerThreads ( VOID  )

Definition at line 522 of file work.c.

523{
524 ULONG WorkQueueType;
525 ULONG CriticalThreads, DelayedThreads;
526 HANDLE ThreadHandle;
528 ULONG i;
530
531 /* Setup the stack swap support */
535
536 /* Set the number of critical and delayed threads. We shouldn't hardcode */
537 DelayedThreads = EX_DELAYED_WORK_THREADS;
538 CriticalThreads = EX_CRITICAL_WORK_THREADS;
539
540 /* Protect against greedy registry modifications */
545
546 /* Calculate final count */
547 DelayedThreads += ExpAdditionalDelayedWorkerThreads;
548 CriticalThreads += ExpAdditionalCriticalWorkerThreads;
549
550 /* Initialize the Array */
551 for (WorkQueueType = 0; WorkQueueType < MaximumWorkQueue; WorkQueueType++)
552 {
553 /* Clear the structure and initialize the queue */
554 RtlZeroMemory(&ExWorkerQueue[WorkQueueType], sizeof(EX_WORK_QUEUE));
555 KeInitializeQueue(&ExWorkerQueue[WorkQueueType].WorkerQueue, 0);
556 }
557
558 /* Dynamic threads are only used for the critical queue */
560
561 /* Initialize the balance set manager events */
565 FALSE);
566
567 /* Create the built-in worker threads for the critical queue */
568 for (i = 0; i < CriticalThreads; i++)
569 {
570 /* Create the thread */
573 }
574
575 /* Create the built-in worker threads for the delayed queue */
576 for (i = 0; i < DelayedThreads; i++)
577 {
578 /* Create the thread */
581 }
582
583 /* Create the built-in worker thread for the hypercritical queue */
585
586 /* Create the balance set manager thread */
587 Status = PsCreateSystemThread(&ThreadHandle,
589 NULL,
590 0,
591 NULL,
593 NULL);
594 if (!NT_SUCCESS(Status))
595 {
596 KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
597 }
598
599 /* Get a pointer to it for the shutdown process */
600 ObReferenceObjectByHandle(ThreadHandle,
602 NULL,
604 (PVOID*)&Thread,
605 NULL);
607
608 /* Close the handle and return */
609 ObCloseHandle(ThreadHandle, KernelMode);
610}
#define min(a, b)
Definition: monoChain.cc:55
#define KernelMode
Definition: asm.h:38
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
@ SynchronizationEvent
VOID NTAPI KeInitializeQueue(IN PKQUEUE Queue, IN ULONG Count OPTIONAL)
Definition: queue.c:148
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3379
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
ULONG MakeThreadsAsNecessary
Definition: extypes.h:400
EX_QUEUE_WORKER_INFO Info
Definition: extypes.h:412
VOID NTAPI ExpWorkerThreadBalanceManager(IN PVOID Context)
Definition: work.c:427
ULONG ExCriticalWorkerThreads
Definition: work.c:34
KEVENT ExpThreadSetManagerEvent
Definition: work.c:45
PETHREAD ExpWorkerThreadBalanceManagerPtr
Definition: work.c:49
BOOLEAN ExpWorkersCanSwap
Definition: work.c:40
ULONG ExDelayedWorkerThreads
Definition: work.c:35
ULONG ExpAdditionalCriticalWorkerThreads
Definition: work.c:36
VOID NTAPI ExpCreateWorkerThread(WORK_QUEUE_TYPE WorkQueueType, IN BOOLEAN Dynamic)
Definition: work.c:250
#define EX_DELAYED_WORK_THREADS
Definition: work.c:19
#define EX_CRITICAL_WORK_THREADS
Definition: work.c:20
KEVENT ExpThreadSetManagerShutdownEvent
Definition: work.c:46
ULONG ExpAdditionalDelayedWorkerThreads
Definition: work.c:37
FAST_MUTEX ExpWorkerSwapinMutex
Definition: work.c:42
EX_WORK_QUEUE ExWorkerQueue[MaximumWorkQueue]
Definition: work.c:31
LIST_ENTRY ExpWorkerListHead
Definition: work.c:41
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
@ DelayedWorkQueue
Definition: extypes.h:190
@ CriticalWorkQueue
Definition: extypes.h:189
@ HyperCriticalWorkQueue
Definition: extypes.h:191
@ MaximumWorkQueue
Definition: extypes.h:192

Referenced by ExpInitSystemPhase1().

◆ ExpInitLookasideLists()

VOID NTAPI ExpInitLookasideLists ( VOID  )

Definition at line 89 of file lookas.c.

90{
91 ULONG i;
92
93 /* Initialize locks and lists */
100
101 /* Initialize the system lookaside lists */
102 for (i = 0; i < NUMBER_POOL_LOOKASIDE_LISTS; i++)
103 {
104 /* Initialize the non-paged list */
107 (i + 1) * 8,
108 'looP',
109 256,
111
112 /* Initialize the paged list */
114 PagedPool,
115 (i + 1) * 8,
116 'looP',
117 256,
119 }
120}
KSPIN_LOCK ExpPagedLookasideListLock
Definition: lookas.c:20
VOID NTAPI ExInitializeSystemLookasideList(IN PGENERAL_LOOKASIDE List, IN POOL_TYPE Type, IN ULONG Size, IN ULONG Tag, IN USHORT MaximumDepth, IN PLIST_ENTRY ListHead)
Definition: lookas.c:31
LIST_ENTRY ExPoolLookasideListHead
Definition: lookas.c:22
KSPIN_LOCK ExpNonPagedLookasideListLock
Definition: lookas.c:18
LIST_ENTRY ExpPagedLookasideListHead
Definition: lookas.c:19
LIST_ENTRY ExSystemLookasideListHead
Definition: lookas.c:21
LIST_ENTRY ExpNonPagedLookasideListHead
Definition: lookas.c:17

◆ ExpLockHandleTableEntry()

BOOLEAN NTAPI ExpLockHandleTableEntry ( IN PHANDLE_TABLE  HandleTable,
IN PHANDLE_TABLE_ENTRY  HandleTableEntry 
)

Definition at line 884 of file handle.c.

886{
887 LONG_PTR NewValue, OldValue;
888
889 /* Sanity check */
890 ASSERT((KeGetCurrentThread()->CombinedApcDisable != 0) ||
892
893 /* Start lock loop */
894 for (;;)
895 {
896 /* Get the current value and check if it's locked */
897 OldValue = *(volatile LONG_PTR *)&HandleTableEntry->Object;
899 {
900 /* It's not locked, remove the lock bit to lock it */
901 NewValue = OldValue & ~EXHANDLE_TABLE_ENTRY_LOCK_BIT;
902 if (InterlockedCompareExchangePointer(&HandleTableEntry->Object,
903 (PVOID)NewValue,
904 (PVOID)OldValue) == (PVOID)OldValue)
905 {
906 /* We locked it, get out */
907 return TRUE;
908 }
909 }
910 else
911 {
912 /* We couldn't lock it, bail out if it's been freed */
913 if (!OldValue) return FALSE;
914 }
915
916 /* It's locked, wait for it to be unlocked */
917 ExpBlockOnLockedHandleEntry(HandleTable, HandleTableEntry);
918 }
919}
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
VOID NTAPI ExpBlockOnLockedHandleEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:858
void * PVOID
Definition: typedefs.h:50

Referenced by ExChangeHandle(), ExDestroyHandle(), ExDupHandleTable(), ExEnumHandleTable(), ExMapHandleToPointer(), ExSweepHandleTable(), and QSI_DEF().

◆ ExpLookupHandleTableEntry()

PHANDLE_TABLE_ENTRY NTAPI ExpLookupHandleTableEntry ( IN PHANDLE_TABLE  HandleTable,
IN EXHANDLE  Handle 
)

Definition at line 43 of file handle.c.

45{
46 ULONG TableLevel;
47 ULONG_PTR TableBase;
48 PHANDLE_TABLE_ENTRY HandleArray, Entry;
49 PVOID *PointerArray;
50
51 /* Clear the tag bits */
52 Handle.TagBits = 0;
53
54 /* Check if the handle is in the allocated range */
55 if (Handle.Value >= HandleTable->NextHandleNeedingPool)
56 {
57 return NULL;
58 }
59
60 /* Get the table code */
61 TableBase = HandleTable->TableCode;
62
63 /* Extract the table level and actual table base */
64 TableLevel = (ULONG)(TableBase & 3);
65 TableBase &= ~3;
66
67 PointerArray = (PVOID*)TableBase;
68 HandleArray = (PHANDLE_TABLE_ENTRY)TableBase;
69
70 /* Check what level we're running at */
71 switch (TableLevel)
72 {
73 case 2:
74
75 /* Get the mid level pointer array */
76 PointerArray = PointerArray[Handle.HighIndex];
77 ASSERT(PointerArray != NULL);
78
79 /* Fall through */
80 case 1:
81
82 /* Get the handle array */
83 HandleArray = PointerArray[Handle.MidIndex];
84 ASSERT(HandleArray != NULL);
85
86 /* Fall through */
87 case 0:
88
89 /* Get the entry using the low index */
90 Entry = &HandleArray[Handle.LowIndex];
91
92 /* All done */
93 break;
94
95 default:
96
98 Entry = NULL;
99 }
100
101 /* Return the handle entry */
102 return Entry;
103}
struct _HANDLE_TABLE_ENTRY * PHANDLE_TABLE_ENTRY

Referenced by ExChangeHandle(), ExDestroyHandle(), ExDupHandleTable(), ExEnumHandleTable(), ExMapHandleToPointer(), ExpAllocateHandleTableEntry(), ExpFreeHandleTableEntry(), ExSweepHandleTable(), and QSI_DEF().

◆ ExpResourceInitialization()

VOID NTAPI ExpResourceInitialization ( VOID  )

Definition at line 173 of file resource.c.

174{
175 /* Setup the timeout */
176 ExpTimeout.QuadPart = Int32x32To64(4, -10000000);
179}
#define Int32x32To64(a, b)
KSPIN_LOCK ExpResourceSpinLock
Definition: resource.c:79
LARGE_INTEGER ExpTimeout
Definition: resource.c:74
LIST_ENTRY ExpSystemResourcesList
Definition: resource.c:80

Referenced by ExpInitSystemPhase0().

◆ ExpSetTimeZoneInformation()

NTSTATUS ExpSetTimeZoneInformation ( IN PRTL_TIME_ZONE_INFORMATION  TimeZoneInformation)

◆ ExpUuidInitialization()

BOOLEAN NTAPI ExpUuidInitialization ( VOID  )

Definition at line 53 of file uuid.c.

54{
56
59
60 return TRUE;
61}
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
FAST_MUTEX ExpUuidLock
Definition: uuid.c:35
BOOLEAN ExpUuidSequenceNumberValid
Definition: uuid.c:38
LARGE_INTEGER ExpUuidLastTimeAllocated
Definition: uuid.c:36

Referenced by ExpInitSystemPhase1().

◆ ExpWin32kInit()

BOOLEAN NTAPI ExpWin32kInit ( VOID  )

Definition at line 259 of file win32k.c.

260{
261 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
264 DPRINT("Creating Win32 Object Types\n");
265
266 /* Create the window station Object Type */
267 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
268 RtlInitUnicodeString(&Name, L"WindowStation");
269 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
270 ObjectTypeInitializer.GenericMapping = ExpWindowStationMapping;
271 ObjectTypeInitializer.PoolType = NonPagedPool;
272 ObjectTypeInitializer.DeleteProcedure = ExpWinStaObjectDelete;
273 ObjectTypeInitializer.ParseProcedure = ExpWinStaObjectParse;
274 ObjectTypeInitializer.OkayToCloseProcedure = ExpWindowStationOkToClose;
275 ObjectTypeInitializer.SecurityRequired = TRUE;
276 ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK |
279 ObjectTypeInitializer.ValidAccessMask = STANDARD_RIGHTS_REQUIRED;
281 &ObjectTypeInitializer,
282 NULL,
284 if (!NT_SUCCESS(Status)) return FALSE;
285
286 /* Create desktop object type */
287 RtlInitUnicodeString(&Name, L"Desktop");
288 ObjectTypeInitializer.GenericMapping = ExpDesktopMapping;
289 ObjectTypeInitializer.DeleteProcedure = ExpDesktopDelete;
290 ObjectTypeInitializer.ParseProcedure = NULL;
291 ObjectTypeInitializer.OkayToCloseProcedure = ExpDesktopOkToClose;
292 ObjectTypeInitializer.OpenProcedure = ExpDesktopOpen;
293 ObjectTypeInitializer.CloseProcedure = ExpDesktopClose;
295 &ObjectTypeInitializer,
296 NULL,
298 if (!NT_SUCCESS(Status)) return FALSE;
299
300 return TRUE;
301}
#define OBJ_EXCLUSIVE
Definition: winternl.h:227
#define STANDARD_RIGHTS_REQUIRED
Definition: nt_native.h:63
OB_CLOSE_METHOD CloseProcedure
Definition: obtypes.h:368
OB_OPEN_METHOD OpenProcedure
Definition: obtypes.h:367
OB_PARSE_METHOD ParseProcedure
Definition: obtypes.h:370
OB_OKAYTOCLOSE_METHOD OkayToCloseProcedure
Definition: obtypes.h:373
GENERIC_MAPPING ExpWindowStationMapping
Definition: win32k.c:24
BOOLEAN NTAPI ExpWindowStationOkToClose(IN PEPROCESS Process OPTIONAL, IN PVOID Object, IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: win32k.c:135
GENERIC_MAPPING ExpDesktopMapping
Definition: win32k.c:32
NTSTATUS NTAPI ExpWinStaObjectParse(IN PVOID ParseObject, IN PVOID ObjectType, IN OUT PACCESS_STATE AccessState, IN KPROCESSOR_MODE AccessMode, IN ULONG Attributes, IN OUT PUNICODE_STRING CompleteName, IN OUT PUNICODE_STRING RemainingName, IN OUT PVOID Context OPTIONAL, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL, OUT PVOID *Object)
Definition: win32k.c:171
POBJECT_TYPE ExDesktopObjectType
Definition: win32k.c:22
VOID NTAPI ExpWinStaObjectDelete(PVOID DeletedObject)
Definition: win32k.c:157
BOOLEAN NTAPI ExpDesktopOkToClose(IN PEPROCESS Process OPTIONAL, IN PVOID Object, IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: win32k.c:113
VOID NTAPI ExpDesktopClose(IN PEPROCESS Process OPTIONAL, IN PVOID Object, IN ACCESS_MASK GrantedAccess, IN ULONG ProcessHandleCount, IN ULONG SystemHandleCount)
Definition: win32k.c:237
NTSTATUS NTAPI ExpDesktopOpen(IN OB_OPEN_REASON Reason, IN PEPROCESS Process OPTIONAL, IN PVOID ObjectBody, IN ACCESS_MASK GrantedAccess, IN ULONG HandleCount)
Definition: win32k.c:216
VOID NTAPI ExpDesktopDelete(PVOID DeletedObject)
Definition: win32k.c:202
POBJECT_TYPE ExWindowStationObjectType
Definition: win32k.c:21

Referenced by ExpInitSystemPhase1().

◆ ExReferenceCallBackBlock()

PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExReferenceCallBackBlock ( IN OUT PEX_CALLBACK  CallBack)

Definition at line 122 of file callback.c.

123{
124 EX_FAST_REF OldValue;
126 PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock;
127
128 /* Acquire a reference */
129 OldValue = ExAcquireFastReference(&CallBack->RoutineBlock);
130 Count = ExGetCountFastReference(OldValue);
131
132 /* Fail if there isn't any object */
133 if (!ExGetObjectFastReference(OldValue)) return NULL;
134
135 /* Check if we don't have a reference */
136 if (!Count)
137 {
138 /* FIXME: Race */
139 DPRINT1("Unhandled callback race condition\n");
140 ASSERT(FALSE);
141 return NULL;
142 }
143
144 /* Get the callback block */
145 CallbackBlock = ExGetObjectFastReference(OldValue);
146
147 /* Check if this is the last reference */
148 if (Count == 1)
149 {
150 /* Acquire rundown protection */
153 {
154 /* Insert references */
155 if (!ExInsertFastReference(&CallBack->RoutineBlock, CallbackBlock))
156 {
157 /* Backdown the rundown acquire */
160 }
161 }
162 }
163
164 /* Return the callback block */
165 return CallbackBlock;
166}
FORCEINLINE BOOLEAN ExInsertFastReference(IN OUT PEX_FAST_REF FastRef, IN PVOID Object)
Definition: ex.h:649
FORCEINLINE EX_FAST_REF ExAcquireFastReference(IN OUT PEX_FAST_REF FastRef)
Definition: ex.h:620

Referenced by ExDoCallBack(), PsRemoveCreateThreadNotifyRoutine(), PsRemoveLoadImageNotifyRoutine(), and PsSetCreateProcessNotifyRoutine().

◆ ExRefreshTimeZoneInformation()

BOOLEAN NTAPI ExRefreshTimeZoneInformation ( IN PLARGE_INTEGER  SystemBootTime)

Definition at line 320 of file time.c.

321{
322 LARGE_INTEGER CurrentTime, NewTimeZoneBias;
324
325 DPRINT("ExRefreshTimeZoneInformation\n");
326
327 /* Set the global data for ExpTimeZoneBias and the Time Zone ID */
328 Success = ExpGetTimeZoneId(CurrentBootTime, &ExpTimeZoneId, &NewTimeZoneBias);
329 if (!Success)
330 {
331 DPRINT1("ExpGetTimeZoneId failed\n");
332 return FALSE;
333 }
334 DPRINT("ExpTimeZoneId is %lu\n", ExpTimeZoneId);
335
336 ExpTimeZoneBias = NewTimeZoneBias;
337
338 /* Change SharedUserData->TimeZoneBias for user-mode applications */
339 SharedUserData->TimeZoneBias.High2Time = ExpTimeZoneBias.u.HighPart;
340 SharedUserData->TimeZoneBias.LowPart = ExpTimeZoneBias.u.LowPart;
341 SharedUserData->TimeZoneBias.High1Time = ExpTimeZoneBias.u.HighPart;
342 SharedUserData->TimeZoneId = ExpTimeZoneId;
343
344 /* Convert boot time from local time to UTC */
346
347 /* Convert system time from local time to UTC */
348 KeQuerySystemTime(&CurrentTime);;
349
350 /* Change it for user-mode applications */
351 CurrentTime.QuadPart += ExpTimeZoneBias.QuadPart;
352 SharedUserData->SystemTime.High2Time = CurrentTime.u.HighPart;
353 SharedUserData->SystemTime.LowPart = CurrentTime.u.LowPart;
354 SharedUserData->SystemTime.High1Time = CurrentTime.u.HighPart;
355
356 /* Return success */
357 return TRUE;
358}
@ Success
Definition: eventcreate.c:712
LARGE_INTEGER ExpTimeZoneBias
Definition: time.c:23
static BOOLEAN ExpGetTimeZoneId(_In_ PLARGE_INTEGER TimeNow, _Out_ PULONG TimeZoneId, _Out_ PLARGE_INTEGER NewTimeZoneBias)
Definition: time.c:39
ULONG ExpTimeZoneId
Definition: time.c:25
LARGE_INTEGER KeBootTime
Definition: clock.c:17
struct _LARGE_INTEGER::@2379 u

Referenced by Phase1InitializationDiscard().

◆ ExReleaseFastReference()

FORCEINLINE BOOLEAN ExReleaseFastReference ( IN PEX_FAST_REF  FastRef,
IN PVOID  Object 
)

Definition at line 688 of file ex.h.

690{
691 EX_FAST_REF OldValue, NewValue;
692
693 /* Sanity checks */
694 ASSERT(Object != NULL);
696
697 /* Start reference loop */
698 for (;;)
699 {
700 /* Get the current reference count */
701 OldValue = *FastRef;
702
703 /* Check if we're full if if the pointer changed */
704 if ((OldValue.Value ^ (ULONG_PTR)Object) >= MAX_FAST_REFS) return FALSE;
705
706 /* Decrease the reference count */
707 NewValue.Value = OldValue.Value + 1;
708 NewValue.Object = ExpChangePushlock(&FastRef->Object,
709 NewValue.Object,
710 OldValue.Object);
711 if (NewValue.Object != OldValue.Object) continue;
712
713 /* We are done */
714 break;
715 }
716
717 /* Return success */
718 return TRUE;
719}

Referenced by ExDereferenceCallBackBlock(), and ObFastDereferenceObject().

◆ ExReleasePushLock()

FORCEINLINE VOID ExReleasePushLock ( PEX_PUSH_LOCK  PushLock)

Definition at line 1299 of file ex.h.

1300{
1301 EX_PUSH_LOCK OldValue = *PushLock;
1302 EX_PUSH_LOCK NewValue;
1303
1304 /* Sanity checks */
1305 ASSERT(OldValue.Locked);
1306
1307 /* Check if the pushlock is shared */
1308 if (OldValue.Shared > 1)
1309 {
1310 /* Decrease the share count */
1311 NewValue.Value = OldValue.Value - EX_PUSH_LOCK_SHARE_INC;
1312 }
1313 else
1314 {
1315 /* Clear the pushlock entirely */
1316 NewValue.Value = 0;
1317 }
1318
1319 /* Check if nobody is waiting on us and try clearing the lock here */
1320 if ((OldValue.Waiting) ||
1321 (ExpChangePushlock(PushLock, NewValue.Ptr, OldValue.Ptr) !=
1322 OldValue.Ptr))
1323 {
1324 /* We have waiters, use the long path */
1325 ExfReleasePushLock(PushLock);
1326 }
1327}
VOID FASTCALL ExfReleasePushLock(PEX_PUSH_LOCK PushLock)
Definition: pushlock.c:810
ULONG_PTR Waiting
Definition: extypes.h:460
ULONG_PTR Shared
Definition: extypes.h:463

Referenced by CmLoadKey(), CmpDestroyHive(), CmpDoFlushAll(), CmpDoFlushNextHive(), CmpInitializeHive(), CmpReleaseKcbLockByIndex(), CmpUnlinkHiveFromMaster(), ObpReleaseDirectoryLock(), and ObpSdReleaseLockShared().

◆ ExReleasePushLockExclusive()

FORCEINLINE VOID ExReleasePushLockExclusive ( PEX_PUSH_LOCK  PushLock)

Definition at line 1255 of file ex.h.

1256{
1257 EX_PUSH_LOCK OldValue;
1258
1259 /* Sanity checks */
1260 ASSERT(PushLock->Locked);
1261
1262 /* Unlock the pushlock */
1263 OldValue.Value = InterlockedExchangeAddSizeT((PSIZE_T)PushLock,
1265
1266 /* Sanity checks */
1267 ASSERT(OldValue.Locked);
1268 ASSERT(OldValue.Waiting || OldValue.Shared == 0);
1269
1270 /* Check if anyone is waiting on it and it's not already waking*/
1271 if ((OldValue.Waiting) && !(OldValue.Waking))
1272 {
1273 /* Wake it up */
1274 ExfTryToWakePushLock(PushLock);
1275 }
1276}
LONG_PTR SSIZE_T
Definition: basetsd.h:181
#define InterlockedExchangeAddSizeT(a, b)
Definition: interlocked.h:196
VOID FASTCALL ExfTryToWakePushLock(PEX_PUSH_LOCK PushLock)
Definition: pushlock.c:1165
ULONG_PTR Waking
Definition: extypes.h:461
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80

Referenced by CmUnloadKey(), ExCreateHandleTable(), ExDupHandleTable(), ExpAllocateHandleTableEntry(), ExRemoveHandleTable(), GDIOBJ_vDeleteObject(), GDIOBJ_vUnlockObject(), GdiPoolAllocate(), GdiPoolFree(), MiUnlockProcessWorkingSet(), MiUnlockProcessWorkingSetUnsafe(), MiUnlockWorkingSet(), NtUnloadKey2(), ObpSdReleaseLock(), PspCreateThread(), PspDeleteThread(), PspExitThread(), PspUnlockProcessSecurityExclusive(), PspUnlockThreadSecurityExclusive(), PsSetProcessWin32Process(), and TEXTOBJ_UnlockText().

◆ ExReleasePushLockShared()

FORCEINLINE VOID ExReleasePushLockShared ( PEX_PUSH_LOCK  PushLock)

Definition at line 1216 of file ex.h.

1217{
1218 EX_PUSH_LOCK OldValue;
1219
1220 /* Sanity checks */
1221 ASSERT(PushLock->Locked);
1222
1223 /* Try to clear the pushlock */
1225 if (ExpChangePushlock(PushLock, 0, OldValue.Ptr) != OldValue.Ptr)
1226 {
1227 /* There are still other people waiting on it */
1228 ExfReleasePushLockShared(PushLock);
1229 }
1230}
VOID FASTCALL ExfReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: pushlock.c:956

Referenced by ExpAllocateHandleTableEntry(), MiUnlockProcessWorkingSetShared(), MiUnlockWorkingSetShared(), NtSetInformationProcess(), NtSetInformationThread(), PsGetNextProcessThread(), PspUnlockProcessSecurityShared(), PspUnlockThreadSecurityShared(), and QSI_DEF().

◆ ExReleaseTimeRefreshLock()

VOID NTAPI ExReleaseTimeRefreshLock ( VOID  )

Definition at line 177 of file time.c.

178{
179 /* Release the lock and re-enable APCs */
182}
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822

Referenced by ExSetTimerResolution(), and KdpTimeSlipWork().

◆ ExShutdownSystem()

VOID NTAPI ExShutdownSystem ( VOID  )

Definition at line 21 of file shutdown.c.

22{
23 /* Dereference the hard-error port and process objects */
25 {
28 }
30 {
33 }
34}
PVOID ExpDefaultErrorPort
Definition: harderr.c:18
PEPROCESS ExpDefaultErrorPortProcess
Definition: harderr.c:19

Referenced by PopGracefulShutdown().

◆ ExSwapFastReference()

FORCEINLINE EX_FAST_REF ExSwapFastReference ( IN PEX_FAST_REF  FastRef,
IN PVOID  Object 
)

Definition at line 723 of file ex.h.

725{
726 EX_FAST_REF NewValue, OldValue;
727
728 /* Sanity check */
730
731 /* Check if an object is being set */
732 if (!Object)
733 {
734 /* Clear the field */
735 NewValue.Object = NULL;
736 }
737 else
738 {
739 /* Otherwise, we assume the object was referenced and is ready */
740 NewValue.Value = (ULONG_PTR)Object | MAX_FAST_REFS;
741 }
742
743 /* Update the object */
744 OldValue.Object = InterlockedExchangePointer(&FastRef->Object, NewValue.Object);
745 return OldValue;
746}

Referenced by ObFastReplaceObject().

◆ ExSwapinWorkerThreads()

VOID NTAPI ExSwapinWorkerThreads ( IN BOOLEAN  AllowSwap)

Definition at line 637 of file work.c.

638{
640 PETHREAD CurrentThread = PsGetCurrentThread(), Thread;
642 KAPC Apc;
643 PAGED_CODE();
644
645 /* Initialize an event so we know when we're done */
647
648 /* Lock this routine */
650
651 /* New threads cannot swap anymore */
652 ExpWorkersCanSwap = AllowSwap;
653
654 /* Loop all threads in the system process */
656 while (Thread)
657 {
658 /* Skip threads with explicit permission to do this */
660
661 /* Check if we reached ourselves */
662 if (Thread == CurrentThread)
663 {
664 /* Do it inline */
666 }
667 else
668 {
669 /* Queue an APC */
670 KeInitializeApc(&Apc,
671 &Thread->Tcb,
674 NULL,
675 NULL,
677 &AllowSwap);
678 if (KeInsertQueueApc(&Apc, &Event, NULL, 3))
679 {
680 /* Wait for the APC to run */
683 }
684 }
685
686 /* Next thread */
687Next:
689 }
690
691 /* Release the lock */
693}
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
@ InsertApcEnvironment
Definition: ketypes.h:770
BOOLEAN NTAPI KeInsertQueueApc(IN PKAPC Apc, IN PVOID SystemArgument1, IN PVOID SystemArgument2, IN KPRIORITY PriorityBoost)
Definition: apc.c:735
VOID NTAPI KeInitializeApc(IN PKAPC Apc, IN PKTHREAD Thread, IN KAPC_ENVIRONMENT TargetEnvironment, IN PKKERNEL_ROUTINE KernelRoutine, IN PKRUNDOWN_ROUTINE RundownRoutine OPTIONAL, IN PKNORMAL_ROUTINE NormalRoutine, IN KPROCESSOR_MODE Mode, IN PVOID Context)
Definition: apc.c:651
PETHREAD NTAPI PsGetNextProcessThread(IN PEPROCESS Process, IN PETHREAD Thread OPTIONAL)
Definition: process.c:75
PEPROCESS PsInitialSystemProcess
Definition: psmgr.c:50
STDMETHOD() Next(THIS_ ULONG celt, IAssociationElement *pElement, ULONG *pceltFetched) PURE
KTHREAD Tcb
Definition: pstypes.h:1104
ULONG ExWorkerCanWaitUser
Definition: pstypes.h:1202
Definition: ketypes.h:547
BOOLEAN NTAPI KeSetKernelStackSwapEnable(IN BOOLEAN Enable)
Definition: thrdobj.c:988
VOID NTAPI ExpSetSwappingKernelApc(IN PKAPC Apc, OUT PKNORMAL_ROUTINE *NormalRoutine, IN OUT PVOID *NormalContext, IN OUT PVOID *SystemArgument1, IN OUT PVOID *SystemArgument2)
Definition: work.c:614
@ Executive
Definition: ketypes.h:415

Referenced by NtSetSystemPowerState().

◆ ExSweepHandleTable()

VOID NTAPI ExSweepHandleTable ( IN PHANDLE_TABLE  HandleTable,
IN PEX_SWEEP_HANDLE_CALLBACK  EnumHandleProcedure,
IN PVOID  Context 
)

Definition at line 1232 of file handle.c.

1235{
1237 PHANDLE_TABLE_ENTRY HandleTableEntry;
1238 PAGED_CODE();
1239
1240 /* Set the initial value and loop the entries */
1241 Handle.Value = INDEX_TO_HANDLE_VALUE(1);
1242 while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
1243 {
1244 /* Loop each handle */
1245 do
1246 {
1247 /* Lock the entry */
1248 if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1249 {
1250 /* Notify the callback routine */
1251 EnumHandleProcedure(HandleTableEntry,
1252 Handle.GenericHandleOverlay,
1253 Context);
1254 }
1255
1256 /* Go to the next handle and entry */
1257 Handle.Value += INDEX_TO_HANDLE_VALUE(1);
1258 HandleTableEntry++;
1260
1261 /* Skip past the last entry */
1262 Handle.Value += INDEX_TO_HANDLE_VALUE(1);
1263 }
1264}

Referenced by ObClearProcessHandleTable(), ObKillProcess(), and RtlpDestroyAtomHandleTable().

◆ ExSystemExceptionFilter()

LONG NTAPI ExSystemExceptionFilter ( VOID  )

Definition at line 349 of file harderr.c.

350{
351 return KeGetPreviousMode() != KernelMode ?
353}
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:91
#define KeGetPreviousMode()
Definition: ketypes.h:1115

Referenced by _IRQL_requires_max_(), NtAddAtom(), NtAllocateUuids(), NtCancelTimer(), NtCompareTokens(), NtCreateDebugObject(), NtCreateDirectoryObject(), NtCreateEvent(), NtCreateEventPair(), NtCreateIoCompletion(), NtCreateMutant(), NtCreateProfile(), NtCreateSemaphore(), NtCreateSymbolicLinkObject(), NtCreateTimer(), NtFindAtom(), NtOpenDirectoryObject(), NtOpenEvent(), NtOpenEventPair(), NtOpenIoCompletion(), NtOpenMutant(), NtOpenSemaphore(), NtOpenSymbolicLinkObject(), NtOpenTimer(), NtPulseEvent(), NtQueryDefaultLocale(), NtQueryDefaultUILanguage(), NtQueryDirectoryObject(), NtQueryEvent(), NtQueryInformationAtom(), NtQueryInstallUILanguage(), NtQueryIntervalProfile(), NtQueryIoCompletion(), NtQueryMutant(), NtQueryObject(), NtQueryPerformanceCounter(), NtQuerySecurityObject(), NtQuerySemaphore(), NtQuerySymbolicLinkObject(), NtQuerySystemEnvironmentValue(), NtQuerySystemInformation(), NtQueryTimer(), NtReleaseMutant(), NtReleaseSemaphore(), NtRemoveIoCompletion(), NtResetEvent(), NtSetEvent(), NtSetInformationDebugObject(), NtSetSystemTime(), NtSetThreadExecutionState(), NtSetTimer(), NtStartProfile(), NtWaitForDebugEvent(), ObpCaptureObjectCreateInformation(), ObpCaptureObjectName(), ObQueryTypeInfo(), and ProbeAndCaptureObjectAttributes().

◆ ExTimerRundown()

VOID NTAPI ExTimerRundown ( VOID  )

Definition at line 43 of file timer.c.

44{
47 PLIST_ENTRY CurrentEntry;
49 ULONG DerefsToDo;
50
51 /* Lock the Thread's Active Timer List and loop it */
53 CurrentEntry = Thread->ActiveTimerListHead.Flink;
54 while (CurrentEntry != &Thread->ActiveTimerListHead)
55 {
56 /* Get the timer */
57 Timer = CONTAINING_RECORD(CurrentEntry, ETIMER, ActiveTimerListEntry);
58
59 /* Reference it */
61 DerefsToDo = 1;
62
63 /* Unlock the list */
65
66 /* Lock the Timer */
68
69 /* Lock the list again */
71
72 /* Make sure that the timer is valid */
73 if ((Timer->ApcAssociated) && (&Thread->Tcb == Timer->TimerApc.Thread))
74 {
75 /* Remove it from the list */
76 RemoveEntryList(&Timer->ActiveTimerListEntry);
77 Timer->ApcAssociated = FALSE;
78
79 /* Cancel the timer and remove its DPC and APC */
80 KeCancelTimer(&Timer->KeTimer);
81 KeRemoveQueueDpc(&Timer->TimerDpc);
82 if (KeRemoveQueueApc(&Timer->TimerApc)) DerefsToDo++;
83
84 /* Add another dereference to do */
85 DerefsToDo++;
86 }
87
88 /* Unlock the list */
90
91 /* Unlock the Timer */
93
94 /* Dereference it */
95 ObDereferenceObjectEx(Timer, DerefsToDo);
96
97 /* Loop again */
99 CurrentEntry = Thread->ActiveTimerListHead.Flink;
100 }
101
102 /* Release lock and return */
104}
BOOLEAN NTAPI KeRemoveQueueDpc(IN PKDPC Dpc)
Definition: dpc.c:878
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
BOOLEAN NTAPI KeRemoveQueueApc(PKAPC Apc)
LONG FASTCALL ObDereferenceObjectEx(IN PVOID Object, IN LONG Count)
Definition: obref.c:88
#define KeAcquireSpinLockAtDpcLevel(SpinLock)
Definition: ke.h:125
#define KeReleaseSpinLockFromDpcLevel(SpinLock)
Definition: ke.h:135
LIST_ENTRY ActiveTimerListHead
Definition: pstypes.h:1128
KSPIN_LOCK ActiveTimerListLock
Definition: pstypes.h:1127
Definition: ex.h:111
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
Definition: timerobj.c:206
#define ObReferenceObject
Definition: obfuncs.h:204

Referenced by PspExitThread().

◆ ExTryToAcquirePushLockExclusive()

FORCEINLINE BOOLEAN ExTryToAcquirePushLockExclusive ( PEX_PUSH_LOCK  PushLock)

Definition at line 1073 of file ex.h.

1074{
1075 /* Try acquiring the lock */
1077 {
1078 /* Can't acquire */
1079 return FALSE;
1080 }
1081
1082 /* Got acquired */
1083 ASSERT (PushLock->Locked);
1084 return TRUE;
1085}

◆ ExTryToAcquireResourceExclusiveLite()

BOOLEAN NTAPI ExTryToAcquireResourceExclusiveLite ( IN PERESOURCE  Resource)

Definition at line 2134 of file resource.c.

2135{
2138 BOOLEAN Acquired = FALSE;
2139
2140 /* Sanity check */
2141 ASSERT((Resource->Flag & ResourceNeverExclusive) == 0);
2142
2143 /* Get the thread */
2145
2146 /* Sanity check and validation */
2149
2150 /* Acquire the lock */
2152
2153 /* Check if there is an owner */
2154 if (!Resource->ActiveCount)
2155 {
2156 /* No owner, give exclusive access */
2158 Resource->OwnerEntry.OwnerThread = Thread;
2159 Resource->OwnerEntry.OwnerCount = 1;
2160 Resource->ActiveCount = 1;
2161 Resource->ActiveEntries = 1;
2162 Acquired = TRUE;
2163 }
2164 else if ((IsOwnedExclusive(Resource)) &&
2165 (Resource->OwnerEntry.OwnerThread == Thread))
2166 {
2167 /* Do a recursive acquire */
2168 Resource->OwnerEntry.OwnerCount++;
2169 Acquired = TRUE;
2170 }
2171
2172 /* Release the resource */
2174 return Acquired;
2175}
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:843
#define ResourceOwnedExclusive
Definition: dldetect.h:32
BOOLEAN NTAPI KeIsExecutingDpc(VOID)
Definition: dpc.c:965
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
FORCEINLINE VOID ExReleaseResourceLock(IN PERESOURCE Resource, IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: resource.c:37
#define ExpVerifyResource(r)
Definition: resource.c:154
FORCEINLINE VOID ExAcquireResourceLock(IN PERESOURCE Resource, IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: resource.c:25
#define IsOwnedExclusive(r)
Definition: resource.c:18
#define ResourceNeverExclusive
Definition: extypes.h:245
ULONG_PTR ERESOURCE_THREAD
Definition: extypes.h:208
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:717

Referenced by ApphelpCacheTryAcquireLock().

◆ ExUnlockHandleTableEntry()

VOID NTAPI ExUnlockHandleTableEntry ( IN PHANDLE_TABLE  HandleTable,
IN PHANDLE_TABLE_ENTRY  HandleTableEntry 
)

Definition at line 923 of file handle.c.

925{
926 LONG_PTR OldValue;
927 PAGED_CODE();
928
929 /* Sanity check */
930 ASSERT((KeGetCurrentThread()->CombinedApcDisable != 0) ||
932
933 /* Set the lock bit and make sure it wasn't earlier */
934 OldValue = InterlockedOr((PLONG) &HandleTableEntry->Value,
936 ASSERT((OldValue & EXHANDLE_TABLE_ENTRY_LOCK_BIT) == 0);
937
938 /* Unblock any waiters */
939 ExfUnblockPushLock(&HandleTable->HandleContentionEvent, NULL);
940}
#define InterlockedOr
Definition: interlocked.h:224

Referenced by ExChangeHandle(), ExCreateHandle(), ExEnumHandleTable(), NtWaitForMultipleObjects(), ObpCloseHandleTableEntry(), ObpDuplicateHandleCallback(), ObpReferenceProcessObjectByHandle(), ObQueryObjectAuditingByHandle(), ObReferenceFileObjectForWrite(), ObReferenceObjectByHandle(), PsLookupProcessByProcessId(), PsLookupProcessThreadByCid(), PsLookupThreadByThreadId(), QSI_DEF(), and RtlpGetAtomEntry().

◆ ExUnlockUserBuffer()

VOID NTAPI ExUnlockUserBuffer ( PMDL  Mdl)

Definition at line 194 of file sysinfo.c.

195{
198}
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1435

Referenced by ExLockUserBuffer(), KdSystemDebugControl(), and QSI_DEF().

◆ ExUpdateSystemTimeFromCmos()

VOID NTAPI ExUpdateSystemTimeFromCmos ( IN BOOLEAN  UpdateInterruptTime,
IN ULONG  MaxSepInSeconds 
)

Definition at line 311 of file time.c.

313{
314 /* FIXME: TODO */
315 return;
316}

Referenced by KdpTimeSlipWork().

◆ ExWaitForCallBacks()

VOID NTAPI ExWaitForCallBacks ( IN PEX_CALLBACK_ROUTINE_BLOCK  CallbackRoutineBlock)

Definition at line 85 of file callback.c.

86{
87 /* Wait on the rundown */
88 ExWaitForRundownProtectionRelease(&CallbackBlock->RundownProtect);
89}
#define ExWaitForRundownProtectionRelease
Definition: ex.h:141

Referenced by PsRemoveCreateThreadNotifyRoutine(), PsRemoveLoadImageNotifyRoutine(), and PsSetCreateProcessNotifyRoutine().

◆ ExWaitForUnblockPushLock()

VOID FASTCALL ExWaitForUnblockPushLock ( IN PEX_PUSH_LOCK  PushLock,
IN PVOID  WaitBlock 
)

Definition at line 395 of file pushlock.c.

397{
398 /* Call the timed function with no timeout */
399 ExTimedWaitForUnblockPushLock(PushLock, WaitBlock, NULL);
400}
NTSTATUS FASTCALL ExTimedWaitForUnblockPushLock(IN PEX_PUSH_LOCK PushLock, IN PVOID WaitBlock, IN PLARGE_INTEGER Timeout)
Definition: pushlock.c:319

Referenced by ExfUnblockPushLock(), and ExpBlockOnLockedHandleEntry().

◆ ExWaitOnPushLock()

FORCEINLINE VOID ExWaitOnPushLock ( PEX_PUSH_LOCK  PushLock)

Definition at line 1181 of file ex.h.

1182{
1183 /* Check if we're locked */
1184 if (PushLock->Locked)
1185 {
1186 /* Acquire the lock */
1188 ASSERT(PushLock->Locked);
1189
1190 /* Release it */
1192 }
1193}
VOID FASTCALL ExfReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: pushlock.c:1091

Referenced by ExCompareExchangeCallBack(), and ExpMoveFreeHandles().

◆ HeadlessInit()

VOID NTAPI HeadlessInit ( IN PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 189 of file hdlsterm.c.

190{
191 PHEADLESS_LOADER_BLOCK HeadlessBlock;
192
193 /* Only initialize further if the loader found EMS enabled */
194 HeadlessBlock = LoaderBlock->Extension->HeadlessLoaderBlock;
195 if (!HeadlessBlock) return;
196
197 /* Ignore invalid EMS settings */
198 if ((HeadlessBlock->PortNumber > 4) && (HeadlessBlock->UsedBiosSettings)) return;
199
200 /* Allocate the global headless data */
202 sizeof(*HeadlessGlobals),
203 'sldH');
204 if (!HeadlessGlobals) return;
205
206 /* Zero and copy loader data */
210 HeadlessGlobals->TerminalBaudRate = HeadlessBlock->BaudRate;
211 HeadlessGlobals->TerminalParity = HeadlessBlock->Parity;
212 HeadlessGlobals->TerminalStopBits = HeadlessBlock->StopBits;
214 HeadlessGlobals->IsMMIODevice = HeadlessBlock->IsMMIODevice;
215 HeadlessGlobals->TerminalType = HeadlessBlock->TerminalType;
216 HeadlessGlobals->SystemGUID = HeadlessBlock->SystemGUID;
217 DPRINT1("EMS on Port %lu (0x%p) at %lu bps\n",
221
222 /* These two are opposites of each other */
224
225 /* Check for a PCI device, warn that this isn't supported */
226 if (HeadlessBlock->PciDeviceId != PCI_INVALID_VENDORID)
227 {
228 DPRINT1("PCI Serial Ports not supported\n");
229 }
230
231 /* Log entries are not yet supported */
232 DPRINT1("FIXME: No Headless logging support\n");
233
234 /* Allocate temporary buffer */
236 if (!HeadlessGlobals->TmpBuffer) return;
237
238 /* Windows seems to apply some special hacks for 9600 bps */
240 {
241 DPRINT1("Please use other baud rate than 9600bps for now\n");
242 }
243
244 /* Enable the terminal */
246}
PHEADLESS_GLOBALS HeadlessGlobals
Definition: hdlsterm.c:16
NTSTATUS NTAPI HdlspEnableTerminal(IN BOOLEAN Enable)
Definition: hdlsterm.c:148
GUID SystemGUID
Definition: hdl.h:119
ULONG IsNonLegacyDevice
Definition: hdl.h:106
PUCHAR TerminalPortAddress
Definition: hdl.h:112
ULONG TerminalPortNumber
Definition: hdl.h:105
ULONG UsedBiosSettings
Definition: hdl.h:99
ULONG TerminalStopBits
Definition: hdl.h:104
BOOLEAN IsMMIODevice
Definition: hdl.h:120
UCHAR TerminalType
Definition: hdl.h:115
ULONG TerminalBaudRate
Definition: hdl.h:110
ULONG TerminalParity
Definition: hdl.h:103
PUCHAR TmpBuffer
Definition: hdl.h:89
UCHAR IsMMIODevice
Definition: arc.h:367
UCHAR UsedBiosSettings
Definition: arc.h:353
PUCHAR PortAddress
Definition: arc.h:359
USHORT PciDeviceId
Definition: arc.h:360
UCHAR TerminalType
Definition: arc.h:368
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3601

Referenced by ExpInitializeExecutive().

◆ Phase1Initialization()

VOID NTAPI Phase1Initialization ( IN PVOID  Context)

Definition at line 2060 of file init.c.

2061{
2062 /* Do the .INIT part of Phase 1 which we can free later */
2064
2065 /* Jump into zero page thread */
2067}
VOID NTAPI Phase1InitializationDiscard(IN PVOID Context)
Definition: init.c:1351
VOID NTAPI MmZeroPageThread(VOID)
Definition: zeropage.c:36

Referenced by PspInitPhase0().

◆ XIPInit()

VOID NTAPI XIPInit ( IN PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 55 of file xipdisp.c.

56{
57 PCHAR CommandLine, XipBoot, XipRom, XipMegs, XipVerbose, XipRam;
59
60 /* Get the command line */
61 CommandLine = LoaderBlock->LoadOptions;
62 if (!CommandLine) return;
63
64 /* Get XIP settings */
65 XipBoot = strstr(CommandLine, "XIPBOOT");
66 XipRam = strstr(CommandLine, "XIPRAM=");
67 XipRom = strstr(CommandLine, "XIPROM=");
68 XipMegs = strstr(CommandLine, "XIPMEGS=");
69 XipVerbose = strstr(CommandLine, "XIPVERBOSE");
70
71 /* Check if this is a verbose boot */
72 if (XipVerbose)
73 {
74 /* Print out our header */
75 DbgPrint("\n\nXIP: debug timestamp at line %d in %s: <<<%s %s>>>\n\n",
76 __LINE__,
77 __FILE__,
78 __DATE__,
79 __TIME__);
80 }
81
82 /* Find the XIP memory descriptor */
83 XipDescriptor = XIPpFindMemoryDescriptor(LoaderBlock);
84 if (!XipDescriptor) return;
85
86 //
87 // Make sure this is really XIP, and not RAM Disk -- also validate XIP
88 // Basically, either this is a ROM boot or a RAM boot, but not both nor none
89 //
90 if (!((ULONG_PTR)XipRom ^ (ULONG_PTR)XipRam)) return;
91
92 /* FIXME: TODO */
93 DPRINT1("ReactOS does not yet support eXecute In Place boot technology\n");
94 DPRINT("%s MB requested (XIP = %s)\n", XipMegs, XipBoot);
95}
#define DbgPrint
Definition: hal.h:12
PMEMORY_ALLOCATION_DESCRIPTOR NTAPI XIPpFindMemoryDescriptor(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: xipdisp.c:31

Referenced by Phase1InitializationDiscard().

Variable Documentation

◆ _ExEventObjectType

POBJECT_TYPE _ExEventObjectType
extern

◆ _ExSemaphoreObjectType

POBJECT_TYPE _ExSemaphoreObjectType

Definition at line 16 of file ex.h.

◆ CmCSDVersionString

UNICODE_STRING CmCSDVersionString
extern

◆ CmNtCSDReleaseType

ULONG CmNtCSDReleaseType
extern

Definition at line 60 of file init.c.

Referenced by ExpInitializeExecutive().

◆ CmNtCSDVersion

ULONG CmNtCSDVersion
extern

Definition at line 59 of file init.c.

Referenced by ExpInitializeExecutive(), MmCreatePeb(), and RtlGetVersion().

◆ CmNtSpBuildNumber

ULONG CmNtSpBuildNumber
extern

Definition at line 58 of file init.c.

Referenced by CmpSetVersionData(), and ExpInitializeExecutive().

◆ CmVersionString

UNICODE_STRING CmVersionString
extern

Definition at line 61 of file init.c.

Referenced by CmpSetVersionData(), and ExpInitializeExecutive().

◆ ExCriticalWorkerThreads

ULONG ExCriticalWorkerThreads
extern

Definition at line 34 of file work.c.

Referenced by CcInitializeCacheManager(), and ExpInitializeWorkerThreads().

◆ ExDelayedWorkerThreads

ULONG ExDelayedWorkerThreads
extern

Definition at line 35 of file work.c.

Referenced by ExpInitializeWorkerThreads().

◆ ExEventPairObjectType

◆ ExpAltTimeZoneBias

ULONG ExpAltTimeZoneBias
extern

Definition at line 24 of file time.c.

Referenced by Phase1InitializationDiscard().

◆ ExpAnsiCodePageDataOffset

ULONG ExpAnsiCodePageDataOffset
extern

Definition at line 86 of file init.c.

Referenced by ExpInitializeExecutive(), ExpInitNls(), and MmCreatePeb().

◆ ExpDebuggerPageIn

ULONG_PTR ExpDebuggerPageIn
extern

Definition at line 28 of file dbgctrl.c.

Referenced by ExpDebuggerWorker().

◆ ExpDebuggerProcessAttach

PEPROCESS ExpDebuggerProcessAttach
extern

Definition at line 26 of file dbgctrl.c.

Referenced by ExpDebuggerWorker().

◆ ExpDebuggerProcessKill

PEPROCESS ExpDebuggerProcessKill
extern

Definition at line 27 of file dbgctrl.c.

Referenced by ExpDebuggerWorker().

◆ ExpDebuggerWork

WINKD_WORKER_STATE ExpDebuggerWork
extern

Definition at line 25 of file dbgctrl.c.

Referenced by ExpDebuggerWorker(), and ExpWorkerThreadBalanceManager().

◆ ExpDebuggerWorkItem

WORK_QUEUE_ITEM ExpDebuggerWorkItem
extern

Definition at line 20 of file dbgctrl.c.

Referenced by ExpWorkerThreadBalanceManager().

◆ ExpDefaultErrorPort

PVOID ExpDefaultErrorPort
extern

Definition at line 18 of file harderr.c.

Referenced by ExpRaiseHardError(), ExShutdownSystem(), and NtSetDefaultHardErrorPort().

◆ ExpDefaultErrorPortProcess

PEPROCESS ExpDefaultErrorPortProcess
extern

Definition at line 19 of file harderr.c.

Referenced by ExpRaiseHardError(), ExShutdownSystem(), and NtSetDefaultHardErrorPort().

◆ ExpEnvironmentLock

FAST_MUTEX ExpEnvironmentLock
extern

Definition at line 29 of file sysinfo.c.

Referenced by ExpInitSystemPhase0().

◆ ExpFirmwareTableProviderListHead

LIST_ENTRY ExpFirmwareTableProviderListHead
extern

Definition at line 31 of file sysinfo.c.

Referenced by ExpInitSystemPhase0().

◆ ExpFirmwareTableResource

ERESOURCE ExpFirmwareTableResource
extern

Definition at line 30 of file sysinfo.c.

Referenced by ExpInitSystemPhase0().

◆ ExpInitializationPhase

ULONG ExpInitializationPhase
extern

Definition at line 68 of file init.c.

◆ ExpIsWinPEMode

BOOLEAN ExpIsWinPEMode
extern

◆ ExpLastTimeZoneBias

ULONG ExpLastTimeZoneBias
extern

Definition at line 22 of file time.c.

Referenced by Phase1InitializationDiscard().

◆ ExpNlsSectionPointer

PVOID ExpNlsSectionPointer
extern

Definition at line 90 of file init.c.

Referenced by ExpInitNls(), and MmCreatePeb().

◆ ExpNonPagedLookasideListHead

LIST_ENTRY ExpNonPagedLookasideListHead
extern

Definition at line 17 of file lookas.c.

Referenced by ExInitializeNPagedLookasideList(), ExpInitLookasideLists(), and QSI_DEF().

◆ ExpNonPagedLookasideListLock

KSPIN_LOCK ExpNonPagedLookasideListLock
extern

◆ ExpOemCodePageDataOffset

ULONG ExpOemCodePageDataOffset

Definition at line 24 of file ex.h.

◆ ExPoolLookasideListHead

LIST_ENTRY ExPoolLookasideListHead
extern

Definition at line 22 of file lookas.c.

Referenced by ExpInitLookasideLists(), ExQueryPoolUsage(), and QSI_DEF().

◆ ExpPagedLookasideListHead

LIST_ENTRY ExpPagedLookasideListHead
extern

Definition at line 19 of file lookas.c.

Referenced by ExInitializePagedLookasideList(), ExpInitLookasideLists(), and QSI_DEF().

◆ ExpPagedLookasideListLock

KSPIN_LOCK ExpPagedLookasideListLock
extern

◆ ExpResourceTimeoutCount

ULONG ExpResourceTimeoutCount
extern

Definition at line 77 of file resource.c.

Referenced by ExpWaitForResource().

◆ ExpSystemResourcesList

LIST_ENTRY ExpSystemResourcesList
extern

Definition at line 80 of file resource.c.

Referenced by ExInitializeResourceLite(), and ExpResourceInitialization().

◆ ExpTickCountMultiplier

ULONG ExpTickCountMultiplier
extern

Definition at line 26 of file time.c.

Referenced by ExpInitializeExecutive().

◆ ExpTimeRefreshLock

ERESOURCE ExpTimeRefreshLock
extern

Definition at line 27 of file time.c.

Referenced by ExAcquireTimeRefreshLock(), ExpInitSystemPhase0(), and ExReleaseTimeRefreshLock().

◆ ExpTimeZoneBias

◆ ExpTimeZoneId

ULONG ExpTimeZoneId
extern

◆ ExpTimeZoneInfo

RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo
extern

Definition at line 21 of file time.c.

Referenced by ExpGetTimeZoneId(), ExpSetTimeZoneInformation(), and QSI_DEF().

◆ ExpUnicodeCaseTableDataOffset

ULONG ExpUnicodeCaseTableDataOffset
extern

Definition at line 87 of file init.c.

Referenced by ExpInitializeExecutive(), ExpInitNls(), and MmCreatePeb().

◆ ExSystemLookasideListHead

LIST_ENTRY ExSystemLookasideListHead
extern

Definition at line 21 of file lookas.c.

Referenced by ExpInitLookasideLists(), IopInitLookasideLists(), ObInit2(), ObInitSystem(), and QSI_DEF().

◆ NtBuildLab

CHAR NtBuildLab[]
extern

Definition at line 64 of file init.c.

Referenced by CmpSetVersionData(), and Phase1InitializationDiscard().

◆ NtBuildNumber

ULONG NtBuildNumber
extern

Definition at line 50 of file init.c.

◆ NtGlobalFlag

ULONG NtGlobalFlag
extern

Definition at line 54 of file init.c.

◆ NtMajorVersion

ULONG NtMajorVersion
extern

Definition at line 45 of file init.c.

◆ NtMinorVersion

ULONG NtMinorVersion
extern

Definition at line 46 of file init.c.

◆ NtSystemRoot

◆ PowerStateCallback

PCALLBACK_OBJECT PowerStateCallback
extern

Definition at line 29 of file callback.c.

Referenced by NtSetSystemPowerState().