PATCH: Convert HICON to a void*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

License: LGPL, X11
Changelog:
	Michael Stefaniuc <mstefani@redhat.com>
	- change the internal functions in windows/cursoricon.c to use
	  32bit handles
	- move the implementation of ExtractAssociatedIcon16 to
	  ExtractAssociatedIconA
	- convert HICON to a void*
	- fixed some handle conversions that happened to be in the way
	  while doing the above

bye
	michael
-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
System Administration           Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani@redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
Index: controls/static.c
===================================================================
RCS file: /home/wine/wine/controls/static.c,v
retrieving revision 1.37
diff -u -r1.37 static.c
--- controls/static.c	4 Sep 2002 19:37:01 -0000	1.37
+++ controls/static.c	8 Oct 2002 23:47:15 -0000
@@ -93,19 +93,19 @@
 static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style )
 {
     HICON prevIcon;
-    CURSORICONINFO *info = hicon?(CURSORICONINFO *) GlobalLock16( hicon ):NULL;
+    CURSORICONINFO *info = hicon?(CURSORICONINFO *) GlobalLock16(HICON_16(hicon)):NULL;
 
     if ((style & SS_TYPEMASK) != SS_ICON) return 0;
     if (hicon && !info) {
 	ERR("huh? hicon!=0, but info=0???\n");
     	return 0;
     }
-    prevIcon = SetWindowLongA( hwnd, HICON_GWL_OFFSET, hicon );
+    prevIcon = (HICON)SetWindowLongA( hwnd, HICON_GWL_OFFSET, (LONG)hicon );
     if (hicon)
     {
         SetWindowPos( hwnd, 0, 0, 0, info->nWidth, info->nHeight,
                         SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
-        GlobalUnlock16( hicon );
+        GlobalUnlock16(HICON_16(hicon));
     }
     return prevIcon;
 }
@@ -362,7 +362,7 @@
 	    lResult = STATIC_SetBitmap( hwnd, (HBITMAP)lParam, style );
 	    break;
 	case IMAGE_ICON:
-	    lResult = STATIC_SetIcon( hwnd, (HICON)lParam, style );
+	    lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)lParam, style );
 	    break;
 	default:
 	    FIXME("STM_SETIMAGE: Unhandled type %x\n", wParam);
@@ -373,7 +373,7 @@
 
     case STM_SETICON16:
     case STM_SETICON:
-        lResult = STATIC_SetIcon( hwnd, (HICON)wParam, style );
+        lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)wParam, style );
         InvalidateRect( hwnd, NULL, TRUE );
         break;
 
@@ -530,7 +530,7 @@
     GetClientRect( hwnd, &rc );
     hbrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, (LPARAM)hwnd );
     FillRect( hdc, &rc, hbrush );
