added more irql checks
Modified: trunk/reactos/ntoskrnl/ex/callback.c
Modified: trunk/reactos/ntoskrnl/ex/event.c
Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
Modified: trunk/reactos/ntoskrnl/ex/mutant.c
Modified: trunk/reactos/ntoskrnl/ex/profile.c
Modified: trunk/reactos/ntoskrnl/ex/rundown.c
Modified: trunk/reactos/ntoskrnl/ex/sem.c
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
Modified: trunk/reactos/ntoskrnl/ex/time.c
Modified: trunk/reactos/ntoskrnl/ex/timer.c
Modified: trunk/reactos/ntoskrnl/ex/uuid.c
Modified: trunk/reactos/ntoskrnl/rtl/capture.c
_____
Modified: trunk/reactos/ntoskrnl/ex/callback.c
--- trunk/reactos/ntoskrnl/ex/callback.c 2005-02-22 22:08:04 UTC
(rev 13719)
+++ trunk/reactos/ntoskrnl/ex/callback.c 2005-02-22 22:19:14 UTC
(rev 13720)
@@ -171,6 +171,8 @@
PINT_CALLBACK_OBJECT Callback;
NTSTATUS Status;
HANDLE Handle;
+
+ PAGED_CODE();
/* Open a handle to the callback if it exists */
if (ObjectAttributes->ObjectName)
@@ -346,6 +348,8 @@
PINT_CALLBACK_OBJECT CallbackObject =
(PINT_CALLBACK_OBJECT)OpaqueCallbackObject;
PCALLBACK_REGISTRATION CallbackRegistration = NULL;
KIRQL OldIrql;
+
+ PAGED_CODE();
/* Create reference to Callback Object */
ObReferenceObject (CallbackObject);
@@ -411,6 +415,8 @@
PCALLBACK_REGISTRATION CallbackRegistration;
PINT_CALLBACK_OBJECT CallbackObject;
KIRQL OldIrql;
+
+ PAGED_CODE();
/* Convert Handle to valid Structure Pointer */
CallbackRegistration = (PCALLBACK_REGISTRATION)
CallbackRegistrationHandle;
_____
Modified: trunk/reactos/ntoskrnl/ex/event.c
--- trunk/reactos/ntoskrnl/ex/event.c 2005-02-22 22:08:04 UTC (rev
13719)
+++ trunk/reactos/ntoskrnl/ex/event.c 2005-02-22 22:19:14 UTC (rev
13720)
@@ -88,6 +88,8 @@
PKEVENT Event;
NTSTATUS Status;
+ PAGED_CODE();
+
Status = ObReferenceObjectByHandle(EventHandle,
EVENT_MODIFY_STATE,
ExEventObjectType,
@@ -118,6 +120,8 @@
PKEVENT Event;
HANDLE hEvent;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
PreviousMode = ExGetPreviousMode();
@@ -195,6 +199,8 @@
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+ PAGED_CODE();
+
DPRINT("NtOpenEvent(0x%x, 0x%x, 0x%x)\n", EventHandle,
DesiredAccess, ObjectAttributes);
PreviousMode = ExGetPreviousMode();
@@ -254,6 +260,8 @@
PKEVENT Event;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
DPRINT("NtPulseEvent(EventHandle 0%x PreviousState 0%x)\n",
EventHandle, PreviousState);
@@ -322,6 +330,8 @@
PKEVENT Event;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
PreviousMode = ExGetPreviousMode();
@@ -395,6 +405,8 @@
PKEVENT Event;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
DPRINT("NtResetEvent(EventHandle 0%x PreviousState 0%x)\n",
EventHandle, PreviousState);
@@ -460,6 +472,8 @@
PKEVENT Event;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
DPRINT("NtSetEvent(EventHandle 0%x PreviousState 0%x)\n",
EventHandle, PreviousState);
_____
Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
--- trunk/reactos/ntoskrnl/ex/evtpair.c 2005-02-22 22:08:04 UTC (rev
13719)
+++ trunk/reactos/ntoskrnl/ex/evtpair.c 2005-02-22 22:19:14 UTC (rev
13720)
@@ -95,6 +95,8 @@
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+ PAGED_CODE();
+
PreviousMode = ExGetPreviousMode();
if(PreviousMode == UserMode)
@@ -168,6 +170,8 @@
HANDLE hEventPair;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
PreviousMode = ExGetPreviousMode();
@@ -221,6 +225,8 @@
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
+
+ PAGED_CODE();
DPRINT("NtSetHighEventPair(EventPairHandle %x)\n",
EventPairHandle);
@@ -252,6 +258,8 @@
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
+
+ PAGED_CODE();
DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n",
EventPairHandle);
@@ -289,6 +297,8 @@
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
+
+ PAGED_CODE();
DPRINT("NtSetLowEventPair(EventPairHandle %x)\n",
EventPairHandle);
@@ -320,6 +330,8 @@
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
+
+ PAGED_CODE();
DPRINT("NtSetLowWaitHighEventPair(EventPairHandle %x)\n",
EventPairHandle);
@@ -357,6 +369,8 @@
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
+
+ PAGED_CODE();
DPRINT("NtWaitLowEventPair(EventPairHandle %x)\n",
EventPairHandle);
@@ -390,6 +404,8 @@
PKEVENT_PAIR EventPair;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
+
+ PAGED_CODE();
DPRINT("NtWaitHighEventPair(EventPairHandle %x)\n",
EventPairHandle);
@@ -436,6 +452,8 @@
NTSTATUS Status;
KIRQL Irql;
+ PAGED_CODE();
+
PreviousMode = ExGetPreviousMode();
if(!Thread->EventPair)
@@ -489,6 +507,8 @@
PKEVENT_PAIR EventPair;
NTSTATUS Status;
KIRQL Irql;
+
+ PAGED_CODE();
Thread = PsGetCurrentThread();
_____
Modified: trunk/reactos/ntoskrnl/ex/mutant.c
--- trunk/reactos/ntoskrnl/ex/mutant.c 2005-02-22 22:08:04 UTC (rev
13719)
+++ trunk/reactos/ntoskrnl/ex/mutant.c 2005-02-22 22:19:14 UTC (rev
13720)
@@ -104,27 +104,29 @@
PKMUTEX Mutant;
NTSTATUS Status = STATUS_SUCCESS;
- PreviousMode = ExGetPreviousMode();
+ PAGED_CODE();
+
+ PreviousMode = ExGetPreviousMode();
- if(PreviousMode == UserMode)
- {
- _SEH_TRY
- {
- ProbeForWrite(MutantHandle,
- sizeof(HANDLE),
- sizeof(ULONG));
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
+ if(PreviousMode == UserMode)
+ {
+ _SEH_TRY
+ {
+ ProbeForWrite(MutantHandle,
+ sizeof(HANDLE),
+ sizeof(ULONG));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
- if(!NT_SUCCESS(Status))
- {
- return Status;
- }
- }
+ if(!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+ }
Status = ObCreateObject(PreviousMode,
ExMutantObjectType,
@@ -177,6 +179,8 @@
HANDLE hMutant;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
DPRINT("NtOpenMutant(0x%x, 0x%x, 0x%x)\n", MutantHandle,
DesiredAccess, ObjectAttributes);
@@ -240,6 +244,8 @@
PKMUTANT Mutant;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
PreviousMode = ExGetPreviousMode();
@@ -311,6 +317,8 @@
PKMUTANT Mutant;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
DPRINT("NtReleaseMutant(MutantHandle 0%x PreviousCount 0%x)\n",
MutantHandle, PreviousCount);
_____
Modified: trunk/reactos/ntoskrnl/ex/profile.c
--- trunk/reactos/ntoskrnl/ex/profile.c 2005-02-22 22:08:04 UTC (rev
13719)
+++ trunk/reactos/ntoskrnl/ex/profile.c 2005-02-22 22:19:14 UTC (rev
13720)
@@ -109,6 +109,8 @@
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status = STATUS_SUCCESS;
+ PAGED_CODE();
+
PreviousMode = ExGetPreviousMode();
if(BufferSize == 0)
@@ -271,6 +273,8 @@
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+ PAGED_CODE();
+
PreviousMode = ExGetPreviousMode();
if(PreviousMode != KernelMode)
@@ -329,6 +333,8 @@
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
+ PAGED_CODE();
+
PreviousMode = ExGetPreviousMode();
Status = ObReferenceObjectByHandle(ProfileHandle,
@@ -353,6 +359,8 @@
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
+ PAGED_CODE();
+
PreviousMode = ExGetPreviousMode();
Status = ObReferenceObjectByHandle(ProfileHandle,
_____
Modified: trunk/reactos/ntoskrnl/ex/rundown.c
--- trunk/reactos/ntoskrnl/ex/rundown.c 2005-02-22 22:08:04 UTC (rev
13719)
+++ trunk/reactos/ntoskrnl/ex/rundown.c 2005-02-22 22:19:14 UTC (rev
13720)
@@ -41,6 +41,8 @@
{
ULONG_PTR PrevCount, Current;
+ PAGED_CODE();
+
Count <<= EX_RUNDOWN_COUNT_SHIFT;
/* Loop until successfully incremented the counter */
@@ -74,6 +76,8 @@
IN PEX_RUNDOWN_REF RunRef
)
{
+ PAGED_CODE();
+
/* Set the count to zero */
RunRef->Count = 0;
}
@@ -87,6 +91,8 @@
IN PEX_RUNDOWN_REF RunRef
)
{
+ PAGED_CODE();
+
/* Reset the count */
#ifdef _WIN64
InterlockedExchangeAdd64((LONGLONG*)&RunRef->Count, 0LL);
@@ -106,6 +112,8 @@
IN ULONG Count
)
{
+ PAGED_CODE();
+
Count <<= EX_RUNDOWN_COUNT_SHIFT;
for (;;)
@@ -200,7 +208,9 @@
IN PEX_RUNDOWN_REF RunRef
)
{
- /* mark the */
+ PAGED_CODE();
+
+ /* mark the counter as active */
#ifdef _WIN64
InterlockedExchange64((LONGLONG*)&RunRef->Count,
(LONGLONG)EX_RUNDOWN_ACTIVE);
#else
@@ -220,6 +230,8 @@
ULONG_PTR PrevCount, NewPtr, PrevPtr;
RUNDOWN_DESCRIPTOR RundownDescriptor;
+ PAGED_CODE();
+
PrevCount = RunRef->Count;
if (PrevCount != 0 && !(PrevCount & EX_RUNDOWN_ACTIVE))
_____
Modified: trunk/reactos/ntoskrnl/ex/sem.c
--- trunk/reactos/ntoskrnl/ex/sem.c 2005-02-22 22:08:04 UTC (rev
13719)
+++ trunk/reactos/ntoskrnl/ex/sem.c 2005-02-22 22:19:14 UTC (rev
13720)
@@ -91,6 +91,8 @@
HANDLE hSemaphore;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
PreviousMode = ExGetPreviousMode();
@@ -167,6 +169,8 @@
HANDLE hSemaphore;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
PreviousMode = ExGetPreviousMode();
@@ -227,6 +231,8 @@
PKSEMAPHORE Semaphore;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
PreviousMode = ExGetPreviousMode();
@@ -299,6 +305,8 @@
PKSEMAPHORE Semaphore;
NTSTATUS Status = STATUS_SUCCESS;
+ PAGED_CODE();
+
PreviousMode = ExGetPreviousMode();
if(PreviousCount != NULL && PreviousMode == UserMode)
_____
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
--- trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-02-22 22:08:04 UTC (rev
13719)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-02-22 22:19:14 UTC (rev
13720)
@@ -101,6 +101,8 @@
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+ PAGED_CODE();
+
PreviousMode = ExGetPreviousMode();
if(PreviousMode != KernelMode)
@@ -245,6 +247,8 @@
ANSI_STRING AName, AValue;
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
+
+ PAGED_CODE();
PreviousMode = ExGetPreviousMode();
@@ -1371,6 +1375,8 @@
PVOID SystemInformation;
NTSTATUS Status;
NTSTATUS FStatus;
+
+ PAGED_CODE();
/* DPRINT("NtQuerySystemInformation Start. Class:%d\n",
SystemInformationClass );
@@ -1448,6 +1454,8 @@
IN ULONG SystemInformationLength
)
{
+ PAGED_CODE();
+
/*
* If called from user mode, check
* possible unsafe arguments.
@@ -1496,6 +1504,8 @@
IN UINT NumberOfBytesToFlush
)
{
+ PAGED_CODE();
+
__asm__("wbinvd\n");
return STATUS_SUCCESS;
}
_____
Modified: trunk/reactos/ntoskrnl/ex/time.c
--- trunk/reactos/ntoskrnl/ex/time.c 2005-02-22 22:08:04 UTC (rev
13719)
+++ trunk/reactos/ntoskrnl/ex/time.c 2005-02-22 22:19:14 UTC (rev
13720)
@@ -151,6 +151,8 @@
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+ PAGED_CODE();
+
PreviousMode = ExGetPreviousMode();
if(PreviousMode != KernelMode)
@@ -233,6 +235,8 @@
{
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
PreviousMode = ExGetPreviousMode();
_____
Modified: trunk/reactos/ntoskrnl/ex/timer.c
--- trunk/reactos/ntoskrnl/ex/timer.c 2005-02-22 22:08:04 UTC (rev
13719)
+++ trunk/reactos/ntoskrnl/ex/timer.c 2005-02-22 22:19:14 UTC (rev
13720)
@@ -209,12 +209,16 @@
OUT PBOOLEAN CurrentState OPTIONAL)
{
PETIMER Timer;
- KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
- NTSTATUS Status = STATUS_SUCCESS;
+ KPROCESSOR_MODE PreviousMode;
BOOLEAN State;
KIRQL OldIrql;
+ PETHREAD TimerThread;
BOOLEAN KillTimer = FALSE;
- PETHREAD TimerThread;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
+
+ PreviousMode = ExGetPreviousMode();
DPRINT("NtCancelTimer(0x%x, 0x%x)\n", TimerHandle, CurrentState);
@@ -319,8 +323,12 @@
{
PETIMER Timer;
HANDLE hTimer;
- KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
+ KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
+
+ PreviousMode = ExGetPreviousMode();
DPRINT("NtCreateTimer(Handle: %x, Type: %d)\n", TimerHandle,
TimerType);
@@ -398,8 +406,12 @@
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
HANDLE hTimer;
- KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
+ KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
+
+ PreviousMode = ExGetPreviousMode();
DPRINT("NtOpenTimer(TimerHandle: %x)\n", TimerHandle);
@@ -452,9 +464,13 @@
OUT PULONG ReturnLength OPTIONAL)
{
PETIMER Timer;
- KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
+ KPROCESSOR_MODE PreviousMode;
NTSTATUS Status = STATUS_SUCCESS;
PTIMER_BASIC_INFORMATION BasicInfo =
(PTIMER_BASIC_INFORMATION)TimerInformation;
+
+ PAGED_CODE();
+
+ PreviousMode = ExGetPreviousMode();
DPRINT("NtQueryTimer(TimerHandle: %x, Class: %d)\n", TimerHandle,
TimerInformationClass);
@@ -522,13 +538,18 @@
{
PETIMER Timer;
KIRQL OldIrql;
- BOOLEAN KillTimer = FALSE;
BOOLEAN State;
- KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
- PETHREAD CurrentThread = PsGetCurrentThread();
- NTSTATUS Status = STATUS_SUCCESS;
+ KPROCESSOR_MODE PreviousMode;
+ PETHREAD CurrentThread;
LARGE_INTEGER TimerDueTime;
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);
_____
Modified: trunk/reactos/ntoskrnl/ex/uuid.c
--- trunk/reactos/ntoskrnl/ex/uuid.c 2005-02-22 22:08:04 UTC (rev
13719)
+++ trunk/reactos/ntoskrnl/ex/uuid.c 2005-02-22 22:19:14 UTC (rev
13720)
@@ -223,6 +223,8 @@
ULARGE_INTEGER IntTime;
ULONG IntRange;
NTSTATUS Status;
+
+ PAGED_CODE();
ExAcquireFastMutex(&UuidMutex);
@@ -278,6 +280,8 @@
NTSTATUS STDCALL
NtSetUuidSeed(IN PUCHAR Seed)
{
+ PAGED_CODE();
+
RtlCopyMemory(UuidSeed,
Seed,
SEED_BUFFER_SIZE);
_____
Modified: trunk/reactos/ntoskrnl/rtl/capture.c
--- trunk/reactos/ntoskrnl/rtl/capture.c 2005-02-22 22:08:04 UTC
(rev 13719)
+++ trunk/reactos/ntoskrnl/rtl/capture.c 2005-02-22 22:19:14 UTC
(rev 13720)
@@ -125,46 +125,6 @@
}
}
-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
*/