Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma pack( push )
- #pragma pack( 2 )
- typedef struct
- {
- BYTE bWidth; // Width, in pixels, of the image
- BYTE bHeight; // Height, in pixels, of the image
- BYTE bColorCount; // Number of colors in image (0 if >=8bpp)
- BYTE bReserved; // Reserved
- WORD wPlanes; // Color Planes
- WORD wBitCount; // Bits per pixel
- DWORD dwBytesInRes; // how many bytes in this resource?
- WORD nID; // the ID
- } GRPICONDIRENTRY, *LPGRPICONDIRENTRY;
- #pragma pack( pop )
- // #pragmas are used here to insure that the structure's
- // packing in memory matches the packing of the EXE or DLL.
- #pragma pack( push )
- #pragma pack( 2 )
- typedef struct
- {
- WORD idReserved; // Reserved (must be 0)
- WORD idType; // Resource type (1 for icons)
- WORD idCount; // How many images?
- GRPICONDIRENTRY idEntries[1]; // The entries for each image
- } GRPICONDIR, *LPGRPICONDIR;
- #pragma pack( pop )
- HMODULE hExe = LoadLibrary("stubpe.exe");
- EnumResourceTypes(hExe, (ENUMRESTYPEPROC)ResTypes, 0);
- // Find the group resource which lists its images
- /* Need to set "IconGrpName" this from ResTypee */
- HRSRC hRsrc = FindResource( hExe, MAKEINTRESOURCE(1), RT_GROUP_ICON );
- // Load and Lock to get a pointer to a GRPICONDIR
- HGLOBAL hGlobal = LoadResource( hExe, hRsrc );
- GRPICONDIR *lpIconGroup = new GRPICONDIR[ SizeofResource( hExe, hRsrc ) ];
- RtlZeroMemory( lpIconGroup, SizeofResource( hExe, hRsrc ) );
- lpIconGroup = (GRPICONDIR*)LockResource( hGlobal );
- // We now have the header of the icon file now we need all the icons.
- cout << "Icon Count: " << lpIconGroup->idCount << endl;
- cout << "Type: " << lpIconGroup->idType << endl;
Advertisement
Add Comment
Please, Sign In to add comment