jtwspoon Posted November 28, 2014 Posted November 28, 2014 I am trying to use dllcall to pass a variable to a dll that modifies the value of that variable. But the variable does not appear to get modified as it should. The relevant code is attached. Any help or suggestions would be appreciated. Thanks. test.au3GSLINK.ZIP
Danyfirex Posted November 28, 2014 Posted November 28, 2014 the dll? 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
Danyfirex Posted November 28, 2014 Posted November 28, 2014 Do something like this: locaL $get=10 Local $ret=DllCall("gslink.dll","none","gsupdate","int*",$get) $get=$ret[1] MsgBox(0,"",$get) use stdcall procedure gsupdate(var y: integer); stdcall; 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
jtwspoon Posted November 28, 2014 Author Posted November 28, 2014 Ok, I know I can do it that way, but I want to eventually do something more substantial --- namely altering the elements of an array passed to the dll. Are the changed values always going to have to be accessed as elements of the $ret array, as in the example you posted, and NOT from the original array as passed to the dll?
Danyfirex Posted November 28, 2014 Posted November 28, 2014 I think maybe using dllstructure. to fill the structure. 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
jtwspoon Posted November 28, 2014 Author Posted November 28, 2014 Yes, but still have to get the changed varaibles from $ret array? Also, I notice that if I try to write to a file in the dll, then return back to autoit is corrupted so that autoit fails to continue, and morevover nothing ever gets written to the file, so I am unsure exactly what is getting corrupted and how.
Danyfirex Posted November 28, 2014 Posted November 28, 2014 I mean something like this: local $t=dllstructurecreate("long mylong") dllcall("midll","none","mifuntion","ptr",dllstructuregetptr($t)) msgbox(0,"",$t.mylong) 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
jtwspoon Posted November 28, 2014 Author Posted November 28, 2014 wouldn't you have to use dllstructgetdatarather than simply $t.mylong?
Danyfirex Posted November 28, 2014 Posted November 28, 2014 not need to use dllstructgetdata just use dot(.) Access 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
jtwspoon Posted December 3, 2014 Author Posted December 3, 2014 Now I have my dll working correctly as called from autoit via DllCall, however if I attempt to write to a file from within my dll, there is no return to autoit from my dll. What could be causing this? I am sure there is no error in the code which writes to the file, and no path not found problem or anything of that sort. My Dll is written in Free Pascal, and I am running under Windows 7.
jtwspoon Posted December 3, 2014 Author Posted December 3, 2014 Also, if I run my dll as a stand-alone program, calculations differ from when I run it as a dll. In particular, some elements of a multidimensional array are not computed at all when run as a dll, while they are computed when run as a stand-alone program. I tend to infer that code within the dll gets corrupted when run as a dll from autoit. Not sure what further tests I can try to resolve this problem.
jtwspoon Posted December 3, 2014 Author Posted December 3, 2014 Previous post is incorrect. No problem with that after all. Still have problem with writing to file in dll.
funkey Posted December 3, 2014 Posted December 3, 2014 Show us your code you have so far. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
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