Author: tfaber
Date: Thu Mar 31 07:51:08 2016
New Revision: 71082
URL:
http://svn.reactos.org/svn/reactos?rev=71082&view=rev
Log:
[NTOS:PNP]
- Avoid INVALID_HANDLE_VALUE, it's not meant for the kernel.
Modified:
trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Thu Mar 31 07:51:08 2016
@@ -781,7 +781,7 @@
PDEVICE_NODE DeviceNode)
{
NTSTATUS Status;
- HANDLE InstanceHandle = INVALID_HANDLE_VALUE, ControlHandle = INVALID_HANDLE_VALUE;
+ HANDLE InstanceHandle = NULL, ControlHandle = NULL;
UNICODE_STRING KeyName;
OBJECT_ATTRIBUTES ObjectAttributes;
@@ -817,10 +817,10 @@
// }
ByeBye:
- if (ControlHandle != INVALID_HANDLE_VALUE)
+ if (ControlHandle != NULL)
ZwClose(ControlHandle);
- if (InstanceHandle != INVALID_HANDLE_VALUE)
+ if (InstanceHandle != NULL)
ZwClose(InstanceHandle);
return Status;
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] Thu Mar 31 07:51:08 2016
@@ -198,7 +198,7 @@
UNICODE_STRING PathSep = RTL_CONSTANT_STRING(L"\\");
ULONG NextInstance;
UNICODE_STRING EnumKeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\"
REGSTR_PATH_SYSTEMENUM);
- HANDLE EnumHandle, DeviceKeyHandle = INVALID_HANDLE_VALUE, InstanceKeyHandle;
+ HANDLE EnumHandle, DeviceKeyHandle = NULL, InstanceKeyHandle;
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
OBJECT_ATTRIBUTES ObjectAttributes;
@@ -377,7 +377,7 @@
RtlFreeUnicodeString(&Device->InstanceID);
ExFreePoolWithTag(Device, TAG_PNP_ROOT);
}
- if (DeviceKeyHandle != INVALID_HANDLE_VALUE)
+ if (DeviceKeyHandle != NULL)
ObCloseHandle(DeviceKeyHandle, KernelMode);
return Status;
}
@@ -447,9 +447,9 @@
WCHAR DevicePath[MAX_PATH + 1];
RTL_QUERY_REGISTRY_TABLE QueryTable[4];
PPNPROOT_DEVICE Device = NULL;
- HANDLE KeyHandle = INVALID_HANDLE_VALUE;
- HANDLE SubKeyHandle = INVALID_HANDLE_VALUE;
- HANDLE DeviceKeyHandle = INVALID_HANDLE_VALUE;
+ HANDLE KeyHandle = NULL;
+ HANDLE SubKeyHandle = NULL;
+ HANDLE DeviceKeyHandle = NULL;
ULONG BufferSize;
ULONG ResultSize;
ULONG Index1, Index2;
@@ -627,7 +627,7 @@
}
ZwClose(DeviceKeyHandle);
- DeviceKeyHandle = INVALID_HANDLE_VALUE;
+ DeviceKeyHandle = NULL;
/* Insert the newly created device into the list */
InsertTailList(
@@ -641,7 +641,7 @@
}
ZwClose(SubKeyHandle);
- SubKeyHandle = INVALID_HANDLE_VALUE;
+ SubKeyHandle = NULL;
Index1++;
}
@@ -652,11 +652,11 @@
/* FIXME */
ExFreePoolWithTag(Device, TAG_PNP_ROOT);
}
- if (DeviceKeyHandle != INVALID_HANDLE_VALUE)
+ if (DeviceKeyHandle != NULL)
ZwClose(DeviceKeyHandle);
- if (SubKeyHandle != INVALID_HANDLE_VALUE)
+ if (SubKeyHandle != NULL)
ZwClose(SubKeyHandle);
- if (KeyHandle != INVALID_HANDLE_VALUE)
+ if (KeyHandle != NULL)
ZwClose(KeyHandle);
if (KeyInfo)
ExFreePoolWithTag(KeyInfo, TAG_PNP_ROOT);