Changeset 23866 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Oct 19, 2009 12:55:05 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 53635
- Location:
- trunk/src/VBox/Additions/common/VBoxGuestLib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
r23856 r23866 104 104 VBoxGuestR3LibTime.cpp 105 105 endif 106 106 #VBoxGuestR3LibMisc.cpp uses VBOX_SVN_REV. 107 VBoxGuestR3LibMisc.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) 108 VBoxGuestR3LibMisc.cpp_DEPS = $(VBOX_SVN_REV_KMK) 107 109 108 110 # -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp
r23856 r23866 25 25 *******************************************************************************/ 26 26 #include <iprt/mem.h> 27 #include <iprt/string.h> 27 28 #include <VBox/log.h> 29 #include <VBox/version.h> 28 30 #include "VBGLR3Internal.h" 29 31 … … 194 196 195 197 196 /** @todo Docs */ 198 /** 199 * Retrieves the installed Guest Additions version/revision. 200 * 201 * @returns IPRT status value 202 * @param ppszVer Receives pointer of allocated version string. NULL is accepted. 203 * The returned pointer must be freed using RTStrFree(). 204 * @param ppszRev Receives pointer of allocated revision string. NULL is accepted. 205 * The returned pointer must be freed using RTStrFree(). 206 */ 197 207 VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszRev) 198 208 { … … 231 241 DWORD dwType; 232 242 DWORD dwSize = 32; 233 char *pszVer = (char*)RTMemAlloc(dwSize); 234 if (pszVer) 243 if (ppszVer) 235 244 { 236 if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)pszVer, &dwSize)) 237 *ppszVer = pszVer; 245 char *pszVer = (char*)RTMemAlloc(dwSize); 246 if (pszVer) 247 { 248 if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)pszVer, &dwSize)) 249 *ppszVer = pszVer; 250 } 238 251 } 239 252 /* Revision. */ 240 253 if (ppszRev) 241 254 { 242 dwSize = 32; 255 dwSize = 32; /* Reset */ 243 256 char *pszRev = (char*)RTMemAlloc(dwSize); 244 if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)pszRev, &dwSize)) 245 *ppszRev = pszRev; 257 if (pszRev) 258 { 259 if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)pszRev, &dwSize)) 260 *ppszRev = pszRev; 261 } 246 262 } 247 263 } 248 264 rc = RTErrConvertFromWin32(r); 249 250 265 if (NULL != hKey) 251 266 RegCloseKey(hKey); 252 267 #else 268 /* On non-Windows platforms just return the compile-time version string atm. */ 269 /* Version. */ 270 if (ppszVer) 271 rc = RTStrAPrintf(ppszVer, "%s", VBOX_VERSION_STRING); 272 /* Revision. */ 273 if (ppszRev) 274 rc = RTStrAPrintf(ppszRev, "%s", VBOX_SVN_REV); 253 275 #endif /* RT_OS_WINDOWS */ 254 276 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.