Changeset 48323 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Sep 5, 2013 7:41:45 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 88751
- Location:
- trunk/src/VBox/Main/src-client/win
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/win/VBoxClient-x86.def
r48283 r48323 1 ; $Id$ 1 2 ;; @file 2 ; 3 ; VBoxC DLL Definition File. 3 ; VBoxClient-x86 DLL Definition File. 4 4 ; 5 5 6 ; Copyright (C) 2006-2010 Oracle Corporation 6 ; 7 ; Copyright (C) 2006-2013 Oracle Corporation 7 8 ; 8 9 ; This file is part of VirtualBox Open Source Edition (OSE), as … … 15 16 ; 16 17 17 LIBRARY VBoxC .dll18 LIBRARY VBoxClient-x86.dll 18 19 19 20 EXPORTS … … 23 24 DllRegisterServer PRIVATE 24 25 DllUnregisterServer PRIVATE 25 ; private entry points 26 VBoxDriversRegister PRIVATE 26 -
trunk/src/VBox/Main/src-client/win/VBoxClient-x86.rc
r48283 r48323 39 39 BEGIN 40 40 VALUE "CompanyName", VBOX_RC_COMPANY_NAME 41 VALUE "FileDescription", "VirtualBox Interface \0"41 VALUE "FileDescription", "VirtualBox Interface (32-bit)\0" 42 42 VALUE "FileVersion", VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0" 43 VALUE "InternalName", "VBoxC .dll\0"43 VALUE "InternalName", "VBoxClient-x86.dll\0" 44 44 VALUE "LegalCopyright", VBOX_RC_LEGAL_COPYRIGHT 45 VALUE "OriginalFilename","VBoxC .dll\0"45 VALUE "OriginalFilename","VBoxClient-x86.dll\0" 46 46 VALUE "ProductName", VBOX_PRODUCT "\0" 47 47 VALUE "ProductVersion", VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0" … … 62 62 // 63 63 64 IDR_VIRTUALBOX REGISTRY "VBoxC .rgs"64 IDR_VIRTUALBOX REGISTRY "VBoxClient-x86.rgs" 65 65 66 1 TYPELIB "VirtualBox.tlb" 66 1 TYPELIB "VirtualBox-x86.tlb" 67 -
trunk/src/VBox/Main/src-client/win/dllmain.cpp
r47822 r48323 32 32 #include <iprt/string.h> 33 33 34 35 /******************************************************************************* 36 * Global Variables * 37 *******************************************************************************/ 34 38 CComModule _Module; 35 39 … … 40 44 41 45 46 /** @def WITH_MANUAL_CLEANUP 47 * Manually clean up the registry. */ 48 #if defined(DEBUG) && !defined(VBOX_IN_32_ON_64_MAIN_API) 49 //# define WITH_MANUAL_CLEANUP 50 #endif 51 52 53 #ifndef WITH_MANUAL_CLEANUP 54 /** Type library GUIDs to clean up manually. */ 55 static const char * const g_apszTypelibGuids[] = 56 { 57 "{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}", 58 "{d7569351-1750-46f0-936e-bd127d5bc264}", 59 }; 60 61 /** Same as above but with a "Typelib\\" prefix. */ 62 static const char * const g_apszTypelibGuidKeys[] = 63 { 64 "TypeLib\\{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}", 65 "TypeLib\\{d7569351-1750-46f0-936e-bd127d5bc264}", 66 }; 67 68 /** Type library version to clean up manually. */ 69 static const char * const g_apszTypelibVersions[] = 70 { 71 "1.0", 72 "1.3", 73 }; 74 #endif 75 76 42 77 /******************************************************************************* 43 78 * Internal Functions * 44 79 *******************************************************************************/ 80 #ifndef WITH_MANUAL_CLEANUP 45 81 static void removeOldMess(void); 82 #endif 46 83 47 84 … … 89 126 { 90 127 // registers object, typelib and all interfaces in typelib 91 removeOldMess();92 128 return _Module.RegisterServer(TRUE); 93 129 } … … 98 134 STDAPI DllUnregisterServer(void) 99 135 { 100 return _Module.UnregisterServer(TRUE); 101 } 102 103 104 105 /** 106 * Hack to clean out the interfaces belonging to the old typelib on development 136 HRESULT hrc = _Module.UnregisterServer(TRUE); 137 #ifndef WITH_MANUAL_CLEANUP 138 removeOldMess(); 139 #endif 140 return hrc; 141 } 142 143 #ifndef WITH_MANUAL_CLEANUP 144 145 /** 146 * Checks if the typelib GUID is one of the ones we wish to clean up. 147 * 148 * @returns true if it should be cleaned up, false if not. 149 * @param pszTypelibGuid The typelib GUID as bracketed string. 150 */ 151 static bool isTypelibGuidToRemove(const char *pszTypelibGuid) 152 { 153 unsigned i = RT_ELEMENTS(g_apszTypelibGuids); 154 while (i-- > 0) 155 if (!stricmp(g_apszTypelibGuids[i], pszTypelibGuid)) 156 return true; 157 return false; 158 } 159 160 161 /** 162 * Checks if the typelib version is one of the ones we wish to clean up. 163 * 164 * @returns true if it should be cleaned up, false if not. 165 * @param pszTypelibVer The typelib version as string. 166 */ 167 static bool isTypelibVersionToRemove(const char *pszTypelibVer) 168 { 169 unsigned i = RT_ELEMENTS(g_apszTypelibVersions); 170 while (i-- > 0) 171 if (!strcmp(g_apszTypelibVersions[i], pszTypelibVer)) 172 return true; 173 return false; 174 } 175 176 177 /** 178 * Hack to clean out the class IDs belonging to obsolete typelibs on development 107 179 * boxes and such likes. 180 */ 181 static void removeOldClassIDs(HKEY hkeyClassesRoot) 182 { 183 HKEY hkeyClsId; 184 LONG rc = RegOpenKeyExA(hkeyClassesRoot, "CLSID", NULL, DELETE | KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE, 185 &hkeyClsId); 186 if (rc == ERROR_SUCCESS) 187 { 188 for (DWORD idxKey = 0;; idxKey++) 189 { 190 char szCurNm[128 + 128]; 191 DWORD cbCurNm = 128; 192 rc = RegEnumKeyExA(hkeyClsId, idxKey, szCurNm, &cbCurNm, NULL, NULL, NULL, NULL); 193 if (rc == ERROR_NO_MORE_ITEMS) 194 break; 195 196 /* 197 * Get the typelib GUID and program ID with the class ID. 198 */ 199 AssertBreak(rc == ERROR_SUCCESS); 200 strcpy(&szCurNm[cbCurNm], "\\TypeLib"); 201 HKEY hkeyIfTypelib; 202 rc = RegOpenKeyExA(hkeyClsId, szCurNm, NULL, KEY_QUERY_VALUE, &hkeyIfTypelib); 203 if (rc != ERROR_SUCCESS) 204 continue; 205 206 char szTypelibGuid[128]; 207 DWORD cbValue = sizeof(szTypelibGuid) - 1; 208 rc = RegQueryValueExA(hkeyIfTypelib, NULL, NULL, NULL, (PBYTE)&szTypelibGuid[0], &cbValue); 209 if (rc != ERROR_SUCCESS) 210 cbValue = 0; 211 szTypelibGuid[cbValue] = '\0'; 212 RegCloseKey(hkeyIfTypelib); 213 if (!isTypelibGuidToRemove(szTypelibGuid)) 214 continue; 215 216 /* ProgId */ 217 strcpy(&szCurNm[cbCurNm], "\\ProgId"); 218 HKEY hkeyIfProgId; 219 rc = RegOpenKeyExA(hkeyClsId, szCurNm, NULL, KEY_QUERY_VALUE, &hkeyIfProgId); 220 if (rc != ERROR_SUCCESS) 221 continue; 222 223 char szProgId[64]; 224 cbValue = sizeof(szProgId) - 1; 225 rc = RegQueryValueExA(hkeyClsId, NULL, NULL, NULL, (PBYTE)&szProgId[0], &cbValue); 226 if (rc != ERROR_SUCCESS) 227 cbValue = 0; 228 szProgId[cbValue] = '\0'; 229 RegCloseKey(hkeyClsId); 230 if (strnicmp(szProgId, RT_STR_TUPLE("VirtualBox."))) 231 continue; 232 233 /* 234 * Ok, it's an orphaned VirtualBox interface. Delete it. 235 */ 236 szCurNm[cbCurNm] = '\0'; 237 RTAssertMsg2("Should delete HCR/CLSID/%s\n", szCurNm); 238 //rc = SHDeleteKeyA(hkeyClsId, szCurNm); 239 Assert(rc == ERROR_SUCCESS); 240 } 241 242 RegCloseKey(hkeyClsId); 243 } 244 } 245 246 247 /** 248 * Hack to clean out the interfaces belonging to obsolete typelibs on 249 * development boxes and such likes. 108 250 */ 109 251 static void removeOldInterfaces(HKEY hkeyClassesRoot) … … 138 280 cbValue = 0; 139 281 szTypelibGuid[cbValue] = '\0'; 140 if ( strcmp(szTypelibGuid, "{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}"))282 if (!isTypelibGuidToRemove(szTypelibGuid)) 141 283 { 142 284 RegCloseKey(hkeyIfTypelib); … … 153 295 RegCloseKey(hkeyIfTypelib); 154 296 155 if ( strcmp(szTypelibVer, "1.3"))297 if (!isTypelibVersionToRemove(szTypelibVer)) 156 298 continue; 157 299 … … 172 314 173 315 /** 174 * Hack to clean o ut the old typelibon development boxes and such.316 * Hack to clean obsolete typelibs on development boxes and such. 175 317 */ 176 318 static void removeOldTypelib(HKEY hkeyClassesRoot) … … 179 321 * Open it and verify the identity. 180 322 */ 181 HKEY hkeyOldTyplib; 182 LONG rc = RegOpenKeyExA(hkeyClassesRoot, "TypeLib\\{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}", NULL, 183 DELETE | KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE, &hkeyOldTyplib); 184 if (rc == ERROR_SUCCESS) 185 { 186 HKEY hkeyVer1Dot3; 187 rc = RegOpenKeyExA(hkeyOldTyplib, "1.3", NULL, KEY_READ, &hkeyVer1Dot3); 323 unsigned i = RT_ELEMENTS(g_apszTypelibGuidKeys); 324 while (i-- > 0) 325 { 326 HKEY hkeyTyplib; 327 LONG rc = RegOpenKeyExA(hkeyClassesRoot, g_apszTypelibGuidKeys[i], NULL, 328 DELETE | KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE, &hkeyTyplib); 188 329 if (rc == ERROR_SUCCESS) 189 330 { 190 char szValue[128]; 191 DWORD cbValue = sizeof(szValue) - 1; 192 rc = RegQueryValueExA(hkeyVer1Dot3, NULL, NULL, NULL, (PBYTE)&szValue[0], &cbValue); 193 if (rc == ERROR_SUCCESS) 331 unsigned iVer = RT_ELEMENTS(g_apszTypelibVersions); 332 while (iVer-- > 0) 194 333 { 195 szValue[cbValue] = '\0'; 196 if (!strcmp(szValue, "VirtualBox Type Library")) 334 HKEY hkeyVer; 335 rc = RegOpenKeyExA(hkeyTyplib, g_apszTypelibVersions[iVer], NULL, KEY_READ, &hkeyVer); 336 if (rc == ERROR_SUCCESS) 197 337 { 198 RegCloseKey(hkeyVer1Dot3); 199 hkeyVer1Dot3 = NULL; 200 201 /* 202 * Delete the type library. 203 */ 204 //RTAssertMsg2("Should delete HCR/TypeLib/{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}/1.3\n"); 205 rc = SHDeleteKeyA(hkeyOldTyplib, "1.3"); 206 Assert(rc == ERROR_SUCCESS); 338 char szValue[128]; 339 DWORD cbValue = sizeof(szValue) - 1; 340 rc = RegQueryValueExA(hkeyVer, NULL, NULL, NULL, (PBYTE)&szValue[0], &cbValue); 341 if (rc == ERROR_SUCCESS) 342 { 343 szValue[cbValue] = '\0'; 344 if (!strcmp(szValue, "VirtualBox Type Library")) 345 { 346 RegCloseKey(hkeyVer); 347 hkeyVer = NULL; 348 349 /* 350 * Delete the type library. 351 */ 352 //RTAssertMsg2("Should delete HCR\\%s\\%s\n", g_apszTypelibGuidKeys[i], g_apszTypelibVersions[iVer]); 353 rc = SHDeleteKeyA(hkeyTyplib, g_apszTypelibVersions[iVer]); 354 Assert(rc == ERROR_SUCCESS); 355 } 356 } 357 358 if (hkeyVer != NULL) 359 RegCloseKey(hkeyVer); 207 360 } 208 361 } 209 210 if (hkeyVer1Dot3 != NULL) 211 RegCloseKey(hkeyVer1Dot3); 362 RegCloseKey(hkeyTyplib); 363 364 /* 365 * The typelib key should be empty now, so we can try remove it (non-recursively). 366 */ 367 rc = RegDeleteKeyA(hkeyClassesRoot, g_apszTypelibGuidKeys[i]); 368 Assert(rc == ERROR_SUCCESS); 212 369 } 213 RegCloseKey(hkeyOldTyplib); 214 215 /* 216 * The typelib key should be empty now, so we can try remove it (non-recursively). 217 */ 218 rc = RegDeleteKeyA(hkeyClassesRoot, "TypeLib\\{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}"); 219 Assert(rc == ERROR_SUCCESS); 220 } 221 } 222 223 224 /** 225 * Hack to clean out the old typelib on development boxes and such. 370 } 371 } 372 373 374 /** 375 * Hack to clean out obsolete typelibs on development boxes and such. 226 376 */ 227 377 static void removeOldMess(void) … … 232 382 removeOldTypelib(HKEY_CLASSES_ROOT); 233 383 removeOldInterfaces(HKEY_CLASSES_ROOT); 384 removeOldClassIDs(HKEY_CLASSES_ROOT); 234 385 235 386 /* … … 243 394 removeOldTypelib(hkeyWow64); 244 395 removeOldInterfaces(hkeyWow64); 396 removeOldClassIDs(hkeyWow64); 245 397 246 398 RegCloseKey(hkeyWow64); … … 248 400 } 249 401 402 #endif /* WITH_MANUAL_CLEANUP */ 403
Note:
See TracChangeset
for help on using the changeset viewer.