Here is the code I am using to try and execute a program in a Windows XP VM (vm is set earlier by call to search_vm()):
Code:
guest = prlsdkapi.VmGuest(vm.handle)
hArgsList = prlsdkapi.StringList()
hArgsList.add_item("www.google.com")
hEnvsList = prlsdkapi.StringList()
hEnvsList.add_item("")
guest.run_program("iexplore.exe", hArgsList, hEnvsList)
This takes me to prlsdkapi/__init__.py line 4641:
Code:
4637 def run_program(self, sAppName, hArgsList, hEnvsList, nFlags = consts.PRPM_RUN_PROGRAM_AND_RETURN_IMMEDIATELY, nStdin = consts.PRL_INVALID_FILE_DESCRIPTOR, nStdout = consts.PRL_INVALID_FILE_DESCRIPTOR, nStderr = consts.PRL_INVALID_FILE_DESCRIPTOR):
4638 """
4639 Execute a program in a virtual machine.
4640 """
4641 return Job(SDK.PrlVmGuest_RunProgram(self.handle, sAppName, conv_handle_arg(hArgsList), conv_handle_arg(hEnvsList), nFlags, nStdin, nStdout, nStderr)[0])
Next I see two calls to conv_handle_arg(), as expected, and then it goes to prlsdkapi/__init__.py line 227:
Code:
224 class _Handle(object):
225
226 def __init__(self, handle = consts.PRL_INVALID_HANDLE):
227 self.handle = handle
228 self.id = deinit_sdk.id
229 if self.__class__ is _Handle:
230 raise TypeError, 'class _Handle is a private class'
And returns after line 229. I can't trace through the actual call to SDK.PrlVmGuest_RunProgram, which resolves to:
Code:
SDK = <module 'prlsdkapi.prlsdk' from '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/prlsdkapi/prlsdk.so'>
I see nothing happening in the guest, and the return from the run_program() call is immediate. Any suggestions?
Edit: In addition to the default (PRPM_RUN_PROGRAM_AND_RETURN_IMMEDIATELY) I also tried:
PRPM_RUN_PROGRAM_ENTER -- return from function call is still immediate
PRPM_RUN_PROGRAM_IN_SHELL