ZChatoutput !

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Extreme Coder - Delphi bounty-hunter is offline
    MemberRank
    Sep 2007 Join Date
    GunZone MansionLocation
    1,725Posts

    ZChatoutput !

    I attempted to do ZChatOutPut in Delphi and here is my code :
    Code:
    library ZChat;
    
    uses 
      SysUtils,
      Classes,
      Windows,
      Dialogs;
    
    //include the windows file
    
      const
      ADDRESS = $0042A230; // address for the ZChatOutPut
    
      type
      TZChatoutput = procedure (char : Pchar; int1 : integer; int2 :integer; Colour:Dword); cdecl;
    
      var
      GunZChat:TZChatoutput = TZChatOutput(ADDRESS);
    
    
    //EntryPoint for DLL
    Procedure Entrypoint( Reason :DWORD);
    begin
      if Reason = DLL_PROCESS_ATTACH then begin
      if GetAsyncKeyState(VK_MENU) <> 0  then // Check if ALT was pressed
      begin
        GunZChat('hello world from dll',2,0,$FFFFFF);
      end;
      end;
      if Reason = DLL_PROCESS_DETACH then begin
        showmessage('closed gunz');
      end;
    end;
    
    begin
    DLLProc := @EntryPoint;
      EntryPoint(DLL_PROCESS_ATTACH);
    end.
    When i inject into exe, it crashes ...
    What am i doing wrong?


  2. #2
    Programming Addict Lambda is offline
    MemberRank
    Sep 2007 Join Date
    SpainLocation
    393Posts

    Re: ZChatoutput !

    Try to change the line

    Code:
    GunZChat:TZChatoutput = TZChatOutput(ADDRESS);
    To

    Code:
    GunZChat:TZChatoutput := Pointer(ADDRESS);
    I dont know if this will work, i haven't touched delphi in years

  3. #3
    Extreme Coder - Delphi bounty-hunter is offline
    MemberRank
    Sep 2007 Join Date
    GunZone MansionLocation
    1,725Posts

    Re: ZChatoutput !

    Changed the code, now crashes after Character Selection menu

  4. #4
    Reverse Engineer ThievingSix is offline
    MemberRank
    Mar 2007 Join Date
    CaliforniaLocation
    901Posts

    Re: ZChatoutput !

    Delphi 2009? If so PChar --> PAnsiChar.

    Also, calling ZChatOutput directly never worked well in Delphi, try this:

    Code:
    procedure Echo(Output: String);
    var
      Buffer : PAnsiChar;
    begin
      If Length(Output) < 200 Then
        begin
        If @ZChatOutput <> nil Then
          begin
          Buffer := AllocMem(200);
          Try
            StrPCopy(Buffer,Output);
            ZChatOutput(Buffer,0,0,$FFFFFFFF);
          Finally
            FreeMem(Buffer);
          end;
        end;
      end;
    end;

  5. #5
    Mako is insane. ThePhailure772 is offline
    MemberRank
    Sep 2007 Join Date
    1,115Posts

    Re: ZChatoutput !

    Quote Originally Posted by ThievingSix View Post
    Delphi 2009? If so PChar --> PAnsiChar.

    Also, calling ZChatOutput directly never worked well in Delphi, try this:

    Code:
    procedure Echo(Output: String);
    var
      Buffer : PAnsiChar;
    begin
      If Length(Output) < 200 Then
        begin
        If @ZChatOutput <> nil Then
          begin
          Buffer := AllocMem(200);
          Try
            StrPCopy(Buffer,Output);
            ZChatOutput(Buffer,0,0,$FFFFFFFF);
          Finally
            FreeMem(Buffer);
          end;
        end;
      end;
    end;

    Welcome back?


    Quote Originally Posted by bounty-hunter View Post
    I attempted to do ZChatOutPut in Delphi and here is my code :
    Code:
    library ZChat;
    
    uses 
      SysUtils,
      Classes,
      Windows,
      Dialogs;
    
    //include the windows file
    
      const
      ADDRESS = $0042A230; // address for the ZChatOutPut
    
      type
      TZChatoutput = procedure (char : Pchar; int1 : integer; int2 :integer; Colour:Dword); cdecl;
    
      var
      GunZChat:TZChatoutput = TZChatOutput(ADDRESS);
    
    
    //EntryPoint for DLL
    Procedure Entrypoint( Reason :DWORD);
    begin
      if Reason = DLL_PROCESS_ATTACH then begin
      if GetAsyncKeyState(VK_MENU) <> 0  then // Check if ALT was pressed
      begin
        GunZChat('hello world from dll',2,0,$FFFFFF);
      end;
      end;
      if Reason = DLL_PROCESS_DETACH then begin
        showmessage('closed gunz');
      end;
    end;
    
    begin
    DLLProc := @EntryPoint;
      EntryPoint(DLL_PROCESS_ATTACH);
    end.
    When i inject into exe, it crashes ...
    What am i doing wrong?
    Client version?

  6. #6
    Reverse Engineer ThievingSix is offline
    MemberRank
    Mar 2007 Join Date
    CaliforniaLocation
    901Posts

    Re: ZChatoutput !

    I was bored T.T

  7. #7
    Sharing is caring KillerStefan is offline
    MemberRank
    Feb 2007 Join Date
    NetherlandsLocation
    2,554Posts

    Re: ZChatoutput !

    Funny how you have troubles with this when you call it a "simple edit" here: http://forum.ragezone.com/f579/kille...2/#post5461252
    Last edited by KillerStefan; 24-02-10 at 02:11 AM.

  8. #8
    Sultan of Yolo Demantor is offline
    MemberRank
    May 2008 Join Date
    GermanyLocation
    1,266Posts

    Re: ZChatoutput !

    Some Runnables have the address ZChatoutput edited, if you tried to output a string it will crash so.

  9. #9
    Extreme Coder - Delphi bounty-hunter is offline
    MemberRank
    Sep 2007 Join Date
    GunZone MansionLocation
    1,725Posts

    Re: ZChatoutput !

    Quote Originally Posted by KillerStefan View Post
    Funny how you have troubles with this when you call it a "simple edit" here: http://forum.ragezone.com/f579/kille...2/#post5461252
    I Assumed it was a simple edit, guess its my badd :P

    @Phail : its xaios runnable :S
    Last edited by KillerStefan; 24-02-10 at 02:11 AM.

  10. #10
    Mako is insane. ThePhailure772 is offline
    MemberRank
    Sep 2007 Join Date
    1,115Posts

    Re: ZChatoutput !

    Why not make a thread on that DLL btw?

  11. #11
    Extreme Coder - Delphi bounty-hunter is offline
    MemberRank
    Sep 2007 Join Date
    GunZone MansionLocation
    1,725Posts

    Re: ZChatoutput !

    @ Phail here is the code with the Thread :
    Code:
     library ZChat;
    
    uses
      SysUtils,
      Classes,
      Windows,
      Dialogs;
    
    //include the windows file
    
      const
      ADDRESS = $0042A230; // address for the ZChatOutPut
    
      type
      TZChatoutput = procedure (char : Pchar; int1 : integer; int2 :integer; Colour:Dword); cdecl;
    
      var
      GunZChat:TZChatoutput = Pointer(ADDRESS);
      C:Cardinal;
      //Our Chat Display
      Procedure DisplayChat();
      begin
      if GetAsyncKeyState(VK_MENU) = 1 then
      begin
        GunZChat('Sup',2,0,$FFFFFF);
        sleep(250);
      end;
      end;
    
    //EntryPoint for DLL
    Procedure Entrypoint( Reason :DWORD);
    begin
      if Reason = DLL_PROCESS_ATTACH then begin
      CreateThread(nil,0,@DisplayChat,nil,0,C);
      end;
    end;
    
    begin
    DLLProc := @EntryPoint;
      EntryPoint(DLL_PROCESS_ATTACH);
    end.
    Did i do the thread right? atm the server is offline so i cant test >_<

  12. #12
    Reverse Engineer ThievingSix is offline
    MemberRank
    Mar 2007 Join Date
    CaliforniaLocation
    901Posts

    Re: ZChatoutput !

    Sigh:

    First, Jacob is correct you need to create a thread. Your original way will just crash Gunz.

    Second, Jacob doesn't know Delphi(no offense). You have to use BeginThread() not CreateThread() or use TThread object.

    Correct example(no I didn't test this):
    Code:
    library ZChat;
    
    uses 
      SysUtils,
      Classes,
      Windows;
    
    //include the windows file
    const
      ADDRESS = $0042A230; // address for the ZChatOutPut
    type
      TZChatoutput = procedure (char : Pchar; int1 : integer; int2 :integer; Colour:Dword); cdecl;
    var
      ZChatOutput : TZChatoutput = TZChatOutput(ADDRESS);
      ThreadID : Integer;
      
    procedure Echo(Output: String);
    var
      Buffer : PAnsiChar;
    begin
      If Length(Output) < 200 Then
        begin
        If @ZChatOutput <> nil Then
          begin
          Buffer := AllocMem(200);
          Try
            StrPCopy(Buffer,Output);
            ZChatOutput(Buffer,0,0,$FFFFFFFF);
          Finally
            FreeMem(Buffer);
          end;
        end;
      end;
    end;
    
      
    function ChatThread(Data: Pointer): Integer;
    begin
      Result := 0;
      While True Do
        begin
        If GetAsyncKeyState(VK_MENU) <> 0  then // Check if ALT was pressed
          begin
          Echo('hello world from dll');
        end;
        Sleep(10);
      end;
    end;
    
    //EntryPoint for DLL
    Procedure Entrypoint( Reason :DWORD);
    var
      ID1 : DWORD;
    begin
      if Reason = DLL_PROCESS_ATTACH then begin
        ThreadID := BeginThread(nil,0,@ChatThread,nil,0,ID1);
      end;
      if Reason = DLL_PROCESS_DETACH then begin
        TerminateThread(ThreadID,0);
        CloseHandle(ThreadID);
      end;
    end;
    
    begin
      DLLProc := @EntryPoint;
      EntryPoint(DLL_PROCESS_ATTACH);
    end.

  13. #13
    Extreme Coder - Delphi bounty-hunter is offline
    MemberRank
    Sep 2007 Join Date
    GunZone MansionLocation
    1,725Posts

    Re: ZChatoutput !

    Quote Originally Posted by ThievingSix View Post
    Delphi 2009? If so PChar --> PAnsiChar.

    Also, calling ZChatOutput directly never worked well in Delphi, try this:

    Code:
    procedure Echo(Output: String);
    var
      Buffer : PAnsiChar;
    begin
      If Length(Output) < 200 Then
        begin
        If @ZChatOutput <> nil Then
          begin
          Buffer := AllocMem(200);
          Try
            StrPCopy(Buffer,Output);
            ZChatOutput(Buffer,0,0,$FFFFFFFF);
          Finally
            FreeMem(Buffer);
          end;
        end;
      end;
    end;
    Can u explain the above code?

    Length(output) gets the length of the string
    but what does @zchatoutput do?
    and the rest i sort of understand ...
    Last edited by bounty-hunter; 20-02-10 at 03:12 AM.

  14. #14
    Account Upgraded | Title Enabled! PenguinGuys is offline
    MemberRank
    Sep 2009 Join Date
    AlabamaLocation
    261Posts

    Re: ZChatoutput !

    Quote Originally Posted by ThievingSix View Post
    Sigh:

    First, Jacob is correct you need to create a thread. Your original way will just crash Gunz.

    Second, Jacob doesn't know Delphi(no offense). You have to use BeginThread() not CreateThread() or use TThread object.

    Correct example(no I didn't test this):
    Code:
    library ZChat;
    
    uses 
      SysUtils,
      Classes,
      Windows;
    
    //include the windows file
    const
      ADDRESS = $0042A230; // address for the ZChatOutPut
    type
      TZChatoutput = procedure (char : Pchar; int1 : integer; int2 :integer; Colour:Dword); cdecl;
    var
      ZChatOutput : TZChatoutput = TZChatOutput(ADDRESS);
      ThreadID : Integer;
      
    procedure Echo(Output: String);
    var
      Buffer : PAnsiChar;
    begin
      If Length(Output) < 200 Then
        begin
        If @ZChatOutput <> nil Then
          begin
          Buffer := AllocMem(200);
          Try
            StrPCopy(Buffer,Output);
            ZChatOutput(Buffer,0,0,$FFFFFFFF);
          Finally
            FreeMem(Buffer);
          end;
        end;
      end;
    end;
    
      
    function ChatThread(Data: Pointer): Integer;
    begin
      Result := 0;
      While True Do
        begin
        If GetAsyncKeyState(VK_MENU) <> 0  then // Check if ALT was pressed
          begin
          Echo('hello world from dll');
        end;
        Sleep(10);
      end;
    end;
    
    //EntryPoint for DLL
    Procedure Entrypoint( Reason :DWORD);
    var
      ID1 : DWORD;
    begin
      if Reason = DLL_PROCESS_ATTACH then begin
        ThreadID := BeginThread(nil,0,@ChatThread,nil,0,ID1);
      end;
      if Reason = DLL_PROCESS_DETACH then begin
        TerminateThread(ThreadID,0);
        CloseHandle(ThreadID);
      end;
    end;
    
    begin
      DLLProc := @EntryPoint;
      EntryPoint(DLL_PROCESS_ATTACH);
    end.
    Quote Originally Posted by bounty-hunter View Post
    Can u explain the above code?

    Length(output) gets the length of the string
    but what does @zchatoutput do?
    and the rest i sort of understand ...
    It's a conditional statement...
    http://www.delphibasics.co.uk/RTL.asp?Name=Nil

    I don't know jack-shit about Delphi, but looks like it's checking to see if
    ZChatOutput is a pointer OR making ZChatOutput into a pointer?
    Let me know if I'm just talking gibberish.
    Last edited by PenguinGuys; 20-02-10 at 04:18 AM.

  15. #15
    Account Upgraded | Title Enabled! cerealnp is offline
    MemberRank
    Apr 2006 Join Date
    BrazilLocation
    441Posts

    Re: ZChatoutput !

    I don't know delphi too, but it looks like some kinda check to see if the pointer has been set correctly.



Page 1 of 2 12 LastLast

Advertisement