mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 21:05:43 +00:00
[NTOS:PNP]
- Avoid INVALID_HANDLE_VALUE, it's not meant for the kernel. svn path=/trunk/; revision=71082
This commit is contained in:
parent
d44ee74466
commit
72cf18964b
2 changed files with 13 additions and 13 deletions
|
@ -781,7 +781,7 @@ IopStartDevice(
|
||||||
PDEVICE_NODE DeviceNode)
|
PDEVICE_NODE DeviceNode)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE InstanceHandle = INVALID_HANDLE_VALUE, ControlHandle = INVALID_HANDLE_VALUE;
|
HANDLE InstanceHandle = NULL, ControlHandle = NULL;
|
||||||
UNICODE_STRING KeyName;
|
UNICODE_STRING KeyName;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
|
||||||
|
@ -817,10 +817,10 @@ IopStartDevice(
|
||||||
// }
|
// }
|
||||||
|
|
||||||
ByeBye:
|
ByeBye:
|
||||||
if (ControlHandle != INVALID_HANDLE_VALUE)
|
if (ControlHandle != NULL)
|
||||||
ZwClose(ControlHandle);
|
ZwClose(ControlHandle);
|
||||||
|
|
||||||
if (InstanceHandle != INVALID_HANDLE_VALUE)
|
if (InstanceHandle != NULL)
|
||||||
ZwClose(InstanceHandle);
|
ZwClose(InstanceHandle);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -198,7 +198,7 @@ PnpRootCreateDevice(
|
||||||
UNICODE_STRING PathSep = RTL_CONSTANT_STRING(L"\\");
|
UNICODE_STRING PathSep = RTL_CONSTANT_STRING(L"\\");
|
||||||
ULONG NextInstance;
|
ULONG NextInstance;
|
||||||
UNICODE_STRING EnumKeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\" REGSTR_PATH_SYSTEMENUM);
|
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];
|
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ cleanup:
|
||||||
RtlFreeUnicodeString(&Device->InstanceID);
|
RtlFreeUnicodeString(&Device->InstanceID);
|
||||||
ExFreePoolWithTag(Device, TAG_PNP_ROOT);
|
ExFreePoolWithTag(Device, TAG_PNP_ROOT);
|
||||||
}
|
}
|
||||||
if (DeviceKeyHandle != INVALID_HANDLE_VALUE)
|
if (DeviceKeyHandle != NULL)
|
||||||
ObCloseHandle(DeviceKeyHandle, KernelMode);
|
ObCloseHandle(DeviceKeyHandle, KernelMode);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -447,9 +447,9 @@ EnumerateDevices(
|
||||||
WCHAR DevicePath[MAX_PATH + 1];
|
WCHAR DevicePath[MAX_PATH + 1];
|
||||||
RTL_QUERY_REGISTRY_TABLE QueryTable[4];
|
RTL_QUERY_REGISTRY_TABLE QueryTable[4];
|
||||||
PPNPROOT_DEVICE Device = NULL;
|
PPNPROOT_DEVICE Device = NULL;
|
||||||
HANDLE KeyHandle = INVALID_HANDLE_VALUE;
|
HANDLE KeyHandle = NULL;
|
||||||
HANDLE SubKeyHandle = INVALID_HANDLE_VALUE;
|
HANDLE SubKeyHandle = NULL;
|
||||||
HANDLE DeviceKeyHandle = INVALID_HANDLE_VALUE;
|
HANDLE DeviceKeyHandle = NULL;
|
||||||
ULONG BufferSize;
|
ULONG BufferSize;
|
||||||
ULONG ResultSize;
|
ULONG ResultSize;
|
||||||
ULONG Index1, Index2;
|
ULONG Index1, Index2;
|
||||||
|
@ -627,7 +627,7 @@ EnumerateDevices(
|
||||||
}
|
}
|
||||||
|
|
||||||
ZwClose(DeviceKeyHandle);
|
ZwClose(DeviceKeyHandle);
|
||||||
DeviceKeyHandle = INVALID_HANDLE_VALUE;
|
DeviceKeyHandle = NULL;
|
||||||
|
|
||||||
/* Insert the newly created device into the list */
|
/* Insert the newly created device into the list */
|
||||||
InsertTailList(
|
InsertTailList(
|
||||||
|
@ -641,7 +641,7 @@ EnumerateDevices(
|
||||||
}
|
}
|
||||||
|
|
||||||
ZwClose(SubKeyHandle);
|
ZwClose(SubKeyHandle);
|
||||||
SubKeyHandle = INVALID_HANDLE_VALUE;
|
SubKeyHandle = NULL;
|
||||||
Index1++;
|
Index1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,11 +652,11 @@ cleanup:
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
ExFreePoolWithTag(Device, TAG_PNP_ROOT);
|
ExFreePoolWithTag(Device, TAG_PNP_ROOT);
|
||||||
}
|
}
|
||||||
if (DeviceKeyHandle != INVALID_HANDLE_VALUE)
|
if (DeviceKeyHandle != NULL)
|
||||||
ZwClose(DeviceKeyHandle);
|
ZwClose(DeviceKeyHandle);
|
||||||
if (SubKeyHandle != INVALID_HANDLE_VALUE)
|
if (SubKeyHandle != NULL)
|
||||||
ZwClose(SubKeyHandle);
|
ZwClose(SubKeyHandle);
|
||||||
if (KeyHandle != INVALID_HANDLE_VALUE)
|
if (KeyHandle != NULL)
|
||||||
ZwClose(KeyHandle);
|
ZwClose(KeyHandle);
|
||||||
if (KeyInfo)
|
if (KeyInfo)
|
||||||
ExFreePoolWithTag(KeyInfo, TAG_PNP_ROOT);
|
ExFreePoolWithTag(KeyInfo, TAG_PNP_ROOT);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue