Jungo WinDriver  
Official Documentation
wdu_lib.h
Go to the documentation of this file.
1 /* @JUNGO_COPYRIGHT@ */
2 
3 #ifndef _WD_USB_H_
4 #define _WD_USB_H_
5 
6 #include "windrvr.h"
7 
8 #if defined(__cplusplus)
9  extern "C" {
10 #endif
11 
12 typedef PVOID WDU_DRIVER_HANDLE;
13 typedef PVOID WDU_DEVICE_HANDLE;
14 typedef PVOID WDU_STREAM_HANDLE;
15 
16 typedef WORD WDU_LANGID;
17 
18 /*
19  * User Callbacks
20  */
21 
36  _In_ WDU_DEVICE *pDeviceInfo, _In_ PVOID pUserData);
37 
46  _In_ PVOID pUserData);
47 
57  _In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwPowerState,
58  _In_ PVOID pUserData);
59 
60 /*
61  * struct definitions
62  */
63 typedef struct
64 {
68  PVOID pUserData; /* pointer to pass in each callback */
70 
71 /*
72  * API Functions
73  */
74 
91  _In_ WDU_MATCH_TABLE *pMatchTables, _In_ DWORD dwNumMatchTables,
92  _In_ WDU_EVENT_TABLE *pEventTable, _In_ const char *pcLicense,
93  _In_ DWORD dwOptions);
94 
101 
113  _Out_ DWORD *pAddress);
114 
142  _Outptr_ PVOID pBuffer, _Inout_ PDWORD pdwSize,
144 
156  _Outptr_ WDU_DEVICE **ppDeviceInfo);
157 
166 
176  _In_ DWORD dwInterfaceNum, _In_ DWORD dwAlternateSetting);
177 
178 /* NOT IMPLEMENTED YET */
179 DWORD DLLCALLCONV WDU_SetConfig(WDU_DEVICE_HANDLE hDevice, DWORD dwConfigNum);
180 /* NOT IMPLEMENTED YET */
181 
190  _In_ DWORD dwPipeNum);
191 
207  _In_ DWORD dwOptions);
208 
219  _In_ DWORD dwOptions);
220 
238  _In_ DWORD dwOptions);
239 
273  _In_ DWORD dwPipeNum, _In_ DWORD fRead, _In_ DWORD dwOptions,
274  _In_ PVOID pBuffer, _In_ DWORD dwBufferSize,
275  _Outptr_ PDWORD pdwBytesTransferred, _In_ PBYTE pSetupPacket,
276  _In_ DWORD dwTimeout);
277 
287  _In_ DWORD dwPipeNum);
288 
289 /*
290  * Simplified transfers - for a specific pipe
291  */
292 
294  _In_ DWORD fRead, _In_ DWORD dwOptions,
295  _In_ PVOID pBuffer, _In_ DWORD dwBufferSize,
296  _Outptr_ PDWORD pdwBytesTransferred,
297  _In_ PBYTE pSetupPacket, _In_ DWORD dwTimeout);
298 
300  _In_ DWORD dwPipeNum, _In_ DWORD fRead, _In_ DWORD dwOptions,
301  _In_ PVOID pBuffer, _In_ DWORD dwBufferSize,
302  _Outptr_ PDWORD pdwBytesTransferred, _In_ DWORD dwTimeout);
303 
305  _In_ DWORD dwPipeNum, _In_ DWORD fRead, _In_ DWORD dwOptions,
306  _In_ PVOID pBuffer, _In_ DWORD dwBufferSize,
307  _Outptr_ PDWORD pdwBytesTransferred, _In_ DWORD dwTimeout);
308 
310  _In_ DWORD dwPipeNum, _In_ DWORD fRead, _In_ DWORD dwOptions,
311  _In_ PVOID pBuffer, _In_ DWORD dwBufferSize,
312  _Outptr_ PDWORD pdwBytesTransferred, _In_ DWORD dwTimeout);
313 
341  _Outptr_ PBYTE pbNumSupportedLangIDs, _Outptr_ WDU_LANGID *pLangIDs,
342  _In_ BYTE bNumLangIDs);
343 
365  _In_ BYTE bStrIndex, _Outptr_ PBYTE pbBuf, _In_ DWORD dwBufSize,
366  _In_ WDU_LANGID langID, _Outptr_ PDWORD pdwDescSize);
367 
368 /*
369  * Streaming Functions
370  */
371 
422  _In_ DWORD dwPipeNum, _In_ DWORD dwBufferSize, _In_ DWORD dwRxSize,
423  _In_ BOOL fBlocking, _In_ DWORD dwOptions, _In_ DWORD dwRxTxTimeout,
424  _Outptr_ WDU_STREAM_HANDLE *phStream);
425 
436 
446 
455 
467 
491 DWORD DLLCALLCONV WDU_StreamRead(_In_ HANDLE hStream, _Outptr_ PVOID pBuffer,
492  _In_ DWORD bytes, _Outptr_ DWORD *pdwBytesRead);
493 
518 DWORD DLLCALLCONV WDU_StreamWrite(_In_ HANDLE hStream,
519  _In_ const PVOID pBuffer, _In_ DWORD bytes,
520  _Outptr_ DWORD *pdwBytesWritten);
521 
541  _Outptr_ BOOL *pfIsRunning, _Outptr_ DWORD *pdwLastError,
542  _Outptr_ DWORD *pdwBytesInBuffer);
543 
544 #ifdef __cplusplus
545 }
546 #endif
547 
548 #endif /* _WD_USB_H_ */
549 
WDU_POWER_CHANGE_CALLBACK pfPowerChange
Definition: wdu_lib.h:67
WDU_DETACH_CALLBACK pfDeviceDetach
Definition: wdu_lib.h:66
PVOID pUserData
Definition: wdu_lib.h:68
WDU_ATTACH_CALLBACK pfDeviceAttach
Definition: wdu_lib.h:65
DWORD DLLCALLCONV WDU_Init(_Outptr_ WDU_DRIVER_HANDLE *phDriver, _In_ WDU_MATCH_TABLE *pMatchTables, _In_ DWORD dwNumMatchTables, _In_ WDU_EVENT_TABLE *pEventTable, _In_ const char *pcLicense, _In_ DWORD dwOptions)
Starts listening to devices matching a criteria, and registers notification callbacks for those devic...
DWORD DLLCALLCONV WDU_TransferDefaultPipe(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD fRead, _In_ DWORD dwOptions, _In_ PVOID pBuffer, _In_ DWORD dwBufferSize, _Outptr_ PDWORD pdwBytesTransferred, _In_ PBYTE pSetupPacket, _In_ DWORD dwTimeout)
DWORD DLLCALLCONV WDU_GetLangIDs(_In_ WDU_DEVICE_HANDLE hDevice, _Outptr_ PBYTE pbNumSupportedLangIDs, _Outptr_ WDU_LANGID *pLangIDs, _In_ BYTE bNumLangIDs)
Reads a list of supported language IDs and/or the number of supported language IDs from a device.
DWORD DLLCALLCONV WDU_SetConfig(WDU_DEVICE_HANDLE hDevice, DWORD dwConfigNum)
DWORD DLLCALLCONV WDU_StreamFlush(_In_ WDU_STREAM_HANDLE hStream)
Flushes a stream, i.e writes the entire contents of the stream's data buffer to the device (relevant ...
DWORD DLLCALLCONV WDU_HaltTransfer(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwPipeNum)
Halts the transfer on the specified pipe (only one simultaneous transfer per-pipe is allowed by WinDr...
DWORD DLLCALLCONV WDU_GetStringDesc(_In_ WDU_DEVICE_HANDLE hDevice, _In_ BYTE bStrIndex, _Outptr_ PBYTE pbBuf, _In_ DWORD dwBufSize, _In_ WDU_LANGID langID, _Outptr_ PDWORD pdwDescSize)
Reads a string descriptor from a device by string index.
DWORD DLLCALLCONV WDU_TransferInterrupt(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwPipeNum, _In_ DWORD fRead, _In_ DWORD dwOptions, _In_ PVOID pBuffer, _In_ DWORD dwBufferSize, _Outptr_ PDWORD pdwBytesTransferred, _In_ DWORD dwTimeout)
WORD WDU_LANGID
Definition: wdu_lib.h:16
DWORD DLLCALLCONV WDU_SelectiveSuspend(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwOptions)
Submits a request to suspend a given device (selective suspend), or cancels a previous suspend reques...
DWORD DLLCALLCONV WDU_TransferIsoch(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwPipeNum, _In_ DWORD fRead, _In_ DWORD dwOptions, _In_ PVOID pBuffer, _In_ DWORD dwBufferSize, _Outptr_ PDWORD pdwBytesTransferred, _In_ DWORD dwTimeout)
DWORD DLLCALLCONV WDU_GetDeviceAddr(_In_ WDU_DEVICE_HANDLE hDevice, _Out_ DWORD *pAddress)
Gets USB address that the device uses.
DWORD DLLCALLCONV WDU_Transfer(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwPipeNum, _In_ DWORD fRead, _In_ DWORD dwOptions, _In_ PVOID pBuffer, _In_ DWORD dwBufferSize, _Outptr_ PDWORD pdwBytesTransferred, _In_ PBYTE pSetupPacket, _In_ DWORD dwTimeout)
Transfers data to/from a device.
DWORD DLLCALLCONV WDU_TransferBulk(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwPipeNum, _In_ DWORD fRead, _In_ DWORD dwOptions, _In_ PVOID pBuffer, _In_ DWORD dwBufferSize, _Outptr_ PDWORD pdwBytesTransferred, _In_ DWORD dwTimeout)
PVOID WDU_DRIVER_HANDLE
Definition: wdu_lib.h:12
DWORD DLLCALLCONV WDU_GetDeviceRegistryProperty(_In_ WDU_DEVICE_HANDLE hDevice, _Outptr_ PVOID pBuffer, _Inout_ PDWORD pdwSize, _In_ WD_DEVICE_REGISTRY_PROPERTY property)
Gets the specified registry property of a given device.
DWORD DLLCALLCONV WDU_StreamClose(_In_ WDU_STREAM_HANDLE hStream)
Closes an open stream.
DWORD DLLCALLCONV WDU_StreamGetStatus(_In_ WDU_STREAM_HANDLE hStream, _Outptr_ BOOL *pfIsRunning, _Outptr_ DWORD *pdwLastError, _Outptr_ DWORD *pdwBytesInBuffer)
Returns a stream's current status.
BOOL(DLLCALLCONV * WDU_ATTACH_CALLBACK)(_In_ WDU_DEVICE_HANDLE hDevice, _In_ WDU_DEVICE *pDeviceInfo, _In_ PVOID pUserData)
WinDriver calls this function with any new device that is attached, matches the given criteria,...
Definition: wdu_lib.h:35
DWORD DLLCALLCONV WDU_StreamWrite(_In_ HANDLE hStream, _In_ const PVOID pBuffer, _In_ DWORD bytes, _Outptr_ DWORD *pdwBytesWritten)
Writes data from the application to a write stream.
DWORD DLLCALLCONV WDU_GetDeviceInfo(_In_ WDU_DEVICE_HANDLE hDevice, _Outptr_ WDU_DEVICE **ppDeviceInfo)
Gets configuration information from the device including all the descriptors in a WDU_DEVICE struct.
DWORD DLLCALLCONV WDU_ResetPipe(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwPipeNum)
Resets a pipe.
BOOL(DLLCALLCONV * WDU_POWER_CHANGE_CALLBACK)(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwPowerState, _In_ PVOID pUserData)
Definition: wdu_lib.h:56
DWORD DLLCALLCONV WDU_Wakeup(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwOptions)
Enables/Disables wakeup feature.
void DLLCALLCONV WDU_Uninit(_In_ WDU_DRIVER_HANDLE hDriver)
Stops listening to devices matching the criteria, and unregisters the notification callbacks for thos...
DWORD DLLCALLCONV WDU_SetInterface(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwInterfaceNum, _In_ DWORD dwAlternateSetting)
Sets the alternate setting for the specified interface.
DWORD DLLCALLCONV WDU_StreamRead(_In_ HANDLE hStream, _Outptr_ PVOID pBuffer, _In_ DWORD bytes, _Outptr_ DWORD *pdwBytesRead)
Reads data from a read stream to the application.
DWORD DLLCALLCONV WDU_StreamStop(_In_ WDU_STREAM_HANDLE hStream)
Stops a stream, i.e stops transfers between the stream and the device.
PVOID WDU_DEVICE_HANDLE
Definition: wdu_lib.h:13
void(DLLCALLCONV * WDU_DETACH_CALLBACK)(_In_ WDU_DEVICE_HANDLE hDevice, _In_ PVOID pUserData)
WinDriver calls this function when a controlled device has been detached from the system.
Definition: wdu_lib.h:45
DWORD DLLCALLCONV WDU_StreamStart(_In_ WDU_STREAM_HANDLE hStream)
Starts a stream, i.e starts transfers between the stream and the device.
void DLLCALLCONV WDU_PutDeviceInfo(_In_ WDU_DEVICE *pDeviceInfo)
Receives a device information pointer, allocated with a previous WDU_GetDeviceInfo() call,...
DWORD DLLCALLCONV WDU_StreamOpen(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwPipeNum, _In_ DWORD dwBufferSize, _In_ DWORD dwRxSize, _In_ BOOL fBlocking, _In_ DWORD dwOptions, _In_ DWORD dwRxTxTimeout, _Outptr_ WDU_STREAM_HANDLE *phStream)
Opens a new data stream for the specified pipe.
DWORD DLLCALLCONV WDU_ResetDevice(_In_ WDU_DEVICE_HANDLE hDevice, _In_ DWORD dwOptions)
Resets a device (supported only on Windows).
PVOID WDU_STREAM_HANDLE
Definition: wdu_lib.h:14
#define _Inout_
Definition: windrvr.h:38
unsigned short int WORD
Definition: windrvr.h:333
unsigned char BYTE
Definition: windrvr.h:332
#define _Outptr_
Definition: windrvr.h:40
#define _Out_
Definition: windrvr.h:39
#define _In_
Definition: windrvr.h:37
#define DLLCALLCONV
Definition: windrvr.h:32
WD_DEVICE_REGISTRY_PROPERTY
Definition: windrvr_usb.h:321