331
330
#endif /* TARGET_NT4 */
333
int VboxServiceWinGetAddsVersion(uint32_t uiClientID)
335
char szInstDir[_MAX_PATH] = {0};
336
char szRev[_MAX_PATH] = {0};
337
char szVer[_MAX_PATH] = {0};
344
VBoxServiceVerbose(3, "Guest Additions version lookup: Looking up ...\n");
346
/* Check the new path first. */
347
rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
349
if (rc != ERROR_SUCCESS)
351
/* Check Wow6432Node (for new entries). */
352
rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
356
/* Still no luck? Then try the old xVM paths ... */
359
rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
361
if (rc != ERROR_SUCCESS)
363
/* Check Wow6432Node (for new entries). */
364
rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
369
/* Did we get something worth looking at? */
372
VBoxServiceError("Failed to open registry key (guest additions)! Error: %Rrc\n", rc);
376
VBoxServiceVerbose(3, "Guest Additions version lookup: Key: 0x%p, rc: %Rrc\n", hKey, rc);
377
/* Installation directory. */
378
dwSize = sizeof(szInstDir);
379
rc = RegQueryValueEx(hKey, "InstallDir", NULL, &dwType, (BYTE*)(LPCTSTR)szInstDir, &dwSize);
380
if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
382
VBoxServiceError("Failed to query registry key (install directory)! Error: %Rrc\n", rc);
387
for (char* pszTmp = &szInstDir[0]; *pszTmp; ++pszTmp)
392
dwSize = sizeof(szRev);
393
rc = RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)szRev, &dwSize);
394
if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
395
VBoxServiceError("Failed to query registry key (revision)! Error: %Rrc\n", rc);
397
dwSize = sizeof(szVer);
398
rc = RegQueryValueEx(hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)szVer, &dwSize);
399
if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
400
VBoxServiceError("Failed to query registry key (version)! Error: %Rrc\n", rc);
403
/* Write information to host. */
404
VboxServiceWriteProp(uiClientID, "GuestAdd/InstallDir", szInstDir);
405
VboxServiceWriteProp(uiClientID, "GuestAdd/Revision", szRev);
406
VboxServiceWriteProp(uiClientID, "GuestAdd/Version", szVer);
414
int VboxServiceWinGetComponentVersions(uint32_t uiClientID)
332
int VBoxServiceWinGetComponentVersions(uint32_t uiClientID)
417
335
char szVer[_MAX_PATH] = {0};
439
357
{ szSysDir, "VBoxService.exe", },
440
358
{ szSysDir, "VBoxTray.exe", },
441
359
{ szSysDir, "VBoxGINA.dll", },
360
{ szSysDir, "VBoxCredProv.dll", },
443
362
/* On 64-bit we don't yet have the OpenGL DLLs in native format.
444
363
So just enumerate the 32-bit files in the SYSWOW directory. */
493
412
while (pTable->pszFileName)
495
rc = VboxServiceGetFileVersionString(pTable->pszFilePath, pTable->pszFileName, szVer, sizeof(szVer));
496
RTStrPrintf(szPropPath, sizeof(szPropPath), "GuestAdd/Components/%s", pTable->pszFileName);
497
VboxServiceWriteProp(uiClientID, szPropPath, szVer);
414
rc = VBoxServiceGetFileVersionString(pTable->pszFilePath, pTable->pszFileName, szVer, sizeof(szVer));
415
RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestAdd/Components/%s", pTable->pszFileName);
416
rc = VBoxServiceWritePropF(uiClientID, szPropPath, "%s", szVer);
501
420
return VINF_SUCCESS;