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

View file

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

View file

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