[USER32] Fix SetWindowWord/Long

These must use the corresponding NtUserSetWindowWord/Long function and cannot use NtUserSetWindowLongPtr, otherwise the function can fail, when there is only space for a LONG, but not for a LONG_PTR at the specified offset.
This commit is contained in:
Timo Kreuzer 2023-05-12 15:55:47 +03:00
parent 0fa4edebd9
commit 05cd3406e7
2 changed files with 7 additions and 4 deletions

View file

@ -4148,7 +4148,7 @@ NtUserSetWindowWord(HWND hWnd, INT Index, WORD NewValue)
if ((ULONG)Index > (Window->cbwndExtra - sizeof(WORD)))
{
EngSetLastError(ERROR_INVALID_PARAMETER);
EngSetLastError(ERROR_INVALID_INDEX);
RETURN( 0);
}

View file

@ -1666,7 +1666,8 @@ SetWindowWord ( HWND hWnd,int nIndex,WORD wNewWord )
}
break;
}
return (WORD)NtUserSetWindowLongPtr(hWnd, nIndex, wNewWord, FALSE);
/* DO NOT USE NtUserSetWindowLong(Ptr)! */
return NtUserSetWindowWord(hWnd, nIndex, wNewWord);
}
/*
@ -1680,7 +1681,8 @@ SetWindowLongA(
int nIndex,
LONG dwNewLong)
{
return (LONG)NtUserSetWindowLongPtr(hWnd, nIndex, dwNewLong, TRUE);
/* DO NOT USE NtUserSetWindowLongPtr! */
return NtUserSetWindowLong(hWnd, nIndex, dwNewLong, TRUE);
}
/*
@ -1693,7 +1695,8 @@ SetWindowLongW(
int nIndex,
LONG dwNewLong)
{
return (LONG)NtUserSetWindowLongPtr(hWnd, nIndex, dwNewLong, FALSE);
/* DO NOT USE NtUserSetWindowLongPtr! */
return NtUserSetWindowLong(hWnd, nIndex, dwNewLong, FALSE);
}
#ifdef _WIN64