[NTOSKRNL]

- Construct a valid device path for ZwOpenFile
- Button events are now recognized by the power manager (tested on VirtualBox)

svn path=/trunk/; revision=46458
This commit is contained in:
Cameron Gutman 2010-03-26 02:41:08 +00:00
parent 937d6233d7
commit 443b32a725

View file

@ -157,6 +157,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);
@ -177,10 +179,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);