[vbox-dev] queryBitmapInfo in Java API returns no image address

Szatmári Norbert Péter szatmari.norbert.peter at gmail.com
Mon Jul 2 20:08:55 GMT 2018


Hi Klaus,

Is casting the pointer to a byte (and sending it the same way as T_I8) not
a good solution to this? As the Java API already uses the byte type.
Could it cause issues? (I'm not very experienced with C++.)
Using the Pointer class in JNA I believe I could work with a byte or int
value.

Thanks,
Norbert


Date: Mon, 2 Jul 2018 13:46:57 +0200
> From: Klaus Espenlaub <klaus.espenlaub at oracle.com>
> To: vbox-dev at virtualbox.org
> Subject: Re: [vbox-dev] queryBitmapInfo in Java API returns no image
>         address
> Message-ID: <8f996c78-330d-efec-c92c-4e54081decce at oracle.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Norbert,
>
> On 01.07.2018 23:29, Szatm?ri Norbert P?ter wrote:
> > Hello,
> > 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.
> >
> > 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.
> > (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.)
> >
> > How can I receive images from the machine in Java?
>
> 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.
>
> Apparently so far no one needed to call methods with pointer parameters.
>
> Klaus
>
> > VirtualBox version: 5.2.12 r122591 (Qt5.9.5)
> > VBox API: Java XPCOM 5.2
> > OS: Ubuntu 18.04 x64, Java 8
> >
> > My code in notifyChange:
> >
> >     |display.querySourceBitmap(0L, holder);
> >     byte[] arr = bb.array(); //640 * 480 * 4 bytes backing a ByteBuffer
> >     long[] w = new long[1], h = new long[1], bpp = new long[1], bpl =
> >     new long[1], pf = new long[1];
> >     holder.value.getTypedWrapped().queryBitmapInfo(arr, w, h, bpp,
> >     bpl, pf);
> >     System.out.println("Arr0:" + arr[0]); //Returns 0
> >     System.out.println("whbppbplpf: " + w[0] + " " + h[0] + " " +
> >     bpp[0] + " " + bpl[0] + " " + pf[0]); //Returns correct values
> >     |
> >
> > Regards,
> > Norbert
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20180702/df9ed382/attachment.html>


More information about the vbox-dev mailing list