added more irql checks

svn path=/trunk/; revision=13723
This commit is contained in:
Thomas Bluemel 2005-02-23 09:56:36 +00:00
parent 1d8b8598af
commit d60f4e5131
3 changed files with 56 additions and 1 deletions

View file

@ -27,6 +27,7 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <ntdll/rtl.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
@ -89,6 +90,8 @@ RtlRandom (IN OUT PULONG Seed)
int Pos; int Pos;
ULONG Result; ULONG Result;
PAGED_CODE_RTL();
Rand = (*Seed * 0x7fffffed + 0x7fffffc3) % 0x7fffffff; Rand = (*Seed * 0x7fffffed + 0x7fffffc3) % 0x7fffffff;
*Seed = (Rand * 0x7fffffed + 0x7fffffc3) % 0x7fffffff; *Seed = (Rand * 0x7fffffed + 0x7fffffc3) % 0x7fffffff;
Pos = *Seed & 0x7f; Pos = *Seed & 0x7f;

View file

@ -166,6 +166,8 @@ RtlCheckRegistryKey(IN ULONG RelativeTo,
HANDLE KeyHandle; HANDLE KeyHandle;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE_RTL();
Status = RtlpGetRegistryHandle(RelativeTo, Status = RtlpGetRegistryHandle(RelativeTo,
Path, Path,
FALSE, FALSE,
@ -189,6 +191,8 @@ RtlCreateRegistryKey(IN ULONG RelativeTo,
HANDLE KeyHandle; HANDLE KeyHandle;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE_RTL();
Status = RtlpGetRegistryHandle(RelativeTo, Status = RtlpGetRegistryHandle(RelativeTo,
Path, Path,
TRUE, TRUE,
@ -214,6 +218,8 @@ RtlDeleteRegistryValue(IN ULONG RelativeTo,
NTSTATUS Status; NTSTATUS Status;
UNICODE_STRING Name; UNICODE_STRING Name;
PAGED_CODE_RTL();
Status = RtlpGetRegistryHandle(RelativeTo, Status = RtlpGetRegistryHandle(RelativeTo,
(PWSTR)Path, (PWSTR)Path,
FALSE, FALSE,
@ -246,6 +252,8 @@ RtlFormatCurrentUserKeyPath (OUT PUNICODE_STRING KeyPath)
UNICODE_STRING SidString; UNICODE_STRING SidString;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE_RTL();
DPRINT ("RtlFormatCurrentUserKeyPath() called\n"); DPRINT ("RtlFormatCurrentUserKeyPath() called\n");
Status = ZwOpenThreadToken (NtCurrentThread (), Status = ZwOpenThreadToken (NtCurrentThread (),
@ -299,7 +307,7 @@ RtlFormatCurrentUserKeyPath (OUT PUNICODE_STRING KeyPath)
KeyPath->Length = 0; KeyPath->Length = 0;
KeyPath->MaximumLength = Length; KeyPath->MaximumLength = Length;
KeyPath->Buffer = ExAllocatePool (NonPagedPool, KeyPath->Buffer = ExAllocatePool (PagedPool,
KeyPath->MaximumLength); KeyPath->MaximumLength);
if (KeyPath->Buffer == NULL) if (KeyPath->Buffer == NULL)
{ {
@ -329,6 +337,8 @@ RtlOpenCurrentUser(IN ACCESS_MASK DesiredAccess,
UNICODE_STRING KeyPath; UNICODE_STRING KeyPath;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE_RTL();
Status = RtlFormatCurrentUserKeyPath(&KeyPath); Status = RtlFormatCurrentUserKeyPath(&KeyPath);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
@ -391,6 +401,8 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
UNICODE_STRING EnvValue; UNICODE_STRING EnvValue;
UNICODE_STRING EnvExpandedValue; UNICODE_STRING EnvExpandedValue;
PAGED_CODE_RTL();
DPRINT("RtlQueryRegistryValues() called\n"); DPRINT("RtlQueryRegistryValues() called\n");
Status = RtlpGetRegistryHandle(RelativeTo, Status = RtlpGetRegistryHandle(RelativeTo,
@ -879,6 +891,8 @@ RtlWriteRegistryValue(IN ULONG RelativeTo,
NTSTATUS Status; NTSTATUS Status;
UNICODE_STRING Name; UNICODE_STRING Name;
PAGED_CODE_RTL();
Status = RtlpGetRegistryHandle(RelativeTo, Status = RtlpGetRegistryHandle(RelativeTo,
(PWSTR)Path, (PWSTR)Path,
TRUE, TRUE,

View file

@ -39,6 +39,8 @@ CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
{ {
PREGISTRY_CALLBACK Callback; PREGISTRY_CALLBACK Callback;
PAGED_CODE();
ASSERT(Function && Cookie); ASSERT(Function && Cookie);
Callback = ExAllocatePoolWithTag(PagedPool, Callback = ExAllocatePoolWithTag(PagedPool,
@ -77,6 +79,8 @@ CmUnRegisterCallback(IN LARGE_INTEGER Cookie)
{ {
PLIST_ENTRY CurrentEntry; PLIST_ENTRY CurrentEntry;
PAGED_CODE();
ExAcquireFastMutex(&CmiCallbackLock); ExAcquireFastMutex(&CmiCallbackLock);
for(CurrentEntry = CmiCallbackHead.Flink; for(CurrentEntry = CmiCallbackHead.Flink;
@ -129,6 +133,8 @@ CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
{ {
PLIST_ENTRY CurrentEntry; PLIST_ENTRY CurrentEntry;
PAGED_CODE();
ExAcquireFastMutex(&CmiCallbackLock); ExAcquireFastMutex(&CmiCallbackLock);
for(CurrentEntry = CmiCallbackHead.Flink; for(CurrentEntry = CmiCallbackHead.Flink;
@ -185,6 +191,8 @@ NtCreateKey(OUT PHANDLE KeyHandle,
PWSTR Start; PWSTR Start;
unsigned i; unsigned i;
PAGED_CODE();
DPRINT("NtCreateKey (Name %wZ KeyHandle %x Root %x)\n", DPRINT("NtCreateKey (Name %wZ KeyHandle %x Root %x)\n",
ObjectAttributes->ObjectName, ObjectAttributes->ObjectName,
KeyHandle, KeyHandle,
@ -366,6 +374,8 @@ NtDeleteKey(IN HANDLE KeyHandle)
PKEY_OBJECT KeyObject; PKEY_OBJECT KeyObject;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
DPRINT1("NtDeleteKey(KeyHandle %x) called\n", KeyHandle); DPRINT1("NtDeleteKey(KeyHandle %x) called\n", KeyHandle);
PreviousMode = ExGetPreviousMode(); PreviousMode = ExGetPreviousMode();
@ -446,6 +456,8 @@ NtEnumerateKey(IN HANDLE KeyHandle,
ULONG NameSize, ClassSize; ULONG NameSize, ClassSize;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
DPRINT("KH %x I %d KIC %x KI %x L %d RL %x\n", DPRINT("KH %x I %d KIC %x KI %x L %d RL %x\n",
KeyHandle, KeyHandle,
Index, Index,
@ -793,6 +805,8 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
PKEY_VALUE_PARTIAL_INFORMATION ValuePartialInformation; PKEY_VALUE_PARTIAL_INFORMATION ValuePartialInformation;
PKEY_VALUE_FULL_INFORMATION ValueFullInformation; PKEY_VALUE_FULL_INFORMATION ValueFullInformation;
PAGED_CODE();
DPRINT("KH %x I %d KVIC %x KVI %x L %d RL %x\n", DPRINT("KH %x I %d KVIC %x KVI %x L %d RL %x\n",
KeyHandle, KeyHandle,
Index, Index,
@ -1029,6 +1043,8 @@ NtFlushKey(IN HANDLE KeyHandle)
PREGISTRY_HIVE RegistryHive; PREGISTRY_HIVE RegistryHive;
KPROCESSOR_MODE PreviousMode; KPROCESSOR_MODE PreviousMode;
PAGED_CODE();
DPRINT("NtFlushKey (KeyHandle %lx) called\n", KeyHandle); DPRINT("NtFlushKey (KeyHandle %lx) called\n", KeyHandle);
PreviousMode = ExGetPreviousMode(); PreviousMode = ExGetPreviousMode();
@ -1083,6 +1099,8 @@ NtOpenKey(OUT PHANDLE KeyHandle,
HANDLE hKey; HANDLE hKey;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
DPRINT("NtOpenKey(KH %x DA %x OA %x OA->ON '%wZ'\n", DPRINT("NtOpenKey(KH %x DA %x OA %x OA->ON '%wZ'\n",
KeyHandle, KeyHandle,
DesiredAccess, DesiredAccess,
@ -1184,6 +1202,8 @@ NtQueryKey(IN HANDLE KeyHandle,
ULONG NameSize, ClassSize; ULONG NameSize, ClassSize;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
DPRINT("NtQueryKey(KH %x KIC %x KI %x L %d RL %x)\n", DPRINT("NtQueryKey(KH %x KIC %x KI %x L %d RL %x)\n",
KeyHandle, KeyHandle,
KeyInformationClass, KeyInformationClass,
@ -1385,6 +1405,8 @@ NtQueryValueKey(IN HANDLE KeyHandle,
PKEY_VALUE_PARTIAL_INFORMATION ValuePartialInformation; PKEY_VALUE_PARTIAL_INFORMATION ValuePartialInformation;
PKEY_VALUE_FULL_INFORMATION ValueFullInformation; PKEY_VALUE_FULL_INFORMATION ValueFullInformation;
PAGED_CODE();
DPRINT("NtQueryValueKey(KeyHandle %x ValueName %S Length %x)\n", DPRINT("NtQueryValueKey(KeyHandle %x ValueName %S Length %x)\n",
KeyHandle, ValueName->Buffer, Length); KeyHandle, ValueName->Buffer, Length);
@ -1625,6 +1647,8 @@ NtSetValueKey(IN HANDLE KeyHandle,
PHBIN pBin; PHBIN pBin;
ULONG DesiredAccess; ULONG DesiredAccess;
PAGED_CODE();
DPRINT("NtSetValueKey(KeyHandle %x ValueName '%wZ' Type %d)\n", DPRINT("NtSetValueKey(KeyHandle %x ValueName '%wZ' Type %d)\n",
KeyHandle, ValueName, Type); KeyHandle, ValueName, Type);
@ -1780,6 +1804,8 @@ NtDeleteValueKey (IN HANDLE KeyHandle,
PKEY_OBJECT KeyObject; PKEY_OBJECT KeyObject;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
/* Verify that the handle is valid and is a registry key */ /* Verify that the handle is valid and is a registry key */
Status = ObReferenceObjectByHandle(KeyHandle, Status = ObReferenceObjectByHandle(KeyHandle,
KEY_QUERY_VALUE, KEY_QUERY_VALUE,
@ -1851,6 +1877,8 @@ NtLoadKey2 (IN POBJECT_ATTRIBUTES KeyObjectAttributes,
ULONG Length; ULONG Length;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
DPRINT ("NtLoadKey2() called\n"); DPRINT ("NtLoadKey2() called\n");
#if 0 #if 0
@ -1989,6 +2017,8 @@ NtQueryMultipleValueKey (IN HANDLE KeyHandle,
PUCHAR DataPtr; PUCHAR DataPtr;
ULONG i; ULONG i;
PAGED_CODE();
/* Verify that the handle is valid and is a registry key */ /* Verify that the handle is valid and is a registry key */
Status = ObReferenceObjectByHandle(KeyHandle, Status = ObReferenceObjectByHandle(KeyHandle,
KEY_QUERY_VALUE, KEY_QUERY_VALUE,
@ -2117,6 +2147,8 @@ NtSaveKey (IN HANDLE KeyHandle,
PKEY_OBJECT KeyObject; PKEY_OBJECT KeyObject;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
DPRINT ("NtSaveKey() called\n"); DPRINT ("NtSaveKey() called\n");
#if 0 #if 0
@ -2219,6 +2251,8 @@ NtSetInformationKey (IN HANDLE KeyHandle,
PKEY_OBJECT KeyObject; PKEY_OBJECT KeyObject;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
if (KeyInformationClass != KeyWriteTimeInformation) if (KeyInformationClass != KeyWriteTimeInformation)
return STATUS_INVALID_INFO_CLASS; return STATUS_INVALID_INFO_CLASS;
@ -2275,6 +2309,8 @@ NtUnloadKey (IN POBJECT_ATTRIBUTES KeyObjectAttributes)
PREGISTRY_HIVE RegistryHive; PREGISTRY_HIVE RegistryHive;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
DPRINT ("NtUnloadKey() called\n"); DPRINT ("NtUnloadKey() called\n");
#if 0 #if 0
@ -2321,6 +2357,8 @@ NtInitializeRegistry (IN BOOLEAN SetUpBoot)
{ {
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
if (CmiRegistryInitialized == TRUE) if (CmiRegistryInitialized == TRUE)
return STATUS_ACCESS_DENIED; return STATUS_ACCESS_DENIED;