Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


how comunicate with DLL injected??
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Tue Sep 09, 2008 5:47 pm    Post subject: Reply with quote

nog_lorp wrote:
YOU're an inefficient way.

Actually if the synchronicity is planned properly it shouldn't be inefficient. The threads will block while they are waiting. Unlike a window proc which loops continuously.


Your last comment didn't make sense.
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Tue Sep 09, 2008 10:37 pm    Post subject: Reply with quote

_void_ wrote:
nog_lorp wrote:
YOU're an inefficient way.

Actually if the synchronicity is planned properly it shouldn't be inefficient. The threads will block while they are waiting. Unlike a window proc which loops continuously.


Your last comment didn't make sense.


it did, i understood it.

he ments instead of making a window (UI) that will loop like a shitload and wait for hotkeys, just use conditions like he proposed (Mutex).
Back to top
View user's profile Send private message
sylvanus
Advanced Cheater
Reputation: 0

Joined: 09 May 2006
Posts: 68

PostPosted: Tue Sep 09, 2008 11:54 pm    Post subject: Reply with quote

thanks for you help,

i put this sample, it work!
example only for crc and itemvac in odinms 0.55
i use gui into dll and createthread, if you don't use createthread GUI is locked
sorry for my poor english

demotrainer.dll
Quote:


//demotrainer.cpp
// Includes, defines..
#include "windows.h"
#include "resource.h"

bool itemvac(void);
#define JMP(frm, to) (int)(((int)to - (int)frm) - 5);

static const FARPROC Vprotect = (FARPROC)((DWORD)GetProcAddress(GetModuleHandleA("kernel32.dll"), "VirtualProtectEx")+5);

_declspec(naked) BOOL WINAPI FixMem(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
{
_asm
{
mov edi,edi
push ebp
mov ebp,esp
jmp Vprotect
}
}

// Addresses
DWORD IVADDY = 0x004B44E7; // itemvac address
DWORD CRCADDY = 0x0045CDBF;
DWORD Retornar = 0;
LPVOID CRC;
BYTE MEMDUMP[0x400000];

//variables
HANDLE hThreadItemVac;
HANDLE tidItemVac;


__declspec(naked) void itemvac()
{
__asm
{
pop [Retornar]
pushad
mov ecx,[ebp+0x8]
mov ebx,[ebp-0x24]
mov [ecx],ebx
mov [ecx+0x4],eax
mov ecx,eax
mov eax,ebx
lea edx,[eax-0x19]
mov [ebp-0x34],edx
lea edx,[ecx-0x32]
add eax,0x19
add ecx,0xA
mov [ebp-0x30],edx
mov [ebp-0x2C],eax
mov [ebp-0x28],ecx
popad
push eax
push [ebp-0x24]
lea eax,[ebp-0x34]
push [Retornar]
ret
}
}

BOOL static CALLBACK DialogProc(

HWND hwndDlg, // manejador de caja de dialogo
UINT uMsg, // mensaje
WPARAM wParam, // primer parametro mensajes
LPARAM lParam // segundo parametro mensajes
)
{

switch( uMsg )
{
case WM_INITDIALOG:

hThreadItemVac = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)&ItemVac,NULL,0,&tidItemVac );
return false;
break;

case WM_CLOSE:
//UnloadMe();
return false;
break;

case WM_COMMAND:
if(wParam == IDCLOSE){
//UnloadMe();
return false;
}
if(wParam == IDC_ITEMVAC){
// YOU can use CreateThread here! for itemvac
return false;
}
if(wParam == IDC_GODMODE){
// YOU can use CreateThread here! for godmode
return false;
}

}
return FALSE;
}

