keyboard is not responding at boot time?

136 Views Asked by At

I am writing an application of Defragmentation at boot time.But,problem is that at boot time when monitor starts and black screen appears, it does not response to any keyboard keys when pressed?

My code goes like that:

  1. I call NtCreateFile to object "Device\KeyboardClass0", and it returns successfully with handle to the object.
  2. then I create event with NtCreateEvent and it returns successfully.
  3. then I call NtReadFile with the handle and event.
  4. then I wait on NtWaitForSingleObject for the event to signal me when there is something to read.
  5. when I am signaled I am going to to read the key that was pressed by user.

The problem is that step#5 is never reached, and I am pressing on the USB keyboard keys and nothing happens, as if the keyboard was not pressed.

The same code works fine with PS/2 keyboard, but with USB keyboard I can't read anything.

1

There are 1 best solutions below

0
On BEST ANSWER

Finally , i got the solution.Problem was regarding type of keyboard you are using i.e, PS2 or USB. you need to get all of the instances of the keyboard interface and read from all the keyboards simultaneously.As there exists port for the PS2 keyboard on motherboard,it gets priority at the boot time.While, for USB keyboard,We need to add some delay because,Windows System just need more time to register the USB keyboard class instance.