moooe Posted November 24, 2021 Posted November 24, 2021 There is an API for hardware, which is implemented through Lusbapi.dll In the C ++ reference it looks like this: 1) if (GetDllVersion() != 2) { printf("error 1"); } 2) pModule = static_cast<ILE440 *>(CreateInstance("e440")); if (pModule == NULL) { printf("error 2"); } 3) if (!pModule->GetModuleName()) { printf("error 3"); } For AutoIt I rewrote: $hDLL = DllOpen('Lusbapi.dll') 1) $aRes = DllCall($hDLL, 'LRESULT', 'GetDllVersion') if $aRes[0] <> 2 then Exit 2) $tDeviceName = DllStructCreate("char DeviceName[9]") DllStructSetData($tDeviceName, "DeviceName", 'e440') $aRes = DllCall($hDLL, 'PTR', 'CreateLInstance', 'STRUCT*', $tDeviceName) $pModule = $aRes[0] if $pModule == Null then Exit 3) At this step, the error $aRes = DllCall($hDLL, 'PTR', 'GetModuleName') The function GetModuleName was not found (since this is a method from the CreateLInstance function), I could not implement a call to the method
Danyfirex Posted November 25, 2021 Posted November 25, 2021 Hello. this should work. Local $sDeviceName="e440" Local $aCall = DllCall($hDLL, 'dword', 'CreateLInstance', 'str', $sDeviceName) Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
moooe Posted November 29, 2021 Author Posted November 29, 2021 @Danyfirex function CreateLlnstance is work, problem with GetModuleName
junkew Posted November 29, 2021 Posted November 29, 2021 So part of your include lusbapi.h has some struct constructs where the pointer reference is to the function extern "C" DWORD WINAPI GetDllVersion(void); extern "C" LPVOID WINAPI CreateLInstance(PCHAR const DeviceName); enum { USB11_LUSBAPI, USB20_LUSBAPI, INVALID_USB_SPEED_LUSBAPI }; enum { NO_MODULE_MODIFICATION_LUSBAPI = -1 }; const WORD MAX_VIRTUAL_SLOTS_QUANTITY_LUSBAPI = 127; // ========================================================================== // *************************** L-Card USB BASE ****************************** // ========================================================================== struct ILUSBBASE { virtual BOOL WINAPI OpenLDevice(WORD VirtualSlot) = 0; virtual BOOL WINAPI CloseLDevice(void) = 0; virtual BOOL WINAPI ReleaseLInstance(void) = 0; virtual HANDLE WINAPI GetModuleHandle(void) = 0; virtual BOOL WINAPI GetModuleName(PCHAR const ModuleName) = 0; virtual BOOL WINAPI GetUsbSpeed(BYTE* const UsbSpeed) = 0; virtual BOOL WINAPI LowPowerMode(BOOL LowPowerFlag) = 0; virtual BOOL WINAPI GetLastErrorInfo(LAST_ERROR_INFO_LUSBAPI* const LastErrorInfo) = 0; }; struct ILE140 : public ILUSBBASE { virtual BOOL WINAPI GET_ADC_PARS(ADC_PARS_E140* const AdcPars) = 0; virtual BOOL WINAPI SET_ADC_PARS(ADC_PARS_E140* const AdcPars) = 0; virtual BOOL WINAPI START_ADC(void) = 0; ... For that to work you probably need https://www.autoitscript.com/autoit3/docs/functions/DllCallAddress.htm maybe with objcreateinterface (but as it looks plain c probably not) Danyfirex 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Danyfirex Posted November 29, 2021 Posted November 29, 2021 You need to do something like this. Local $tFunctions = DllStructCreate("ptr[" $iNumberOfFunctions "]", $pModule) DllCallAddress("none", DllStructGetData($tFunctions,1, 4)) ;GetModuleHandle Saludos junkew 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now