samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Tue Mar 17, 2009 4:06 pm Post subject: |
|
|
If there's no better way, you could always enumerate the modules of the process and check their address range to see if yours fits.
| Code: |
//C++:
//#include <windows.h>
//#include <tlhelp32.h>
BOOL FindModule( DWORD dwAddress, LPTSTR tszModuleName )
{
HANDLE hSnapshot;
MODULEENTRY32 me32;
tszModuleName[ 0 ] = 0; //to make things easier to determine if we've succeeded or not
hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, GetCurrentProcessId( ) );
if( !hSnapshot )
return FALSE;
me32.dwSize = sizeof( MODULEENTRY32 );
if( !Module32First( hSnapshot, &me32 )
return FALSE;
do {
if( dwAddress >= ( DWORD )me32.modBaseAddr &&
dwAddress <= ( ( DWORD )me32.modBaseAddr + me32.modBaseSize ) ) {
_tcscpy( tszModuleName, me32.szModule );
break;
}
} while( Module32Next( hSnapshot, &me32 ) );
CloseHandle( hSnapshot );
return( tszModuleName[ 0 ] == 0 );
}
|
_________________
|
|