aquila Posted June 11, 2009 Share Posted June 11, 2009 (edited) Hello, I have an exe file where I can watch the functions with Dependency Walker. Am I able to use this functions with dllcall or something like that? If yes, are there any examples? Maybe a crap question but At dll its the same so why not calling an exe file, lol. Edited June 11, 2009 by aquila Link to comment Share on other sites More sharing options...
Skruge Posted June 11, 2009 Share Posted June 11, 2009 Check the help file and the forums for examples on how to use DllCall. For information on the particular DLL you're using, you'd have to check with the vendor/developer. [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
aquila Posted June 16, 2009 Author Share Posted June 16, 2009 (edited) I tried some crap and now i have this: $dll = DllOpen("kernel32.dll") $a = DllCall($dll, "ptr", "LoadLibrary", "str", "C:\Test\test.exe") $b = DllCall($dll, "ptr", "GetProcAddress", "ptr", $a[0], "str", "SomeFunction") $c = DllCall($dll, "none:cdecl", $b[0], "str", "test test") MsgBox(0, "", $c) The exe is an c++ exe from a friend and has only one parameter with "str", showing a MsgBox. But this doesn't work. Any ideas from the Dll pro's ? I think the 3rd dllcall is completely incorrect, but i don't know what to change Hm, so noone any idea? Edited June 16, 2009 by aquila Link to comment Share on other sites More sharing options...
aquila Posted June 16, 2009 Author Share Posted June 16, 2009 Guys, I need really a lil help, so if someone knows something about this, tell me. I thank to every answer! Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 16, 2009 Share Posted June 16, 2009 (edited) As far as I know, AutoIt does not have a way to call function pointers. You could instead call the function yourself. DllCall("test.exe", "none:cdecl", "SomeFunction", "str", "test test") Edited June 16, 2009 by Richard Robertson Link to comment Share on other sites More sharing options...
aquila Posted June 16, 2009 Author Share Posted June 16, 2009 (edited) Thx 4 answer! Yes, I also thought about that. It's crashing. I have the same function in my test.dll. There is it working with that call. So i started to use google with 'call function in exe' and i get some scripts in c++/vb/delphi/whatever with dllcalls of LoadLibrary and GetProcAddress. That's why I try this. I think the first 2 calls are correct. But I don't now the third, calling the function Edited June 16, 2009 by aquila Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 16, 2009 Share Posted June 16, 2009 (edited) You can't. I'm not sure why AutoIt is failing. What error was provided? Edited June 16, 2009 by Richard Robertson Link to comment Share on other sites More sharing options...
aquila Posted June 16, 2009 Author Share Posted June 16, 2009 AutoIT3.exe ended.rc:-1073741819 Link to comment Share on other sites More sharing options...
aquila Posted June 17, 2009 Author Share Posted June 17, 2009 So anyone knows, if I call LoadLibrary and GetProcAddress, how the 3rd. Call has to look? I have no idea what to add at the DllName and Function name? Function name = return of GetProcAddress? Link to comment Share on other sites More sharing options...
ProgAndy Posted June 17, 2009 Share Posted June 17, 2009 (edited) First try to use DLLcall in stdcall mode, so remove :cdecl //Edit: Are you sure it has no return value? Try also dword or ptr instead of none //Edit2: You could also add DLLOpen and check what happens then. Edited June 17, 2009 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
aquila Posted June 17, 2009 Author Share Posted June 17, 2009 I tried. I added now an archive with the files. Maybe you can take a look inside.Test.rar Link to comment Share on other sites More sharing options...
ProgAndy Posted June 17, 2009 Share Posted June 17, 2009 (edited) OK, should be a bug in DLLCall. Although MemoryDLLCall uses this func, too, it works. Strange...The UDF can be found here: http://www.autoitscript.com/forum/index.php?showtopic=77463#include <MemoryDLL.au3> ... MemoryFuncCall("none:cdecl", $b[0], "str", "Test")//Edit: NO, sorry, this code also crashes when using the exe instead of the dll. Edited June 17, 2009 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
trancexx Posted June 17, 2009 Share Posted June 17, 2009 Something is wrong, that's for sure.All looks fine but still crashes. I can see two possible problems. First one is the issue with DllMain, but that is highly unlikely.Second problem could be the entry point to the app. I don't know how your code looks but as I can see (using my supernatural abilities - yeah right ) you are actually calling SomeFunction to show "Nachricht aus der EXE" message. Rewrite the code to avoid that and try then.This all could be just a bunch of... nothing. But do try. It's interesting. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
aquila Posted June 17, 2009 Author Share Posted June 17, 2009 Second problem could be the entry point to the app. Hm, $b[0] is always 0x020A12F0, when I take a look with Dependency Walker, it's 0x000012F0, so. Must this two values be the same? Link to comment Share on other sites More sharing options...
trancexx Posted June 17, 2009 Share Posted June 17, 2009 No. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
aquila Posted June 18, 2009 Author Share Posted June 18, 2009 This "The Nachricht aus der EXE" appears cause the exe is calling the function with that parameter as string. I did this because i don't want an empty exe file with funcs only, I want to call a function of an exe file which can do also other things. So just call this function, and use it (Showing the messagebox or get a return) You understand? Link to comment Share on other sites More sharing options...
trancexx Posted June 18, 2009 Share Posted June 18, 2009 This "The Nachricht aus der EXE" appears cause the exe is calling the function with that parameter as string. I did this because i don't want an empty exe file with funcs only, I want to call a function of an exe file which can do also other things. So just call this function, and use it (Showing the messagebox or get a return) You understand?My understanding of your actions is irrelevant. <- scared a bit? I'm kidding. Did you try like I said? Btw, this I find interesting... Can you run this code (or somebody else): DllCall("netsh.exe", "dword:cdecl", "PrintMessage", "wstr", "Something to print") ConsoleWrite(@CRLF) $a_hCall = DllCall("kernel32.dll", "hwnd", "LoadLibraryExW", "wstr", @AutoItExe, "hwnd", 0, "int", 34) $hModule = $a_hCall[0] $a_iCall = DllCall("netsh.exe", "dword:cdecl", "PrintMessageFromModule", "hwnd", $hModule, "dword", 166) $a_iCall = DllCall("netsh.exe", "dword:cdecl", "PrintMessage", "wstr", @CRLF) It fails with system I'm currently running (XP SP3), but works for another instalation of the same system (again XP SP3). Fails with Vista and Vista SP1. Strange I tell you. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
aquila Posted June 18, 2009 Author Share Posted June 18, 2009 Hehe . Had no time to test it, the dll & exe is from a friend and he wasn't online since yesterday. Unfortunately, the Code is crashing. Using XP Sp2. 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