Modules Used by a Process

The toolhelp functions can also return a list of modules (normally DLLs) used by the application. To obtain the snapshot, CreateToolhelp32Snapshot is passed the TH32CS_SNAPMODULE constant, and the second parameter contains the process identifier whose module list is to be returned. In Listing 5.5 the process identifier for the current process is returned from calling GetCurrentProcessId. The functions Module32First and Module32Next are used to enumerate the modules, and information about the modules is returned in a MODULEENTRY32 structure.

Listing 5.5. Lists modules being used by a process
 void Listing5_5() { HANDLE hModuleSnap; MODULEENTRY32 me32; DWORD dwProcessID; dwProcessID = GetCurrentProcessId(); hModuleSnap ...

Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.