func (v *VM) SnapshotByName(name string) (*Snapshot, error) {
	var snapshotHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK

	sname := C.CString(name)
	defer C.free(unsafe.Pointer(sname))

	err = C.VixVM_GetNamedSnapshot(v.handle, sname, &snapshotHandle)
	if C.VIX_OK != err {
		return nil, &Error{
			Operation: "vm.SnapshotByName",
			Code:      int(err & 0xFFFF),
			Text:      C.GoString(C.Vix_GetErrorText(err, nil)),
		}
	}

	snapshot := &Snapshot{handle: snapshotHandle}

	// FIXME(c4milo): Replace with cleanUp function as we've done for VM and Host.
	runtime.SetFinalizer(snapshot, cleanupSnapshot)

	return snapshot, nil
}
func (v *VM) SnapshotByName(name string) (*Snapshot, error) {
	var snapshotHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK

	sname := C.CString(name)
	defer C.free(unsafe.Pointer(sname))

	err = C.VixVM_GetNamedSnapshot(v.handle, sname, &snapshotHandle)
	if C.VIX_OK != err {
		return nil, &Error{
			Operation: "vm.SnapshotByName",
			Code:      int(err & 0xFFFF),
			Text:      C.GoString(C.Vix_GetErrorText(err, nil)),
		}
	}

	snapshot := &Snapshot{handle: snapshotHandle}

	// FIXME(c4milo): Replace with cleanUp function as we've done for VM and Host.
	runtime.SetFinalizer(snapshot, cleanupSnapshot)

	return snapshot, nil
}
// SnapshotByName returns a Snapshot object matching the given name.
//
// Parameters:
//
//   name: Identifies a snapshot name.
//
// Remarks:
//
//   * When the snapshot name is a duplicate, it returns error 13017
//     VIX_E_SNAPSHOT_NONUNIQUE_NAME.
//
//   * When there are multiple snapshots with the same name, or the same path to
//     that name, you cannot specify a unique name, but you can to use the UI to
//     rename duplicates.
//
//   * You can specify the snapshot name as a path using '/' or '\\' as path
//     separators, including snapshots in the tree above the named snapshot,
//     for example 'a/b/c' or 'x/x'. Do not mix '/' and '\\' in the same path
//     expression.
//
//   * This function is not supported when using the VMWARE_PLAYER provider.
//
// Since VMware Workstation 6.0
//