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

Magnus Madsen madsen.magnus at gmail.com
Fri May 31 11:05:07 GMT 2013

LeeEll <info at ...> writes:

> I have change the code so i execute ipconfig directly (not via cmd.exe) 
> but i can't get the output from it.

> I don't understand why this happens. The output type for Read method is 
> System.Array.
> I really need help with this!!!!!!!!

Hi LeeEll,
Are you still having issues with this problem?

I've been working on utilizing the VirtualBox interface through .NET, 
and was not able to find much information on it.

Please let me know if I should elaborate, but I can let you know that it 
to my knowledge, simply not possible to directly access those functions in 
VirtualBox API that return binary data as an array from .NET. 
I am not entirely sure why, but the SafeArray type returned cannot be 
marshalled correctly.

What I ended up doing was writing a simple wrapper in unmanaged C++ to 
a new "normal" SafeArray of bytes and returning that to my .NET application.

Using the wrapper I was able to successfully return output data from a 
I've created from the host. I haven't tried sending input to a process, but 
looking at IProcess::write it requires the same kind of parameter:

[in] unsigned long handle,
[in] unsigned long flags,
[in] octet data[],
[in] unsigned long timeoutMS)

Therefore it is probably also not possible to send data to a process 
using a wrapper. 
Let me know if you want the source for the wrapper; it's quite simple.

Kind regards,

More information about the vbox-dev mailing list