DWORD static WINAPI ThreadFunc( LPVOID )
{
gameWindow = FindWindow(NULL,L"MapleStory");
HRSRC hrsrc = FindResource(GetModuleHandle(L"demotrainer.dll"), MAKEINTRESOURCE(IDD_DIALOG1), RT_DIALOG);
if( !hrsrc )
{
MessageBoxA( NULL, "Error", "Cargando Recurso", NULL );
ExitThread(0);
}
//aqui cargamos el dialogo que se encuentra dentro de este mismo dll
//como demotrainer.dll se ha injectado al proceso maplestory
// ahora lo busco y lo cargo como si fuera parte de maple
HGLOBAL hglobal = LoadResource(GetModuleHandle(L"demotrainer.dll"), hrsrc);
if( !hglobal )
{
MessageBoxA( NULL, "Error", "Cargando Recurso", NULL );
ExitThread(0);
}
LPVOID hlock = LockResource( hglobal );
if( !hlock )
{
MessageBoxA( NULL, "Error", "Cargando Recurso", NULL );
ExitThread(0);
}

if( DialogBoxIndirectParam( GetModuleHandle(L"demotrainer.dll"), (LPCDLGTEMPLATE) hglobal, NULL, DialogProc, 0 ) == -1 )
{
MessageBoxA( NULL, "NO PUEDO CREAR DIALOGO VENTANA", "NO PUEDO CREAR DIALOGO VENTANA", NULL );
}
FreeLibraryAndExitThread( GetModuleHandle( L"demotrainer.dll" ), 0 );
}

bool ItemVac(void) // Main code
{
//dump crc
CRC = VirtualAlloc(NULL, 0x00400000, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
memcpy((void *)MEMDUMP, (void *)0x00400000, 0x00400000);
memcpy((void *)CRC, (void *)MEMDUMP, 0x00400000);

CRCdelay:
MSWIN = FindWindow(L"MapleStoryClass",NULL);
if(MSWIN == 0)
{
Sleep(100);
goto CRCdelay;
}

Sleep(1000);

FixMem(GetCurrentProcess(), (void*)CRCADDY, 5, PAGE_EXECUTE_READWRITE, (DWORD*)oldprot);
*(BYTE*)CRCADDY = 0xE8;
*(DWORD*)(CRCADDY + 1) = JMP(CRCADDY, CRC_hook);


//item vac
FixMem(GetCurrentProcess(), (void*)IVADDY, 5, PAGE_EXECUTE_READWRITE, (DWORD*)oldprot);
*(BYTE*)IVADDY = 0xE8;
*(DWORD*)(IVADDY + 1) = JMP(IVADDY, itemvac);
*(DWORD*)(IVADDY + 5) = 0x90;
*(DWORD*)(IVADDY + 6) = 0x90;
return true;
}

BOOL APIENTRY DllMain(HMODULE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&ThreadFunc, 0, 0, 0); // Main thread
}
return true;
}


demotrainer.rc
Quote:

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DIALOG1 DIALOGEX 0, 0, 296, 155
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Demo Trainer"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Aceptar",IDOK,239,103,50,14
PUSHBUTTON "Cancelar",IDCANCEL,239,124,50,14
CONTROL "Auto HP",IDC_CHECK_HP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,111,40,11
CONTROL "Auto MP",IDC_CHECK_MP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,124,38,13
GROUPBOX "Auto Pociones y BOT",IDC_STATIC,16,89,213,52
EDITTEXT IDC_HP,66,110,19,12,ES_AUTOHSCROLL
EDITTEXT IDC_MP,66,125,19,12,ES_AUTOHSCROLL
LTEXT "Porcentaje(%)",IDC_STATIC,57,97,50,10
GROUPBOX "Hacks",IDC_STATIC,15,7,213,80
CONTROL "CRC Bypass",IDC_CRC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,17,57,11
CONTROL "GodMode",IDC_GODMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,34,59,13
CONTROL "Miss GodMode",IDC_MISS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,53,60,13
CONTROL "Perfect No Breath",IDC_NOBREATH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,72,77,12
CONTROL "Unlimited Attack",IDC_UNLIMITEDATTACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,133,19,66,10
CONTROL "Speed Attack",IDC_SPEEDATTACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,133,33,66,12
CONTROL "ItemVac",IDC_ITEMVAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,133,49,44,12
CONTROL "DupeXvac",IDC_DUPEXVAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,133,65,58,11
END



resources.h
Quote:

///////////////////////////////////////////////
// Microsoft Visual C++ generated include file.
// Used by demotrainer.rc
//
#define IDD_DIALOG1 101
#define IDC_CHECK_HP 1001
#define IDC_CHECK_MP 1002
#define IDC_HP 1003
#define IDC_MP 1004
#define IDC_CRC 1005
#define IDC_GODMODE 1006
#define IDC_MISS 1007
#define IDC_NOBREATH 1008
#define IDC_UNLIMITEDATTACK 1009
#define IDC_SPEEDATTACK 1010
#define IDC_ITEMVAC 1012
#define IDC_CHECK9 1013
#define IDC_DUPEXVAC 1013
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites