Index: /trunk/src/VBox/Main/src-server/win/svcmain.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/win/svcmain.cpp	(revision 65542)
+++ /trunk/src/VBox/Main/src-server/win/svcmain.cpp	(revision 65543)
@@ -23,7 +23,5 @@
 
 #include "VBox/com/defs.h"
-
 #include "VBox/com/com.h"
-
 #include "VBox/com/VirtualBox.h"
 
@@ -189,44 +187,44 @@
     switch (msg)
     {
-    case WM_QUERYENDSESSION:
-    {
-        if (g_pModule)
-        {
-            rc = !g_pModule->HasActiveConnection();
-            if (!rc)
-            {
-                /* place the VBoxSVC into system shutdown list */
-                ShutdownBlockReasonCreateAPI(hwnd, L"Has active connections.");
-                /* decrease a latency of MonitorShutdown loop */
-                ASMAtomicXchgU32(&dwTimeOut, 100);
-                Log(("VBoxSVCWinMain: WM_QUERYENDSESSION: VBoxSvc has active connections. bActivity = %d. Loc count = %d\n",
-                    g_pModule->bActivity, g_pModule->GetLockCount()));
-            }
-        }
-        else
-        {
-            Assert(g_pModule);
-            Log(("VBoxSVCWinMain: WM_QUERYENDSESSION: Error: g_pModule is NULL"));
-        }
-     } break;
-    case WM_ENDSESSION:
-    {
-        /* Restore timeout of Monitor Shutdown if user canceled system shutdown */
-        if (wParam == FALSE)
-        {
-            ASMAtomicXchgU32(&dwTimeOut, dwNormalTimeout);
-            Log(("VBoxSVCWinMain: user canceled system shutdown.\n"));
-        }
-    } break;
-    case WM_DESTROY:
-    {
-        ShutdownBlockReasonDestroyAPI(hwnd);
-        PostQuitMessage(0);
-    } break;
-
-    default:
-    {
-        rc = DefWindowProc(hwnd, msg, wParam, lParam);
-    }
+        case WM_QUERYENDSESSION:
+        {
+            if (g_pModule)
+            {
+                bool fActiveConnection = g_pModule->HasActiveConnection();
+                if (fActiveConnection)
+                {
+                    /* place the VBoxSVC into system shutdown list */
+                    ShutdownBlockReasonCreateAPI(hwnd, L"Has active connections.");
+                    /* decrease a latency of MonitorShutdown loop */
+                    ASMAtomicXchgU32(&dwTimeOut, 100);
+                    Log(("VBoxSVCWinMain: WM_QUERYENDSESSION: VBoxSvc has active connections. bActivity = %d. Loc count = %d\n",
+                         g_pModule->bActivity, g_pModule->GetLockCount()));
+                }
+                rc = !fActiveConnection;
+            }
+            else
+                AssertMsgFailed(("VBoxSVCWinMain: WM_QUERYENDSESSION: Error: g_pModule is NULL"));
+            break;
+        }
+        case WM_ENDSESSION:
+        {
+            /* Restore timeout of Monitor Shutdown if user canceled system shutdown */
+            if (wParam == FALSE)
+            {
+                ASMAtomicXchgU32(&dwTimeOut, dwNormalTimeout);
+                Log(("VBoxSVCWinMain: user canceled system shutdown.\n"));
+            }
+            break;
+        }
+        case WM_DESTROY:
+        {
+            ShutdownBlockReasonDestroyAPI(hwnd);
+            PostQuitMessage(0);
+            break;
+        }
+        default:
+        {
+            rc = DefWindowProc(hwnd, msg, wParam, lParam);
+        }
     }
     return rc;
@@ -253,7 +251,5 @@
     wc.lpszClassName = MAIN_WND_CLASS;
 
-
     ATOM atomWindowClass = RegisterClass(&wc);
-
     if (atomWindowClass == 0)
     {
@@ -265,8 +261,7 @@
         /* Create the window. */
         g_hMainWindow = CreateWindowEx(WS_EX_TOOLWINDOW |  WS_EX_TOPMOST,
-            MAIN_WND_CLASS, MAIN_WND_CLASS,
-            WS_POPUPWINDOW,
-            0, 0, 1, 1, NULL, NULL, g_hInstance, NULL);
-
+                                       MAIN_WND_CLASS, MAIN_WND_CLASS,
+                                       WS_POPUPWINDOW,
+                                       0, 0, 1, 1, NULL, NULL, g_hInstance, NULL);
         if (g_hMainWindow == NULL)
         {
@@ -277,5 +272,5 @@
         {
             SetWindowPos(g_hMainWindow, HWND_TOPMOST, -200, -200, 0, 0,
-                SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE);
+                         SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE);
 
         }
@@ -293,5 +288,4 @@
         DestroyWindow(g_hMainWindow);
         g_hMainWindow = NULL;
-
         if (g_hInstance != NULL)
         {
@@ -565,11 +559,7 @@
 
         if (RT_SUCCESS(CreateMainWindow()))
-        {
             Log(("SVCMain: Main window succesfully created\n"));
-        }
         else
-        {
             Log(("SVCMain: Failed to create main window\n"));
-        }
 
         MSG msg;
