--- trunk/reactos/ntoskrnl/ps/w32call.c 2005-01-23 18:18:08 UTC (rev 13226)
+++ trunk/reactos/ntoskrnl/ps/w32call.c 2005-01-23 20:48:19 UTC (rev 13227)
@@ -292,7 +292,8 @@
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. */