VirtualBox

Ignore:
Timestamp:
Jan 15, 2008 5:37:15 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27282
Message:

Guest Additions NT4: Dynamic display resizing works now.

Guest Additions NT4: Bugfix: VBoxService was eating up 99% of CPU time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxService/VBoxService.cpp

    r6169 r6360  
    3030
    3131#include "helpers.h"
    32 
    3332#include <sddl.h>
    3433
     
    6968    pReq->header.size += strlen(pReq->szString);
    7069
     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
    7182    DeviceIoControl(gVBoxDriver, IOCTL_VBOXGUEST_VMMREQUEST, pReq, pReq->header.size,
    7283                    pReq, pReq->header.size, &cbReturned, NULL);
     
    135146static int vboxStartServices (VBOXSERVICEENV *pEnv, VBOXSERVICEINFO *pTable)
    136147{
     148    dprintf(("VBoxService: Starting services...\n"));
     149
    137150    pEnv->hStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
    138151
     
    262275    if (gVBoxDriver == INVALID_HANDLE_VALUE)
    263276    {
    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()));
    265278        status = ERROR_GEN_FAILURE;
    266279    }
     
    315328        if (gStopSem == NULL)
    316329        {
    317             dprintf(("VBoxService: CreateEvent failed: rc = %d\n", GetLastError()));
     330            dprintf(("VBoxService: CreateEvent for Stopping failed: rc = %d\n", GetLastError()));
    318331            return;
    319332        }
     
    377390        }
    378391
    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            }
    384400        }
    385401    }
     
    430446     * Wait for the stop semaphore to be posted or a window event to arrive
    431447     */
     448
     449    DWORD dwEventCount = 2;
    432450    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
    433457    while(true)
    434458    {
    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"));
    439467            /* exit */
    440468            break;
    441469        }
    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
    445474            /* seamless window notification */
    446475            VBoxSeamlessCheckWindows();
     
    504533    dprintf(("VBoxService: WinMain\n"));
    505534    gInstance = hInstance;
    506     VBoxServiceStart ();
     535    VBoxServiceStart();
     536   
    507537    return 0;
    508538}
     
    546576    return 0;
    547577}
    548 
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette