mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
added more irql checks
svn path=/trunk/; revision=13720
This commit is contained in:
parent
2c2b8c9796
commit
756ab632ca
12 changed files with 145 additions and 70 deletions
|
@ -172,6 +172,8 @@ ExCreateCallback(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Open a handle to the callback if it exists */
|
/* Open a handle to the callback if it exists */
|
||||||
if (ObjectAttributes->ObjectName)
|
if (ObjectAttributes->ObjectName)
|
||||||
{
|
{
|
||||||
|
@ -347,6 +349,8 @@ ExRegisterCallback(
|
||||||
PCALLBACK_REGISTRATION CallbackRegistration = NULL;
|
PCALLBACK_REGISTRATION CallbackRegistration = NULL;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Create reference to Callback Object */
|
/* Create reference to Callback Object */
|
||||||
ObReferenceObject (CallbackObject);
|
ObReferenceObject (CallbackObject);
|
||||||
|
|
||||||
|
@ -412,6 +416,8 @@ ExUnregisterCallback(
|
||||||
PINT_CALLBACK_OBJECT CallbackObject;
|
PINT_CALLBACK_OBJECT CallbackObject;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Convert Handle to valid Structure Pointer */
|
/* Convert Handle to valid Structure Pointer */
|
||||||
CallbackRegistration = (PCALLBACK_REGISTRATION) CallbackRegistrationHandle;
|
CallbackRegistration = (PCALLBACK_REGISTRATION) CallbackRegistrationHandle;
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,8 @@ NtClearEvent(IN HANDLE EventHandle)
|
||||||
PKEVENT Event;
|
PKEVENT Event;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
Status = ObReferenceObjectByHandle(EventHandle,
|
Status = ObReferenceObjectByHandle(EventHandle,
|
||||||
EVENT_MODIFY_STATE,
|
EVENT_MODIFY_STATE,
|
||||||
ExEventObjectType,
|
ExEventObjectType,
|
||||||
|
@ -119,6 +121,8 @@ NtCreateEvent(OUT PHANDLE EventHandle,
|
||||||
HANDLE hEvent;
|
HANDLE hEvent;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousMode == UserMode)
|
if(PreviousMode == UserMode)
|
||||||
|
@ -195,6 +199,8 @@ NtOpenEvent(OUT PHANDLE EventHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtOpenEvent(0x%x, 0x%x, 0x%x)\n", EventHandle, DesiredAccess, ObjectAttributes);
|
DPRINT("NtOpenEvent(0x%x, 0x%x, 0x%x)\n", EventHandle, DesiredAccess, ObjectAttributes);
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
@ -255,6 +261,8 @@ NtPulseEvent(IN HANDLE EventHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtPulseEvent(EventHandle 0%x PreviousState 0%x)\n",
|
DPRINT("NtPulseEvent(EventHandle 0%x PreviousState 0%x)\n",
|
||||||
EventHandle, PreviousState);
|
EventHandle, PreviousState);
|
||||||
|
|
||||||
|
@ -323,6 +331,8 @@ NtQueryEvent(IN HANDLE EventHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
DefaultQueryInfoBufferCheck(EventInformationClass,
|
DefaultQueryInfoBufferCheck(EventInformationClass,
|
||||||
|
@ -396,6 +406,8 @@ NtResetEvent(IN HANDLE EventHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtResetEvent(EventHandle 0%x PreviousState 0%x)\n",
|
DPRINT("NtResetEvent(EventHandle 0%x PreviousState 0%x)\n",
|
||||||
EventHandle, PreviousState);
|
EventHandle, PreviousState);
|
||||||
|
|
||||||
|
@ -461,6 +473,8 @@ NtSetEvent(IN HANDLE EventHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtSetEvent(EventHandle 0%x PreviousState 0%x)\n",
|
DPRINT("NtSetEvent(EventHandle 0%x PreviousState 0%x)\n",
|
||||||
EventHandle, PreviousState);
|
EventHandle, PreviousState);
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousMode == UserMode)
|
if(PreviousMode == UserMode)
|
||||||
|
@ -169,6 +171,8 @@ NtOpenEventPair(OUT PHANDLE EventPairHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousMode == UserMode)
|
if(PreviousMode == UserMode)
|
||||||
|
@ -222,6 +226,8 @@ NtSetHighEventPair(IN HANDLE EventPairHandle)
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtSetHighEventPair(EventPairHandle %x)\n",
|
DPRINT("NtSetHighEventPair(EventPairHandle %x)\n",
|
||||||
EventPairHandle);
|
EventPairHandle);
|
||||||
|
|
||||||
|
@ -253,6 +259,8 @@ NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle)
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n",
|
DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n",
|
||||||
EventPairHandle);
|
EventPairHandle);
|
||||||
|
|
||||||
|
@ -290,6 +298,8 @@ NtSetLowEventPair(IN HANDLE EventPairHandle)
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtSetLowEventPair(EventPairHandle %x)\n",
|
DPRINT("NtSetLowEventPair(EventPairHandle %x)\n",
|
||||||
EventPairHandle);
|
EventPairHandle);
|
||||||
|
|
||||||
|
@ -321,6 +331,8 @@ NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle)
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtSetLowWaitHighEventPair(EventPairHandle %x)\n",
|
DPRINT("NtSetLowWaitHighEventPair(EventPairHandle %x)\n",
|
||||||
EventPairHandle);
|
EventPairHandle);
|
||||||
|
|
||||||
|
@ -358,6 +370,8 @@ NtWaitLowEventPair(IN HANDLE EventPairHandle)
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtWaitLowEventPair(EventPairHandle %x)\n",
|
DPRINT("NtWaitLowEventPair(EventPairHandle %x)\n",
|
||||||
EventPairHandle);
|
EventPairHandle);
|
||||||
|
|
||||||
|
@ -391,6 +405,8 @@ NtWaitHighEventPair(IN HANDLE EventPairHandle)
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtWaitHighEventPair(EventPairHandle %x)\n",
|
DPRINT("NtWaitHighEventPair(EventPairHandle %x)\n",
|
||||||
EventPairHandle);
|
EventPairHandle);
|
||||||
|
|
||||||
|
@ -436,6 +452,8 @@ NtSetLowWaitHighThread(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KIRQL Irql;
|
KIRQL Irql;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(!Thread->EventPair)
|
if(!Thread->EventPair)
|
||||||
|
@ -490,6 +508,8 @@ NtSetHighWaitLowThread(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KIRQL Irql;
|
KIRQL Irql;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
Thread = PsGetCurrentThread();
|
Thread = PsGetCurrentThread();
|
||||||
|
|
||||||
if(!Thread->EventPair)
|
if(!Thread->EventPair)
|
||||||
|
|
|
@ -104,6 +104,8 @@ NtCreateMutant(OUT PHANDLE MutantHandle,
|
||||||
PKMUTEX Mutant;
|
PKMUTEX Mutant;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousMode == UserMode)
|
if(PreviousMode == UserMode)
|
||||||
|
@ -178,6 +180,8 @@ NtOpenMutant(OUT PHANDLE MutantHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtOpenMutant(0x%x, 0x%x, 0x%x)\n", MutantHandle, DesiredAccess, ObjectAttributes);
|
DPRINT("NtOpenMutant(0x%x, 0x%x, 0x%x)\n", MutantHandle, DesiredAccess, ObjectAttributes);
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
@ -241,6 +245,8 @@ NtQueryMutant(IN HANDLE MutantHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
DefaultQueryInfoBufferCheck(MutantInformationClass,
|
DefaultQueryInfoBufferCheck(MutantInformationClass,
|
||||||
|
@ -312,6 +318,8 @@ NtReleaseMutant(IN HANDLE MutantHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("NtReleaseMutant(MutantHandle 0%x PreviousCount 0%x)\n",
|
DPRINT("NtReleaseMutant(MutantHandle 0%x PreviousCount 0%x)\n",
|
||||||
MutantHandle, PreviousCount);
|
MutantHandle, PreviousCount);
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,8 @@ NtCreateProfile(OUT PHANDLE ProfileHandle,
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(BufferSize == 0)
|
if(BufferSize == 0)
|
||||||
|
@ -271,6 +273,8 @@ NtQueryIntervalProfile(IN KPROFILE_SOURCE ProfileSource,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousMode != KernelMode)
|
if(PreviousMode != KernelMode)
|
||||||
|
@ -329,6 +333,8 @@ NtStartProfile(IN HANDLE ProfileHandle)
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
Status = ObReferenceObjectByHandle(ProfileHandle,
|
Status = ObReferenceObjectByHandle(ProfileHandle,
|
||||||
|
@ -353,6 +359,8 @@ NtStopProfile(IN HANDLE ProfileHandle)
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
Status = ObReferenceObjectByHandle(ProfileHandle,
|
Status = ObReferenceObjectByHandle(ProfileHandle,
|
||||||
|
|
|
@ -41,6 +41,8 @@ ExAcquireRundownProtectionEx (
|
||||||
{
|
{
|
||||||
ULONG_PTR PrevCount, Current;
|
ULONG_PTR PrevCount, Current;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
Count <<= EX_RUNDOWN_COUNT_SHIFT;
|
Count <<= EX_RUNDOWN_COUNT_SHIFT;
|
||||||
|
|
||||||
/* Loop until successfully incremented the counter */
|
/* Loop until successfully incremented the counter */
|
||||||
|
@ -74,6 +76,8 @@ ExInitializeRundownProtection (
|
||||||
IN PEX_RUNDOWN_REF RunRef
|
IN PEX_RUNDOWN_REF RunRef
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Set the count to zero */
|
/* Set the count to zero */
|
||||||
RunRef->Count = 0;
|
RunRef->Count = 0;
|
||||||
}
|
}
|
||||||
|
@ -87,6 +91,8 @@ ExReInitializeRundownProtection (
|
||||||
IN PEX_RUNDOWN_REF RunRef
|
IN PEX_RUNDOWN_REF RunRef
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Reset the count */
|
/* Reset the count */
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
InterlockedExchangeAdd64((LONGLONG*)&RunRef->Count, 0LL);
|
InterlockedExchangeAdd64((LONGLONG*)&RunRef->Count, 0LL);
|
||||||
|
@ -106,6 +112,8 @@ ExReleaseRundownProtectionEx (
|
||||||
IN ULONG Count
|
IN ULONG Count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
Count <<= EX_RUNDOWN_COUNT_SHIFT;
|
Count <<= EX_RUNDOWN_COUNT_SHIFT;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -200,7 +208,9 @@ ExRundownCompleted (
|
||||||
IN PEX_RUNDOWN_REF RunRef
|
IN PEX_RUNDOWN_REF RunRef
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* mark the */
|
PAGED_CODE();
|
||||||
|
|
||||||
|
/* mark the counter as active */
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
InterlockedExchange64((LONGLONG*)&RunRef->Count, (LONGLONG)EX_RUNDOWN_ACTIVE);
|
InterlockedExchange64((LONGLONG*)&RunRef->Count, (LONGLONG)EX_RUNDOWN_ACTIVE);
|
||||||
#else
|
#else
|
||||||
|
@ -220,6 +230,8 @@ ExWaitForRundownProtectionRelease (
|
||||||
ULONG_PTR PrevCount, NewPtr, PrevPtr;
|
ULONG_PTR PrevCount, NewPtr, PrevPtr;
|
||||||
RUNDOWN_DESCRIPTOR RundownDescriptor;
|
RUNDOWN_DESCRIPTOR RundownDescriptor;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PrevCount = RunRef->Count;
|
PrevCount = RunRef->Count;
|
||||||
|
|
||||||
if (PrevCount != 0 && !(PrevCount & EX_RUNDOWN_ACTIVE))
|
if (PrevCount != 0 && !(PrevCount & EX_RUNDOWN_ACTIVE))
|
||||||
|
|
|
@ -92,6 +92,8 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousMode == UserMode)
|
if(PreviousMode == UserMode)
|
||||||
|
@ -168,6 +170,8 @@ NtOpenSemaphore(OUT PHANDLE SemaphoreHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousMode == UserMode)
|
if(PreviousMode == UserMode)
|
||||||
|
@ -228,6 +232,8 @@ NtQuerySemaphore(IN HANDLE SemaphoreHandle,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
DefaultQueryInfoBufferCheck(SemaphoreInformationClass,
|
DefaultQueryInfoBufferCheck(SemaphoreInformationClass,
|
||||||
|
@ -299,6 +305,8 @@ NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
|
||||||
PKSEMAPHORE Semaphore;
|
PKSEMAPHORE Semaphore;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousCount != NULL && PreviousMode == UserMode)
|
if(PreviousCount != NULL && PreviousMode == UserMode)
|
||||||
|
|
|
@ -101,6 +101,8 @@ NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousMode != KernelMode)
|
if(PreviousMode != KernelMode)
|
||||||
|
@ -246,6 +248,8 @@ NtSetSystemEnvironmentValue (IN PUNICODE_STRING VariableName,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1372,6 +1376,8 @@ NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
NTSTATUS FStatus;
|
NTSTATUS FStatus;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
/* DPRINT("NtQuerySystemInformation Start. Class:%d\n",
|
/* DPRINT("NtQuerySystemInformation Start. Class:%d\n",
|
||||||
SystemInformationClass );
|
SystemInformationClass );
|
||||||
*/
|
*/
|
||||||
|
@ -1448,6 +1454,8 @@ NtSetSystemInformation (
|
||||||
IN ULONG SystemInformationLength
|
IN ULONG SystemInformationLength
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If called from user mode, check
|
* If called from user mode, check
|
||||||
* possible unsafe arguments.
|
* possible unsafe arguments.
|
||||||
|
@ -1496,6 +1504,8 @@ NtFlushInstructionCache (
|
||||||
IN UINT NumberOfBytesToFlush
|
IN UINT NumberOfBytesToFlush
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
__asm__("wbinvd\n");
|
__asm__("wbinvd\n");
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,8 @@ NtSetSystemTime(IN PLARGE_INTEGER SystemTime,
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousMode != KernelMode)
|
if(PreviousMode != KernelMode)
|
||||||
|
@ -234,6 +236,8 @@ NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
PreviousMode = ExGetPreviousMode();
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
if(PreviousMode != KernelMode)
|
if(PreviousMode != KernelMode)
|
||||||
|
|
|
@ -209,12 +209,16 @@ NtCancelTimer(IN HANDLE TimerHandle,
|
||||||
OUT PBOOLEAN CurrentState OPTIONAL)
|
OUT PBOOLEAN CurrentState OPTIONAL)
|
||||||
{
|
{
|
||||||
PETIMER Timer;
|
PETIMER Timer;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
BOOLEAN State;
|
BOOLEAN State;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
BOOLEAN KillTimer = FALSE;
|
|
||||||
PETHREAD TimerThread;
|
PETHREAD TimerThread;
|
||||||
|
BOOLEAN KillTimer = FALSE;
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
DPRINT("NtCancelTimer(0x%x, 0x%x)\n", TimerHandle, CurrentState);
|
DPRINT("NtCancelTimer(0x%x, 0x%x)\n", TimerHandle, CurrentState);
|
||||||
|
|
||||||
|
@ -319,9 +323,13 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
|
||||||
{
|
{
|
||||||
PETIMER Timer;
|
PETIMER Timer;
|
||||||
HANDLE hTimer;
|
HANDLE hTimer;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
DPRINT("NtCreateTimer(Handle: %x, Type: %d)\n", TimerHandle, TimerType);
|
DPRINT("NtCreateTimer(Handle: %x, Type: %d)\n", TimerHandle, TimerType);
|
||||||
|
|
||||||
/* Check Parameter Validity */
|
/* Check Parameter Validity */
|
||||||
|
@ -398,9 +406,13 @@ NtOpenTimer(OUT PHANDLE TimerHandle,
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
{
|
{
|
||||||
HANDLE hTimer;
|
HANDLE hTimer;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
DPRINT("NtOpenTimer(TimerHandle: %x)\n", TimerHandle);
|
DPRINT("NtOpenTimer(TimerHandle: %x)\n", TimerHandle);
|
||||||
|
|
||||||
/* Check Parameter Validity */
|
/* Check Parameter Validity */
|
||||||
|
@ -452,10 +464,14 @@ NtQueryTimer(IN HANDLE TimerHandle,
|
||||||
OUT PULONG ReturnLength OPTIONAL)
|
OUT PULONG ReturnLength OPTIONAL)
|
||||||
{
|
{
|
||||||
PETIMER Timer;
|
PETIMER Timer;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
PTIMER_BASIC_INFORMATION BasicInfo = (PTIMER_BASIC_INFORMATION)TimerInformation;
|
PTIMER_BASIC_INFORMATION BasicInfo = (PTIMER_BASIC_INFORMATION)TimerInformation;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
DPRINT("NtQueryTimer(TimerHandle: %x, Class: %d)\n", TimerHandle, TimerInformationClass);
|
DPRINT("NtQueryTimer(TimerHandle: %x, Class: %d)\n", TimerHandle, TimerInformationClass);
|
||||||
|
|
||||||
/* Check Validity */
|
/* Check Validity */
|
||||||
|
@ -522,13 +538,18 @@ NtSetTimer(IN HANDLE TimerHandle,
|
||||||
{
|
{
|
||||||
PETIMER Timer;
|
PETIMER Timer;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
BOOLEAN KillTimer = FALSE;
|
|
||||||
BOOLEAN State;
|
BOOLEAN State;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode;
|
||||||
PETHREAD CurrentThread = PsGetCurrentThread();
|
PETHREAD CurrentThread;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
LARGE_INTEGER TimerDueTime;
|
LARGE_INTEGER TimerDueTime;
|
||||||
PETHREAD TimerThread;
|
PETHREAD TimerThread;
|
||||||
|
BOOLEAN KillTimer = FALSE;
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
CurrentThread = PsGetCurrentThread();
|
||||||
|
|
||||||
DPRINT("NtSetTimer(TimerHandle: %x, DueTime: %d, Apc: %x, Period: %d)\n", TimerHandle, DueTime->QuadPart, TimerApcRoutine, Period);
|
DPRINT("NtSetTimer(TimerHandle: %x, DueTime: %d, Apc: %x, Period: %d)\n", TimerHandle, DueTime->QuadPart, TimerApcRoutine, Period);
|
||||||
|
|
||||||
|
|
|
@ -224,6 +224,8 @@ NtAllocateUuids(OUT PULARGE_INTEGER Time,
|
||||||
ULONG IntRange;
|
ULONG IntRange;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
ExAcquireFastMutex(&UuidMutex);
|
ExAcquireFastMutex(&UuidMutex);
|
||||||
|
|
||||||
if (!UuidSequenceInitialized)
|
if (!UuidSequenceInitialized)
|
||||||
|
@ -278,6 +280,8 @@ NtAllocateUuids(OUT PULARGE_INTEGER Time,
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
NtSetUuidSeed(IN PUCHAR Seed)
|
NtSetUuidSeed(IN PUCHAR Seed)
|
||||||
{
|
{
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
RtlCopyMemory(UuidSeed,
|
RtlCopyMemory(UuidSeed,
|
||||||
Seed,
|
Seed,
|
||||||
SEED_BUFFER_SIZE);
|
SEED_BUFFER_SIZE);
|
||||||
|
|
|
@ -125,46 +125,6 @@ RtlReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
RtlCaptureAnsiString(PANSI_STRING Dest,
|
|
||||||
PANSI_STRING UnsafeSrc)
|
|
||||||
{
|
|
||||||
PANSI_STRING Src;
|
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copy the source string structure to kernel space.
|
|
||||||
*/
|
|
||||||
Status = MmCopyFromCaller(&Src, UnsafeSrc, sizeof(ANSI_STRING));
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
return(Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize the destination string.
|
|
||||||
*/
|
|
||||||
Dest->Length = Src->Length;
|
|
||||||
Dest->MaximumLength = Src->MaximumLength;
|
|
||||||
Dest->Buffer = ExAllocatePool(NonPagedPool, Dest->MaximumLength);
|
|
||||||
if (Dest->Buffer == NULL)
|
|
||||||
{
|
|
||||||
return(Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copy the source string to kernel space.
|
|
||||||
*/
|
|
||||||
Status = MmCopyFromCaller(Dest->Buffer, Src->Buffer, Dest->Length);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
ExFreePool(Dest->Buffer);
|
|
||||||
return(Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue