Project JEDI - Issue Tracker - JEDI VCL
Viewing Issue Advanced Details
6652 00 JVCL Components minor always 2018-10-08 10:44 2018-10-08 10:44
new Daily / GIT  
0006652: JvHidDeviceController LoadSetupApi returns false

I have a program for a HID device using TJvHidDeviceController and the program works on most PC's but not on some machines. It turns out, that on these machines these two functions
- SetupDiInstallDeviceInterfaces
- SetupDiRegisterCoDeviceInstallers
are not available.

That means, that LoadSetupApi in JvSetupApi.pas is returning false.

These functions are not used in JvHidControllerClass.pas.

Only these 5 functions are required:
- SetupDiGetDeviceRegistryProperty
- SetupDiGetClassDevs
- SetupDiEnumDeviceInterfaces
- SetupDiGetDeviceInterfaceDetail
- SetupDiDestroyDeviceInfoList

In LoadSetupApi, more than 400 functions are dynamically linked (if case SETUPAPI_LINKONREQUEST is set) and if one fails, than the function returns FALSE.

I am wondering, if it is a good idea to use LoadSetupApi in TJvHidDeviceController. Why not write another function which is linking just the above functions?

Also, would it not be wise to have an overloaded function

function GetModuleSymbolEx(Module: TModuleHandle; SymbolName: string; var ErrorMsg: string): Pointer;

which returns in ErrorMsg the FIRST SymbolName where GetProcAddress failed?

In this case, LoadSetupApi could return, which of the more than 400 linked functions failed.

Issue History
2018-10-08 10:44 Gerold New Issue

There are no notes attached to this issue.