#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")
int WINAPI EnumResNameProc(HMODULE hModule, LPCSTR lpType, LPSTR lpName,LONG_PTR lParam);
int main(void)
//void __cdecl mainCRTStartup(void)
{
HMODULE hMod = LoadLibraryEx(TEXT("powercfg.cpl"), NULL, LOAD_LIBRARY_AS_DATAFILE);
if (hMod) {
puts("load powercfg.cpl");
EnumResourceNames(hMod, MAKEINTRESOURCE(RT_ICON), (ENUMRESNAMEPROC)EnumResNameProc, 0);
FreeLibrary(hMod);
}
return 0;
// ExitProcess(0);
}
int WINAPI EnumResNameProc(HMODULE hModule, LPCSTR lpType, LPSTR lpName,LONG_PTR lParam)
{
TCHAR szTmp[100];
if (IS_INTRESOURCE (lpName)) {
wsprintf(szTmp, TEXT("#%u"), lpName);
puts(szTmp);
} else
puts(lpName);
return 1;
}
Hi Timo,
Thanks. Compiling your code, here is my output on Windows 7 :
load powercfg.cpl
#1
#2
#3
#4
#5
#6
#7
#8
#9
#10
Enumerating with Podump :
podump.exe /RESOURCES:HEADERS C:\Windows\System32\powercfg.cpl | findstr "type"
File type: DLL
type: "MUI", name: 1, language: 1033
type: "WEVT_TEMPLATE", name: 1, language: 1033
type: ICON, name: 1, language: 1033
type: ICON, name: 2, language: 1033
type: ICON, name: 3, language: 1033
type: ICON, name: 4, language: 1033
type: ICON, name: 5, language: 1033
type: ICON, name: 6, language: 1033
type: ICON, name: 7, language: 1033
type: ICON, name: 8, language: 1033
type: ICON, name: 9, language: 1033
type: ICON, name: 10, language: 1033
type: GROUP ICON, name: 202, language: 1033
type: VERSION, name: 1, language: 1033
type: MANIFEST, name: 124, language: 10338