func (v *VM) AddSharedFolder(guestpath, hostpath string, flags SharedFolderOption) error {
	var jobHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK

	gpath := C.CString(guestpath)
	hpath := C.CString(hostpath)
	defer C.free(unsafe.Pointer(gpath))
	defer C.free(unsafe.Pointer(hpath))

	jobHandle = C.VixVM_AddSharedFolder(v.handle,
		gpath,
		hpath,
		C.VixMsgSharedFolderOptions(flags),
		nil, nil)

	defer C.Vix_ReleaseHandle(jobHandle)

	err = C.vix_job_wait(jobHandle)
	if C.VIX_OK != err {
		return &Error{
			Operation: "vm.AddSharedFolder",
			Code:      int(err & 0xFFFF),
			Text:      C.GoString(C.Vix_GetErrorText(err, nil)),
		}
	}

	return nil
}
func (v *VM) AddSharedFolder(guestpath, hostpath string, flags SharedFolderOption) error {
	var jobHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK

	gpath := C.CString(guestpath)
	hpath := C.CString(hostpath)
	defer C.free(unsafe.Pointer(gpath))
	defer C.free(unsafe.Pointer(hpath))

	jobHandle = C.VixVM_AddSharedFolder(v.handle,
		gpath,
		hpath,
		C.VixMsgSharedFolderOptions(flags),
		nil, nil)

	defer C.Vix_ReleaseHandle(jobHandle)

	err = C.vix_job_wait(jobHandle)
	if C.VIX_OK != err {
		return &Error{
			Operation: "vm.AddSharedFolder",
			Code:      int(err & 0xFFFF),
			Text:      C.GoString(C.Vix_GetErrorText(err, nil)),
		}
	}

	return nil
}
// AddSharedFolder mounts a new shared folder in the virtual machine.
//
// Parameters:
//
//   guestpath: Specifies the guest path name of the new shared folder.
//   hostpath: Specifies the host path of the shared folder.
//   flags: The folder options.
//
// Remarks:
//
//   * This function creates a local mount point in the guest file system and
//     mounts a shared folder exported by the host.
//
//   * Shared folders will only be accessible inside the guest operating system
//     if shared folders are enabled for the virtual machine.
//     See the documentation for VM.EnableSharedFolders().
//
//   * The folder options include: SHAREDFOLDER_WRITE_ACCESS - Allow write access.
//
//   * Only absolute paths should be used for files in the guest; the resolution
//     of relative paths is not specified.
//
//   * The hostpath argument must specify a path to a directory that exists on the
//     host, or an error will result.
//
//   * If a shared folder with the same name exists before calling this function,
//     the job handle returned by this function will return VIX_E_ALREADY_EXISTS.
//
//   * It is not necessary to call VM.LoginInGuest() before calling this function.
//
//   * When creating shared folders in a Windows guest, there might be a delay
//     before contents of a shared folder are visible to functions such as
//     Guest.IsFile() and Guest.RunProgram().
//
//   * Shared folders are not supported for the following guest operating
//     systems: Windows ME, Windows 98, Windows 95, Windows 3.x, and DOS.
//
//   * In this release, this function requires the virtual machine to be powered
//     on with VMware Tools installed.
//
//   * To determine in which directory in the guest the shared folder will be,
//     query Guest.SharedFoldersParentDir(). When the virtual machine is powered
//     on and the VMware Tools are running, this property will contain the path to
//     the parent directory of the shared folders for that virtual machine.
//
// Since VMware Workstation 6.0, not available on Server 2.0.
//