VirtualBox

Changeset 59385 in vbox


Ignore:
Timestamp:
Jan 18, 2016 5:37:59 PM (9 years ago)
Author:
vboxsync
Message:

VBoxProxyStub,comregister,glue: Added a second proxy dll for older 64-bit windows versions since we're having trouble convincing MIDL to produce code that works with XP64/W2K3 without indicating that we're targetting windows 2000 and dropping the ndr64/all protocol option. Using the legacy proxy stub for vista and windows server 2008 too, since there was some potentially interesting changes introduced with windows 7 that we might benefit from.

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

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

    r59371 r59385  
    929929 VBoxCOM_SOURCES       += \
    930930        $(VBoxCOM_0_OUTDIR)/VirtualBox_i.c
     931 VBoxCOM_CLEAN          = \
     932        $(VBoxCOM_0_OUTDIR)/VirtualBox_i.c \
     933        $(VBoxCOM_0_OUTDIR)/VirtualBox_p.c \
     934        $(VBoxCOM_0_OUTDIR)/dlldata.c \
     935        $(VBoxCOM_0_OUTDIR)/VirtualBox.h \
     936        $(VBoxCOM_0_OUTDIR)/VirtualBox.tlb
     937 ifeq ($(KBUILD_TARGET_ARCH),amd64)
     938  VBoxCOM_CLEAN        += \
     939        $(VBoxCOM_0_OUTDIR)/old64/VirtualBox_i.c \
     940        $(VBoxCOM_0_OUTDIR)/old64/VirtualBox_p.c \
     941        $(VBoxCOM_0_OUTDIR)/old64/dlldata.c \
     942        $(VBoxCOM_0_OUTDIR)/old64/VirtualBox.h \
     943        $(VBoxCOM_0_OUTDIR)/old64/VirtualBox.tlb
     944  VBoxCOM_BLDDIRS      = $(VBoxCOM_0_OUTDIR)/old64/
     945 endif
    931946else # !win
    932947 VBoxCOM_SOURCES       += \
     
    944959 VBoxCOM-x86_TEMPLATE = VBoxMainLib-x86
    945960 VBoxCOM-x86_EXTENDS  = VBoxCOM
     961 ifeq ($(KBUILD_TARGET),win)
     962  VBoxCOM-x86_CLEAN   = \
     963        $(VBoxCOM-x86_0_OUTDIR)/VirtualBox_i.c \
     964        $(VBoxCOM-x86_0_OUTDIR)/VirtualBox_p.c \
     965        $(VBoxCOM-x86_0_OUTDIR)/dlldata.c \
     966        $(VBoxCOM-x86_0_OUTDIR)/VirtualBox.h \
     967        $(VBoxCOM-x86_0_OUTDIR)/VirtualBox.tlb
     968 endif
    946969endif
    947970
     
    10121035if defined(VBOX_WITH_MIDL_PROXY_STUB) && "$(KBUILD_TARGET)" == "win"
    10131036 #
    1014  # Experimental COM proxy + stub DLL.
     1037 # Experimental COM proxy + stub DLL w/ automatic registration updating.
     1038 #
     1039 # The Legacy stub is for older 64-bit windows versions (pre Windows 7) as we
     1040 # were having various problems on windows server 2003 and 2008 with the code
     1041 # MIDL generated.  Also, in windows 7 there are some potentially interesting
     1042 # changes in the generated code where it uses new helpers from OLE32.
    10151043 #
    10161044 DLLS += VBoxProxyStub
     
    10301058  src-all/win/VBoxProxyStub.rc_DEPS = $(VBoxCOM_0_OUTDIR)/VirtualBox.tlb
    10311059
     1060 DLLS += VBoxProxyStubLegacy
     1061 VBoxProxyStubLegacy_TEMPLATE = VBOXMAINCOMP
     1062 VBoxProxyStubLegacy_EXTENDS  = VBoxProxyStub
     1063 VBoxProxyStubLegacy_DEFS     = $(VBoxProxyStub_DEFS) VBOX_IN_PROXY_STUB_LEGACY
     1064 VBoxProxyStubLegacy_INCS     = $(VBoxCOM_0_OUTDIR)/old64/
     1065 VBoxProxyStubLegacy_SOURCES  = \
     1066        $(VBoxCOM_0_OUTDIR)/old64/VirtualBox_p.c \
     1067        $(VBoxCOM_0_OUTDIR)/old64/VirtualBox_i.c \
     1068        src-all/win/VBoxProxyStub.def \
     1069        src-all/win/VBoxProxyStub.rc \
     1070        src-all/win/VBoxProxyStub.c
     1071  src-all/win/VBoxProxyStub.rc_DEPS = $(VBoxCOM_0_OUTDIR)/old64/VirtualBox.tlb
     1072
    10321073 ifdef VBOX_WITH_32_ON_64_MAIN_API
    10331074  DLLS += VBoxProxyStub-x86
     
    10921133        $(QUIET)$(VBOX_XSLTPROC) -o $@ $< $(VBOX_XIDL_FILE)
    10931134
     1135# Note! Because we've got a different proxy stub DLL for pre windows 7 64-bit hosts, we target windows 7 for AMD64.
     1136#       The output is different and hopefully more efficient, at least memory wise (using more helpers in OLE32).
    10941137$(VBoxCOM_0_OUTDIR)/VirtualBox_i.c \
    10951138+ $(VBoxCOM_0_OUTDIR)/VirtualBox.h \
     
    10971140+ $(VBoxCOM_0_OUTDIR)/VirtualBox.tlb: $(VBOX_IDL_FILE.MSCOM) | $$(dir $$@)
    10981141        $(VBOX_WIN_MIDL) /nologo \
    1099                 $(if-expr "$(KBUILD_TARGET_ARCH)" == "amd64" && "$(KBUILD_HOST)" == "win",/env amd64,/env win32) \
    1100                 /robust /protocol all /target NT51 \
     1142                $(if-expr "$(KBUILD_TARGET_ARCH)" == "amd64" && "$(KBUILD_HOST)" == "win" \
     1143                ,/env amd64 /robust /protocol all /target NT61\
     1144                ,/env win32 /robust /protocol all /target NT51) \
    11011145                /out $(call VBOX_FN_MAKE_WIN_PATH,$(VBoxCOM_0_OUTDIR)) \
    11021146                /cpp_cmd $(subst $(EXEC_X86_WIN32),,$(call VBOX_FN_MAKE_WIN_PATH,$(TOOL_$(VBOX_VCC_TOOL)_CC))) \
     
    11041148                /I idl \
    11051149                $(call VBOX_FN_MAKE_WIN_PATH,$<)
     1150
     1151if defined(VBOX_WITH_MIDL_PROXY_STUB) && "$(KBUILD_TARGET_ARCH)" == "amd64"
     1152# -Windows Server 2003 AMD64 SP1 does not like the result when using '/protocol all' and '/target NT51'.
     1153# -Vista AMD64 SP1 and Windows Server 2008 AMD64 seems to have some objections as well, but it seemed
     1154#  that using an older MIDL compiler (v7.00.0499 instead of v7.00.0555) helps. But the W2K3 fix also works.
     1155$(VBoxCOM_0_OUTDIR)/old64/VirtualBox_i.c \
     1156+ $(VBoxCOM_0_OUTDIR)/old64/VirtualBox_p.c\
     1157+ $(VBoxCOM_0_OUTDIR)/old64/dlldata.c \
     1158+ $(VBoxCOM_0_OUTDIR)/old64/VirtualBox.h \
     1159+ $(VBoxCOM_0_OUTDIR)/old64/VirtualBox.tlb: $(VBOX_IDL_FILE.MSCOM) | $$(dir $$@)
     1160        $(VBOX_WIN_MIDL) /nologo \
     1161                /env win64 /x64 /robust /target NT50 \
     1162                /out $(call VBOX_FN_MAKE_WIN_PATH,$(dir $@)) \
     1163                /cpp_cmd $(subst $(EXEC_X86_WIN32),,$(call VBOX_FN_MAKE_WIN_PATH,$(TOOL_$(VBOX_VCC_TOOL)_CC))) \
     1164                /I $(call VBOX_FN_MAKE_WIN_PATH,$(PATH_SDK_$(VBOX_WINPSDK)_INC)) \
     1165                /I idl \
     1166                $(call VBOX_FN_MAKE_WIN_PATH,$<)
     1167endif
    11061168
    11071169$(VBoxCOM-x86_0_OUTDIR)/VirtualBox_i.c \
  • trunk/src/VBox/Main/glue/initterm.cpp

    r59368 r59385  
    1919#if !defined(VBOX_WITH_XPCOM)
    2020
     21# include <iprt/nt/nt-and-windows.h>
    2122# include <objbase.h>
    2223
     
    254255        int vrc = RTPathAppPrivateArch(szPath, sizeof(szPath));
    255256        if (RT_SUCCESS(vrc))
     257        {
    256258#  ifndef VBOX_IN_32_ON_64_MAIN_API
    257             rc = RTPathAppend(szPath, sizeof(szPath), "VBoxProxyStub.dll");
     259            rc = RTPathAppend(szPath, sizeof(szPath),
     260#   if ARCH_BITS == 64
     261                                 RT_MAKE_U64(((PKUSER_SHARED_DATA)MM_SHARED_USER_DATA_VA)->NtMinorVersion,
     262                                             ((PKUSER_SHARED_DATA)MM_SHARED_USER_DATA_VA)->NtMajorVersion)
     263                              >= RT_MAKE_U64(1/*Lo*/,6/*Hi*/)
     264                              ? "VBoxProxyStub.dll" : "VBoxProxyStubLegacy.dll"
     265#   else
     266                              "VBoxProxyStub.dll"
     267#   endif
     268                              );
    258269#  else
    259270            rc = RTPathAppend(szPath, sizeof(szPath), "x86\\VBoxProxyStub-x86.dll");
    260271#  endif
     272        }
    261273        if (RT_SUCCESS(vrc))
    262274        {
  • trunk/src/VBox/Main/src-all/win/VBoxProxyStub.c

    r59370 r59385  
    6969# define VBSP_LOG_DEL_KEY(a)        do { } while (0)
    7070#endif
     71
     72/**
     73 * Selects the proxy stub DLL based on 32-on-64-bit and host OS version.
     74 *
     75 * The legacy DLL covers 64-bit pre Windows 7 versions of Windows. W2K3-amd64
     76 * has trouble parsing the result when MIDL /target NT51 or higher. Vista and
     77 * windows server 2008 seems to have trouble with newer IDL compilers.
     78 */
     79#define VBPS_PROXY_STUB_FILE(a_fIs32On64) \
     80    ( (a_fIs32On64) ? "x86\\VBoxProxyStub-x86.dll" \
     81      : RT_MAKE_U64(((PKUSER_SHARED_DATA)MM_SHARED_USER_DATA_VA)->NtMinorVersion, \
     82                    ((PKUSER_SHARED_DATA)MM_SHARED_USER_DATA_VA)->NtMajorVersion) >= RT_MAKE_U64(1/*Lo*/,6/*Hi*/) \
     83        ? "VBoxProxyStub.dll" : "VBoxProxyStubLegacy.dll" )
    7184
    7285
     
    142155            /* Init IPRT. */
    143156            RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE);
     157
     158#ifdef VBOX_STRICT
     159            {
     160                /*
     161                 * Check that no interface has more than 256 methods in the stub vtable.
     162                 */
     163                const ProxyFileInfo **ppProxyFile = &g_apProxyFiles[0];
     164                const ProxyFileInfo  *pProxyFile;
     165                while ((pProxyFile = *ppProxyFile++) != NULL)
     166                {
     167                    const PCInterfaceStubVtblList * const   papStubVtbls  = pProxyFile->pStubVtblList;
     168                    const char * const                     *papszNames    = pProxyFile->pNamesArray;
     169                    unsigned                                iIf           = pProxyFile->TableSize;
     170                    AssertStmt(iIf < 1024, iIf = 0);
     171                    Assert(pProxyFile->TableVersion == 2);
     172
     173                    while (iIf-- > 0)
     174                        AssertMsg(papStubVtbls[iIf]->header.DispatchTableCount <= 256,
     175                                  ("%s: DispatchTableCount=%d\n", papszNames[iIf], papStubVtbls[iIf]->header.DispatchTableCount));
     176                }
     177            }
     178#endif
    144179            break;
    145180
     
    11071142        unsigned i = pState->cAltDeletes;
    11081143        while (i-- > 0)
    1109             vbpsDeleteKeyRecursiveA(pState, pState->aAltDeletes[i].hkeyClsid, szClsId, __LINE__);
     1144            if (pState->aAltDeletes[i].hkeyClsid != NULL)
     1145                vbpsDeleteKeyRecursiveA(pState, pState->aAltDeletes[i].hkeyClsid, szClsId, __LINE__);
    11101146        vbpsDeleteKeyRecursiveA(pState, pState->hkeyClsidRootDst, szClsId, __LINE__);
    11111147    }
     
    12321268static void vbpsUpdateTypeLibRegistration(VBPSREGSTATE *pState, PCRTUTF16 pwszVBoxDir, bool fIs32On64)
    12331269{
    1234     const char * const pszTypeLibDll = !fIs32On64 ? "VBoxProxyStub.dll" : "x86\\VBoxProxyStub-x86.dll";
     1270    const char * const pszTypeLibDll = VBPS_PROXY_STUB_FILE(fIs32On64);
    12351271    const char * const pszWinXx      = !fIs32On64 ? "win64"             : "win32";
    12361272    const char * const pszDescription = "VirtualBox Type Library";
     
    13161352     * It's simple compared to the VBox classes, thus all the NULL parameters.
    13171353     */
    1318     const char *pszPsDll = !fIs32On64 ? "VBoxProxyStub.dll" : "x86\\VBoxProxyStub-x86.dll";
     1354    const char *pszPsDll = VBPS_PROXY_STUB_FILE(fIs32On64);
    13191355    Assert(pState->fUpdate && !pState->fDelete);
    13201356    VbpsRegisterClassId(pState, &g_ProxyClsId, "PSFactoryBuffer", NULL /*pszAppId*/,
  • trunk/src/VBox/Main/src-all/win/comregister.cmd

    r59365 r59385  
    77
    88REM
    9 REM Copyright (C) 2006-2015 Oracle Corporation
     9REM Copyright (C) 2006-2016 Oracle Corporation
    1010REM
    1111REM This file is part of VirtualBox Open Source Edition (OSE), as
     
    121121REM
    122122set fNoProxy=0
    123 if "%WinVerMajor%" == "5" set fNoProxy=1
    124 if "%WinVerMajor%" == "4" set fNoProxy=1
    125123set fUninstallOnly=0
    126124
     
    173171REM Unregister all first, then register them. The order matters here.
    174172:register_amd64
     173if "%WinVerMajor%" == "5" goto register_amd64_legacy
     174if not "%WinVerMajor%" == "6" goto register_amd64_not_legacy
     175if not "%WinVerMinor%" == "0" goto register_amd64_not_legacy
     176:register_amd64_legacy
     177set s64BitProxyStub=VBoxProxyStubLegacy.dll
     178goto register_amd64_begin
     179:register_amd64_not_legacy
     180set s64BitProxyStub=VBoxProxyStub.dll
     181:register_amd64_begin
     182echo s64BitProxyStub=%s64BitProxyStub%
    175183@echo on
    176184"%_VBOX_DIR%VBoxSVC.exe" /UnregServer
    177185%windir%\system32\regsvr32 /s /u "%_VBOX_DIR%VBoxC.dll"
    178186%windir%\syswow64\regsvr32 /s /u "%_VBOX_DIR%x86\VBoxClient-x86.dll"
    179 %windir%\system32\regsvr32 /s /u "%_VBOX_DIR%VBoxProxyStub.dll"
     187%windir%\system32\regsvr32 /s /u "%_VBOX_DIR%%s64BitProxyStub%"
    180188%windir%\syswow64\regsvr32 /s /u "%_VBOX_DIR%x86\VBoxProxyStub-x86.dll"
    181189if %fUninstallOnly% == 1 goto end
     
    184192%windir%\syswow64\regsvr32 /s    "%_VBOX_DIR%x86\VBoxClient-x86.dll"
    185193if %fNoProxy% == 1 goto end
    186 if exist "%_VBOX_DIR%VBoxProxyStub.dll"         %windir%\system32\regsvr32 /s "%_VBOX_DIR%VBoxProxyStub.dll"
     194if exist "%_VBOX_DIR%%s64BitProxyStub%"         %windir%\system32\regsvr32 /s "%_VBOX_DIR%%s64BitProxyStub%"
    187195if exist "%_VBOX_DIR%x86\VBoxProxyStub-x86.dll" %windir%\syswow64\regsvr32 /s "%_VBOX_DIR%x86\VBoxProxyStub-x86.dll"
    188196@echo off
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