A SERVICE OF

logo

CHAPTER 4 Operations on Virtual Machines
41
RC1
}
Vix_ReleaseHandle(jobHandle);
// Power on the virtual machine before copying file.
jobHandle = VixVM_PowerOn(vmHandle,
0, // powerOnOptions
VIX_INVALID_HANDLE, // propertyListHandle
NULL, // callbackProc
NULL); // clientData
err = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);
if (VIX_OK != err) {
// Handle the error...
goto abort;
}
Vix_ReleaseHandle(jobHandle);
// Assume autologon is configured in guest.
// Wait until guest is completely booted.
jobHandle = VixVM_WaitForToolsInGuest(vmHandle,
300, // timeoutInSeconds
NULL, // callbackProc,
NULL); // clientData
err = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);
if (VIX_OK != err) {
// Handle the error...
goto abort;
}
Vix_ReleaseHandle(jobHandle);
// Copy a file.
jobHandle = VixVM_CopyFileFromHostToGuest(vmHandle,
"c:\\hostDir\\helloworld.c", // src name
"c:\\guestDir\\helloworld.c", // dest name
0, // options
VIX_INVALID_HANDLE, // propertyList
NULL, // callbackProc
NULL); // clientData
err = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);
if (VIX_OK != err) {
// Handle the error...
goto abort;
}
abort:
Vix_ReleaseHandle(jobHandle);
Vix_ReleaseHandle(vmHandle);
VixHost_Disconnect(hostHandle);