Commit a9568dd0 authored by Dusan Lacko's avatar Dusan Lacko Committed by Alexandre Julliard

Fix extraction of icons from ICO files.

parent 2e0d8cfc
...@@ -473,6 +473,15 @@ static int ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *szX ...@@ -473,6 +473,15 @@ static int ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *szX
return 0; 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) static int ExtractFromICO(const char *szFileName, const char *szXPMFileName)
{ {
FILE *fICOFile; FILE *fICOFile;
...@@ -482,8 +491,10 @@ static int ExtractFromICO(const char *szFileName, const char *szXPMFileName) ...@@ -482,8 +491,10 @@ static int ExtractFromICO(const char *szFileName, const char *szXPMFileName)
int nIndex = 0; int nIndex = 0;
void *pIcon; void *pIcon;
int i; int i;
char *filename;
if (!(fICOFile = fopen(szFileName, "r"))) filename = get_unix_file_name(szFileName);
if (!(fICOFile = fopen(filename, "r")))
goto error1; goto error1;
if (fread(&iconDir, sizeof (ICONDIR), 1, fICOFile) != 1) if (fread(&iconDir, sizeof (ICONDIR), 1, fICOFile) != 1)
...@@ -525,18 +536,10 @@ static int ExtractFromICO(const char *szFileName, const char *szXPMFileName) ...@@ -525,18 +536,10 @@ static int ExtractFromICO(const char *szFileName, const char *szXPMFileName)
error2: error2:
fclose(fICOFile); fclose(fICOFile);
error1: error1:
HeapFree(GetProcessHeap(), 0, filename);
return 0; 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 ) static BOOL create_default_icon( const char *filename )
{ {
FILE *fXPM; FILE *fXPM;
...@@ -997,7 +1000,8 @@ HRESULT WINAPI IShellLink_Constructor ( ...@@ -997,7 +1000,8 @@ HRESULT WINAPI IShellLink_Constructor (
TRACE("(%p)->()\n",sl); TRACE("(%p)->()\n",sl);
if (IsEqualIID(riid, &IID_IShellLinkA)) if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IShellLinkA))
*ppv = sl; *ppv = sl;
else if (IsEqualIID(riid, &IID_IShellLinkW)) else if (IsEqualIID(riid, &IID_IShellLinkW))
*ppv = &(sl->lpvtblw); *ppv = &(sl->lpvtblw);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment