Reactos
at master 33 lines 1.2 kB view raw
1#include <stdio.h> 2#include <windows.h> 3#include <usbdi.h> 4 5typedef ULONG NTAPI 6(*USBD_GetInterfaceLengthTYPE)( 7 PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor, 8 PUCHAR BufferEnd 9 ); 10 11int main() 12{ 13 HMODULE Lib; 14 USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; 15 USBD_GetInterfaceLengthTYPE USBD_GetInterfaceLength; 16 17 InterfaceDescriptor.bLength = 10; 18 InterfaceDescriptor.bNumEndpoints = 2; 19 InterfaceDescriptor.bDescriptorType = /*USB_INTERFACE_DESCRIPTOR_TYPE*/2; 20 InterfaceDescriptor.iInterface = 0x1; 21 22 Lib = LoadLibraryEx("usbd.sys", NULL, DONT_RESOLVE_DLL_REFERENCES); 23 USBD_GetInterfaceLength = (USBD_GetInterfaceLengthTYPE)GetProcAddress(Lib, "USBD_GetInterfaceLength"); 24 printf("%X\n", USBD_GetInterfaceLength(&InterfaceDescriptor, (PUCHAR)((DWORD)&InterfaceDescriptor + sizeof(InterfaceDescriptor)))); 25 FreeLibrary(Lib); 26 27 Lib = LoadLibraryEx("usbd.ms", NULL, DONT_RESOLVE_DLL_REFERENCES); 28 USBD_GetInterfaceLength = (USBD_GetInterfaceLengthTYPE)GetProcAddress(Lib, "USBD_GetInterfaceLength"); 29 printf("%X\n", USBD_GetInterfaceLength(&InterfaceDescriptor, (PUCHAR)((DWORD)&InterfaceDescriptor + sizeof(InterfaceDescriptor)))); 30 FreeLibrary(Lib); 31 return 0; 32} 33