Methods

  • EnumerateUsbTree

BOOL EnumerateUsbTree(VARIANT * pContext);

Routine description:
Creates and returns USB devices enumerator. The enumerator is used to iterate USB devices.

Arguments:
pContext – USB devices enumerator

Return Value:
Returns TRUE on success.

  • GetUsbDevFromHub

BOOL GetUsbDevFromHub(VARIANT HubContext, unsigned short nIndex, VARIANT * pDevContext);

Routine description:
Gets USB device descriptor from USB hub which is used in subsequent operations with USB devices.

Arguments:
HubContext – USB hub descriptor returned by GetUsbDevFromHub method
nIndex – USB port number
pDevContext – USB device descriptor which is used in subsequent operations with USB devices

Return Value:
Returns TRUE on success.

  • UsbDevIsHub

BOOL UsbDevIsHub(VARIANT DevContext);

Routine description:
Determines whether the USB device is a USB hub.

Arguments:
DevContext – USB device descriptor returned by GetUsbDevFromHub method

Return Value:
Returns TRUE if USB device is a hub.

  • GetUsbDevName

BOOL GetUsbDevName(VARIANT DevContext, BSTR * pName);

Routine description:
Returns USB device name.

Arguments:
DevContext – USB device descriptor returned by GetUsbDevFromHub method
pName – USB device name

Return Value:
Returns TRUE on success.

  • UsbDevIsMonitored

BOOL UsbDevIsMonitored();

Routine description:
Determines whether any USB device is being monitored now.

Return Value:
Returns TRUE if any USB device is being monitored now.

  • StartMonitor

long StartMonitor(VARIANT DevContext, short pnp, short ioctl, short urb, short usbInterface);

Routine description:
Starts USB device monitoring.

Arguments:
DevContext – USB device descriptor returned by GetUsbDevFromHub method
pnp – pass 1 to catch PnP IRPs, 0 to skip
ioctl – pass 1 to catch kernel-mode and user-mode I/O control requests, 0 to skip
urb – pass 1 to catch USB Request Blocks, 0 to skip
usbInterface – pass 1 to catch USB Interface, 0 to skip

Return Value:
Returns 0 on success, or error code.

  • StopMonitor

BOOL StopMonitor();
Routine description:
Stops current USB device monitoring.

Return Value:
Returns TRUE on success.

  • IsPnp

BOOL IsPnp(VARIANT IrpSave);

Routine description:
Determines whether the IRP is PnP.

Arguments:
IrpSave – IRP descriptor passed in OnDataRecieve

Return Value:
Returns TRUE if IRP is PnP.

  • IsIoctl

BOOL IsIoctl(VARIANT IrpSave);

Routine description:
Determines whether the IRP is user-mode I/O control request.

Arguments:
IrpSave – IRP descriptor passed in OnDataRecieve

Return Value:
Returns TRUE if IRP is user-mode I/O control request.

  • IsInternalIoctl

BOOL IsInternalIoctl(VARIANT IrpSave);

Routine description:
Determines whether the IRP is kernel-mode I/O control request.

Arguments:
IrpSave – IRP descriptor passed in OnDataRecieve

Return Value:
Returns TRUE if IRP is kernel-mode I/O control request.

  • IsUrb

BOOL IsUrb(VARIANT IrpSave);

Routine description:
Determines whether the IRP is USB Request Block.

Arguments:
IrpSave – IRP descriptor passed in OnDataRecieve

Return Value:
Returns TRUE if IRP is USB Request Block.

  • IsUsbInterface

BOOL IsUsbInterface(VARIANT IrpSave);

Routine description:
Determines whether the I/O request is USB Interface.

Arguments:
IrpSave – IRP descriptor passed in OnDataRecieve

Return Value:
Returns TRUE if I/O request is USB Interface.

  • GetFunction

long GetFunction(VARIANT IrpSave);

Routine description:
Gets IRP minor function code.

Arguments:
IrpSave – IRP descriptor passed in OnDataRecieve

Return Value:
Returns function code.

  • GetDataDirection

short GetDataDirection(VARIANT IrpSave);

Routine description:
Gets data transfer direction.

Arguments:
IrpSave – IRP descriptor passed in OnDataRecieve

Return Value:
1 – in, 0 – out, -1 – error.

  • GetBuffer

BOOL GetBuffer(VARIANT IrpSave, VARIANT * pBuffer);

Routine description:
Gets data buffer from IRP descriptor.

Arguments:
IrpSave – IRP descriptor passed in OnDataRecieve
pBuffer – VARIANT that contains buffer address

Return Value:
Returns TRUE on success.

  • GetData

BOOL GetData(VARIANT IrpSave, unsigned long * pOffset, unsigned long * pSize);

Routine description:
Gets data offset in buffer and size (in bytes).

Arguments:
IrpSave – IRP descriptor passed in OnDataRecieve
pOffset – data offset in buffer returned by GetBuffer method
pSize – data size

Return Value:
Returns TRUE on success.