Changeset 65543 in vbox
- Timestamp:
- Jan 31, 2017 2:55:32 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 113189
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/win/svcmain.cpp
r65525 r65543 23 23 24 24 #include "VBox/com/defs.h" 25 26 25 #include "VBox/com/com.h" 27 28 26 #include "VBox/com/VirtualBox.h" 29 27 … … 189 187 switch (msg) 190 188 { 191 case WM_QUERYENDSESSION:192 {193 if (g_pModule)194 {195 rc = !g_pModule->HasActiveConnection();196 if (!rc)197 {198 /* place the VBoxSVC into system shutdown list */199 ShutdownBlockReasonCreateAPI(hwnd, L"Has active connections.");200 /* decrease a latency of MonitorShutdown loop */201 ASMAtomicXchgU32(&dwTimeOut, 100);202 Log(("VBoxSVCWinMain: WM_QUERYENDSESSION: VBoxSvc has active connections. bActivity = %d. Loc count = %d\n",203 g_pModule->bActivity, g_pModule->GetLockCount()));204 }205 }206 else207 {208 Assert(g_pModule);209 Log(("VBoxSVCWinMain: WM_QUERYENDSESSION: Error: g_pModule is NULL"));210 } 211 } break;212 case WM_ENDSESSION:213 {214 /* Restore timeout of Monitor Shutdown if user canceled system shutdown */215 if (wParam == FALSE)216 {217 ASMAtomicXchgU32(&dwTimeOut, dwNormalTimeout);218 Log(("VBoxSVCWinMain: user canceled system shutdown.\n"));219 }220 } break;221 case WM_DESTROY:222 {223 ShutdownBlockReasonDestroyAPI(hwnd);224 PostQuitMessage(0);225 }break;226 227 default:228 {229 rc = DefWindowProc(hwnd, msg, wParam, lParam);230 }189 case WM_QUERYENDSESSION: 190 { 191 if (g_pModule) 192 { 193 bool fActiveConnection = g_pModule->HasActiveConnection(); 194 if (fActiveConnection) 195 { 196 /* place the VBoxSVC into system shutdown list */ 197 ShutdownBlockReasonCreateAPI(hwnd, L"Has active connections."); 198 /* decrease a latency of MonitorShutdown loop */ 199 ASMAtomicXchgU32(&dwTimeOut, 100); 200 Log(("VBoxSVCWinMain: WM_QUERYENDSESSION: VBoxSvc has active connections. bActivity = %d. Loc count = %d\n", 201 g_pModule->bActivity, g_pModule->GetLockCount())); 202 } 203 rc = !fActiveConnection; 204 } 205 else 206 AssertMsgFailed(("VBoxSVCWinMain: WM_QUERYENDSESSION: Error: g_pModule is NULL")); 207 break; 208 } 209 case WM_ENDSESSION: 210 { 211 /* Restore timeout of Monitor Shutdown if user canceled system shutdown */ 212 if (wParam == FALSE) 213 { 214 ASMAtomicXchgU32(&dwTimeOut, dwNormalTimeout); 215 Log(("VBoxSVCWinMain: user canceled system shutdown.\n")); 216 } 217 break; 218 } 219 case WM_DESTROY: 220 { 221 ShutdownBlockReasonDestroyAPI(hwnd); 222 PostQuitMessage(0); 223 break; 224 } 225 default: 226 { 227 rc = DefWindowProc(hwnd, msg, wParam, lParam); 228 } 231 229 } 232 230 return rc; … … 253 251 wc.lpszClassName = MAIN_WND_CLASS; 254 252 255 256 253 ATOM atomWindowClass = RegisterClass(&wc); 257 258 254 if (atomWindowClass == 0) 259 255 { … … 265 261 /* Create the window. */ 266 262 g_hMainWindow = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, 267 MAIN_WND_CLASS, MAIN_WND_CLASS, 268 WS_POPUPWINDOW, 269 0, 0, 1, 1, NULL, NULL, g_hInstance, NULL); 270 263 MAIN_WND_CLASS, MAIN_WND_CLASS, 264 WS_POPUPWINDOW, 265 0, 0, 1, 1, NULL, NULL, g_hInstance, NULL); 271 266 if (g_hMainWindow == NULL) 272 267 { … … 277 272 { 278 273 SetWindowPos(g_hMainWindow, HWND_TOPMOST, -200, -200, 0, 0, 279 SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE);274 SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE); 280 275 281 276 } … … 293 288 DestroyWindow(g_hMainWindow); 294 289 g_hMainWindow = NULL; 295 296 290 if (g_hInstance != NULL) 297 291 { … … 565 559 566 560 if (RT_SUCCESS(CreateMainWindow())) 567 {568 561 Log(("SVCMain: Main window succesfully created\n")); 569 }570 562 else 571 {572 563 Log(("SVCMain: Failed to create main window\n")); 573 }574 564 575 565 MSG msg;
Note:
See TracChangeset
for help on using the changeset viewer.