Click here to Skip to main content
14,932,407 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hallo All
I use Create file ,Writefile,Readfile to communicate with a usb device,After using Createfile successfully Writefile needs a pipe to the device .I tried Createpipe() to create anynoumous pipe and I binded his handle with Createfile handle with refrence.but it did not work.So How to bind my Createfile handle to this pipe or How to use Createnamedpipe to solve my problem?
P.s How to make right pipename from usbpath which I have ?

What I have tried:

Hanle *g,*f;
Handle h;
Updated 28-Aug-18 0:30am
Richard MacCutchan 28-Aug-18 4:21am
Why does this need a pipe when you already have a direct handle to the device?
Member 13947289 28-Aug-18 4:25am
because when I use Writefile directly after Createfile I have the error E0001009 USBIO_ERR_NOT_BOUND
Richard MacCutchan 28-Aug-18 7:11am
Why do you believe that using a pipe will correct it?

1 solution

I know of three options to communicate with USB devices on Windows:
  • Using a device specific driver with an SDK provided by the device manufacturer
  • Using a device specific driver with IOCTLs
  • Using a device independant API or library like WinUSB or libusb

As a starting point you might read USB desktop application programming reference (Windows Drivers)[^].

For WinUSB examples see How to Access a USB Device by Using WinUSB Functions | Microsoft Docs[^] and Write a Windows desktop app based on the WinUSB template | Microsoft Docs[^].
Member 13947289 28-Aug-18 7:15am
Thank you Jochen
My usb device hat already a driver and a commuincation protocol from the original company and this protocol says that I can use Windows function Createfile...with the driver to accsess the device
the other option for me is to use libusb (because winusb is hard )
I will try this way.
Jochen Arndt 28-Aug-18 7:24am
If you have a look at the WinUSB example code you will notice that CreateFile() is used too initially.

Have you ever used libusb? It is low level and hard as well :)
Member 13947289 28-Aug-18 8:28am
I am lerning about it nowadays

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900