All of this extract-icon stuff should be moved to exticon.c in the user32 directory.
At the moment there are 3 copys of this code in wine.
Ciao
Juergen
Date sent: Thu, 21 Sep 2000 21:22:28 +0000
From: Andreas Mohr <[EMAIL PROTECTED]>
To: Wine Devel <[EMAIL PROTECTED]>
Subject: InternalExtractIcon16 fix
Send reply to: [EMAIL PROTECTED]
> Determining best CVS host...
> Using CVSROOT :pserver:[EMAIL PROTECTED]:/home/wine
> Index: dlls/shell32/shell.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/shell32/shell.c,v
> retrieving revision 1.16
> diff -u -r1.16 shell.c
> --- dlls/shell32/shell.c 2000/08/14 14:41:21 1.16
> +++ dlls/shell32/shell.c 2000/09/22 01:17:38
> @@ -666,7 +666,7 @@
> LPBYTE pData;
> OFSTRUCT ofs;
> DWORD sig;
> - HFILE hFile = OpenFile( lpszExeFileName, &ofs, OF_READ );
> + HFILE hFile;
> UINT16 iconDirCount = 0,iconCount = 0;
> LPBYTE peimage;
> HANDLE fmapping;
> @@ -674,13 +674,33 @@
> TRACE("(%04x,file %s,start %d,extract %d\n",
> hInstance, lpszExeFileName, nIconIndex, n);
>
> - if( hFile == HFILE_ERROR || !n )
> + if( !n )
> return 0;
>
> + hFile = OpenFile( lpszExeFileName, &ofs, OF_READ );
> +
> hRet = GlobalAlloc16( GMEM_FIXED | GMEM_ZEROINIT, sizeof(HICON16)*n);
> RetPtr = (HICON16*)GlobalLock16(hRet);
> +
> + if (hFile == HFILE_ERROR)
> + { /* not found - load from builtin module if available */
> + HINSTANCE hInst = (HINSTANCE)LoadLibrary16(lpszExeFileName);
> +
> + if (hInst < 32) /* hmm, no Win16 module - try Win32 :-) */
> + hInst = LoadLibraryA(lpszExeFileName);
> + if (hInst)
> + {
> + int i;
> + for (i=nIconIndex; i < nIconIndex + n; i++)
> + RetPtr[i-nIconIndex] =
> + (HICON16)LoadIconA(hInst, (LPCSTR)(DWORD)i);
> + FreeLibrary(hInst);
> + return hRet;
> + }
> + return 0;
> + }
>
> - *RetPtr = (n == 0xFFFF)? 0: 1; /* error return values */
> + *RetPtr = (n == 0xFFFF)? 0 : 1; /* error return values */
>
> sig = SHELL_GetResourceTable(hFile,&pData);
>
> @@ -903,7 +923,7 @@
> }
> RetPtr[i] =
>CreateIconFromResourceEx(idata,idataent->Size,TRUE,0x00030000,GetSystemMetrics(
SM_CXICON),GetSystemMetrics(SM_CYICON),0);
> }
> - goto end_3; /* sucess */
> + goto end_3; /* success */
> }
> goto end_1; /* return array with icon handles */
>
>