Commit bc54d785 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

- 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
parent b41d4fed
......@@ -93,19 +93,19 @@ const struct builtin_class_descr STATIC_builtin_class =
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 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
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 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
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 @@ static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
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 );
}
......@@ -538,24 +538,23 @@ static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style )
{
RECT rc;
HBRUSH hbrush;
HICON hIcon;
HDC hMemDC;
HBITMAP oldbitmap;
HBITMAP hBitmap, oldbitmap;
GetClientRect( hwnd, &rc );
hbrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, (LPARAM)hwnd );
FillRect( hdc, &rc, hbrush );
if ((hIcon = GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
if ((hBitmap = (HBITMAP)GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
{
BITMAP bm;
SIZE sz;
if(GetObjectType(hIcon) != OBJ_BITMAP) return;
if(GetObjectType(hBitmap) != OBJ_BITMAP) return;
if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
GetObjectW(hIcon, sizeof(bm), &bm);
GetBitmapDimensionEx(hIcon, &sz);
oldbitmap = SelectObject(hMemDC, hIcon);
GetObjectW(hBitmap, sizeof(bm), &bm);
GetBitmapDimensionEx(hBitmap, &sz);
oldbitmap = SelectObject(hMemDC, hBitmap);
BitBlt(hdc, sz.cx, sz.cy, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
SRCCOPY);
SelectObject(hMemDC, oldbitmap);
......
......@@ -8483,7 +8483,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return (LRESULT)infoPtr->hwndHeader;
case LVM_GETHOTCURSOR:
return infoPtr->hHotCursor;
return (LRESULT)infoPtr->hHotCursor;
case LVM_GETHOTITEM:
return infoPtr->nHotItem;
......@@ -8661,7 +8661,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* 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);
......
......@@ -2566,11 +2566,11 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
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;
......
......@@ -1112,7 +1112,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
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);
......
......@@ -69,12 +69,12 @@ static const WCHAR FILE_star[] = {'*','.','*', 0};
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;
......
......@@ -49,6 +49,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
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 @@ HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(
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;
......
......@@ -120,7 +120,7 @@ BOOL CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
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)) ;
......
......@@ -197,7 +197,7 @@ static HICON WINE_UNUSED SIC_GetIcon (LPCSTR sSourceFile, INT dwSourceIndex, BOO
if (INVALID_INDEX == index)
{
return INVALID_INDEX;
return (HICON)INVALID_INDEX;
}
if (bSmallIcon)
......@@ -415,11 +415,11 @@ HICON WINAPI ExtractIconExA ( LPCSTR lpszFile, INT nIconIndex, HICON * phiconLar
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 @@ HICON WINAPI ExtractIconExA ( LPCSTR lpszFile, INT nIconIndex, HICON * phiconLar
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 ExtractIconExA ( LPCSTR lpszFile, INT nIconIndex, HICON * phiconLar
*/
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 @@ HICON WINAPI ExtractIconExW ( LPCWSTR lpszFile, INT nIconIndex, HICON * phiconLa
* 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;
}
/*************************************************************************
......
......@@ -207,7 +207,7 @@ BOOL16 WINAPI AboutDlgProc16( HWND16 hWnd, UINT16 msg, WPARAM16 wParam,
*/
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 @@ HGLOBAL16 WINAPI InternalExtractIcon16(HINSTANCE16 hInstance,
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 @@ HGLOBAL16 WINAPI InternalExtractIcon16(HINSTANCE16 hInstance,
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 @@ HGLOBAL16 WINAPI InternalExtractIcon16(HINSTANCE16 hInstance,
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 @@ HICON16 WINAPI ExtractIconEx16(
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 @@ HICON16 WINAPI ExtractIconEx16(
* 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));
}
/*************************************************************************
......
......@@ -531,7 +531,7 @@ HICON WINAPI ExtractIconA( HINSTANCE hInstance, LPCSTR lpszExeFileName,
HICON16 hIcon = *ptr;
GlobalFree16(handle);
return hIcon;
return HICON_32(hIcon);
}
return 0;
}
......@@ -567,7 +567,7 @@ typedef struct
#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 @@ BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
{ 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 );
......
......@@ -197,6 +197,9 @@ inline static void __SHCloneStrWtoA(char ** target, const WCHAR * source)
}
/* 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
......@@ -2206,7 +2206,7 @@ BOOL WINAPI SHLWAPI_335(LPSHELLEXECUTEINFOW lpExecInfo)
*
* Late bound call to shell32.SHFileOperationW.
*/
DWORD WINAPI SHLWAPI_336(LPSHFILEOPSTRUCTW lpFileOp)
HICON WINAPI SHLWAPI_336(LPSHFILEOPSTRUCTW lpFileOp)
{
GET_FUNC(pSHFileOperationW, shell32, "SHFileOperationW", 0);
return pSHFileOperationW(lpFileOp);
......
......@@ -340,17 +340,17 @@ static HRESULT ICO_ExtractIconExW(
/* .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 @@ static HRESULT ICO_ExtractIconExW(
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;
......
......@@ -46,7 +46,7 @@ static LRESULT WINAPI desktop_winproc( HWND hwnd, UINT message, WPARAM wParam, L
break;
case WM_SETCURSOR:
return SetCursor( LoadCursorA( 0, IDC_ARROWA ) );
return (LRESULT)SetCursor( LoadCursorA( 0, IDC_ARROWA ) );
case WM_NCHITTEST:
return HTCLIENT;
......
......@@ -236,7 +236,7 @@ inline static void destroy_icon_window( Display *display, WND *win )
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 @@ HICON X11DRV_SetWindowIcon( HWND hwnd, HICON icon, BOOL small )
{
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 );
......
......@@ -1840,7 +1840,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
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 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
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;
}
......
......@@ -493,7 +493,7 @@ HBITMAP X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap, BOOL bDeletePixmap)
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.
......
......@@ -84,13 +84,6 @@ typedef struct
#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 */
......@@ -142,7 +142,14 @@ extern HPEN SYSCOLOR_GetPen( INT index );
extern DWORD USER16_AlertableWait;
/* HANDLE16 <-> HANDLE conversions */
#define HACCEL_32(h16) ((HACCEL)(ULONG_PTR)(h16))
#define HACCEL_16(h32) (LOWORD(h32))
#define HBRUSH_16(h32) (LOWORD(h32))
#define HCURSOR_16(h32) (LOWORD(h32))
#define HICON_16(h32) (LOWORD(h32))
#define HACCEL_32(h16) ((HACCEL)(ULONG_PTR)(h16))
#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_USER_H */
......@@ -80,7 +80,7 @@ DECLARE_HANDLE(HDESK);
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);
......
......@@ -102,7 +102,7 @@ FARPROC48 INT_GetPMHandler48( BYTE intnum )
*/
void INT_SetPMHandler48( BYTE intnum, FARPROC48 handler )
{
TRACE("Set 32-bit protected mode interrupt vector %02x <- %04x:%08x\n",
TRACE("Set 32-bit protected mode interrupt vector %02x <- %04x:%08lx\n",
intnum, handler.selector, handler.offset );
INT_Vectors48[intnum] = handler;
}
......
......@@ -553,12 +553,12 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
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 @@ ATOM WINAPI RegisterClassA( const WNDCLASSA* wc ) /* [in] Address of structure w
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 @@ ATOM WINAPI RegisterClassW( const WNDCLASSW* wc )
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 @@ ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
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 @@ ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc )
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 @@ ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc )
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 @@ LONG WINAPI SetClassLongA( HWND hwnd, INT offset, LONG newval )
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 @@ BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc
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 @@ BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16
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;
......
......@@ -66,6 +66,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(cursor);
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 @@ typedef struct tagICONCACHE
HMODULE hModule;
HRSRC hRsrc;
HRSRC hGroupRsrc;
HANDLE handle;
HICON hIcon;
INT count;
......@@ -157,9 +168,9 @@ static int get_bitmap_width_bytes( int width, int bpp )
/**********************************************************************
* 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 @@ static HANDLE CURSORICON_FindSharedIcon( HMODULE hModule, HRSRC hRsrc )
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 @@ static HANDLE CURSORICON_FindSharedIcon( HMODULE hModule, HRSRC hRsrc )
* Failure: NULL
*
*/
static ICONCACHE* CURSORICON_FindCache(HANDLE handle)
static ICONCACHE* CURSORICON_FindCache(HICON hIcon)
{
ICONCACHE *ptr;
ICONCACHE *pRet=NULL;
......@@ -201,7 +212,7 @@ static ICONCACHE* CURSORICON_FindCache(HANDLE handle)
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 @@ static ICONCACHE* CURSORICON_FindCache(HANDLE handle)
/**********************************************************************
* 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 @@ static void CURSORICON_AddSharedIcon( HMODULE hModule, HRSRC hRsrc, HRSRC hGroup
/**********************************************************************
* CURSORICON_DelSharedIcon
*/
static INT CURSORICON_DelSharedIcon( HANDLE handle )
static INT CURSORICON_DelSharedIcon( HICON hIcon )
{
INT count = -1;
ICONCACHE *ptr;
......@@ -244,7 +255,7 @@ static INT CURSORICON_DelSharedIcon( HANDLE handle )
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 @@ void CURSORICON_FreeModuleIcons( HMODULE hModule )
ICONCACHE *freePtr = *ptr;
*ptr = freePtr->next;
GlobalFree16( freePtr->handle );
GlobalFree16(HICON_16(freePtr->hIcon));
HeapFree( GetProcessHeap(), 0, freePtr );
continue;
}
......@@ -405,7 +416,7 @@ static CURSORICONDIRENTRY *CURSORICON_FindBestCursor( CURSORICONDIR *dir,
* 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 @@ fail:
* 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 @@ static HGLOBAL16 CURSORICON_CreateFromResource( HINSTANCE16 hInstance, HGLOBAL16
DeleteObject( hAndBits );
DeleteObject( hXorBits );
return hObj;
return HICON_32((HICON16)hObj);
}
......@@ -717,11 +729,12 @@ HICON WINAPI CreateIconFromResourceEx( LPBYTE bits, UINT cbSize,
*
* 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 @@ HGLOBAL CURSORICON_Load( HINSTANCE hInstance, LPCWSTR name,
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 @@ HGLOBAL CURSORICON_Load( HINSTANCE hInstance, LPCWSTR name,
/* 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 @@ HGLOBAL CURSORICON_Load( HINSTANCE hInstance, LPCWSTR name,
*
* 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;
HINSTANCE16 hInst16 = HINSTANCE_16(hInst);
HICON16 hOld = HICON_16(hIcon);
HICON16 hNew;
if (!(ptrOld = (char *)GlobalLock16( handle ))) return 0;
if (hInstance && !(hInstance = GetExePtr( hInstance ))) return 0;
size = GlobalSize16( handle );
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 @@ static HGLOBAL16 CURSORICON_Copy( HINSTANCE16 hInstance, HGLOBAL16 handle )
*
*/
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 @@ HGLOBAL CURSORICON_ExtCopy(HGLOBAL Handle, UINT nType,
&& (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 @@ HGLOBAL CURSORICON_ExtCopy(HGLOBAL Handle, UINT nType,
FreeResource(hMem);
}
}
else hNew = CURSORICON_Copy(0, Handle);
else hNew = CURSORICON_Copy(0, hIcon);
return hNew;
}
......@@ -993,7 +1008,8 @@ HCURSOR WINAPI CreateCursor( HINSTANCE hInstance,
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 @@ HICON16 WINAPI CreateIcon16( HINSTANCE16 hInstance, INT16 nWidth,
* 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 @@ HICON WINAPI CreateIcon(
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 @@ HGLOBAL16 WINAPI CreateCursorIconIndirect16( HINSTANCE16 hInstance,
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 @@ HICON WINAPI CopyIcon( HICON hIcon )
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 @@ WORD WINAPI DestroyIcon32( HGLOBAL16 handle, UINT16 flags )
/* 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 @@ WORD WINAPI DestroyIcon32( HGLOBAL16 handle, UINT16 flags )
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 @@ WORD WINAPI DestroyIcon32( HGLOBAL16 handle, UINT16 flags )
*/
BOOL WINAPI DestroyIcon( HICON hIcon )
{
return DestroyIcon32( hIcon, CID_WIN32 );
return DestroyIcon32(HICON_16(hIcon), CID_WIN32);
}
......@@ -1231,7 +1248,7 @@ BOOL WINAPI DestroyIcon( HICON hIcon )
*/
BOOL WINAPI DestroyCursor( HCURSOR hCursor )
{
return DestroyIcon32( hCursor, CID_WIN32 );
return DestroyIcon32(HCURSOR_16(hCursor), CID_WIN32);
}
......@@ -1245,7 +1262,7 @@ BOOL WINAPI DrawIcon( HDC hdc, INT x, INT y, HICON hIcon )
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 @@ BOOL WINAPI DrawIcon( HDC hdc, INT x, INT y, HICON hIcon )
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 @@ HCURSOR WINAPI SetCursor( HCURSOR hCursor /* [in] Handle of cursor to show */ )
/* 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 @@ INT WINAPI ShowCursor( BOOL bShow )
{
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 @@ HGLOBAL16 WINAPI LoadDIBIconHandler16( HGLOBAL16 hMemObj, HMODULE16 hModule, HRS
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 @@ HGLOBAL16 WINAPI LoadDIBCursorHandler16( HGLOBAL16 hMemObj, HMODULE16 hModule, H
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 @@ HICON16 WINAPI LoadIconHandler16( HGLOBAL16 hResource, BOOL16 bNew )
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 @@ HICON WINAPI LoadIconA(HINSTANCE hInstance, LPCSTR name)
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 @@ BOOL WINAPI GetIconInfo(HICON hIcon,PICONINFO iconinfo) {
iconinfo->hbmMask = CreateBitmap ( ciconinfo->nWidth, ciconinfo->nHeight,
1, 1, (char *)(ciconinfo + 1));
GlobalUnlock16(hIcon);
GlobalUnlock16(HICON_16(hIcon));
return TRUE;
}
......@@ -1645,7 +1666,7 @@ BOOL WINAPI GetIconInfo(HICON hIcon,PICONINFO iconinfo) {
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 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo)
GetBitmapBits( iconinfo->hbmColor,sizeXor,(char*)(info + 1) +sizeAnd);
GlobalUnlock16( hObj );
}
return hObj;
return HICON_32(hObj);
}
/******************************************************************************
......@@ -1714,7 +1735,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
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 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
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 @@ HICON WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx,
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);
......
......@@ -431,7 +431,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
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 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
{
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 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
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:
......
......@@ -1029,9 +1029,9 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild )
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;
......
......@@ -110,16 +110,20 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSA lpmb)
/* 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.
......
......@@ -1708,7 +1708,7 @@ LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam )
case HTCLIENT:
{
HCURSOR hCursor = GetClassLongA(hwnd, GCL_HCURSOR);
HCURSOR hCursor = (HCURSOR)GetClassLongA(hwnd, GCL_HCURSOR);
if(hCursor) {
SetCursor(hCursor);
return TRUE;
......
......@@ -3264,9 +3264,9 @@ DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj,
MSG msg;
LPDRAGINFO16 lpDragInfo;
SEGPTR spDragInfo;
HCURSOR16 hOldCursor=0, hBummer=0;
HCURSOR hOldCursor=0, hBummer=0;
HGLOBAL16 hDragInfo = GlobalAlloc16( GMEM_SHARE | GMEM_ZEROINIT, 2*sizeof(DRAGINFO16));
HCURSOR16 hCurrentCursor = 0;
HCURSOR hCurrentCursor = 0;
HWND16 hCurrentWnd = 0;
lpDragInfo = (LPDRAGINFO16) GlobalLock16(hDragInfo);
......@@ -3280,7 +3280,7 @@ DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj,
return 0L;
}
if(hCursor) hOldCursor = SetCursor(hCursor);
if(hCursor) hOldCursor = SetCursor(HCURSOR_32(hCursor));
lpDragInfo->hWnd = hWnd;
lpDragInfo->hScope = 0;
......@@ -3305,7 +3305,7 @@ DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj,
TRACE_(msg)("lpDI->hScope = %04x\n",lpDragInfo->hScope);
if( DRAG_QueryUpdate16(WIN_Handle32(hwndScope), spDragInfo) > 0 )
hCurrentCursor = hCursor;
hCurrentCursor = HCURSOR_32(hCursor);
else
{
hCurrentCursor = hBummer;
......@@ -3337,7 +3337,7 @@ DWORD WINAPI DragObject16( HWND16 hwndScope, HWND16 hWnd, UINT16 wObj,
ReleaseCapture();
ShowCursor( FALSE );
if( hCursor ) SetCursor( hOldCursor );
if( hCursor ) SetCursor(hOldCursor);
if( hCurrentCursor != hBummer )
msg.lParam = SendMessage16( lpDragInfo->hScope, WM_DROPOBJECT,
......
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