I read the tutorial "Making Hacks in C++". I'm wondering if someone could make a small program to use those functions in action. I'm somewhat new to C++ and I'm having trouble following the pseudo code in the tutorial.
BTW thanks for tutorial ;)

I read the tutorial "Making Hacks in C++". I'm wondering if someone could make a small program to use those functions in action. I'm somewhat new to C++ and I'm having trouble following the pseudo code in the tutorial.
BTW thanks for tutorial ;)




I woud help but.... dam im bad at excuses..
meh without giving away crap here are some key word that google may be nice with
asm is assembly
it's raw cpu code
if you ever get into game cracking
you'll read alot about NOP
and other 3 letter acronyms
they're the cpu code
hex workshop
WDASM
soft ice ..... which is a **** to install, because it sits in the shell, like between windows and the cpu you'll need to understand hex
and what breaks are
Last edited by Silence : 11-22-2004 at 12:43 PM
Silence, your signature is to fuking big, next time you do this your signature will be disabled.
<3 LCS
[/QUOTE]
d2V.
only if you're not any good ;)Originally Posted by Silence
My signature is back!! Hell YES!
Click the link, I DEMAND YOU! :-D
http://www.bwhacks.com/forums/showthread.php?t=24873

I would like a simple program that demonstrates WriteProcessMemory() OpenProcess() and GetWindowThreadProcessId(); preferably on Starcraft. I don't need help with assembly or SoftIce and I know what a NOP instruction is =/.
I specifically made the tutorial somewhat cryptic so those who wanted to use it would actually need to learn a bit of C++. Nothing in there is that hard, just go read some beginner tutorials and try to piece it all together.
This space still for rent.
I tried piecing stuff together, but I drove myself crazy trying to figure out which variable type to declare everything. Anyone want to point those out for me?




One thing, dont make your hacks dll style........ takes ages ( :( )
Silence, your signature is to fuking big, next time you do this your signature will be disabled.
<3 LCS
[/QUOTE]
d2V.

I'm not asking for a spoon feeding just something to jump start with. The best tutorials give examples to employ.
There really aren't any good C++ tutorials online and most don't go beyond console programming (loops, arrays, ect.) and basic win32 programming. Some tutorials are outdated and some mix regular C with C++. Still others mix and match compilers. Worse of all are the books that talk to you like you're an MIT grad. Another obfuscated tutorial by itself isn't helping ^(-.-)^
And silence, no offense, but you are way off topic. Nobody is talking about assembly, softice, or dll's in the thread.
Get a good C++ book. You don't need much in-depth knowledge to follow Fish Beans' tutorial, just the bare basics. You will also end up learning other aspects of C++ while reading a book (as opposed to someone clarifying for you) which are very useful outside of hacking and, when you get better, in game hacking as well.Originally Posted by NoFinalTruth

Well, I went looking at different tutorials and I put together this program. I'm trying to change my minerals to 100 (brood war). Clearly I'm new to C++ and this isn't working so can someone help me?
Code:#include "stdafx.h" #include <windows.h> #include <string.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND windowHandle; LPDWORD pid; DWORD pid2; HANDLE processHandel; bool wpm; int DataToWrite; DataToWrite = 100; windowHandle = FindWindow(NULL,"Brood War"); pid2 = GetWindowThreadProcessId(windowHandle,pid); processHandel = OpenProcess( PROCESS_ALL_ACCESS, 0, pid2 ); wpm = WriteProcessMemory(processHandel,(void*)0x004FD4A4,&DataToWrite,4,NULL); }


There is no need to store the return value of GetWindowThreadProcessId. You need to use the second parameter of it when calling OpenProcess instead of its return value. Simply change OpenProcess(PROCESS_ALL_ACCESS, 0, pid2); to OpenProcess(PROCESS_ALL_ACCESS, 0, *pid);. You need to use the indirection operator (*) here, because the variable type of pid is LPDWORD, a pointer to a dword, and OpenProcess doesn't need the address of it (pid), but the actual value (*pid).
edit: typo
Last edited by nickolay : 11-29-2004 at 03:25 AM

I made the changes to the program including setting pid to NULL, and the following code builds just fine:
When I debug the program I get the following error:Code:#include "stdafx.h" #include <windows.h> #include <string.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND windowHandle; LPDWORD pid = NULL; HANDLE processHandel; int DataToWrite; DataToWrite = 100; windowHandle = FindWindow(NULL,"Brood War"); GetWindowThreadProcessId(windowHandle, pid); processHandel = OpenProcess(PROCESS_ALL_ACCESS,0,*pid); WriteProcessMemory(processHandel,(void*)0x004FD4A4,&DataToWrite,4,NULL); }
The compiler points to the following line:Code:An unhandled exception of type 'System.NullReferenceException' occurred in man.exe Additional information: Object reference not set to an instance of an object.
processHandel = OpenProcess(PROCESS_ALL_ACCESS,0,*pid);
and says *pid is null which I'm assuming means something is wrong with the prior function. what am I missing?
Thanks for help ;)





LPDWORD *pid; //<-- use this

nm that didnt see the *

error C2664: 'GetWindowThreadProcessId' : cannot convert parameter 2 from 'LPDWORD * ' to 'LPDWORD'
error C2664: 'OpenProcess' : cannot convert parameter 3 from 'LPDWORD' to 'DWORD'
don't think that will work =/





Should work now ;)Code:DWORD pid; //change var type GetWindowThreadProcessId(windowHandle, &pid); // add the & processHandel = OpenProcess(PROCESS_ALL_ACCESS,0,pid);

SWEET! it worked and it also worked on BW. Thanks guys. Learned how to use API's and make windows in the process.
Heres the working code for anyone that wants it:
Code:#include "stdafx.h" #include <windows.h> #include <string.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND windowHandle; DWORD pid; HANDLE processHandel; int DataToWrite; DataToWrite = 100; windowHandle = FindWindow(NULL,"Brood War"); GetWindowThreadProcessId(windowHandle, &pid); processHandel = OpenProcess(PROCESS_ALL_ACCESS,0,pid); WriteProcessMemory(processHandel,(void*)0x004FD4A4,&DataToWrite,4,NULL); }





Keep the good work!
P.S: Trolls bitching that BWHacks staff dont help people you can now STFU!!

The parts I did myself actually took me a long time. Theres a good API tutorial that I used to figure most of it out: http://www.winprog.org/tutorial/index.html
Compiler helped me with the variable types and I serfed the web for solutions to the error messages.


The reason it didn't work with the fix I suggested was because you initialized pid to NULL. Had you not done so, it would have worked as intended. Pid is a pointer, so you should not set it to NULL if you expect a function to access the data it points to. Initializing it with *pid = NULL; would have been the correct way of doing so. Also, including string.h is unnecessary.
There are currently 1 users browsing this thread. (0 members and 1 guests)