Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Two different addresses, c++ and cheat engine

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
mo290103
How do I cheat?
Reputation: 0

Joined: 15 Sep 2022
Posts: 2

PostPosted: Thu Sep 15, 2022 5:32 am    Post subject: Two different addresses, c++ and cheat engine Reply with quote

When i scan for module base address i get value: 0xCC110000, but cheat engine shows much bigger values. My code:
Code:
uintptr_t dwGetModuleBaseAddress(DWORD procId, char* modName)
{
    uintptr_t modBaseAddr = 0;

    string helper = "";

    HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, procId);
    if (hSnap != INVALID_HANDLE_VALUE)
    {
        MODULEENTRY32 modEntry;
        modEntry.dwSize = sizeof(modEntry);
        if (Module32First(hSnap, &modEntry))
        {
            do
            {
                for (int i = 0; i < strlen(modName); i++)
                {
                    if ((CHAR)modEntry.szModule[i] != 0)
                    {
                        helper = helper + (CHAR)modEntry.szModule[i];
                    }
                }

                cout<<helper.c_str()<<endl;
                if (strcmp(helper.c_str(), modName) == 0)
                {
                    modBaseAddr = (uintptr_t)modEntry.modBaseAddr;
                    break;
                }
                helper = "";
            } while (Module32Next(hSnap, &modEntry));
        }
    }
    CloseHandle(hSnap);
    return modBaseAddr;
}

...
int main()
{
    ...
    HANDLE pHandle = OpenProcess(PROCESS_VM_READ, 0, pid);

    string module_name = "GameAssembly.dll";
    //cout << const_cast<char *>(module_name.c_str()) << endl;
    DWORD GameAssembly = dwGetModuleBaseAddress(pid, "GameAssembly.dll");
    cout << GameAssembly<<endl;



engine.png
 Description:
 Filesize:  19.86 KB
 Viewed:  3929 Time(s)

engine.png


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Thu Sep 15, 2022 11:28 am    Post subject: Reply with quote

The arrow -> means "the value stored at this address is..."

Look at what address "GameAssembly.dll" is actually loaded at in CE
Code:
print(('%08X'):format(getAddress'GameAssembly.dll'))

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
mo290103
How do I cheat?
Reputation: 0

Joined: 15 Sep 2022
Posts: 2

PostPosted: Fri Sep 16, 2022 7:34 am    Post subject: Reply with quote

ParkourPenguin wrote:
The arrow -> means "the value stored at this address is..."

Look at what address "GameAssembly.dll" is actually loaded at in CE
Code:
print(('%08X'):format(getAddress'GameAssembly.dll'))


Thanks, i figured out that address needs to be type long long. When I get to know, that these are pointers I could easily finish my project Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites