News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Which DLLs are loaded?

Started by jj2007, March 18, 2022, 02:41:03 AM

Previous topic - Next topic

jj2007

include \masm32\MasmBasic\MasmBasic.inc         ; download
  SetGlobals moduleCount, modules[100], buffer[MAX_PATH]:BYTE
  Init
  Dll "psapi"                  ; from Windows 7 onwards
  Declare void EnumProcessModules, 4
  Declare void GetModuleFileNameExW, 4
  lea esi, modules
  EnumProcessModules(-1, esi, 100, addr moduleCount)
  Print Str$("%i modules found\n", moduleCount/4)
  Clr moduleCount
  .While 1
        lodsd
        .Break .if !eax
        GetModuleFileNameExW(-1, eax, addr buffer, 200)
        wPrintLine wStr$("%i\t", moduleCount), addr buffer
        inc moduleCount
  .Endw
  Inkey "hit any key"
EndOfCode


Output (on Win7-64):
37 modules found
0       C:\Masm32\MasmBasic\BugTests\EnumModules.exe
1       C:\Windows\SysWOW64\ntdll.dll
2       C:\Windows\syswow64\kernel32.dll
3       C:\Windows\syswow64\KERNELBASE.dll
4       C:\Windows\syswow64\user32.dll
5       C:\Windows\syswow64\GDI32.dll
6       C:\Windows\syswow64\LPK.dll
7       C:\Windows\syswow64\USP10.dll
8       C:\Windows\syswow64\msvcrt.dll
9       C:\Windows\syswow64\ADVAPI32.dll
10      C:\Windows\SysWOW64\sechost.dll
11      C:\Windows\syswow64\RPCRT4.dll
12      C:\Windows\syswow64\SspiCli.dll
13      C:\Windows\syswow64\CRYPTBASE.dll
14      C:\Windows\syswow64\comdlg32.dll
15      C:\Windows\syswow64\SHLWAPI.dll
16      C:\Windows\WinSxS\x86_microsoft.windows.common
17      C:\Windows\syswow64\SHELL32.dll
18      C:\Windows\syswow64\ole32.dll
19      C:\Windows\system32\apphelp.dll
20      C:\Windows\AppPatch\AcLayers.DLL
21      C:\Windows\syswow64\OLEAUT32.dll
22      C:\Windows\syswow64\USERENV.dll
23      C:\Windows\syswow64\profapi.dll
24      C:\Windows\system32\WINSPOOL.DRV


Note the discrepancy between moduleCount returned (37) and the actual count (24) :rolleyes:

Vortex

Hi Jochen,

Here is my report based on my Windows 7 64-bit system :

0       C:\Masm32\EnumModules.exe
1       C:\Windows\SysWOW64\ntdll.dll
2       C:\Windows\syswow64\kernel32.dll
3       C:\Windows\syswow64\KERNELBASE.dll
4       C:\Windows\syswow64\user32.dll
5       C:\Windows\syswow64\GDI32.dll
6       C:\Windows\syswow64\LPK.dll
7       C:\Windows\syswow64\USP10.dll
8       C:\Windows\syswow64\msvcrt.dll
9       C:\Windows\syswow64\ADVAPI32.dll
10      C:\Windows\SysWOW64\sechost.dll
11      C:\Windows\syswow64\RPCRT4.dll
12      C:\Windows\syswow64\SspiCli.dll
13      C:\Windows\syswow64\CRYPTBASE.dll
14      C:\Windows\syswow64\comdlg32.dll
15      C:\Windows\syswow64\SHLWAPI.dll
16      C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.18837_none_ec86b8d6858ec0bc\COMCTL32.dll
17      C:\Windows\syswow64\SHELL32.dll
18      C:\Windows\syswow64\ole32.dll
19      C:\Windows\system32\IMM32.DLL
20      C:\Windows\syswow64\MSCTF.dll
21      C:\Windows\syswow64\psapi.DLL
hit any key