Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
00niels00
Code:
#include <windows.h>
#include "ZFuncs.h"
char* ChatInput( )
{
return( char* ) ( ZGetGameInterface( ) + 0x3A6 /*Or 0x3A8*/ );
}
void MyThread()
{
for(;;Sleep(20))
{
if( memcmp( ChatInput( ), "/dood", 4 ) == 0 )
{
ZCharacter::SetHP( 0 );
ZCharacter::SetAP( 0 );
}
}
}
extern "C"
{
__declspec(dllexport) BOOL __stdcall DllMain(HINSTANCE hInst,DWORD reason,LPVOID lpv)
{
DisableThreadLibraryCalls(hInst);
if (reason == DLL_PROCESS_ATTACH)
{
MessageBox(NULL, L"Injected", L"HI", MB_OK);
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&MyThread, NULL, 0, NULL); //Remember our void? "MyThread" ??
}
return true;
}
}
Ok thats the code I've now. I compiled it and injected it. But gunz just crashes how do I fix that.
I use the Zfuncs from heroin.dll.
Code:
#include <windows.h>
#include "ZFuncs.h"
char* ChatInput( )
{
return( char* ) ( ZGetGameInterface( ) + 0x3A8 );
}
void Clear( )
{
(* (char* ) ( ZGetGameInterface( ) + 0x3A8 ) ) = '\n';
}
void MyThread( )
{
for( ;;Sleep( 20 ) )
{
if( memcmp( ChatInput( ), "/dood", 4 ) == 0 )
{
ZCharacter::SetHP(0);
ZCharacter::SetAP(0);
Clear( ); //You have to clear you're last input, or you can't input another command.
}
}
}
extern "C"
{
__declspec( dllexport ) BOOL __stdcall DllMain( HINSTANCE hInst, DWORD dwReason, LPVOID lpv )
{
DisableThreadLibraryCalls( hInst );
if ( dwReason == DLL_PROCESS_ATTACH )
{
Beep( 500, 500 );
CreateThread( NULL, 0, ( LPTHREAD_START_ROUTINE )&MyThread, NULL, 0, NULL );
}
return true;
}
}
Try that.
Re: Basic tut on using C++ for GunZ
Re: Basic tut on using C++ for GunZ
Ok it still chrashes. Probaly because it tries to execute. And can't find it.
So I tought like this:
PHP Code:
#include <windows.h>
#include "ZFuncs.h"
char* ChatInput( )
{
return( char* ) ( ZGetGameInterface( ) + 0x3A8 );
}
void Clear( )
{
(* (char* ) ( ZGetGameInterface( ) + 0x3A8 ) ) = '\n';
}
void MyThread( )
{
for( ;;Sleep( 20 ) )
{
if (ZGetGameInterface!=0x0) {
if( memcmp( ChatInput( ), "/dood", 4 ) == 0 )
{
ZCharacter::SetHP(0);
ZCharacter::SetAP(0);
Clear( ); //You have to clear you're last input, or you can't input another command.
}
}
}
}
extern "C"
{
__declspec( dllexport ) BOOL __stdcall DllMain( HINSTANCE hInst, DWORD dwReason, LPVOID lpv )
{
DisableThreadLibraryCalls( hInst );
if ( dwReason == DLL_PROCESS_ATTACH )
{
Beep( 500, 500 );
CreateThread( NULL, 0, ( LPTHREAD_START_ROUTINE )&MyThread, NULL, 0, NULL );
}
return true;
}
}
But it still doesn't work.
Maybe is the handling of the ZGetGameInterface wrong
PHP Code:
DWORD ZGetGameInterface()
{
DWORD ReturnVal;
if (ZGetGameInterfaceAddress!=0x0)
{
__asm
{
MOV EAX, ZGetGameInterfaceAddress
CALL EAX
MOV ReturnVal, EAX
}
}else{
return 0x0;
}
return ReturnVal;
}
Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
00niels00
Ok it still chrashes. Probaly because it tries to execute. And can't find it.
So I tought like this:
PHP Code:
#include <windows.h>
#include "ZFuncs.h"
char* ChatInput( )
{
return( char* ) ( ZGetGameInterface( ) + 0x3A8 );
}
void Clear( )
{
(* (char* ) ( ZGetGameInterface( ) + 0x3A8 ) ) = '\n';
}
void MyThread( )
{
for( ;;Sleep( 20 ) )
{
if (ZGetGameInterface!=0x0) {
if( memcmp( ChatInput( ), "/dood", 4 ) == 0 )
{
ZCharacter::SetHP(0);
ZCharacter::SetAP(0);
Clear( ); //You have to clear you're last input, or you can't input another command.
}
}
}
}
extern "C"
{
__declspec( dllexport ) BOOL __stdcall DllMain( HINSTANCE hInst, DWORD dwReason, LPVOID lpv )
{
DisableThreadLibraryCalls( hInst );
if ( dwReason == DLL_PROCESS_ATTACH )
{
Beep( 500, 500 );
CreateThread( NULL, 0, ( LPTHREAD_START_ROUTINE )&MyThread, NULL, 0, NULL );
}
return true;
}
}
But it still doesn't work.
Maybe is the handling of the ZGetGameInterface wrong
PHP Code:
DWORD ZGetGameInterface()
{
DWORD ReturnVal;
if (ZGetGameInterfaceAddress!=0x0)
{
__asm
{
MOV EAX, ZGetGameInterfaceAddress
CALL EAX
MOV ReturnVal, EAX
}
}else{
return 0x0;
}
return ReturnVal;
}
That is the structure for pChar(), if I am correct.
I have provided the definition for ZGetGameInterface().
Code:
typedef DWORD(__cdecl *ZGetGameInterfaceType)();
ZGetGameInterfaceType ZGetGameInterface = (ZGetGameInterfaceType)0x004ABCF0;
Enjoy.
Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
Linear88
That is the structure for pChar(), if I am correct.
I have provided the definition for ZGetGameInterface().
Code:
typedef DWORD(__cdecl *ZGetGameInterfaceType)();
ZGetGameInterfaceType ZGetGameInterface = (ZGetGameInterfaceType)0x004ABCF0;
Enjoy.
No, that is ZGetGameInterface. Snail's did it straight through inline ASM. Probably the sig. searcher isn't finding the address for ZGetGameInteface.
Re: Basic tut on using C++ for GunZ
Microssoft visual c++ is the same of Hex Work Shop?
Re: Basic tut on using C++ for GunZ
Trying to translate Zchatoutput to Delphi :
C++:
Code:
typedef void(__cdecl *ZChatOutputType) (const char*, int, int, DWORD);
ZChatOutputType ZChatOutput = (ZChatOutputType)0x0042BAE0; //FAKE Address *points to jjang*
my Delphi attempt:
Code:
const
ADDRESS = $0042BAE0; // some fakeaddress
type
TZChatoutput = procedure (char : Pchar; int1 : integer; int2 :integer; MyWord:Dword);
var
GunZChat:TZChatoutput = TZChatOutput(ADDRESS);
begin
GunZChat('bounty-hunta :O',2,1,$FFFFFF);
end;
going to need the real zchatoutput to test this ..
Re: Basic tut on using C++ for GunZ
Quote:
Originally Posted by
marcoslvl
Microssoft visual c++ is the same of Hex Work Shop?
You wish. (Also, don't bump topic older than 3 weeks, I've noticed that happening: You might get infracted.)
@bounty-hunter: 0042A230
Re: Basic tut on using C++ for GunZ
Thanks linear, hope my code works xD