-    if ((hIcon = GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
+    if ((hIcon = (HICON)GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
         DrawIcon( hdc, rc.left, rc.top, hIcon );
 }
 
@@ -546,7 +546,7 @@
     hbrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, (LPARAM)hwnd );
     FillRect( hdc, &rc, hbrush );
 
-    if ((hIcon = GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
+    if ((hIcon = (HICON)GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
     {
         BITMAP bm;
 	SIZE sz;
@@ -554,7 +554,7 @@
         if(GetObjectType(hIcon) != OBJ_BITMAP) return;
         if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
 	GetObjectW(hIcon, sizeof(bm), &bm);
-	GetBitmapDimensionEx(hIcon, &sz);
+	GetBitmapDimensionEx((HBITMAP)hIcon, &sz);
 	oldbitmap = SelectObject(hMemDC, hIcon);
 	BitBlt(hdc, sz.cx, sz.cy, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
 	       SRCCOPY);
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.187
diff -u -r1.187 listview.c
--- dlls/comctl32/listview.c	8 Oct 2002 01:55:32 -0000	1.187
+++ dlls/comctl32/listview.c	8 Oct 2002 23:47:20 -0000
@@ -8478,7 +8478,7 @@
     return (LRESULT)infoPtr->hwndHeader;
 
   case LVM_GETHOTCURSOR:
-    return infoPtr->hHotCursor;
+    return (LRESULT)infoPtr->hHotCursor;
 
   case LVM_GETHOTITEM:
     return infoPtr->nHotItem;
@@ -8656,7 +8656,7 @@
   /* case LVN_SETGROUPMETRICS: */
 
   case LVM_SETHOTCURSOR:
-    return LISTVIEW_SetHotCursor(infoPtr, (HCURSOR)lParam);
+    return (LRESULT)LISTVIEW_SetHotCursor(infoPtr, (HCURSOR)lParam);
 
   case LVM_SETHOTITEM:
     return LISTVIEW_SetHotItem(infoPtr, (INT)wParam);
Index: dlls/comctl32/propsheet.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/propsheet.c,v
retrieving revision 1.69
diff -u -r1.69 propsheet.c
--- dlls/comctl32/propsheet.c	6 Sep 2002 19:41:17 -0000	1.69
+++ dlls/comctl32/propsheet.c	8 Oct 2002 23:47:21 -0000
@@ -2566,11 +2566,11 @@
         else
           hIcon = psInfo->ppshheader.u.hIcon;
 
-        SendMessageW(hwnd, WM_SETICON, 0, hIcon);
+        SendMessageW(hwnd, WM_SETICON, 0, (LPARAM)hIcon);
       }
 
       if (psInfo->ppshheader.dwFlags & PSH_USEHICON)
-        SendMessageW(hwnd, WM_SETICON, 0, psInfo->ppshheader.u.hIcon);
+        SendMessageW(hwnd, WM_SETICON, 0, (LPARAM)psInfo->ppshheader.u.hIcon);
 
       psInfo->strPropertiesFor = strCaption;
 
Index: dlls/comctl32/status.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/status.c,v
retrieving revision 1.51
diff -u -r1.51 status.c
--- dlls/comctl32/status.c	24 Sep 2002 18:26:43 -0000	1.51
+++ dlls/comctl32/status.c	8 Oct 2002 23:47:22 -0000
@@ -1112,7 +1112,7 @@
 	    return STATUSBAR_GetBorders ((INT *)lParam);
 
 	case SB_GETICON:
-	    return STATUSBAR_GetIcon (infoPtr, nPart);
+	    return (LRESULT)STATUSBAR_GetIcon (infoPtr, nPart);
 
 	case SB_GETPARTS:
 	    return STATUSBAR_GetParts (infoPtr, (INT)wParam, (INT *)lParam);
Index: dlls/commdlg/filedlg.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/filedlg.c,v
retrieving revision 1.53
diff -u -r1.53 filedlg.c
--- dlls/commdlg/filedlg.c	16 Sep 2002 22:47:05 -0000	1.53
+++ dlls/commdlg/filedlg.c	8 Oct 2002 23:47:22 -0000
@@ -69,12 +69,12 @@
 static const WCHAR FILE_bslash[] = {'\\', 0};
 static const WCHAR FILE_specc[] = {'%','c',':', 0};
 
-static HICON16 hFolder = 0;
-static HICON16 hFolder2 = 0;
-static HICON16 hFloppy = 0;
-static HICON16 hHDisk = 0;
-static HICON16 hCDRom = 0;
-static HICON16 hNet = 0;
+static HICON hFolder = 0;
+static HICON hFolder2 = 0;
+static HICON hFloppy = 0;
+static HICON hHDisk = 0;
+static HICON hCDRom = 0;
+static HICON hNet = 0;
 static const int fldrHeight = 16;
 static const int fldrWidth = 20;
 
Index: dlls/ole32/ole2.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2.c,v
retrieving revision 1.33
diff -u -r1.33 ole2.c
--- dlls/ole32/ole2.c	28 Aug 2002 00:39:39 -0000	1.33
+++ dlls/ole32/ole2.c	8 Oct 2002 23:47:23 -0000
@@ -49,6 +49,10 @@
 WINE_DECLARE_DEBUG_CHANNEL(accel);
 
 #define HACCEL_16(h32)		(LOWORD(h32))
+#define HICON_16(h32)		(LOWORD(h32))
+
+#define HDC_32(h16)		((HDC)(ULONG_PTR)(h16))
+#define HICON_32(h16)		((HICON)(ULONG_PTR)(h16))
 
 /******************************************************************************
  * These are static/global variables and internal data structures that the
@@ -2241,15 +2245,15 @@
 	    HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile);
 
 	    /* load the icon at index from lpszSourceFile */
-	    hIcon = (HICON16)LoadIconA(hInstance, (LPCSTR)(DWORD)iIconIndex);
+	    hIcon = HICON_16(LoadIconA(hInstance, (LPCSTR)(DWORD)iIconIndex));
 	    FreeLibrary16(hInstance);
 	} else
 	    return (HGLOBAL)NULL;
     }
 
     hdc = CreateMetaFile16(NULL);
-    DrawIcon(hdc, 0, 0, hIcon); /* FIXME */
-    TextOutA(hdc, 0, 0, lpszLabel, 1); /* FIXME */
+    DrawIcon(HDC_32(hdc), 0, 0, HICON_32(hIcon)); /* FIXME */
+    TextOutA(HDC_32(hdc), 0, 0, lpszLabel, 1); /* FIXME */
     hmf = GlobalAlloc16(0, sizeof(METAFILEPICT16));
     mf = (METAFILEPICT16 *)GlobalLock16(hmf);
     mf->mm = MM_ANISOTROPIC;
Index: dlls/shell32/dialogs.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/dialogs.c,v
retrieving revision 1.9
diff -u -r1.9 dialogs.c
--- dlls/shell32/dialogs.c	28 Aug 2002 23:42:34 -0000	1.9
+++ dlls/shell32/dialogs.c	8 Oct 2002 23:47:24 -0000
@@ -120,7 +120,7 @@
         case WM_INITDIALOG :
             prfdp = (RUNFILEDLGPARAMS *)lParam ;
             SetWindowTextA (hwnd, prfdp->lpstrTitle) ;
-            SetClassLongA (hwnd, GCL_HICON, prfdp->hIcon) ;
+            SetClassLongA (hwnd, GCL_HICON, (LPARAM)prfdp->hIcon) ;
             SendMessageA (GetDlgItem (hwnd, 12297), STM_SETICON, (WPARAM)LoadIconA ((HINSTANCE)NULL, IDI_WINLOGOA), 0) ;
             FillList (GetDlgItem (hwnd, 12298), NULL) ;
             SetFocus (GetDlgItem (hwnd, 12298)) ;
Index: dlls/shell32/iconcache.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/iconcache.c,v
retrieving revision 1.58
diff -u -r1.58 iconcache.c
--- dlls/shell32/iconcache.c	17 Aug 2002 00:43:17 -0000	1.58
+++ dlls/shell32/iconcache.c	8 Oct 2002 23:47:24 -0000
@@ -197,7 +197,7 @@
 
 	if (INVALID_INDEX == index)
 	{
-	  return INVALID_INDEX;
+	  return (HICON)INVALID_INDEX;
 	}
 
 	if (bSmallIcon)
@@ -415,11 +415,11 @@
 	TRACE("file=%s idx=%i %p %p num=%i\n", lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons );
 
 	if (nIconIndex==-1)	/* Number of icons requested */
-            return PrivateExtractIconsA( lpszFile, -1, 0, 0, NULL, 0, 0, 0 );
+            return (HICON)PrivateExtractIconsA( lpszFile, -1, 0, 0, NULL, 0, 0, 0 );
 
 	if (phiconLarge)
         {
-          ret = PrivateExtractIconsA( lpszFile, nIconIndex, 32, 32, phiconLarge, 0, nIcons, 0 );
+          ret = (HICON)PrivateExtractIconsA( lpszFile, nIconIndex, 32, 32, phiconLarge, 0, nIcons, 0 );
 	  if ( nIcons==1)
 	  { ret = phiconLarge[0];
 	  }
@@ -431,7 +431,7 @@
 
 	if (phiconSmall)
         {
-          ret = PrivateExtractIconsA( lpszFile, nIconIndex, 16, 16, phiconSmall, 0, nIcons, 0 );
+          ret = (HICON)PrivateExtractIconsA( lpszFile, nIconIndex, 16, 16, phiconSmall, 0, nIcons, 0 );
 	  if ( nIcons==1 )
 	  { ret = phiconSmall[0];
 	  }
@@ -444,7 +444,7 @@
  */
 HICON WINAPI ExtractIconExW ( LPCWSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons )
 {	LPSTR sFile;
-	DWORD ret;
+	HICON ret;
 
 	TRACE("file=%s idx=%i %p %p num=%i\n", debugstr_w(lpszFile), nIconIndex, phiconLarge, phiconSmall, nIcons );
 
@@ -461,8 +461,40 @@
  * executable) and patch parameters if needed.
  */
 HICON WINAPI ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lpiIcon)
-{	TRACE("\n");
-	return ExtractAssociatedIcon16(hInst,lpIconPath,lpiIcon);
+{	
+	HICON hIcon;
+	WORD wDummyIcon = 0;
+	
+	TRACE("\n");
+
+	if(lpiIcon == NULL)
+	    lpiIcon = &wDummyIcon;
+
+	hIcon = ExtractIconA(hInst, lpIconPath, *lpiIcon);
+
+	if( hIcon < (HICON)2 )
+	{ if( hIcon == (HICON)1 ) /* no icons found in given file */
+	  { char  tempPath[0x80];
+	    UINT16  uRet = FindExecutable16(lpIconPath,NULL,tempPath);
+
+	    if( uRet > 32 && tempPath[0] )
+	    { strcpy(lpIconPath,tempPath);
+	      hIcon = ExtractIconA(hInst, lpIconPath, *lpiIcon);
+	      if( hIcon > (HICON)2 )
+	        return hIcon;
+	    }
+	    else hIcon = 0;
+	  }
+
+	  if( hIcon == (HICON)1 )
+	    *lpiIcon = 2;   /* MSDOS icon - we found .exe but no icons in it */
+	  else
+	    *lpiIcon = 6;   /* generic icon - found nothing */
+
+	  GetModuleFileName16(hInst, lpIconPath, 0x80);
+	  hIcon = LoadIconA( hInst, MAKEINTRESOURCEA(*lpiIcon));
+	}
+	return hIcon;
 }
 
 /*************************************************************************
Index: dlls/shell32/shell.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell.c,v
retrieving revision 1.45
diff -u -r1.45 shell.c
--- dlls/shell32/shell.c	6 Sep 2002 19:41:18 -0000	1.45
+++ dlls/shell32/shell.c	8 Oct 2002 23:47:24 -0000
@@ -207,7 +207,7 @@
  */
 BOOL16 WINAPI ShellAbout16( HWND16 hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
                             HICON16 hIcon )
-{ return ShellAboutA( HWND_32(hWnd), szApp, szOtherStuff, hIcon );
+{ return ShellAboutA( HWND_32(hWnd), szApp, szOtherStuff, HICON_32(hIcon) );
 }
 
 /*************************************************************************
@@ -245,7 +245,7 @@
 	    int i;
 	    for (i=nIconIndex; i < nIconIndex + n; i++)
 	      RetPtr[i-nIconIndex] =
-		      (HICON16)LoadIconA(hInst, (LPCSTR)(DWORD)i);
+		      HICON_16(LoadIconA(hInst, (LPCSTR)(DWORD)i));
 	    FreeLibrary(hInst);
 	    return hRet;
 	  }
@@ -269,7 +269,7 @@
             if (!res)
             {
                 int i;
-                for (i = 0; i < n; i++) RetPtr[i] = (HICON16)icons[i];
+                for (i = 0; i < n; i++) RetPtr[i] = HICON_16(icons[i]);
             }
             else
             {
@@ -287,7 +287,7 @@
 HICON16 WINAPI ExtractIcon16( HINSTANCE16 hInstance, LPCSTR lpszExeFileName,
 	UINT16 nIconIndex )
 {   TRACE("\n");
-    return ExtractIconA( hInstance, lpszExeFileName, nIconIndex );
+    return HICON_16(ExtractIconA(HINSTANCE_32(hInstance), lpszExeFileName, nIconIndex));
 }
 
 /*************************************************************************
@@ -309,15 +309,15 @@
     	ismall = (HICON*)HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON));
     else
     	ismall = NULL;
-    ret = ExtractIconExA(lpszFile,nIconIndex,ilarge,ismall,nIcons);
+    ret = HICON_16(ExtractIconExA(lpszFile,nIconIndex,ilarge,ismall,nIcons));
     if (ilarge) {
     	for (i=0;i<nIcons;i++)
-	    phiconLarge[i]=ilarge[i];
+	    phiconLarge[i]=HICON_16(ilarge[i]);
 	HeapFree(GetProcessHeap(),0,ilarge);
     }
     if (ismall) {
     	for (i=0;i<nIcons;i++)
-	    phiconSmall[i]=ismall[i];
+	    phiconSmall[i]=HICON_16(ismall[i]);
 	HeapFree(GetProcessHeap(),0,ismall);
     }
     return ret;
@@ -330,39 +330,9 @@
  * executable) and patch parameters if needed.
  */
 HICON16 WINAPI ExtractAssociatedIcon16(HINSTANCE16 hInst, LPSTR lpIconPath, LPWORD lpiIcon)
-{	HICON16 hIcon;
-	WORD wDummyIcon = 0;
-
-	TRACE("\n");
-
-	if(lpiIcon == NULL)
-	    lpiIcon = &wDummyIcon;
-
-	hIcon = ExtractIcon16(hInst, lpIconPath, *lpiIcon);
-
-	if( hIcon < 2 )
-	{ if( hIcon == 1 ) /* no icons found in given file */
-	  { char  tempPath[0x80];
-	    UINT16  uRet = FindExecutable16(lpIconPath,NULL,tempPath);
-
-	    if( uRet > 32 && tempPath[0] )
-	    { strcpy(lpIconPath,tempPath);
-	      hIcon = ExtractIcon16(hInst, lpIconPath, *lpiIcon);
-	      if( hIcon > 2 )
-	        return hIcon;
-	    }
-	    else hIcon = 0;
-	  }
-
-	  if( hIcon == 1 )
-	    *lpiIcon = 2;   /* MSDOS icon - we found .exe but no icons in it */
-	  else
-	    *lpiIcon = 6;   /* generic icon - found nothing */
-
-	  GetModuleFileName16(hInst, lpIconPath, 0x80);
-	  hIcon = LoadIconA( hInst, MAKEINTRESOURCEA(*lpiIcon));
-	}
-	return hIcon;
+{
+    return HICON_16(ExtractAssociatedIconA(HINSTANCE_32(hInst), lpIconPath,
+		    lpiIcon));
 }
 
 /*************************************************************************
Index: dlls/shell32/shell32_main.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32_main.c,v
retrieving revision 1.99
diff -u -r1.99 shell32_main.c
--- dlls/shell32/shell32_main.c	6 Sep 2002 19:41:18 -0000	1.99
+++ dlls/shell32/shell32_main.c	8 Oct 2002 23:47:25 -0000
@@ -531,7 +531,7 @@
 	HICON16  hIcon = *ptr;
 
 	GlobalFree16(handle);
-	return hIcon;
+	return HICON_32(hIcon);
     }
     return 0;
 }
@@ -567,7 +567,7 @@
 #define		DROP_FIELD_TOP		(-15)
 #define		DROP_FIELD_HEIGHT	15
 
-static HICON hIconTitleFont;
+static HFONT hIconTitleFont;
 
 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
@@ -674,7 +674,7 @@
       { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
             if (info)
         { const char* const *pstr = SHELL_People;
-                SendDlgItemMessageA(hWnd, stc1, STM_SETICON,info->hIcon, 0);
+                SendDlgItemMessageA(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
                 GetWindowTextA( hWnd, Template, sizeof(Template) );
                 sprintf( AppTitle, Template, info->szApp );
                 SetWindowTextA( hWnd, AppTitle );
Index: dlls/shell32/shell32_main.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32_main.h,v
retrieving revision 1.52
diff -u -r1.52 shell32_main.h
--- dlls/shell32/shell32_main.h	6 Sep 2002 19:41:18 -0000	1.52
+++ dlls/shell32/shell32_main.h	8 Oct 2002 23:47:25 -0000
@@ -197,6 +197,9 @@
 }
 
 /* handle conversions */
+#define HICON_16(h32)		(LOWORD(h32))
+#define HICON_32(h16)		((HICON)(ULONG_PTR)(h16))
+#define HINSTANCE_32(h16)	((HINSTANCE)(ULONG_PTR)(h16))
 #define HWND_32(h16)		((HWND)(ULONG_PTR)(h16))
 
 #endif
Index: dlls/shlwapi/ordinal.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/ordinal.c,v
retrieving revision 1.56
diff -u -r1.56 ordinal.c
--- dlls/shlwapi/ordinal.c	3 Oct 2002 19:46:27 -0000	1.56
+++ dlls/shlwapi/ordinal.c	8 Oct 2002 23:47:26 -0000
@@ -2209,7 +2209,7 @@
 DWORD WINAPI SHLWAPI_336(LPSHFILEOPSTRUCTW lpFileOp)
 {
   GET_FUNC(pSHFileOperationW, shell32, "SHFileOperationW", 0);
-  return pSHFileOperationW(lpFileOp);
+  return (DWORD)pSHFileOperationW(lpFileOp);
 }
 
 /*************************************************************************
Index: dlls/user/controls.h
===================================================================
RCS file: /home/wine/wine/dlls/user/controls.h,v
retrieving revision 1.9
diff -u -r1.9 controls.h
--- dlls/user/controls.h	9 Mar 2002 23:44:30 -0000	1.9
+++ dlls/user/controls.h	8 Oct 2002 23:47:26 -0000
@@ -139,4 +139,14 @@
 
 extern BOOL DIALOG_Init(void);
 
+/* handle => handle16 conversions */
+#define HBRUSH_16(h32)		(LOWORD(h32))
+#define HCURSOR_16(h32)		(LOWORD(h32))
+#define HICON_16(h32)		(LOWORD(h32))
+
+/* handle16 => handle conversions */
+#define HBRUSH_32(h16)		((HBRUSH)(ULONG_PTR)(h16))
+#define HCURSOR_32(h16)		((HCURSOR)(ULONG_PTR)(h16))
+#define HICON_32(h16)		((HICON)(ULONG_PTR)(h16))
+
 #endif  /* __WINE_CONTROLS_H */
Index: dlls/user/exticon.c
===================================================================
RCS file: /home/wine/wine/dlls/user/exticon.c,v
retrieving revision 1.20
diff -u -r1.20 exticon.c
--- dlls/user/exticon.c	17 Aug 2002 00:43:17 -0000	1.20
+++ dlls/user/exticon.c	8 Oct 2002 23:47:26 -0000
@@ -340,17 +340,17 @@
 	        /* .ICO files have only one icon directory */
 	        if( lpiID == NULL )	/* *.ico */
 	          pCIDir = USER32_LoadResource( peimage, pIconDir + i, *(WORD*)pData, &uSize );
-	        RetPtr[i-nIconIndex] = LookupIconIdFromDirectoryEx( pCIDir, TRUE, cxDesired, cyDesired, 0);
+	        RetPtr[i-nIconIndex] = (HICON)LookupIconIdFromDirectoryEx( pCIDir, TRUE, cxDesired, cyDesired, 0);
 	      }
 
 	      for( icon = nIconIndex; icon < nIconIndex + nIcons; icon++ )
 	      {
 	        pCIDir = NULL;
 	        if( lpiID )
-	          pCIDir = ICO_LoadIcon( peimage, lpiID->idEntries + RetPtr[icon-nIconIndex], &uSize);
+	          pCIDir = ICO_LoadIcon( peimage, lpiID->idEntries + (int)RetPtr[icon-nIconIndex], &uSize);
 	        else
 		  for( i = 0; i < iconCount; i++ )
-		    if( pIconStorage[i].id == (RetPtr[icon-nIconIndex] | 0x8000) )
+		    if( pIconStorage[i].id == ((int)RetPtr[icon-nIconIndex] | 0x8000) )
 		      pCIDir = USER32_LoadResource( peimage, pIconStorage + i,*(WORD*)pData, &uSize );
 
 	        if( pCIDir )
@@ -508,7 +508,7 @@
 	  for (i=0; i<nIcons; i++)
 	  {
               const IMAGE_RESOURCE_DIRECTORY *xresdir;
-              xresdir = find_entry_by_id(iconresdir,RetPtr[i],rootresdir);
+              xresdir = find_entry_by_id(iconresdir,LOWORD(RetPtr[i]),rootresdir);
               xresdir = find_entry_default(xresdir,rootresdir);
 	    idataent = (PIMAGE_RESOURCE_DATA_ENTRY)xresdir;
 	    idata = NULL;
Index: dlls/x11drv/desktop.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/desktop.c,v
retrieving revision 1.7
diff -u -r1.7 desktop.c
--- dlls/x11drv/desktop.c	13 Jun 2002 19:11:21 -0000	1.7
+++ dlls/x11drv/desktop.c	8 Oct 2002 23:47:27 -0000
@@ -46,7 +46,7 @@
         break;
 
     case WM_SETCURSOR:
-        return SetCursor( LoadCursorA( 0, IDC_ARROWA ) );
+        return (LRESULT)SetCursor( LoadCursorA( 0, IDC_ARROWA ) );
 
     case WM_NCHITTEST:
         return HTCLIENT;
Index: dlls/x11drv/window.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/window.c,v
retrieving revision 1.41
diff -u -r1.41 window.c
--- dlls/x11drv/window.c	24 Sep 2002 18:36:51 -0000	1.41
+++ dlls/x11drv/window.c	8 Oct 2002 23:47:27 -0000
@@ -236,7 +236,7 @@
 static void set_icon_hints( Display *display, WND *wndPtr, XWMHints *hints )
 {
     X11DRV_WND_DATA *data = wndPtr->pDriverData;
-    HICON hIcon = GetClassLongA( wndPtr->hwndSelf, GCL_HICON );
+    HICON hIcon = (HICON)GetClassLongA( wndPtr->hwndSelf, GCL_HICON );
 
     if (data->hWMIconBitmap) DeleteObject( data->hWMIconBitmap );
     if (data->hWMIconMask) DeleteObject( data->hWMIconMask);
@@ -1206,7 +1206,7 @@
 {
     WND *wndPtr;
     Display *display = thread_display();
-    HICON old = SetClassLongW( hwnd, small ? GCL_HICONSM : GCL_HICON, icon );
+    HICON old = (HICON)SetClassLongW(hwnd, small ? GCL_HICONSM : GCL_HICON, (LONG)icon );
 
     SetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE |
                   SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER );
Index: dlls/x11drv/winpos.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/winpos.c,v
retrieving revision 1.51
diff -u -r1.51 winpos.c
--- dlls/x11drv/winpos.c	24 Sep 2002 18:36:51 -0000	1.51
+++ dlls/x11drv/winpos.c	8 Oct 2002 23:47:28 -0000
@@ -1840,7 +1840,7 @@
     HDC hdc;
     HWND parent;
     LONG hittest = (LONG)(wParam & 0x0f);
-    HCURSOR16 hDragCursor = 0, hOldCursor = 0;
+    HCURSOR hDragCursor = 0, hOldCursor = 0;
     POINT minTrack, maxTrack;
     POINT capturePoint, pt;
     LONG style = GetWindowLongA( hwnd, GWL_STYLE );
@@ -1929,7 +1929,7 @@
 
     if( iconic ) /* create a cursor for dragging */
     {
-        hDragCursor = GetClassLongA( hwnd, GCL_HICON);
+        hDragCursor = (HCURSOR)GetClassLongA( hwnd, GCL_HICON);
         if( !hDragCursor ) hDragCursor = (HCURSOR)SendMessageA( hwnd, WM_QUERYDRAGICON, 0, 0L);
         if( !hDragCursor ) iconic = FALSE;
     }
Index: graphics/x11drv/bitmap.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/bitmap.c,v
retrieving revision 1.41
diff -u -r1.41 bitmap.c
--- graphics/x11drv/bitmap.c	24 Sep 2002 18:36:51 -0000	1.41
+++ graphics/x11drv/bitmap.c	8 Oct 2002 23:47:29 -0000
@@ -493,7 +493,7 @@
     width = pBmp->bitmap.bmWidth;
     height = pBmp->bitmap.bmHeight;
 
-    hBmpCopy = CopyImage(hBmp, IMAGE_BITMAP, width, height, LR_CREATEDIBSECTION);
+    hBmpCopy = (HBITMAP)CopyImage(hBmp, IMAGE_BITMAP, width, height, LR_CREATEDIBSECTION);
 
     /* We can now get rid of the HBITMAP wrapper we created earlier.
      * Note: Simply calling DeleteObject will free the embedded Pixmap as well.
Index: include/cursoricon.h
===================================================================
RCS file: /home/wine/wine/include/cursoricon.h,v
retrieving revision 1.17
diff -u -r1.17 cursoricon.h
--- include/cursoricon.h	2 Jun 2002 21:29:23 -0000	1.17
+++ include/cursoricon.h	8 Oct 2002 23:47:29 -0000
@@ -84,13 +84,6 @@
 #define CID_WIN32     0x0004
 #define CID_NONSHARED 0x0008
 
-extern HGLOBAL CURSORICON_Load( HINSTANCE hInstance, LPCWSTR name,
-                                int width, int height, int colors,
-                                BOOL fCursor, UINT loadflags);
-
-extern HGLOBAL CURSORICON_ExtCopy(HGLOBAL handle, UINT type,
-				  INT desiredx, INT desiredy,
-				  UINT flags);
 extern void CURSORICON_FreeModuleIcons( HMODULE hModule );
 
 #endif /* __WINE_CURSORICON_H */
Index: include/windef.h
===================================================================
RCS file: /home/wine/wine/include/windef.h,v
retrieving revision 1.75
diff -u -r1.75 windef.h
--- include/windef.h	24 Sep 2002 03:09:12 -0000	1.75
+++ include/windef.h	8 Oct 2002 23:47:29 -0000
@@ -80,7 +80,7 @@
 DECLARE_HANDLE(HENHMETAFILE);
 DECLARE_OLD_HANDLE(HFONT);
 DECLARE_HANDLE(HHOOK);
-DECLARE_OLD_HANDLE(HICON);
+DECLARE_HANDLE(HICON);
 DECLARE_OLD_HANDLE(HINSTANCE);
 DECLARE_HANDLE(HKEY);
 DECLARE_HANDLE(HKL);
Index: windows/class.c
===================================================================
RCS file: /home/wine/wine/windows/class.c,v
retrieving revision 1.49
diff -u -r1.49 class.c
--- windows/class.c	31 May 2002 23:06:54 -0000	1.49
+++ windows/class.c	8 Oct 2002 23:47:30 -0000
@@ -553,12 +553,12 @@
     iSmIconWidth  = GetSystemMetrics(SM_CXSMICON);
     iSmIconHeight = GetSystemMetrics(SM_CYSMICON);
 
-    classPtr->hIcon         = wc->hIcon;
+    classPtr->hIcon         = HICON_32(wc->hIcon);
     classPtr->hIconSm       = CopyImage(wc->hIcon, IMAGE_ICON,
 					iSmIconWidth, iSmIconHeight,
 					LR_COPYFROMRESOURCE);
-    classPtr->hCursor       = wc->hCursor;
-    classPtr->hbrBackground = wc->hbrBackground;
+    classPtr->hCursor       = HCURSOR_32(wc->hCursor);
+    classPtr->hbrBackground = HBRUSH_32(wc->hbrBackground);
 
     WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc,
                      WIN_PROC_16, WIN_PROC_CLASS );
@@ -602,8 +602,8 @@
     classPtr->hIconSm       = CopyImage(wc->hIcon, IMAGE_ICON,
 					iSmIconWidth, iSmIconHeight,
 					LR_COPYFROMRESOURCE);
-    classPtr->hCursor       = (HCURSOR16)wc->hCursor;
-    classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground;
+    classPtr->hCursor       = wc->hCursor;
+    classPtr->hbrBackground = wc->hbrBackground;
 
     WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc,
                      WIN_PROC_32A, WIN_PROC_CLASS );
@@ -642,8 +642,8 @@
     classPtr->hIconSm       = CopyImage(wc->hIcon, IMAGE_ICON,
 					iSmIconWidth, iSmIconHeight,
 					LR_COPYFROMRESOURCE);
-    classPtr->hCursor       = (HCURSOR16)wc->hCursor;
-    classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground;
+    classPtr->hCursor       = wc->hCursor;
+    classPtr->hbrBackground = wc->hbrBackground;
 
     WINPROC_SetProc( &classPtr->winprocW, (HWINDOWPROC)wc->lpfnWndProc,
                      WIN_PROC_32W, WIN_PROC_CLASS );
@@ -674,10 +674,10 @@
                    wc->hbrBackground, wc->style, wc->cbClsExtra,
                    wc->cbWndExtra, classPtr );
 
-    classPtr->hIcon         = wc->hIcon;
-    classPtr->hIconSm       = wc->hIconSm;
-    classPtr->hCursor       = wc->hCursor;
-    classPtr->hbrBackground = wc->hbrBackground;
+    classPtr->hIcon         = HICON_32(wc->hIcon);
+    classPtr->hIconSm       = HICON_32(wc->hIconSm);
+    classPtr->hCursor       = HCURSOR_32(wc->hCursor);
+    classPtr->hbrBackground = HBRUSH_32(wc->hbrBackground);
 
     WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc,
                      WIN_PROC_16, WIN_PROC_CLASS );
@@ -708,10 +708,10 @@
                    wc->hbrBackground, wc->style, wc->cbClsExtra,
                    wc->cbWndExtra, classPtr );
 
-    classPtr->hIcon         = (HICON16)wc->hIcon;
-    classPtr->hIconSm       = (HICON16)wc->hIconSm;
-    classPtr->hCursor       = (HCURSOR16)wc->hCursor;
-    classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground;
+    classPtr->hIcon         = wc->hIcon;
+    classPtr->hIconSm       = wc->hIconSm;
+    classPtr->hCursor       = wc->hCursor;
+    classPtr->hbrBackground = wc->hbrBackground;
     WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc,
                      WIN_PROC_32A, WIN_PROC_CLASS );
     CLASS_SetMenuNameA( classPtr, wc->lpszMenuName );
@@ -741,10 +741,10 @@
                    wc->hbrBackground, wc->style, wc->cbClsExtra,
                    wc->cbWndExtra, classPtr );
 
-    classPtr->hIcon         = (HICON16)wc->hIcon;
-    classPtr->hIconSm       = (HICON16)wc->hIconSm;
-    classPtr->hCursor       = (HCURSOR16)wc->hCursor;
-    classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground;
+    classPtr->hIcon         = wc->hIcon;
+    classPtr->hIconSm       = wc->hIconSm;
+    classPtr->hCursor       = wc->hCursor;
+    classPtr->hbrBackground = wc->hbrBackground;
     WINPROC_SetProc( &classPtr->winprocW, (HWINDOWPROC)wc->lpfnWndProc,
                      WIN_PROC_32W, WIN_PROC_CLASS );
     CLASS_SetMenuNameW( classPtr, wc->lpszMenuName );
@@ -1014,15 +1014,15 @@
         break;
     case GCL_HCURSOR:
         retval = (LONG)class->hCursor;
-        class->hCursor = newval;
+        class->hCursor = (HCURSOR)newval;
         break;
     case GCL_HICON:
         retval = (LONG)class->hIcon;
-        class->hIcon = newval;
+        class->hIcon = (HICON)newval;
         break;
     case GCL_HICONSM:
         retval = (LONG)class->hIconSm;
-        class->hIconSm = newval;
+        class->hIconSm = (HICON)newval;
         break;
     case GCL_STYLE:
         retval = (LONG)class->style;
@@ -1125,9 +1125,9 @@
     wc->cbClsExtra    = (INT16)classPtr->cbClsExtra;
     wc->cbWndExtra    = (INT16)classPtr->cbWndExtra;
     wc->hInstance     = classPtr->style & CS_GLOBALCLASS ? GetModuleHandle16("USER") : (HINSTANCE16)classPtr->hInstance;
-    wc->hIcon         = classPtr->hIcon;
-    wc->hCursor       = classPtr->hCursor;
-    wc->hbrBackground = classPtr->hbrBackground;
+    wc->hIcon         = HICON_16(classPtr->hIcon);
+    wc->hCursor       = HCURSOR_16(classPtr->hCursor);
+    wc->hbrBackground = HBRUSH_16(classPtr->hbrBackground);
     wc->lpszClassName = name;
     wc->lpszMenuName  = CLASS_GetMenuName16( classPtr );
     return TRUE;
@@ -1234,10 +1234,10 @@
     wc->cbClsExtra    = (INT16)classPtr->cbClsExtra;
     wc->cbWndExtra    = (INT16)classPtr->cbWndExtra;
     wc->hInstance     = (HINSTANCE16)classPtr->hInstance;
-    wc->hIcon         = classPtr->hIcon;
-    wc->hIconSm       = classPtr->hIconSm;
-    wc->hCursor       = classPtr->hCursor;
-    wc->hbrBackground = classPtr->hbrBackground;
+    wc->hIcon         = HICON_16(classPtr->hIcon);
+    wc->hIconSm       = HICON_16(classPtr->hIconSm);
+    wc->hCursor       = HCURSOR_16(classPtr->hCursor);
+    wc->hbrBackground = HBRUSH_16(classPtr->hbrBackground);
     wc->lpszClassName = (SEGPTR)0;
     wc->lpszMenuName  = CLASS_GetMenuName16( classPtr );
     wc->lpszClassName = name;
Index: windows/cursoricon.c
===================================================================
RCS file: /home/wine/wine/windows/cursoricon.c,v
retrieving revision 1.53
diff -u -r1.53 cursoricon.c
--- windows/cursoricon.c	27 Sep 2002 22:04:54 -0000	1.53
+++ windows/cursoricon.c	8 Oct 2002 23:47:31 -0000
@@ -66,6 +66,17 @@
 WINE_DECLARE_DEBUG_CHANNEL(icon);
 WINE_DECLARE_DEBUG_CHANNEL(resource);
 
+/* handle conversions */
+#define HCURSOR_16(h32)		(LOWORD(h32))
+#define HGLOBAL_16(h32)		(LOWORD(h32))
+#define HICON_16(h32)		(LOWORD(h32))
+#define HINSTANCE_16(h32)	(LOWORD(h32))
+
+#define HCURSOR_32(h16)		((HCURSOR)(ULONG_PTR)(h16))
+#define HICON_32(h16)		((HICON)(ULONG_PTR)(h16))
+#define HINSTANCE_32(h16)	((HINSTANCE)(ULONG_PTR)(h16))
+#define HMODULE_32(h16)		((HMODULE)(ULONG_PTR)(h16))
+
 static RECT CURSOR_ClipRect;       /* Cursor clipping rect */
 
 static HDC screen_dc;
@@ -84,7 +95,7 @@
     HMODULE              hModule;
     HRSRC                hRsrc;
     HRSRC                hGroupRsrc;
-    HANDLE               handle;
+    HICON                hIcon;
 
     INT                  count;
 
@@ -157,9 +168,9 @@
 /**********************************************************************
  *	    CURSORICON_FindSharedIcon
  */
-static HANDLE CURSORICON_FindSharedIcon( HMODULE hModule, HRSRC hRsrc )
+static HICON CURSORICON_FindSharedIcon( HMODULE hModule, HRSRC hRsrc )
 {
-    HANDLE handle = 0;
+    HICON hIcon = 0;
     ICONCACHE *ptr;
 
     EnterCriticalSection( &IconCrst );
@@ -168,13 +179,13 @@
         if ( ptr->hModule == hModule && ptr->hRsrc == hRsrc )
         {
             ptr->count++;
-            handle = ptr->handle;
+            hIcon = ptr->hIcon;
             break;
         }
 
     LeaveCriticalSection( &IconCrst );
 
-    return handle;
+    return hIcon;
 }
 
 /*************************************************************************
@@ -190,7 +201,7 @@
  *     Failure: NULL
  *
  */
-static ICONCACHE* CURSORICON_FindCache(HANDLE handle)
+static ICONCACHE* CURSORICON_FindCache(HICON hIcon)
 {
     ICONCACHE *ptr;
     ICONCACHE *pRet=NULL;
@@ -201,7 +212,7 @@
 
     for (count = 0, ptr = IconAnchor; ptr != NULL && !IsFound; ptr = ptr->next, count++ )
     {
-        if ( handle == ptr->handle )
+        if ( hIcon == ptr->hIcon )
         {
             IsFound = TRUE;
             pRet = ptr;
@@ -216,14 +227,14 @@
 /**********************************************************************
  *	    CURSORICON_AddSharedIcon
  */
-static void CURSORICON_AddSharedIcon( HMODULE hModule, HRSRC hRsrc, HRSRC hGroupRsrc, HANDLE handle )
+static void CURSORICON_AddSharedIcon( HMODULE hModule, HRSRC hRsrc, HRSRC hGroupRsrc, HICON hIcon )
 {
     ICONCACHE *ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(ICONCACHE) );
     if ( !ptr ) return;
 
     ptr->hModule = hModule;
     ptr->hRsrc   = hRsrc;
-    ptr->handle  = handle;
+    ptr->hIcon  = hIcon;
     ptr->hGroupRsrc = hGroupRsrc;
     ptr->count   = 1;
 
@@ -236,7 +247,7 @@
 /**********************************************************************
  *	    CURSORICON_DelSharedIcon
  */
-static INT CURSORICON_DelSharedIcon( HANDLE handle )
+static INT CURSORICON_DelSharedIcon( HICON hIcon )
 {
     INT count = -1;
     ICONCACHE *ptr;
@@ -244,7 +255,7 @@
     EnterCriticalSection( &IconCrst );
 
     for ( ptr = IconAnchor; ptr; ptr = ptr->next )
-        if ( ptr->handle == handle )
+        if ( ptr->hIcon == hIcon )
         {
             if ( ptr->count > 0 ) ptr->count--;
             count = ptr->count;
@@ -277,7 +288,7 @@
             ICONCACHE *freePtr = *ptr;
             *ptr = freePtr->next;
 
-            GlobalFree16( freePtr->handle );
+            GlobalFree16(HICON_16(freePtr->hIcon));
             HeapFree( GetProcessHeap(), 0, freePtr );
             continue;
         }
@@ -405,7 +416,7 @@
  *		directly from corresponding DIB sections
  * Note: wResId is index to array of pointer returned in ptrs (origin is 1)
  */
-BOOL CURSORICON_SimulateLoadingFromResourceW( LPWSTR filename, BOOL fCursor,
+static BOOL CURSORICON_SimulateLoadingFromResourceW( LPWSTR filename, BOOL fCursor,
                                                 CURSORICONDIR **res, LPBYTE **ptr)
 {
     LPBYTE   _free;
@@ -493,13 +504,14 @@
  * FIXME: Convert to mono when cFlag is LR_MONOCHROME. Do something
  *        with cbSize parameter as well.
  */
-static HGLOBAL16 CURSORICON_CreateFromResource( HINSTANCE16 hInstance, HGLOBAL16 hObj, LPBYTE bits,
+static HICON CURSORICON_CreateFromResource( HINSTANCE hInstance, HICON hObject, LPBYTE bits,
 	 					UINT cbSize, BOOL bIcon, DWORD dwVersion,
 						INT width, INT height, UINT loadflags )
 {
     static HDC hdcMem;
     int sizeAnd, sizeXor;
     HBITMAP hAndBits = 0, hXorBits = 0; /* error condition for later */
+    HGLOBAL16 hObj = HGLOBAL_16(hObject);
     BITMAP bmpXor, bmpAnd;
     POINT16 hotspot;
     BITMAPINFO *bmi;
@@ -686,7 +698,7 @@
 
     DeleteObject( hAndBits );
     DeleteObject( hXorBits );
-    return hObj;
+    return HICON_32((HICON16)hObj);
 }
 
 
@@ -717,11 +729,12 @@
  *
  * Load a cursor or icon from resource or file.
  */
-HGLOBAL CURSORICON_Load( HINSTANCE hInstance, LPCWSTR name,
-                         INT width, INT height, INT colors,
-                         BOOL fCursor, UINT loadflags )
+static HICON CURSORICON_Load(HINSTANCE hInstance, LPCWSTR name,
+			     INT width, INT height, INT colors,
+			     BOOL fCursor, UINT loadflags)
 {
-    HANDLE handle = 0, h = 0;
+    HANDLE handle = 0;
+    HICON hIcon = 0;
     HRSRC hRsrc;
     CURSORICONDIR *dir;
     CURSORICONDIRENTRY *dirEntry;
@@ -737,7 +750,7 @@
         else
             dirEntry = (CURSORICONDIRENTRY *)CURSORICON_FindBestIcon(dir, width, height, colors);
         bits = ptr[dirEntry->wResId-1];
-        h = CURSORICON_CreateFromResource( 0, 0, bits, dirEntry->dwBytesInRes,
+        hIcon = CURSORICON_CreateFromResource( 0, 0, bits, dirEntry->dwBytesInRes,
                                            !fCursor, 0x00030000, width, height, loadflags);
         HeapFree( GetProcessHeap(), 0, dir );
         HeapFree( GetProcessHeap(), 0, ptr );
@@ -789,22 +802,22 @@
 
         /* If shared icon, check whether it was already loaded */
         if (    (loadflags & LR_SHARED)
-             && (h = CURSORICON_FindSharedIcon( hInstance, hRsrc ) ) != 0 )
-            return h;
+             && (hIcon = CURSORICON_FindSharedIcon( hInstance, hRsrc ) ) != 0 )
+            return hIcon;
 
         if (!(handle = LoadResource( hInstance, hRsrc ))) return 0;
         bits = (LPBYTE)LockResource( handle );
-        h = CURSORICON_CreateFromResource( 0, 0, bits, dwBytesInRes,
+        hIcon = CURSORICON_CreateFromResource( 0, 0, bits, dwBytesInRes,
                                            !fCursor, 0x00030000, width, height, loadflags);
         FreeResource( handle );
 
         /* If shared icon, add to icon cache */
 
-        if ( h && (loadflags & LR_SHARED) )
-            CURSORICON_AddSharedIcon( hInstance, hRsrc, hGroupRsrc, h );
+        if ( hIcon && (loadflags & LR_SHARED) )
+            CURSORICON_AddSharedIcon( hInstance, hRsrc, hGroupRsrc, hIcon );
     }
 
-    return h;
+    return hIcon;
 }
 
 /***********************************************************************
@@ -812,22 +825,24 @@
  *
  * Make a copy of a cursor or icon.
  */
-static HGLOBAL16 CURSORICON_Copy( HINSTANCE16 hInstance, HGLOBAL16 handle )
+static HICON CURSORICON_Copy( HINSTANCE hInst, HICON hIcon )
 {
     char *ptrOld, *ptrNew;
     int size;
-    HGLOBAL16 hNew;
-
-    if (!(ptrOld = (char *)GlobalLock16( handle ))) return 0;
-    if (hInstance && !(hInstance = GetExePtr( hInstance ))) return 0;
-    size = GlobalSize16( handle );
+    HINSTANCE16 hInst16 = HINSTANCE_16(hInst);
+    HICON16 hOld = HICON_16(hIcon);
+    HICON16 hNew;
+
+    if (!(ptrOld = (char *)GlobalLock16( hOld ))) return 0;
+    if (hInst16 && !(hInst16 = GetExePtr( hInst16 ))) return 0;
+    size = GlobalSize16( hOld );
     hNew = GlobalAlloc16( GMEM_MOVEABLE, size );
-    FarSetOwner16( hNew, hInstance );
+    FarSetOwner16( hNew, hInst16 );
     ptrNew = (char *)GlobalLock16( hNew );
     memcpy( ptrNew, ptrOld, size );
-    GlobalUnlock16( handle );
+    GlobalUnlock16( hOld );
     GlobalUnlock16( hNew );
-    return hNew;
+    return HICON_32(hNew);
 }
 
 /*************************************************************************
@@ -853,16 +868,16 @@
  *
  */
 
-HGLOBAL CURSORICON_ExtCopy(HGLOBAL Handle, UINT nType,
+static HICON CURSORICON_ExtCopy(HICON hIcon, UINT nType,
 			   INT iDesiredCX, INT iDesiredCY,
 			   UINT nFlags)
 {
-    HGLOBAL16 hNew=0;
+    HICON hNew=0;
 
-    TRACE_(icon)("Handle %u, uType %u, iDesiredCX %i, iDesiredCY %i, nFlags %u\n",
-        Handle, nType, iDesiredCX, iDesiredCY, nFlags);
+    TRACE_(icon)("hIcon %u, nType %u, iDesiredCX %i, iDesiredCY %i, nFlags %u\n",
+        hIcon, nType, iDesiredCX, iDesiredCY, nFlags);
 
-    if(Handle == 0)
+    if(hIcon == 0)
     {
 	return 0;
     }
@@ -872,13 +887,13 @@
         && (iDesiredCX > 0 || iDesiredCY > 0))
         || nFlags & LR_MONOCHROME)
     {
-        ICONCACHE* pIconCache = CURSORICON_FindCache(Handle);
+        ICONCACHE* pIconCache = CURSORICON_FindCache(hIcon);
 
         /* Not Found in Cache, then do a straight copy
         */
         if(pIconCache == NULL)
         {
-            hNew = CURSORICON_Copy(0, Handle);
+            hNew = CURSORICON_Copy(0, hIcon);
             if(nFlags & LR_COPYFROMRESOURCE)
             {
                 TRACE_(icon)("LR_COPYFROMRESOURCE: Failed to load from cache\n");
@@ -967,7 +982,7 @@
             FreeResource(hMem);
         }
     }
-    else hNew = CURSORICON_Copy(0, Handle);
+    else hNew = CURSORICON_Copy(0, hIcon);
     return hNew;
 }
 
@@ -993,7 +1008,8 @@
     info.bPlanes = 1;
     info.bBitsPerPixel = 1;
 
-    return CreateCursorIconIndirect16( 0, &info, lpANDbits, lpXORbits );
+    return HICON_32(CreateCursorIconIndirect16(HINSTANCE_16(hInstance), &info,
+		    lpANDbits, lpXORbits));
 }
 
 
@@ -1054,7 +1070,7 @@
  *    also be done in CreateIconIndirect...
  */
 HICON WINAPI CreateIcon(
-    HINSTANCE hInstance,  /* [in] the application's hInstance, currently unused */
+    HINSTANCE hInstance,  /* [in] the application's hInstance */
     INT       nWidth,     /* [in] the width of the provided bitmaps */
     INT       nHeight,    /* [in] the height of the provided bitmaps */
     BYTE      bPlanes,    /* [in] the number of planes in the provided bitmaps */
@@ -1083,7 +1099,8 @@
         info.bPlanes = bPlanes;
         info.bBitsPerPixel = bBitsPixel;
 
-        hIcon=CreateCursorIconIndirect16( 0, &info, lpANDbits, lpXORbits );
+        hIcon=HICON_32(CreateCursorIconIndirect16(HINSTANCE_16(hInstance), &info,
+						  lpANDbits, lpXORbits));
     } else {
         ICONINFO iinfo;
         BITMAPINFO bmi;
@@ -1154,7 +1171,7 @@
 HICON16 WINAPI CopyIcon16( HINSTANCE16 hInstance, HICON16 hIcon )
 {
     TRACE_(icon)("%04x %04x\n", hInstance, hIcon );
-    return CURSORICON_Copy( hInstance, hIcon );
+    return HICON_16(CURSORICON_Copy(HINSTANCE_32(hInstance), HICON_32(hIcon)));
 }
 
 
@@ -1174,7 +1191,7 @@
 HCURSOR16 WINAPI CopyCursor16( HINSTANCE16 hInstance, HCURSOR16 hCursor )
 {
     TRACE_(cursor)("%04x %04x\n", hInstance, hCursor );
-    return CURSORICON_Copy( hInstance, hCursor );
+    return HICON_16(CURSORICON_Copy(HINSTANCE_32(hInstance), HCURSOR_32(hCursor)));
 }
 
 /**********************************************************************
@@ -1193,7 +1210,7 @@
 
     /* Check whether destroying active cursor */
 
-    if ( QUEUE_Current()->cursor == handle )
+    if ( QUEUE_Current()->cursor == HICON_32(handle) )
     {
         WARN_(cursor)("Destroying active cursor!\n" );
         SetCursor( 0 );
@@ -1203,7 +1220,7 @@
 
     if ( !(flags & CID_NONSHARED) )
     {
-        INT count = CURSORICON_DelSharedIcon( handle );
+        INT count = CURSORICON_DelSharedIcon(HICON_32(handle));
 
         if ( count != -1 )
             return (flags & CID_WIN32)? TRUE : (count == 0);
@@ -1222,7 +1239,7 @@
  */
 BOOL WINAPI DestroyIcon( HICON hIcon )
 {
-    return DestroyIcon32( hIcon, CID_WIN32 );
+    return DestroyIcon32(HICON_16(hIcon), CID_WIN32);
 }
 
 
@@ -1231,7 +1248,7 @@
  */
 BOOL WINAPI DestroyCursor( HCURSOR hCursor )
 {
-    return DestroyIcon32( hCursor, CID_WIN32 );
+    return DestroyIcon32(HCURSOR_16(hCursor), CID_WIN32);
 }
 
 
@@ -1245,7 +1262,7 @@
     HBITMAP hXorBits, hAndBits;
     COLORREF oldFg, oldBg;
 
-    if (!(ptr = (CURSORICONINFO *)GlobalLock16( hIcon ))) return FALSE;
+    if (!(ptr = (CURSORICONINFO *)GlobalLock16(HICON_16(hIcon)))) return FALSE;
     if (!(hMemDC = CreateCompatibleDC( hdc ))) return FALSE;
     hAndBits = CreateBitmap( ptr->nWidth, ptr->nHeight, 1, 1,
                                (char *)(ptr+1) );
@@ -1266,7 +1283,7 @@
     DeleteDC( hMemDC );
     if (hXorBits) DeleteObject( hXorBits );
     if (hAndBits) DeleteObject( hAndBits );
-    GlobalUnlock16( hIcon );
+    GlobalUnlock16(HICON_16(hIcon));
     SetTextColor( hdc, oldFg );
     SetBkColor( hdc, oldBg );
     return TRUE;
@@ -1308,8 +1325,8 @@
     /* Change the cursor shape only if it is visible */
     if (queue->cursor_count >= 0)
     {
-        USER_Driver.pSetCursor( (CURSORICONINFO*)GlobalLock16( hCursor ) );
-        GlobalUnlock16( hCursor );
+        USER_Driver.pSetCursor( (CURSORICONINFO*)GlobalLock16(HCURSOR_16(hCursor)) );
+        GlobalUnlock16(HCURSOR_16(hCursor));
     }
     return hOldCursor;
 }
@@ -1327,8 +1344,8 @@
     {
         if (++queue->cursor_count == 0)  /* Show it */
         {
-            USER_Driver.pSetCursor( (CURSORICONINFO*)GlobalLock16( queue->cursor ) );
-            GlobalUnlock16( queue->cursor );
+            USER_Driver.pSetCursor((CURSORICONINFO*)GlobalLock16(HCURSOR_16(queue->cursor)));
+            GlobalUnlock16(HCURSOR_16(queue->cursor));
         }
     }
     else
@@ -1510,9 +1527,11 @@
      if( hMemObj )
      {
 	 LPBYTE bits = (LPBYTE)GlobalLock16( hMemObj );
-	 hMemObj = CURSORICON_CreateFromResource( hModule, hMemObj, bits,
-		   SizeofResource16(hModule, hRsrc), TRUE, 0x00030000,
-		   GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR );
+	 hMemObj = HICON_16(CURSORICON_CreateFromResource(
+				HMODULE_32(hModule), HICON_32(hMemObj), bits,
+				SizeofResource16(hModule, hRsrc), TRUE, 0x00030000,
+				GetSystemMetrics(SM_CXICON),
+				GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR));
      }
      return hMemObj;
 }
@@ -1528,9 +1547,11 @@
     if( hMemObj )
     {
 	LPBYTE bits = (LPBYTE)GlobalLock16( hMemObj );
-	hMemObj = CURSORICON_CreateFromResource( hModule, hMemObj, bits,
-		  SizeofResource16(hModule, hRsrc), FALSE, 0x00030000,
-		  GetSystemMetrics(SM_CXCURSOR), GetSystemMetrics(SM_CYCURSOR), LR_MONOCHROME );
+	hMemObj = HICON_16(CURSORICON_CreateFromResource(
+				HMODULE_32(hModule), HICON_32(hMemObj), bits,
+				SizeofResource16(hModule, hRsrc), FALSE, 0x00030000,
+				GetSystemMetrics(SM_CXCURSOR),
+				GetSystemMetrics(SM_CYCURSOR), LR_MONOCHROME));
     }
     return hMemObj;
 }
@@ -1544,8 +1565,8 @@
 
     TRACE_(cursor)("hRes=%04x\n",hResource);
 
-    return CURSORICON_CreateFromResource( 0, 0, bits, 0, TRUE,
-		      bNew ? 0x00030000 : 0x00020000, 0, 0, LR_DEFAULTCOLOR );
+    return HICON_16(CURSORICON_CreateFromResource(0, 0, bits, 0, TRUE,
+		      bNew ? 0x00030000 : 0x00020000, 0, 0, LR_DEFAULTCOLOR));
 }
 
 /***********************************************************************
@@ -1608,7 +1629,7 @@
 BOOL WINAPI GetIconInfo(HICON hIcon,PICONINFO iconinfo) {
     CURSORICONINFO	*ciconinfo;
 
-    ciconinfo = GlobalLock16(hIcon);
+    ciconinfo = GlobalLock16(HICON_16(hIcon));
     if (!ciconinfo)
 	return FALSE;
 
@@ -1634,7 +1655,7 @@
     iconinfo->hbmMask = CreateBitmap ( ciconinfo->nWidth, ciconinfo->nHeight,
                                 1, 1, (char *)(ciconinfo + 1));
 
-    GlobalUnlock16(hIcon);
+    GlobalUnlock16(HICON_16(hIcon));
 
     return TRUE;
 }
@@ -1645,7 +1666,7 @@
 HICON WINAPI CreateIconIndirect(PICONINFO iconinfo)
 {
     BITMAP bmpXor,bmpAnd;
-    HICON hObj;
+    HICON16 hObj;
     int	sizeXor,sizeAnd;
 
     GetObjectA( iconinfo->hbmColor, sizeof(bmpXor), &bmpXor );
@@ -1686,7 +1707,7 @@
 	GetBitmapBits( iconinfo->hbmColor,sizeXor,(char*)(info + 1) +sizeAnd);
 	GlobalUnlock16( hObj );
     }
-    return hObj;
+    return HICON_32(hObj);
 }
 
 /******************************************************************************
@@ -1714,7 +1735,7 @@
                             INT cxWidth, INT cyWidth, UINT istep,
                             HBRUSH hbr, UINT flags )
 {
-    CURSORICONINFO *ptr = (CURSORICONINFO *)GlobalLock16 (hIcon);
+    CURSORICONINFO *ptr = (CURSORICONINFO *)GlobalLock16(HICON_16(hIcon));
     HDC hDC_off = 0, hMemDC = CreateCompatibleDC (hdc);
     BOOL result = FALSE, DoOffscreen;
     HBITMAP hB_off = 0, hOld = 0;
@@ -1825,7 +1846,7 @@
     if (hMemDC) DeleteDC( hMemDC );
     if (hDC_off) DeleteDC(hDC_off);
     if (hB_off) DeleteObject(hB_off);
-    GlobalUnlock16( hIcon );
+    GlobalUnlock16(HICON_16(hIcon));
     return result;
 }
 
@@ -2094,7 +2115,7 @@
                 SetBitmapBits( res, bm.bmWidthBytes * bm.bmHeight, buf );
                 HeapFree( GetProcessHeap(), 0, buf );
             }
-            return res;
+            return (HICON)res;
         }
 	case IMAGE_ICON:
 		return CURSORICON_ExtCopy(hnd,type, desiredx, desiredy, flags);
Index: windows/defwnd.c
===================================================================
RCS file: /home/wine/wine/windows/defwnd.c,v
retrieving revision 1.76
diff -u -r1.76 defwnd.c
--- windows/defwnd.c	31 May 2002 23:06:54 -0000	1.76
+++ windows/defwnd.c	8 Oct 2002 23:47:31 -0000
@@ -431,7 +431,7 @@
 	    if( hdc )
 	    {
               HICON hIcon;
-	      if (IsIconic(hwnd) && ((hIcon = GetClassLongW( hwnd, GCL_HICON))) )
+	      if (IsIconic(hwnd) && ((hIcon = (HICON)GetClassLongW( hwnd, GCL_HICON))) )
 	      {
                   RECT rc;
                   int x, y;
@@ -621,9 +621,9 @@
         {
             UINT len;
 
-            HICON hIcon = GetClassLongW( hwnd, GCL_HICON );
+            HICON hIcon = (HICON)GetClassLongW( hwnd, GCL_HICON );
             HINSTANCE instance = GetWindowLongW( hwnd, GWL_HINSTANCE );
-            if (hIcon) return hIcon;
+            if (hIcon) return (LRESULT)hIcon;
             for(len=1; len<64; len++)
                 if((hIcon = LoadIconW(instance, MAKEINTRESOURCEW(len))))
                     return (LRESULT)hIcon;
@@ -649,14 +649,14 @@
 
     case WM_SETICON:
         if (USER_Driver.pSetWindowIcon)
-            return USER_Driver.pSetWindowIcon( hwnd, lParam, (wParam != ICON_SMALL) );
+            return (LRESULT)USER_Driver.pSetWindowIcon( hwnd, (HICON)lParam, (wParam != ICON_SMALL) );
         else
 	{
-            HICON hOldIcon = SetClassLongW( hwnd, (wParam != ICON_SMALL) ? GCL_HICON : GCL_HICONSM,
+            HICON hOldIcon = (HICON)SetClassLongW( hwnd, (wParam != ICON_SMALL) ? GCL_HICON : GCL_HICONSM,
                                             lParam);
             SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE |
                          SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
-            return hOldIcon;
+            return (LRESULT)hOldIcon;
 	}
 
     case WM_GETICON:
Index: windows/mdi.c
===================================================================
RCS file: /home/wine/wine/windows/mdi.c,v
retrieving revision 1.97
diff -u -r1.97 mdi.c
--- windows/mdi.c	4 Sep 2002 19:37:02 -0000	1.97
+++ windows/mdi.c	8 Oct 2002 23:47:32 -0000
@@ -1029,9 +1029,9 @@
 
   if(TWEAK_WineLook > WIN31_LOOK)
   {
-    HICON hIcon = GetClassLongA(hChild, GCL_HICONSM);
+    HICON hIcon = (HICON)GetClassLongA(hChild, GCL_HICONSM);
     if (!hIcon)
-      hIcon = GetClassLongA(hChild, GCL_HICON);
+      hIcon = (HICON)GetClassLongA(hChild, GCL_HICON);
     if (hIcon)
     {
       HDC hMemDC;
Index: windows/msgbox.c
===================================================================
RCS file: /home/wine/wine/windows/msgbox.c,v
retrieving revision 1.32
diff -u -r1.32 msgbox.c
--- windows/msgbox.c	31 May 2002 23:06:54 -0000	1.32
+++ windows/msgbox.c	8 Oct 2002 23:47:32 -0000
@@ -110,16 +110,20 @@
     /* Set the icon */
     switch(lpmb->dwStyle & MB_ICONMASK) {
     case MB_ICONEXCLAMATION:
-	SendDlgItemMessageA(hwnd, stc1, STM_SETICON, LoadIconA(0, IDI_EXCLAMATIONA), 0);
+	SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
+			    (WPARAM)LoadIconA(0, IDI_EXCLAMATIONA), 0);
 	break;
     case MB_ICONQUESTION:
-	SendDlgItemMessageA(hwnd, stc1, STM_SETICON, LoadIconA(0, IDI_QUESTIONA), 0);
+	SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
+			    (WPARAM)LoadIconA(0, IDI_QUESTIONA), 0);
 	break;
     case MB_ICONASTERISK:
-	SendDlgItemMessageA(hwnd, stc1, STM_SETICON, LoadIconA(0, IDI_ASTERISKA), 0);
+	SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
+			    (WPARAM)LoadIconA(0, IDI_ASTERISKA), 0);
 	break;
     case MB_ICONHAND:
-      SendDlgItemMessageA(hwnd, stc1, STM_SETICON, LoadIconA(0, IDI_HANDA), 0);
+      SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
+			    (WPARAM)LoadIconA(0, IDI_HANDA), 0);
       break;
     default:
 	/* By default, Windows 95/98/NT do not associate an icon to message boxes.
Index: windows/nonclient.c
===================================================================
RCS file: /home/wine/wine/windows/nonclient.c,v
retrieving revision 1.99
diff -u -r1.99 nonclient.c
--- windows/nonclient.c	28 Aug 2002 22:25:12 -0000	1.99
+++ windows/nonclient.c	8 Oct 2002 23:47:33 -0000
@@ -1708,7 +1708,7 @@
 
     case HTCLIENT:
 	{
-	    HCURSOR hCursor = GetClassLongA(hwnd, GCL_HCURSOR);
+	    HCURSOR hCursor = (HCURSOR)GetClassLongA(hwnd, GCL_HCURSOR);
 	    if(hCursor) {
 		SetCursor(hCursor);
 		return TRUE;
Index: windows/win.c
===================================================================
RCS file: /home/wine/wine/windows/win.c,v
retrieving revision 1.193
diff -u -r1.193 win.c
--- windows/win.c	3 Oct 2002 19:54:58 -0000	1.193
+++ windows/win.c	9 Oct 2002 00:09:57 -0000
@@ -3274,13 +3274,13 @@
 
     if( !lpDragInfo || !spDragInfo ) return 0L;
 
-    if (!(hBummer = LoadCursorA(0, MAKEINTRESOURCEA(OCR_NO))))
+    if (!(hBummer = LoadCursor16(0, MAKEINTRESOURCEA(OCR_NO))))
     {
         GlobalFree16(hDragInfo);
         return 0L;
     }
 
-    if(hCursor) hOldCursor = SetCursor(hCursor);
+    if(hCursor) hOldCursor = SetCursor16(hCursor);
 
     lpDragInfo->hWnd   = hWnd;
     lpDragInfo->hScope = 0;
@@ -3312,7 +3312,7 @@
             lpDragInfo->hScope = 0;
 	}
 	if( hCurrentCursor )
-	    SetCursor(hCurrentCursor);
+	    SetCursor16(hCurrentCursor);
 
 	/* send WM_DRAGLOOP */
 	SendMessage16( hWnd, WM_DRAGLOOP, (WPARAM16)(hCurrentCursor != hBummer),
@@ -3337,7 +3337,7 @@
     ReleaseCapture();
     ShowCursor( FALSE );
 
-    if( hCursor ) SetCursor( hOldCursor );
+    if( hCursor ) SetCursor16(hOldCursor);
 
     if( hCurrentCursor != hBummer )
 	msg.lParam = SendMessage16( lpDragInfo->hScope, WM_DROPOBJECT,

Attachment: pgp00053.pgp
Description: PGP signature


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux