Commit 7ef66af3 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved some more 16-bit functions to user16.c.

A few fixes for -DSTRICT.
parent 8710a79d
......@@ -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);
}
......
......@@ -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 );
}
......@@ -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);
......
......@@ -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);
......
......@@ -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 );
}
......
......@@ -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;
......
......@@ -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 );
......
......@@ -1076,25 +1076,6 @@ INT WINAPI DrawTextA( HDC hdc, LPCSTR str, INT count, LPRECT rect, UINT flags )
}
/***********************************************************************
* 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 );
}
/***********************************************************************
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
......
......@@ -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);
......
......@@ -363,15 +363,6 @@ DWORD WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DW
}
/***********************************************************************
* GetSysColorBrush (USER.281)
*/
HBRUSH16 WINAPI GetSysColorBrush16( INT16 index )
{
return (HBRUSH16)GetSysColorBrush(index);
}
/***********************************************************************
* GetSysColorBrush (USER32.@)
*/
HBRUSH WINAPI GetSysColorBrush( INT index )
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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;
}
......
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