[ros-diffs] [cgutman] 56196: [NTOSKRNL] - Fix opening of handles to enumerated devices (revert 53351 which ironically fixed this same bug) - Fixes bug 6939
cgutman at svn.reactos.org
cgutman at svn.reactos.org
Tue Mar 20 17:04:36 UTC 2012
Author: cgutman
Date: Tue Mar 20 17:04:36 2012
New Revision: 56196
URL: http://svn.reactos.org/svn/reactos?rev=56196&view=rev
Log:
[NTOSKRNL]
- Fix opening of handles to enumerated devices (revert 53351 which ironically fixed this same bug)
- Fixes bug 6939
Modified:
trunk/reactos/ntoskrnl/po/events.c
Modified: trunk/reactos/ntoskrnl/po/events.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/events.c?rev=56196&r1=56195&r2=56196&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/po/events.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/po/events.c [iso-8859-1] Tue Mar 20 17:04:36 2012
@@ -162,6 +162,8 @@
BOOLEAN Arrival;
ULONG Caps;
NTSTATUS Status;
+ UNICODE_STRING DeviceName;
+ UNICODE_STRING DeviceNamePrefix = RTL_CONSTANT_STRING(L"\\??\\");
DPRINT("PopAddRemoveSysCapsCallback(%p %p)\n",
NotificationStructure, Context);
@@ -182,10 +184,20 @@
{
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 */
InitializeObjectAttributes(
&ObjectAttributes,
- Notification->SymbolicLinkName,
+ &DeviceName,
OBJ_KERNEL_HANDLE,
NULL,
NULL);
@@ -196,6 +208,7 @@
&IoStatusBlock,
FILE_SHARE_READ | FILE_SHARE_WRITE,
0);
+ RtlFreeUnicodeString(&DeviceName);
if (!NT_SUCCESS(Status))
{
DPRINT1("ZwOpenFile() failed with status 0x%08lx\n", Status);
More information about the Ros-diffs
mailing list