[ros-diffs] [gschneider] 47548: [DESK] - Rearrange screensaver wait codes around the MsgWaitForMultipleObjects function - Fixes screensaver configuration windows blocking the control panel - Refs: http://blogs.msdn.com/b/oldnewthing/archive/2005/02/17/375307.aspx and http://codereflect.com/2008/09/19/when-and-how-should-we-use-msgwaitformultipleobjects/ See issue #4213 for more details.

gschneider at svn.reactos.org gschneider at svn.reactos.org
Thu Jun 3 20:47:38 CEST 2010


Author: gschneider
Date: Thu Jun  3 20:47:37 2010
New Revision: 47548

URL: http://svn.reactos.org/svn/reactos?rev=47548&view=rev
Log:
[DESK] 
- Rearrange screensaver wait codes around the MsgWaitForMultipleObjects function
- Fixes screensaver configuration windows blocking the control panel
- Refs: http://blogs.msdn.com/b/oldnewthing/archive/2005/02/17/375307.aspx and http://codereflect.com/2008/09/19/when-and-how-should-we-use-msgwaitformultipleobjects/

See issue #4213 for more details.

Modified:
    trunk/reactos/dll/cpl/desk/screensaver.c

Modified: trunk/reactos/dll/cpl/desk/screensaver.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/screensaver.c?rev=47548&r1=47547&r2=47548&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/desk/screensaver.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/desk/screensaver.c [iso-8859-1] Thu Jun  3 20:47:37 2010
@@ -147,33 +147,32 @@
 WaitForSettingsDialog(HWND hwndDlg,
                       HANDLE hProcess)
 {
+    DWORD dwResult;
+    MSG msg;
+
     while (TRUE)
     {
-        DWORD Ret;
-        MSG msg;
-
-        while (PeekMessage(&msg,
-                           NULL,
-                           0,
-                           0,
-                           PM_REMOVE))
-        {
-            if (msg.message == WM_QUIT)
-                return FALSE;
-
-            if (IsDialogMessage(hwndDlg, &msg))
+        dwResult = MsgWaitForMultipleObjects(1,
+                                             &hProcess,
+                                             FALSE,
+                                             INFINITE,
+                                             QS_ALLINPUT);
+        if (dwResult == WAIT_OBJECT_0 + 1)
+        {
+            if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
             {
-                TranslateMessage(&msg);
-                DispatchMessage(&msg);
+                if (msg.message == WM_QUIT)
+                {
+                    return FALSE;
+                }
+                if (IsDialogMessage(hwndDlg, &msg))
+                {
+                    TranslateMessage(&msg);
+                    DispatchMessage(&msg);
+                }
             }
         }
-
-        Ret = MsgWaitForMultipleObjects(1,
-                                        &hProcess,
-                                        FALSE,
-                                        INFINITE,
-                                        QS_ALLINPUT);
-        if (Ret == (WAIT_OBJECT_0))
+        else
         {
             return TRUE;
         }




More information about the Ros-diffs mailing list