Example #1
0
// SetLogoFadeIn sets whether the BIOS logo fades in during boot.
// It any error encountered.
func (settings *BiosSettings) SetLogoFadeIn(logoFadeIn bool) error {
	clogoFadeIn := C.PRBool(0)
	if logoFadeIn {
		clogoFadeIn = C.PRBool(1)
	}
	result := C.GoVboxSetBiosSettingsLogoFadeIn(settings.csettings, clogoFadeIn)
	if C.GoVboxFAILED(result) != 0 {
		return errors.New(
			fmt.Sprintf("Failed to set IBiosSettings logoFadeIn: %x", result))
	}
	return nil
}
Example #2
0
// UnmountMedium ejects a removable Medium from this VM.
// It returns any error encountered.
func (machine *Machine) UnmountMedium(controllerName string,
	controllerPort int, deviceSlot int, force bool) error {
	cforce := C.PRBool(0)
	if force {
		cforce = C.PRBool(1)
	}

	cname := C.CString(controllerName)
	result := C.GoVboxMachineUnmountMedium(machine.cmachine, cname,
		C.PRInt32(controllerPort), C.PRInt32(deviceSlot), cforce)
	C.free(unsafe.Pointer(cname))

	if C.GoVboxFAILED(result) != 0 {
		return errors.New(
			fmt.Sprintf("Failed to unmount medium from IMachine: %x", result))
	}
	return nil
}
Example #3
0
// OpenMedium opens an image backing a VirtualBox storage medium.
// It returns the newly opened Medium and any error encountered.
func OpenMedium(location string, deviceType DeviceType, accessMode AccessMode,
	forceNewUuid bool) (Medium, error) {
	var medium Medium
	if err := Init(); err != nil {
		return medium, err
	}

	clocation := C.CString(location)
	cforceNewUuid := C.PRBool(0)
	if forceNewUuid {
		cforceNewUuid = C.PRBool(1)
	}
	result := C.GoVboxOpenMedium(cbox, clocation, C.PRUint32(deviceType),
		C.PRUint32(accessMode), cforceNewUuid, &medium.cmedium)
	C.free(unsafe.Pointer(clocation))

	if C.GoVboxFAILED(result) != 0 || medium.cmedium == nil {
		return medium, errors.New(
			fmt.Sprintf("Failed to open IMedium: %x", result))
	}
	return medium, nil
}