[FIXED in 5.0.18] Problems using IGuestSession.CopyTo and CopyFrom in VB 5.0

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
Magnus Madsen
Posts: 22
Joined: 11. Jun 2013, 08:35
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: WinXP, WinVista, Win7, Win8

[FIXED in 5.0.18] Problems using IGuestSession.CopyTo and CopyFrom in VB 5.0

Post by Magnus Madsen »

Hi,

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();
Meanwhile the (almost) same code run against VirtualBox 5.0.8:

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();
throwns no exception but does not copy to the file to the guest. This problem occurs no matter if the VM is running additions 4.3.32 or 5.0.8.
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
with that from 5.0.8:

Code: Select all

00:00:00.000000 main     Request to start process szCmd=vbox_cat, uFlags=0x4, szArgs=, szEnv=<None>, uTimeout=30000
Attachments
VboxService.7z
(10.8 KiB) Downloaded 35 times
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Problems using IGuestSession.CopyTo and CopyFrom in VB 5

Post by noteirak »

To be honest I don't think there is much to add. I see the issue on my side too. The devs will handle it via the ticket, so keep an eye there for any updates.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Magnus Madsen
Posts: 22
Joined: 11. Jun 2013, 08:35
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: WinXP, WinVista, Win7, Win8

Re: Problems using IGuestSession.CopyTo and CopyFrom in VB 5

Post by Magnus Madsen »

The error is still present in 5.0.10 unfortunately.
pentagonik
Oracle Corporation
Posts: 283
Joined: 19. May 2008, 16:09
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Too many to specify!
Contact:

Re: Problems using IGuestSession.CopyTo and CopyFrom in VB 5.0

Post by pentagonik »

Please re-try with latest 5.0.18. Also keep in mind that the 5.0.18 Guest Additions needs to be installed. Thanks.
frank
Oracle Corporation
Posts: 3362
Joined: 7. Jun 2007, 09:11
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows
Location: Dresden, Germany
Contact:

Re: Problems using IGuestSession.CopyTo and CopyFrom in VB 5.0

Post by frank »

More fixes in the most recent 5.0 test builds (>= revision 106900).
Magnus Madsen
Posts: 22
Joined: 11. Jun 2013, 08:35
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: WinXP, WinVista, Win7, Win8

Re: Problems using IGuestSession.CopyTo and CopyFrom in VB 5.0

Post by Magnus Madsen »

Yes, as per 5.0.18 CopyTo and CopyFrom are working again - thank you!

It doesn't seem like the Guest Additions need to be updated for it to work either; at least 5.0.16 works too.
pentagonik
Oracle Corporation
Posts: 283
Joined: 19. May 2008, 16:09
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Too many to specify!
Contact:

Re: Problems using IGuestSession.CopyTo and CopyFrom in VB 5.0

Post by pentagonik »

Great, glad it works for you now -- thanks for the feedback.
Post Reply