VirtualBox

Changeset 48323 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Sep 5, 2013 7:41:45 PM (11 years ago)
Author:
vboxsync
Message:

Main,Installer: 32-bit on 64-bit COM API support (windows). Currently disabled

Location:
trunk/src/VBox/Main
Files:
3 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Makefile.kmk

    r48297 r48323  
    744744 # 32-bit VBox API Client In-Process module.
    745745 #
     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 #
    746754 DLLS += VBoxClient-x86
    747755 VBoxClient-x86_TEMPLATE = VBoxMainComp-x86
    748756 VBoxClient-x86_EXTENDS  = VBoxC
    749757 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)
    750762 VBoxClient-x86_SOURCES = \
    751763        src-all/EventImpl.cpp \
     
    760772 VBoxClient-x86_SOURCES.win = \
    761773        src-client/win/dllmain.cpp \
    762         src-client/win/VBoxC.def \
    763         src-client/win/VBoxC.rc
     774        src-client/win/VBoxClient-x86.def \
     775        src-client/win/VBoxClient-x86.rc
    764776 ifdef VBOX_WITH_XPCOM
    765777  VBoxClient-x86_SOURCES += \
     
    767779 endif
    768780 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
    769792endif
    770793
     
    788811        include
    789812ifeq ($(KBUILD_TARGET),win)
    790  VBoxCOM_DEFS.x86      += _WIN32_WINNT=0x0500
    791  VBoxCOM_DEFS.amd64    += _WIN32_WINNT=0x0510
    792  VBoxCOM_SOURCES       += \
     813 VBoxCOM_DEFS.x86       = _WIN32_WINNT=0x0500
     814 VBoxCOM_DEFS.amd64     = _WIN32_WINNT=0x0510
     815 VBoxCOM_SOURCES.win    = \
    793816        $(VBoxCOM_0_OUTDIR)/VirtualBox_i.c
    794817else # !win
     
    805828 VBoxCOM-x86_TEMPLATE = VBoxMainLib-x86
    806829 VBoxCOM-x86_EXTENDS  = VBoxCOM
     830 VBoxCOM-x86_SOURCES.win    = \
     831        $(VBoxCOM-x86_0_OUTDIR)/VirtualBox_i.c
    807832endif
    808833
     
    887912testidlhdr: $(VBOX_IDL_HEADER.XPCOM)
    888913else
    889 testidl:    $(VBOX_IDL_FILE.MSCOM) $(VBoxCOM_0_OUTDIR)/VirtualBox_i.c
     914testidl:    $(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,)
    890916endif
    891917
     
    894920+ $(VBoxCOM_0_OUTDIR)/VirtualBox.h \
    895921+ $(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 \
    897923                /out $(call VBOX_FN_MAKE_WIN_PATH,$(VBoxCOM_0_OUTDIR)) \
    898924                /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))) \
    899936                /I $(call VBOX_FN_MAKE_WIN_PATH,$(PATH_SDK_$(VBOX_WINPSDK)_INC)) \
    900937                /I idl \
  • trunk/src/VBox/Main/src-all/win/comregister.cmd

    r39262 r48323  
    77
    88REM
    9 REM Copyright (C) 2006-2011 Oracle Corporation
     9REM Copyright (C) 2006-2013 Oracle Corporation
    1010REM
    1111REM This file is part of VirtualBox Open Source Edition (OSE), as
     
    9595REM Do the registrations.
    9696REM
    97 :register
     97if "%ProgramW6432%x" == "x" goto register_x86
     98goto register_amd64
     99
     100:register_x86
    98101@echo on
    99 %_VBOX_DIR%VBoxSVC.exe /ReregServer
     102%_VBOX_DIR%VBoxSVC.exe /UnregServer
    100103regsvr32 /s /u %_VBOX_DIR%VBoxC.dll
     104@if "%1" == "-u" goto end
     105%_VBOX_DIR%VBoxSVC.exe /RegServer
    101106regsvr32 /s    %_VBOX_DIR%VBoxC.dll
     107@echo off
     108goto end
     109
     110REM 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
    102120@echo off
    103121
    104122:end
    105 endlocal
     123@endlocal
    106124
  • trunk/src/VBox/Main/src-client/win/VBoxClient-x86.def

    r48283 r48323  
     1; $Id$
    12;; @file
    2 ;
    3 ; VBoxC DLL Definition File.
     3; VBoxClient-x86 DLL Definition File.
    44;
    55
    6 ; Copyright (C) 2006-2010 Oracle Corporation
     6;
     7; Copyright (C) 2006-2013 Oracle Corporation
    78;
    89; This file is part of VirtualBox Open Source Edition (OSE), as
     
    1516;
    1617
    17 LIBRARY VBoxC.dll
     18LIBRARY VBoxClient-x86.dll
    1819
    1920EXPORTS
     
    2324    DllRegisterServer   PRIVATE
    2425    DllUnregisterServer PRIVATE
    25     ; private entry points
    26     VBoxDriversRegister PRIVATE
     26
  • trunk/src/VBox/Main/src-client/win/VBoxClient-x86.rc

    r48283 r48323  
    3939    BEGIN
    4040    VALUE "CompanyName",     VBOX_RC_COMPANY_NAME
    41     VALUE "FileDescription", "VirtualBox Interface\0"
     41    VALUE "FileDescription", "VirtualBox Interface (32-bit)\0"
    4242    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"
    4444    VALUE "LegalCopyright",  VBOX_RC_LEGAL_COPYRIGHT
    45     VALUE "OriginalFilename","VBoxC.dll\0"
     45    VALUE "OriginalFilename","VBoxClient-x86.dll\0"
    4646    VALUE "ProductName",     VBOX_PRODUCT "\0"
    4747    VALUE "ProductVersion",  VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
     
    6262//
    6363
    64 IDR_VIRTUALBOX REGISTRY "VBoxC.rgs"
     64IDR_VIRTUALBOX REGISTRY "VBoxClient-x86.rgs"
    6565
    66 1 TYPELIB "VirtualBox.tlb"
     661 TYPELIB "VirtualBox-x86.tlb"
     67
  • trunk/src/VBox/Main/src-client/win/dllmain.cpp

    r47822 r48323  
    3232#include <iprt/string.h>
    3333
     34
     35/*******************************************************************************
     36*   Global Variables                                                           *
     37*******************************************************************************/
    3438CComModule _Module;
    3539
     
    4044
    4145
     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. */
     55static 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. */
     62static 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. */
     69static const char * const g_apszTypelibVersions[] =
     70{
     71    "1.0",
     72    "1.3",
     73};
     74#endif
     75
     76
    4277/*******************************************************************************
    4378*   Internal Functions                                                         *
    4479*******************************************************************************/
     80#ifndef WITH_MANUAL_CLEANUP
    4581static void removeOldMess(void);
     82#endif
    4683
    4784
     
    89126{
    90127    // registers object, typelib and all interfaces in typelib
    91     removeOldMess();
    92128    return _Module.RegisterServer(TRUE);
    93129}
     
    98134STDAPI DllUnregisterServer(void)
    99135{
    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 */
     151static 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 */
     167static 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
    107179 * boxes and such likes.
     180 */
     181static 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.
    108250 */
    109251static void removeOldInterfaces(HKEY hkeyClassesRoot)
     
    138280                cbValue = 0;
    139281            szTypelibGuid[cbValue] = '\0';
    140             if (strcmp(szTypelibGuid, "{46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}"))
     282            if (!isTypelibGuidToRemove(szTypelibGuid))
    141283            {
    142284                RegCloseKey(hkeyIfTypelib);
     
    153295            RegCloseKey(hkeyIfTypelib);
    154296
    155             if (strcmp(szTypelibVer, "1.3"))
     297            if (!isTypelibVersionToRemove(szTypelibVer))
    156298                continue;
    157299
     
    172314
    173315/**
    174  * Hack to clean out the old typelib on development boxes and such.
     316 * Hack to clean obsolete typelibs on development boxes and such.
    175317 */
    176318static void removeOldTypelib(HKEY hkeyClassesRoot)
     
    179321     * Open it and verify the identity.
    180322     */
    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);
    188329        if (rc == ERROR_SUCCESS)
    189330        {
    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)
    194333            {
    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)
    197337                {
    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);
    207360                }
    208361            }
    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);
    212369        }
    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.
    226376 */
    227377static void removeOldMess(void)
     
    232382    removeOldTypelib(HKEY_CLASSES_ROOT);
    233383    removeOldInterfaces(HKEY_CLASSES_ROOT);
     384    removeOldClassIDs(HKEY_CLASSES_ROOT);
    234385
    235386    /*
     
    243394        removeOldTypelib(hkeyWow64);
    244395        removeOldInterfaces(hkeyWow64);
     396        removeOldClassIDs(hkeyWow64);
    245397
    246398        RegCloseKey(hkeyWow64);
     
    248400}
    249401
     402#endif /* WITH_MANUAL_CLEANUP */
     403
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette