"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
I get annoyed when I see simple memory writing made this complex... You can easily change the value of a pointer without defining any variables but the base addy and the offset. It is a waste of time to declare other ints and floats when you can write to a value with a single line of code. I'll just use stamina as an example and make up random addresses. Here is an example of how to do this the efficient way. I will also add the hotkeys and show how to make an efficient loop to keep the hack running:
Please excuse any errors, I just wrote this from memory. The basic idea is actually this line:Code:#define Playerpointer 0x12345678 #define StaminaOffset 0x284 bool staminaon = false; void Stamina() { while(1) { if(staminaon == true) { *(float*)(*(*DWORD*)Playerpointer + StaminaOffset) = 100; Sleep(100); //Avoid lag } } } void Hotkeys() { while(1) { if(GetAsyncKeyState(VK_NUMPAD1)) { if(staminaon == false) { staminaon = true; MessageBox(0, "Stamina Activated", "DLL Hack", MB_OK); } else { staminaon = false; MessageBox(0, "Stamina Deactivated", "DLL Hack", MB_OK); } } Sleep(100); //Avoid lag } } BOOL APIENTRY DllMain(HINSTANCE hDll, DWORD callReason, LPVOID lpReserved) { DisableThreadLibraryCalls(hDll); switch(callReason) { case(DLL_PROCESS_ATTACH): { CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&Stamina, 0, 0, 0); CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&Hotkeys, 0, 0, 0); } case(DLL_PROCESS_DETACH): { FreeLibrary(hDll); break; } } return 1; }
The float at the beginning is showing that the type of the value is float, the DWORD is just showing that it is 4 byte (which an offset always is) and the 100 is just the value to set it to.Code:*(float*)(*(DWORD*)Playerpointer + StaminaOffset) = 100;
ok lets get started:
Originally Posted by Destrod16efficient? no...Originally Posted by Destrod16
complex? yes...
so you do the exact same thing ^^
You could write a whole program in 1 line. as long as you dont use newlines and make sure the brackets are ok.Originally Posted by Destrod16
so 1 line doesnt say anything about the efficienty of the code. but then again, you would use defines to make a struct, so what do you know about efficienty ^^
FYI 100 is an intOriginally Posted by Destrod16
100.0f is a float if you wish to do it correctly.
Hmm... thats new to me, could someone explain since when offsets are 4 bytes?Originally Posted by Destrod16
Oh wait...
Offsets are not always 4 bytes ever heard of unsigned char? thats right, 1 whole byte and you can even use it in structs and classes(OH NO A 1 BYTE OFFSET)
Thanks for making my day
@hell_demon: Wouldn't the #define be more efficient? Because instead of allocating tons of memory to variables you are just saying the address manually each time. If you have tons of addresses to work with, allocating that many would be quite problamatic, and define doesn't take any resources from the compiled program, unlike having tons of variables. Though i may be wrong, since i'm pretty much a beginner.
And everything you said besides that is just nit-picking :/
Using 100 instead of 100.0f doesn't really matter that much, it was a quick example.
Last edited by zeco; 09-21-2009 at 11:35 AM.
compiler takes care of converting 100 to 100.0f, but its still cleaner to write 100.0f
Him saying he hates it when people do easy memory editing so complex while he himself uses 150 defines for something which can be done in a small loop pisses me off :P
you could have 1 byte(using unsigned chars) or 8 bytes(using double) which according to him would not excist because all offsets must be 4 bytes.
/agree that i was nitpicking, but he was trying to be a mr. know-it-all while there can only be one! ME!
whats the addrese of today?
posting your source isnt a tutorial at all, nice youre banned (sorry:P)