H5O2OH Posted June 24, 2008 Posted June 24, 2008 (edited) This is a part of the source in the dll expandcollapse popupuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; {$R *.res} const basepointer:DWORD=$CEBB4C; CurrentHP:DWORD=$450; function GetBasePointer:DWORD; begin Result:=basepointer; end; function GetCurrentHP(wnd:HWND):DWORD stdcall; var ProcessId : integer; HandleWindow : Cardinal; baseadress,erg:DWord; BytesRead : Cardinal; begin if wnd <> 0 then begin GetWindowThreadProcessId(wnd,@ProcessId); HandleWindow := OpenProcess(PROCESS_VM_READ,False,ProcessId); ReadProcessMemory(HandleWindow, Pointer(basepointer),@baseAdress, Sizeof(DWord) ,BytesRead ); ReadProcessMemory(HandleWindow,Pointer(baseadress+CurrentHP),@erg, Sizeof(DWord) ,BytesRead ); end; Result:=erg; And my script end; $result = DllCall("Mydll.dll", "int", "GetCurrentHP") IF @error Then Msgbox(0,"Error!",@error) exit EndIf msgbox(0, "", $result) In the end - @error is 3. Edited June 24, 2008 by H5O2OH
FreeFry Posted June 24, 2008 Posted June 24, 2008 If reading the memory of some application is all that you want to do(with your dll), then you should know that reading memory can be done with pure autoit alone(no need for the dll).
Siao Posted June 24, 2008 Posted June 24, 2008 In the end - @error is 3. And that doesn't tell you anything?GetCurrentHP isn't exported. What language is this, Delphi? There should be some "export" keyword to be used in func declaration... "be smart, drink your wine"
H5O2OH Posted June 24, 2008 Author Posted June 24, 2008 (edited) FreeFry, I know,but can't i use the dll as a plugin? Siao,yeah pure delphi,could you help me a with that keyword? Edited June 24, 2008 by H5O2OH
FreeFry Posted June 24, 2008 Posted June 24, 2008 FreeFry, I know,but can't i use the dll as a plugin?Siao,yeah pure delphi,could you help me a with that keyword?If you follow Siao's advice yes, but why use a DLL, when you can do it solely in AutoIt itself?
H5O2OH Posted June 25, 2008 Author Posted June 25, 2008 (edited) Okay,so could you guys help me with that export "keyword"? In the end the integer will be placed in erg (Result:=erg;) How can i make it call that function and export that function? Edited June 25, 2008 by H5O2OH
Siao Posted June 25, 2008 Posted June 25, 2008 I'm not familiar with Delphi, but it could be something like... function GetCurrentHP(wnd:HWND):DWORD stdcall; export; Geez, just read some delphi help on how to make proper usable DLLs. "be smart, drink your wine"
H5O2OH Posted June 25, 2008 Author Posted June 25, 2008 That's how it is in delphi function GetCurrentHP(wnd:HWND):DWORD;stdcall;external 'MyDll.dll'; How to do it in au3? >.>
Siao Posted June 25, 2008 Posted June 25, 2008 You don't get it. It's not AutoIt problem at all. It's how you build your DLL in Delphi.Just digest this:http://en.wikipedia.org/wiki/Dynamic-link_library#Delphi "be smart, drink your wine"
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