Skip to content

Commit 21fe6d8

Browse files
committed
Fixed a bug with Win32ResourceGenerator where the code was using FindResource() which detect unicode support and calls FindResourceA() or FindResourceW() depending of the settings. Modified the code to always use ANSI functions since the names of the identifiers are always English based characters.
1 parent 5471797 commit 21fe6d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bin2cpp/Win32ResourceGenerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ namespace bin2cpp
138138
fprintf(cpp, " if ( EnumProcessModules( hProcess, &hModule, sizeof(hModule), &cbNeeded) )\n");
139139
fprintf(cpp, " {\n");
140140
fprintf(cpp, " //Retrieve the resource\n");
141-
fprintf(cpp, " hResourceInfoBlock = FindResource(hModule, \"%s\", \"CUSTOM\");\n", getRandomIdentifier(mContext.inputFilePath.c_str()).c_str());
141+
fprintf(cpp, " hResourceInfoBlock = FindResourceA(hModule, \"%s\", \"CUSTOM\");\n", getRandomIdentifier(mContext.inputFilePath.c_str()).c_str());
142142
fprintf(cpp, " if (hResourceInfoBlock)\n");
143143
fprintf(cpp, " {\n");
144144
fprintf(cpp, " hResHandle = LoadResource(hModule, hResourceInfoBlock);\n");
@@ -283,7 +283,7 @@ namespace bin2cpp
283283
fprintf(fout, " if ( EnumProcessModules( info->hProcess, &info->hModule, sizeof(info->hModule), &cbNeeded) )\n");
284284
fprintf(fout, " {\n");
285285
fprintf(fout, " //Retrieve the resource\n");
286-
fprintf(fout, " info->hResourceInfoBlock = FindResource(info->hModule, L\"%s\", L\"CUSTOM\");\n", getRandomIdentifier(mContext.inputFilePath.c_str()).c_str());
286+
fprintf(fout, " info->hResourceInfoBlock = FindResourceA(info->hModule, \"%s\", \"CUSTOM\");\n", getRandomIdentifier(mContext.inputFilePath.c_str()).c_str());
287287
fprintf(fout, " if (info->hResourceInfoBlock)\n");
288288
fprintf(fout, " {\n");
289289
fprintf(fout, " info->hResHandle = LoadResource(info->hModule, info->hResourceInfoBlock);\n");

0 commit comments

Comments
 (0)