added more irql checks
Modified: trunk/reactos/lib/rtl/random.c
Modified: trunk/reactos/lib/rtl/registry.c
Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c

Modified: trunk/reactos/lib/rtl/random.c
--- trunk/reactos/lib/rtl/random.c	2005-02-23 08:16:19 UTC (rev 13722)
+++ trunk/reactos/lib/rtl/random.c	2005-02-23 09:56:36 UTC (rev 13723)
@@ -27,6 +27,7 @@
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
+#include <ntdll/rtl.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -88,6 +89,8 @@
    ULONG Rand;
    int Pos;
    ULONG Result;
+   
+   PAGED_CODE_RTL();
 
    Rand = (*Seed * 0x7fffffed + 0x7fffffc3) % 0x7fffffff;
    *Seed = (Rand * 0x7fffffed + 0x7fffffc3) % 0x7fffffff;

Modified: trunk/reactos/lib/rtl/registry.c
--- trunk/reactos/lib/rtl/registry.c	2005-02-23 08:16:19 UTC (rev 13722)
+++ trunk/reactos/lib/rtl/registry.c	2005-02-23 09:56:36 UTC (rev 13723)
@@ -165,6 +165,8 @@
 {
   HANDLE KeyHandle;
   NTSTATUS Status;
+  
+  PAGED_CODE_RTL();
 
   Status = RtlpGetRegistryHandle(RelativeTo,
 				 Path,
@@ -188,6 +190,8 @@
 {
   HANDLE KeyHandle;
   NTSTATUS Status;
+  
+  PAGED_CODE_RTL();
 
   Status = RtlpGetRegistryHandle(RelativeTo,
 				 Path,
@@ -213,6 +217,8 @@
   HANDLE KeyHandle;
   NTSTATUS Status;
   UNICODE_STRING Name;
+  
+  PAGED_CODE_RTL();
 
   Status = RtlpGetRegistryHandle(RelativeTo,
 				 (PWSTR)Path,
@@ -245,6 +251,8 @@
   ULONG Length;
   UNICODE_STRING SidString;
   NTSTATUS Status;
+  
+  PAGED_CODE_RTL();
 
   DPRINT ("RtlFormatCurrentUserKeyPath() called\n");
 
@@ -299,7 +307,7 @@
 
   KeyPath->Length = 0;
   KeyPath->MaximumLength = Length;
-  KeyPath->Buffer = ExAllocatePool (NonPagedPool,
+  KeyPath->Buffer = ExAllocatePool (PagedPool,
 				    KeyPath->MaximumLength);
   if (KeyPath->Buffer == NULL)
     {
@@ -328,6 +336,8 @@
   OBJECT_ATTRIBUTES ObjectAttributes;
   UNICODE_STRING KeyPath;
   NTSTATUS Status;
+  
+  PAGED_CODE_RTL();
 
   Status = RtlFormatCurrentUserKeyPath(&KeyPath);
   if (NT_SUCCESS(Status))
@@ -390,6 +400,8 @@
   PWSTR ValueName;
   UNICODE_STRING EnvValue;
   UNICODE_STRING EnvExpandedValue;
+  
+  PAGED_CODE_RTL();
 
   DPRINT("RtlQueryRegistryValues() called\n");
 
@@ -878,6 +890,8 @@
   HANDLE KeyHandle;
   NTSTATUS Status;
   UNICODE_STRING Name;
+  
+  PAGED_CODE_RTL();
 
   Status = RtlpGetRegistryHandle(RelativeTo,
 				 (PWSTR)Path,

Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c
--- trunk/reactos/ntoskrnl/cm/ntfunc.c	2005-02-23 08:16:19 UTC (rev 13722)
+++ trunk/reactos/ntoskrnl/cm/ntfunc.c	2005-02-23 09:56:36 UTC (rev 13723)
@@ -39,6 +39,8 @@
 {
   PREGISTRY_CALLBACK Callback;
   
+  PAGED_CODE();
+  
   ASSERT(Function && Cookie);
   
   Callback = ExAllocatePoolWithTag(PagedPool,
@@ -76,6 +78,8 @@
 CmUnRegisterCallback(IN LARGE_INTEGER Cookie)
 {
   PLIST_ENTRY CurrentEntry;
+  
+  PAGED_CODE();
 
   ExAcquireFastMutex(&CmiCallbackLock);
 
@@ -129,6 +133,8 @@
 {
   PLIST_ENTRY CurrentEntry;
   
+  PAGED_CODE();
+  
   ExAcquireFastMutex(&CmiCallbackLock);
 
   for(CurrentEntry = CmiCallbackHead.Flink;
@@ -184,6 +190,8 @@
   PVOID Object;
   PWSTR Start;
   unsigned i;
+  
+  PAGED_CODE();
 
   DPRINT("NtCreateKey (Name %wZ  KeyHandle %x  Root %x)\n",
 	 ObjectAttributes->ObjectName,
@@ -365,6 +373,8 @@
   KPROCESSOR_MODE PreviousMode;
   PKEY_OBJECT KeyObject;
   NTSTATUS Status;
+  
+  PAGED_CODE();
 
   DPRINT1("NtDeleteKey(KeyHandle %x) called\n", KeyHandle);
   
@@ -445,6 +455,8 @@
   PDATA_CELL ClassCell;
   ULONG NameSize, ClassSize;
   NTSTATUS Status;
+  
+  PAGED_CODE();
 
   DPRINT("KH %x  I %d  KIC %x KI %x  L %d  RL %x\n",
 	 KeyHandle,
@@ -792,6 +804,8 @@
   PKEY_VALUE_BASIC_INFORMATION  ValueBasicInformation;
   PKEY_VALUE_PARTIAL_INFORMATION  ValuePartialInformation;
   PKEY_VALUE_FULL_INFORMATION  ValueFullInformation;
+  
+  PAGED_CODE();
 
   DPRINT("KH %x  I %d  KVIC %x  KVI %x  L %d  RL %x\n",
 	 KeyHandle,
@@ -1028,6 +1042,8 @@
   PKEY_OBJECT  KeyObject;
   PREGISTRY_HIVE  RegistryHive;
   KPROCESSOR_MODE  PreviousMode;
+  
+  PAGED_CODE();
 
   DPRINT("NtFlushKey (KeyHandle %lx) called\n", KeyHandle);
   
@@ -1082,6 +1098,8 @@
   PVOID Object;
   HANDLE hKey;
   NTSTATUS Status = STATUS_SUCCESS;
+  
+  PAGED_CODE();
 
   DPRINT("NtOpenKey(KH %x  DA %x  OA %x  OA->ON '%wZ'\n",
 	 KeyHandle,
@@ -1183,6 +1201,8 @@
   PKEY_CELL KeyCell;
   ULONG NameSize, ClassSize;
   NTSTATUS Status;
+  
+  PAGED_CODE();
 
   DPRINT("NtQueryKey(KH %x  KIC %x  KI %x  L %d  RL %x)\n",
 	 KeyHandle,
@@ -1384,6 +1404,8 @@
   PKEY_VALUE_BASIC_INFORMATION  ValueBasicInformation;
   PKEY_VALUE_PARTIAL_INFORMATION  ValuePartialInformation;
   PKEY_VALUE_FULL_INFORMATION  ValueFullInformation;
+  
+  PAGED_CODE();
 
   DPRINT("NtQueryValueKey(KeyHandle %x  ValueName %S  Length %x)\n",
     KeyHandle, ValueName->Buffer, Length);
@@ -1624,6 +1646,8 @@
   PDATA_CELL NewDataCell;
   PHBIN pBin;
   ULONG DesiredAccess;
+  
+  PAGED_CODE();
 
   DPRINT("NtSetValueKey(KeyHandle %x  ValueName '%wZ'  Type %d)\n",
 	 KeyHandle, ValueName, Type);
@@ -1779,6 +1803,8 @@
 {
   PKEY_OBJECT KeyObject;
   NTSTATUS Status;
+  
+  PAGED_CODE();
 
   /* Verify that the handle is valid and is a registry key */
   Status = ObReferenceObjectByHandle(KeyHandle,
@@ -1850,6 +1876,8 @@
   ULONG BufferSize;
   ULONG Length;
   NTSTATUS Status;
+  
+  PAGED_CODE();
 
   DPRINT ("NtLoadKey2() called\n");
 
@@ -1988,6 +2016,8 @@
   NTSTATUS Status;
   PUCHAR DataPtr;
   ULONG i;
+  
+  PAGED_CODE();
 
   /* Verify that the handle is valid and is a registry key */
   Status = ObReferenceObjectByHandle(KeyHandle,
@@ -2116,6 +2146,8 @@
   PREGISTRY_HIVE TempHive;
   PKEY_OBJECT KeyObject;
   NTSTATUS Status;
+  
+  PAGED_CODE();
 
   DPRINT ("NtSaveKey() called\n");
 
@@ -2218,6 +2250,8 @@
 {
   PKEY_OBJECT KeyObject;
   NTSTATUS Status;
+  
+  PAGED_CODE();
 
   if (KeyInformationClass != KeyWriteTimeInformation)
     return STATUS_INVALID_INFO_CLASS;
@@ -2274,6 +2308,8 @@
 {
   PREGISTRY_HIVE RegistryHive;
   NTSTATUS Status;
+  
+  PAGED_CODE();
 
   DPRINT ("NtUnloadKey() called\n");
 
@@ -2320,6 +2356,8 @@
 NtInitializeRegistry (IN BOOLEAN SetUpBoot)
 {
   NTSTATUS Status;
+  
+  PAGED_CODE();
 
   if (CmiRegistryInitialized == TRUE)
     return STATUS_ACCESS_DENIED;