diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 5d16022..0394d9d 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -1018,6 +1018,8 @@ static HRESULT open_file_type_icon(LPCWSTR szFileName, IStream **ppStream) WCHAR *comma; int index = 0; HRESULT hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND); + char *target_unix = NULL; + struct stat stat_buffer; extension = strrchrW(szFileName, '.'); if (extension == NULL) @@ -1040,9 +1042,19 @@ static HRESULT open_file_type_icon(LPCWSTR szFileName, IStream **ppStream) goto end; } + target_unix = wchars_to_unix_chars(target); + if (!target_unix) + { + hr = E_OUTOFMEMORY; + goto end; + } + if (stat(target_unix, &stat_buffer) != 0) + goto end; + hr = open_icon(target, index, FALSE, ppStream); end: + HeapFree(GetProcessHeap(), 0, target_unix); HeapFree(GetProcessHeap(), 0, target); return hr; }