Jump to content

Recommended Posts

Posted (edited)

This is a part of the source in the dll

uses
  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 by H5O2OH
Posted

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).

Posted

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"

Posted (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 by H5O2OH
Posted

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? :)
Posted (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 by H5O2OH
Posted

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"

Posted

That's how it is in delphi

function GetCurrentHP(wnd:HWND):DWORD;stdcall;external 'MyDll.dll';

How to do it in au3? >.>

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...