Greetings There is a usb device. The system recognized it and installed the driver. There is a dump of the device with a special program (hex codes of data exchange). Is it possible to write a C ++ program to interact with this device? What can you read about this problem?

Thanks in advance!

  • Write theoretically possible. But you need to look at how the program communicates with the driver, and not the dump exchange on the port. - KoVadim
  • How can I see it? (is there a utility?) - ivan_b
  • one
    In general, user-mode programs interact with drivers by opening the driver descriptor using the CreateFile("\\\\.\\DEVICE\\devicename", ...) function and exchanging data packets using DeviceIoControl(hDevice, ...) . - karmadro4
  • @ Kotik_hochet_kusat, WinAPI path - interact with the object that this driver serves. I think that a good example would be the `` \\\\. \\ COM1 "device and its specific API. - karmadro4

2 answers 2

In this article, AntiHASP: we emulate the hardware protection key HASP

A variant of creating an emulator in the form of an IRP packet intercept driver is proposed. Sources to the text - look on the Internet, perhaps someone laid out. The article and examples are fully consistent with the task you described.

    Windows proposes strictly by API to interact with devices. The general algorithm comes down to this: first you need to catch, let's say a handler to the device, then you can work with the file, open, read, write something. But this is the simplest algorithm for com ports. And with usb devices it is much more difficult. You can’t open them so easy (I tried to read from the printer itself, it didn’t work) I think you need to look at the Windows Driver KIt side.

    • The situation is complicated by the fact that the native uses java to work with the device ( - ivan_b