mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +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 <win32k.h>
|
||||||
#include <immdev.h>
|
#include <immdev.h>
|
||||||
|
#include <unaligned.h>
|
||||||
|
|
||||||
DBG_DEFAULT_CHANNEL(UserWnd);
|
DBG_DEFAULT_CHANNEL(UserWnd);
|
||||||
|
|
||||||
INT gNestedWindowLimit = 50;
|
INT gNestedWindowLimit = 50;
|
||||||
|
@ -3842,16 +3844,18 @@ co_IntSetWindowLongPtr(HWND hWnd, DWORD Index, LONG_PTR NewValue, BOOL Ansi, ULO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PVOID Address = (PUCHAR)(&Window[1]) + Index;
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
if (Size == sizeof(LONG))
|
if (Size == sizeof(LONG))
|
||||||
{
|
{
|
||||||
OldValue = *((LONG *)((PCHAR)(Window + 1) + Index));
|
OldValue = ReadUnalignedU32(Address);
|
||||||
*((LONG*)((PCHAR)(Window + 1) + Index)) = (LONG)NewValue;
|
WriteUnalignedU32(Address, NewValue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
OldValue = *((LONG_PTR *)((PCHAR)(Window + 1) + Index));
|
OldValue = ReadUnalignedUlongPtr(Address);
|
||||||
/*
|
/*
|
||||||
if ( Index == DWLP_DLGPROC && Wnd->state & WNDS_DIALOGWINDOW)
|
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;
|
if (!OldValue) return 0;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
*((LONG_PTR*)((PCHAR)(Window + 1) + Index)) = NewValue;
|
WriteUnalignedUlongPtr(Address, NewValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue