Author: dquintana
Date: Mon Oct 13 16:07:19 2014
New Revision: 64725

URL: http://svn.reactos.org/svn/reactos?rev=64725&view=rev
Log:
[MSGINA]
 * Fix an exception in the shutdown dialog that was silently eaten by the 
window proc.

Modified:
    branches/shell-experiments/dll/win32/msgina/shutdown.c

Modified: branches/shell-experiments/dll/win32/msgina/shutdown.c
URL: 
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/msgina/shutdown.c?rev=64725&r1=64724&r2=64725&view=diff
==============================================================================
--- branches/shell-experiments/dll/win32/msgina/shutdown.c      [iso-8859-1] 
(original)
+++ branches/shell-experiments/dll/win32/msgina/shutdown.c      [iso-8859-1] 
Mon Oct 13 16:07:19 2014
@@ -115,6 +115,11 @@
             WCHAR tmpBuffer2[512];
 
             pgContext = (PGINA_CONTEXT)lParam;
+            if (!pgContext)
+            {
+                WARN("pgContext is NULL, branding bitmaps will not be 
displayed.\n");
+            }
+            
             SetWindowLongPtr(hwnd, GWL_USERDATA, (DWORD_PTR)pgContext);
 
             /* Clears the content before it's used */
@@ -158,7 +163,8 @@
             UpdateShutdownShellDesc(hwnd);
             
             /* Draw the logo graphic */
-            pgContext->hBitmap = LoadImage(hDllInstance, 
MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
+            if (pgContext)
+                pgContext->hBitmap = LoadImage(hDllInstance, 
MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
 
             return TRUE;
         }
@@ -166,17 +172,19 @@
         {
             PAINTSTRUCT ps;
             HDC hdc;
-            if (pgContext->hBitmap)
+            if (pgContext && pgContext->hBitmap)
             {
                 hdc = BeginPaint(hwnd, &ps);
                 DrawStateW(hdc, NULL, NULL, (LPARAM)pgContext->hBitmap, 
(WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
                 EndPaint(hwnd, &ps);
-            }
-            return TRUE;
+                return TRUE;
+            }
+            return FALSE;
         }
         case WM_DESTROY:
         {
-            DeleteObject(pgContext->hBitmap);
+            if (pgContext)
+                DeleteObject(pgContext->hBitmap);
             return TRUE;
         }
         case WM_COMMAND:
@@ -226,6 +234,7 @@
     LPWSTR lpUsername,
     BOOL   bHideLogoff)
 {
+    GINA_CONTEXT pgContext = { 0 };
     int dlgValue = 0;
     
     g_logoffHideState = bHideLogoff;
@@ -233,10 +242,11 @@
     UNREFERENCED_PARAMETER(lpUsername);
 
     // Loads the shut down dialog box
-    dlgValue = DialogBox(hDllInstance,
-                         MAKEINTRESOURCE(IDD_SHUTDOWN_SHELL),
-                         hParent,
-                         ExitWindowsDialogShellProc);
+    dlgValue = DialogBoxParam(hDllInstance,
+                              MAKEINTRESOURCE(IDD_SHUTDOWN_SHELL),
+                              hParent,
+                              ExitWindowsDialogShellProc,
+                              (LPARAM)&pgContext);
 
     // Determines what to do based on user selection
     if (dlgValue == IDOK)


Reply via email to