From a9568dd08b603c1b614caa4b03bc941dcc9b89bc Mon Sep 17 00:00:00 2001 From: Dusan Lacko Date: Tue, 20 Aug 2002 00:25:03 +0000 Subject: [PATCH] Fix extraction of icons from ICO files. --- dlls/shell32/shelllink.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index 55d4b045e99..f8070126f3f 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -473,6 +473,15 @@ static int ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *szX return 0; } +/* get the Unix file name for a given path, allocating the string */ +inline static char *get_unix_file_name( const char *dos ) +{ + char buffer[MAX_PATH]; + + if (!wine_get_unix_file_name( dos, buffer, sizeof(buffer) )) return NULL; + return heap_strdup( buffer ); +} + static int ExtractFromICO(const char *szFileName, const char *szXPMFileName) { FILE *fICOFile; @@ -482,8 +491,10 @@ static int ExtractFromICO(const char *szFileName, const char *szXPMFileName) int nIndex = 0; void *pIcon; int i; + char *filename; - if (!(fICOFile = fopen(szFileName, "r"))) + filename = get_unix_file_name(szFileName); + if (!(fICOFile = fopen(filename, "r"))) goto error1; if (fread(&iconDir, sizeof (ICONDIR), 1, fICOFile) != 1) @@ -525,18 +536,10 @@ static int ExtractFromICO(const char *szFileName, const char *szXPMFileName) error2: fclose(fICOFile); error1: + HeapFree(GetProcessHeap(), 0, filename); return 0; } -/* get the Unix file name for a given path, allocating the string */ -inline static char *get_unix_file_name( const char *dos ) -{ - char buffer[MAX_PATH]; - - if (!wine_get_unix_file_name( dos, buffer, sizeof(buffer) )) return NULL; - return heap_strdup( buffer ); -} - static BOOL create_default_icon( const char *filename ) { FILE *fXPM; @@ -997,7 +1000,8 @@ HRESULT WINAPI IShellLink_Constructor ( TRACE("(%p)->()\n",sl); - if (IsEqualIID(riid, &IID_IShellLinkA)) + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IShellLinkA)) *ppv = sl; else if (IsEqualIID(riid, &IID_IShellLinkW)) *ppv = &(sl->lpvtblw);