Page 1 of 1
Forgotten World
Posted: Sat May 29, 2004 2:08 pm
by thisisjustatest80
OK so this may be lame, but...
I found the data for my character, but I cannot alter that data in any way. I even tried setting up a break and tracing back from when the data was written to, and I can't figgure it out. So instead of altering data, I wanted to try a different route: monitor the data until there's a result I want (unlike EQ, starting stats are random, and you can keep rerolling 'till you're happy).
However, I have no idea how to write a program to monitor another program's data. I've only ever written self-contained programs. So if possible, I was wondering if there was an easy way to:
1) Send a keystroke to another process
2) If the result in memory isn't the desired result, repeat
This seems like it's easy, I just don't know how to send a keystroke to another process or how to check another process' memory.
Thanks in advance.
what i got
Posted: Thu Jun 03, 2004 6:57 pm
by thisisjustatest80
I figured it out, though I am no windows programmer. It's running rather slowly I think in part because there's no event handler, so I'm pretty sure my process is hoggin the processor time. If anyone has suggestions, they'd be appreciated.
Code: Select all
#include <windows.h>
HWND windowname;
typedef struct _CHARACTER { //there's a reason for the buffer as seperate from a normal int
short int might;
short int buffer0;
short int agility;
short int buffer1;
short int fortitute;
short int buffer2;
short int intellect;
short int buffer3;
short int insight;
short int buffer4;
short int personality;
short int buffer5;
} CHARACTER;
struct _offset{
long might;
long agility;
long fortitude;
long intellect;
long insight;
long personality;
} offset = {0x7392b80,0x7392b84,0x7392b88,0x7392b8C,0x7392b90,0x7392b94};
void messbox (char* mess)
{
static char caption[]="Process Patcher Error";
MessageBox (windowname,mess, caption,MB_OK|MB_ICONERROR|MB_DEFBUTTON4|MB_APPLMODAL);
}
void main ()
{
CHARACTER i,j,result;
static char program[] = "d:\\forg\\fw.exe";
static char command[] = "";
static char path[] = "d:\\forg";
STARTUPINFO si;
PROCESS_INFORMATION pi;
char debuginfo[80] = "";
static char name[] = "ForgottenWorld";
unsigned long procid;
HANDLE FWhandle;
ZeroMemory(&result,sizeof(result));
ZeroMemory(&si,sizeof(si));
si.cb=sizeof(si);
windowname=FindWindow(NULL,&name);
GetWindowThreadProcessId(windowname,&procid);
FWhandle = OpenProcess(PROCESS_ALL_ACCESS,FALSE,procid);
while(result.might<16 || result.agility<18 || result.fortitute<18 || result.insight<18)
{
ZeroMemory(&i,sizeof(i));
ZeroMemory(&j,sizeof(j));
if(ReadProcessMemory(FWhandle,offset.might,&i,sizeof(i),NULL)==FALSE) messbox("cannot read memory");
PostMessage(windowname,WM_KEYDOWN,VK_RETURN,0);
Loop:
if(ReadProcessMemory(FWhandle,offset.might,&j,sizeof(j),NULL)==FALSE) messbox("cannot read memory");
if(i.agility==j.agility&&i.fortitute==j.fortitute&&i.insight==j.insight&&i.intellect==j.intellect&&i.might==j.might&&i.personality==j.personality) goto Loop;
if(ReadProcessMemory(FWhandle,offset.might,&result,sizeof(result),NULL)==FALSE) messbox("cannot read memory");
PostMessage(windowname,WM_KEYUP,VK_RETURN,1);
}
PostMessage(windowname,WM_KEYUP,VK_RETURN,1);
CloseHandle(FWhandle);
}
Posted: Fri Jun 04, 2004 5:15 am
by thisisjustatest80
Code: Select all
#include <windows.h>
HWND windowname;
typedef struct _CHARACTER {
short int might;
short int buffer0;
short int agility;
short int buffer1;
short int fortitute;
short int buffer2;
short int intellect;
short int buffer3;
short int insight;
short int buffer4;
short int personality;
short int buffer5;
} CHARACTER;
struct _offset{
long might;
long agility;
long fortitude;
long intellect;
long insight;
long personality;
} static offset = {0x7392b80,0x7392b84,0x7392b88,0x7392b8C,0x7392b90,0x7392b94};
void messbox (char* mess)
{
static char caption[]="Process Patcher Error";
MessageBox (windowname,mess, caption,MB_OK|MB_ICONERROR|MB_DEFBUTTON4|MB_APPLMODAL);
}
void main ()
{
CHARACTER i,j,result;
PROCESS_INFORMATION pi;
static char name[] = "ForgottenWorld";
unsigned long procid;
HANDLE FWhandle;
ZeroMemory(&j,sizeof(j));
windowname=FindWindow(NULL,&name);
GetWindowThreadProcessId(windowname,&procid);
FWhandle = OpenProcess(PROCESS_ALL_ACCESS,FALSE,procid);
while(!(j.agility>=18 && j.fortitute>=18 && j.insight>=18))
{
ReadProcessMemory(FWhandle,offset.might,&i,sizeof(i),NULL);
PostMessage(windowname,WM_KEYDOWN,VK_RETURN,0);
ReadProcessMemory(FWhandle,offset.might,&j,sizeof(j),NULL);
while(i.agility==j.agility&&i.fortitute==j.fortitute&&i.insight==j.insight&&i.intellect==j.intellect&&i.might==j.might&&i.personality==j.personality)
ReadProcessMemory(FWhandle,offset.might,&j,sizeof(j),NULL);
}
CloseHandle(FWhandle);
messbox("We have a winner");
}
Any suggestions on making it interact better?