You can use "winemenubuilder -t *.exe *.png" to directly extraction icon image files from exe
From: Maotong Zhang zmtong1988@gmail.com
You can use "winemenubuilder -t *.exe *.png" to directly extraction icon image files from exe --- programs/winemenubuilder/winemenubuilder.c | 46 +++++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 36569fa9d5f..f4bef7d6c99 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -2728,6 +2728,10 @@ static void thumbnail_lnk(LPCWSTR lnkPath, LPCWSTR outputPath) ICONDIRENTRY *pIconDirEntries = NULL; int numEntries; HRESULT hr; + WCHAR *fileName = NULL; + WCHAR *extName = NULL; + HICON icons[1]; + int numIcons;
utf8lnkPath = wchars_to_utf8_chars(lnkPath); winLnkPath = wine_get_dos_file_name(utf8lnkPath); @@ -2755,8 +2759,46 @@ static void thumbnail_lnk(LPCWSTR lnkPath, LPCWSTR outputPath) hr = IPersistFile_Load(persistFile, winLnkPath, STGM_READ); if (FAILED(hr)) { - WINE_ERR("could not read .lnk, error 0x%08lX\n", hr); - goto end; + WINE_WARN("could not read .lnk, error 0x%08lX\n", hr); + fileName = PathFindFileNameW(lnkPath); + extName = PathFindExtensionW(fileName); + if (lstrcmpiW(extName, L".exe") == 0) + { + WINE_WARN("read .exe and generate icons normally \n"); + numIcons = PrivateExtractIconExW(lnkPath, 0, NULL, icons, 1); + if (numIcons > 0 && icons[0] != NULL) + { + hr = open_icon(lnkPath, 0, FALSE, &stream, &pIconDirEntries, &numEntries); + if (SUCCEEDED(hr)) + { + hr = write_native_icon(stream, pIconDirEntries, numEntries, outputPath); + if (FAILED(hr)) + { + WINE_ERR("could not save icon, error 0x%08lX\n", hr); + } + if (stream) stream->lpVtbl->Release(stream); + if (pIconDirEntries) heap_free(pIconDirEntries); + } + DestroyIcon(icons[0]); + heap_free(fileName); + heap_free(extName); + goto end; + } + else + { + WINE_ERR("could not extract icon from %s, error 0x%08lX \n", wine_dbgstr_w(lnkPath), hr); + heap_free(fileName); + heap_free(extName); + goto end; + } + } + else + { + WINE_ERR("the target %s is not an executable file. please check!\n", wine_dbgstr_w(lnkPath)); + heap_free(fileName); + heap_free(extName); + goto end; + } }
get_cmdline(shellLink, szTmp, MAX_PATH, szArgs, INFOTIPSIZE);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=148416
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000008900D8, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032