<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Norbert,<br>
    <br>
    <div class="moz-cite-prefix">On 01.07.2018 23:29, Szatmári Norbert
      Péter wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAPyn-JrCfsSyCFKM9kK__duKvd5YNQEXZsbSiH=Cps2UVhLMQw@mail.gmail.com">
      <div dir="ltr">
        <div>Hello,</div>
        <div>I'm developing a Java frontend for VirtualBox machines and
          I managed to set it up to launch the machine inside the
          process and attach my framebuffer to it. It's receiving
          changes and updates, queryBitmapInfo returns all information
          correctly, except for the address out parameter.</div>
        <div><br>
        </div>
        <div>The array I'm using to hold the value is large enough for
          the whole screen but all of the values in the array remain 0,
          even after the machine has booted up and is running the guest
          OS. VirtualBox also seems to freeze for some seconds while the
          machine is running inside my application.</div>
        <div>(I'm also running my program as root as I was unable to set
          the setuid bit up correctly, but I don't have any issues
          running VBox as root, so I don't think it's related.)</div>
        <br>
        How can I receive images from the machine in Java?<br>
      </div>
    </blockquote>
    <br>
    Right now? You don't. JXPCOM simply can't deal with such parameters.
    Possibly fixable, didn't investigate if there are technical issues
    with implementing "out" parameters of type "byte ptr". The code for
    handling the various 'out' parameter passing cases is in
    src/libs/xpcom18a4/java/src/nsJavaWrapper.cpp, function
    FinalizeParams (which is called from Java through the JNI function
    callXPCOMMethod in the same file). The 'in' case is in SetupParams.<br>
    <br>
    Apparently so far no one needed to call methods with pointer
    parameters.<br>
    <br>
    Klaus<br>
    <br>
    <blockquote type="cite"
cite="mid:CAPyn-JrCfsSyCFKM9kK__duKvd5YNQEXZsbSiH=Cps2UVhLMQw@mail.gmail.com">
      <div dir="ltr">VirtualBox version: 5.2.12 r122591 (Qt5.9.5)<br>
        VBox API: Java XPCOM 5.2<br>
        OS: Ubuntu 18.04 x64, Java 8<br>
        <br>
        My code in notifyChange:<br>
        <dl class="gmail-codebox">
          <dd><code>display.querySourceBitmap(0L, holder);<br>
              byte[] arr = bb.array(); //640 * 480 * 4 bytes backing a
              ByteBuffer<br>
              long[] w = new long[1], h = new long[1], bpp = new
              long[1], bpl = new long[1], pf = new long[1];<br>
              holder.value.getTypedWrapped().queryBitmapInfo(arr, w, h,
              bpp, bpl, pf);<br>
              System.out.println("Arr0:" + arr[0]); //Returns 0<br>
              System.out.println("whbppbplpf: " + w[0] + " " + h[0] + "
              " + bpp[0] + " " + bpl[0] + " " + pf[0]); //Returns
              correct values<br>
            </code></dd>
        </dl>
        <div>Regards,</div>
        <div>Norbert
        </div>
      </div>
      <br>
    </blockquote>
  </body>
</html>