[ros-diffs] [cgutman] 46458: [NTOSKRNL] - Construct a valid device path for ZwOpenFile - Button events are now recognized by the power manager (tested on VirtualBox)

cgutman at svn.reactos.org cgutman at svn.reactos.org
Fri Mar 26 03:41:09 CET 2010


Author: cgutman
Date: Fri Mar 26 03:41:08 2010
New Revision: 46458

URL: http://svn.reactos.org/svn/reactos?rev=46458&view=rev
Log:
[NTOSKRNL]
- Construct a valid device path for ZwOpenFile
- Button events are now recognized by the power manager (tested on VirtualBox)

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=46458&r1=46457&r2=46458&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/po/events.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/po/events.c [iso-8859-1] Fri Mar 26 03:41:08 2010
@@ -157,6 +157,8 @@
 	BOOLEAN Arrival;
 	ULONG Caps;
 	NTSTATUS Status;
+	UNICODE_STRING DeviceName;
+	UNICODE_STRING DeviceNamePrefix = RTL_CONSTANT_STRING(L"\\??\\");
 
 	DPRINT("PopAddRemoveSysCapsCallback(%p %p)\n",
 		NotificationStructure, Context);
@@ -177,10 +179,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);




More information about the Ros-diffs mailing list