EightyVice Posted August 21, 2017 Share Posted August 21, 2017 Ok, Welcome guys, as the topic says, i know C++ and wrote that code as a DLL #include "stdafx.h"BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, PVOID lpvReserved){ switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: // DO STUFF HERE break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return TRUE;} so. What i write to read a memory and write it ? use WriteProcessMemory function or something else , can u show me guys a small example and thanks Link to comment Share on other sites More sharing options...
madleg Posted August 22, 2017 Share Posted August 22, 2017 just cast memory address to pointer. For protected memory regions you should set virtual protect first. Link to comment Share on other sites More sharing options...
EightyVice Posted August 22, 2017 Author Share Posted August 22, 2017 just cast memory address to pointer. For protected memory regions you should set virtual protect first. oh thanks very much, can u show small example to cast memory , let memory address is 0xAAFE8C Link to comment Share on other sites More sharing options...
madleg Posted August 22, 2017 Share Posted August 22, 2017 (edited) setting integer value at given address: int* ptr = (int*)0xAAFE8C *ptr = 123 or just *(int*)0xAAFE8C = 123 Edited August 22, 2017 by madleg EightyVice 1 Link to comment Share on other sites More sharing options...
EightyVice Posted August 22, 2017 Author Share Posted August 22, 2017 setting integer value at given address: int* ptr = (int*)0xAAFE8C *ptr = 123 or just *(int*)0xAAFE8C = 123 Thanks mate u are Awesome Link to comment Share on other sites More sharing options...
EightyVice Posted August 22, 2017 Author Share Posted August 22, 2017 ok well I did that code to make the health 100 forever BOOL WINAPI VCCOOPDLL(HMODULE hModule, DWORD ul_reason_for_call, PVOID lpvReserved){ switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: // DO STUFF HERE for (; { *(float*)(0x94AD28 + 0x354) = 100; } break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return TRUE;} so some people said compile that DLL and rename it into *.asi file and put it in root file of the game, i did that and the health decrease, also used cheat engine and injected the DLL and nothing happend , any help? did i do any thing wrong? note: 0x94AD28 is CPed Pointer (Return to the player instance too) then we add 0x354 to get health and with value of float. Link to comment Share on other sites More sharing options...
spaceeinstein Posted August 22, 2017 Share Posted August 22, 2017 (edited) It's much easier to use plugin-sdk if you are just modifying known values and behaviors. There are lots of examples available there. Edited August 23, 2017 by spaceeinstein Link to comment Share on other sites More sharing options...
EightyVice Posted August 23, 2017 Author Share Posted August 23, 2017 It's much easier to use plugin-sdk if you are just modifying known values and behaviors. There are lots of examples available there. Thanks mate that will help me, but i have to make it DLL to control it from another C++ program, hmm let me explain well iam making a Online COOP mod for Vice City , so i will make a DLL that will be injected with values like coordinates and health to make sync later but the problem is in the DLL what i write, i make a DLL that can be injected easily in the game and be controled like the not working example above , or to make a DLL with (WriteProcessMemory) and that can be hard and take alot of time, i hope i explained that, so question is making a DLL in C++ that can be injected and thanks mates <3 Link to comment Share on other sites More sharing options...
madleg Posted August 23, 2017 Share Posted August 23, 2017 (edited) your "hello world" is not working or will not work cause of many reasons: VCCOOPDLL is just a function, nothing is calling it. for (; ; ) is infinite loop and it has no break condition in your example if 0x94ad28 is pointer to CPlayerPed, then you have to read this pointer first *(float*)(*(unsigned int*)0x94ad28 + 0x354) = 100 Edited August 23, 2017 by madleg Link to comment Share on other sites More sharing options...
spaceeinstein Posted August 23, 2017 Share Posted August 23, 2017 plugin-sdk still works if you're writing your code in C++. With plugin-sdk, madleg's line is equivalent to FindPlayerPed()->m_fHealth = 100.0f; Link to comment Share on other sites More sharing options...
EightyVice Posted August 23, 2017 Author Share Posted August 23, 2017 your "hello world" is not working or will not work cause of many reasons: VCCOOPDLL is just a function, nothing is calling it. for (; ; ) is infinite loop and it has no break condition in your example if 0x94ad28 is pointer to CPlayerPed, then you have to read this pointer first *(float*)(*(unsigned int*)0x94ad28 + 0x354) = 100 yea that what i want is how to call it xD plugin-sdk still works if you're writing your code in C++. With plugin-sdk, madleg's line is equivalent to FindPlayerPed()->m_fHealth = 100.0f; Awesome mate, can i make a DLL in that SDK or it only make ASI? to be called later and thanks guy for helping , i didnt even expected that , i thought that my topic will be ignored , thanks Link to comment Share on other sites More sharing options...
DK22Pac Posted September 3, 2017 Share Posted September 3, 2017 Yes, you can. When project is created, go to project settings, and change target extension from ".asi" to ".dll" (for both Release and Debug modes). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now