Changeset 6360 in vbox for trunk/src/VBox/Additions/WINNT/VBoxService/VBoxService.cpp
- Timestamp:
- Jan 15, 2008 5:37:15 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 27282
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxService/VBoxService.cpp
r6169 r6360 30 30 31 31 #include "helpers.h" 32 33 32 #include <sddl.h> 34 33 … … 69 68 pReq->header.size += strlen(pReq->szString); 70 69 70 printf("%s\n", pReq->szString); 71 72 FILE* pFh = fopen("c:\\VBoxServiceDebug.txt", "at"); 73 74 /* Does maybe not work on Vista (write protection when starting without admin rights), 75 so do this check! */ 76 if (NULL != pFh) 77 { 78 fprintf(pFh, "%s", pReq->szString); 79 fclose(pFh); 80 } 81 71 82 DeviceIoControl(gVBoxDriver, IOCTL_VBOXGUEST_VMMREQUEST, pReq, pReq->header.size, 72 83 pReq, pReq->header.size, &cbReturned, NULL); … … 135 146 static int vboxStartServices (VBOXSERVICEENV *pEnv, VBOXSERVICEINFO *pTable) 136 147 { 148 dprintf(("VBoxService: Starting services...\n")); 149 137 150 pEnv->hStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL); 138 151 … … 262 275 if (gVBoxDriver == INVALID_HANDLE_VALUE) 263 276 { 264 dprintf(("VBoxService: could not open VBox Guest Additions driver! rc = %d\n", GetLastError()));277 dprintf(("VBoxService: could not open VBox Guest Additions driver! Please install / start it first! rc = %d\n", GetLastError())); 265 278 status = ERROR_GEN_FAILURE; 266 279 } … … 315 328 if (gStopSem == NULL) 316 329 { 317 dprintf(("VBoxService: CreateEvent f ailed: rc = %d\n", GetLastError()));330 dprintf(("VBoxService: CreateEvent for Stopping failed: rc = %d\n", GetLastError())); 318 331 return; 319 332 } … … 377 390 } 378 391 379 ghSeamlessNotifyEvent = CreateEvent(&SecAttr, FALSE, FALSE, VBOXHOOK_GLOBAL_EVENT_NAME); 380 if (ghSeamlessNotifyEvent == NULL) 381 { 382 dprintf(("VBoxService: CreateEvent failed: rc = %d\n", GetLastError())); 383 return; 392 if (dwMajorVersion >= 5) /* Only for W2K and up ... */ 393 { 394 ghSeamlessNotifyEvent = CreateEvent(&SecAttr, FALSE, FALSE, VBOXHOOK_GLOBAL_EVENT_NAME); 395 if (ghSeamlessNotifyEvent == NULL) 396 { 397 dprintf(("VBoxService: CreateEvent for Seamless failed: rc = %d\n", GetLastError())); 398 return; 399 } 384 400 } 385 401 } … … 430 446 * Wait for the stop semaphore to be posted or a window event to arrive 431 447 */ 448 449 DWORD dwEventCount = 2; 432 450 HANDLE hWaitEvent[2] = {gStopSem, ghSeamlessNotifyEvent}; 451 452 if (0 == ghSeamlessNotifyEvent) /* If seamless mode is not active / supported, reduce event array count */ 453 dwEventCount = 1; 454 455 dprintf(("VBoxService: Number of events to wait in main loop: %ld\n", dwEventCount)); 456 433 457 while(true) 434 458 { 435 DWORD waitResult = MsgWaitForMultipleObjectsEx(2, hWaitEvent, 500, QS_ALLINPUT, 0); 436 if (waitResult == WAIT_OBJECT_0) 437 { 438 dprintf(("VBoxService: exit\n")); 459 DWORD waitResult = MsgWaitForMultipleObjectsEx(dwEventCount, hWaitEvent, 500, QS_ALLINPUT, 0); 460 waitResult = waitResult - WAIT_OBJECT_0; 461 462 dprintf(("VBoxService: Wait result = %ld.\n", waitResult)); 463 464 if (waitResult == 0) 465 { 466 dprintf(("VBoxService: Event 'Exit' triggered.\n")); 439 467 /* exit */ 440 468 break; 441 469 } 442 else 443 if (waitResult == WAIT_OBJECT_0+1) 444 { 470 else if ((waitResult == 1) && (ghSeamlessNotifyEvent!=0)) /* Only jump in, if seamless is active! */ 471 { 472 dprintf(("VBoxService: Event 'Seamless' triggered.\n")); 473 445 474 /* seamless window notification */ 446 475 VBoxSeamlessCheckWindows(); … … 504 533 dprintf(("VBoxService: WinMain\n")); 505 534 gInstance = hInstance; 506 VBoxServiceStart (); 535 VBoxServiceStart(); 536 507 537 return 0; 508 538 } … … 546 576 return 0; 547 577 } 548
Note:
See TracChangeset
for help on using the changeset viewer.