You can certainly call KeSetEvent at dispatch level, there is no problem there. What documentation led you to think otherwise? A better design would be to complete a pended IRP because then you can send data back to the user mode application/service in the output buffer.
I am confused about your statements such as " the ACPI scan code (E0, 5E) is not supported." Do you mean ps2 scan code? Acpi has nothing to do with keyboard scan codes. If you look at the pnpi8042 sample in the vista wdk (removed for the win7 wdk), you will see the scan code is handled, but it is mapped to GUID_DEVICE_SYS_BUTTON, http://msdn.microsoft.com/en-us/library/windows/hardware/ff545782(v=vs.85).aspx. If you truly want to report a power button from your driver, enumerate a raw PDO and report this device interface from it. You want to report SYS_BUTTON_POWER for IOCTL_GET_SYS_BUTTON_CAPS and then pend IOCTL_GET_SYS_BUTTON_EVENT until the button is pressed or you when want to “inject” and then set SYS_BUTTON_POWER when you complete the irp.
I think a user mode service is much simpler.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Sunday, February 26, 2012 10:35 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] ZwShutDownSystem, ZwSetSystemPowerState or ZwInitiatePowerAction Native API for WXP
Hi Doron, Ken and All,
Actually I want to have one “Power” key as the standard Keyboard.
But as I said, if you search the winuser.h(win Server 2003), the ACPI scan code (E0, 5E) is not supported.
If we use a user mode service, we need to send a signal from the keyboard driver. But my driver is based on the ddk filter sample, which means I will need to “send this signal” from the KbFilter_ServiceCallback() function. But this callback function is running on dispatch IRQL, set SetEvent() doesn’t work.
That is why I want to use these API functions.
I have checked the DDK XP ntdll.lib, the API symbols are inside. Just wonder why the build process failed.
Thanks and Regards,
Jeff
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer