Alexandre Julliard : shell: Convert the about icon to 32-bit explicitly instead of casting the handle.

Alexandre Julliard julliard at winehq.org
Tue Jan 5 11:37:50 CST 2010


Module: wine
Branch: master
Commit: 67e1ac9a936a96647b0b9e1c53a59abd144c0397
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=67e1ac9a936a96647b0b9e1c53a59abd144c0397

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan  4 20:20:15 2010 +0100

shell: Convert the about icon to 32-bit explicitly instead of casting the handle.

---

 dlls/shell.dll16/shell.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/dlls/shell.dll16/shell.c b/dlls/shell.dll16/shell.c
index b33d3cc..b8d99fd 100644
--- a/dlls/shell.dll16/shell.c
+++ b/dlls/shell.dll16/shell.c
@@ -42,6 +42,7 @@
 #include "shlwapi.h"
 
 #include "wine/winbase16.h"
+#include "wine/winuser16.h"
 
 #include "wine/debug.h"
 
@@ -52,7 +53,6 @@ extern HINSTANCE WINAPI WOWShellExecute(HWND hWnd, LPCSTR lpOperation,LPCSTR lpF
                                         INT iShowCmd, void *callback);
 
 #define HICON_16(h32)		(LOWORD(h32))
-#define HICON_32(h16)		((HICON)(ULONG_PTR)(h16))
 #define HINSTANCE_32(h16)	((HINSTANCE)(ULONG_PTR)(h16))
 #define HINSTANCE_16(h32)	(LOWORD(h32))
 
@@ -73,6 +73,17 @@ static UINT	uMsgWndCreated = 0;
 static UINT	uMsgWndDestroyed = 0;
 static UINT	uMsgShellActivate = 0;
 
+static HICON convert_icon_to_32( HICON16 icon16 )
+{
+    CURSORICONINFO *info = GlobalLock16( icon16 );
+    void *and_bits = info + 1;
+    void *xor_bits = (BYTE *)and_bits + info->nHeight * 2 * ((info->nWidth + 15) / 16);
+    HICON ret = CreateIcon( 0, info->nWidth, info->nHeight, info->bPlanes, info->bBitsPerPixel,
+                            and_bits, xor_bits );
+    GlobalUnlock16( icon16 );
+    return ret;
+}
+
 /***********************************************************************
  * DllEntryPoint [SHELL.101]
  *
@@ -183,9 +194,12 @@ BOOL16 WINAPI AboutDlgProc16( HWND16 hWnd, UINT16 msg, WPARAM16 wParam,
 /*************************************************************************
  *             ShellAbout   (SHELL.22)
  */
-BOOL16 WINAPI ShellAbout16( HWND16 hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
-                            HICON16 hIcon )
-{ return ShellAboutA( HWND_32(hWnd), szApp, szOtherStuff, HICON_32(hIcon) );
+BOOL16 WINAPI ShellAbout16( HWND16 hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON16 icon16 )
+{
+    HICON icon = convert_icon_to_32( icon16 );
+    BOOL ret = ShellAboutA( HWND_32(hWnd), szApp, szOtherStuff, icon );
+    DestroyIcon( icon );
+    return ret;
 }
 
 /*************************************************************************




More information about the wine-cvs mailing list