VirtualBox

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


Ignore:
Timestamp:
Sep 5, 2013 7:41:45 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
88751
Message:

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

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$
    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.

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