Changeset 48323 in vbox for trunk/src/VBox/Main
- Timestamp:
- Sep 5, 2013 7:41:45 PM (11 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r48297 r48323 744 744 # 32-bit VBox API Client In-Process module. 745 745 # 746 # This is currently just a 32-bit version of VBoxC. It might be desirable to 747 # split up VBoxC into a simple client and a VM client part later, in which 748 # case this module will be a simple client. 749 # 750 # Note! One important thing is that the typelib for this DLL must be build 751 # with the /env win32 switch and the VBoxC typelib with /env amd64, if 752 # not they will overwrite each others typelib module entry. 753 # 746 754 DLLS += VBoxClient-x86 747 755 VBoxClient-x86_TEMPLATE = VBoxMainComp-x86 748 756 VBoxClient-x86_EXTENDS = VBoxC 749 757 VBoxClient-x86_DEFS = VBOX_COM_INPROC_API_CLIENT $(VBoxC_DEFS) 758 VBoxClient-x86_INCS.win = \ 759 $(VBoxClient-x86_0_OUTDIR) \ 760 $(VBoxCOM-x86_0_OUTDIR) \ 761 $(VBoxC_INCS.win) 750 762 VBoxClient-x86_SOURCES = \ 751 763 src-all/EventImpl.cpp \ … … 760 772 VBoxClient-x86_SOURCES.win = \ 761 773 src-client/win/dllmain.cpp \ 762 src-client/win/VBoxC .def \763 src-client/win/VBoxC .rc774 src-client/win/VBoxClient-x86.def \ 775 src-client/win/VBoxClient-x86.rc 764 776 ifdef VBOX_WITH_XPCOM 765 777 VBoxClient-x86_SOURCES += \ … … 767 779 endif 768 780 VBoxClient-x86_LIBS = $(NO_SUCH_VARIABLE) 781 VBoxClient-x86_LIBS.win = $(NO_SUCH_VARIABLE) 782 VBoxClient-x86_CLEAN.win += $$(VBoxClient-x86_0_OUTDIR)/VBoxClient-x86.rgs 783 src-client/win/VBoxClient-x86.rc_DEPS = \ 784 $(VBoxClient-x86_0_OUTDIR)/VBoxClient-x86.rgs \ 785 $(VBoxCOM-x86_0_OUTDIR)/VirtualBox-x86.tlb 786 787 $$(VBoxClient-x86_0_OUTDIR)/VBoxClient-x86.rgs: \ 788 $(VBOX_PATH_MAIN_SRC)/src-all/win/VirtualBox_rgs.xsl \ 789 $(VBOX_XIDL_FILE) | $$(dir $$@) 790 $(VBOX_XSLTPROC) --stringparam Module VBoxC -o $@ $< $(VBOX_XIDL_FILE) 791 769 792 endif 770 793 … … 788 811 include 789 812 ifeq ($(KBUILD_TARGET),win) 790 VBoxCOM_DEFS.x86 += _WIN32_WINNT=0x0500791 VBoxCOM_DEFS.amd64 += _WIN32_WINNT=0x0510792 VBoxCOM_SOURCES += \813 VBoxCOM_DEFS.x86 = _WIN32_WINNT=0x0500 814 VBoxCOM_DEFS.amd64 = _WIN32_WINNT=0x0510 815 VBoxCOM_SOURCES.win = \ 793 816 $(VBoxCOM_0_OUTDIR)/VirtualBox_i.c 794 817 else # !win … … 805 828 VBoxCOM-x86_TEMPLATE = VBoxMainLib-x86 806 829 VBoxCOM-x86_EXTENDS = VBoxCOM 830 VBoxCOM-x86_SOURCES.win = \ 831 $(VBoxCOM-x86_0_OUTDIR)/VirtualBox_i.c 807 832 endif 808 833 … … 887 912 testidlhdr: $(VBOX_IDL_HEADER.XPCOM) 888 913 else 889 testidl: $(VBOX_IDL_FILE.MSCOM) $(VBoxCOM_0_OUTDIR)/VirtualBox_i.c 914 testidl: $(VBOX_IDL_FILE.MSCOM) $(VBoxCOM_0_OUTDIR)/VirtualBox_i.c \ 915 $(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBoxCOM-x86_0_OUTDIR)/VirtualBox_i.c,) 890 916 endif 891 917 … … 894 920 + $(VBoxCOM_0_OUTDIR)/VirtualBox.h \ 895 921 + $(VBoxCOM_0_OUTDIR)/VirtualBox.tlb: $(VBOX_IDL_FILE.MSCOM) | $$(dir $$@) 896 $(VBOX_WIN_MIDL) /nologo \922 $(VBOX_WIN_MIDL) /nologo $(if-expr "$(KBUILD_TARGET_ARCH)" == "amd64",/env amd64,/env win32) /target NT51 \ 897 923 /out $(call VBOX_FN_MAKE_WIN_PATH,$(VBoxCOM_0_OUTDIR)) \ 898 924 /cpp_cmd $(subst $(EXEC_X86_WIN32),,$(call VBOX_FN_MAKE_WIN_PATH,$(TOOL_$(VBOX_VCC_TOOL)_CC))) \ 925 /I $(call VBOX_FN_MAKE_WIN_PATH,$(PATH_SDK_$(VBOX_WINPSDK)_INC)) \ 926 /I idl \ 927 $(call VBOX_FN_MAKE_WIN_PATH,$<) 928 929 $(VBoxCOM-x86_0_OUTDIR)/VirtualBox_i.c \ 930 + $(VBoxCOM-x86_0_OUTDIR)/VirtualBox.h \ 931 + $(VBoxCOM-x86_0_OUTDIR)/VirtualBox-x86.tlb: $(VBOX_IDL_FILE.MSCOM) | $$(dir $$@) 932 $(VBOX_WIN_MIDL) /nologo /env win32 /target NT51 \ 933 /out $(call VBOX_FN_MAKE_WIN_PATH,$(VBoxCOM-x86_0_OUTDIR)) \ 934 /tlb $(call VBOX_FN_MAKE_WIN_PATH,$(VBoxCOM-x86_0_OUTDIR)/VirtualBox-x86.tlb) \ 935 /cpp_cmd $(subst $(EXEC_X86_WIN32),,$(call VBOX_FN_MAKE_WIN_PATH,$(TOOL_$(VBOX_VCC_TOOL_STEM)X86_CC))) \ 899 936 /I $(call VBOX_FN_MAKE_WIN_PATH,$(PATH_SDK_$(VBOX_WINPSDK)_INC)) \ 900 937 /I idl \ -
trunk/src/VBox/Main/src-all/win/comregister.cmd
r39262 r48323 7 7 8 8 REM 9 REM Copyright (C) 2006-201 1Oracle Corporation9 REM Copyright (C) 2006-2013 Oracle Corporation 10 10 REM 11 11 REM This file is part of VirtualBox Open Source Edition (OSE), as … … 95 95 REM Do the registrations. 96 96 REM 97 :register 97 if "%ProgramW6432%x" == "x" goto register_x86 98 goto register_amd64 99 100 :register_x86 98 101 @echo on 99 %_VBOX_DIR%VBoxSVC.exe / ReregServer102 %_VBOX_DIR%VBoxSVC.exe /UnregServer 100 103 regsvr32 /s /u %_VBOX_DIR%VBoxC.dll 104 @if "%1" == "-u" goto end 105 %_VBOX_DIR%VBoxSVC.exe /RegServer 101 106 regsvr32 /s %_VBOX_DIR%VBoxC.dll 107 @echo off 108 goto end 109 110 REM Unregister both first, then register them. The order matters here. 111 :register_amd64 112 @echo on 113 %_VBOX_DIR%VBoxSVC.exe /UnregServer 114 %windir%\syswow64\regsvr32 /s /u %_VBOX_DIR%VBoxClient-x86.dll 115 %windir%\system32\regsvr32 /s /u %_VBOX_DIR%VBoxC.dll 116 @if "%1" == "-u" goto end 117 %_VBOX_DIR%VBoxSVC.exe /RegServer 118 %windir%\system32\regsvr32 /s %_VBOX_DIR%VBoxC.dll 119 %windir%\syswow64\regsvr32 /s %_VBOX_DIR%VBoxClient-x86.dll 102 120 @echo off 103 121 104 122 :end 105 endlocal123 @endlocal 106 124 -
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.