I'm having issues getting the CopyTo and CopyFrom commands working when using VirtualBox 5.0 or newer (still failing in 5.0.8 ).
For reference, the following code (C#) works fine to copy a file to the guest using 4.3.32:
Code: Select all
IVirtualBox vb = new VirtualBoxClass();
IMachine vm = vb.FindMachine(VM);
Session session = new SessionClass();
vm.LockMachine(session, LockType.LockType_Shared);
IGuestSession guestSession = session.Console.Guest.CreateSession(Username, Password, Domain, "TestSession");
guestSession.WaitForArray(new GuestSessionWaitForFlag[] { GuestSessionWaitForFlag.GuestSessionWaitForFlag_Start }, 0);
IProgress progress = guestSession.CopyTo(HostFileName, GuestFileName, new CopyFileFlag[] { CopyFileFlag.CopyFileFlag_None });
progress.WaitForCompletion(10000);
session.UnlockMachine();
Code: Select all
IVirtualBox vb = new VirtualBoxClass();
IMachine vm = vb.FindMachine(VM);
Session session = new SessionClass();
vm.LockMachine(session, LockType.LockType_Shared);
IGuestSession guestSession = session.Console.Guest.CreateSession(Username, Password, Domain, "TestSession");
guestSession.WaitForArray(new GuestSessionWaitForFlag[] { GuestSessionWaitForFlag.GuestSessionWaitForFlag_Start }, 0);
IProgress progress = guestSession.FileCopyToGuest(HostFileName, GuestFileName, new FileCopyFlag[] { FileCopyFlag.FileCopyFlag_None});
progress.WaitForCompletion(10000);
session.UnlockMachine();
CopyFrom results in much the same case, where the operation seems to complete successfully, but nothing happens except creating a 0-byte file on the host.
I suspect it is an error in VirtualBox itself, since it seems to also affect VboxManage: https://www.virtualbox.org/ticket/14336
I have attached verbose logs from VboxService, but I don't see anything of note in them - it looks like the process is correctly started on the guest but it doesn't receive the command for copying the file.
Can anyone verify that there is a problem?
edit:
I think this line in the log could be telling - it looks like the filename argument does not make it to the guest.
Contrast the line from a working copy in 4.3.32:
Code: Select all
00:00:00.031250 main Request to start process szCmd=vbox_cat, uFlags=0x4, szArgs=--output=C:/temp.txt, szEnv=<None>, uTimeout=30000
Code: Select all
00:00:00.000000 main Request to start process szCmd=vbox_cat, uFlags=0x4, szArgs=, szEnv=<None>, uTimeout=30000