Im currently trying to build a process that'll start up a Virtual Machine, opens the IE with a specific Adress and makes a Screenshot. I got the complete code running, but I'm simply not able to create the process on the Guest machine.
Code: Select all
ISession session = mgr.getSessionObject();
machine.lockMachine(session, LockType.Shared);
IConsole console = session.getConsole();
IGuest guest = console.getGuest();
Long time = 50L;
IGuestProcess gp = null;
System.out.println("Logging into Guest System");
IGuestSession gs = guest.createSession("IEUser", "Passw0rd!", "", "");
System.out.println("Hoping to be accepted...");
GuestSessionWaitResult result = gs.waitFor(1L, time);
if(result == GuestSessionWaitResult.Start){
System.out.println("Guest Session is " + gs.getStatus());
System.out.println("Got accepted!");
Adress = "\"" + Adress + "\"";
System.out.println("Starting IE with Adress: " + Adress);
String iexplore = "\"C:\\Program Files\\Internet Explorer\\iexplore.exe\"";
//String iexplore = "\"C:\\Program/ Files\\Internet/ Explorer\\iexplore.exe\"";
//String iexplore = "C:\\Program/ Files\\Internet/ Explorer\\iexplore.exe";
System.out.println("Console Call will be: " + iexplore + " " + Adress);
List<String> arguments = new ArrayList<>();
arguments.add(Adress);
gp = gs.processCreate(iexplore, arguments, null, null, 0L);
System.out.println("Started the process");
List<IGuestProcess> gps = new ArrayList<>();
gps = gs.getProcesses();
for(int i=0;i<gps.size();i++){
IGuestProcess gp_foo = gps.get(i);
System.out.print("Name: " + gp_foo.getName() + " ");
System.out.print("Ex. Path: " + gp_foo.getExecutablePath() + " ");
System.out.print("PID: " + gp_foo.getPID() + " ");
System.out.println("Status: " + gp_foo.getStatus());
}
List<ProcessWaitForFlag> foo = new ArrayList<>();
foo.add(ProcessWaitForFlag.Start);
ProcessWaitResult waitResult = gp.waitForArray(foo, 0L);
if(waitResult == ProcessWaitResult.Start){
System.out.println("Process Load finished");
}
}
Code: Select all
Exception in thread "main" org.virtualbox_5_0.VBoxException: The function "waitForArray" returned an error condition: "The specified file is an invalid name" (0x80bb0005)
at org.virtualbox_5_0.IProcess.waitForArray(IProcess.java:165)
at virtualbox_local_getscreenfromurl.VirtualBox_Local_GetScreenFromUrl.openURLinIEandSaveToPath(VirtualBox_Local_GetScreenFromUrl.java:125)
at virtualbox_local_getscreenfromurl.VirtualBox_Local_GetScreenFromUrl.main(VirtualBox_Local_GetScreenFromUrl.java:56)
Caused by: org.mozilla.xpcom.XPCOMException: The function "waitForArray" returned an error condition: "The specified file is an invalid name" (0x80bb0005)
at org.mozilla.xpcom.internal.XPCOMJavaProxy.callXPCOMMethod(Native Method)
at org.mozilla.xpcom.internal.XPCOMJavaProxy.invoke(XPCOMJavaProxy.java:143)
at com.sun.proxy.$Proxy11.waitForArray(Unknown Source)
at org.virtualbox_5_0.IProcess.waitForArray(IProcess.java:160)
... 2 more
Java Result: 1
I also tried to start other programs, like cmd.exe - no success either.
Hope you can help out!
PS: I'm using the Windows 7 Developer VM from Microsoft with IE8 preinstalled.