VirtualBox

Changeset 66274 in vbox for trunk/src/VBox/Main/src-all


Ignore:
Timestamp:
Mar 28, 2017 12:19:45 AM (8 years ago)
Author:
vboxsync
Message:

VBox/Main: ​bugref:3300: VBoxSVC from terminal server session is not 'visible' - added VBoxSDS implementation

Location:
trunk/src/VBox/Main/src-all/win
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-all/win/VBoxProxyStub.c

    r65088 r66274  
    10181018 * @param   pszAppId            The application UUID string.
    10191019 * @param   pszDescription      The description string.
    1020  */
    1021 LSTATUS VbpsRegisterAppId(VBPSREGSTATE *pState, const char *pszAppId, const char *pszDescription)
     1020 * @param   bIsService          The application is windows service
     1021 */
     1022LSTATUS VbpsRegisterAppId(
     1023    VBPSREGSTATE *pState,
     1024    const char *pszModuleName,
     1025    const char *pszAppId,
     1026    const char *pszDescription,
     1027    bool bIsService)
    10221028{
    10231029    LSTATUS rc;
     
    10561062
    10571063    if (pState->fDelete)
     1064    {
    10581065        vbpsDeleteKeyRecursiveA(pState, hkeyAppIds, pszAppId, __LINE__);
    1059 
    1060     /*
    1061      * Update.
    1062      */
    1063     if (pState->fUpdate)
    1064         vbpsCreateRegKeyWithDefaultValueAA(pState, hkeyAppIds, pszAppId, pszDescription, __LINE__);
     1066        vbpsDeleteKeyRecursiveA(pState, hkeyAppIds, pszModuleName, __LINE__);
     1067    }
     1068
     1069        if (pState->fUpdate)
     1070        {
     1071            //HKEY hkeyApp;
     1072            HKEY hkeyServiceExe;
     1073   
     1074            vbpsCreateRegKeyWithDefaultValueAA(pState, hkeyAppIds, pszAppId, pszDescription, __LINE__);
     1075   
     1076            if (bIsService)
     1077            {
     1078                HKEY hkeyApp;
     1079
     1080                char szModule[MAX_PATH + 2];
     1081                size_t len = RTStrNLen(pszModuleName, MAX_PATH);
     1082                Assert(len);
     1083                Assert(len < MAX_PATH);
     1084                rc = RTStrCopy(szModule, sizeof(szModule), pszModuleName);
     1085                AssertRC(rc);
     1086                szModule[len - 4] = '\0';
     1087
     1088                rc = RegOpenKeyExA(hkeyAppIds, pszAppId, 0 /*fOptions*/, pState->fSamBoth, &hkeyApp);
     1089                if (rc == ERROR_FILE_NOT_FOUND)
     1090                    return ERROR_SUCCESS;
     1091                // create the value "Service" with the service name
     1092                vbpsSetRegValueAA(pState, hkeyApp, "LocalService", szModule, __LINE__);
     1093                vbpsCloseKey(pState, hkeyApp, __LINE__);
     1094            }
     1095   
     1096            vbpsCreateRegKeyWithDefaultValueAA(pState, hkeyAppIds, pszModuleName, "", __LINE__);
     1097            rc = RegOpenKeyExA(hkeyAppIds, pszModuleName, 0 /*fOptions*/, pState->fSamBoth, &hkeyServiceExe);
     1098            if (rc == ERROR_FILE_NOT_FOUND)
     1099                return ERROR_SUCCESS;
     1100            vbpsSetRegValueAA(pState, hkeyServiceExe, "AppID", pszAppId, __LINE__);
     1101            vbpsCloseKey(pState, hkeyServiceExe, __LINE__);
     1102        }
    10651103
    10661104    vbpsCloseKey(pState, hkeyAppIds, __LINE__);
     
    11631201    LSTATUS rc;
    11641202    char szClsId[CURLY_UUID_STR_BUF_SIZE];
     1203    bool fQuoteIt = false;
    11651204    RT_NOREF(pszAppId);
    11661205
     
    12041243                RTUTF16 wszModule[MAX_PATH * 2];
    12051244                PRTUTF16 pwszCur = wszModule;
    1206                 bool fQuoteIt = strcmp(pszServerType, "LocalServer32") == 0;
     1245                fQuoteIt = strcmp(pszServerType, "LocalServer32") == 0;
    12071246                if (fQuoteIt)
    12081247                    *pwszCur++ = '"';
     
    12481287            }
    12491288
     1289            /* AppID = pszAppId */
     1290            if(pszAppId && fQuoteIt)
     1291                vbpsSetRegValueAA(pState, hkeyClass, "AppID", pszAppId, __LINE__);
     1292
    12501293            vbpsCloseKey(pState, hkeyClass, __LINE__);
    12511294        }
     
    12551298}
    12561299
     1300
     1301#ifdef VBOX_WITH_SDS
     1302/**
     1303* Register VBoxSDS classes from the VirtualBox.xidl file.
     1304*
     1305* @returns COM status code.
     1306* @param   pState
     1307* @param   pwszVBoxDir         The VirtualBox application directory.
     1308*
     1309* @todo convert to XSLT.
     1310*/
     1311void RegisterVBoxSDSXidl(VBPSREGSTATE *pState, PCRTUTF16 pwszVBoxDir)
     1312{
     1313    const char *pszServiceAppId = "{EC0E78E8-FA43-43E8-AC0A-02C784C4A4FA}";
     1314    const char *pszWindowsService = "VBoxSDS.exe";
     1315
     1316    VbpsRegisterAppId(pState, pszWindowsService, pszServiceAppId, "VirtualBox System Service", true);
     1317
     1318    /* VBoxSDS */
     1319    VbpsRegisterClassName(pState, "VirtualBox.VirtualBoxSDS.1", "VirtualBoxSDS Class", &CLSID_VirtualBoxSDS, NULL);
     1320    VbpsRegisterClassName(pState, "VirtualBox.VirtualBoxSDS", "VirtualBoxSDS Class", &CLSID_VirtualBoxSDS, ".1");
     1321    VbpsRegisterClassId(pState, &CLSID_VirtualBoxSDS, "VirtualBoxSDS Class", pszServiceAppId, "VirtualBox.VirtualBoxSDS", ".1",
     1322        &LIBID_VirtualBox, "LocalServer32", pwszVBoxDir, pszWindowsService, NULL /*N/A*/);
     1323}
     1324#endif
    12571325
    12581326/**
     
    12681336void RegisterXidlModulesAndClassesGenerated(VBPSREGSTATE *pState, PCRTUTF16 pwszVBoxDir, bool fIs32On64)
    12691337{
    1270     const char *pszAppId = "{819B4D85-9CEE-493C-B6FC-64FFE759B3C9}";
     1338    const char *pszAppId        = "{819B4D85-9CEE-493C-B6FC-64FFE759B3C9}";
    12711339    const char *pszInprocDll = !fIs32On64 ? "VBoxC.dll" : "x86\\VBoxClient-x86.dll";
    1272 
    1273     VbpsRegisterAppId(pState, pszAppId, "VirtualBox Application");
     1340    const char *pszLocalServer      = "VBoxSVC.exe";
     1341       
     1342    VbpsRegisterAppId(pState, pszLocalServer, pszAppId, "VirtualBox Application", false);
    12741343
    12751344    /* VBoxSVC */
     
    12771346    VbpsRegisterClassName(pState, "VirtualBox.VirtualBox",   "VirtualBox Class", &CLSID_VirtualBox, ".1");
    12781347    VbpsRegisterClassId(pState, &CLSID_VirtualBox, "VirtualBox Class", pszAppId, "VirtualBox.VirtualBox", ".1",
    1279                         &LIBID_VirtualBox, "LocalServer32", pwszVBoxDir, "VBoxSVC.exe", NULL /*N/A*/);
     1348                        &LIBID_VirtualBox, "LocalServer32", pwszVBoxDir, pszLocalServer, NULL /*N/A*/);
    12801349    /* VBoxC */
    12811350    VbpsRegisterClassName(pState, "VirtualBox.Session.1", "Session Class", &CLSID_Session, NULL);
     
    12891358                        "VirtualBox.VirtualBoxClient", ".1",
    12901359                        &LIBID_VirtualBox, "InprocServer32", pwszVBoxDir, pszInprocDll, "Free");
     1360
     1361#ifdef VBOX_WITH_SDS
     1362    RegisterVBoxSDSXidl(pState, pwszVBoxDir);
     1363#endif
    12911364}
    12921365
  • trunk/src/VBox/Main/src-all/win/VirtualBox_rgs.xsl

    r62486 r66274  
    2929-->
    3030
     31<!-- Name of the application to generate the RGS script for -->
     32<xsl:param name="Application"/>
    3133<!-- Name of the module to generate the RGS script for -->
    3234<xsl:param name="Module"/>
     
    4244-->
    4345<xsl:template match="/idl">
    44 HKCR
    45 {
    46 <xsl:apply-templates/>
    47 }
     46  <xsl:apply-templates/>
    4847</xsl:template>
    4948
     
    5251 *  libraries
    5352-->
    54 <xsl:template match="idl/library">
     53<xsl:template match="library">
     54  <xsl:apply-templates/>
     55</xsl:template>
     56
     57
     58<!--
     59 *  applications
     60-->
     61<xsl:template match="application">
     62  <xsl:if test="@name=$Application">
     63    <xsl:variable name="context" select="//module[@name=$Module]/@context"/>
     64<xsl:text>HKCR
     65{
    5566  NoRemove AppID
    5667  {
    57     ForceRemove {<xsl:value-of select="@appUuid"/>} = s '<xsl:value-of select="@name"/> Application'
     68    ForceRemove {</xsl:text><xsl:value-of select="@uuid"/>} = s '<xsl:value-of select="@name"/><xsl:text> </xsl:text>
     69    <xsl:choose>
     70      <xsl:when test="$context='LocalService'">
     71        <xsl:text>Service</xsl:text>
     72      </xsl:when>
     73      <xsl:otherwise>
     74        <xsl:text>Application</xsl:text>
     75      </xsl:otherwise>
     76    </xsl:choose>
     77    <xsl:text>'
     78</xsl:text>
     79    <xsl:if test="$context='LocalService'">
     80      <xsl:text>    {
     81      val LocalService = s '</xsl:text><xsl:value-of select="$Module"/><xsl:text>'
     82    }
     83</xsl:text>
     84    </xsl:if>
     85    <xsl:text>    '</xsl:text><xsl:value-of select="$Module"/>
     86    <xsl:choose>
     87      <xsl:when test="$context='InprocServer'">
     88        <xsl:text>.dll</xsl:text>
     89      </xsl:when>
     90      <xsl:otherwise>
     91        <xsl:text>.exe</xsl:text>
     92      </xsl:otherwise>
     93    </xsl:choose>
     94    <xsl:text>'
     95    {
     96      val AppID = s '{</xsl:text><xsl:value-of select="//library/application[@name=$Application]/@uuid"/><xsl:text>}'
     97    }
    5898  }
    5999
    60 <xsl:apply-templates select="module[@name=$Module]/class"/>
     100</xsl:text>
     101    <xsl:apply-templates select="module[@name=$Module]/class"/>
     102<xsl:text>}
     103</xsl:text>
     104  </xsl:if>
    61105</xsl:template>
    62106
     
    66110-->
    67111<xsl:template match="library//module/class">
    68   <xsl:variable name="cname" select="concat(//library/@name,'.',@name)"/>
     112  <xsl:variable name="cname" select="concat(//library/application/@name,'.',@name)"/>
    69113  <xsl:variable name="desc" select="concat(@name,' Class')"/>
    70114  <xsl:text>  </xsl:text>
     
    82126    ForceRemove {<xsl:value-of select="@uuid"/>} = s '<xsl:value-of select="$desc"/>'
    83127    {
    84       ProgId = s '<xsl:value-of select="concat($cname,'.1')"/>'
    85       VersionIndependentProgID = s '<xsl:value-of select="$cname"/>'
    86       <xsl:choose>
    87         <xsl:when test="../@context='InprocServer'">InprocServer32</xsl:when>
    88         <xsl:when test="../@context='LocalServer'">LocalServer32</xsl:when>
    89         <xsl:otherwise>
    90           <xsl:message terminate="yes">
    91             <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
    92             <xsl:text>module context </xsl:text>
    93             <xsl:value-of select="concat('&quot;',../@context,'&quot;')"/>
    94             <xsl:text> is invalid!</xsl:text>
    95           </xsl:message>
    96         </xsl:otherwise>
    97       </xsl:choose> = s '%MODULE%'
    98       <xsl:if test="../@context='InprocServer'">
    99         <xsl:variable name="tmodel" select="(./@threadingModel | ../@threadingModel)[last()]"/>{
    100         val ThreadingModel = s '<xsl:choose>
    101           <xsl:when test="$tmodel='Apartment'">Apartment</xsl:when>
    102           <xsl:when test="$tmodel='Free'">Free</xsl:when>
    103           <xsl:when test="$tmodel='Both'">Both</xsl:when>
    104           <xsl:when test="$tmodel='Neutral'">Neutral</xsl:when>
    105           <xsl:when test="$tmodel='Single'">Single</xsl:when>
    106           <xsl:when test="$tmodel='Rental'">Rental</xsl:when>
     128      val AppID = s '{<xsl:value-of select="//library/application[@name=$Application]/@uuid"/><xsl:text>}'
     129</xsl:text>
     130      <xsl:if test="../@context!='LocalService'">
     131        <xsl:text>      ProgID = s '</xsl:text><xsl:value-of select="concat($cname,'.1')"/><xsl:text>'
     132      VersionIndependentProgID = s '</xsl:text><xsl:value-of select="$cname"/><xsl:text>'
     133      </xsl:text>
     134        <xsl:choose>
     135          <xsl:when test="../@context='InprocServer'">InprocServer32</xsl:when>
     136          <xsl:when test="../@context='LocalServer'">LocalServer32</xsl:when>
    107137          <xsl:otherwise>
    108138            <xsl:message terminate="yes">
    109               <xsl:value-of select="concat(../../@name,'::',@name,': ')"/>
    110               <xsl:text>class (or module) threading model </xsl:text>
    111               <xsl:value-of select="concat('&quot;',$tmodel,'&quot;')"/>
     139              <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
     140              <xsl:text>module context </xsl:text>
     141              <xsl:value-of select="concat('&quot;',../@context,'&quot;')"/>
    112142              <xsl:text> is invalid!</xsl:text>
    113143            </xsl:message>
    114144          </xsl:otherwise>
    115         </xsl:choose>'
     145        </xsl:choose><xsl:text> = s '%MODULE%'
     146</xsl:text>
     147        <xsl:if test="../@context='InprocServer'">
     148          <xsl:variable name="tmodel" select="(./@threadingModel | ../@threadingModel)[last()]"/><xsl:text>      {
     149        val ThreadingModel = s '</xsl:text>
     150          <xsl:choose>
     151            <xsl:when test="$tmodel='Apartment'">Apartment</xsl:when>
     152            <xsl:when test="$tmodel='Free'">Free</xsl:when>
     153            <xsl:when test="$tmodel='Both'">Both</xsl:when>
     154            <xsl:when test="$tmodel='Neutral'">Neutral</xsl:when>
     155            <xsl:when test="$tmodel='Single'">Single</xsl:when>
     156            <xsl:when test="$tmodel='Rental'">Rental</xsl:when>
     157            <xsl:otherwise>
     158              <xsl:message terminate="yes">
     159                <xsl:value-of select="concat(../../@name,'::',@name,': ')"/>
     160                <xsl:text>class (or module) threading model </xsl:text>
     161                <xsl:value-of select="concat('&quot;',$tmodel,'&quot;')"/>
     162                <xsl:text> is invalid!</xsl:text>
     163              </xsl:message>
     164            </xsl:otherwise>
     165          </xsl:choose><xsl:text>'
    116166      }
     167</xsl:text>
     168        </xsl:if>
     169        <xsl:text>      TypeLib = s '{</xsl:text><xsl:value-of select="//library/@uuid"/><xsl:text>}'
     170</xsl:text>
    117171      </xsl:if>
    118       val AppId = s '{<xsl:value-of select="//library/@appUuid"/>}'
    119       'TypeLib' = s '{<xsl:value-of select="//library/@uuid"/>}'
    120     }
     172      <xsl:text>    }
    121173  }
    122 
     174</xsl:text>
    123175</xsl:template>
    124176
  • trunk/src/VBox/Main/src-all/win/comregister.cmd

    r59385 r66274  
    163163@if %fUninstallOnly% == 1 goto end
    164164"%_VBOX_DIR%VBoxSVC.exe" /RegServer
     165"%_VBOX_DIR%VBoxSDS.exe" /RegService
    165166regsvr32 /s    "%_VBOX_DIR%VBoxC.dll"
    166167@if %fNoProxy% == 1 goto end
     
    183184@echo on
    184185"%_VBOX_DIR%VBoxSVC.exe" /UnregServer
     186"%_VBOX_DIR%VBoxSDS.exe" /UnregService
    185187%windir%\system32\regsvr32 /s /u "%_VBOX_DIR%VBoxC.dll"
    186188%windir%\syswow64\regsvr32 /s /u "%_VBOX_DIR%x86\VBoxClient-x86.dll"
     
    189191if %fUninstallOnly% == 1 goto end
    190192"%_VBOX_DIR%VBoxSVC.exe" /RegServer
     193"%_VBOX_DIR%VBoxSDS.exe" /RegService
    191194%windir%\system32\regsvr32 /s    "%_VBOX_DIR%VBoxC.dll"
    192195%windir%\syswow64\regsvr32 /s    "%_VBOX_DIR%x86\VBoxClient-x86.dll"
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