Jump to content

DllCall problem


Recommended Posts

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
Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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