News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

getting module base of a .dll in windows7

Started by mikky, May 31, 2010, 08:48:44 PM

Previous topic - Next topic

mikky

hi
i have some problems finding the module base address of a dll
i want to train a game, and i need to find the module base for 'XXX.dll'

here's the code routine that works on windows xp:

GetModuleBaseAddress proc iProcID:DWORD, DLLName:DWORD
LOCAL hSnap:DWORD
LOCAL xModule:MODULEENTRY32
invoke CreateToolhelp32Snapshot, TH32CS_SNAPMODULE, iProcID
mov hSnap,eax
mov xModule.dwSize, sizeof xModule
invoke Module32First, hSnap, addr xModule
test eax, eax
jnz getdll
mov eax, 0
ret
getdll:
invoke Module32Next, hSnap, addr xModule
test eax, eax
jnz checkdll
mov eax, 0
ret
checkdll:
invoke lstrcmpi, DLLName, addr xModule.szModule
test eax, eax
jnz getdll
mov eax, xModule.modBaseAddr
ret
GetModuleBaseAddress endp


now the problem is that this doesn't work on windows7. why?
am i doing something wrong?
is there any other way to obtain the module base of a dll in windows7?

thank you very much

Slugsnack

or you know you could use GetModuleHandle(). btw you probably shouldn't post any more queries on game training, etc. on these forums. it is not encouraged and against the forum rules

oex

Quote from: Slugsnack on June 01, 2010, 12:04:51 AM
btw you probably shouldn't post any more queries on game training, etc. on these forums. it is not encouraged and against the forum rules

Please excuse my ignorance but why are game training queries banned? It is late here and all I can think is maybe it is a SMC reference?
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv