mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 10:03:26 +00:00
[NTOSKRNL]
- Fix opening of handles to enumerated devices (revert 53351 which ironically fixed this same bug) - Fixes bug 6939 svn path=/trunk/; revision=56196
This commit is contained in:
parent
c9c1053b91
commit
f2162e8335
1 changed files with 14 additions and 1 deletions
|
@ -162,6 +162,8 @@ PopAddRemoveSysCapsCallback(IN PVOID NotificationStructure,
|
||||||
BOOLEAN Arrival;
|
BOOLEAN Arrival;
|
||||||
ULONG Caps;
|
ULONG Caps;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
UNICODE_STRING DeviceName;
|
||||||
|
UNICODE_STRING DeviceNamePrefix = RTL_CONSTANT_STRING(L"\\??\\");
|
||||||
|
|
||||||
DPRINT("PopAddRemoveSysCapsCallback(%p %p)\n",
|
DPRINT("PopAddRemoveSysCapsCallback(%p %p)\n",
|
||||||
NotificationStructure, Context);
|
NotificationStructure, Context);
|
||||||
|
@ -182,10 +184,20 @@ PopAddRemoveSysCapsCallback(IN PVOID NotificationStructure,
|
||||||
{
|
{
|
||||||
DPRINT("Arrival of %wZ\n", Notification->SymbolicLinkName);
|
DPRINT("Arrival of %wZ\n", Notification->SymbolicLinkName);
|
||||||
|
|
||||||
|
DeviceName.Length = 0;
|
||||||
|
DeviceName.MaximumLength = Notification->SymbolicLinkName->MaximumLength + DeviceNamePrefix.MaximumLength;
|
||||||
|
DeviceName.Buffer = ExAllocatePool(PagedPool, DeviceName.MaximumLength);
|
||||||
|
if (!DeviceName.Buffer) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
|
RtlCopyUnicodeString(&DeviceName, &DeviceNamePrefix);
|
||||||
|
RtlAppendUnicodeStringToString(&DeviceName, Notification->SymbolicLinkName);
|
||||||
|
|
||||||
|
DPRINT("Opening handle to %wZ\n", &DeviceName);
|
||||||
|
|
||||||
/* Open the device */
|
/* Open the device */
|
||||||
InitializeObjectAttributes(
|
InitializeObjectAttributes(
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
Notification->SymbolicLinkName,
|
&DeviceName,
|
||||||
OBJ_KERNEL_HANDLE,
|
OBJ_KERNEL_HANDLE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -196,6 +208,7 @@ PopAddRemoveSysCapsCallback(IN PVOID NotificationStructure,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
0);
|
0);
|
||||||
|
RtlFreeUnicodeString(&DeviceName);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("ZwOpenFile() failed with status 0x%08lx\n", Status);
|
DPRINT1("ZwOpenFile() failed with status 0x%08lx\n", Status);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue