본문으로 바로가기

프로세스에 로드된 모든 DLL 보기

category 개발언어/c++ 2016. 7. 16. 19:22

void PrintModules()

{

HMODULE hMods[1024];

DWORD cbNeeded;

unsigned int i;

.

// Get a list of all the modules in this process.

if(EnumProcessModules(GetCurrentProcess(), hMods,

sizeof(hMods), &cbNeeded))

{

for (i = 0; i < (cbNeeded / sizeof(HMODULE)); i++ )

{

TCHAR szModName[MAX_PATH];


// Get the full path to the module's file.

if (GetModuleFileNameEx(GetCurrentProcess(),

hMods[i], szModName,

sizeof(szModName) / sizeof(TCHAR)))

{

// Print the module name and handle value.

TRACE(_T("\t%s (0x%08X)\n"),

szModName, hMods[i]);

}

}

}

}