- Fix a possible integer overflow in NtGdiCreateBitmap
- Don't cast length of LARGE_STRING (ULONG) to USHORT, instead truncate to MAXUSHORT. This is still hacky, but better than before.
- Fix MSVC warnings

svn path=/trunk/; revision=55993
This commit is contained in:
Timo Kreuzer 2012-03-04 11:32:43 +00:00
parent a5bdcfa727
commit a508886eb0
27 changed files with 162 additions and 155 deletions

View file

@ -2038,7 +2038,7 @@ NtUserGetKeyboardLayout(
UINT
NTAPI
NtUserGetKeyboardLayoutList(
INT nItems,
ULONG nItems,
HKL *pHklBuff);
BOOL

View file

@ -62,8 +62,8 @@ NTSTATUS FASTCALL InitSessionImpl(VOID);
/*************** METRIC.C ***************/
BOOL FASTCALL InitMetrics(VOID);
ULONG FASTCALL UserGetSystemMetrics(ULONG Index);
BOOL NTAPI InitMetrics(VOID);
LONG NTAPI UserGetSystemMetrics(ULONG Index);
/*************** KEYBOARD.C ***************/

View file

@ -64,7 +64,7 @@ REGISTER_SYSCLASS DefaultServerClasses[] =
NULL,
FNID_MESSAGEWND,
ICLS_HWNDMESSAGE
}
}
};
static struct
@ -82,8 +82,8 @@ static struct
{ FNID_BUTTON, ICLS_BUTTON},
{ FNID_COMBOBOX, ICLS_COMBOBOX},
{ FNID_COMBOLBOX, ICLS_COMBOLBOX},
{ FNID_DIALOG, ICLS_DIALOG},
{ FNID_EDIT, ICLS_EDIT},
{ FNID_DIALOG, ICLS_DIALOG},
{ FNID_EDIT, ICLS_EDIT},
{ FNID_LISTBOX, ICLS_LISTBOX},
{ FNID_MDICLIENT, ICLS_MDICLIENT},
{ FNID_STATIC, ICLS_STATIC},
@ -97,7 +97,7 @@ FASTCALL
LookupFnIdToiCls(int FnId, int *iCls )
{
int i;
for ( i = 0; i < ARRAYSIZE(FnidToiCls); i++)
{
if (FnidToiCls[i].FnId == FnId)
@ -178,7 +178,7 @@ void FASTCALL DestroyProcessClasses(PPROCESSINFO Process )
{
PCLS Class;
PPROCESSINFO pi = (PPROCESSINFO)Process;
if (pi != NULL)
{
/* Free all local classes */
@ -413,7 +413,7 @@ IntSetClassWndProc(IN OUT PCLS Class,
Class->lpfnWndProc = chWndProc;
Class->Unicode = TRUE;
Class->CSF_flags &= ~CSF_ANSIPROC;
Class->CSF_flags |= CSF_SERVERSIDEPROC;
Class->CSF_flags |= CSF_SERVERSIDEPROC;
}
else
{
@ -433,7 +433,7 @@ IntSetClassWndProc(IN OUT PCLS Class,
{
Class->Unicode = !Ansi;
Class->lpfnWndProc = chWndProc;
Class = Class->pclsNext;
}
@ -936,7 +936,7 @@ IntCreateClass(IN CONST WNDCLASSEXW* lpwcx,
ANSI_STRING AnsiString;
Class->lpszClientAnsiMenuName = (PSTR)pszMenuNameBuffer;
AnsiString.MaximumLength = RtlUnicodeStringToAnsiSize(MenuName);
AnsiString.MaximumLength = (USHORT)RtlUnicodeStringToAnsiSize(MenuName);
AnsiString.Buffer = Class->lpszClientAnsiMenuName;
Status = RtlUnicodeStringToAnsiString(&AnsiString,
MenuName,
@ -1525,7 +1525,7 @@ IntSetClassMenuName(IN PCLS Class,
ANSI_STRING AnsiString;
PWSTR strBufW;
AnsiString.MaximumLength = RtlUnicodeStringToAnsiSize(MenuName);
AnsiString.MaximumLength = (USHORT)RtlUnicodeStringToAnsiSize(MenuName);
strBufW = UserHeapAlloc(MenuName->Length + sizeof(UNICODE_NULL) +
AnsiString.MaximumLength);
@ -1634,8 +1634,8 @@ UserSetClassLongPtr(IN PCLS Class,
TRACE("SetClassLong(%d, %x)\n", Index, NewLong);
if (Index + sizeof(ULONG_PTR) < Index ||
Index + sizeof(ULONG_PTR) > Class->cbclsExtra)
if ((Index + (INT)sizeof(ULONG_PTR)) < Index ||
(Index + (INT)sizeof(ULONG_PTR)) > Class->cbclsExtra)
{
EngSetLastError(ERROR_INVALID_PARAMETER);
return 0;
@ -1822,7 +1822,7 @@ UserGetClassInfo(IN PCLS Class,
lpwcx->style &= ~CS_GLOBALCLASS;
lpwcx->lpfnWndProc = IntGetClassWndProc(Class, Ansi);
lpwcx->cbClsExtra = Class->cbclsExtra;
lpwcx->cbWndExtra = Class->cbwndExtra;
lpwcx->hIcon = Class->hIcon; /* FIXME: Get handle from pointer */
@ -1840,7 +1840,7 @@ UserGetClassInfo(IN PCLS Class,
* lpszClientXxxMenuName should already be mapped to user space.
*/
/* Copy string ptr to user. */
if ( Class->lpszClientUnicodeMenuName != NULL &&
if ( Class->lpszClientUnicodeMenuName != NULL &&
Class->MenuNameIsString)
{
lpwcx->lpszMenuName = UserHeapAddressToUser(Ansi ?
@ -1897,7 +1897,7 @@ UserRegisterSystemClasses(VOID)
ClassName.Length = 0;
ClassName.MaximumLength = 0;
}
wc.cbSize = sizeof(wc);
wc.style = DefaultServerClasses[i].Style;
@ -2016,15 +2016,14 @@ NtUserRegisterClassExWOW(
CapturedMenuName = ProbeForReadUnicodeString(pClassMenuName->pusMenuName);
if ( CapturedName.Length & 1 ||
CapturedMenuName.Length & 1 ||
CapturedClassInfo.cbClsExtra < 0 ||
CapturedClassInfo.cbClsExtra +
CapturedName.Length +
CapturedMenuName.Length +
sizeof(CLS) < CapturedClassInfo.cbClsExtra ||
CapturedClassInfo.cbWndExtra < 0 ||
CapturedClassInfo.hInstance == NULL)
if ( (CapturedName.Length & 1) ||
(CapturedMenuName.Length & 1) ||
(CapturedClassInfo.cbClsExtra < 0) ||
((CapturedClassInfo.cbClsExtra + CapturedName.Length +
CapturedMenuName.Length + sizeof(CLS))
< (ULONG)CapturedClassInfo.cbClsExtra) ||
(CapturedClassInfo.cbWndExtra < 0) ||
(CapturedClassInfo.hInstance == NULL) )
{
ERR("NtUserRegisterClassExWOW Invalid Parameter Error!\n");
goto InvalidParameter;

View file

@ -59,7 +59,7 @@ IntClientShutdown(
break;
}
}
else
else
{
co_IntSendMessage(WndChild->head.h, WM_ENDSESSION, KillTimers, lParams);
if (KillTimers)
@ -82,7 +82,7 @@ IntClientShutdown(
lResult = MCSR_DONOTSHUTDOWN;
}
}
else
else
{
co_IntSendMessage(pWindow->head.h, WM_ENDSESSION, KillTimers, lParams);
if (KillTimers)
@ -141,7 +141,7 @@ DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam)
{
Hook = TRUE;
lResult = co_HOOK_CallHooks(WH_CBT, HCBT_SYSCOMMAND, wParam, lParam);
if (lResult) return lResult;
}
@ -218,7 +218,7 @@ IntDefWindowProc(
return (LRESULT) DefWndControlColor((HDC)wParam, HIWORD(lParam));
case WM_GETHOTKEY:
return DefWndGetHotKey(UserHMGetHandle(Wnd));
return DefWndGetHotKey(UserHMGetHandle(Wnd));
case WM_SETHOTKEY:
return DefWndSetHotKey(Wnd, wParam);

View file

@ -102,8 +102,8 @@ InitDisplayDriver(
/* Initialize the UNICODE_STRING */
ustrDisplayDrivers.Buffer = awcBuffer;
ustrDisplayDrivers.MaximumLength = cbSize;
ustrDisplayDrivers.Length = cbSize;
ustrDisplayDrivers.MaximumLength = (USHORT)cbSize;
ustrDisplayDrivers.Length = (USHORT)cbSize;
/* Set Buffer for description and size of remaining buffer */
ustrDescription.Buffer = awcBuffer + (cbSize / sizeof(WCHAR));
@ -117,8 +117,8 @@ InitDisplayDriver(
&cbSize);
if (NT_SUCCESS(Status))
{
ustrDescription.MaximumLength = cbSize;
ustrDescription.Length = cbSize;
ustrDescription.MaximumLength = (USHORT)cbSize;
ustrDescription.Length = (USHORT)cbSize;
}
else
{

View file

@ -137,7 +137,7 @@ RawInputThreadMain()
ULONG cWaitObjects = 0, cMaxWaitObjects = 1;
MOUSE_INPUT_DATA MouseInput;
KEYBOARD_INPUT_DATA KeyInput;
ByteOffset.QuadPart = (LONGLONG)0;
//WaitTimeout.QuadPart = (LONGLONG)(-10000000);
@ -196,7 +196,7 @@ RawInputThreadMain()
&ByteOffset,
NULL);
}
if (MouStatus == STATUS_PENDING)
WaitObjects[cWaitObjects++] = &pMouDevice->Event;
}
@ -215,7 +215,7 @@ RawInputThreadMain()
sizeof(KEYBOARD_INPUT_DATA),
&ByteOffset,
NULL);
}
if (KbdStatus == STATUS_PENDING)
WaitObjects[cWaitObjects++] = &pKbdDevice->Event;
@ -233,7 +233,8 @@ RawInputThreadMain()
NULL,//&WaitTimeout,
NULL);
if (Status >= STATUS_WAIT_0 && Status < STATUS_WAIT_0 + cWaitObjects)
if ((Status >= STATUS_WAIT_0) &&
(Status < (STATUS_WAIT_0 + (LONG)cWaitObjects)))
{
/* Some device has finished reading */
pSignaledObject = WaitObjects[Status - STATUS_WAIT_0];

View file

@ -440,7 +440,7 @@ UserGetKeyboardLayout(
UINT
APIENTRY
NtUserGetKeyboardLayoutList(
INT nBuff,
ULONG nBuff,
HKL *pHklBuff)
{
UINT uRet = 0;
@ -600,7 +600,7 @@ NtUserLoadKeyboardLayoutEx(
pklLast = gspklBaseLayout->pklPrev;
while (pklLast != gspklBaseLayout && pklLast->dwKL_Flags & KLF_UNLOAD)
pklLast = pklLast->pklPrev;
/* Add new layout to the list */
pKl->pklNext = pklLast->pklNext;
pKl->pklPrev = pklLast;

View file

@ -876,8 +876,8 @@ ProcessKeyEvent(WORD wVk, WORD wScanCode, DWORD dwFlags, BOOL bInjected, DWORD d
Msg.lParam |= KF_REPEAT << 16;
if (!bIsDown)
Msg.lParam |= KF_UP << 16;
/* FIXME: Set KF_DLGMODE and KF_MENUMODE when needed */
if (pFocusQueue->QF_flags & QF_DIALOGACTIVE)
/* FIXME: Set KF_DLGMODE and KF_MENUMODE when needed */
if (pFocusQueue->QF_flags & QF_DIALOGACTIVE)
Msg.lParam |= KF_DLGMODE << 16;
if (pFocusQueue->MenuOwner) // pFocusQueue->MenuState) // MenuState needs a start flag...
Msg.lParam |= KF_MENUMODE << 16;
@ -967,7 +967,7 @@ UserSendKeyboardInput(KEYBDINPUT *pKbdInput, BOOL bInjected)
return ProcessKeyEvent(wVk, wScanCode, pKbdInput->dwFlags, bInjected, dwTime, pKbdInput->dwExtraInfo);
}
/*
/*
* UserProcessKeyboardInput
*
* Process raw keyboard input data
@ -1045,7 +1045,7 @@ UserProcessKeyboardInput(
}
}
/*
/*
* IntTranslateKbdMessage
*
* Addes WM_(SYS)CHAR messages to message queue if message
@ -1408,8 +1408,8 @@ NtUserGetKeyNameText(LONG lParam, LPWSTR lpString, int cchSize)
if (pKeyName)
{
cchKeyName = wcslen(pKeyName);
if (cchKeyName > cchSize - 1)
cchKeyName = cchSize - 1; // Don't count '\0'
if (cchKeyName > (cchSize - 1UL))
cchKeyName = cchSize - 1UL; // Don't count '\0'
_SEH2_TRY
{

View file

@ -804,7 +804,7 @@ BOOL FASTCALL
IntInsertMenuItem(PMENU_OBJECT MenuObject, UINT uItem, BOOL fByPosition,
PROSMENUITEMINFO ItemInfo)
{
int pos = (int)uItem;
int pos;
PMENU_ITEM MenuItem;
PMENU_OBJECT SubMenu = NULL;
@ -818,7 +818,8 @@ IntInsertMenuItem(PMENU_OBJECT MenuObject, UINT uItem, BOOL fByPosition,
{
SubMenu = MenuObject;
/* calculate position */
if(MenuObject->MenuInfo.MenuItemCount < pos)
pos = (int)uItem;
if(uItem > MenuObject->MenuInfo.MenuItemCount)
{
pos = MenuObject->MenuInfo.MenuItemCount;
}
@ -1254,7 +1255,7 @@ intGetTitleBarInfo(PWND pWindowObject, PTITLEBARINFO bti)
bti->rcTitleBar.right = pWindowObject->rcWindow.right - pWindowObject->rcWindow.left;
bti->rcTitleBar.bottom = pWindowObject->rcWindow.bottom - pWindowObject->rcWindow.top;
/* Is it iconiced ? */
/* Is it iconiced ? */
if ((dwStyle & WS_ICONIC)!=WS_ICONIC)
{
/* Remove frame from rectangle */
@ -1303,24 +1304,24 @@ intGetTitleBarInfo(PWND pWindowObject, PTITLEBARINFO bti)
/* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CYSMCAPTION) */
bti->rcTitleBar.bottom += UserGetSystemMetrics(SM_CYSMCAPTION);
}
else
else
{
/* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CYCAPTION) and UserGetSystemMetrics(SM_CXSIZE) */
bti->rcTitleBar.bottom += UserGetSystemMetrics(SM_CYCAPTION);
bti->rcTitleBar.left += UserGetSystemMetrics(SM_CXSIZE);
}
if (dwStyle & WS_CAPTION)
if (dwStyle & WS_CAPTION)
{
bti->rgstate[1] = STATE_SYSTEM_INVISIBLE;
if (dwStyle & WS_SYSMENU)
if (dwStyle & WS_SYSMENU)
{
if (!(dwStyle & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX)))
if (!(dwStyle & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX)))
{
bti->rgstate[2] = STATE_SYSTEM_INVISIBLE;
bti->rgstate[3] = STATE_SYSTEM_INVISIBLE;
}
else
else
{
if (!(dwStyle & WS_MINIMIZEBOX))
{
@ -1341,7 +1342,7 @@ intGetTitleBarInfo(PWND pWindowObject, PTITLEBARINFO bti)
bti->rgstate[5] = STATE_SYSTEM_UNAVAILABLE;
}
}
else
else
{
bti->rgstate[2] = STATE_SYSTEM_INVISIBLE;
bti->rgstate[3] = STATE_SYSTEM_INVISIBLE;
@ -1609,13 +1610,13 @@ NtUserGetTitleBarInfo(
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Fail copy the data */
/* Fail copy the data */
EngSetLastError(ERROR_INVALID_PARAMETER);
retValue = FALSE;
}
_SEH2_END
/* Get the tile bar info */
/* Get the tile bar info */
if (retValue)
{
retValue = intGetTitleBarInfo(WindowObject, &bartitleinfo);
@ -1629,7 +1630,7 @@ NtUserGetTitleBarInfo(
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Fail copy the data */
/* Fail copy the data */
EngSetLastError(ERROR_INVALID_PARAMETER);
retValue = FALSE;
}
@ -2240,7 +2241,7 @@ UserMenuItemInfo(
{
EngSetLastError(ERROR_INVALID_PARAMETER);
// This will crash menu (line 80) correct_behavior test!
// "NT4 and below can't handle a bigger MENUITEMINFO struct"
// "NT4 and below can't handle a bigger MENUITEMINFO struct"
//EngSetLastError(ERROR_MENU_ITEM_NOT_FOUND);
return( FALSE);
}
@ -2445,7 +2446,7 @@ NtUserThunkedMenuItemInfo(
ERR("Failed to capture MenuItem Caption (status 0x%08x)\n",Status);
SetLastNtError(Status);
RETURN(FALSE);
}
}
}
if (bInsert) RETURN( UserInsertMenuItem(Menu, uItem, fByPosition, lpmii));

View file

@ -1844,7 +1844,7 @@ NtUserDragDetect(
{
MSG msg;
RECT rect;
WORD wDragWidth, wDragHeight;
ULONG wDragWidth, wDragHeight;
DECLARE_RETURN(BOOL);
TRACE("Enter NtUserDragDetect(%x)\n", hWnd);

View file

@ -15,7 +15,7 @@ static BOOL Setup = FALSE;
/* FUNCTIONS *****************************************************************/
BOOL
FASTCALL
NTAPI
InitMetrics(VOID)
{
INT *piSysMet = gpsi->aiSysMet;
@ -175,7 +175,8 @@ InitMetrics(VOID)
return TRUE;
}
ULONG FASTCALL
LONG
NTAPI
UserGetSystemMetrics(ULONG Index)
{
ASSERT(gpsi);

View file

@ -94,7 +94,7 @@ IntTopLevelWindowFromPoint(INT x, INT y)
if ((pWnd->style & WS_VISIBLE) && IntPtInWindow(pWnd, x, y))
return pWnd;
}
/* Window has not been found */
return NULL;
}
@ -177,10 +177,10 @@ int UserShowCursor(BOOL bShow)
pti = PsGetCurrentThreadWin32Thread();
MessageQueue = pti->MessageQueue;
/* Update counter */
MessageQueue->ShowingCursor += bShow ? 1 : -1;
/* Check for trivial cases */
if ((bShow && MessageQueue->ShowingCursor != 0) ||
(!bShow && MessageQueue->ShowingCursor != -1))
@ -189,7 +189,7 @@ int UserShowCursor(BOOL bShow)
internally to check if cursor is visible */
return MessageQueue->ShowingCursor;
}
/* Check if cursor is above window owned by this MessageQueue */
pWnd = IntTopLevelWindowFromPoint(gpsi->ptCursor.x, gpsi->ptCursor.y);
if (pWnd && pWnd->head.pti->MessageQueue == MessageQueue)
@ -206,7 +206,7 @@ int UserShowCursor(BOOL bShow)
GreMovePointer(hdcScreen, -1, -1);
TRACE("Removing pointer!\n");
}
/* Update global info */
IntGetSysCursorInfo()->ShowingCursor = MessageQueue->ShowingCursor;
}
@ -1382,7 +1382,7 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT
if ((msg->message == clk_msg.message) &&
(msg->hwnd == clk_msg.hwnd) &&
(msg->wParam == clk_msg.wParam) &&
(msg->time - clk_msg.time < gspv.iDblClickTime) &&
((msg->time - clk_msg.time) < (ULONG)gspv.iDblClickTime) &&
(abs(msg->pt.x - clk_msg.pt.x) < UserGetSystemMetrics(SM_CXDOUBLECLK)/2) &&
(abs(msg->pt.y - clk_msg.pt.y) < UserGetSystemMetrics(SM_CYDOUBLECLK)/2))
{
@ -1999,7 +1999,7 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
MessageQueue->nCntsQBits[QSRosPostMessage] = 0;
MessageQueue->nCntsQBits[QSRosSendMessage] = 0;
MessageQueue->nCntsQBits[QSRosHotKey] = 0;
if (MessageQueue->CursorObject)
{
PCURICON_OBJECT pCursor = MessageQueue->CursorObject;
@ -2020,7 +2020,7 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
UserDereferenceObject(pCursor);
}
}
PUSER_MESSAGE_QUEUE FASTCALL
@ -2183,7 +2183,7 @@ NtUserGetKeyState(INT key)
UserLeave();
return Ret;
return (SHORT)Ret;
}

View file

@ -777,7 +777,7 @@ IntPrintWindow(
}
BOOL
FASTCALL
FASTCALL
IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi)
{
PPROPERTY pprop;
@ -1831,9 +1831,9 @@ BOOL UserDrawCaption(
else if (pWnd != NULL) // FIXME: Windows does not do that
{
UNICODE_STRING ustr;
ustr.Buffer = pWnd->strName.Buffer;
ustr.Length = pWnd->strName.Length;
ustr.MaximumLength = pWnd->strName.MaximumLength;
ustr.Buffer = pWnd->strName.Buffer; // FIXME: LARGE_STRING truncated!
ustr.Length = (USHORT)min(pWnd->strName.Length, MAXUSHORT);
ustr.MaximumLength = (USHORT)min(pWnd->strName.MaximumLength, MAXUSHORT);
UserDrawCaptionText(hDc, &ustr, &Rect, uFlags, hFont);
}
}

View file

@ -361,7 +361,7 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
/* Make sure the page size is valid */
if (Info->nPage < 0)
Info->nPage = 0;
else if (Info->nMax - Info->nMin + 1 < Info->nPage)
else if ((Info->nMax - Info->nMin + 1UL) < Info->nPage)
{
Info->nPage = Info->nMax - Info->nMin + 1;
}
@ -371,7 +371,7 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
{
Info->nPos = Info->nMin;
}
else if (Info->nPos > Info->nMax - max(Info->nPage - 1, 0))
else if (Info->nPos > (Info->nMax - max((int)Info->nPage - 1, 0)))
{
Info->nPos = Info->nMax - max(Info->nPage - 1, 0);
}
@ -421,7 +421,7 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
done:
if ( action & SA_SSI_HIDE )
{
{
co_UserShowScrollBar(Window, nBar, FALSE, FALSE);
}
else
@ -616,7 +616,7 @@ co_UserShowScrollBar(PWND Wnd, int nBar, BOOL fShowH, BOOL fShowV)
case SB_HORZ:
if (fShowH) set_bits |= WS_HSCROLL;
else clear_bits |= WS_HSCROLL;
if( nBar == SB_HORZ ) break;
if( nBar == SB_HORZ ) break;
/* Fall through */
case SB_VERT:
if (fShowV) set_bits |= WS_VSCROLL;
@ -701,8 +701,8 @@ CLEANUP:
BOOL
APIENTRY
NtUserSBGetParms(
HWND hWnd,
int fnBar,
HWND hWnd,
int fnBar,
PSBDATA pSBData,
LPSCROLLINFO lpsi)
{
@ -822,11 +822,11 @@ NtUserEnableScrollBar(
if(InfoH)
Chg = (IntEnableScrollBar(TRUE, InfoH, wArrows) || Chg);
ERR("FIXME: EnableScrollBar wSBflags %d wArrows %d Chg %d\n",wSBflags,wArrows, Chg);
// Done in user32:
// SCROLL_RefreshScrollBar( hwnd, nBar, TRUE, TRUE );
if (OrigArrows == wArrows) RETURN( FALSE);
RETURN( TRUE);

View file

@ -727,7 +727,7 @@ SpiNotifyNCMetricsChanged()
UserRefObjectCo(pwndCurrent, &Ref);
co_WinPosSetWindowPos(pwndCurrent, 0, pwndCurrent->rcWindow.left,pwndCurrent->rcWindow.top,
pwndCurrent->rcWindow.right-pwndCurrent->rcWindow.left
,pwndCurrent->rcWindow.bottom - pwndCurrent->rcWindow.top,
,pwndCurrent->rcWindow.bottom - pwndCurrent->rcWindow.top,
SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOCOPYBITS|
SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW);
UserDerefObjectCo(pwndCurrent);
@ -800,7 +800,7 @@ SpiGetSet(UINT uiAction, UINT uiParam, PVOID pvParam, FLONG fl)
return SpiSetInt(&gspv.uiGridGranularity, uiParam, KEY_DESKTOP, VAL_GRID, fl);
case SPI_GETDESKWALLPAPER:
uiParam = min(uiParam, gspv.ustrWallpaper.Length + 1);
uiParam = min(uiParam, gspv.ustrWallpaper.Length + 1UL);
return SpiGet(pvParam, gspv.awcWallpaper, uiParam, fl);
case SPI_SETDESKWALLPAPER:
@ -1590,7 +1590,7 @@ UserSystemParametersInfo(
}
ulResult = 1;
}
return ulResult;
}
@ -1616,7 +1616,7 @@ NtUserSystemParametersInfo(
TRACE("Leave NtUserSystemParametersInfo, returning %d\n", bResult);
UserLeave();
return bResult;
}

View file

@ -795,7 +795,7 @@ IntGetClientRect(PWND Wnd, RECTL *Rect)
Rect->bottom = UserGetSystemMetrics(SM_CYMINIMIZED);
return;
}
if ( Wnd != UserGetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
if ( Wnd != UserGetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
{
*Rect = Wnd->rcClient;
RECTL_vOffsetRect(Rect, -Wnd->rcClient.left, -Wnd->rcClient.top);
@ -1953,7 +1953,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
if (Window->state & WNDS_ANSICREATOR)
{
ANSI_STRING AnsiString;
AnsiString.MaximumLength = RtlUnicodeStringToAnsiSize(ClassName)+sizeof(CHAR);
AnsiString.MaximumLength = (USHORT)RtlUnicodeStringToAnsiSize(ClassName)+sizeof(CHAR);
pszClass = UserHeapAlloc(AnsiString.MaximumLength);
if (!pszClass)
{
@ -1984,13 +1984,13 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
{
UNICODE_STRING Name;
Name.Buffer = WindowName->Buffer;
Name.Length = WindowName->Length;
Name.MaximumLength = WindowName->MaximumLength;
Name.Length = (USHORT)min(WindowName->Length, MAXUSHORT); // FIXME: LARGE_STRING truncated
Name.MaximumLength = (USHORT)min(WindowName->MaximumLength, MAXUSHORT);
if (Window->state & WNDS_ANSICREATOR)
{
ANSI_STRING AnsiString;
AnsiString.MaximumLength = RtlUnicodeStringToAnsiSize(&Name) + sizeof(CHAR);
AnsiString.MaximumLength = (USHORT)RtlUnicodeStringToAnsiSize(&Name) + sizeof(CHAR);
pszName = UserHeapAlloc(AnsiString.MaximumLength);
if (!pszName)
{
@ -2325,8 +2325,8 @@ NtUserCreateWindowEx(
/* We pass it on as a UNICODE_STRING */
ustrClassName.Buffer = lstrClassName.Buffer;
ustrClassName.Length = lstrClassName.Length;
ustrClassName.MaximumLength = lstrClassName.MaximumLength;
ustrClassName.Length = (USHORT)min(lstrClassName.Length, MAXUSHORT); // FIXME: LARGE_STRING truncated
ustrClassName.MaximumLength = (USHORT)min(lstrClassName.MaximumLength, MAXUSHORT);
}
/* Fill the CREATESTRUCTW */
@ -2593,10 +2593,10 @@ IntFindWindow(PWND Parent,
send WM_GETTEXT messages to windows belonging to its processes */
if (!ClassAtom || Child->pcls->atomClassName == ClassAtom)
{
// HACK: use UNICODE_STRING instead of LARGE_STRING
// FIXME: LARGE_STRING truncated
CurrentWindowName.Buffer = Child->strName.Buffer;
CurrentWindowName.Length = Child->strName.Length;
CurrentWindowName.MaximumLength = Child->strName.MaximumLength;
CurrentWindowName.Length = (USHORT)min(Child->strName.Length, MAXUSHORT);
CurrentWindowName.MaximumLength = (USHORT)min(Child->strName.MaximumLength, MAXUSHORT);
if(!CheckWindowName ||
(Child->strName.Length < 0xFFFF &&
!RtlCompareUnicodeString(WindowName, &CurrentWindowName, TRUE)))
@ -2772,8 +2772,8 @@ NtUserFindWindowEx(HWND hwndParent,
The user mode version however calls GetWindowText() which will
send WM_GETTEXT messages to windows belonging to its processes */
ustr.Buffer = TopLevelWindow->strName.Buffer;
ustr.Length = TopLevelWindow->strName.Length;
ustr.MaximumLength = TopLevelWindow->strName.MaximumLength;
ustr.Length = (USHORT)min(TopLevelWindow->strName.Length, MAXUSHORT); // FIXME:LARGE_STRING truncated
ustr.MaximumLength = (USHORT)min(TopLevelWindow->strName.MaximumLength, MAXUSHORT);
WindowMatches = !CheckWindowName ||
(TopLevelWindow->strName.Length < 0xFFFF &&
!RtlCompareUnicodeString(&WindowName, &ustr, TRUE));
@ -3158,7 +3158,7 @@ NtUserSetShellWindowEx(HWND hwndShell, HWND hwndListView)
WinStaObject->ShellListView = hwndListView;
ti = GetW32ThreadInfo();
if (ti->pDeskInfo)
if (ti->pDeskInfo)
{
ti->pDeskInfo->hShellWindow = hwndShell;
ti->pDeskInfo->ppiShellProcess = ti->ppi;
@ -3450,7 +3450,7 @@ NtUserSetWindowWord(HWND hWnd, INT Index, WORD NewValue)
case GWL_ID:
case GWL_HINSTANCE:
case GWL_HWNDPARENT:
RETURN( co_UserSetWindowLong(Window->head.h, Index, (UINT)NewValue, TRUE));
RETURN( (WORD)co_UserSetWindowLong(Window->head.h, Index, (UINT)NewValue, TRUE));
default:
if (Index < 0)
{
@ -3459,7 +3459,7 @@ NtUserSetWindowWord(HWND hWnd, INT Index, WORD NewValue)
}
}
if (Index > Window->cbwndExtra - sizeof(WORD))
if ((ULONG)Index > (Window->cbwndExtra - sizeof(WORD)))
{
EngSetLastError(ERROR_INVALID_PARAMETER);
RETURN( 0);

View file

@ -173,7 +173,7 @@ co_WinPosArrangeIconicWindows(PWND parent)
TRACE("X:%d Y:%d XS:%d YS:%d\n",x,y,xspacing,yspacing);
for( i = 0; List[i]; i++)
for(i = 0; List[i]; i++)
{
PWND Child;
@ -197,7 +197,7 @@ co_WinPosArrangeIconicWindows(PWND parent)
UserDerefObjectCo(Child);
if (x <= rectParent.right - UserGetSystemMetrics(SM_CXMINSPACING))
if (x <= (rectParent.right - UserGetSystemMetrics(SM_CXMINSPACING)))
x += xspacing;
else
{
@ -228,8 +228,8 @@ WinPosFindIconPos(PWND Window, POINT *Pos)
}
IntGetClientRect( pwndParent, &rectParent );
if ((Pos->x >= rectParent.left) && (Pos->x + UserGetSystemMetrics(SM_CXICON) < rectParent.right) &&
(Pos->y >= rectParent.top) && (Pos->y + UserGetSystemMetrics(SM_CYICON) < rectParent.bottom))
if ((Pos->x >= rectParent.left) && ((Pos->x + UserGetSystemMetrics(SM_CXICON)) < rectParent.right) &&
(Pos->y >= rectParent.top) && ((Pos->y + UserGetSystemMetrics(SM_CYICON)) < rectParent.bottom))
return; /* The icon already has a suitable position */
xspacing = UserGetSystemMetrics(SM_CXICONSPACING);
@ -318,7 +318,7 @@ WinPosInitInternalPos(PWND Wnd, RECTL *RestoreRect)
if (Wnd->state & WNDS_MAXIMIZESTOMONITOR)
{
Wnd->InternalPos.flags &= ~WPF_MAXINIT;
Wnd->InternalPos.MaxPos.x = Wnd->InternalPos.MaxPos.y = -1;
Wnd->InternalPos.MaxPos.x = Wnd->InternalPos.MaxPos.y = -1;
}
else
{
@ -1893,8 +1893,8 @@ co_WinPosSearchChildren(
}
}
*HitTest = co_IntSendMessage(ScopeWin->head.h, WM_NCHITTEST, 0,
MAKELONG(Point->x, Point->y));
*HitTest = (USHORT)co_IntSendMessage(ScopeWin->head.h, WM_NCHITTEST, 0,
MAKELONG(Point->x, Point->y));
if ((*HitTest) == (USHORT)HTTRANSPARENT)
{
UserDereferenceObject(ScopeWin);
@ -2046,7 +2046,7 @@ BOOL FASTCALL IntEndDeferWindowPosEx( HDWP hdwp, BOOL sAsync )
TRACE("hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n",
winpos->pos.hwnd, winpos->pos.hwndInsertAfter, winpos->pos.x, winpos->pos.y,
winpos->pos.cx, winpos->pos.cy, winpos->pos.flags);
pwnd = UserGetWindowObject(winpos->pos.hwnd);
if (!pwnd)
continue;

View file

@ -126,10 +126,10 @@ IntArc( DC *dc,
AngleEnd = atan2((RectSEpts.bottom - CenterY), RectSEpts.right - CenterX)*(360.0/(M_PI*2));
AngleStart = atan2((RectSEpts.top - CenterY), RectSEpts.left - CenterX)*(360.0/(M_PI*2));
SfCx = (Rcos(AngleStart) * RadiusX);
SfCy = (Rsin(AngleStart) * RadiusY);
EfCx = (Rcos(AngleEnd) * RadiusX);
EfCy = (Rsin(AngleEnd) * RadiusY);
SfCx = (LONG)(Rcos(AngleStart) * RadiusX);
SfCy = (LONG)(Rsin(AngleStart) * RadiusY);
EfCx = (LONG)(Rcos(AngleEnd) * RadiusX);
EfCy = (LONG)(Rsin(AngleEnd) * RadiusY);
if ((arctype == GdiTypePie) || (arctype == GdiTypeChord))
{

View file

@ -158,11 +158,11 @@ NtGdiCreateBitmap(
/* Calculate width and image size in bytes */
cjWidthBytes = WIDTH_BYTES_ALIGN16(nWidth, cRealBpp);
cjSize = cjWidthBytes * nHeight;
cjSize = (ULONGLONG)cjWidthBytes * nHeight;
/* Check parameters (possible overflow of cjWidthBytes!) */
if (iFormat == 0 || nWidth <= 0 || nWidth >= 0x8000000 || nHeight <= 0 ||
cBitsPixel > 32 || cPlanes > 32 || cjSize >= 0x100000000ULL)
/* Check parameters (possible overflow of cjSize!) */
if ((iFormat == 0) || (nWidth <= 0) || (nWidth >= 0x8000000) || (nHeight <= 0) ||
(cBitsPixel > 32) || (cPlanes > 32) || (cjSize >= 0x100000000ULL))
{
DPRINT1("Invalid bitmap format! Width=%d, Height=%d, Bpp=%d, Planes=%d\n",
nWidth, nHeight, cBitsPixel, cPlanes);
@ -178,7 +178,7 @@ NtGdiCreateBitmap(
PSURFACE psurf = SURFACE_ShareLockSurface(hbmp);
_SEH2_TRY
{
ProbeForRead(pUnsafeBits, cjSize, 1);
ProbeForRead(pUnsafeBits, (SIZE_T)cjSize, 1);
UnsafeSetBitmapBits(psurf, 0, pUnsafeBits);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)

View file

@ -141,9 +141,9 @@ IntSetDIBColorTable(
}
biBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat);
if (biBitCount <= 8 && StartIndex < (1 << biBitCount))
if ((biBitCount <= 8) && (StartIndex < (1UL << biBitCount)))
{
if (StartIndex + Entries > (1 << biBitCount))
if (StartIndex + Entries > (1UL << biBitCount))
Entries = (1 << biBitCount) - StartIndex;
if (psurf->ppal == NULL)
@ -537,7 +537,8 @@ NtGdiGetDIBitsInternal(
LONG width, height;
WORD planes, bpp;
DWORD compr, size ;
int i, bitmap_type;
USHORT i;
int bitmap_type;
RGBTRIPLE* rgbTriples;
RGBQUAD* rgbQuads;
VOID* colorPtr;
@ -618,10 +619,10 @@ NtGdiGetDIBitsInternal(
case 0: /* Only info */
if(pbmci)
{
pbmci->bmciHeader.bcWidth = psurf->SurfObj.sizlBitmap.cx;
pbmci->bmciHeader.bcHeight = (psurf->SurfObj.fjBitmap & BMF_TOPDOWN) ?
pbmci->bmciHeader.bcWidth = (WORD)psurf->SurfObj.sizlBitmap.cx;
pbmci->bmciHeader.bcHeight = (WORD)((psurf->SurfObj.fjBitmap & BMF_TOPDOWN) ?
-psurf->SurfObj.sizlBitmap.cy :
psurf->SurfObj.sizlBitmap.cy;
psurf->SurfObj.sizlBitmap.cy);
pbmci->bmciHeader.bcPlanes = 1;
pbmci->bmciHeader.bcBitCount = BitsPerFormat(psurf->SurfObj.iBitmapFormat);
}
@ -674,19 +675,19 @@ NtGdiGetDIBitsInternal(
{
if(Usage == DIB_RGB_COLORS)
{
unsigned int colors = min(psurf->ppal->NumColors, 1 << bpp);
ULONG colors = min(psurf->ppal->NumColors, 256);
if(pbmci)
{
for(i=0; i < colors; i++)
for(i = 0; i < colors; i++)
{
rgbTriples[i].rgbtRed = psurf->ppal->IndexedColors[i].peRed;
rgbTriples[i].rgbtGreen = psurf->ppal->IndexedColors[i].peGreen;
rgbTriples[i].rgbtBlue = psurf->ppal->IndexedColors[i].peBlue;
}
}
if(colors != 1 << bpp) Info->bmiHeader.biClrUsed = colors;
for(i=0; i < colors; i++)
if(colors != 256) Info->bmiHeader.biClrUsed = colors;
for(i = 0; i < colors; i++)
{
rgbQuads[i].rgbRed = psurf->ppal->IndexedColors[i].peRed;
rgbQuads[i].rgbGreen = psurf->ppal->IndexedColors[i].peGreen;
@ -695,7 +696,7 @@ NtGdiGetDIBitsInternal(
}
else
{
for(i=0; i < 1 << bpp; i++)
for(i = 0; i < 256; i++)
{
if(pbmci) ((WORD*)rgbTriples)[i] = i;
((WORD*)rgbQuads)[i] = i;
@ -706,7 +707,7 @@ NtGdiGetDIBitsInternal(
{
if(Usage == DIB_PAL_COLORS)
{
for(i=0; i < 1 << bpp; i++)
for(i = 0; i < 256; i++)
{
if(pbmci) ((WORD*)rgbTriples)[i] = i;
((WORD*)rgbQuads)[i] = i;
@ -877,7 +878,7 @@ NtGdiGetDIBitsInternal(
POINTL srcPoint;
BOOL ret ;
if (StartScan > psurf->SurfObj.sizlBitmap.cy)
if (StartScan > (ULONG)psurf->SurfObj.sizlBitmap.cy)
{
ScanLines = 0;
goto done;
@ -889,8 +890,8 @@ NtGdiGetDIBitsInternal(
/* Fixup values */
Info->bmiHeader.biWidth = psurf->SurfObj.sizlBitmap.cx;
Info->bmiHeader.biHeight = height < 0 ?
-ScanLines : ScanLines;
Info->bmiHeader.biHeight = (height < 0) ?
-(LONG)ScanLines : ScanLines;
/* Create the DIB */
hBmpDest = DIB_CreateDIBSection(pDC, Info, Usage, &pDIBits, NULL, 0, 0);
/* Restore them */
@ -1379,7 +1380,7 @@ NtGdiCreateDIBSection(
{
ProbeForRead(&bmi->bmiHeader.biSize, sizeof(DWORD), 1);
ProbeForRead(bmi, bmi->bmiHeader.biSize, 1);
ProbeForRead(bmi, DIB_BitmapInfoSize(bmi, Usage), 1);
ProbeForRead(bmi, DIB_BitmapInfoSize(bmi, (WORD)Usage), 1);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
@ -1783,7 +1784,7 @@ HPALETTE
FASTCALL
BuildDIBPalette(CONST BITMAPINFO *bmi)
{
BYTE bits;
WORD bits;
ULONG ColorCount;
HPALETTE hPal;
ULONG RedMask = 0, GreenMask = 0, BlueMask = 0;

View file

@ -1315,14 +1315,14 @@ IntFillArc( PDC dc,
INT YLeft,
INT Width,
INT Height,
double StartArc,
double StartArc, // FIXME: don't use floating point!
double EndArc,
ARCTYPE arctype)
{
PDC_ATTR pdcattr;
PBRUSH pbrush;
int Start = ceil(StartArc);
int End = ceil(EndArc);
int Start = (int)ceil(StartArc);
int End = (int)ceil(EndArc);
BOOL Chord = (arctype == GdiTypeChord), ret;
pdcattr = dc->pdcattr;
@ -1351,13 +1351,13 @@ IntDrawArc( PDC dc,
INT YLeft,
INT Width,
INT Height,
double StartArc,
double StartArc, // FIXME: don't use floating point!
double EndArc,
ARCTYPE arctype,
PBRUSH pbrush)
{
int Start = ceil(StartArc);
int End = ceil(EndArc);
int Start = (int)ceil(StartArc);
int End = (int)ceil(EndArc);
BOOL Chord = (arctype == GdiTypeChord);
// Sort out alignment here.
return app_draw_arc(dc, rect( XLeft, YLeft, Width, Height),

View file

@ -355,7 +355,7 @@ NtGdiPolyPolyDraw( IN HDC hDC,
PULONG SafeCounts;
NTSTATUS Status = STATUS_SUCCESS;
BOOL Ret = TRUE;
INT nPoints = 0, nMaxPoints = 0, nInvalid = 0, i;
ULONG nPoints = 0, nMaxPoints = 0, nInvalid = 0, i;
if (!UnsafePoints || !UnsafeCounts ||
Count == 0 || iFunc == 0 || iFunc > GdiPolyPolyRgn)

View file

@ -1227,7 +1227,7 @@ GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize)
{
POBJ pobj;
FLONG fl = 0;
UCHAR objt = ObjectType >> 16;
UCHAR objt = (ObjectType >> 16) & 0xFF;
if ((objt == GDIObjType_DC_TYPE && cjSize == sizeof(DC)) ||
(objt == GDIObjType_PAL_TYPE && cjSize == sizeof(PALETTE)) ||

View file

@ -334,7 +334,7 @@ IntGdiPolyPolyline(DC *dc,
PULONG PolyPoints,
DWORD Count)
{
int i;
ULONG i;
LPPOINT pts;
PULONG pc;
BOOL ret = FALSE; // Default to failure
@ -419,7 +419,7 @@ NtGdiPolyDraw(
PDC dc;
PDC_ATTR pdcattr;
POINT *line_pts = NULL, *line_pts_old, *bzr_pts = NULL, bzr[4];
INT i, num_pts, num_bzr_pts, space, space_old, size;
ULONG i, num_pts, num_bzr_pts, space, space_old, size;
BOOL result = FALSE;
dc = DC_LockDc(hdc);

View file

@ -404,7 +404,7 @@ ColorCorrection(PPALETTE PalGDI, PPALETTEENTRY PaletteEntry, ULONG Colors)
if (ppdev->flFlags & PDEV_GAMMARAMP_TABLE)
{
INT i;
ULONG i;
PGAMMARAMP GammaRamp = (PGAMMARAMP)ppdev->pvGammaRamp;
for ( i = 0; i < Colors; i++)
{
@ -980,7 +980,7 @@ IntSetPaletteEntries(
CONST LPPALETTEENTRY pe)
{
PPALETTE palGDI;
WORD numEntries;
ULONG numEntries;
if ((UINT)hpal & GDI_HANDLE_STOCK_MASK)
{

View file

@ -13,6 +13,10 @@
#define NDEBUG
#include <debug.h>
#ifdef _MSC_VER
#pragma warning(disable:4244)
#endif
#define NUM_ENTRIES_INITIAL 16 /* Initial size of points / flags arrays */
#define GROW_FACTOR_NUMER 2 /* Numerator of grow factor for the array */
#define GROW_FACTOR_DENOM 1 /* Denominator of grow factor */
@ -20,7 +24,7 @@
/***********************************************************************
* Internal functions
*/
/* PATH_DestroyGdiPath
*
* Destroys a GdiPath structure (frees the memory in the arrays).
@ -71,7 +75,7 @@ FASTCALL
GdiPathDPtoLP(PDC pdc, PPOINT ppt, INT count)
{
XFORMOBJ xo;
XFORMOBJ_vInit(&xo, &pdc->dclevel.mxDeviceToWorld);
return XFORMOBJ_bApplyXform(&xo, XF_LTOL, count, (PPOINTL)ppt, (PPOINTL)ppt);
}
@ -738,7 +742,7 @@ PATH_PolyDraw(PDC dc, const POINT *pts, const BYTE *types, DWORD cbPoints)
{
PPATH pPath;
POINT lastmove, orig_pos;
INT i;
ULONG i;
PDC_ATTR pdcattr;
BOOL State = FALSE, Ret = FALSE;
@ -751,7 +755,7 @@ PATH_PolyDraw(PDC dc, const POINT *pts, const BYTE *types, DWORD cbPoints)
return FALSE;
}
pdcattr = dc->pdcattr;
pdcattr = dc->pdcattr;
lastmove.x = orig_pos.x = pdcattr->ptlCurrent.x;
lastmove.y = orig_pos.y = pdcattr->ptlCurrent.y;

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel
* PURPOSE: Pen functiona
* FILE: subsys/win32k/objects/pen.c
* PROGRAMER:
* PROGRAMER:
*/
#include <win32k.h>
@ -230,7 +230,7 @@ PEN_GetObject(PBRUSH pbrushPen, INT cbCount, PLOGPEN pBuffer)
cbRetCount = sizeof(EXTLOGPEN) - sizeof(DWORD) + pbrushPen->dwStyleCount * sizeof(DWORD);
if (pBuffer)
{
INT i;
ULONG i;
if (cbCount < cbRetCount) return 0;
pExtLogPen = (PEXTLOGPEN)pBuffer;