Yeh, good job, but room for LOTS of improvement. It's very clear someone made this originally and was just glad that it compiled and worked (barely).
// forgot to add // infront? Modapp on Code
BYTE Hud[1] = {0x92};
Why? This just makes it sloppier. Put the byte as a hexidecimal (dword) value into ReadProcessMemory..
This just shows that this comes from the same source code made by some noob being copied over and over, and then it gets worse and worse as more people edit/redistribute that crappy code. You end up with a messy file like what you just posted.
WriteProcessMemory(Handle, (LPCVOID)0x00EB0F44, 0x92,1,0);
Now doesn't that look a lot cleaner?
http://msdn.microsoft.com/en-us/library/windows/desktop/ms681674%28v=vs.85%29.aspxUse documents to guide you, but copy and pasting will get you nowhere..
// YOU DONT NEED TO EDIT BELOW THIS LINE
BOOL GetProcessList( )
..
{
..
}
Woops? Looks like you forgot to edit something.
//Call to function above (game always attatched)
Bad comment, the handle might not have opened successfully and this is an .exe which uses RPM/WPM (external) so it is never actually 'hooked' like a .dll, nor are any functions hooked (by dll) or scanned/modified (advanced external editing). The only way you can read and modify is with RPM/WPM (and scanning externally, re-projecting and changing the EIP to hook without editing anything using breakpoints but I doubt you are into that yet).
There are lots of issues and optimizations to be done with this copy and paste code.. and I'm starting to think I can just punch it into google and it'll pop up 100 times with different authors.. You can probably also google and find a better one although public mod-apping source code generally sucks and is leeched/renamed all the time.
Not hating, but as I said you should improve this a lot. So far the only custom code I see is very messy and overly commented stuff like
if(GetAsyncKeyState(Key)) // This makes sure Key is pressed!111 omg
{
int Horse = Strcmp ( ... );
if(Horse==false) FUNC(); // If STRCMP is successful
{
..
}
}
Fix:
If you do if(Horse), it initializes as a bool and if it is not 0 (false) then it will run, else you do if(!Horse) if the success return value is 0. You don't need to initialize a new variable unless you're using it across multiple scopes, so just do:
if(!StrCmp(...) && GetAsyncKeyState(0xkey)) { PseudoCode; }
instead of those 3 unneeded and sloppy looking lines of code.
I mean really I can probably change every line on this, and then it wouldn't matter because it's somewhat worthless except as a learning utensil. Keep on trying I guess, you'll slowly get better.
(Footnote: this might just be C, because C++ generally uses .cpp files and not old .c files, although they are still backwards compatible.)