 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Sat Sep 27, 2008 9:59 am Post subject: |
|
|
| TraxMate wrote: | | Hmm.. I use the express edition do you think that's why I'm getting the error? :O |
no. Express is just fine.
_________________
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Sat Sep 27, 2008 10:20 am Post subject: |
|
|
| kitterz wrote: | | TraxMate wrote: | | Hmm.. I use the express edition do you think that's why I'm getting the error? :O |
no. Express is just fine. | k. When you said try to debug it to se where the error is I. There is no error it's just that it it's not injecting the dll.. and I can't use your code cuz of that stupid error :/.
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Sat Sep 27, 2008 10:30 am Post subject: |
|
|
| TraxMate wrote: | | kitterz wrote: | | TraxMate wrote: | | Hmm.. I use the express edition do you think that's why I'm getting the error? :O |
no. Express is just fine. | k. When you said try to debug it to se where the error is I. There is no error it's just that it it's not injecting the dll.. and I can't use your code cuz of that stupid error :/. |
As I said before...make error checks to see if, say WriteProcessMemory failed or not, like I did.
And if it gives you and error, take it out...
| Code: | //Inject a Dll into process
int InjectDll(DWORD dwPid, char *Name)
{
HANDLE hProc;
DWORD dwMemSize, dwWritten, dwThreadId;
FARPROC hLoadLibrary;
LPVOID hRemoteMem;
char cDllPath [260];
cDllPath = Name;
hProc = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_CREATE_THREAD, FALSE, dwPid);
if(hProc != NULL){
dwMemSize = strlen(cDllPath);
hLoadLibrary = GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA");
if(hLoadLibrary != NULL){
hRemoteMem = VirtualAllocEx(hProc, NULL, dwMemSize, MEM_COMMIT, PAGE_READWRITE);
if(hRemoteMem != NULL){
if(WriteProcessMemory(hProc, hRemoteMem, (LPVOID)cDllPath, dwMemSize, &dwWritten)){
if(CreateRemoteThread(hProc, NULL, 0, (LPTHREAD_START_ROUTINE)hLoadLibrary, hRemoteMem, 0, &dwThreadId) != NULL){
CloseHandle (hProc);
return 0;
}
}
}
}
}
CloseHandle (hProc);
return 1;
} |
_________________
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat Sep 27, 2008 10:58 am Post subject: |
|
|
It seems you are injecting after you find the window of MapleStory ? Not sure if I am right saying that since I'm still pretty newb at C. But if yes, then you should not be doing that. Your WPM will not work at that point because GG has already loaded then. The time to inject is between when Maple's process is loaded but before GG has loaded. That means watch for Maple's process not window and inject once you see the process.
Last edited by Slugsnack on Sat Sep 27, 2008 11:10 am; edited 1 time in total |
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Sat Sep 27, 2008 10:59 am Post subject: |
|
|
| Code: | #include <windows.h>
#include <tchar.h>
#include <iostream>
using namespace std;
DWORD GetPID()
{
HWND MapleWnd;
DWORD MapleID;
DWORD PID;
// Get maples window
MapleWnd = FindWindow(NULL, _T("MapleStory"));
if(!MapleWnd)
return 0;
// Get maple id
MapleID = GetWindowThreadProcessId(MapleWnd, &PID);
if(!PID)
return 0;
return PID;
}
BOOL InjectDll(DWORD pID, char *DllName)
{
HANDLE hProcess;
LPVOID RemoteString;
DWORD MemSize, Written, ThreadId;
FARPROC hLoadLibrary;
char DllPath[260];
GetCurrentDirectoryA(260, DllPath);
strcat_s(DllPath, "\\");
strcat_s(DllPath, DllName);
if(!pID)
{
MessageBox(NULL, _T("Failed to retrieve the process id."), _T("pID error"), MB_OK);
return 0;
}
hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_CREATE_THREAD, FALSE, pID);
if(!hProcess)
{
MessageBox(NULL, _T("Dll injection failed :("), _T("Error!"), MB_OK);
return 0;
}
if(hProcess != NULL)
{
MemSize = strlen(DllPath);
hLoadLibrary = GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "LoadLibraryA");
if(hLoadLibrary != NULL)
{
RemoteString = VirtualAllocEx(hProcess, NULL, MemSize, MEM_COMMIT, PAGE_READWRITE);
if(RemoteString != NULL)
{
if(WriteProcessMemory(hProcess, RemoteString, (LPVOID)DllPath, MemSize, &Written))
{
if(CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)hLoadLibrary, RemoteString, 0, &ThreadId) != NULL)
{
CloseHandle(hProcess);
return 0;
}
}
}
}
}
CloseHandle(hProcess);
return 1;
}
int main()
{
// Title
SetConsoleTitle(_T("My Dll Injector"));
cout << "///////////////////////////////////////////////////////////////////////////////" << endl;
cout << "// TraxMate's Dll Injector //" << endl;
cout << "///////////////////////////////////////////////////////////////////////////////" << endl << endl;
cout << "Waiting for MapleStory...";
// While waiting for Maple it sends "."
while(!FindWindow(NULL, _T("MapleStory")))
{
cout << ".";
Sleep(85);
}
InjectDll(GetPID(), "Test.dll");
cout << endl << "Dll injected.";
cin.sync();
cin.ignore();
return 0;
} | I remaked the InjectDll() by following what you did but it still don't inject the dll O.o. Yes the dll are in the same folder. Is it the way i'm getting the pid from that fuck it up?
| Slugsnack wrote: | | It seems you are injecting after you find the window of MapleStory ? Not sure if I am right saying that since I'm still pretty newb at C. But if yes, then you should not be doing that. Your WPM will not work at that point because GG has already loaded then. The time to inject is between when Maple's process is loaded but before GG has loaded. That means watch for Maple's process not window and inject once you see the process. | Im loking for the "PLAY" window and that is before GG has loaded so I am free to do what I want with maple.
|
|
| Back to top |
|
 |
|
|
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
|
|