VirtualBox

Changeset 20698 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Jun 18, 2009 7:55:01 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
48803
Message:

VBoxService/win: Fixed Guest Additions lookup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp

    r19374 r20698  
    182182    if (r != STATUS_SUCCESS)
    183183    {
    184         VBoxServiceError("LsaGetLogonSessionData failed %lu\n", LsaNtStatusToWinError(r));
     184        VBoxServiceError("LsaGetLogonSessionData failed, LSA error %lu\n", LsaNtStatusToWinError(r));
    185185
    186186        if (sessionData)
     
    196196    }
    197197
    198     VBoxServiceVerbose(3, "vboxVMInfoThread: Users: Session data: Name = %ls, Len = %d, SID = %s, LogonID = %d,%d\n",
     198    VBoxServiceVerbose(3, "Users: Session data: Name = %ls, Len = %d, SID = %s, LogonID = %d,%d\n",
    199199        (sessionData->UserName).Buffer, (sessionData->UserName).Length, (sessionData->Sid != NULL) ? "1" : "0", sessionData->LogonId.HighPart, sessionData->LogonId.LowPart);
    200200
     
    281281                        &dwBytesRet))
    282282                    {
    283                         /*VBoxServiceVerbose(3, ("vboxVMInfoThread: Users: WTSQuerySessionInformation returned %ld bytes, p=%p, state=%d\n", dwBytesRet, pBuffer, pBuffer != NULL ? (INT)*pBuffer : -1));*/
     283                        /*VBoxServiceVerbose(3, ("Users: WTSQuerySessionInformation returned %ld bytes, p=%p, state=%d\n", dwBytesRet, pBuffer, pBuffer != NULL ? (INT)*pBuffer : -1));*/
    284284                        if(dwBytesRet)
    285285                            iState = *pBuffer;
     
    291291                            /** @todo On Vista and W2K, always "old" user name are still
    292292                             *        there. Filter out the old one! */
    293                             VBoxServiceVerbose(3, "vboxVMInfoThread: Users: Account User=%ls is logged in via TCS/RDP. State=%d\n", a_pUserInfo->szUser, iState);
     293                            VBoxServiceVerbose(3, "Users: Account User=%ls is logged in via TCS/RDP. State=%d\n", a_pUserInfo->szUser, iState);
    294294                            bFoundUser = TRUE;
    295295                        }
     
    333333
    334334    HKEY hKey = NULL;
    335     int rc = 0;
     335    long rc = 0;
    336336    DWORD dwSize = 0;
    337 
     337    DWORD dwType = 0;
     338
     339    /* First try the old registry path ... */
    338340    rc = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
    339     if ((rc != ERROR_SUCCESS ) && (rc != ERROR_FILE_NOT_FOUND))
    340     {
     341    if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
     342    {
     343        /* Old registry path does not exist -- maybe the new one does? */
    341344        rc = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
    342         if ((rc != ERROR_SUCCESS ) && (rc != ERROR_FILE_NOT_FOUND))
    343         {
    344             VBoxServiceError("Failed to open registry key (guest additions)! Error: %d\n", GetLastError());
     345        if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
     346        {
     347            VBoxServiceError("Failed to open registry key (guest additions)! Error: %d\n", rc);
    345348            return 1;
    346349        }
     
    349352    /* Installation directory. */
    350353    dwSize = sizeof(szInstDir);
    351     rc = RegQueryValueExA (hKey, "InstallDir", 0, 0, (BYTE*)(LPCTSTR)szInstDir, &dwSize);
    352     if ((rc != ERROR_SUCCESS ) && (rc != ERROR_FILE_NOT_FOUND))
     354    rc = RegQueryValueExA (hKey, "InstallDir", NULL, &dwType, (BYTE*)(LPCTSTR)szInstDir, &dwSize);
     355    if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
    353356    {
    354357        RegCloseKey (hKey);
    355         VBoxServiceError("Failed to query registry key (install directory)! Error: %d\n", GetLastError());
     358        VBoxServiceError("Failed to query registry key (install directory)! Error: %d\n", rc);
    356359        return 1;
    357360    }
     
    364367    /* Revision. */
    365368    dwSize = sizeof(szRev);
    366     rc = RegQueryValueExA (hKey, "Revision", 0, 0, (BYTE*)(LPCTSTR)szRev, &dwSize);
    367     if ((rc != ERROR_SUCCESS ) && (rc != ERROR_FILE_NOT_FOUND))
     369    rc = RegQueryValueExA (hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)szRev, &dwSize);
     370    if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
    368371    {
    369372        RegCloseKey (hKey);
    370         VBoxServiceError("Failed to query registry key (revision)! Error: %d\n",  GetLastError());
     373        VBoxServiceError("Failed to query registry key (revision)! Error: %d\n",  rc);
    371374        return 1;
    372375    }
     
    374377    /* Version. */
    375378    dwSize = sizeof(szVer);
    376     rc = RegQueryValueExA (hKey, "Version", 0, 0, (BYTE*)(LPCTSTR)szVer, &dwSize);
    377     if ((rc != ERROR_SUCCESS ) && (rc != ERROR_FILE_NOT_FOUND))
     379    rc = RegQueryValueExA (hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)szVer, &dwSize);
     380    if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
    378381    {
    379382        RegCloseKey (hKey);
    380         VBoxServiceError("Failed to query registry key (version)! Error: %Rrc\n",  GetLastError());
     383        VBoxServiceError("Failed to query registry key (version)! Error: %Rrc\n",  rc);
    381384        return 1;
    382385    }
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