|
Basically a very old asm-snippet of the stuff you need to sort...
get_modules:
cmp [modbuffer],0
jz nofreemod
Call GlobalFree, [modbuffer]
nofreemod:
mov [modsize],04000h
Call GlobalAlloc, 0040h, [modsize]
mov [modbuffer],eax
mov [modpointer],eax
mov ecx,[P_Info+8]
mov [ProcEth32ProcessID],ecx
push ProcEth32ProcessID ;th32ProcessID
push TH32CS_SNAPMODULE ;dwFlags
call CreateToolhelp32Snapshot
mov [hSnapshot],eax
lea edi,ModuleEntry
push edi ;lpme
mov dword ptr [edi],SIZEOFMODULEENTRY
push eax ;hSnapshot
call Module32First
call copy_modinfo
next_mod:
push edi ;lpme
push hSnapshot ;hSnapshot
call Module32Next
or eax,eax
jz mod_done
call copy_modinfo
jmp next_mod
mod_done:
push hSnapshot
call CloseHandle
xor eax,eax
ret
copy_modinfo:
pushad
mov edi,[modpointer]
mov ecx,edi
push ecx
mov eax,[ModEmodBaseAddr] ; get imagebase
mov [edi+30h],eax
mov eax,[ModEmodBaseSize] ; get sizeofimage
mov [edi+34h],eax
lea eax,ModEszModule ; get name of module
call copy0
pop ecx
mov eax,ecx
call lowercase_buffer
add ecx,040h
mov [modpointer],ecx
popad
ret
Just look what apifunctions are used and port it to ur c-code.
that should be enough.. basically you workout all the loaded modules from within a given processinfo!
so..using such a snippet will obtain a list of the loaded modules..
u can increase the search for ur "special" dll by skiping "known" dll modules.
doin this , you can create a table with system librarys and just ignore them.
non standard dlls u examine by obtaining the export table.
you can get the addresses of the exported functions and do a search for whatever in that memory-area.
hope it helps, cheers
|