VirtualBox

Changeset 101763 in vbox


Ignore:
Timestamp:
Nov 3, 2023 6:24:30 PM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159859
Message:

doc/SDKRef: A handful of edits to improve the clarity and readability of
the VBox Programming Guide and Reference (aka SDK). The changes cover a
few misspellings, some grammatical mistakes, some missing prepositions
or definite articles, and some gratuitous commas. There was also some
modernizing here and there such as updating some hard-coded references
such as VBoxCAPI_v4_3.h to instead use
VBoxCAPI_v&VBOX_VERSION_MAJOR;_&VBOX_VERSION_MINOR;.h which will map to
the version of VBox delivered with the SDK and also removing some
outdated statements like the one stating 'Live Migration' and 'Resource
Monitor' are still in development and targeting a future version of
VirtualBox.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/SDKRef.xml

    r101041 r101763  
    7272      <para>At the bottom of the stack resides the hypervisor -- the core of
    7373      the virtualization engine, controlling execution of the virtual machines
    74       and making sure they do not conflict with each other or whatever the
    75       host computer is doing otherwise.</para>
     74      and making sure they do not conflict with each other or with whatever else
     75      the host computer is doing.</para>
    7676
    7777      <para>On top of the hypervisor, additional internal modules provide
    7878      extra functionality. For example, the RDP server, which can deliver the
    7979      graphical output of a VM remotely to an RDP client, is a separate module
    80       that is only loosely tacked into the virtual graphics device. Live
    81       Migration and Resource Monitor are additional modules currently in the
    82       process of being added to VirtualBox.</para>
     80      that is only loosely tacked onto the virtual graphics device.</para>
    8381
    8482      <para>What is primarily of interest for purposes of the SDK is the API
     
    170168            software components originally introduced by Microsoft for
    171169            Microsoft Windows. On a Windows host, VirtualBox will use
    172             Microsoft COM; on other hosts where COM is not present, it ships
    173             with XPCOM, a free software implementation of COM originally
     170            Microsoft COM; on other hosts where COM is not present, VirtualBox
     171            ships with XPCOM, a free software implementation of COM originally
    174172            created by the Mozilla project for their browsers.</para>
    175173
    176             <para>So, if you are familiar with COM and the C++ programming
     174            <para>So if you are familiar with COM and the C++ programming
    177175            language (or with any other programming language that can handle
    178176            COM/XPCOM objects, such as Java, Visual Basic or C#), then you can
    179             use the COM/XPCOM API directly. VirtualBox comes with all
     177            use the COM/XPCOM API directly. VirtualBox comes with all the
    180178            necessary files and documentation to build fully functional COM
    181179            applications. For an introduction, please see <xref
     
    190188        </orderedlist></para>
    191189
    192       <para>If you wonder which way to choose, here are a few
     190      <para>If you are wondering which approach to choose, here are a few
    193191      comparisons:<table>
    194192          <title>Comparison web service vs. COM/XPCOM</title>
     
    235233      <para>In the following chapters, we will describe the different ways in
    236234      which to program VirtualBox, starting with the method that is easiest to
    237       use and then increase complexity as we go along.</para>
     235      use and then increasing in complexity as we go along.</para>
    238236    </sect1>
    239237
     
    270268      <para>In order to successfully use a web service, a number of things are
    271269      required -- primarily, a web service accepting connections; service
    272       descriptions; and then a client that connects to that web service. The
    273       connections are governed by the SOAP standard, which describes how
    274       messages are to be exchanged between a service and its clients; the
    275       service descriptions are governed by WSDL.</para>
     270      descriptions; and a client that connects to that web service. Connections
     271      to the VirtualBox web service are governed by the SOAP standard, which
     272      describes how messages are to be exchanged between a service and its
     273      clients; the service descriptions are governed by WSDL.</para>
    276274
    277275      <para>In the case of VirtualBox, this translates into the following
     
    280278            <para>The VirtualBox web service (the "server"): this is the
    281279            <computeroutput>vboxwebsrv</computeroutput> executable shipped
    282             with VirtualBox. Once you start this executable (which acts as a
     280            with VirtualBox. Once you start this executable (which acts as an
    283281            HTTP server on a specific TCP/IP port), clients can connect to the
    284282            web service and thus control a VirtualBox installation.</para>
     
    293291            easily access a web service even if you don't use our
    294292            object-oriented client layers. VirtualBox is shipped with
    295             pregenerated web service glue code for several languages (Python,
     293            pre-generated web service glue code for several languages (Python,
    296294            Perl, Java).</para>
    297295          </listitem>
     
    301299            control the VirtualBox installation.</para>
    302300
    303             <para>Unless you play with some of the samples shipped with
     301            <para>Unless you use some of the samples shipped with
    304302            VirtualBox, this needs to be written by you.</para>
    305303          </listitem>
     
    310308      <title>Running the web service</title>
    311309
    312       <para>The web service ships in an stand-alone executable,
     310      <para>The web service ships in a stand-alone executable,
    313311      <computeroutput>vboxwebsrv</computeroutput>, that, when running, acts as
    314       a HTTP server, accepts SOAP connections and processes them -- remotely
    315       or from the same machine.<note>
    316           <para>The web service executable is not contained with the
     312      an HTTP server, accepts SOAP connections, remotely or from the same machine,
     313      and processes them.<note>
     314          <para>The web service executable is not delivered with the
    317315          VirtualBox SDK, but instead ships with the standard VirtualBox
    318           binary package for your specific platform. Since the SDK contains
    319           only platform-independent text files and documentation, the binaries
    320           are instead shipped with the platform-specific packages. For this
    321           reason the information how to run it as a service is included in the
    322           VirtualBox documentation.</para>
     316          binary package for your specific platform. The SDK contains only
     317          platform-independent text files and documentation so thus the vboxwebsrv
     318          binary is shipped with the platform-specific packages.  Therefore the
     319          information on how to run vboxwebsrv as a service is included in the
     320          VirtualBox documentation and not the SDK.</para>
    323321        </note></para>
    324322
     
    542540
    543541        <para>For testing purposes, it is recommended that you first disable
    544         authentication with this command:
     542        authentication with the command:
    545543        <screen>VBoxManage setproperty websrvauthlibrary null</screen></para>
    546544
     
    565563        <para>By default, after installation, the web service uses the
    566564        VBoxAuth module that ships with VirtualBox. This module uses PAM on
    567         Linux hosts to authenticate users. Any valid username/password
    568         combination is accepted, it does not have to be the username and
    569         password of the user running the web service daemon. Unless
    570         <computeroutput>vboxwebsrv</computeroutput> runs as root, PAM
    571         authentication can fail, because sometimes the file
    572         <computeroutput>/etc/shadow</computeroutput>, which is used by PAM, is
    573         not readable. On most Linux distribution PAM uses a suid root helper
    574         internally, so make sure you test this before deploying it. One can
    575         override this behavior by setting the environment variable
    576         <computeroutput>VBOX_PAM_ALLOW_INACTIVE</computeroutput> which will
    577         suppress failures when unable to read the shadow password file. Please
    578         use this variable carefully, and only if you fully understand what
     565        FreeBSD, Linux, and Solaris hosts to authenticate users. Any valid
     566        username/password combination is accepted, it does not have to be the
     567        username and password of the user running the web service daemon. If
     568        <computeroutput>vboxwebsrv</computeroutput> doesn't run as root PAM
     569        authentication can fail, because the
     570        <computeroutput>/etc/shadow</computeroutput> file, which is used by PAM,
     571        is only readable by root. On most Linux distributions PAM uses a suid
     572        root helper internally, so make sure you test this before deploying it.
     573        One can override authentication failures due to lack of read privileges
     574        of the shadow password file by setting the environment variable
     575        <computeroutput>VBOX_PAM_ALLOW_INACTIVE</computeroutput>.
     576        Please use this variable carefully and only if you fully understand what
    579577        you're doing.</para>
    580578      </sect2>
     
    814812        installation (VirtualBox ships the most important ones for each
    815813        platform<footnote>
    816             <para>On On Mac OS X only the Python versions bundled with the OS
    817             are officially supported. This means 2.6 and 2.7 for 10.9 and later.</para>
     814            <para>On Mac OS X only the Python versions bundled with the OS
     815            are officially supported.</para>
    818816          </footnote>). On Windows, you can use the Main API from Python if the
    819817          Win32 extensions package for Python<footnote>
     
    829827        url="http://pywebsvcs.sourceforge.net/zsi.html">http://pywebsvcs.sourceforge.net/zsi.html</ulink>),
    830828        which you will need to install locally before trying the examples.
    831         Most Linux distributions come with package for ZSI, such as
     829        Most Linux distributions come with a package for ZSI, such as
    832830        <computeroutput>python-zsi</computeroutput> in Ubuntu.</para>
    833831
    834832        <para>To get started, open a terminal and change to the
    835         <computeroutput>bindings/glue/python/sample</computeroutput>
     833        <computeroutput>sdk/bindings/glue/python/sample</computeroutput>
    836834        directory, which contains an example of a simple interactive shell
    837835        able to control a VirtualBox instance. The shell is written using the
    838836        API layer, thereby hiding different implementation details, so it is
    839         actually an example of code share among XPCOM, MSCOM and web services.
     837        actually an example of code shared among XPCOM, MSCOM and web services.
    840838        If you are interested in how to interact with the web services layer
    841839        directly, have a look at
     
    844842        and web services).</para>
    845843
    846         <para>To start the shell, perform the following commands:
    847         <screen>/opt/VirtualBox/vboxwebsrv -t 0
    848             # start web service with object autocollection disabled
    849 export VBOX_PROGRAM_PATH=/opt/VirtualBox
    850             # your VirtualBox installation directory
    851 export VBOX_SDK_PATH=/home/youruser/vbox-sdk
    852             # where you've extracted the SDK
     844        <para>To start the shell, run the following commands:
     845        <screen>/opt/VirtualBox/vboxwebsrv -t 0 # start web service with object autocollection disabled
     846export VBOX_PROGRAM_PATH=/opt/VirtualBox        # your VirtualBox installation directory
     847export VBOX_SDK_PATH=/home/youruser/vbox-sdk    # where you've extracted the SDK
    853848./vboxshell.py -w        </screen>
    854849        See <xref linkend="vboxshell"/> for more
     
    883878      previous chapter.</para>
    884879
    885       <para>Generally, when reading the documentation in <xref
    886       linkend="sdkref_classes"/> and <xref linkend="sdkref_enums"/>, due to
    887       the limitations of SOAP and WSDL lined out in <xref
    888       linkend="rawws-conventions"/>, please have the following notes in
    889       mind:</para>
     880      <para>Due to the limitations of SOAP and WSDL outlined in
     881      <xref linkend="rawws-conventions"/>, keep the following notes in
     882      mind when reading the documentation in <xref linkend="sdkref_classes"/>
     883      and <xref linkend="sdkref_enums"/>:</para>
    890884
    891885      <para><orderedlist>
     
    937931        foundation. If your distribution does not have it installed, you can
    938932        get a binary from <ulink
    939         url="http://www.apache.org">http://www.apache.org</ulink>. The
     933        url="http://axis.apache.org">http://axis.apache.org</ulink>. The
    940934        following examples assume that you have Axis 1.4 installed.</para>
    941935
    942936        <para>The VirtualBox SDK ships with an example for Axis that, again,
    943937        is called <computeroutput>clienttest.java</computeroutput> and that
    944         imitates a few of the commands of
    945         <computeroutput>VBoxManage</computeroutput> over the wire.</para>
    946 
    947         <para>Then perform the following steps:<orderedlist>
     938        imitates a few <computeroutput>VBoxManage</computeroutput> commands
     939        and sends them to the VirtualBox web service.</para>
     940
     941        <para>To try out the raw web service with Axis complete the following
     942        steps:<orderedlist>
    948943            <listitem>
    949944              <para>Create a working directory somewhere. Under your
     
    10371032        communicating with the web service from Perl. You can generate such a
    10381033        module yourself using the "stubmaker" tool that comes with SOAP::Lite,
    1039         but since that tool is slow as well as sometimes unreliable, we are
    1040         shipping a working module with the SDK for your convenience.</para>
     1034        but since that tool is slow as well as sometimes unreliable, we ship a
     1035        working module with the SDK for your convenience.</para>
    10411036
    10421037        <para>Perform the following steps:<orderedlist>
     
    10891084          <title>Fundamental conventions</title>
    10901085
    1091           <para>If you are familiar with other web services, you may find the
    1092           VirtualBox web service to behave a bit differently to accommodate
    1093           for the fact that VirtualBox web service more or less maps the
    1094           VirtualBox Main COM API. The following main differences had to be
    1095           taken care of:<itemizedlist>
     1086          <para>If you are familiar with other web services, you may find that the
     1087          VirtualBox web service behaves a bit differently to accommodate
     1088          for the fact that the VirtualBox web service more or less maps the
     1089          VirtualBox Main COM API. The primary challenges in mapping the VirtualBox
     1090          Main COM API to the web service are as follows:<itemizedlist>
    10961091              <listitem>
    10971092                <para>Web services, as expressed by WSDL, are not
     
    11211116                there are only functions ("operations") in WSDL, but no
    11221117                classes, interfaces, or methods.</para>
    1123 
    1124                 <para>In addition, all calls to the VirtualBox web service
    1125                 (except for logon, see below) take a <emphasis
    1126                 role="bold">managed object reference</emphasis> as the first
    1127                 argument, representing the object upon which the underlying
    1128                 method is invoked. (Managed object references are explained in
    1129                 detail below; see <xref
    1130                 linkend="managed-object-references"/>.)</para>
     1118              </listitem>
     1119
     1120              <listitem>
     1121                <para>All calls to the VirtualBox web service (except for logon, see
     1122                below) take a <emphasis role="bold">managed object reference</emphasis>
     1123                as the first argument, representing the object upon which the underlying
     1124                method is invoked. (Managed object references are explained in detail
     1125                below; see <xref linkend="managed-object-references"/>.)</para>
    11311126
    11321127                <para>So, when one would normally code, in the pseudo-code of
     
    12091204
    12101205              <listitem>
    1211                 <para>The VirtualBox Main API documentation says that the
     1206                <para>The VirtualBox Main API documentation explains that the
    12121207                <computeroutput>IVirtualBox</computeroutput> interface has a
    12131208                <link linkend="IVirtualBox__version">version</link>
    12141209                attribute, which is a string. For each attribute, there is a
    1215                 "get" and a "set" method in COM, which maps to according
     1210                "get" and a "set" method in COM, which maps to the corresponding
    12161211                operations in the web service. So, to retrieve the "version"
    12171212                attribute of this <computeroutput>IVirtualBox</computeroutput>
     
    13621357            <para><orderedlist>
    13631358                <listitem>
    1364                   <para>prepare a connection to a web service running on port
    1365                   18083 of "localhost";</para>
     1359                  <para>Prepare a connection to the web service running on port
     1360                  18083 of "localhost".</para>
    13661361                </listitem>
    13671362
    13681363                <listitem>
    1369                   <para>for the <computeroutput>SayHello()</computeroutput>
    1370                   function of the web service, generate a SOAP message like in
    1371                   the above example by encoding all arguments of the remote
    1372                   procedure call (which could involve all kinds of type
    1373                   conversions and complex marshalling for arrays and
    1374                   structures);</para>
     1364                    <para>Generate a SOAP message similar to the above example for the
     1365                    <computeroutput>SayHello()</computeroutput> function of the web service
     1366                    by encoding all arguments of the remote procedure call (which could
     1367                    involve all kinds of type conversions and complex marshalling for arrays
     1368                    and structures).</para>
    13751369                </listitem>
    13761370
    13771371                <listitem>
    1378                   <para>connect to the web service via HTTP and send that
    1379                   message;</para>
     1372                  <para>Connect to the web service via HTTP and then send that
     1373                  message.</para>
    13801374                </listitem>
    13811375
    13821376                <listitem>
    1383                   <para>wait for the web service to send a response
    1384                   message;</para>
     1377                  <para>Wait for the web service to send a response message.</para>
    13851378                </listitem>
    13861379
    13871380                <listitem>
    1388                   <para>decode that response message and put the return value
     1381                  <para>Decode that response message and put the return value
    13891382                  of the remote procedure into the "result" variable.</para>
    13901383                </listitem>
     
    13951388            <title>Service descriptions in WSDL</title>
    13961389
    1397             <para>In the above explanations about SOAP, it was left open how
     1390            <para>In the above explanations about SOAP, it wasn't explained how
    13981391            the programming language learns about how to translate function
    13991392            calls in its own syntax into proper SOAP messages. In other words,
     
    14041397            a web service operation expects a number in "double" floating
    14051398            point format for a particular parameter, the programming language
    1406             cannot send to it a string instead.</para>
     1399            cannot send it a string instead.</para>
    14071400
    14081401            <para>For this, the Web Service Definition Language (WSDL) was
     
    14171410            services, this typically means that a programming language has
    14181411            support for parsing WSDL files and somehow integrating the remote
    1419             procedure calls into the native language syntax -- for example,
    1420             like in the Java sample shown in <xref
     1412            procedure calls into the native language syntax -- for example, as
     1413            shown in the Java sample in <xref
    14211414            linkend="webservice-java-sample"/>.</para>
    14221415
    14231416            <para>For details about how programming languages support web
    14241417            services, please refer to the documentation that comes with the
    1425             individual languages. Here are a few pointers:</para>
     1418            individual language. Here are a few pointers:</para>
    14261419
    14271420            <orderedlist>
     
    14761469      <para>COM has several advantages: it is language-neutral, meaning that
    14771470      even though all of VirtualBox is internally written in C++, programs
    1478       written in other languages could communicate with it. COM also cleanly
    1479       separates interface from implementation, so that external programs need
    1480       not know anything about the messy and complicated details of VirtualBox
    1481       internals.</para>
     1471      written in other languages can communicate with it. COM also cleanly
     1472      separates interface from implementation, so that external programs do
     1473      not need to know anything about the messy and complicated details of
     1474      VirtualBox internals.</para>
    14821475
    14831476      <para>On a Windows host, all parts of VirtualBox will use the COM
     
    14941487
    14951488        <para>On Windows, Python scripts can use COM and VirtualBox interfaces
    1496         to control almost all aspects of virtual machine execution. As an
    1497         example, use the following commands to instantiate the VirtualBox
    1498         object and start a VM: <screen>
     1489        to control almost all aspects of virtual machine execution. For example,
     1490        you can use the following commands to instantiate the VirtualBox object
     1491        and start a VM: <screen>
    14991492       vbox = win32com.client.Dispatch("VirtualBox.VirtualBox")
    15001493       session = win32com.client.Dispatch("VirtualBox.Session")
     
    15031496       progress.waitForCompletion(-1)
    15041497      </screen> Also, see
    1505         <computeroutput>/bindings/glue/python/samples/vboxshell.py</computeroutput>
     1498        <computeroutput>sdk/bindings/glue/python/samples/vboxshell.py</computeroutput>
    15061499        for more advanced usage scenarious. However, unless you have specific
    1507         requirements, we strongly recommend to use the generic glue layer
     1500        requirements, we strongly recommend that you use the generic glue layer
    15081501        described in the next section to access MS COM objects.</para>
    15091502      </sect2>
     
    15141507        <para>As different wrappers ultimately provide access to the same
    15151508        underlying API, and to simplify porting and development of Python
    1516         application using the VirtualBox Main API, we developed a common glue
     1509        applications using the VirtualBox Main API, we developed a common glue
    15171510        layer that abstracts out most platform-specific details from the
    15181511        application and allows the developer to focus on application logic.
     
    15551548        other platforms). The second argument defines parameters, passed to
    15561549        the platform-specific module, as we do in the second example, where we
    1557         pass username and password to be used to authenticate against the web
     1550        pass a username and password to be used to authenticate against the web
    15581551        service.</para>
    15591552
     
    15741567        </screen>
    15751568        <para>
    1576           Following code will print all registered machines and their log
    1577           folders
     1569          The following code will print all registered machines and their log
     1570          folders:
    15781571        </para>
    15791572        <screen>from vboxapi import VirtualBoxManager
     
    15851578        </screen>
    15861579
    1587         <para>Code above demonstrates cross-platform access to array properties
    1588         (certain limitations prevent one from using
     1580        <para>The code above demonstrates cross-platform access to array
     1581        properties (certain limitations prevent one from using
    15891582        <computeroutput>vbox.machines</computeroutput> to access a list of
    1590         available virtual machines in case of XPCOM), and a mechanism of
    1591         uniform session creation and closing
     1583        available virtual machines in the case of XPCOM), and a mechanism for
     1584        uniform session creation and closure
    15921585        (<computeroutput>mgr.getSessionObject()</computeroutput>).</para>
    15931586
     
    15951588          <title>Manual or subsequent setup</title>
    15961589
    1597           <para>In case you want to use the glue layer with a different Python
    1598             installation or the installer failed to set it up, use these steps
     1590          <para>If you want to use the glue layer with a different Python
     1591            installation or the installer failed to set it up, then use these steps
    15991592            in a shell to install the necessary files:</para>
    16001593
    16011594        <screen>    # cd VBOX_INSTALL_PATH/sdk/installer
    1602     # PYTHON vboxapisetup.py install</screen>
     1595    # python vboxapisetup.py install</screen>
    16031596
    16041597           <note> <para>On Windows hosts, a Python distribution along with the
     
    16191612        use the Main API to implement a number of tasks on your host platform.
    16201613        These samples can be found in the
    1621         <computeroutput>/bindings/xpcom/samples</computeroutput> directory for
     1614        <computeroutput>sdk/bindings/xpcom/samples</computeroutput> directory for
    16221615        Linux, Mac OS X and Solaris and
    1623         <computeroutput>/bindings/mscom/samples</computeroutput> for Windows.
     1616        <computeroutput>sdk/bindings/mscom/samples</computeroutput> for Windows.
    16241617        The two samples are actually different, because the one for Windows
    16251618        uses native COM, whereas the other uses our XPCOM implementation, as
     
    17031696        <title>Event queue processing</title>
    17041697
    1705         <para>Both VirtualBox client programs and frontends should
     1698        <para>Both VirtualBox client programs and front-ends should
    17061699        periodically perform processing of the main event queue, and do that
    1707         on the application's main thread. In case of a typical GUI Windows/Mac
    1708         OS application this happens automatically in the GUI's dispatch loop.
    1709         However, for CLI only application, the appropriate actions have to be
    1710         taken. For C++ applications, the VirtualBox SDK provided glue method
     1700        on the application's main thread. In the case of a typical GUI
     1701        Windows/Mac OS application this happens automatically in the GUI's
     1702        dispatch loop. However, for CLI only application, the appropriate actions
     1703        have to be taken. For C++ applications, the VirtualBox SDK provided glue
     1704        method
    17111705        <screen>
    17121706            int EventQueue::processEventQueue(uint32_t cMsTimeout)
     
    17191713        application using VirtualBox cannot directly control the main event
    17201714        loop and the main event queue is separated from the event queue of the
    1721         programming librarly (for example in case of Qt on Unix platforms). In
     1715        programming library (for example in case of Qt on Unix platforms). In
    17221716        such a case, the application developer is advised to use a
    17231717        platform/toolkit specific event injection mechanism to force event
    1724         queue checks either based on periodical timer events delivered to the
     1718        queue checks either based on periodic timer events delivered to the
    17251719        main thread, or by using custom platform messages to notify the main
    1726         thread when events are available. See the VBoxSDL and Qt (VirtualBox)
    1727         frontends as examples.</para>
     1720        thread when events are available. See the Qt (VirtualBox) front-end as
     1721        an example.</para>
    17281722      </sect2>
    17291723
     
    17441738          </footnote></para>
    17451739
    1746         <para>VBS is scripting language available in any recent Windows
    1747         environment. As an example, the following VBS code will print
     1740        <para>VBS is a scripting language available in any recent Windows
     1741        environment. As an example, the following VBS code will print the
    17481742        VirtualBox version: <screen>
    17491743         set vb = CreateObject("VirtualBox.VirtualBox")
    17501744         Wscript.Echo "VirtualBox version " &amp; vb.version
    17511745       </screen> See
    1752         <computeroutput>bindings/mscom/vbs/sample/vboxinfo.vbs</computeroutput>
     1746        <computeroutput>sdk/bindings/mscom/vbs/sample/vboxinfo.vbs</computeroutput>
    17531747        for the complete sample.</para>
    17541748
     
    17641758         Next
    17651759       </screen> See
    1766         <computeroutput>bindings/mscom/vb/sample/vboxinfo.vb</computeroutput>
     1760        <computeroutput>sdk/bindings/mscom/vb/sample/vboxinfo.vb</computeroutput>
    17671761        for the complete sample.</para>
    17681762      </sect2>
    17691763
    17701764      <sect2 id="cbinding">
    1771         <title>C binding to VirtualBox API</title>
    1772 
    1773         <para>The VirtualBox API originally is designed as object oriented,
    1774         using XPCOM or COM as the middleware, which translates natively to C++.
    1775         This means that in order to use it from C there needs to be some
    1776         helper code to bridge the language differences and reduce the
    1777         differences between platforms.</para>
     1765        <title>C bindings to the VirtualBox API</title>
     1766
     1767        <para>The VirtualBox API was originally designed to be object oriented
     1768        and leverages XPCOM or COM as the middleware to natively map the API to
     1769        C++.  This means that in order to use the VirtualBox API from C there
     1770        needs to be some helper code to bridge the language differences and
     1771        reduce the differences between platforms.</para>
    17781772
    17791773        <sect3 id="capi_glue">
    1780           <title>Cross-platform C binding to VirtualBox API</title>
    1781 
    1782             <para>Starting with version 4.3, VirtualBox offers a C binding
     1774          <title>Cross-platform C bindings to the VirtualBox API</title>
     1775
     1776            <para>Starting with version 4.3, VirtualBox offers C bindings
    17831777            which allows using the same C client sources for all platforms,
    17841778            covering Windows, Linux, Mac OS X and Solaris. It is the
     
    18001794          directory <computeroutput>sdk/bindings/c/samples</computeroutput>
    18011795          which demonstrates
    1802           using the C binding to initialize the API, get handles for
     1796          using the C bindings to initialize the API, get handles for
    18031797          VirtualBox and Session objects, make calls to list and start virtual
    18041798          machines, monitor events, and uninitialize resources when done. The
     
    18251819
    18261820          <para>The following sections document the important concepts needed
    1827           to correctly use the C binding, as it is vital for developing API
     1821          to correctly use the C bindings, as it is vital for developing API
    18281822          client code which manages memory correctly, updates the reference
    1829           counters correctly, avoiding crashes and memory leaks. Often API
     1823          counters correctly, and avoids crashes and memory leaks. Often API
    18301824          clients need to handle events, so the C API specifics are also
    18311825          described below.</para>
     
    18371831          <para>Just like in C++, the API and the underlying middleware needs
    18381832          to be initialized before it can be used. The
    1839           <computeroutput>VBoxCAPI_v4_3.h</computeroutput> header provides the
    1840           interface to the C binding, but you can alternatively and more
    1841           conveniently also include
     1833          <computeroutput>VBoxCAPI_v&VBOX_VERSION_MAJOR;_&VBOX_VERSION_MINOR;.h</computeroutput>
     1834          header file provides the interface to the C bindings, but you can
     1835          alternatively and more conveniently just include
    18421836          <computeroutput>VBoxCAPIGlue.h</computeroutput>,
    18431837          as this avoids the VirtualBox version dependent header file name and
    1844           makes sure the global variable <code>g_pVBoxFuncs</code> contains a
     1838          makes sure that the global variable <code>g_pVBoxFuncs</code> contains a
    18451839          pointer to the structure which contains the helper function pointers.
    18461840          Here's how to initialize the C API:<screen>#include "VBoxCAPIGlue.h"
    18471841...
    18481842IVirtualBoxClient *vboxclient   = NULL;
    1849 IVirtualBox *vbox               = NULL;
    1850 ISession *session               = NULL;
    1851 HRESULT rc;
    1852 ULONG revision;
    18531843
    18541844/*
     
    18931883          <code>g_pVBoxFuncs->pfnClientThreadUninitialize()</code>. You don't
    18941884          have to use these functions in worker threads created by COM/XPCOM
    1895           (which you might observe if your code uses active event handling),
    1896           everything is initialized correctly already. On Windows the C
     1885          (which you might utilize if your code uses active event handling),
     1886          since everything is initialized correctly already. On Windows the C
    18971887          bindings create a marshaller which supports a wide range of COM
    1898           threading models, from STA to MTA, so you don't have to worry about
     1888          threading models, from Single-Threaded Apartments (STA) to
     1889          Multithreaded Apartments (MTA), so you don't have to worry about
    18991890          these details unless you plan to use active event handlers. See
    1900           the sample code how to get this to work reliably (in other words
     1891          the sample code for how to get this to work reliably (in other words
    19011892          think twice if passive event handling isn't the better solution after
    19021893          you looked at the sample code).</para>
     
    19061897          <title>C API attribute and method invocation</title>
    19071898
    1908           <para>Method invocation is straightforward. It looks pretty much
    1909           like the C++ way, by using a macro which internally accesses the
    1910           vtable, and additionally needs to be passed a pointer to the objecti
    1911           as the first argument to serve as the
     1899          <para>Method invocation is straightforward. It looks very similar
     1900          to the C++ mechanism since it also uses a macro which internally
     1901          accesses the vtable and additionally needs to be passed a pointer to the
     1902          object as the first argument to serve as the
    19121903          <computeroutput>this</computeroutput> pointer.</para>
    19131904
    1914           <para>Using the C binding, all method invocations return a numeric
     1905          <para>Using the C bindings all method invocations return a numeric
    19151906          result code of type <code>HRESULT</code> (with a few exceptions
    19161907          which normally are not relevant).</para>
     
    19321923          <link linkend="IVirtualBox__revision">IVirtualBox::revision</link>
    19331924          attribute:
    1934           <screen>rc = IVirtualBoxClient_get_VirtualBox(vboxclient, &amp;vbox);
     1925          <screen>
     1926IVirtualBox *vbox               = NULL;
     1927ISession *session               = NULL;
     1928HRESULT rc;
     1929ULONG revision;
     1930
     1931rc = IVirtualBoxClient_get_VirtualBox(vboxclient, &amp;vbox);
     1932
    19351933if (FAILED(rc) || !vbox)
    19361934{
     
    19511949}</screen></para>
    19521950
    1953           <para>The convenience macros for calling a method are named by
    1954           prepending the method name with the interface name (using
    1955           <code>_</code>as the separator).</para>
     1951          <para>The convenience macros for calling a method are named by prepending
     1952          the method name with the interface name (using <code>_</code> as the
     1953          separator).</para>
    19561954
    19571955          <para>So far only attribute getters were illustrated, but generic
     
    20672065free(machines);</screen></para>
    20682066
    2069           <para>Handling output parameters needs more special effort than
    2070           input parameters, thus only for the former there are special helpers,
    2071           and the latter is handled through the generic array support.</para>
     2067          <para>Handling output parameters needs more special handling than
     2068          input parameters, thus only for the former are there special helpers
     2069          while the latter is handled through the generic array support.</para>
    20722070        </sect3>
    20732071
     
    20842082          triggering the necessary handlers explicitly in the API client code.
    20852083          Both approaches depend on an event loop to make sure that events
    2086           get delivered in a timely manner, with differences what exactly needs
    2087           to be done.</para>
     2084          get delivered in a timely manner but otherwise differ in what
     2085          else is required to implement the respective event handler type.</para>
    20882086
    20892087          <para>The C API sample contains code for both event handling styles,
    20902088          and one has to modify the appropriate <code>#define</code> to select
    20912089          which style is actually used by the compiled program. It allows a
    2092           good comparison between the two variants, and the code sequences are
     2090          good comparison between the two variants and the code sequences are
    20932091          probably worth reusing without much change in other API clients
    20942092          with only minor adaptions.</para>
     
    21012099          it has to implement a complete API interface. Especially on Windows
    21022100          it is a lot of work to implement the complicated
    2103           <code>IDispatch</code> interface, requiring to load COM type
     2101          <code>IDispatch</code> interface, requiring loading COM type
    21042102          information and using it in the <code>IDispatch</code> method
    21052103          implementation. Overall this is quite tedious compared to passive
     
    21162114
    21172115          <para>This is vital for vetoable events, as they would be stuck
    2118           otherwise, waiting whether the veto comes or not. It does not do any
     2116          otherwise, waiting on whether the veto comes or not. It does not do any
    21192117          harm for other event types, and in the end is cheaper than checking
    21202118          if the event at hand is vetoable or not.</para>
     
    21272125          application. Additional hints are in the comments documenting
    21282126          the helper methods in
    2129           <computeroutput>VBoxCAPI_v4_3.h</computeroutput>. The code complexity
    2130           of active event handling (and its inherenly platform/compiler
    2131           specific aspects) should be motivation to use passive event handling
    2132           whereever possible.</para>
     2127          <computeroutput>VBoxCAPI_v&VBOX_VERSION_MAJOR;_&VBOX_VERSION_MINOR;.h</computeroutput>.
     2128          The code complexity of active event handling (and its inherently
     2129          platform/compiler specific aspects) should be motivation to use passive
     2130          event handling wherever possible.</para>
    21332131        </sect3>
    21342132
     
    21382136          <para>Uninitialization is performed by
    21392137          <computeroutput>g_pVBoxFuncs-&gt;pfnClientUninitialize().</computeroutput>
    2140           If your program can exit from more than one place, it is a good idea
    2141           to install this function as an exit handler with Standard C's
     2138          If your program can exit in more than one place, it is a good idea
     2139          to install this function as an exit handler using the C library function
    21422140          <computeroutput>atexit()</computeroutput> just after calling
    21432141          <computeroutput>g_pVBoxFuncs-&gt;pfnClientInitialize()</computeroutput>
     
    21682166          <computeroutput>main.</computeroutput></para>
    21692167
    2170           <para>If you expect the program to be terminated by a signal (e.g.
     2168          <para>If you expect your program to be terminated by a signal (e.g. a
    21712169          user types CTRL-C sending SIGINT) you might want to install a signal
    21722170          handler setting a flag noting that a signal was sent and then
     
    21792177          before it terminates, there is a mechanism in place which will
    21802178          eventually release references held by the client. On Windows it can
    2181           take quite a while, in the order of 6-7 minutes.</para>
     2179          take quite a while, on the order of 6-7 minutes.</para>
    21822180        </sect3>
    21832181
     
    21862184
    21872185          <para>A program using the C binding has to open the library during
    2188           runtime using the help of glue code provided and as shown in the
     2186          runtime using the help of the glue code provided and as shown in the
    21892187          example <computeroutput>tstCAPIGlue.c</computeroutput>.
    21902188          Compilation and linking can be achieved with a makefile fragment
     
    22202218
    22212219        <sect3 id="capi_conversion">
    2222           <title>Conversion of code using legacy C binding</title>
    2223 
    2224           <para>This section aims to make the task of converting code using
    2225           the legacy C binding to the new style a breeze, by pointing out some
    2226           key steps.</para>
     2220          <title>Conversion of code using legacy C bindings</title>
     2221
     2222          <para>This section aims to make the task of converting code using the
     2223          legacy C bindings to the new style a breeze by following these key
     2224          steps.</para>
    22272225
    22282226          <para>One necessary change is adjusting your Makefile to reflect the
    2229           different include paths. See above. There are now 3 relevant include
    2230           directories, and most of it is pointing to the C binding directory.
    2231           The XPCOM include directory is still relevant for platforms where
    2232           the XPCOM middleware is used, but most of the include files live
    2233           elsewhere now, so it's good to have it last. Additionally the
    2234           <computeroutput>VirtualBox_i.c</computeroutput> file needs to be
    2235           compiled and linked to the program, it contains the IIDs relevant
    2236           for the VirtualBox API, making sure they are not replicated endlessly
    2237           if the code refers to them frequently.</para>
     2227          different include paths. As shown in the makefile fragment above, there
     2228          are now three relevant include directories.  The XPCOM include directory
     2229          is still relevant for platforms where the XPCOM middleware is used but
     2230          most of its include files live elsewhere now so it's good to have it
     2231          last. Additionally the <computeroutput>VirtualBox_i.c</computeroutput>
     2232          file needs to be compiled and linked to the program since it contains
     2233          the interface IDs (IIDs) relevant for the VirtualBox API, making sure
     2234          they are not replicated endlessly if the code refers to them
     2235          frequently.</para>
    22382236
    22392237          <para>The C API client code should include
    22402238          <computeroutput>VBoxCAPIGlue.h</computeroutput> instead of
    22412239          <computeroutput>VBoxXPCOMCGlue.h</computeroutput> or
    2242           <computeroutput>VBoxCAPI_v4_3.h</computeroutput>, as this makes sure
    2243           the correct macros and internal translations are selected.</para>
     2240          <computeroutput>VBoxCAPI_v&VBOX_VERSION_MAJOR;_&VBOX_VERSION_MINOR;.h</computeroutput>,
     2241          as this makes sure the correct macros and internal translations are
     2242          selected.</para>
    22442243
    22452244          <para>All API method calls (anything mentioning <code>vtbl</code>)
    22462245          should be rewritten using the convenience macros for calling methods,
    2247           as these hide the internal details, are generally easier to use and
    2248           shorter to type. You should remove as many as possible
     2246          as these hide the internal details, are generally easier to
     2247          use, and are shorter to type. You should remove as many as possible
    22492248          <code>(nsISupports **)</code> or similar typecasts, as the new style
    22502249          should use the correct type in most places, increasing the type
     
    22632262          helpers, as these make sure the code works without changes with
    22642263          both COM and XPCOM, which are significantly different in this area.
    2265           The code should be double checked if it uses the correct way to
    2266           manage memory, and is freeing it only after the last use.</para>
     2264          The code should be double checked to see that it uses the correct way to
     2265          manage memory and is freeing it only after the last use.</para>
    22672266        </sect3>
    22682267
    22692268        <sect3 id="xpcom_cbinding">
    2270           <title>Legacy C binding to VirtualBox API for XPCOM</title>
     2269          <title>Legacy C bindings to VirtualBox API for XPCOM</title>
    22712270
    22722271          <note>
     
    22752274          </note>
    22762275
    2277           <para>Starting with version 2.2, VirtualBox offers a C binding for
     2276          <para>Starting with version 2.2, VirtualBox offers C bindings for
    22782277          its API which works only on platforms using XPCOM. Refer to the
    22792278          old SDK documentation (included in the SDK packages for version 4.3.6
    2280           or earlier), it still applies unchanged. The fundamental concepts are
    2281           similar (but the syntactical details are quite different) to the
    2282           newer cross-platform C binding which should be used for all new code,
    2283           as the support for the old C binding will go away in a major release
     2279          or earlier) since it still applies unchanged. The fundamental concepts
     2280          are similar (but the syntactical details are quite different) to the
     2281          newer cross-platform C bindings which should be used for all new code,
     2282          as the support for the old C bindings will go away in a major release
    22842283          after version 4.3.</para>
    22852284        </sect3>
     
    23372336      <title>Changing machine settings: Sessions</title>
    23382337
    2339       <para>As said in the previous section, to read a machine's attribute,
     2338      <para>As described in the previous section, to read a machine's attribute,
    23402339      one invokes the corresponding "get" method. One would think that to
    23412340      change settings of a machine, it would suffice to call the corresponding
     
    23852384      calling
    23862385      <link linkend="ISession__unlockMachine">ISession::unlockMachine()</link>.
    2387       Otherwise, when the calling process end, the machine will receive the
     2386      Otherwise, when the calling process exits, the machine will be moved to the
    23882387      "aborted" state, which can lead to loss of data.</para>
    23892388
     
    24062405      <para>To launch a virtual machine, you call
    24072406      <link linkend="IMachine__launchVMProcess">IMachine::launchVMProcess()</link>.
    2408       In doing so, the caller instructs the VirtualBox engine to start a new
    2409       process with the virtual machine in it, since to the host, each virtual
    2410       machine looks like single process, even if it has hundreds of its own
    2411       processes inside. (This new VM process in turn obtains a write lock on
     2407      This instructs the VirtualBox engine to start a new process containing the
     2408      virtual machine. The host system sees each virtual machine as a single
     2409      process, even if the virtual machine has hundreds of its own processes
     2410      running inside it. (This new VM process in turn obtains a write lock on
    24122411      the machine, as described above, to prevent conflicting changes from
    24132412      other processes; this is why opening another session will fail while the
     
    24462445      <para>The IEvent interface is an abstract parent interface for all
    24472446      events that can occur in VirtualBox. The actual events that the server
    2448       sends out are then of one of the specific subclasses, for example
     2447      sends out belong to one of the specific subclasses, for example
    24492448      <link linkend="IMachineStateChangedEvent">IMachineStateChangedEvent</link>
    24502449      or
    24512450      <link linkend="IMediumChangedEvent">IMediumChangedEvent</link>.</para>
    24522451
    2453       <para>As an example, the VirtualBox GUI waits for machine events and can
    2454       thus update its display when the machine state changes or machine
    2455       settings are modified, even if this happens in another client. This is
    2456       how the GUI can automatically refresh its display even if you manipulate
    2457       a machine from another client, for example, from VBoxManage.</para>
    2458 
    2459       <para>To register an event listener to listen to events, use code like
    2460       this:<screen>EventSource es = console.getEventSource();
     2452      <para>As an example, the VirtualBox GUI waits for machine events so it can
     2453      update its display when the machine state changes or machine settings are
     2454      modified, even if this happens in another client. This is how the GUI can
     2455      automatically refresh its display even if you manipulate a machine from
     2456      a different client such as VBoxManage.</para>
     2457
     2458      <para>To register an event listener to listen for events, you would use code
     2459      similar to the following:<screen>EventSource es = console.getEventSource();
    24612460IEventListener listener = es.createListener();
    24622461VBoxEventType aTypes[] = (VBoxEventType.OnMachineStateChanged);
     
    24772476es.unregisterListener(listener); </screen></para>
    24782477
    2479       <para>A graphical user interface would probably best start its own
    2480       thread to wait for events and then process these in a loop.</para>
     2478      <para>A graphical user interface application would most likely want to start
     2479      its own thread to wait for events and then process these in a loop.</para>
    24812480
    24822481      <para>The events mechanism was introduced with VirtualBox 3.3 and
    24832482      replaces various callback interfaces which were called for each event in
    24842483      the interface. The callback mechanism was not compatible with scripting
    2485       languages, local Java bindings and remote web services as they do not
     2484      languages, local Java bindings, and remote web services as they do not
    24862485      support callbacks. The new mechanism with events and event listeners
    24872486      works with all of these.</para>
    24882487
    2489       <para>To simplify developement of application using events, concept of
    2490       event aggregator was introduced. Essentially it's mechanism to aggregate
    2491       multiple event sources into single one, and then work with this single
    2492       aggregated event source instead of original sources. As an example, one
    2493       can evaluate demo recorder in VirtualBox Python shell, shipped with SDK
    2494       - it records mouse and keyboard events, represented as separate event
    2495       sources. Code is essentially like this:<screen>
     2488      <para>To simplify development of applications using events, the concept of
     2489      an event aggregator was introduced. Essentially it's a mechanism to
     2490      aggregate multiple event sources into one single event source, and then work
     2491      with this single aggregated event source instead of the original sources. As
     2492      an example, one can try out the VirtualBox Python shell's
     2493      <computeroutput>recordDemo</computeroutput> option which records mouse and
     2494      keyboard events using an event aggregator and displays them as separate event
     2495      sources. The VirtualBox Python shell (vboxshell.py) is shipped with the SDK.
     2496      The <computeroutput>recordDemo</computeroutput> code is essentially:<screen>
    24962497          listener = console.eventSource.createListener()
    24972498          agg = console.eventSource.createAggregator([console.keyboard.eventSource, console.mouse.eventSource])
     
    25032504              processEent(ev)
    25042505          agg.unregisterListener(listener)</screen> Without using aggregators
    2505       consumer have to poll on both sources, or start multiple threads to
    2506       block on those sources.</para>
     2506      consumers would have to either poll on both sources or start multiple
     2507      threads to block on those sources.</para>
    25072508    </sect1>
    25082509  </chapter>
     
    25112512    <title>The VirtualBox shell</title>
    25122513
    2513     <para>VirtualBox comes with an extensible shell, which allows you to
     2514    <para>VirtualBox comes with an extensible shell which allows you to
    25142515    control your virtual machines from the command line. It is also a
    2515     nontrivial example of how to use the VirtualBox APIs from Python, for all
    2516     three COM/XPCOM/WS styles of the API.</para>
    2517 
    2518     <para>You can easily extend this shell with your own commands. Create a
    2519     subdirectory named
    2520     <computeroutput>.config/VirtualBox/shexts</computeroutput> below your home
    2521     directory (respectively <computeroutput>.VirtualBox/shexts</computeroutput>
    2522     on a Windows system and
    2523     <computeroutput>Library/VirtualBox/shexts</computeroutput> on OS X) and put
    2524     a Python file implementing your shell extension commands in this directory.
    2525     This file must contain an array named
    2526     <computeroutput>commands</computeroutput> containing your command
     2516    non-trivial example of how to use the VirtualBox APIs from Python for all
     2517    three styles of the API (COM/XPCOM/WS).</para>
     2518
     2519    <para>You can easily extend this shell with your own commands.  Simply create
     2520    a subdirectory named
     2521    <computeroutput>.config/VirtualBox/shexts</computeroutput> in your home
     2522    directory (<computeroutput>.VirtualBox/shexts</computeroutput>
     2523    on Windows systems and
     2524    <computeroutput>Library/VirtualBox/shexts</computeroutput> on macOS systems)
     2525    and put a Python file implementing your shell extension commands in this
     2526    directory.  This file must have an array named
     2527    <computeroutput>commands</computeroutput> which contains your command
    25272528    definitions: <screen>
    25282529        commands = {
     
    25702571        'myCreateHDD': ['Create virtual HDD, createHdd size location type', createHdd]
    25712572        }
    2572       </screen> Just store the above text in the file
     2573      </screen> Just store the above text in a file named
    25732574    <computeroutput>createHdd</computeroutput> (or any other meaningful name)
    2574     in <computeroutput>.config/VirtualBox/shexts/</computeroutput>. Start the
    2575     VirtualBox shell, or just issue the
    2576     <computeroutput>reloadExts</computeroutput> command, if the shell is
     2575    in the <computeroutput>shexts</computeroutput> directory located as
     2576    described above and then start the VirtualBox shell or just issue the
     2577    <computeroutput>reloadExts</computeroutput> command if the shell is
    25772578    already running. Your new command will now be available.</para>
    25782579  </chapter>
     
    28122813      </itemizedlist></para>
    28132814
    2814     <para>The shared library contains a so called HGCM service. The guest HGCM
    2815     clients establish connections to the service to call it. When calling a
    2816     HGCM service the client supplies a function code and a number of
    2817     parameters for the function.</para>
     2815    <para>The shared library on the host contains a so called HGCM service.
     2816    The guest HGCM client establishes a connection to the HGCM service on the
     2817    host in order to call that HGCM service's entry point.  When calling an
     2818    HGCM service the client supplies a function code, the number of parameters
     2819    for the function, and an array of the parameter arguments.</para>
    28182820
    28192821    <sect1>
    28202822      <title>Virtual hardware implementation</title>
    28212823
    2822       <para>HGCM uses the VMM virtual PCI device to exchange data between the
    2823       guest and the host. The guest always acts as an initiator of requests. A
    2824       request is constructed in the guest physical memory, which must be
    2825       locked by the guest. The physical address is passed to the VMM device
    2826       using a 32-bit <computeroutput>out edx, eax</computeroutput>
    2827       instruction. The physical memory must be allocated below 4GB by 64-bit
     2824      <para>HGCM uses the Virtual Machine Monitor (VMM) virtual PCI device to
     2825      exchange data between the guest and the host. The guest always acts as an
     2826      initiator of requests. A request is constructed in the guest's physical
     2827      memory which must be locked by the guest. The physical address is passed
     2828      to the VMM device using a 32-bit
     2829      <computeroutput>out edx, eax</computeroutput>
     2830      instruction. The physical memory must be allocated below 4GB on 64-bit
    28282831      guests.</para>
    28292832
    28302833      <para>The host parses the request header and data and queues the request
    2831       for a host HGCM service. The guest continues execution and usually waits
    2832       on a HGCM event semaphore.</para>
     2834      for the corresponding host HGCM service type. The guest continues
     2835      execution and usually waits on an HGCM event semaphore.</para>
    28332836
    28342837      <para>When the request has been processed by the HGCM service, the VMM
     
    28442847
    28452848      <para>The HGCM protocol definitions are contained in the
    2846       <computeroutput>VBox/VBoxGuest.h</computeroutput></para>
     2849      <computeroutput>VBox/VBoxGuest.h</computeroutput> header file.</para>
    28472850
    28482851      <sect2>
     
    29442947                  (<computeroutput>60</computeroutput>)</entry>
    29452948
    2946                   <entry>Connect to a HGCM service.</entry>
     2949                  <entry>Connect to an HGCM service.</entry>
    29472950                </row>
    29482951
     
    29582961                  (<computeroutput>62</computeroutput>)</entry>
    29592962
    2960                   <entry>Call a HGCM function using the 32-bit
     2963                  <entry>Call an HGCM function using the 32-bit
    29612964                  interface.</entry>
    29622965                </row>
     
    29662969                  (<computeroutput>63</computeroutput>)</entry>
    29672970
    2968                   <entry>Call a HGCM function using the 64-bit
     2971                  <entry>Call an HGCM function using the 64-bit
    29692972                  interface.</entry>
    29702973                </row>
     
    29742977                  (<computeroutput>64</computeroutput>)</entry>
    29752978
    2976                   <entry>Cancel a HGCM request currently being processed by a
     2979                  <entry>Cancel an HGCM request currently being processed by a
    29772980                  host HGCM service.</entry>
    29782981                </row>
     
    32063209
    32073210        <para>The 32-bit parameter description (HGCMFunctionParameter32)
    3208         consists of 32-bit type field and 8 bytes of an opaque value, so 12
     3211        consists of a 32-bit type field and 8 bytes of an opaque value, so 12
    32093212        bytes in total. The 64-bit variant (HGCMFunctionParameter64) consists
    3210         of the type and 12 bytes of a value, so 16 bytes in total.</para>
     3213        of the 32-bit type and 12 bytes of a value, so 16 bytes in total.</para>
    32113214
    32123215        <para><table>
     
    32873290          </table></para>
    32883291
    3289         <para>The</para>
    32903292      </sect2>
    32913293
     
    33203322      <title>Guest software interface</title>
    33213323
    3322       <para>The guest HGCM clients can call HGCM services from both drivers
     3324      <para>Guest HGCM clients can call HGCM services from both drivers
    33233325      and applications.</para>
    33243326
     
    33273329
    33283330        <para>The driver interface is implemented in the VirtualBox guest
    3329         additions driver (VBoxGuest), which works with the VMM virtual device.
    3330         Drivers must use the VBox Guest Library (VBGL), which provides an API
     3331        additions driver (VBoxGuest) which works with the VMM virtual device.
     3332        Drivers must use the VBox Guest Library (VBGL) which provides an API
    33313333        for HGCM clients (<computeroutput>VBox/VBoxGuestLib.h</computeroutput>
    3332         and <computeroutput>VBox/VBoxGuest.h</computeroutput>).</para>
     3334        and <computeroutput>VBox/VBoxGuest.h</computeroutput>). The key VBGL API
     3335        routines are as follows:</para>
    33333336
    33343337        <para><screen>
    33353338DECLR0VBGL(int) VbglR0HGCMConnect(VBGLHGCMHANDLE *pHandle, const char *pszServiceName, HGCMCLIENTID *pidClient);
    3336           </screen> Connects to the service: <screen>
     3339          </screen> VbglR0HGCMConnect() connects to the HGCM service on the host. An
     3340          example of a guest driver connecting to the VirtualBox Shared Folder
     3341          HGCM service follows:<screen>
    33373342    VBoxGuestHGCMConnectInfo data;
    33383343
     
    33413346    data.result   = VINF_SUCCESS;
    33423347    data.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
    3343     strcpy (data.Loc.u.host.achName, "VBoxSharedFolders");
    3344 
    3345     rc = VbglHGCMConnect (&amp;handle, "VBoxSharedFolders"&amp;data);
    3346 
    3347     if (RT_SUCCESS (rc))
     3348    strcpy(data.Loc.u.host.achName, "VBoxSharedFolders");
     3349
     3350    rc = VbglR0HGCMConnect(&amp;handle, "VBoxSharedFolders"&amp;, data);
     3351
     3352    if (RT_SUCCESS(rc))
    33483353    {
    33493354        rc = data.result;
    33503355    }
    33513356
    3352     if (RT_SUCCESS (rc))
     3357    if (RT_SUCCESS(rc))
    33533358    {
    33543359        /* Get the assigned client identifier. */
     
    33583363
    33593364        <para><screen>
    3360 DECLVBGL(int) VbglHGCMDisconnect (VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData);
    3361           </screen> Disconnects from the service. <screen>
     3365DECLVBGL(int) VbglR0HGCMDisconnect(VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData);
     3366          </screen> VbglR0HGCMDisconnect() disconnects from the HGCM service on the
     3367          host.  An example of a guest driver disconnecting from an HGCM service
     3368          using the client identifier from an earlier call to VbglR0HGCMConnect()
     3369          follows:<screen>
    33623370    VBoxGuestHGCMDisconnectInfo data;
    33633371
    3364     RtlZeroMemory (&amp;data, sizeof (VBoxGuestHGCMDisconnectInfo));
     3372    RtlZeroMemory(&amp;data, sizeof (VBoxGuestHGCMDisconnectInfo));
    33653373
    33663374    data.result      = VINF_SUCCESS;
    33673375    data.u32ClientID = ulClientID;
    33683376
    3369     rc = VbglHGCMDisconnect (handle, &amp;data);
     3377    rc = VbglR0HGCMDisconnect(handle, &amp;data);
    33703378          </screen></para>
    33713379
    33723380        <para><screen>
    3373 DECLVBGL(int) VbglHGCMCall (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
    3374           </screen> Calls a function in the service. <screen>
     3381DECLVBGL(int) VbglR0HGCMCall(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
     3382          </screen> VbglR0HGCMCall() calls a function specified in the
     3383          VBoxGuestHGCMCallInfo argument in the HGCM service on the host. An
     3384          example of a guest driver calling the Shared Folders HGCM service to
     3385          issue a read of an object in a shared folder follows:<screen>
    33753386typedef struct _VBoxSFRead
    33763387{
     
    34343445    data.buffer.u.Pointer.u.linearAddr  = (uintptr_t)pBuffer;
    34353446
    3436     rc = VbglHGCMCall (handle, &amp;data.callInfo, sizeof (data));
    3437 
    3438     if (RT_SUCCESS (rc))
     3447    rc = VbglR0HGCMCall(handle, &amp;data.callInfo, sizeof (data));
     3448
     3449    if (RT_SUCCESS(rc))
    34393450    {
    34403451        rc = data.callInfo.result;
     
    34483459
    34493460        <para>Applications call the VirtualBox Guest Additions driver to
    3450         utilize the HGCM interface. There are IOCTL's which correspond to the
    3451         <computeroutput>Vbgl*</computeroutput> functions: <itemizedlist>
    3452             <listitem>
    3453               <para><computeroutput>VBOXGUEST_IOCTL_HGCM_CONNECT</computeroutput></para>
    3454             </listitem>
    3455 
    3456             <listitem>
    3457               <para><computeroutput>VBOXGUEST_IOCTL_HGCM_DISCONNECT</computeroutput></para>
    3458             </listitem>
    3459 
    3460             <listitem>
    3461               <para><computeroutput>VBOXGUEST_IOCTL_HGCM_CALL</computeroutput></para>
     3461        utilize the HGCM interface. The following IOCTLs correspond to the
     3462        <computeroutput>VbglR0HGCM*</computeroutput> functions listed above:
     3463        <itemizedlist>
     3464            <listitem>
     3465              <para><computeroutput>VBGL_IOCTL_HGCM_CONNECT =>
     3466              VbglR0HGCMConnect()</computeroutput></para>
     3467            </listitem>
     3468
     3469            <listitem>
     3470              <para><computeroutput>VBGL_IOCTL_HGCM_DISCONNECT =>
     3471              VbglR0HGCMDisconnect()</computeroutput></para>
     3472            </listitem>
     3473
     3474            <listitem>
     3475              <para><computeroutput>VBGL_IOCTL_HGCM_CALL =>
     3476              VbglR0HGCMCall()</computeroutput></para>
    34623477            </listitem>
    34633478          </itemizedlist></para>
    34643479
    3465         <para>These IOCTL's get the same input buffer as
    3466         <computeroutput>VbglHGCM*</computeroutput> functions and the output
     3480        <para>These IOCTLs get the same input buffer as the
     3481        <computeroutput>VbglR0HGCM*</computeroutput> functions and the output
    34673482        buffer has the same format as the input buffer. The same address can
    3468         be used as the input and output buffers.</para>
    3469 
    3470         <para>For example see the guest part of shared clipboard, which runs
    3471         as an application and uses the HGCM interface.</para>
     3483        be used for both the input and output buffers.</para>
    34723484      </sect2>
    34733485    </sect1>
     
    34793491      points. The library must export the
    34803492      <computeroutput>VBoxHGCMSvcLoad</computeroutput> entry point: <screen>
    3481 extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad (VBOXHGCMSVCFNTABLE *ptable)
     3493extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad(VBOXHGCMSVCFNTABLE *ptable)
    34823494      </screen></para>
    34833495
     
    34853497      <computeroutput>ptable-&gt;cbSize</computeroutput> and
    34863498      <computeroutput>ptable-&gt;u32Version</computeroutput> fields of the
    3487       input structure and fill the remaining fields with function pointers of
    3488       entry points and the size of the required client buffer size.</para>
    3489 
    3490       <para>The HGCM service gets a dedicated thread, which calls service
    3491       entry points synchronously, that is the service will be called again
    3492       only when a previous call has returned. However, the guest calls can be
    3493       processed asynchronously. The service must call a completion callback
    3494       when the operation is actually completed. The callback can be issued
    3495       from another thread as well.</para>
     3499      input structure and fill in the remaining fields with function pointers of
     3500      service entry points (listed below) and the size of the required client
     3501      buffer size.</para>
     3502
     3503      <para>The HGCM service gets a dedicated thread which calls service
     3504      entry points synchronously, thus the service entry point will only be called
     3505      again once a previous call has returned. However, the guest calls can be
     3506      processed asynchronously. Therefore the service must call a completion
     3507      callback when the operation is actually completed. The callback can be
     3508      issued from another thread as well.</para>
    34963509
    34973510      <para>Service entry points are listed in the
     
    35033516            <tbody>
    35043517              <row>
    3505                 <entry><emphasis role="bold">Entry</emphasis></entry>
     3518                <entry><emphasis role="bold">Entry Point</emphasis></entry>
    35063519
    35073520                <entry><emphasis role="bold">Description</emphasis></entry>
     
    35093522
    35103523              <row>
    3511                 <entry>pfnUnload</entry>
     3524                <entry>int pfnUnload(void *pvService)</entry>
    35123525
    35133526                <entry>The service is being unloaded.</entry>
     
    35153528
    35163529              <row>
    3517                 <entry>pfnConnect</entry>
     3530                <entry>int pfnConnect(void *pvService, uint32_t u32ClientID, void *pvClient,
     3531                uint32_t fRequestor, bool fRestoring)</entry>
    35183532
    35193533                <entry>A client <computeroutput>u32ClientID</computeroutput>
     
    35253539
    35263540              <row>
    3527                 <entry>pfnDisconnect</entry>
     3541                <entry>int pfnDisconnect(void *pvService, uint32_t u32ClientID,
     3542                void *pvClient)</entry>
    35283543
    35293544                <entry>A client is being disconnected.</entry>
     
    35313546
    35323547              <row>
    3533                 <entry>pfnCall</entry>
     3548                <entry>void pfnCall(void *pvService, VBOXHGCMCALLHANDLE callHandle,
     3549                uint32_t u32ClientID, void *pvClient, uint32_t function,
     3550                uint32_t cParms, VBOXHGCMSVCPARM paParms[],
     3551                uint64_t tsArrival)</entry>
    35343552
    35353553                <entry>A guest client calls a service function. The
     
    35403558
    35413559              <row>
    3542                 <entry>pfnHostCall</entry>
     3560                <entry>int pfnHostCall(void *pvService, uint32_t function, uint32_t cParms,
     3561                VBOXHGCMSVCPARM paParms[])</entry>
    35433562
    35443563                <entry>Called by the VirtualBox host components to perform
     
    35493568
    35503569              <row>
    3551                 <entry>pfnSaveState</entry>
     3570                <entry>int pfnSaveState(void *pvService, uint32_t u32ClientID, void *pvClient,
     3571                PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM)</entry>
    35523572
    35533573                <entry>The VM state is being saved and the service must save
     
    35573577
    35583578              <row>
    3559                 <entry>pfnLoadState</entry>
     3579                <entry>int pfnLoadState(void *pvService, uint32_t u32ClientID, void *pvClient,
     3580                PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion)</entry>
    35603581
    35613582                <entry>The VM is being restored from the saved state and the
     
    35733594
    35743595    <para>The VirtualBox <emphasis>RDP Web Control</emphasis> (RDPWeb)
    3575     provides remote access to a running VM. RDPWeb is a RDP (Remote Desktop
     3596    provides remote access to a running VM. RDPWeb is an RDP (Remote Desktop
    35763597    Protocol) client based on Flash technology and can be used from a Web
    35773598    browser with a Flash plugin.</para>
     
    35803601      <title>RDPWeb features</title>
    35813602
    3582       <para>RDPWeb is embedded into a Web page and can connect to VRDP server
    3583       in order to displays the VM screen and pass keyboard and mouse events to
    3584       the VM.</para>
     3603      <para>RDPWeb is embedded into a Web page and connects to a VRDP server
     3604      in order to display the remote VM screen and pass keyboard and mouse events
     3605      to the VM.</para>
    35853606    </sect1>
    35863607
     
    35903611      <para>RDPWeb consists of two required components:<itemizedlist>
    35913612          <listitem>
    3592             <para>Flash movie
     3613            <para>Flash movie file
    35933614            <computeroutput>RDPClientUI.swf</computeroutput></para>
    35943615          </listitem>
    35953616
    35963617          <listitem>
    3597             <para>JavaScript helpers
     3618            <para>JavaScript helpers contained in
    35983619            <computeroutput>webclient.js</computeroutput></para>
    35993620          </listitem>
     
    36033624      including:<itemizedlist>
    36043625          <listitem>
    3605             <para>JavaScript library for embedding Flash content
     3626            <para>A JavaScript library for embedding Flash content:
    36063627            <computeroutput>SWFObject.js</computeroutput></para>
    36073628          </listitem>
    36083629
    36093630          <listitem>
    3610             <para>Sample HTML page
     3631            <para>A sample HTML page:
    36113632            <computeroutput>webclient3.html</computeroutput></para>
    36123633          </listitem>
     
    36173638
    36183639        <para><computeroutput>RDPClientUI.swf</computeroutput> and
    3619         <computeroutput>webclient.js</computeroutput> work with each other.
    3620         JavaScript code is responsible for a proper SWF initialization,
    3621         delivering mouse events to the SWF and processing resize requests from
    3622         the SWF. On the other hand, the SWF contains a few JavaScript callable
    3623         methods, which are used both from
    3624         <computeroutput>webclient.js</computeroutput> and the user HTML
     3640        <computeroutput>webclient.js</computeroutput> work together to provide the
     3641        RDP Web Control functionality.  The JavaScript code is responsible for
     3642        proper Flash initialization, delivering mouse events to the Flash object,
     3643        and processing resize requests from the Flash object. On the other hand,
     3644        the SWF file contains a few JavaScript callable methods, which are used
     3645        both from <computeroutput>webclient.js</computeroutput> and the user HTML
    36253646        page.</para>
    36263647
     
    36283649          <title>JavaScript functions</title>
    36293650
    3630           <para><computeroutput>webclient.js</computeroutput> contains helper
    3631           functions. In the following table ElementId refers to an HTML
    3632           element name or attribute, and Element to the HTML element itself.
    3633           HTML code<programlisting>
     3651          <para>The <computeroutput>webclient.js</computeroutput> file contains
     3652          several helper JavaScript functions. In the following table ElementId
     3653          refers to an HTML element name or attribute, and Element to the HTML
     3654          element itself.
     3655          The HTML code<programlisting>
    36343656    &lt;div id="FlashRDP"&gt;
    36353657    &lt;/div&gt;
     
    36413663                <programlisting>RDPWebClient.embedSWF(SWFFileName, ElementId)</programlisting>
    36423664
    3643                 <para>Uses SWFObject library to replace the HTML element with
    3644                 the Flash movie.</para>
     3665                <para>Uses the open-source SWFObject library to replace the HTML
     3666                element with the Flash movie.</para>
    36453667              </listitem>
    36463668
     
    36483670                <programlisting>RDPWebClient.isRDPWebControlById(ElementId)</programlisting>
    36493671
    3650                 <para>Returns true if the given id refers to a RDPWeb Flash
     3672                <para>Returns true if the given ElementId refers to an RDPWeb
     3673                Flash element.</para>
     3674              </listitem>
     3675
     3676              <listitem>
     3677                <programlisting>RDPWebClient.isRDPWebControlByElement(Element)</programlisting>
     3678
     3679                <para>Returns true if the given Element is an RDPWeb Flash
    36513680                element.</para>
    36523681              </listitem>
    36533682
    36543683              <listitem>
    3655                 <programlisting>RDPWebClient.isRDPWebControlByElement(Element)</programlisting>
    3656 
    3657                 <para>Returns true if the given element is a RDPWeb Flash
    3658                 element.</para>
    3659               </listitem>
    3660 
    3661               <listitem>
    36623684                <programlisting>RDPWebClient.getFlashById(ElementId)</programlisting>
    36633685
    3664                 <para>Returns an element, which is referenced by the given id.
    3665                 This function will try to resolve any element, event if it is
    3666                 not a Flash movie.</para>
     3686                <para>Returns an element, which is referenced by the given
     3687                ElementId.  This function will try to resolve any element, even if
     3688                it is not a Flash movie.</para>
    36673689              </listitem>
    36683690            </itemizedlist></para>
     
    36723694          <title>Flash methods callable from JavaScript</title>
    36733695
    3674           <para><computeroutput>RDPWebClienUI.swf</computeroutput> methods can
    3675           be called directly from JavaScript code on a HTML page.</para>
     3696          <para>The <computeroutput>RDPWebClienUI.swf</computeroutput> methods can
     3697          be called directly from JavaScript code on an HTML page:</para>
    36763698
    36773699          <itemizedlist>
     
    37093731        <title>Embedding RDPWeb in an HTML page</title>
    37103732
    3711         <para>It is necessary to include
     3733        <para>It is necessary to include the
    37123734        <computeroutput>webclient.js</computeroutput> helper script. If
    3713         SWFObject library is used, the
    3714         <computeroutput>swfobject.js</computeroutput> must be also included
    3715         and RDPWeb flash content can be embedded to a Web page using dynamic
    3716         HTML. The HTML must include a "placeholder", which consists of 2
    3717         <computeroutput>div</computeroutput> elements.</para>
     3735        the SWFObject library is used, the
     3736        <computeroutput>swfobject.js</computeroutput> must also be included.
     3737        Using the SWFObject library allows RDPWeb flash content to be embedded in
     3738        a Web page using dynamic HTML. The HTML must include a "placeholder",
     3739        which consists of 2 <computeroutput>div</computeroutput> elements.</para>
    37183740      </sect2>
    37193741    </sect1>
     
    37773799    <title>Drag and Drop</title>
    37783800
    3779     <para>Since VirtualBox 4.2 it's possible to transfer files from host to the
    3780     Linux guests by dragging files, directories or text from the host into the
    3781     guest's screen. This is called <emphasis>drag and drop
     3801    <para>As of VirtualBox 4.2 it's possible to transfer files from the host to
     3802    Linux, Solaris, and macOS guests by dragging files, directories, or text
     3803    from the host into the guest's screen. This is called <emphasis>drag and drop
    37823804    (DnD)</emphasis>.</para>
    37833805
    3784     <para>In version 5.0 support for Windows guests has been added, as well as
    3785     the ability to transfer data the other way around, that is, from the guest
    3786     to the host.</para>
    3787 
    3788     <note><para>Currently only the VirtualBox Manager frontend supports drag and
     3806    <para>VirtualBox 5.0 added support for Windows guests as well as the ability
     3807    to transfer data in the opposite direction, that is, from the guest to the
     3808    host.</para>
     3809
     3810    <note><para>Currently only the VirtualBox Manager front-end supports drag and
    37893811      drop.</para></note>
    37903812
    37913813    <para>This chapter will show how to use the required interfaces provided
    37923814    by VirtualBox for adding drag and drop functionality to third-party
    3793     frontends.</para>
     3815    front-ends.</para>
    37943816
    37953817    <sect1>
     
    37973819
    37983820      <para>In order to use the interfaces provided by VirtualBox, some basic
    3799       concepts needs to be understood first: To successfully initiate a
    3800       drag and drop operation at least two sides needs to be involved, a
    3801       <emphasis>source</emphasis> and a <emphasis>target</emphasis>:</para>
    3802 
    3803       <para>The <emphasis>source</emphasis> is the side which provides the
    3804       data, e.g. is the origin of data. This data can be stored within the
    3805       source directly or can be retrieved on-demand by the source itself. Other
    3806       interfaces don't care where the data from this source actually came
    3807       from.</para>
    3808 
    3809       <para>The <emphasis>target</emphasis> on the other hand is the side which
    3810       provides the source a visual representation where the user can drop the
    3811       data the source offers. This representation can be a window (or just a
    3812       certain part of it), for example.</para>
     3821      concepts need to be understood first: a drag and drop operation logically
     3822      contains both a <emphasis>source</emphasis> and a
     3823      <emphasis>target</emphasis>:</para>
     3824
     3825      <para>The <emphasis>source</emphasis> provides the data, i.e., it is the
     3826      origin of data. This data can be stored within the source directly or it can
     3827      be retrieved on-demand by the source itself.</para>
     3828
     3829      <para>The <emphasis>target</emphasis> on the other hand provides a visual
     3830      representation to the source where the user can drop the data the source
     3831      offers. This representation can be a window (or just a certain part of
     3832      it), for example.</para>
    38133833
    38143834      <para>The source and the target have abstract interfaces called
     
    38183838      <link linkend="IGuestDnDSource">IGuestDnDSource</link> and
    38193839      <link linkend="IGuestDnDTarget">IGuestDnDTarget</link>. Both
    3820       implementations are also used in the VirtualBox Manager frontend.</para>
     3840      implementations are used in the VirtualBox Manager front-end.</para>
    38213841    </sect1>
    38223842
     
    38263846      <para>As the target needs to perform specific actions depending on the
    38273847      data the source provided, the target first needs to know what type of
    3828       data it actually is going to retrieve. It might be that the source offers
     3848      data it is actually going to retrieve. It might be that the source offers
    38293849      data the target cannot (or intentionally does not want to)
    38303850      support.</para>
    38313851
    3832       <para>VirtualBox handles those data types by providing so-called
    3833       <emphasis>MIME types</emphasis> -- these MIME types were originally
    3834       defined in
     3852      <para>VirtualBox describes the data types using
     3853      <emphasis>MIME types</emphasis> -- which were originally defined in
    38353854      <ulink url="https://tools.ietf.org/html/rfc2046">RFC 2046</ulink> and
    3836       are also called <emphasis>Content-types</emphasis>.
     3855      are also called <emphasis>Content-types</emphasis> or
     3856      <emphasis>media types</emphasis>.
    38373857      <link linkend="IGuestDnDSource">IGuestDnDSource</link> and
    38383858      <link linkend="IGuestDnDTarget">IGuestDnDTarget</link> support
     
    38653885      removing and enumerating specific formats.
    38663886      <note><para>Registering new or removing default formats on the guest side
    3867       currently is not implemented.</para></note></para>
     3887      is not currently implemented.</para></note></para>
    38683888    </sect1>
    38693889
     
    38743894
    38753895    <para>VirtualBox supports arbitrary external modules to perform
    3876     authentication. The module is used when the authentication method is set
    3877     to "external" for a particular VM VRDE access and the library was
    3878     specified with <computeroutput>VBoxManage setproperty
    3879     vrdeauthlibrary</computeroutput>. Web service also use the authentication
    3880     module which was specified with <computeroutput>VBoxManage setproperty
    3881     websrvauthlibrary</computeroutput>.</para>
     3896    authentication. External authentication modules are used for remote
     3897    desktop access to a VM when the VRDE authentication type is set to
     3898    "external". VRDE authentication will then use the authentication module
     3899    which was specified with
     3900    <computeroutput>VBoxManage setproperty vrdeauthlibrary</computeroutput>.
     3901    The web service will use the external authentication module specified with
     3902    <computeroutput>VBoxManage setproperty websrvauthlibrary</computeroutput>.
     3903    </para>
    38823904
    38833905    <para>This library will be loaded by the VM or web service process on
     
    38853907    or when a client that wants to use the web service logs on.</para>
    38863908
    3887     <para>External authentication is the most flexible as the external handler
    3888     can both choose to grant access to everyone (like the "null"
    3889     authentication method would) and delegate the request to the guest
    3890     authentication component. When delegating the request to the guest
    3891     component, the handler will still be called afterwards with the option to
    3892     override the result.</para>
     3909    <para>External authentication is the most flexible authentication type
     3910    since the external handler can choose to both grant access to everyone
     3911    (like the "null" authentication method) as well as delegate the request to
     3912    the guest authentication component. When delegating the request to the guest
     3913    component the external handler will still be called afterwards with the
     3914    option to override the result.</para>
    38933915
    38943916    <para>An authentication library is required to implement exactly one entry
     
    39463968    consistent binary representation of UUIDs on all platforms. For this
    39473969    reason the integer fields comprising the UUID are stored as little endian
    3948     values. If you want to pass such UUIDs to code which assumes that the
     3970    values. If you want to pass such UUIDs to code which assumes that
    39493971    integer fields are big endian (often also called network byte order), you
    3950     need to adjust the contents of the UUID to e.g. achieve the same string
     3972    need to adjust the contents of the UUID to achieve the same string
    39513973    representation. The required changes are:<itemizedlist>
    39523974        <listitem>
    3953           <para>reverse the order of byte 0, 1, 2 and 3</para>
    3954         </listitem>
    3955 
    3956         <listitem>
    3957           <para>reverse the order of byte 4 and 5</para>
    3958         </listitem>
    3959 
    3960         <listitem>
    3961           <para>reverse the order of byte 6 and 7.</para>
     3975          <para>reverse the order of bytes 0, 1, 2 and 3</para>
     3976        </listitem>
     3977
     3978        <listitem>
     3979          <para>reverse the order of bytes 4 and 5</para>
     3980        </listitem>
     3981
     3982        <listitem>
     3983          <para>reverse the order of bytes 6 and 7.</para>
    39623984        </listitem>
    39633985      </itemizedlist>Using this conversion you will get identical results when
     
    39673989    contains information about the guest authentication status. For the first
    39683990    call, it is always set to
    3969     <computeroutput>AuthGuestNotAsked</computeroutput>. In case the
     3991    <computeroutput>AuthGuestNotAsked</computeroutput>. If the
    39703992    <computeroutput>AuthEntry</computeroutput> function returns
    39713993    <computeroutput>AuthResultDelegateToGuest</computeroutput>, a guest
    39723994    authentication will be attempted and another call to the
    3973     <computeroutput>AuthEntry</computeroutput> is made with its result. This
    3974     can be either granted / denied or no judgement (the guest component chose
    3975     for whatever reason to not make a decision). In case there is a problem
    3976     with the guest authentication module (e.g. the Additions are not installed
    3977     or not running or the guest did not respond within a timeout), the "not
    3978     reacted" status will be returned.</para>
     3995    <computeroutput>AuthEntry</computeroutput> is made with its result.  The
     3996    guest authentication can return either granted, denied, or no judgement
     3997    (the guest component chose for whatever reason to not make a decision).
     3998    In case there is a problem with the guest authentication module (e.g. the
     3999    Guest Additions are not installed or not running or the guest did not
     4000    respond within a timeout), the "not reacted" status will be returned.</para>
    39794001  </chapter>
    39804002
    39814003  <chapter id="javaapi">
    3982     <title>Using Java API</title>
     4004    <title>Using the Java API</title>
    39834005
    39844006    <sect1>
    39854007      <title>Introduction</title>
    39864008
    3987       <para>VirtualBox can be controlled by a Java API, both locally
    3988       (COM/XPCOM) and from remote (SOAP) clients. As with the Python bindings,
     4009      <para>VirtualBox can be controlled by a Java API, both locally using
     4010      COM/XPCOM and remotely using SOAP. As with the Python bindings,
    39894011      a generic glue layer tries to hide all platform differences, allowing
    39904012      for source and binary compatibility on different platforms.</para>
     
    39974019      on the platform. First of all, you need JDK 1.5 (Java 5) or later. Also
    39984020      please make sure that the version of the VirtualBox API .jar file
    3999       exactly matches the version of VirtualBox you use. To avoid confusion,
     4021      exactly matches the version of VirtualBox in use. To avoid confusion,
    40004022      the VirtualBox API provides versioning in the Java package name, e.g.
    40014023      the package is named <computeroutput>org.virtualbox_3_2</computeroutput>
    40024024      for VirtualBox version 3.2. <itemizedlist>
    40034025          <listitem>
    4004             <para><emphasis role="bold">XPCOM</emphasis> - for all platforms,
    4005             but Microsoft Windows. A Java bridge based on JavaXPCOM is shipped
     4026            <para><emphasis role="bold">XPCOM</emphasis> - for all platforms
     4027            except Microsoft Windows. A Java bridge based on JavaXPCOM is shipped
    40064028            with VirtualBox. The classpath must contain
    40074029            <computeroutput>vboxjxpcom.jar</computeroutput> and the
    4008             <computeroutput>vbox.home</computeroutput> property must be set to
     4030            <computeroutput>vbox.home</computeroutput> property must be set to the
    40094031            location where the VirtualBox binaries are. Please make sure that
    4010             the JVM bitness matches bitness of VirtualBox you use as the XPCOM
     4032            the JVM bitness matches the bitness of VirtualBox in use as the XPCOM
    40114033            bridge relies on native libraries.</para>
    40124034
     
    40194041            <para><emphasis role="bold">COM</emphasis> - for Microsoft
    40204042            Windows. We rely on <computeroutput>Jacob</computeroutput> - a
    4021             generic Java to COM bridge - which has to be installed seperately.
     4043            generic Java to COM bridge - which has to be installed separately.
    40224044            See <ulink
    40234045            url="http://sourceforge.net/projects/jacob-project/">http://sourceforge.net/projects/jacob-project/</ulink>
    40244046            for installation instructions. Also, the VirtualBox provided
    4025             <computeroutput>vboxjmscom.jar</computeroutput> must be in the
     4047            <computeroutput>vboxjmscom.jar</computeroutput> file must be in the
    40264048            class path.</para>
    40274049
     
    40324054          <listitem>
    40334055            <para><emphasis role="bold">SOAP</emphasis> - all platforms. Java
    4034             6 is required, as it comes with builtin support for SOAP via the
     4056            6 is required as it comes with built-in support for SOAP via the
    40354057            JAX-WS library. Also, the VirtualBox provided
    40364058            <computeroutput>vbojws.jar</computeroutput> must be in the class
     
    40464068
    40474069      <para>Exception handling is also generalized by the generic glue layer,
    4048       so that all methods could throw
    4049       <computeroutput>VBoxException</computeroutput> containing human-readable
     4070      so that all methods can throw
     4071      <computeroutput>VBoxException</computeroutput> containing a human-readable
    40504072      text message (see <computeroutput>getMessage()</computeroutput> method)
    4051       along with wrapped original exception (see
     4073      along with the wrapped original exception (see
    40524074      <computeroutput>getWrapped()</computeroutput> method).</para>
    40534075    </sect1>
     
    40574079
    40584080      <para>This example shows a simple use case of the Java API. Differences
    4059       for SOAP vs. local version are minimal, and limited to the connection
     4081      for SOAP vs. local execution are minimal and limited to the connection
    40604082      setup phase (see <computeroutput>ws</computeroutput> variable). In the
    40614083      SOAP case it's possible to create several VirtualBoxManager instances to
     
    40844106
    40854107          mgr.cleanup();
    4086         </programlisting> For more a complete example, see
     4108        </programlisting> For a more complete example, see
    40874109      <computeroutput>TestVBox.java</computeroutput>, shipped with the
    4088       SDK. It contains exception handling and error printing code, which
     4110      SDK. It contains exception handling and error printing code which
    40894111      is important for reliable larger scale projects.</para>
    40904112
    40914113      <para>It is good practice in long-running API clients to process the
    4092       system events every now and then in the main thread (does not work
     4114      system events every now and then in the main thread (this does not work
    40934115      in other threads). As a rule of thumb it makes sense to process them
    40944116      every few 100msec to every few seconds). This is done by
     
    40964118        mgr.waitForEvents(0);
    40974119        </programlisting>
    4098       This avoids that a large number of system events accumulate, which can
    4099       need a significant amount of memory, and as they also play a role in
     4120      This helps prevent a large number of system events from accumulating which
     4121      can need a significant amount of memory, and as they also play a role in
    41004122      object cleanup it helps freeing additional memory in a timely manner
    41014123      which is used by the API implementation itself. Java's garbage collection
    41024124      approach already needs more memory due to the delayed freeing of memory
    4103       used by no longer accessible objects, and not processing the system
     4125      used by no longer accessible objects and not processing the system
    41044126      events exacerbates the memory usage. The
    41054127      <computeroutput>TestVBox.java</computeroutput> example code sprinkles
     
    41214143
    41224144    <para>The Java files under
    4123     <computeroutput>bindings/webservice/java/jax-ws/</computeroutput> (library
     4145    <computeroutput>sdk/bindings/webservice/java/jax-ws/</computeroutput> (library
    41244146    files for the object-oriented web service) are, by contrast, licensed
    41254147    under the GNU Lesser General Public License (LGPL) V2.1.</para>
     
    43084330
    43094331        <listitem><para>The webservice version of the <link linkend="ISharedFolder">ISharedFolder</link>
    4310           interface was changed from a struct to a managed object. This causes incompatiblities on the
     4332          interface was changed from a struct to a managed object. This causes incompatibilities on the
    43114333          protocol level as the shared folder attributes are not returned in the responses of
    43124334          <link linkend="IVirtualBox__sharedFolders">IVirtualBox::getSharedFolders</link> and
     
    43264348        <listitem><para>ProcessCreateFlag::NoProfile has been renamed to
    43274349          <link linkend="ProcessCreateFlag__Profile">ProcessCreateFlag::Profile</link>,
    4328           whereas the semantics also has been changed: ProcessCreateFlag::NoProfile
    4329           explicitly <emphasis role="bold">did not</emphasis> utilize the guest user's profile data,
    4330           which in turn <link linkend="ProcessCreateFlag__Profile">ProcessCreateFlag::Profile</link>
    4331           explicitly <emphasis role="bold">does now</emphasis>.</para>
     4350          and the semantics have also been changed: ProcessCreateFlag::NoProfile
     4351          explicitly <emphasis role="bold">did not</emphasis> utilize the guest user's profile data
     4352          whereas <link linkend="ProcessCreateFlag__Profile">ProcessCreateFlag::Profile</link>
     4353          explicitly <emphasis role="bold">does</emphasis> utilize the guest
     4354          user’s profile data.</para>
    43324355        </listitem>
    43334356      </itemizedlist>
    43344357
    43354358    </sect1>
     4359
     4360    <sect1>
     4361      <title>Incompatible API changes with version 5.1.28</title>
     4362
     4363      <itemizedlist>
     4364        <listitem><para>The Host-Guest Communication Manager (HGCM) guest driver
     4365          interfaces were renamed:
     4366          <itemizedlist>
     4367            <listitem><para>VbglHGCMConnect() was renamed to VbglR0HGCMConnect()
     4368            </para></listitem>
     4369            <listitem><para>VbglHGCMDisconnect() was renamed to VbglR0HGCMDisconnect()
     4370            </para></listitem>
     4371            <listitem><para>VbglHGCMCall() was renamed to VbglR0HGCMCall()
     4372            </para></listitem>
     4373          </itemizedlist>
     4374          </para>
     4375        </listitem>
     4376
     4377        <listitem><para>The Host-Guest Communication Manager (HGCM) guest
     4378          application interface IOCTLs were renamed:
     4379          <itemizedlist>
     4380            <listitem><para>VBOXGUEST_IOCTL_HGCM_CONNECT was renamed to
     4381              VBGL_IOCTL_HGCM_CONNECT
     4382            </para></listitem>
     4383            <listitem><para>VBOXGUEST_IOCTL_HGCM_DISCONNECT was renamed to
     4384              VBGL_IOCTL_HGCM_DISCONNECT
     4385            </para></listitem>
     4386            <listitem><para>VBOXGUEST_IOCTL_HGCM_CALL was renamed to
     4387              VBGL_IOCTL_HGCM_CALL
     4388            </para></listitem>
     4389          </itemizedlist>
     4390          </para>
     4391        </listitem>
     4392
     4393      </itemizedlist>
     4394
     4395    </sect1>
     4396
    43364397
    43374398    <sect1>
     
    45184579
    45194580        <listitem><para>IDisplay and IFramebuffer interfaces were changed to
    4520           allow IFramebuffer object to reside in a separate frontend
     4581          allow IFramebuffer object to reside in a separate front-end
    45214582          process:<itemizedlist>
    45224583
     
    48334894          the meaning of the <computeroutput>type</computeroutput> parameter
    48344895          has changed slightly. Empty string now means that the per-VM or
    4835           global default frontend is launched. Most callers of this method
     4896          global default front-end is launched. Most callers of this method
    48364897          should use the empty string now, unless they really want to override
    4837           the default and launch a particular frontend.</para>
     4898          the default and launch a particular front-end.</para>
    48384899        </listitem>
    48394900
     
    49094970          <link linkend="IGuestProcess">IGuestProcess</link> and so on - now
    49104971          emit own events to provide clients much finer control and the ability
    4911           to write own frontends for guest operations. The event
     4972          to write own front-ends for guest operations. The event
    49124973          <link linkend="IGuestSessionEvent">IGuestSessionEvent</link> acts as
    49134974          an abstract base class for all guest control events. Certain guest
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