From c377a52fa4e1b0809ff734b7e170687f8d3b21f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sun, 23 Jan 2005 20:48:19 +0000 Subject: [PATCH] Keep usermode stack 4-byte aligned svn path=/trunk/; revision=13227 --- reactos/ntoskrnl/ps/w32call.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/ps/w32call.c b/reactos/ntoskrnl/ps/w32call.c index 37a634bedb3..0bbda42d6fc 100644 --- a/reactos/ntoskrnl/ps/w32call.c +++ b/reactos/ntoskrnl/ps/w32call.c @@ -292,7 +292,8 @@ NtW32Call (IN ULONG RoutineIndex, memcpy((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA), Thread->Tcb.TrapFrame, sizeof(KTRAP_FRAME) - (4 * sizeof(DWORD))); NewFrame = (PKTRAP_FRAME)((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA)); - NewFrame->Esp -= (ArgumentLength + (4 * sizeof(ULONG))); + /* We need the stack pointer to remain 4-byte aligned */ + NewFrame->Esp -= (((ArgumentLength + 3) & (~ 0x3)) + (4 * sizeof(ULONG))); NewFrame->Eip = (ULONG)LdrpGetSystemDllCallbackDispatcher(); UserEsp = (PULONG)NewFrame->Esp; UserEsp[0] = 0; /* Return address. */