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>
@ -88,6 +89,8 @@ RtlRandom (IN OUT PULONG Seed)
ULONG Rand; ULONG Rand;
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;

View file

@ -165,6 +165,8 @@ RtlCheckRegistryKey(IN ULONG RelativeTo,
{ {
HANDLE KeyHandle; HANDLE KeyHandle;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE_RTL();
Status = RtlpGetRegistryHandle(RelativeTo, Status = RtlpGetRegistryHandle(RelativeTo,
Path, Path,
@ -188,6 +190,8 @@ RtlCreateRegistryKey(IN ULONG RelativeTo,
{ {
HANDLE KeyHandle; HANDLE KeyHandle;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE_RTL();
Status = RtlpGetRegistryHandle(RelativeTo, Status = RtlpGetRegistryHandle(RelativeTo,
Path, Path,
@ -213,6 +217,8 @@ RtlDeleteRegistryValue(IN ULONG RelativeTo,
HANDLE KeyHandle; HANDLE KeyHandle;
NTSTATUS Status; NTSTATUS Status;
UNICODE_STRING Name; UNICODE_STRING Name;
PAGED_CODE_RTL();
Status = RtlpGetRegistryHandle(RelativeTo, Status = RtlpGetRegistryHandle(RelativeTo,
(PWSTR)Path, (PWSTR)Path,
@ -245,6 +251,8 @@ RtlFormatCurrentUserKeyPath (OUT PUNICODE_STRING KeyPath)
ULONG Length; ULONG Length;
UNICODE_STRING SidString; UNICODE_STRING SidString;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE_RTL();
DPRINT ("RtlFormatCurrentUserKeyPath() called\n"); DPRINT ("RtlFormatCurrentUserKeyPath() called\n");
@ -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)
{ {
@ -328,6 +336,8 @@ RtlOpenCurrentUser(IN ACCESS_MASK DesiredAccess,
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
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))
@ -390,6 +400,8 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
PWSTR ValueName; PWSTR ValueName;
UNICODE_STRING EnvValue; UNICODE_STRING EnvValue;
UNICODE_STRING EnvExpandedValue; UNICODE_STRING EnvExpandedValue;
PAGED_CODE_RTL();
DPRINT("RtlQueryRegistryValues() called\n"); DPRINT("RtlQueryRegistryValues() called\n");
@ -878,6 +890,8 @@ RtlWriteRegistryValue(IN ULONG RelativeTo,
HANDLE KeyHandle; HANDLE KeyHandle;
NTSTATUS Status; NTSTATUS Status;
UNICODE_STRING Name; UNICODE_STRING Name;
PAGED_CODE_RTL();
Status = RtlpGetRegistryHandle(RelativeTo, Status = RtlpGetRegistryHandle(RelativeTo,
(PWSTR)Path, (PWSTR)Path,

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,
@ -76,6 +78,8 @@ NTSTATUS STDCALL
CmUnRegisterCallback(IN LARGE_INTEGER Cookie) CmUnRegisterCallback(IN LARGE_INTEGER Cookie)
{ {
PLIST_ENTRY CurrentEntry; PLIST_ENTRY CurrentEntry;
PAGED_CODE();
ExAcquireFastMutex(&CmiCallbackLock); ExAcquireFastMutex(&CmiCallbackLock);
@ -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;
@ -184,6 +190,8 @@ NtCreateKey(OUT PHANDLE KeyHandle,
PVOID Object; PVOID Object;
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,
@ -365,6 +373,8 @@ NtDeleteKey(IN HANDLE KeyHandle)
KPROCESSOR_MODE PreviousMode; KPROCESSOR_MODE PreviousMode;
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);
@ -445,6 +455,8 @@ NtEnumerateKey(IN HANDLE KeyHandle,
PDATA_CELL ClassCell; PDATA_CELL ClassCell;
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,
@ -792,6 +804,8 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
PKEY_VALUE_BASIC_INFORMATION ValueBasicInformation; PKEY_VALUE_BASIC_INFORMATION ValueBasicInformation;
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,
@ -1028,6 +1042,8 @@ NtFlushKey(IN HANDLE KeyHandle)
PKEY_OBJECT KeyObject; PKEY_OBJECT KeyObject;
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);
@ -1082,6 +1098,8 @@ NtOpenKey(OUT PHANDLE KeyHandle,
PVOID Object; PVOID Object;
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,
@ -1183,6 +1201,8 @@ NtQueryKey(IN HANDLE KeyHandle,
PKEY_CELL KeyCell; PKEY_CELL KeyCell;
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,
@ -1384,6 +1404,8 @@ NtQueryValueKey(IN HANDLE KeyHandle,
PKEY_VALUE_BASIC_INFORMATION ValueBasicInformation; PKEY_VALUE_BASIC_INFORMATION ValueBasicInformation;
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);
@ -1624,6 +1646,8 @@ NtSetValueKey(IN HANDLE KeyHandle,
PDATA_CELL NewDataCell; PDATA_CELL NewDataCell;
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);
@ -1779,6 +1803,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,
@ -1850,6 +1876,8 @@ NtLoadKey2 (IN POBJECT_ATTRIBUTES KeyObjectAttributes,
ULONG BufferSize; ULONG BufferSize;
ULONG Length; ULONG Length;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
DPRINT ("NtLoadKey2() called\n"); DPRINT ("NtLoadKey2() called\n");
@ -1988,6 +2016,8 @@ NtQueryMultipleValueKey (IN HANDLE KeyHandle,
NTSTATUS Status; NTSTATUS Status;
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,
@ -2116,6 +2146,8 @@ NtSaveKey (IN HANDLE KeyHandle,
PREGISTRY_HIVE TempHive; PREGISTRY_HIVE TempHive;
PKEY_OBJECT KeyObject; PKEY_OBJECT KeyObject;
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
DPRINT ("NtSaveKey() called\n"); DPRINT ("NtSaveKey() called\n");
@ -2218,6 +2250,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;
@ -2274,6 +2308,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");
@ -2320,6 +2356,8 @@ NTSTATUS STDCALL
NtInitializeRegistry (IN BOOLEAN SetUpBoot) NtInitializeRegistry (IN BOOLEAN SetUpBoot)
{ {
NTSTATUS Status; NTSTATUS Status;
PAGED_CODE();
if (CmiRegistryInitialized == TRUE) if (CmiRegistryInitialized == TRUE)
return STATUS_ACCESS_DENIED; return STATUS_ACCESS_DENIED;