winemenubuilder: Also extract .lnk icons from file types's open handler.

This commit is contained in:
Damjan Jovanovic 2010-06-08 22:05:04 +02:00 committed by Alexandre Julliard
parent a2791a0919
commit 9954735e43
1 changed files with 20 additions and 10 deletions

View File

@ -819,10 +819,11 @@ static int ExtractFromICO(LPCWSTR szFileName, char *szXPMFileName)
static int ExtractFromFileType(LPCWSTR szFileName, char *szXPMFileName) static int ExtractFromFileType(LPCWSTR szFileName, char *szXPMFileName)
{ {
int ret = 1; int ret = 0;
WCHAR *extension; WCHAR *extension;
WCHAR *icon = NULL; WCHAR *icon = NULL;
WCHAR *comma; WCHAR *comma;
WCHAR *executable = NULL;
int index = 0; int index = 0;
char *output_path = NULL; char *output_path = NULL;
@ -831,9 +832,8 @@ static int ExtractFromFileType(LPCWSTR szFileName, char *szXPMFileName)
goto end; goto end;
icon = assoc_query(ASSOCSTR_DEFAULTICON, extension, NULL); icon = assoc_query(ASSOCSTR_DEFAULTICON, extension, NULL);
if (icon == NULL) if (icon)
goto end; {
comma = strrchrW(icon, ','); comma = strrchrW(icon, ',');
if (comma) if (comma)
{ {
@ -841,11 +841,21 @@ static int ExtractFromFileType(LPCWSTR szFileName, char *szXPMFileName)
index = atoiW(comma + 1); index = atoiW(comma + 1);
} }
output_path = extract_icon(icon, index, NULL, FALSE); output_path = extract_icon(icon, index, NULL, FALSE);
WINE_TRACE("defaulticon %s -> icon %s\n", wine_dbgstr_w(icon), wine_dbgstr_a(output_path));
}
else
{
executable = assoc_query(ASSOCSTR_EXECUTABLE, extension, NULL);
if (executable)
output_path = extract_icon(executable, 0, NULL, FALSE);
WINE_TRACE("executable %s -> icon %s\n", wine_dbgstr_w(executable), wine_dbgstr_a(output_path));
}
if (output_path) if (output_path)
ret = rename(output_path, szXPMFileName); ret = (rename(output_path, szXPMFileName) == 0);
end: end:
HeapFree(GetProcessHeap(), 0, icon); HeapFree(GetProcessHeap(), 0, icon);
HeapFree(GetProcessHeap(), 0, executable);
HeapFree(GetProcessHeap(), 0, output_path); HeapFree(GetProcessHeap(), 0, output_path);
return ret; return ret;
} }