Index: /trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk	(revision 23865)
+++ /trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk	(revision 23866)
@@ -104,5 +104,7 @@
 	VBoxGuestR3LibTime.cpp
 endif
-
+#VBoxGuestR3LibMisc.cpp uses VBOX_SVN_REV.
+VBoxGuestR3LibMisc.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
+VBoxGuestR3LibMisc.cpp_DEPS = $(VBOX_SVN_REV_KMK)
 
 #
Index: /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp	(revision 23865)
+++ /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp	(revision 23866)
@@ -25,5 +25,7 @@
 *******************************************************************************/
 #include <iprt/mem.h>
+#include <iprt/string.h>
 #include <VBox/log.h>
+#include <VBox/version.h>
 #include "VBGLR3Internal.h"
 
@@ -194,5 +196,13 @@
 
 
-/** @todo Docs */
+/**
+ * Retrieves the installed Guest Additions version/revision.
+ *
+ * @returns IPRT status value
+ * @param   ppszVer    Receives pointer of allocated version string. NULL is accepted.
+ *                     The returned pointer must be freed using RTStrFree().
+ * @param   ppszRev    Receives pointer of allocated revision string. NULL is accepted.
+ *                     The returned pointer must be freed using RTStrFree().
+ */
 VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszRev)
 {
@@ -231,24 +241,36 @@
         DWORD dwType;
         DWORD dwSize = 32;
-        char *pszVer = (char*)RTMemAlloc(dwSize);
-        if (pszVer)
+        if (ppszVer)
         {
-            if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)pszVer, &dwSize))
-                *ppszVer = pszVer;
+            char *pszVer = (char*)RTMemAlloc(dwSize);
+            if (pszVer)
+            {
+                if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)pszVer, &dwSize))
+                    *ppszVer = pszVer;
+            }
         }
         /* Revision. */
         if (ppszRev)
         {
-            dwSize = 32;
+            dwSize = 32; /* Reset */
             char *pszRev = (char*)RTMemAlloc(dwSize);
-            if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)pszRev, &dwSize))
-                *ppszRev = pszRev;
+            if (pszRev)
+            {
+                if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)pszRev, &dwSize))
+                    *ppszRev = pszRev;
+            }
         }
     }
     rc = RTErrConvertFromWin32(r);
-
     if (NULL != hKey)
         RegCloseKey(hKey);
 #else
+    /* On non-Windows platforms just return the compile-time version string atm. */
+    /* Version. */
+    if (ppszVer)
+        rc = RTStrAPrintf(ppszVer, "%s", VBOX_VERSION_STRING);
+    /* Revision. */
+    if (ppszRev)
+        rc = RTStrAPrintf(ppszRev, "%s", VBOX_SVN_REV);
 #endif /* RT_OS_WINDOWS */
     return rc;
