16#if defined (ALLOC_PRAGMA)
17#pragma alloc_text(INIT, ExpInitializeSemaphoreImplementation)
48 DPRINT(
"Creating Semaphore Object Type\n");
51 RtlZeroMemory(&ObjectTypeInitializer,
sizeof(ObjectTypeInitializer));
53 ObjectTypeInitializer.
Length =
sizeof(ObjectTypeInitializer);
100 (InitialCount < 0) ||
103 DPRINT(
"Invalid Count Data!\n");
141 *SemaphoreHandle = hSemaphore;
203 *SemaphoreHandle = hSemaphore;
225 IN ULONG SemaphoreInformationLength,
239 SemaphoreInformation,
240 SemaphoreInformationLength,
247 DPRINT(
"NtQuerySemaphore() failed, Status: 0x%x\n",
Status);
322 if (ReleaseCount <= 0)
324 DPRINT(
"Invalid Release Count\n");
349 if (PreviousCount) *PreviousCount = PrevCount;
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
#define ExGetPreviousMode
LONG NTAPI ExSystemExceptionFilter(VOID)
#define IQS_SAME(Type, Alignment, Flags)
#define ICIF_PROBE_READ_WRITE
#define EXCEPTION_EXECUTE_HANDLER
#define SEMAPHORE_QUERY_STATE
struct _SEMAPHORE_BASIC_INFORMATION * PSEMAPHORE_BASIC_INFORMATION
enum _SEMAPHORE_INFORMATION_CLASS SEMAPHORE_INFORMATION_CLASS
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STANDARD_RIGHTS_READ
#define STANDARD_RIGHTS_WRITE
#define STANDARD_RIGHTS_EXECUTE
static __inline NTSTATUS DefaultQueryInfoBufferCheck(_In_ ULONG Class, _In_ const INFORMATION_CLASS_INFO *ClassList, _In_ ULONG ClassListEntries, _In_ ULONG Flags, _In_opt_ PVOID Buffer, _In_ ULONG BufferLength, _In_opt_ PULONG ReturnLength, _In_opt_ PULONG_PTR ReturnLengthPtr, _In_ KPROCESSOR_MODE PreviousMode)
Probe helper that validates the provided parameters whenever a NtQuery*** system call is invoked from...
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
NTSTATUS NTAPI ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN OUT PVOID ParseContext, OUT PHANDLE Handle)
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
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)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
#define ProbeForWriteLong(Ptr)
#define ProbeForWriteHandle(Ptr)
NTSTATUS NTAPI NtOpenSemaphore(OUT PHANDLE SemaphoreHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
BOOLEAN NTAPI ExpInitializeSemaphoreImplementation(VOID)
NTSTATUS NTAPI NtQuerySemaphore(IN HANDLE SemaphoreHandle, IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass, OUT PVOID SemaphoreInformation, IN ULONG SemaphoreInformationLength, OUT PULONG ReturnLength OPTIONAL)
static const INFORMATION_CLASS_INFO ExSemaphoreInfoClass[]
NTSTATUS NTAPI NtCreateSemaphore(OUT PHANDLE SemaphoreHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN LONG InitialCount, IN LONG MaximumCount)
NTSTATUS NTAPI NtReleaseSemaphore(IN HANDLE SemaphoreHandle, IN LONG ReleaseCount, OUT PLONG PreviousCount OPTIONAL)
GENERIC_MAPPING ExSemaphoreMapping
POBJECT_TYPE ExSemaphoreObjectType
LONG NTAPI KeReadStateSemaphore(IN PKSEMAPHORE Semaphore)
VOID NTAPI KeInitializeSemaphore(IN PKSEMAPHORE Semaphore, IN LONG Count, IN LONG Limit)
LONG NTAPI KeReleaseSemaphore(IN PKSEMAPHORE Semaphore, IN KPRIORITY Increment, IN LONG Adjustment, IN BOOLEAN Wait)
PULONG MinorVersion OPTIONAL
GENERIC_MAPPING GenericMapping
ULONG DefaultNonPagedPoolCharge
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_PARAMETER
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
#define SEMAPHORE_MODIFY_STATE
#define SEMAPHORE_ALL_ACCESS
*Count PHARDWARE_COUNTER _In_ ULONG MaximumCount
struct _KSEMAPHORE KSEMAPHORE
#define ObDereferenceObject
_In_ KPROCESSOR_MODE PreviousMode