Ontosy Posted April 2, 2016 Share Posted April 2, 2016 (edited) I have this C code DWORD Interface() { DWORD i; HDEVINFO hDevInfo; SP_DEVINFO_DATA spDevInfoData ; hDevInfo=(HDEVINFO) SetupDiGetClassDevsW(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT); if(hDevInfo == INVALID_HANDLE_VALUE){ if(dbg) wprintf(L"error"); return FALSE; } spDevInfoData.cbSize=sizeof(SP_DEVINFO_DATA); SetupDiEnumDeviceInfo(hDevInfo, 0, &spDevInfoData); wprintf(L"Error: %d", GetLastError()); i=GetLastError(); if(i == 0) { MessageBoxW(NULL, L"WORK!", L"OK", MB_OK); }else{ MessageBoxW(NULL, L"FAIL!", L"KO", MB_OK); } return i; } when run from command line it work fine. when i use dllCall instead it return a error 6. Do you have a help for me? Edited April 9, 2016 by Ontosy Link to comment Share on other sites More sharing options...
UEZ Posted April 2, 2016 Share Posted April 2, 2016 (edited) Ontosy, with this kind of information nobody will probably be able to help you. Maybe you can provide the DLL incl. some documentation. Edited April 2, 2016 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Ontosy Posted April 3, 2016 Author Share Posted April 3, 2016 I attach full code and example: test.exe work test.dll not. example is here. Link to comment Share on other sites More sharing options...
Ontosy Posted April 3, 2016 Author Share Posted April 3, 2016 I have seen a similar problem here. Link to comment Share on other sites More sharing options...
Danyfirex Posted April 3, 2016 Share Posted April 3, 2016 I have not time to debug. but you can do all using AutoIt. expandcollapse popupGlobal Const $INVALID_HANDLE_VALUE = -1 Global Const $DIGCF_ALLCLASSES = 4 Global Const $DIGCF_PRESENT = 2 Const $tagSP_DEVICEINFO_DATA = "dword Size;byte Guid[16];dword DevInst;ulong_ptr Reserved" Local $hDevInfo = _SetupDiGetClassDevs(BitOR($DIGCF_ALLCLASSES, $DIGCF_PRESENT)) ConsoleWrite($hDevInfo & @CRLF) If $hDevInfo = $INVALID_HANDLE_VALUE Then ConsoleWrite("Invalid handle..." & @CRLF) Exit EndIf Local $tDeviceInfo = DllStructCreate($tagSP_DEVICEINFO_DATA) $tDeviceInfo.Size = DllStructGetSize($tDeviceInfo) Local $iRet= _SetupDiEnumDeviceInfo($hDevInfo, 0, $tDeviceInfo) If $iRet Then MsgBox(64,"OK","WORK") Else MsgBox(64,"FAIL","KO") EndIf Func _SetupDiGetClassDevs($iFlags) Local $iResult = DllCall("SetupAPI.dll", "ptr", "SetupDiGetClassDevsW", "ptr", Null, _ "ptr", Null, "hWnd", Null, "dword", $iFlags) Return $iResult[0] EndFunc ;==>_SetupDiGetClassDevs Func _SetupDiEnumDeviceInfo($hDevs, $iIndex, ByRef $tSP_DEVINFO_DATA) Local $pSP_DEVINFO_DATA = DllStructGetPtr($tSP_DEVINFO_DATA) Local $iResult = DllCall("SetupAPI.dll", "int", "SetupDiEnumDeviceInfo", _ "ptr", $hDevs, "int", $iIndex, "ptr", $pSP_DEVINFO_DATA) Return $iResult[0] EndFunc ;==>_SetupDiEnumDeviceInfo 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 Link to comment Share on other sites More sharing options...
Ontosy Posted April 9, 2016 Author Share Posted April 9, 2016 (edited) I have tryed to load dll from a C software and it work fine. Do it is a autoit3 bug? Edited April 9, 2016 by Ontosy Link to comment Share on other sites More sharing options...
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