[vbox-dev] COM API ProcessCreate and GuestProcess.Write

Nikolay Igotti igotti at gmail.com
Sun Jun 2 23:38:56 PDT 2013

Does it work for bytes with value >= 128 in the stream?
To fix this issue properly you may try to fix XSLT IDL generators for 
COM case.


02.06.2013 18:38, Magnus Madsen пишет:
> Ivo Smits <Ivo at ...> writes:
>> After hours of experimenting (why!?!?!?), I think the problem is
>> somewhere in the IDispatch implementation. The Interop assembly
>> generated by VS2008 appears to use te IDispatch interface to call
>> VirtualBox functions. I think the Interop assembly expects an array of
>> unsigned bytes on the .Net side, while VirtualBox uses signed bytes...
>> So, after some crashes of both my own code and the VirtualBox VM, I came
>> up with the attached C# code:
>> - Standard output works, although it is ugly and unreliable with the
>> timed wait
>> - Standard input hangs the VM process. Be careful with this, you may
>> have to kill the running VM! If VBox hangs here, you may still shut down
>> the guest OS via remote desktop, and VBox will get stuck in the Stopping
>> state. Bug report?
>> Ivo
> Aha; Thank you for this insight - it enabled me to get rid of the wrapper by
> using a custom Interop assembly.
> For anyone else who wishes to use it, this is the process I found the
> easiest:
> * Use TlbImp to generate an interop DLL from VirtualBox.tlb
> * Use IlDAsm to generate an MSIL source code file from the dll.
> * Edit the MSIL and replace "marshal (safearray unsigned int8)" with
>    just "(safearray int8)".
> * Use IlAsm to generate a new DLL from the edited MSIL.
> I haven't tested it thoroughly, but it does seem to work for reading from
> processes and getting screenshots at least - two things that didn't work
> before without using my wrapper.
> Kind regards,
> Magnus
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> https://www.virtualbox.org/mailman/listinfo/vbox-dev

More information about the vbox-dev mailing list