#include "usb.h"
// Function pointers in same order(!) as entry names below
struct usb usb;
// A very compact form to load DLL entries:
const char libusbEntries[]=
"libusb0.dll\0" // ASCII only, UTF-8 not supported (as nobody needs it here)
"usb_init\0"
"usb_find_busses\0"
"usb_find_devices\0"
"usb_get_busses\0"
"usb_open\0"
"usb_close\0"
"usb_control_msg\0"
"usb_set_configuration\0"
"usb_claim_interface\0"
"usb_release_interface\0";
// C++ appends a second '\0'. This will mark end-of-list.
// Load DLL and get all function pointers
bool _fastcall dynaprocs::dynaload(const char*e) {
int i;
if (!(hLib=LoadLibraryA(e))) return false;
for (i=0;;i++) {
e+=lstrlenA(e)+1;
if (!*e) return true; // Ende erreicht
if (!(proc[i]=GetProcAddress(hLib,e))) return false;
}
}
Vorgefundene Kodierung: ASCII (7 bit) | 2
|