mirror of
https://github.com/reactos/reactos.git
synced 2025-02-21 16:04:57 +00:00
[NTUSER] Fix unaligned access in co_IntSetWindowLongPtr
This commit is contained in:
parent
201f00ab6f
commit
dbb72f4923
1 changed files with 8 additions and 4 deletions
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include <win32k.h>
|
||||
#include <immdev.h>
|
||||
#include <unaligned.h>
|
||||
|
||||
DBG_DEFAULT_CHANNEL(UserWnd);
|
||||
|
||||
INT gNestedWindowLimit = 50;
|
||||
|
@ -3842,16 +3844,18 @@ co_IntSetWindowLongPtr(HWND hWnd, DWORD Index, LONG_PTR NewValue, BOOL Ansi, ULO
|
|||
return 0;
|
||||
}
|
||||
|
||||
PVOID Address = (PUCHAR)(&Window[1]) + Index;
|
||||
|
||||
#ifdef _WIN64
|
||||
if (Size == sizeof(LONG))
|
||||
{
|
||||
OldValue = *((LONG *)((PCHAR)(Window + 1) + Index));
|
||||
*((LONG*)((PCHAR)(Window + 1) + Index)) = (LONG)NewValue;
|
||||
OldValue = ReadUnalignedU32(Address);
|
||||
WriteUnalignedU32(Address, NewValue);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
OldValue = *((LONG_PTR *)((PCHAR)(Window + 1) + Index));
|
||||
OldValue = ReadUnalignedUlongPtr(Address);
|
||||
/*
|
||||
if ( Index == DWLP_DLGPROC && Wnd->state & WNDS_DIALOGWINDOW)
|
||||
{
|
||||
|
@ -3859,7 +3863,7 @@ co_IntSetWindowLongPtr(HWND hWnd, DWORD Index, LONG_PTR NewValue, BOOL Ansi, ULO
|
|||
if (!OldValue) return 0;
|
||||
}
|
||||
*/
|
||||
*((LONG_PTR*)((PCHAR)(Window + 1) + Index)) = NewValue;
|
||||
WriteUnalignedUlongPtr(Address, NewValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue