2005-07-31 12:11:56 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <windows.h>
|
2005-12-01 21:37:19 +00:00
|
|
|
#include <usbdi.h>
|
2005-07-31 12:11:56 +00:00
|
|
|
|
2008-11-30 11:16:55 +00:00
|
|
|
typedef ULONG NTAPI
|
2005-07-31 12:11:56 +00:00
|
|
|
(*USBD_GetInterfaceLengthTYPE)(
|
|
|
|
PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor,
|
|
|
|
PUCHAR BufferEnd
|
|
|
|
);
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
HMODULE Lib;
|
|
|
|
USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
|
|
|
|
USBD_GetInterfaceLengthTYPE USBD_GetInterfaceLength;
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
InterfaceDescriptor.bLength = 10;
|
|
|
|
InterfaceDescriptor.bNumEndpoints = 2;
|
2005-07-31 12:11:56 +00:00
|
|
|
InterfaceDescriptor.bDescriptorType = /*USB_INTERFACE_DESCRIPTOR_TYPE*/2;
|
|
|
|
InterfaceDescriptor.iInterface = 0x1;
|
|
|
|
|
|
|
|
Lib = LoadLibraryEx("usbd.sys", NULL, DONT_RESOLVE_DLL_REFERENCES);
|
|
|
|
USBD_GetInterfaceLength = (USBD_GetInterfaceLengthTYPE)GetProcAddress(Lib, "USBD_GetInterfaceLength");
|
|
|
|
printf("%X\n", USBD_GetInterfaceLength(&InterfaceDescriptor, (PUCHAR)((DWORD)&InterfaceDescriptor + sizeof(InterfaceDescriptor))));
|
|
|
|
FreeLibrary(Lib);
|
|
|
|
|
|
|
|
Lib = LoadLibraryEx("usbd.ms", NULL, DONT_RESOLVE_DLL_REFERENCES);
|
|
|
|
USBD_GetInterfaceLength = (USBD_GetInterfaceLengthTYPE)GetProcAddress(Lib, "USBD_GetInterfaceLength");
|
|
|
|
printf("%X\n", USBD_GetInterfaceLength(&InterfaceDescriptor, (PUCHAR)((DWORD)&InterfaceDescriptor + sizeof(InterfaceDescriptor))));
|
|
|
|
FreeLibrary(Lib);
|
|
|
|
return 0;
|
|
|
|
}
|
2007-10-19 23:21:45 +00:00
|
|
|
|