Author: hbelusca Date: Sun Dec 16 14:01:32 2012 New Revision: 57923
URL: http://svn.reactos.org/svn/reactos?rev=57923&view=rev Log: [WIN32K] Fix BSOD when starting ReactOS in Safe Mode : NEVER dereference a NULL pointer in a DPRINT or you are dead !! (here, the possible NULL pointer is GetW32ProcessInfo()->prpwinsta). More precisely, you obtain:
<NTOSKRNL.EXE:112296 (ReactOS/ntoskrnl/ke/i386/traphdlr.c:1246 (@KiTrap0EHandler@4))> <NTOSKRNL.EXE:110154 (ReactOS/ntoskrnl/ke/i386/trap.s:0 (_KiTrap0E))> <NTOSKRNL.EXE:142926 (ReactOS/lib/sdk/crt/printf/streamout.c:644 (streamout))> <NTOSKRNL.EXE:140631 (ReactOS/lib/sdk/crt/printf/_sxprintf.c:61 (_vsnprintf))> <NTOSKRNL.EXE:12736a (ReactOS/lib/rtl/debug.c:85 (vDbgPrintExWithPrefixInternal@24))> <NTOSKRNL.EXE:12751c (ReactOS/lib/rtl/debug.c:209 (DbgPrint))> <win32k.sys:55034 (ReactOS/win32ss/user/ntuser/sysparams.c:451 (SpiGet))> <win32k.sys:56bc7 (ReactOS/win32ss/user/ntuser/sysparams.c:963 (@UserSystemParametersInfo@16)
Modified: trunk/reactos/win32ss/user/ntuser/sysparams.c
Modified: trunk/reactos/win32ss/user/ntuser/sysparams.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/syspara... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/sysparams.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/sysparams.c [iso-8859-1] Sun Dec 16 14:01:32 2012 @@ -25,9 +25,18 @@ #define METRIC2REG(met) (-((((met) * 1440)- 0) / dpi))
#define REQ_INTERACTIVE_WINSTA(err) \ - if ( GetW32ProcessInfo()->prpwinsta != InputWindowStation) \ + if (GetW32ProcessInfo()->prpwinsta) \ { \ - ERR("NtUserSystemParametersInfo requires interactive window station (current is %wZ)\n", &GetW32ProcessInfo()->prpwinsta->Name); \ + if (GetW32ProcessInfo()->prpwinsta != InputWindowStation) \ + { \ + ERR("NtUserSystemParametersInfo requires interactive window station (current is %wZ)\n", &GetW32ProcessInfo()->prpwinsta->Name); \ + EngSetLastError(err); \ + return 0; \ + } \ + } \ + else \ + { \ + ERR("NtUserSystemParametersInfo called without active window station, and it requires an interactive one.\n"); \ EngSetLastError(err); \ return 0; \ } @@ -1568,7 +1577,7 @@ /* Get a pointer to the current Windowstation */ if (!ppi->prpwinsta) { - ERR("UserSystemParametersInfo called without active windowstation.\n"); + ERR("UserSystemParametersInfo called without active window station.\n"); //ASSERT(FALSE); //return FALSE; }