Register for your free account! | Forgot your password?

You last visited: Today at 17:06

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



GetModuleBase

Discussion on GetModuleBase within the Coding Snippets forum part of the Coding Releases category.

Reply
 
Old   #1
 
elite*gold: 39
Join Date: Jun 2016
Posts: 269
Received Thanks: 804
GetModuleBase

Needed this for a short project, didn't want to play the copycat so I wrote my own little code. Prolly it looks like any other though.
Code:
uint32_t GetModuleBase(DWORD dwProcessID, std::wstring ModuleName) {
	HANDLE hModuleSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessID);
	MODULEENTRY32 ModuleEntry32;
	ModuleEntry32.dwSize = sizeof(ModuleEntry32);

	if (!Module32First(hModuleSnapshot, &ModuleEntry32)) {
		return 0;
	}

	do {
		if (std::wstring(ModuleEntry32.szModule) == ModuleName) {
			return (uint32_t)ModuleEntry32.modBaseAddr;
		}
	} while (Module32Next(hModuleSnapshot, &ModuleEntry32));
	return 0;
}
gοd is offline  
Thanks
3 Users
Old 08/25/2017, 06:26   #2

 
Requi's Avatar
 
elite*gold: 6300
The Black Market: 244/0/0
Join Date: Dec 2012
Posts: 13,010
Received Thanks: 8,194
You're not closing the handle you opened. Anticheat says "Hello".
Also C-style casts
Requi is offline  
Reply




All times are GMT +1. The time now is 17:06.


Powered by vBulletin®
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2023 elitepvpers All Rights Reserved.