Index: /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp	(revision 22839)
+++ /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp	(revision 22840)
@@ -337,5 +337,5 @@
 
     HKEY hKey = NULL;
-    long rc = 0;
+    int rc;
     DWORD dwSize = 0;
     DWORD dwType = 0;
@@ -344,54 +344,58 @@
 
     /* Check the new path first. */
-    rc = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
+    rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
+#ifdef RT_ARCH_AMD64
     if (rc != ERROR_SUCCESS)
     {
-        VBoxServiceVerbose(3, "Guest Additions version lookup: Looking in xVM key ...\n");
-
-        /* New path does not exist, check the old one ... */
-        rc = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
+        /* Check Wow6432Node (for new entries). */
+        rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
+    }
+#endif
+
+    /* Still no luck? Then try the old xVM paths ... */
+    if (RT_FAILURE(rc))
+    {
+        rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
+#ifdef RT_ARCH_AMD64
         if (rc != ERROR_SUCCESS)
         {
-            /* Nothing seems to exist, print some warning. */
-            VBoxServiceError("Failed to open registry key (guest additions)! Error: %d\n", rc);
-            return 1;
-        }
-    }
-
-    VBoxServiceVerbose(3, "Guest Additions version lookup: Key: 0x%p, RC: %d\n", hKey, rc);
-
-    /* Installation directory. */
-    dwSize = sizeof(szInstDir);
-    rc = RegQueryValueExA (hKey, "InstallDir", NULL, &dwType, (BYTE*)(LPCTSTR)szInstDir, &dwSize);
-    if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
-    {
-        RegCloseKey (hKey);
-        VBoxServiceError("Failed to query registry key (install directory)! Error: %d\n", rc);
-        return 1;
-    }
-
-    /* Flip slashes. */
-    for (char* pszTmp = &szInstDir[0]; *pszTmp; ++pszTmp)
-        if (*pszTmp == '\\')
-            *pszTmp = '/';
-
-    /* Revision. */
-    dwSize = sizeof(szRev);
-    rc = RegQueryValueExA (hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)szRev, &dwSize);
-    if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
-    {
-        RegCloseKey (hKey);
-        VBoxServiceError("Failed to query registry key (revision)! Error: %d\n",  rc);
-        return 1;
-    }
-
-    /* Version. */
-    dwSize = sizeof(szVer);
-    rc = RegQueryValueExA (hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)szVer, &dwSize);
-    if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
-    {
-        RegCloseKey (hKey);
-        VBoxServiceError("Failed to query registry key (version)! Error: %u\n",  rc);
-        return 1;
+            /* Check Wow6432Node (for new entries). */
+            rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
+        }
+#endif
+    }
+
+    /* Did we get something worth looking at? */
+    if (RT_FAILURE(rc))
+    {
+        VBoxServiceError("Failed to open registry key (guest additions)! Error: %Rrc\n", rc);
+    }
+    else
+    {
+        VBoxServiceVerbose(3, "Guest Additions version lookup: Key: 0x%p, rc: %Rrc\n", hKey, rc);
+        /* Installation directory. */
+        dwSize = sizeof(szInstDir);
+        rc = RegQueryValueEx(hKey, "InstallDir", NULL, &dwType, (BYTE*)(LPCTSTR)szInstDir, &dwSize);
+        if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
+        {
+            VBoxServiceError("Failed to query registry key (install directory)! Error: %Rrc\n", rc);
+        }    
+        else
+        {
+            /* Flip slashes. */
+            for (char* pszTmp = &szInstDir[0]; *pszTmp; ++pszTmp)
+                if (*pszTmp == '\\')
+                    *pszTmp = '/';
+        }
+        /* Revision. */
+        dwSize = sizeof(szRev);
+        rc = RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)szRev, &dwSize);
+        if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
+            VBoxServiceError("Failed to query registry key (revision)! Error: %Rrc\n", rc);
+        /* Version. */
+        dwSize = sizeof(szVer);
+        rc = RegQueryValueEx(hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)szVer, &dwSize);
+        if ((rc != ERROR_SUCCESS) && (rc != ERROR_FILE_NOT_FOUND))
+            VBoxServiceError("Failed to query registry key (version)! Error: %Rrc\n", rc);
     }
 
@@ -401,7 +405,8 @@
     VboxServiceWriteProp(uiClientID, "GuestAdd/Version", szVer);
 
-    RegCloseKey (hKey);
-
-    return VINF_SUCCESS;
+    if (NULL != hKey)
+        RegCloseKey(hKey);
+
+    return rc;
 }
 
