2

Right, I haven't got to coding any of this yet but here's my plan:

  1. User scans RFID card with unique ID on it
  2. ID is read like keyboard input
  3. ID relates to DB/flat file and relative information is retrieved

Now this is fairly easy and I can do this, I'm just wondering how I can prevent any other input like from my keyboard being read instead of just from the USB port with the RFID reader (keyboard wedge) attached.

Any help would be greatly appreciated.

Thanks,

Nick

nbaosullivan
  • 4,034
  • 3
  • 21
  • 14

2 Answers2

5

You can use RawInput to distinguish input from multiple devices. It allows to retrieve device VendorID and ProductID which is unique for diffrenet devices, but it will be same for same devices (like two identical keyboards), altrough it also provides device GUID (in system, it's unique for system as i understand or something like this) and some other data that will help distinguish input even from two identical devices.

You can retrieve VID&PID of your RFID-scanner and compare all input message with it, only catching symbols from your device.

Additionaly i suppose your RFID-scanner inputs data realy fast, so you can just measure time which was used to input whole stroke of symbols and distinguish RFID-scanner from keyboard without knowing it's VID&PID pair.

To remove unwanted input you can use window hooks.

Almost forgot, microsoft developed some framework for POS devices, but it's for .NET, it's called POS for .NET. Maybe it will help, in my case i can't use it.

P.S.: I'm currently solving this puzzle myself, but with Barcode scanner (Reading barcode scanner input without knowing VID&PID)

Community
  • 1
  • 1
Ivan0x32
  • 413
  • 1
  • 7
  • 18
1

We had the same problem with RFID readers on the company where I work and we did a library for it to just get the rfid card id. Now that the library became open source (LGPL license), I believe it can be considered as an answer to your problem. It use RawInput as suggested by Ivan0x32 and start hook process on the current active console with impersonation if required (because of session 0 isolation, in case you're developing a Windows Service). Go to LibLogicalAccess project and look for "Keyboard" readers.

Maxime C.
  • 11
  • 1