Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Use the first icon instead of resource 101 (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
sredna authored Nov 17, 2022
1 parent 903b231 commit a096fc7
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion GDFTrace/GDFParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,36 @@ HRESULT CGDFParse::EnumLangs( const WCHAR* strGDFBinPath )
}


//--------------------------------------------------------------------------------------
static BOOL CALLBACK FindFirstResourceLangProc( HMODULE hMod, LPCWSTR lpType, LPCWSTR lpName, WORD Lang, LONG_PTR lParam )
{
SIZE_T* data = (SIZE_T*) lParam;
if( data[1] == Lang || data[2] )
{
HRSRC hRsrc = FindResourceEx( hMod, lpType, lpName, Lang );
data[0] = (SIZE_T) hRsrc;
}
return !(data[0]);
}


//--------------------------------------------------------------------------------------
static BOOL CALLBACK FindFirstResourceNameProc( HMODULE hMod, LPCTSTR lpType, LPTSTR lpName, LONG_PTR lParam )
{
SIZE_T* data = (SIZE_T*) lParam;
EnumResourceLanguages( hMod, lpType, lpName, FindFirstResourceLangProc, lParam );
return !(data[0]);
}


//--------------------------------------------------------------------------------------
static HRSRC FindFirstResource( HMODULE hMod, LPCWSTR lpType, WORD Lang, bool fAnyLanguage = false )
{
SIZE_T data[3] = { 0, Lang, fAnyLanguage };
EnumResourceNames( hMod, lpType, FindFirstResourceNameProc, (SIZE_T) data );
return (HRSRC) data[0];
}

//--------------------------------------------------------------------------------------
HRESULT CGDFParse::LoadXMLinMemory( const WCHAR* strGDFBinPath, WORD wLanguage, HGLOBAL* phResourceCopy )
{
Expand Down Expand Up @@ -770,7 +800,7 @@ HRESULT CGDFParse::OutputGDFIconInfo( WCHAR* strGDFBinPath, BOOL* pIconEightBits
if( hGDFDll )
{
// Extract GDF Icon
hrsrc = FindResourceEx( hGDFDll, RT_GROUP_ICON, (LPCTSTR)101, wLanguage );
hrsrc = FindFirstResource( hGDFDll, RT_GROUP_ICON, wLanguage );
if( hrsrc )
{
hgResource = LoadResource( hGDFDll, hrsrc );
Expand Down

0 comments on commit a096fc7

Please sign in to comment.