From 7ef66af34ab835b0f8fa892cdfb938424558d98d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 22 Nov 2002 04:47:10 +0000 Subject: [PATCH] Moved some more 16-bit functions to user16.c. A few fixes for -DSTRICT. --- controls/edit.c | 12 +- controls/icontitle.c | 4 +- controls/menu.c | 285 +++------------------------------------- controls/scroll.c | 4 +- dlls/user/caret.c | 4 +- dlls/user/focus.c | 2 +- dlls/user/painting.c | 20 +-- dlls/user/property.c | 4 +- dlls/user/text.c | 21 +-- dlls/user/user16.c | 304 +++++++++++++++++++++++++++++++++++++++++-- windows/class.c | 4 +- windows/clipboard.c | 23 ++-- windows/dce.c | 2 +- windows/mdi.c | 8 +- windows/syscolor.c | 9 -- windows/win.c | 6 +- windows/winhelp.c | 2 +- windows/winproc.c | 12 +- 18 files changed, 362 insertions(+), 364 deletions(-) diff --git a/controls/edit.c b/controls/edit.c index 19c6f2ccc85..9a19092b5d1 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -1506,7 +1506,7 @@ static LPWSTR EDIT_GetPasswordPointer_SL(EDITSTATE *es) */ static void EDIT_LockBuffer(EDITSTATE *es) { - HINSTANCE hInstance = (HINSTANCE)GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); + HINSTANCE16 hInstance = GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); if (!es->text) { CHAR *textA = NULL; UINT countA = 0; @@ -2180,7 +2180,7 @@ static void EDIT_SetRectNP(EDITSTATE *es, LPRECT rc) */ static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force) { - HINSTANCE hInstance = (HINSTANCE)GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); + HINSTANCE16 hInstance = GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); /* Edit window might be already destroyed */ if(!IsWindow(es->hwndSelf)) @@ -2490,7 +2490,7 @@ static HLOCAL EDIT_EM_GetHandle(EDITSTATE *es) */ static HLOCAL16 EDIT_EM_GetHandle16(EDITSTATE *es) { - HINSTANCE hInstance = (HINSTANCE)GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); + HINSTANCE16 hInstance = GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); CHAR *textA; UINT countA, alloc_size; @@ -3120,7 +3120,7 @@ static void EDIT_EM_ScrollCaret(EDITSTATE *es) */ static void EDIT_EM_SetHandle(EDITSTATE *es, HLOCAL hloc) { - HINSTANCE hInstance = (HINSTANCE)GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); + HINSTANCE16 hInstance = GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); if (!(es->style & ES_MULTILINE)) return; @@ -3200,7 +3200,7 @@ static void EDIT_EM_SetHandle(EDITSTATE *es, HLOCAL hloc) */ static void EDIT_EM_SetHandle16(EDITSTATE *es, HLOCAL16 hloc) { - HINSTANCE hInstance = (HINSTANCE)GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); + HINSTANCE16 hInstance = GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); INT countW, countA; HLOCAL hloc32W_new; WCHAR *textW; @@ -3747,7 +3747,6 @@ static LRESULT EDIT_WM_Create(EDITSTATE *es, LPCWSTR name) */ static LRESULT EDIT_WM_Destroy(EDITSTATE *es) { - HINSTANCE hInstance = (HINSTANCE)GetWindowLongW( es->hwndSelf, GWL_HINSTANCE ); LINEDEF *pc, *pp; if (es->hloc32W) { @@ -3759,6 +3758,7 @@ static LRESULT EDIT_WM_Destroy(EDITSTATE *es) LocalFree(es->hloc32A); } if (es->hloc16) { + HINSTANCE16 hInstance = GetWindowWord( es->hwndSelf, GWL_HINSTANCE ); while (LOCAL_Unlock(hInstance, es->hloc16)) ; LOCAL_Free(hInstance, es->hloc16); } diff --git a/controls/icontitle.c b/controls/icontitle.c index 68b946bfb79..8c0ca329956 100644 --- a/controls/icontitle.c +++ b/controls/icontitle.c @@ -62,7 +62,7 @@ const struct builtin_class_descr ICONTITLE_builtin_class = HWND ICONTITLE_Create( HWND owner ) { HWND hWnd; - HINSTANCE instance = GetWindowLongA( owner, GWL_HINSTANCE ); + HINSTANCE instance = (HINSTANCE)GetWindowLongA( owner, GWL_HINSTANCE ); LONG style = WS_CLIPSIBLINGS; if (!IsWindowEnabled(owner)) style |= WS_DISABLED; @@ -238,5 +238,3 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, } return DefWindowProcW( hWnd, msg, wParam, lParam ); } - - diff --git a/controls/menu.c b/controls/menu.c index 1174665805d..ed17b43b9f9 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -189,7 +189,7 @@ const struct builtin_class_descr MENU_builtin_class = PopupMenuWndProc, /* procW */ sizeof(HMENU), /* extra */ IDC_ARROWA, /* cursor */ - COLOR_MENU+1 /* brush */ + (HBRUSH)(COLOR_MENU+1) /* brush */ }; @@ -371,7 +371,8 @@ HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu ) if (hPopupMenu) { - InsertMenuA( hMenu, -1, MF_SYSMENU | MF_POPUP | MF_BYPOSITION, hPopupMenu, NULL ); + InsertMenuA( hMenu, -1, MF_SYSMENU | MF_POPUP | MF_BYPOSITION, + (UINT_PTR)hPopupMenu, NULL ); menu->items[0].fType = MF_SYSMENU | MF_POPUP; menu->items[0].fState = 0; @@ -593,7 +594,7 @@ UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget ) POPUPMENU *menu; UINT i; MENUITEM *item; - if (((*hmenu)==0xffff) || + if (((*hmenu)==(HMENU)0xffff) || (!(menu = MENU_GetMenu(*hmenu)))) return NO_SELECTED_ITEM; item = menu->items; @@ -663,7 +664,7 @@ static MENUITEM *MENU_FindItemByCoords( POPUPMENU *menu, static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu, UINT key, BOOL forceMenuChar ) { - TRACE("\tlooking for '%c' in [%04x]\n", (char)key, (UINT16)hmenu ); + TRACE("\tlooking for '%c' in [%x]\n", (char)key, hmenu ); if (!IsMenu( hmenu )) hmenu = GetSubMenu( get_win_sys_menu(hwndOwner), 0); @@ -693,7 +694,7 @@ static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu, } } menuchar = SendMessageA( hwndOwner, WM_MENUCHAR, - MAKEWPARAM( key, menu->wFlags ), hmenu ); + MAKEWPARAM( key, menu->wFlags ), (LPARAM)hmenu ); if (HIWORD(menuchar) == 2) return LOWORD(menuchar); if (HIWORD(menuchar) == 1) return (UINT)(-2); } @@ -1633,7 +1634,7 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, /* NOTE: In Windows, top menu popup is not owned. */ menu->hWnd = CreateWindowA( POPUPMENU_CLASS_ATOM, NULL, WS_POPUP, x, y, width, height, - hwndOwner, 0, GetWindowLongA(hwndOwner,GWL_HINSTANCE), + hwndOwner, 0, (HINSTANCE)GetWindowLongA(hwndOwner,GWL_HINSTANCE), (LPVOID)hmenu ); if( !menu->hWnd ) return FALSE; if (!top_popup) top_popup = menu->hWnd; @@ -1693,7 +1694,7 @@ static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex, SendMessageA( hwndOwner, WM_MENUSELECT, MAKELONG(ip->fType & MF_POPUP ? wIndex: ip->wID, ip->fType | ip->fState | MF_MOUSESELECT | - (lppop->wFlags & MF_SYSMENU)), hmenu); + (lppop->wFlags & MF_SYSMENU)), (LPARAM)hmenu); } } else if (sendMenuSelect) { @@ -1704,7 +1705,7 @@ static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex, MENUITEM *ip = &ptm->items[pos]; SendMessageA( hwndOwner, WM_MENUSELECT, MAKELONG(pos, ip->fType | ip->fState | MF_MOUSESELECT | - (ptm->wFlags & MF_SYSMENU)), topmenu); + (ptm->wFlags & MF_SYSMENU)), (LPARAM)topmenu); } } } @@ -1796,12 +1797,12 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT_PTR id, else item->dwItemData = 0; - if ((item->fType & MF_POPUP) && (flags & MF_POPUP) && (item->hSubMenu != id) ) + if ((item->fType & MF_POPUP) && (flags & MF_POPUP) && (item->hSubMenu != (HMENU)id) ) DestroyMenu( item->hSubMenu ); /* ModifyMenu() spec */ if (flags & MF_POPUP) { - POPUPMENU *menu = MENU_GetMenu((UINT16)id); + POPUPMENU *menu = MENU_GetMenu((HMENU)id); if (menu) menu->wFlags |= MF_POPUP; else { @@ -1814,8 +1815,7 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT_PTR id, } item->wID = id; - if (flags & MF_POPUP) - item->hSubMenu = id; + if (flags & MF_POPUP) item->hSubMenu = (HMENU)id; if ((item->fType & MF_POPUP) && !(flags & MF_POPUP) ) flags |= MF_POPUP; /* keep popup */ @@ -2074,8 +2074,8 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu, /* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */ if (!(wFlags & TPM_NONOTIFY)) - SendMessageA( hwndOwner, WM_INITMENUPOPUP, item->hSubMenu, - MAKELONG( menu->FocusedItem, IS_SYSTEM_MENU(menu) )); + SendMessageA( hwndOwner, WM_INITMENUPOPUP, (WPARAM)item->hSubMenu, + MAKELONG( menu->FocusedItem, IS_SYSTEM_MENU(menu) )); item = &menu->items[menu->FocusedItem]; rect = item->rect; @@ -2981,7 +2981,7 @@ static BOOL MENU_InitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT wFlags) if (!(wFlags & TPM_NONOTIFY)) { POPUPMENU *menu; - SendMessageA( hWnd, WM_INITMENU, hMenu, 0 ); + SendMessageA( hWnd, WM_INITMENU, (WPARAM)hMenu, 0 ); if ((menu = MENU_GetMenu( hMenu )) && (!menu->Height)) { /* app changed/recreated menu bar entries in WM_INITMENU Recalculate menu sizes else clicks will not work */ @@ -3101,7 +3101,7 @@ BOOL WINAPI TrackPopupMenu( HMENU hMenu, UINT wFlags, INT x, INT y, /* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */ if (!(wFlags & TPM_NONOTIFY)) - SendMessageA( hWnd, WM_INITMENUPOPUP, hMenu, 0); + SendMessageA( hWnd, WM_INITMENUPOPUP, (WPARAM)hMenu, 0); if (MENU_ShowPopup( hWnd, hMenu, 0, x, y, 0, 0 )) ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd, lpRect ); @@ -3213,32 +3213,6 @@ UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth, } -/******************************************************************* - * ChangeMenu (USER.153) - */ -BOOL16 WINAPI ChangeMenu16( HMENU16 hMenu, UINT16 pos, SEGPTR data, - UINT16 id, UINT16 flags ) -{ - TRACE("menu=%04x pos=%d data=%08lx id=%04x flags=%04x\n", - hMenu, pos, (DWORD)data, id, flags ); - if (flags & MF_APPEND) return AppendMenu16( hMenu, flags & ~MF_APPEND, - id, data ); - - /* FIXME: Word passes the item id in 'pos' and 0 or 0xffff as id */ - /* for MF_DELETE. We should check the parameters for all others */ - /* MF_* actions also (anybody got a doc on ChangeMenu?). */ - - if (flags & MF_DELETE) return DeleteMenu16(hMenu, pos, flags & ~MF_DELETE); - if (flags & MF_CHANGE) return ModifyMenu16(hMenu, pos, flags & ~MF_CHANGE, - id, data ); - if (flags & MF_REMOVE) return RemoveMenu16(hMenu, - flags & MF_BYPOSITION ? pos : id, - flags & ~MF_REMOVE ); - /* Default: MF_INSERT */ - return InsertMenu16( hMenu, pos, flags, id, data ); -} - - /******************************************************************* * ChangeMenuA (USER32.@) */ @@ -3281,15 +3255,6 @@ BOOL WINAPI ChangeMenuW( HMENU hMenu, UINT pos, LPCWSTR data, } -/******************************************************************* - * CheckMenuItem (USER.154) - */ -BOOL16 WINAPI CheckMenuItem16( HMENU16 hMenu, UINT16 id, UINT16 flags ) -{ - return (BOOL16)CheckMenuItem( hMenu, id, flags ); -} - - /******************************************************************* * CheckMenuItem (USER32.@) */ @@ -3307,15 +3272,6 @@ DWORD WINAPI CheckMenuItem( HMENU hMenu, UINT id, UINT flags ) } -/********************************************************************** - * EnableMenuItem (USER.155) - */ -UINT16 WINAPI EnableMenuItem16( HMENU16 hMenu, UINT16 wItemID, UINT16 wFlags ) -{ - return EnableMenuItem( hMenu, wItemID, wFlags ); -} - - /********************************************************************** * EnableMenuItem (USER32.@) */ @@ -3360,16 +3316,6 @@ UINT WINAPI EnableMenuItem( HMENU hMenu, UINT wItemID, UINT wFlags ) } -/******************************************************************* - * GetMenuString (USER.161) - */ -INT16 WINAPI GetMenuString16( HMENU16 hMenu, UINT16 wItemID, - LPSTR str, INT16 nMaxSiz, UINT16 wFlags ) -{ - return GetMenuStringA( hMenu, wItemID, str, nMaxSiz, wFlags ); -} - - /******************************************************************* * GetMenuStringA (USER32.@) */ @@ -3432,15 +3378,6 @@ BOOL WINAPI HiliteMenuItem( HWND hWnd, HMENU hMenu, UINT wItemID, } -/********************************************************************** - * GetMenuState (USER.250) - */ -UINT16 WINAPI GetMenuState16( HMENU16 hMenu, UINT16 wItemID, UINT16 wFlags ) -{ - return GetMenuState( hMenu, wItemID, wFlags ); -} - - /********************************************************************** * GetMenuState (USER32.@) */ @@ -3467,19 +3404,6 @@ UINT WINAPI GetMenuState( HMENU hMenu, UINT wItemID, UINT wFlags ) } -/********************************************************************** - * GetMenuItemCount (USER.263) - */ -INT16 WINAPI GetMenuItemCount16( HMENU16 hMenu ) -{ - LPPOPUPMENU menu = MENU_GetMenu(hMenu); - if (!menu) return -1; - TRACE("(%04x) returning %d\n", - hMenu, menu->nItems ); - return menu->nItems; -} - - /********************************************************************** * GetMenuItemCount (USER32.@) */ @@ -3492,13 +3416,6 @@ INT WINAPI GetMenuItemCount( HMENU hMenu ) return menu->nItems; } -/********************************************************************** - * GetMenuItemID (USER.264) - */ -UINT16 WINAPI GetMenuItemID16( HMENU16 hMenu, INT16 nPos ) -{ - return (UINT16) GetMenuItemID (hMenu, nPos); -} /********************************************************************** * GetMenuItemID (USER32.@) @@ -3513,19 +3430,6 @@ UINT WINAPI GetMenuItemID( HMENU hMenu, INT nPos ) } -/******************************************************************* - * InsertMenu (USER.410) - */ -BOOL16 WINAPI InsertMenu16( HMENU16 hMenu, UINT16 pos, UINT16 flags, - UINT16 id, SEGPTR data ) -{ - UINT pos32 = (UINT)pos; - if ((pos == (UINT16)-1) && (flags & MF_BYPOSITION)) pos32 = (UINT)-1; - if (IS_STRING_ITEM(flags) && data) - return InsertMenuA( hMenu, pos32, flags, id, MapSL(data) ); - return InsertMenuA( hMenu, pos32, flags, id, (LPSTR)data ); -} - /******************************************************************* * InsertMenuW (USER32.@) @@ -3552,7 +3456,7 @@ BOOL WINAPI InsertMenuW( HMENU hMenu, UINT pos, UINT flags, } if (flags & MF_POPUP) /* Set the MF_POPUP flag on the popup-menu */ - (MENU_GetMenu((HMENU16)id))->wFlags |= MF_POPUP; + (MENU_GetMenu((HMENU)id))->wFlags |= MF_POPUP; item->hCheckBit = item->hUnCheckBit = 0; return TRUE; @@ -3583,15 +3487,6 @@ BOOL WINAPI InsertMenuA( HMENU hMenu, UINT pos, UINT flags, } -/******************************************************************* - * AppendMenu (USER.411) - */ -BOOL16 WINAPI AppendMenu16(HMENU16 hMenu, UINT16 flags, UINT16 id, SEGPTR data) -{ - return InsertMenu16( hMenu, -1, flags | MF_BYPOSITION, id, data ); -} - - /******************************************************************* * AppendMenuA (USER32.@) */ @@ -3612,15 +3507,6 @@ BOOL WINAPI AppendMenuW( HMENU hMenu, UINT flags, } -/********************************************************************** - * RemoveMenu (USER.412) - */ -BOOL16 WINAPI RemoveMenu16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags ) -{ - return RemoveMenu( hMenu, nPos, wFlags ); -} - - /********************************************************************** * RemoveMenu (USER32.@) */ @@ -3657,15 +3543,6 @@ BOOL WINAPI RemoveMenu( HMENU hMenu, UINT nPos, UINT wFlags ) } -/********************************************************************** - * DeleteMenu (USER.413) - */ -BOOL16 WINAPI DeleteMenu16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags ) -{ - return DeleteMenu( hMenu, nPos, wFlags ); -} - - /********************************************************************** * DeleteMenu (USER32.@) */ @@ -3680,18 +3557,6 @@ BOOL WINAPI DeleteMenu( HMENU hMenu, UINT nPos, UINT wFlags ) } -/******************************************************************* - * ModifyMenu (USER.414) - */ -BOOL16 WINAPI ModifyMenu16( HMENU16 hMenu, UINT16 pos, UINT16 flags, - UINT16 id, SEGPTR data ) -{ - if (IS_STRING_ITEM(flags)) - return ModifyMenuA( hMenu, pos, flags, id, MapSL(data) ); - return ModifyMenuA( hMenu, pos, flags, id, (LPSTR)data ); -} - - /******************************************************************* * ModifyMenuW (USER32.@) */ @@ -3741,15 +3606,6 @@ BOOL WINAPI ModifyMenuA( HMENU hMenu, UINT pos, UINT flags, } -/********************************************************************** - * CreatePopupMenu (USER.415) - */ -HMENU16 WINAPI CreatePopupMenu16(void) -{ - return CreatePopupMenu(); -} - - /********************************************************************** * CreatePopupMenu (USER32.@) */ @@ -3776,16 +3632,6 @@ DWORD WINAPI GetMenuCheckMarkDimensions(void) } -/********************************************************************** - * SetMenuItemBitmaps (USER.418) - */ -BOOL16 WINAPI SetMenuItemBitmaps16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags, - HBITMAP16 hNewUnCheck, HBITMAP16 hNewCheck) -{ - return SetMenuItemBitmaps( hMenu, nPos, wFlags, hNewUnCheck, hNewCheck ); -} - - /********************************************************************** * SetMenuItemBitmaps (USER32.@) */ @@ -3811,15 +3657,6 @@ BOOL WINAPI SetMenuItemBitmaps( HMENU hMenu, UINT nPos, UINT wFlags, } -/********************************************************************** - * CreateMenu (USER.151) - */ -HMENU16 WINAPI CreateMenu16(void) -{ - return CreateMenu(); -} - - /********************************************************************** * CreateMenu (USER32.@) */ @@ -3841,15 +3678,6 @@ HMENU WINAPI CreateMenu(void) } -/********************************************************************** - * DestroyMenu (USER.152) - */ -BOOL16 WINAPI DestroyMenu16( HMENU16 hMenu ) -{ - return DestroyMenu( hMenu ); -} - - /********************************************************************** * DestroyMenu (USER32.@) */ @@ -4009,15 +3837,6 @@ BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu ) -/********************************************************************** - * GetSubMenu (USER.159) - */ -HMENU16 WINAPI GetSubMenu16( HMENU16 hMenu, INT16 nPos ) -{ - return GetSubMenu( hMenu, nPos ); -} - - /********************************************************************** * GetSubMenu (USER32.@) */ @@ -4106,19 +3925,10 @@ HMENU16 WINAPI LoadMenu16( HINSTANCE16 instance, LPCSTR name ) HGLOBAL16 handle; HMENU16 hMenu; - TRACE("(%04x,%s)\n", instance, debugstr_a(name) ); - - if (HIWORD(name)) - { - if (name[0] == '#') name = (LPCSTR)atoi( name + 1 ); - } - + if (HIWORD(name) && name[0] == '#') name = (LPCSTR)atoi( name + 1 ); if (!name) return 0; - /* check for Win32 module */ - if (HIWORD(instance)) return LoadMenuA( instance, name ); instance = GetExePtr( instance ); - if (!(hRsrc = FindResource16( instance, name, RT_MENUA ))) return 0; if (!(handle = LoadResource16( instance, hRsrc ))) return 0; hMenu = LoadMenuIndirect16(LockResource16(handle)); @@ -4229,15 +4039,6 @@ HMENU WINAPI LoadMenuIndirectW( LPCVOID template ) } -/********************************************************************** - * IsMenu (USER.358) - */ -BOOL16 WINAPI IsMenu16( HMENU16 hmenu ) -{ - return IsMenu( hmenu ); -} - - /********************************************************************** * IsMenu (USER32.@) */ @@ -4580,32 +4381,6 @@ UINT WINAPI GetMenuDefaultItem(HMENU hmenu, UINT bypos, UINT flags) } -/******************************************************************* - * InsertMenuItem (USER.441) - * - * FIXME: untested - */ -BOOL16 WINAPI InsertMenuItem16( HMENU16 hmenu, UINT16 pos, BOOL16 byposition, - const MENUITEMINFO16 *mii ) -{ - MENUITEMINFOA miia; - - miia.cbSize = sizeof(miia); - miia.fMask = mii->fMask; - miia.dwTypeData = (LPSTR)mii->dwTypeData; - miia.fType = mii->fType; - miia.fState = mii->fState; - miia.wID = mii->wID; - miia.hSubMenu = mii->hSubMenu; - miia.hbmpChecked = mii->hbmpChecked; - miia.hbmpUnchecked = mii->hbmpUnchecked; - miia.dwItemData = mii->dwItemData; - miia.cch = mii->cch; - if (IS_STRING_ITEM(miia.fType)) - miia.dwTypeData = MapSL(mii->dwTypeData); - return InsertMenuItemA( hmenu, pos, byposition, &miia ); -} - /********************************************************************** * InsertMenuItemA (USER32.@) @@ -4667,15 +4442,6 @@ BOOL WINAPI CheckMenuRadioItem(HMENU hMenu, return TRUE; } -/********************************************************************** - * CheckMenuRadioItem (USER.666) - */ -BOOL16 WINAPI CheckMenuRadioItem16(HMENU16 hMenu, - UINT16 first, UINT16 last, UINT16 check, - BOOL16 bypos) -{ - return CheckMenuRadioItem (hMenu, first, last, check, bypos); -} /********************************************************************** * GetMenuItemRect (USER32.@) @@ -4790,14 +4556,6 @@ BOOL WINAPI GetMenuInfo (HMENU hMenu, LPMENUINFO lpmi) return FALSE; } -/********************************************************************** - * SetMenuContextHelpId (USER.384) - */ -BOOL16 WINAPI SetMenuContextHelpId16( HMENU16 hMenu, DWORD dwContextHelpID) -{ - return SetMenuContextHelpId( hMenu, dwContextHelpID ); -} - /********************************************************************** * SetMenuContextHelpId (USER32.@) @@ -4816,13 +4574,6 @@ BOOL WINAPI SetMenuContextHelpId( HMENU hMenu, DWORD dwContextHelpID) return FALSE; } -/********************************************************************** - * GetMenuContextHelpId (USER.385) - */ -DWORD WINAPI GetMenuContextHelpId16( HMENU16 hMenu ) -{ - return GetMenuContextHelpId( hMenu ); -} /********************************************************************** * GetMenuContextHelpId (USER32.@) diff --git a/controls/scroll.c b/controls/scroll.c index a3d999e087a..72e2c6222e3 100644 --- a/controls/scroll.c +++ b/controls/scroll.c @@ -1290,12 +1290,12 @@ static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam, &arrowSize, &thumbSize, &thumbPos ); if (!vertical) { - CreateCaret(hwnd,1, thumbSize-2, rect.bottom-rect.top-2); + CreateCaret(hwnd, (HBITMAP)1, thumbSize-2, rect.bottom-rect.top-2); SetCaretPos(thumbPos+1, rect.top+1); } else { - CreateCaret(hwnd,1, rect.right-rect.left-2,thumbSize-2); + CreateCaret(hwnd, (HBITMAP)1, rect.right-rect.left-2,thumbSize-2); SetCaretPos(rect.top+1, thumbPos+1); } ShowCaret(hwnd); diff --git a/dlls/user/caret.c b/dlls/user/caret.c index bcfa36c2905..0d14194db42 100644 --- a/dlls/user/caret.c +++ b/dlls/user/caret.c @@ -116,7 +116,7 @@ BOOL WINAPI CreateCaret( HWND hwnd, HBITMAP bitmap, INT width, INT height ) if (!hwnd) return FALSE; - if (bitmap && (bitmap != 1)) + if (bitmap && (bitmap != (HBITMAP)1)) { BITMAP bmp; if (!GetObjectA( bitmap, sizeof(bmp), &bmp )) return FALSE; @@ -151,7 +151,7 @@ BOOL WINAPI CreateCaret( HWND hwnd, HBITMAP bitmap, INT width, INT height ) { HBITMAP hPrevBmp = SelectObject(hMemDC, hBmp); SetRect( &r, 0, 0, width, height ); - FillRect(hMemDC, &r, (bitmap ? COLOR_GRAYTEXT : COLOR_WINDOW) + 1); + FillRect(hMemDC, &r, (HBRUSH)((bitmap ? COLOR_GRAYTEXT : COLOR_WINDOW) + 1)); SelectObject(hMemDC, hPrevBmp); } DeleteDC(hMemDC); diff --git a/dlls/user/focus.c b/dlls/user/focus.c index a6e7de8e4c6..7a18f12688a 100644 --- a/dlls/user/focus.c +++ b/dlls/user/focus.c @@ -192,7 +192,7 @@ static BOOL set_foreground_window( HWND hwnd, BOOL mouse ) ret = set_active_window( 0, NULL, mouse, TRUE ); if (send_msg_new) /* new window belongs to other thread */ - SendNotifyMessageW( hwnd, WM_WINE_SETACTIVEWINDOW, hwnd, 0 ); + SendNotifyMessageW( hwnd, WM_WINE_SETACTIVEWINDOW, (WPARAM)hwnd, 0 ); else /* new window belongs to us */ ret = set_active_window( hwnd, NULL, mouse, TRUE ); } diff --git a/dlls/user/painting.c b/dlls/user/painting.c index b5e325b6fe2..04e06fa9ec8 100644 --- a/dlls/user/painting.c +++ b/dlls/user/painting.c @@ -54,7 +54,7 @@ static void add_paint_count( HWND hwnd, int incr ) */ static HRGN copy_rgn( HRGN hSrc ) { - if (hSrc > 1) + if (hSrc > (HRGN)1) { HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 ); CombineRgn( hrgn, hSrc, 0, RGN_COPY ); @@ -71,7 +71,7 @@ static HRGN copy_rgn( HRGN hSrc ) */ static void get_update_regions( WND *win, HRGN *whole_rgn, HRGN *client_rgn ) { - if (win->hrgnUpdate > 1) + if (win->hrgnUpdate > (HRGN)1) { RECT client, update; @@ -126,22 +126,22 @@ static HRGN begin_ncpaint( HWND hwnd ) if (whole_rgn) /* NOTE: WM_NCPAINT allows wParam to be 1 */ { WIN_ReleasePtr( wnd ); - SendMessageA( hwnd, WM_NCPAINT, whole_rgn, 0 ); - if (whole_rgn > 1) DeleteObject( whole_rgn ); + SendMessageA( hwnd, WM_NCPAINT, (WPARAM)whole_rgn, 0 ); + if (whole_rgn > (HRGN)1) DeleteObject( whole_rgn ); /* make sure the window still exists before continuing */ if (!(wnd = WIN_GetPtr( hwnd )) || wnd == WND_OTHER_PROCESS) { - if (client_rgn > 1) DeleteObject( client_rgn ); + if (client_rgn > (HRGN)1) DeleteObject( client_rgn ); return 0; } } if (wnd->hrgnUpdate || (wnd->flags & WIN_INTERNAL_PAINT)) add_paint_count( hwnd, -1 ); - if (wnd->hrgnUpdate > 1) DeleteObject( wnd->hrgnUpdate ); + if (wnd->hrgnUpdate > (HRGN)1) DeleteObject( wnd->hrgnUpdate ); wnd->hrgnUpdate = 0; wnd->flags &= ~(WIN_INTERNAL_PAINT | WIN_NEEDS_NCPAINT | WIN_NEEDS_BEGINPAINT); - if (client_rgn > 1) OffsetRgn( client_rgn, wnd->rectWindow.left - wnd->rectClient.left, - wnd->rectWindow.top - wnd->rectClient.top ); + if (client_rgn > (HRGN)1) OffsetRgn( client_rgn, wnd->rectWindow.left - wnd->rectClient.left, + wnd->rectWindow.top - wnd->rectClient.top ); WIN_ReleasePtr( wnd ); return client_rgn; } @@ -181,7 +181,7 @@ HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps ) if (GetClassLongA( hwnd, GCL_STYLE ) & CS_PARENTDC) { /* Don't clip the output to the update region for CS_PARENTDC window */ - if (hrgnUpdate > 1) DeleteObject( hrgnUpdate ); + if (hrgnUpdate > (HRGN)1) DeleteObject( hrgnUpdate ); hrgnUpdate = 0; dcx_flags &= ~DCX_INTERSECTRGN; } @@ -191,7 +191,7 @@ HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps ) { hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 ); } - else if (hrgnUpdate == 1) /* whole client area, don't clip */ + else if (hrgnUpdate == (HRGN)1) /* whole client area, don't clip */ { hrgnUpdate = 0; dcx_flags &= ~DCX_INTERSECTRGN; diff --git a/dlls/user/property.c b/dlls/user/property.c index de4e5d9e7eb..d026811beb6 100644 --- a/dlls/user/property.c +++ b/dlls/user/property.c @@ -311,10 +311,10 @@ INT16 WINAPI EnumProps16( HWND16 hwnd, PROPENUMPROC16 func ) if (list[i].string) /* it was a string originally */ { if (!GlobalGetAtomNameA( list[i].atom, string, ATOM_BUFFER_SIZE )) continue; - ret = PROP_CallTo16_word_wlw( func, hwnd, segptr, list[i].handle ); + ret = PROP_CallTo16_word_wlw( func, hwnd, segptr, LOWORD(list[i].handle) ); } else - ret = PROP_CallTo16_word_wlw( func, hwnd, list[i].atom, list[i].handle ); + ret = PROP_CallTo16_word_wlw( func, hwnd, list[i].atom, LOWORD(list[i].handle) ); if (!ret) break; } UnMapLS( segptr ); diff --git a/dlls/user/text.c b/dlls/user/text.c index 6dfe87a29dc..d88728dacb3 100644 --- a/dlls/user/text.c +++ b/dlls/user/text.c @@ -1075,25 +1075,6 @@ INT WINAPI DrawTextA( HDC hdc, LPCSTR str, INT count, LPRECT rect, UINT flags ) return DrawTextExA( hdc, (LPSTR)str, count, rect, flags, &dtp ); } -/*********************************************************************** - * DrawText (USER.85) - */ -INT16 WINAPI DrawText16( HDC16 hdc, LPCSTR str, INT16 count, LPRECT16 rect, UINT16 flags ) -{ - INT16 ret; - - if (rect) - { - RECT rect32; - CONV_RECT16TO32( rect, &rect32 ); - ret = DrawTextA( hdc, str, count, &rect32, flags ); - CONV_RECT32TO16( &rect32, rect ); - } - else ret = DrawTextA( hdc, str, count, NULL, flags); - return ret; -} - - /*********************************************************************** * * GrayString functions @@ -1113,7 +1094,7 @@ struct gray_string_info static BOOL CALLBACK gray_string_callback( HDC hdc, LPARAM param, INT len ) { const struct gray_string_info *info = (struct gray_string_info *)param; - return TEXT_CallTo16_word_wlw( info->proc, hdc, info->param, len ); + return TEXT_CallTo16_word_wlw( info->proc, HDC_16(hdc), info->param, len ); } /*********************************************************************** diff --git a/dlls/user/user16.c b/dlls/user/user16.c index 2f442935672..4428553df0f 100644 --- a/dlls/user/user16.c +++ b/dlls/user/user16.c @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "wine/winuser16.h" #include "winbase.h" #include "wownt32.h" @@ -31,6 +32,9 @@ #define HANDLE_32(h16) ((HANDLE)(ULONG_PTR)(h16)) #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16)) +#define IS_MENU_STRING_ITEM(flags) \ + (((flags) & (MF_STRING | MF_BITMAP | MF_OWNERDRAW | MF_SEPARATOR)) == MF_STRING) + WORD WINAPI DestroyIcon32(HGLOBAL16, UINT16); @@ -58,6 +62,26 @@ BOOL16 WINAPI DrawIcon16(HDC16 hdc, INT16 x, INT16 y, HICON16 hIcon) return DrawIcon(HDC_32(hdc), x, y, HICON_32(hIcon)); } + +/*********************************************************************** + * DrawText (USER.85) + */ +INT16 WINAPI DrawText16( HDC16 hdc, LPCSTR str, INT16 count, LPRECT16 rect, UINT16 flags ) +{ + INT16 ret; + + if (rect) + { + RECT rect32; + CONV_RECT16TO32( rect, &rect32 ); + ret = DrawTextA( HDC_32(hdc), str, count, &rect32, flags ); + CONV_RECT32TO16( &rect32, rect ); + } + else ret = DrawTextA( hdc, str, count, NULL, flags); + return ret; +} + + /*********************************************************************** * IconSize (USER.86) * @@ -68,6 +92,102 @@ DWORD WINAPI IconSize16(void) return MAKELONG(GetSystemMetrics(SM_CYICON), GetSystemMetrics(SM_CXICON)); } + +/********************************************************************** + * CreateMenu (USER.151) + */ +HMENU16 WINAPI CreateMenu16(void) +{ + return HMENU_16( CreateMenu() ); +} + + +/********************************************************************** + * DestroyMenu (USER.152) + */ +BOOL16 WINAPI DestroyMenu16( HMENU16 hMenu ) +{ + return DestroyMenu( HMENU_32(hMenu) ); +} + + +/******************************************************************* + * ChangeMenu (USER.153) + */ +BOOL16 WINAPI ChangeMenu16( HMENU16 hMenu, UINT16 pos, SEGPTR data, + UINT16 id, UINT16 flags ) +{ + if (flags & MF_APPEND) return AppendMenu16( hMenu, flags & ~MF_APPEND, id, data ); + + /* FIXME: Word passes the item id in 'pos' and 0 or 0xffff as id */ + /* for MF_DELETE. We should check the parameters for all others */ + /* MF_* actions also (anybody got a doc on ChangeMenu?). */ + + if (flags & MF_DELETE) return DeleteMenu16(hMenu, pos, flags & ~MF_DELETE); + if (flags & MF_CHANGE) return ModifyMenu16(hMenu, pos, flags & ~MF_CHANGE, id, data ); + if (flags & MF_REMOVE) return RemoveMenu16(hMenu, flags & MF_BYPOSITION ? pos : id, + flags & ~MF_REMOVE ); + /* Default: MF_INSERT */ + return InsertMenu16( hMenu, pos, flags, id, data ); +} + + +/******************************************************************* + * CheckMenuItem (USER.154) + */ +BOOL16 WINAPI CheckMenuItem16( HMENU16 hMenu, UINT16 id, UINT16 flags ) +{ + return CheckMenuItem( HMENU_32(hMenu), id, flags ); +} + + +/********************************************************************** + * EnableMenuItem (USER.155) + */ +UINT16 WINAPI EnableMenuItem16( HMENU16 hMenu, UINT16 wItemID, UINT16 wFlags ) +{ + return EnableMenuItem( HMENU_32(hMenu), wItemID, wFlags ); +} + + +/********************************************************************** + * GetSubMenu (USER.159) + */ +HMENU16 WINAPI GetSubMenu16( HMENU16 hMenu, INT16 nPos ) +{ + return HMENU_16( GetSubMenu( HMENU_32(hMenu), nPos ) ); +} + + +/******************************************************************* + * GetMenuString (USER.161) + */ +INT16 WINAPI GetMenuString16( HMENU16 hMenu, UINT16 wItemID, + LPSTR str, INT16 nMaxSiz, UINT16 wFlags ) +{ + return GetMenuStringA( HMENU_32(hMenu), wItemID, str, nMaxSiz, wFlags ); +} + + +/********************************************************************** + * WinHelp (USER.171) + */ +BOOL16 WINAPI WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand, + DWORD dwData ) +{ + BOOL ret; + DWORD mutex_count; + + /* We might call WinExec() */ + ReleaseThunkLock(&mutex_count); + + ret = WinHelpA(WIN_Handle32(hWnd), lpHelpFile, wCommand, (DWORD)MapSL(dwData)); + + RestoreThunkLock(mutex_count); + return ret; +} + + /*********************************************************************** * LoadCursor (USER.173) */ @@ -120,6 +240,34 @@ HCURSOR16 WINAPI GetCursor16(void) return HCURSOR_16(GetCursor()); } + +/********************************************************************** + * GetMenuState (USER.250) + */ +UINT16 WINAPI GetMenuState16( HMENU16 hMenu, UINT16 wItemID, UINT16 wFlags ) +{ + return GetMenuState( HMENU_32(hMenu), wItemID, wFlags ); +} + + +/********************************************************************** + * GetMenuItemCount (USER.263) + */ +INT16 WINAPI GetMenuItemCount16( HMENU16 hMenu ) +{ + return GetMenuItemCount( HMENU_32(hMenu) ); +} + + +/********************************************************************** + * GetMenuItemID (USER.264) + */ +UINT16 WINAPI GetMenuItemID16( HMENU16 hMenu, INT16 nPos ) +{ + return GetMenuItemID( HMENU_32(hMenu), nPos ); +} + + /*********************************************************************** * GlobalAddAtom (USER.268) */ @@ -152,6 +300,16 @@ UINT16 WINAPI GlobalGetAtomName16(ATOM nAtom, LPSTR lpBuffer, INT16 nSize) return GlobalGetAtomNameA(nAtom, lpBuffer, nSize); } + +/*********************************************************************** + * GetSysColorBrush (USER.281) + */ +HBRUSH16 WINAPI GetSysColorBrush16( INT16 index ) +{ + return HBRUSH_16( GetSysColorBrush(index) ); +} + + /*********************************************************************** * SelectPalette (USER.282) */ @@ -168,6 +326,34 @@ UINT16 WINAPI RealizePalette16( HDC16 hdc ) return UserRealizePalette( HDC_32(hdc) ); } + +/********************************************************************** + * IsMenu (USER.358) + */ +BOOL16 WINAPI IsMenu16( HMENU16 hmenu ) +{ + return IsMenu( HMENU_32(hmenu) ); +} + + +/********************************************************************** + * SetMenuContextHelpId (USER.384) + */ +BOOL16 WINAPI SetMenuContextHelpId16( HMENU16 hMenu, DWORD dwContextHelpID) +{ + return SetMenuContextHelpId( HMENU_32(hMenu), dwContextHelpID ); +} + + +/********************************************************************** + * GetMenuContextHelpId (USER.385) + */ +DWORD WINAPI GetMenuContextHelpId16( HMENU16 hMenu ) +{ + return GetMenuContextHelpId( HMENU_32(hMenu) ); +} + + /*********************************************************************** * LoadImage (USER.389) * @@ -238,6 +424,107 @@ HCURSOR16 WINAPI CreateCursor16(HINSTANCE16 hInstance, return CreateCursorIconIndirect16(hInstance, &info, lpANDbits, lpXORbits); } + +/******************************************************************* + * InsertMenu (USER.410) + */ +BOOL16 WINAPI InsertMenu16( HMENU16 hMenu, UINT16 pos, UINT16 flags, + UINT16 id, SEGPTR data ) +{ + UINT pos32 = (UINT)pos; + if ((pos == (UINT16)-1) && (flags & MF_BYPOSITION)) pos32 = (UINT)-1; + if (IS_MENU_STRING_ITEM(flags) && data) + return InsertMenuA( HMENU_32(hMenu), pos32, flags, id, MapSL(data) ); + return InsertMenuA( HMENU_32(hMenu), pos32, flags, id, (LPSTR)data ); +} + + +/******************************************************************* + * AppendMenu (USER.411) + */ +BOOL16 WINAPI AppendMenu16(HMENU16 hMenu, UINT16 flags, UINT16 id, SEGPTR data) +{ + return InsertMenu16( HMENU_32(hMenu), -1, flags | MF_BYPOSITION, id, data ); +} + + +/********************************************************************** + * RemoveMenu (USER.412) + */ +BOOL16 WINAPI RemoveMenu16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags ) +{ + return RemoveMenu( HMENU_32(hMenu), nPos, wFlags ); +} + + +/********************************************************************** + * DeleteMenu (USER.413) + */ +BOOL16 WINAPI DeleteMenu16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags ) +{ + return DeleteMenu( HMENU_32(hMenu), nPos, wFlags ); +} + + +/******************************************************************* + * ModifyMenu (USER.414) + */ +BOOL16 WINAPI ModifyMenu16( HMENU16 hMenu, UINT16 pos, UINT16 flags, + UINT16 id, SEGPTR data ) +{ + if (IS_MENU_STRING_ITEM(flags)) + return ModifyMenuA( HMENU_32(hMenu), pos, flags, id, MapSL(data) ); + return ModifyMenuA( HMENU_32(hMenu), pos, flags, id, (LPSTR)data ); +} + + +/********************************************************************** + * CreatePopupMenu (USER.415) + */ +HMENU16 WINAPI CreatePopupMenu16(void) +{ + return HMENU_16( CreatePopupMenu() ); +} + + +/********************************************************************** + * SetMenuItemBitmaps (USER.418) + */ +BOOL16 WINAPI SetMenuItemBitmaps16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags, + HBITMAP16 hNewUnCheck, HBITMAP16 hNewCheck) +{ + return SetMenuItemBitmaps( HMENU_32(hMenu), nPos, wFlags, + HBITMAP_32(hNewUnCheck), HBITMAP_32(hNewCheck) ); +} + + +/******************************************************************* + * InsertMenuItem (USER.441) + * + * FIXME: untested + */ +BOOL16 WINAPI InsertMenuItem16( HMENU16 hmenu, UINT16 pos, BOOL16 byposition, + const MENUITEMINFO16 *mii ) +{ + MENUITEMINFOA miia; + + miia.cbSize = sizeof(miia); + miia.fMask = mii->fMask; + miia.dwTypeData = (LPSTR)mii->dwTypeData; + miia.fType = mii->fType; + miia.fState = mii->fState; + miia.wID = mii->wID; + miia.hSubMenu = mii->hSubMenu; + miia.hbmpChecked = mii->hbmpChecked; + miia.hbmpUnchecked = mii->hbmpUnchecked; + miia.dwItemData = mii->dwItemData; + miia.cch = mii->cch; + if (IS_MENU_STRING_ITEM(miia.fType)) + miia.dwTypeData = MapSL(mii->dwTypeData); + return InsertMenuItemA( HMENU_32(hmenu), pos, byposition, &miia ); +} + + /********************************************************************** * CreateIconFromResourceEx (USER.450) * @@ -440,19 +727,10 @@ BOOL16 WINAPI DrawEdge16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags ) } /********************************************************************** - * WinHelp (USER.171) + * CheckMenuRadioItem (USER.666) */ -BOOL16 WINAPI WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand, - DWORD dwData ) +BOOL16 WINAPI CheckMenuRadioItem16(HMENU16 hMenu, UINT16 first, UINT16 last, + UINT16 check, BOOL16 bypos) { - BOOL ret; - DWORD mutex_count; - - /* We might call WinExec() */ - ReleaseThunkLock(&mutex_count); - - ret = WinHelpA(WIN_Handle32(hWnd), lpHelpFile, wCommand, (DWORD)MapSL(dwData)); - - RestoreThunkLock(mutex_count); - return ret; + return CheckMenuRadioItem( HMENU_32(hMenu), first, last, check, bypos ); } diff --git a/windows/class.c b/windows/class.c index b6a7b643cba..009cf6f1465 100644 --- a/windows/class.c +++ b/windows/class.c @@ -1011,7 +1011,7 @@ LONG WINAPI SetClassLongW( HWND hwnd, INT offset, LONG newval ) break; case GCL_HBRBACKGROUND: retval = (LONG)class->hbrBackground; - class->hbrBackground = newval; + class->hbrBackground = (HBRUSH)newval; break; case GCL_HCURSOR: retval = (LONG)class->hCursor; @@ -1035,7 +1035,7 @@ LONG WINAPI SetClassLongW( HWND hwnd, INT offset, LONG newval ) break; case GCL_HMODULE: retval = (LONG)class->hInstance; - class->hInstance = newval; + class->hInstance = (HINSTANCE)newval; break; case GCW_ATOM: retval = (DWORD)class->atomName; diff --git a/windows/clipboard.c b/windows/clipboard.c index 8931dd78bb4..419080f75f5 100644 --- a/windows/clipboard.c +++ b/windows/clipboard.c @@ -61,12 +61,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(clipboard); * Clipboard context global variables */ -static HANDLE hClipLock = 0; +static DWORD ClipLock = 0; static BOOL bCBHasChanged = FALSE; static HWND hWndClipWindow; /* window that last opened clipboard */ static HWND hWndClipOwner; /* current clipboard owner */ -static HANDLE16 hTaskClipOwner; /* clipboard owner's task */ +static DWORD ClipOwner; /* clipboard owner's thread id */ static HWND hWndViewer; /* start of viewers chain */ /* Clipboard cache initial data. @@ -127,7 +127,6 @@ LPWINE_CLIPFORMAT CLIPBOARD_LookupFormat( WORD wID ) BOOL CLIPBOARD_IsLocked() { BOOL bIsLocked = TRUE; - HANDLE16 hTaskCur = GetCurrentTask(); /* * The clipboard is available: @@ -136,10 +135,10 @@ BOOL CLIPBOARD_IsLocked() * 2. if the caller is the clipboard owners task, AND is responding to a * WM_RENDERFORMAT message. */ - if ( hClipLock == hTaskCur ) + if ( ClipLock == GetCurrentThreadId() ) bIsLocked = FALSE; - else if ( hTaskCur == hTaskClipOwner ) + else if ( ClipOwner == GetCurrentThreadId() ) { /* Check if we're currently executing inside a window procedure * called in response to a WM_RENDERFORMAT message. A WM_RENDERFORMAT @@ -172,7 +171,7 @@ BOOL CLIPBOARD_IsLocked() void CLIPBOARD_ReleaseOwner() { hWndClipOwner = 0; - hTaskClipOwner = 0; + ClipOwner = 0; } /************************************************************************** @@ -753,9 +752,9 @@ BOOL WINAPI OpenClipboard( HWND hWnd ) TRACE("(%04x)...\n", hWnd); - if (!hClipLock) + if (!ClipLock) { - hClipLock = GetCurrentTask(); + ClipLock = GetCurrentThreadId(); /* Save current user of the clipboard */ hWndClipWindow = WIN_GetFullHandle( hWnd ); @@ -785,12 +784,12 @@ BOOL WINAPI CloseClipboard(void) { TRACE("()\n"); - if (hClipLock == GetCurrentTask()) + if (ClipLock == GetCurrentThreadId()) { hWndClipWindow = 0; if (bCBHasChanged && hWndViewer) SendMessageW( hWndViewer, WM_DRAWCLIPBOARD, 0, 0 ); - hClipLock = 0; + ClipLock = 0; } return TRUE; } @@ -813,7 +812,7 @@ BOOL WINAPI EmptyClipboard(void) { TRACE("()\n"); - if (hClipLock != GetCurrentTask()) + if (ClipLock != GetCurrentThreadId()) { WARN("Clipboard not opened by calling task!\n"); return FALSE; @@ -830,7 +829,7 @@ BOOL WINAPI EmptyClipboard(void) hWndClipOwner = hWndClipWindow; /* Save the current task */ - hTaskClipOwner = GetCurrentTask(); + ClipOwner = GetCurrentThreadId(); /* Tell the driver to acquire the selection */ USER_Driver.pAcquireClipboard(); diff --git a/windows/dce.c b/windows/dce.c index e3d9f4d07ec..338dbc687da 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -216,7 +216,7 @@ static void DCE_DeleteClipRgn( DCE* dce ) if( dce->DCXflags & DCX_KEEPCLIPRGN ) dce->DCXflags &= ~DCX_KEEPCLIPRGN; else - if( dce->hClipRgn > 1 ) + if( dce->hClipRgn > (HRGN)1 ) DeleteObject( dce->hClipRgn ); dce->hClipRgn = 0; diff --git a/windows/mdi.c b/windows/mdi.c index 31150a8781a..c92db69b0b0 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -567,7 +567,7 @@ static HWND MDICreateChild( HWND parent, MDICLIENTINFO *ci, seg_cs16 = MapLS( &cs16 ); hwnd = WIN_Handle32( CreateWindow16( cs->szClass, cs->szTitle, style, cs16.x, cs16.y, cs16.cx, cs16.cy, - HWND_16(parent), (HMENU)wIDmenu, + HWND_16(parent), (HMENU16)wIDmenu, cs16.hOwner, (LPVOID)seg_cs16 )); UnMapLS( seg_cs16 ); UnMapLS( title ); @@ -1063,7 +1063,7 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild ) hSysMenuBitmap = hBmpClose; if( !InsertMenuA(menu,0,MF_BYPOSITION | MF_BITMAP | MF_POPUP, - hSysPopup, (LPSTR)(DWORD)hSysMenuBitmap)) + (UINT_PTR)hSysPopup, (LPSTR)hSysMenuBitmap)) { TRACE("not inserted\n"); DestroyMenu(hSysPopup); @@ -1448,7 +1448,7 @@ LRESULT WINAPI DefFrameProc16( HWND16 hwnd, HWND16 hwndMDIClient, MDINEXTMENU next_menu; DefFrameProcW( WIN_Handle32(hwnd), WIN_Handle32(hwndMDIClient), message, wParam, (LPARAM)&next_menu ); - return MAKELONG( next_menu.hmenuNext, HWND_16(next_menu.hwndNext) ); + return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) ); } default: return DefWindowProc16(hwnd, message, wParam, lParam); @@ -1615,7 +1615,7 @@ LRESULT WINAPI DefMDIChildProc16( HWND16 hwnd, UINT16 message, { MDINEXTMENU next_menu; DefMDIChildProcW( WIN_Handle32(hwnd), message, wParam, (LPARAM)&next_menu ); - return MAKELONG( next_menu.hmenuNext, HWND_16(next_menu.hwndNext) ); + return MAKELONG( HMENU_16(next_menu.hmenuNext), HWND_16(next_menu.hwndNext) ); } default: return DefWindowProc16(hwnd, message, wParam, lParam); diff --git a/windows/syscolor.c b/windows/syscolor.c index 34c68419faa..30ddc020f01 100644 --- a/windows/syscolor.c +++ b/windows/syscolor.c @@ -362,15 +362,6 @@ DWORD WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DW return FALSE; } -/*********************************************************************** - * GetSysColorBrush (USER.281) - */ -HBRUSH16 WINAPI GetSysColorBrush16( INT16 index ) -{ - return (HBRUSH16)GetSysColorBrush(index); -} - - /*********************************************************************** * GetSysColorBrush (USER32.@) */ diff --git a/windows/win.c b/windows/win.c index 40c9e99aff8..be96d6b06aa 100644 --- a/windows/win.c +++ b/windows/win.c @@ -1956,7 +1956,7 @@ static LONG WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type ) case GWL_EXSTYLE: retvalue = wndPtr->dwExStyle; break; case GWL_ID: retvalue = (LONG)wndPtr->wIDmenu; break; case GWL_WNDPROC: retvalue = (LONG)WINPROC_GetProc( wndPtr->winproc, type ); break; - case GWL_HINSTANCE: retvalue = wndPtr->hInstance; break; + case GWL_HINSTANCE: retvalue = (LONG)wndPtr->hInstance; break; default: WARN("Unknown offset %d\n", offset ); SetLastError( ERROR_INVALID_INDEX ); @@ -2113,8 +2113,8 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval, retval = reply->old_id; break; case GWL_HINSTANCE: - wndPtr->hInstance = newval; - retval = (HINSTANCE)reply->old_instance; + wndPtr->hInstance = (HINSTANCE)newval; + retval = (ULONG_PTR)reply->old_instance; break; case GWL_USERDATA: wndPtr->userdata = newval; diff --git a/windows/winhelp.c b/windows/winhelp.c index b9bfd85ad6b..6f5e3c0c723 100644 --- a/windows/winhelp.c +++ b/windows/winhelp.c @@ -154,7 +154,7 @@ BOOL WINAPI WinHelpA( HWND hWnd, LPCSTR lpHelpFile, UINT wCommand, ULONG_PTR dwD lpwh->size, lpwh->command, lpwh->data, lpwh->ofsFilename ? (LPSTR)lpwh + lpwh->ofsFilename : ""); - return SendMessageA(hDest, WM_COPYDATA, hWnd, (LPARAM)&cds); + return SendMessageA(hDest, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&cds); } diff --git a/windows/winproc.c b/windows/winproc.c index 58b1d9242fd..fd0f9bbe06c 100644 --- a/windows/winproc.c +++ b/windows/winproc.c @@ -1345,7 +1345,7 @@ INT WINPROC_MapMsg16To32A( HWND hwnd, UINT16 msg16, WPARAM16 wParam16, UINT *pms { MDINEXTMENU *next = HeapAlloc( GetProcessHeap(), 0, sizeof(*next) ); if (!next) return -1; - next->hmenuIn = *plparam; + next->hmenuIn = (HMENU)*plparam; next->hmenuNext = 0; next->hwndNext = 0; *plparam = (LPARAM)next; @@ -2013,11 +2013,11 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32, case WM_MENUSELECT: if(HIWORD(wParam32) & MF_POPUP) { - UINT16 hmenu; + HMENU hmenu; if (((UINT)HIWORD(wParam32) != 0xFFFF) || (*plparam)) { - if((hmenu = GetSubMenu((HMENU16)*plparam, *pwparam16))) - *pwparam16=hmenu; + if((hmenu = GetSubMenu((HMENU)*plparam, *pwparam16))) + *pwparam16=HMENU_16(hmenu); } } /* fall through */ @@ -2125,7 +2125,7 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32, case WM_NEXTMENU: { MDINEXTMENU *next = (MDINEXTMENU *)*plparam; - *plparam = next->hmenuIn; + *plparam = (LPARAM)next->hmenuIn; return 1; } case WM_PAINTCLIPBOARD: @@ -2371,7 +2371,7 @@ void WINPROC_UnmapMsg32ATo16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, case WM_NEXTMENU: { MDINEXTMENU *next = (MDINEXTMENU *)lParam; - next->hmenuNext = LOWORD(p16->lResult); + next->hmenuNext = HMENU_32( LOWORD(p16->lResult) ); next->hwndNext = WIN_Handle32( HIWORD(p16->lResult) ); p16->lResult = 0; }