ReactOS
0.4.16-dev-226-g79f2289
test.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <windows.h>
3
#include <
usbdi.h
>
4
5
typedef
ULONG
NTAPI
6
(*
USBD_GetInterfaceLengthTYPE
)(
7
PUSB_INTERFACE_DESCRIPTOR
InterfaceDescriptor
,
8
PUCHAR
BufferEnd
9
);
10
11
int
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
NULL
#define NULL
Definition:
types.h:112
GetProcAddress
#define GetProcAddress(x, y)
Definition:
compat.h:753
FreeLibrary
#define FreeLibrary(x)
Definition:
compat.h:748
main
int main()
Definition:
test.c:6
USBD_GetInterfaceLengthTYPE
ULONG NTAPI(* USBD_GetInterfaceLengthTYPE)(PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor, PUCHAR BufferEnd)
Definition:
test.c:6
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
printf
#define printf
Definition:
freeldr.h:97
void
Definition:
nsiface.idl:2307
_USB_INTERFACE_DESCRIPTOR
Definition:
usb100.h:147
NTAPI
#define NTAPI
Definition:
typedefs.h:36
PUCHAR
unsigned char * PUCHAR
Definition:
typedefs.h:53
ULONG
uint32_t ULONG
Definition:
typedefs.h:59
USBD_GetInterfaceLength
ULONG NTAPI USBD_GetInterfaceLength(PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor, PUCHAR BufferEnd)
Definition:
usbd.c:414
usbdi.h
BufferEnd
_In_ PUCHAR BufferEnd
Definition:
usbdlib.h:189
InterfaceDescriptor
_In_ WDFUSBINTERFACE _In_ UCHAR _Out_ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
Definition:
wdfusb.h:2334
LoadLibraryEx
#define LoadLibraryEx
Definition:
winbase.h:3887
DONT_RESOLVE_DLL_REFERENCES
#define DONT_RESOLVE_DLL_REFERENCES
Definition:
winbase.h:366
drivers
usb
usbd
test.c
Generated on Sun Nov 3 2024 06:15:44 for ReactOS by
1.9.6