├── lib ├── resourcestore.cpp ├── eventlistener.cpp ├── guestkeyboardevent.cpp ├── token.cpp ├── stringarray.cpp ├── languagechangedevent.cpp ├── reusableevent.cpp ├── snapshotevent.cpp ├── guestdebugcontrolchangedevent.cpp ├── showwindowevent.cpp ├── usbproxybackend.cpp ├── extpackinstalledevent.cpp ├── runtimeerrorevent.cpp ├── keyboardledschangedevent.cpp ├── hostvideoinputdevice.cpp ├── datastream.cpp ├── cpuchangedevent.cpp ├── cpuprofile.cpp ├── clipboardevent.cpp ├── cursorpositionchangedevent.cpp ├── guestfileioevent.cpp ├── extpackplugin.cpp ├── emulatedusb.cpp ├── hostpcideviceplugevent.cpp ├── pcideviceattachment.cpp ├── trustedplatformmodule.cpp ├── guestuserstatechangedevent.cpp ├── virtualboxclient.cpp ├── mediumevent.cpp ├── event.cpp ├── guestprocessioevent.cpp ├── usbcontroller.cpp ├── modechangedevent.cpp ├── progressevent.cpp ├── bandwidthgroup.cpp ├── cloudproviderevent.cpp ├── audiosettings.cpp ├── hostaudiodevicechangedevent.cpp ├── nvramstore.cpp ├── cloudprofileevent.cpp ├── additionsfacility.cpp ├── guestmouseevent.cpp ├── virtualboxerrorinfo.cpp ├── framebufferoverlay.cpp ├── extradatachangedevent.cpp ├── guestprocessevent.cpp ├── guestsessionevent.cpp ├── updateagentevent.cpp ├── session.cpp ├── statechangedevent.cpp ├── usbdevicefilters.cpp ├── displaysourcebitmap.cpp ├── pciaddress.cpp ├── dndbase.cpp ├── dhcpgroupcondition.cpp ├── recordingevent.cpp ├── mousepointershapechangedevent.cpp ├── mousecapabilitychangedevent.cpp ├── mousepointershape.cpp ├── updateagentavailableevent.cpp ├── parallelport.cpp ├── form.cpp ├── internalprogresscontrol.cpp ├── vetoevent.cpp ├── hostdrive.cpp ├── dndsource.cpp ├── keyboard.cpp ├── natredirectevent.cpp ├── guestmultitouchevent.cpp ├── performancemetric.cpp ├── guestadditionsstatuschangedevent.cpp ├── cloudprovidermanager.cpp ├── bandwidthcontrol.cpp ├── guestfileevent.cpp ├── guestmonitorchangedevent.cpp ├── guestdebugcontrol.cpp ├── guestdirectoryevent.cpp ├── errorwrap.cpp ├── guestscreeninfo.cpp ├── machineevent.cpp ├── eventsource.cpp ├── hostonlynetwork.cpp ├── recordingsettings.cpp ├── sharedfolder.cpp ├── directory.cpp ├── snapshot.cpp ├── mediumformat.cpp ├── extpackmanager.cpp ├── mediumattachment.cpp ├── cloudprofile.cpp ├── fsinfo.cpp ├── mediumio.cpp ├── graphicsadapter.cpp ├── storagecontroller.cpp ├── serialport.cpp └── vfsexplorer.cpp ├── cmake └── check_nscleanup.cpp ├── include ├── libvbox_vboxsdk_version.h.in └── libvbox.h └── libvbox-config.cmake /lib/resourcestore.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2024 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 22 | COM_WRAP_IFC(IResourceStore) 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /cmake/check_nscleanup.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | int main() 23 | { 24 | NS_ShutdownXPCOM(nsnull); 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /lib/eventlistener.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IEventListener) 22 | 23 | void VBox::IEventListener::handleEvent(const COMPtr &event) 24 | { 25 | auto rc = get_IFC()->HandleEvent(event->get_IFC()); 26 | COM_ERROR_CHECK(rc); 27 | } 28 | -------------------------------------------------------------------------------- /lib/guestkeyboardevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IGuestKeyboardEvent) 22 | 23 | std::vector VBox::IGuestKeyboardEvent::scancodes() const 24 | { 25 | std::vector result; 26 | COM_GetArray(get_IFC(), Scancodes, COM_Long, result); 27 | return result; 28 | } 29 | -------------------------------------------------------------------------------- /lib/token.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IToken) 22 | 23 | void VBox::IToken::abandon() 24 | { 25 | auto rc = get_IFC()->Abandon(); 26 | COM_ERROR_CHECK(rc); 27 | } 28 | 29 | void VBox::IToken::dummy() 30 | { 31 | auto rc = get_IFC()->Dummy(); 32 | COM_ERROR_CHECK(rc); 33 | } 34 | -------------------------------------------------------------------------------- /lib/stringarray.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 1, 0) 22 | COM_WRAP_IFC(IStringArray) 23 | 24 | std::vector VBox::IStringArray::values() const 25 | { 26 | std::vector result; 27 | COM_GetStringArray(get_IFC(), Values, result); 28 | return result; 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /lib/languagechangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(ILanguageChangedEvent) 23 | 24 | std::u16string VBox::ILanguageChangedEvent::languageId() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), LanguageId, result); 28 | return result; 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /lib/reusableevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IReusableEvent) 22 | 23 | uint32_t VBox::IReusableEvent::generation() const 24 | { 25 | COM_ULong result; 26 | COM_GetValue(get_IFC(), Generation, result); 27 | return static_cast(result); 28 | } 29 | 30 | void VBox::IReusableEvent::reuse() 31 | { 32 | auto rc = get_IFC()->Reuse(); 33 | COM_ERROR_CHECK(rc); 34 | } 35 | -------------------------------------------------------------------------------- /lib/snapshotevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(ISnapshotEvent) 22 | COM_WRAP_IFC(ISnapshotTakenEvent) 23 | COM_WRAP_IFC(ISnapshotDeletedEvent) 24 | COM_WRAP_IFC(ISnapshotRestoredEvent) 25 | COM_WRAP_IFC(ISnapshotChangedEvent) 26 | 27 | std::u16string VBox::ISnapshotEvent::snapshotId() const 28 | { 29 | std::u16string result; 30 | COM_GetString(get_IFC(), SnapshotId, result); 31 | return result; 32 | } 33 | -------------------------------------------------------------------------------- /lib/guestdebugcontrolchangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(IGuestDebugControlChangedEvent) 23 | 24 | VBox::COMPtr 25 | VBox::IGuestDebugControlChangedEvent::guestDebugControl() const 26 | { 27 | COMPtr result; 28 | COM_GetValue_Wrap(get_IFC(), GuestDebugControl, result); 29 | return result; 30 | } 31 | #endif 32 | -------------------------------------------------------------------------------- /lib/showwindowevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(ICanShowWindowEvent) 22 | COM_WRAP_IFC(IShowWindowEvent) 23 | 24 | int64_t VBox::IShowWindowEvent::winId() const 25 | { 26 | COM_Long64 result; 27 | COM_GetValue(get_IFC(), WinId, result); 28 | return static_cast(result); 29 | } 30 | 31 | void VBox::IShowWindowEvent::set_winId(int64_t value) 32 | { 33 | COM_SetValue(get_IFC(), WinId, static_cast(value)); 34 | } 35 | -------------------------------------------------------------------------------- /lib/usbproxybackend.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(5, 1, 0) 22 | COM_WRAP_IFC(IUSBProxyBackend) 23 | 24 | std::u16string VBox::IUSBProxyBackend::name() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), Name, result); 28 | return result; 29 | } 30 | 31 | std::u16string VBox::IUSBProxyBackend::type() const 32 | { 33 | std::u16string result; 34 | COM_GetString(get_IFC(), Type, result); 35 | return result; 36 | } 37 | #endif 38 | -------------------------------------------------------------------------------- /lib/extpackinstalledevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2024 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 22 | COM_WRAP_IFC(IExtPackInstalledEvent) 23 | COM_WRAP_IFC(IExtPackUninstalledEvent) 24 | 25 | std::u16string VBox::IExtPackInstalledEvent::name() const 26 | { 27 | std::u16string result; 28 | COM_GetString(get_IFC(), Name, result); 29 | return result; 30 | } 31 | 32 | std::u16string VBox::IExtPackUninstalledEvent::name() const 33 | { 34 | std::u16string result; 35 | COM_GetString(get_IFC(), Name, result); 36 | return result; 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /lib/runtimeerrorevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IRuntimeErrorEvent) 22 | 23 | bool VBox::IRuntimeErrorEvent::fatal() const 24 | { 25 | COM_Bool result; 26 | COM_GetValue(get_IFC(), Fatal, result); 27 | return result; 28 | } 29 | 30 | std::u16string VBox::IRuntimeErrorEvent::id() const 31 | { 32 | std::u16string result; 33 | COM_GetString(get_IFC(), Id, result); 34 | return result; 35 | } 36 | 37 | std::u16string VBox::IRuntimeErrorEvent::message() const 38 | { 39 | std::u16string result; 40 | COM_GetString(get_IFC(), Message, result); 41 | return result; 42 | } 43 | -------------------------------------------------------------------------------- /lib/keyboardledschangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IKeyboardLedsChangedEvent) 22 | 23 | bool VBox::IKeyboardLedsChangedEvent::numLock() const 24 | { 25 | COM_Bool result; 26 | COM_GetValue(get_IFC(), NumLock, result); 27 | return result; 28 | } 29 | 30 | bool VBox::IKeyboardLedsChangedEvent::capsLock() const 31 | { 32 | COM_Bool result; 33 | COM_GetValue(get_IFC(), CapsLock, result); 34 | return result; 35 | } 36 | 37 | bool VBox::IKeyboardLedsChangedEvent::scrollLock() const 38 | { 39 | COM_Bool result; 40 | COM_GetValue(get_IFC(), ScrollLock, result); 41 | return result; 42 | } 43 | -------------------------------------------------------------------------------- /lib/hostvideoinputdevice.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IHostVideoInputDevice) 22 | 23 | std::u16string VBox::IHostVideoInputDevice::name() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Name, result); 27 | return result; 28 | } 29 | 30 | std::u16string VBox::IHostVideoInputDevice::path() const 31 | { 32 | std::u16string result; 33 | COM_GetString(get_IFC(), Path, result); 34 | return result; 35 | } 36 | 37 | std::u16string VBox::IHostVideoInputDevice::alias() const 38 | { 39 | std::u16string result; 40 | COM_GetString(get_IFC(), Alias, result); 41 | return result; 42 | } 43 | -------------------------------------------------------------------------------- /lib/datastream.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 22 | COM_WRAP_IFC(IDataStream) 23 | 24 | uint32_t VBox::IDataStream::readSize() const 25 | { 26 | COM_ULong result; 27 | COM_GetValue(get_IFC(), ReadSize, result); 28 | return static_cast(result); 29 | } 30 | 31 | std::vector VBox::IDataStream::read(uint32_t size, uint32_t timeoutMS) 32 | { 33 | COM_ArrayProxy pResult; 34 | 35 | auto rc = get_IFC()->Read(size, timeoutMS, COM_ArrayParameterRef(pResult)); 36 | COM_ERROR_CHECK(rc); 37 | 38 | std::vector result; 39 | pResult.toVector(result); 40 | return result; 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /include/libvbox_vboxsdk_version.h.in: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #ifndef _LIBVBOX_VBOXSDK_VERSION_H 20 | #define _LIBVBOX_VBOXSDK_VERSION_H 21 | 22 | #define VBox_MAKE_VERSION(major, minor, patch) \ 23 | ((major) << 16 | (minor) << 8 | (patch)) 24 | 25 | #define VirtualBoxSDK_VERSION VBox_MAKE_VERSION(@VirtualBoxSDK_VERSION_MAJOR@, @VirtualBoxSDK_VERSION_MINOR@, @VirtualBoxSDK_VERSION_PATCH@) 26 | 27 | #define VBOX_@VirtualBoxSDK_COM_FLAVOR@ 28 | 29 | #ifdef _WIN32 30 | # ifdef BUILDING_LIBVBOX 31 | # define LIBVBOX_API __declspec(dllexport) 32 | # else 33 | # define LIBVBOX_API __declspec(dllimport) 34 | # endif 35 | #else 36 | # define LIBVBOX_API 37 | #endif 38 | 39 | #endif /* _LIBVBOX_VBOXSDK_VERSION_H */ 40 | -------------------------------------------------------------------------------- /lib/cpuchangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(ICPUChangedEvent) 22 | COM_WRAP_IFC(ICPUExecutionCapChangedEvent) 23 | 24 | uint32_t VBox::ICPUChangedEvent::CPU() const 25 | { 26 | COM_ULong result; 27 | COM_GetValue(get_IFC(), CPU, result); 28 | return static_cast(result); 29 | } 30 | 31 | bool VBox::ICPUChangedEvent::add() const 32 | { 33 | COM_Bool result; 34 | COM_GetValue(get_IFC(), Add, result); 35 | return static_cast(result); 36 | } 37 | 38 | uint32_t VBox::ICPUExecutionCapChangedEvent::executionCap() const 39 | { 40 | COM_ULong result; 41 | COM_GetValue(get_IFC(), ExecutionCap, result); 42 | return static_cast(result); 43 | } 44 | -------------------------------------------------------------------------------- /lib/cpuprofile.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(ICPUProfile) 23 | 24 | std::u16string VBox::ICPUProfile::name() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), Name, result); 28 | return result; 29 | } 30 | 31 | std::u16string VBox::ICPUProfile::fullName() const 32 | { 33 | std::u16string result; 34 | COM_GetString(get_IFC(), FullName, result); 35 | return result; 36 | } 37 | 38 | VBox::CPUArchitecture VBox::ICPUProfile::architecture() const 39 | { 40 | COM_Enum(::CPUArchitecture) result; 41 | COM_GetValue(get_IFC(), Architecture, result); 42 | return static_cast(result); 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /lib/clipboardevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2024 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 22 | COM_WRAP_IFC(IClipboardEvent) 23 | COM_WRAP_IFC(IClipboardErrorEvent) 24 | 25 | std::u16string VBox::IClipboardEvent::id() const 26 | { 27 | std::u16string result; 28 | COM_GetString(get_IFC(), Id, result); 29 | return result; 30 | } 31 | 32 | std::u16string VBox::IClipboardErrorEvent::msg() const 33 | { 34 | std::u16string result; 35 | COM_GetString(get_IFC(), Msg, result); 36 | return result; 37 | } 38 | 39 | int32_t VBox::IClipboardErrorEvent::rcError() const 40 | { 41 | COM_Long result; 42 | COM_GetValue(get_IFC(), RcError, result); 43 | return static_cast(result); 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /lib/cursorpositionchangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 22 | COM_WRAP_IFC(ICursorPositionChangedEvent) 23 | 24 | bool VBox::ICursorPositionChangedEvent::hasData() const 25 | { 26 | COM_Bool result; 27 | COM_GetValue(get_IFC(), HasData, result); 28 | return static_cast(result); 29 | } 30 | 31 | uint32_t VBox::ICursorPositionChangedEvent::x() const 32 | { 33 | COM_ULong result; 34 | COM_GetValue(get_IFC(), X, result); 35 | return static_cast(result); 36 | } 37 | 38 | uint32_t VBox::ICursorPositionChangedEvent::y() const 39 | { 40 | COM_ULong result; 41 | COM_GetValue(get_IFC(), Y, result); 42 | return static_cast(result); 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /lib/guestfileioevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IGuestFileIOEvent) 22 | COM_WRAP_IFC(IGuestFileOffsetChangedEvent) 23 | COM_WRAP_IFC(IGuestFileReadEvent) 24 | COM_WRAP_IFC(IGuestFileWriteEvent) 25 | 26 | int64_t VBox::IGuestFileIOEvent::offset() const 27 | { 28 | COM_Long64 result; 29 | COM_GetValue(get_IFC(), Offset, result); 30 | return static_cast(result); 31 | } 32 | 33 | uint32_t VBox::IGuestFileIOEvent::processed() const 34 | { 35 | COM_ULong result; 36 | COM_GetValue(get_IFC(), Processed, result); 37 | return static_cast(result); 38 | } 39 | 40 | std::vector VBox::IGuestFileReadEvent::data() const 41 | { 42 | std::vector result; 43 | COM_GetArray(get_IFC(), Data, COM_Byte, result); 44 | return result; 45 | } 46 | -------------------------------------------------------------------------------- /lib/extpackplugin.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IExtPackPlugIn) 22 | 23 | std::u16string VBox::IExtPackPlugIn::name() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Name, result); 27 | return result; 28 | } 29 | 30 | std::u16string VBox::IExtPackPlugIn::description() const 31 | { 32 | std::u16string result; 33 | COM_GetString(get_IFC(), Description, result); 34 | return result; 35 | } 36 | 37 | std::u16string VBox::IExtPackPlugIn::frontend() const 38 | { 39 | std::u16string result; 40 | COM_GetString(get_IFC(), Frontend, result); 41 | return result; 42 | } 43 | 44 | std::u16string VBox::IExtPackPlugIn::modulePath() const 45 | { 46 | std::u16string result; 47 | COM_GetString(get_IFC(), ModulePath, result); 48 | return result; 49 | } 50 | -------------------------------------------------------------------------------- /lib/emulatedusb.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IEmulatedUSB) 22 | 23 | std::vector VBox::IEmulatedUSB::webcams() const 24 | { 25 | std::vector result; 26 | COM_GetStringArray(get_IFC(), Webcams, result); 27 | return result; 28 | } 29 | 30 | void VBox::IEmulatedUSB::webcamAttach(const std::u16string &path, 31 | const std::u16string &settings) 32 | { 33 | COM_StringProxy pPath(path); 34 | COM_StringProxy pSettings(settings); 35 | 36 | auto rc = get_IFC()->WebcamAttach(pPath.m_text, pSettings.m_text); 37 | COM_ERROR_CHECK(rc); 38 | } 39 | 40 | void VBox::IEmulatedUSB::webcamDetach(const std::u16string &path) 41 | { 42 | COM_StringProxy pPath(path); 43 | 44 | auto rc = get_IFC()->WebcamDetach(pPath.m_text); 45 | COM_ERROR_CHECK(rc); 46 | } 47 | -------------------------------------------------------------------------------- /lib/hostpcideviceplugevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IHostPCIDevicePlugEvent) 22 | 23 | bool VBox::IHostPCIDevicePlugEvent::plugged() const 24 | { 25 | COM_Bool result; 26 | COM_GetValue(get_IFC(), Plugged, result); 27 | return result; 28 | } 29 | 30 | bool VBox::IHostPCIDevicePlugEvent::success() const 31 | { 32 | COM_Bool result; 33 | COM_GetValue(get_IFC(), Success, result); 34 | return result; 35 | } 36 | 37 | VBox::COMPtr 38 | VBox::IHostPCIDevicePlugEvent::attachment() const 39 | { 40 | COMPtr result; 41 | COM_GetValue_Wrap(get_IFC(), Attachment, result); 42 | return result; 43 | } 44 | 45 | std::u16string VBox::IHostPCIDevicePlugEvent::message() const 46 | { 47 | std::u16string result; 48 | COM_GetString(get_IFC(), Message, result); 49 | return result; 50 | } 51 | -------------------------------------------------------------------------------- /lib/pcideviceattachment.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IPCIDeviceAttachment) 22 | 23 | std::u16string VBox::IPCIDeviceAttachment::name() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Name, result); 27 | return result; 28 | } 29 | 30 | bool VBox::IPCIDeviceAttachment::isPhysicalDevice() const 31 | { 32 | COM_Bool result; 33 | COM_GetValue(get_IFC(), IsPhysicalDevice, result); 34 | return static_cast(result); 35 | } 36 | 37 | int32_t VBox::IPCIDeviceAttachment::hostAddress() const 38 | { 39 | COM_Long result; 40 | COM_GetValue(get_IFC(), HostAddress, result); 41 | return static_cast(result); 42 | } 43 | 44 | int32_t VBox::IPCIDeviceAttachment::guestAddress() const 45 | { 46 | COM_Long result; 47 | COM_GetValue(get_IFC(), GuestAddress, result); 48 | return static_cast(result); 49 | } 50 | -------------------------------------------------------------------------------- /lib/trustedplatformmodule.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(ITrustedPlatformModule) 23 | 24 | VBox::TpmType VBox::ITrustedPlatformModule::type() const 25 | { 26 | COM_Enum(::TpmType) result; 27 | COM_GetValue(get_IFC(), Type, result); 28 | return static_cast(result); 29 | } 30 | 31 | void VBox::ITrustedPlatformModule::set_type(TpmType value) 32 | { 33 | COM_SetValue(get_IFC(), Type, 34 | static_cast(value)); 35 | } 36 | 37 | std::u16string VBox::ITrustedPlatformModule::location() const 38 | { 39 | std::u16string result; 40 | COM_GetString(get_IFC(), Location, result); 41 | return result; 42 | } 43 | 44 | void VBox::ITrustedPlatformModule::set_location(const std::u16string &value) 45 | { 46 | COM_SetString(get_IFC(), Location, value); 47 | } 48 | #endif 49 | -------------------------------------------------------------------------------- /lib/guestuserstatechangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IGuestUserStateChangedEvent) 22 | 23 | std::u16string VBox::IGuestUserStateChangedEvent::name() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Name, result); 27 | return result; 28 | } 29 | 30 | std::u16string VBox::IGuestUserStateChangedEvent::domain() const 31 | { 32 | std::u16string result; 33 | COM_GetString(get_IFC(), Domain, result); 34 | return result; 35 | } 36 | 37 | VBox::GuestUserState VBox::IGuestUserStateChangedEvent::state() const 38 | { 39 | COM_Enum(::GuestUserState) result; 40 | COM_GetValue(get_IFC(), State, result); 41 | return static_cast(result); 42 | } 43 | 44 | std::u16string VBox::IGuestUserStateChangedEvent::stateDetails() const 45 | { 46 | std::u16string result; 47 | COM_GetString(get_IFC(), StateDetails, result); 48 | return result; 49 | } 50 | -------------------------------------------------------------------------------- /lib/virtualboxclient.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IVirtualBoxClient) 22 | 23 | VBox::COMPtr VBox::IVirtualBoxClient::virtualBox() const 24 | { 25 | COMPtr result; 26 | COM_GetValue_Wrap(get_IFC(), VirtualBox, result); 27 | return result; 28 | } 29 | 30 | VBox::COMPtr VBox::IVirtualBoxClient::session() const 31 | { 32 | COMPtr result; 33 | COM_GetValue_Wrap(get_IFC(), Session, result); 34 | return result; 35 | } 36 | 37 | VBox::COMPtr VBox::IVirtualBoxClient::eventSource() const 38 | { 39 | COMPtr result; 40 | COM_GetValue_Wrap(get_IFC(), EventSource, result); 41 | return result; 42 | } 43 | 44 | void VBox::IVirtualBoxClient::checkMachineError(const COMPtr &machine) 45 | { 46 | auto rc = get_IFC()->CheckMachineError(machine->get_IFC()); 47 | COM_ERROR_CHECK(rc); 48 | } 49 | -------------------------------------------------------------------------------- /lib/mediumevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IMediumRegisteredEvent) 22 | COM_WRAP_IFC(IMediumConfigChangedEvent) 23 | 24 | std::u16string VBox::IMediumRegisteredEvent::mediumId() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), MediumId, result); 28 | return result; 29 | } 30 | 31 | VBox::DeviceType VBox::IMediumRegisteredEvent::mediumType() const 32 | { 33 | COM_Enum(::DeviceType) result; 34 | COM_GetValue(get_IFC(), MediumType, result); 35 | return static_cast(result); 36 | } 37 | 38 | bool VBox::IMediumRegisteredEvent::registered() const 39 | { 40 | COM_Bool result; 41 | COM_GetValue(get_IFC(), Registered, result); 42 | return result; 43 | } 44 | 45 | VBox::COMPtr VBox::IMediumConfigChangedEvent::medium() const 46 | { 47 | COMPtr result; 48 | COM_GetValue_Wrap(get_IFC(), Medium, result); 49 | return result; 50 | } 51 | -------------------------------------------------------------------------------- /lib/event.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IEvent) 22 | 23 | VBox::VBoxEventType VBox::IEvent::type() const 24 | { 25 | COM_Enum(::VBoxEventType) result; 26 | COM_GetValue(get_IFC(), Type, result); 27 | return static_cast(result); 28 | } 29 | 30 | VBox::COMPtr VBox::IEvent::source() const 31 | { 32 | COMPtr result; 33 | COM_GetValue_Wrap(get_IFC(), Source, result); 34 | return result; 35 | } 36 | 37 | bool VBox::IEvent::waitable() const 38 | { 39 | COM_Bool result; 40 | COM_GetValue(get_IFC(), Waitable, result); 41 | return result; 42 | } 43 | 44 | void VBox::IEvent::setProcessed() 45 | { 46 | auto rc = get_IFC()->SetProcessed(); 47 | COM_ERROR_CHECK(rc); 48 | } 49 | 50 | bool VBox::IEvent::waitProcessed(int32_t timeout) 51 | { 52 | COM_Bool result; 53 | auto rc = get_IFC()->WaitProcessed(timeout, &result); 54 | COM_ERROR_CHECK(rc); 55 | return result; 56 | } 57 | -------------------------------------------------------------------------------- /lib/guestprocessioevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IGuestProcessIOEvent) 22 | COM_WRAP_IFC(IGuestProcessInputNotifyEvent) 23 | COM_WRAP_IFC(IGuestProcessOutputEvent) 24 | 25 | uint32_t VBox::IGuestProcessIOEvent::handle() const 26 | { 27 | COM_ULong result; 28 | COM_GetValue(get_IFC(), Handle, result); 29 | return result; 30 | } 31 | 32 | uint32_t VBox::IGuestProcessIOEvent::processed() const 33 | { 34 | COM_ULong result; 35 | COM_GetValue(get_IFC(), Processed, result); 36 | return result; 37 | } 38 | 39 | VBox::ProcessInputStatus VBox::IGuestProcessInputNotifyEvent::status() const 40 | { 41 | COM_Enum(::ProcessInputStatus) result; 42 | COM_GetValue(get_IFC(), Status, result); 43 | return static_cast(result); 44 | } 45 | 46 | std::vector VBox::IGuestProcessOutputEvent::data() const 47 | { 48 | std::vector result; 49 | COM_GetArray(get_IFC(), Data, COM_Byte, result); 50 | return result; 51 | } 52 | -------------------------------------------------------------------------------- /lib/usbcontroller.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IUSBController) 22 | 23 | std::u16string VBox::IUSBController::name() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Name, result); 27 | return result; 28 | } 29 | 30 | void VBox::IUSBController::set_name(const std::u16string &value) 31 | { 32 | COM_SetString(get_IFC(), Name, value); 33 | } 34 | 35 | VBox::USBControllerType VBox::IUSBController::type() const 36 | { 37 | COM_Enum(::USBControllerType) result; 38 | COM_GetValue(get_IFC(), Type, result); 39 | return static_cast(result); 40 | } 41 | 42 | void VBox::IUSBController::set_type(USBControllerType value) 43 | { 44 | COM_SetValue(get_IFC(), Type, static_cast(value)); 45 | } 46 | 47 | uint16_t VBox::IUSBController::USBStandard() const 48 | { 49 | COM_UShort result; 50 | COM_GetValue(get_IFC(), USBStandard, result); 51 | return static_cast(result); 52 | } 53 | -------------------------------------------------------------------------------- /lib/modechangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IClipboardModeChangedEvent) 22 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 1, 0) 23 | COM_WRAP_IFC(IClipboardFileTransferModeChangedEvent) 24 | #endif 25 | COM_WRAP_IFC(IDnDModeChangedEvent) 26 | 27 | VBox::ClipboardMode VBox::IClipboardModeChangedEvent::clipboardMode() const 28 | { 29 | COM_Enum(::ClipboardMode) result; 30 | COM_GetValue(get_IFC(), ClipboardMode, result); 31 | return static_cast(result); 32 | } 33 | 34 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 1, 0) 35 | bool VBox::IClipboardFileTransferModeChangedEvent::enabled() const 36 | { 37 | COM_Bool result; 38 | COM_GetValue(get_IFC(), Enabled, result); 39 | return static_cast(result); 40 | } 41 | #endif 42 | 43 | VBox::DnDMode VBox::IDnDModeChangedEvent::dndMode() const 44 | { 45 | COM_Enum(::DnDMode) result; 46 | COM_GetValue(get_IFC(), DndMode, result); 47 | return static_cast(result); 48 | } 49 | -------------------------------------------------------------------------------- /lib/progressevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(5, 2, 0) 22 | COM_WRAP_IFC(IProgressEvent) 23 | COM_WRAP_IFC(IProgressPercentageChangedEvent) 24 | COM_WRAP_IFC(IProgressTaskCompletedEvent) 25 | 26 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 27 | COM_WRAP_IFC(IProgressCreatedEvent) 28 | #endif 29 | 30 | std::u16string VBox::IProgressEvent::progressId() const 31 | { 32 | std::u16string result; 33 | COM_GetString(get_IFC(), ProgressId, result); 34 | return result; 35 | } 36 | 37 | int32_t VBox::IProgressPercentageChangedEvent::percent() const 38 | { 39 | COM_Long result; 40 | COM_GetValue(get_IFC(), Percent, result); 41 | return static_cast(result); 42 | } 43 | #endif 44 | 45 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 46 | bool VBox::IProgressCreatedEvent::create() const 47 | { 48 | COM_Bool result; 49 | COM_GetValue(get_IFC(), Create, result); 50 | return static_cast(result); 51 | } 52 | #endif 53 | -------------------------------------------------------------------------------- /libvbox-config.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of libvbox 2 | # Copyright (C) 2019 Michael Hansen 3 | # 4 | # libvbox is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU Lesser General Public 6 | # License as published by the Free Software Foundation; either 7 | # version 2.1 of the License, or (at your option) any later version. 8 | # 9 | # libvbox is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public 15 | # License along with libvbox; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | include("${CMAKE_CURRENT_LIST_DIR}/vbox-targets.cmake") 19 | 20 | if(NOT WIN32) 21 | # There's got to be a better way to do this... 22 | find_library(VirtualBox_XPCOM_LIB 23 | NAMES VBoxXPCOM 24 | HINTS /usr/lib/virtualbox 25 | /usr/local/lib/virtualbox 26 | /opt/VirtualBox/lib 27 | ) 28 | mark_as_advanced(VirtualBox_XPCOM_LIB) 29 | 30 | include(FindPackageHandleStandardArgs) 31 | find_package_handle_standard_args(VirtualBox_XPCOM 32 | REQUIRED_VARS VirtualBox_XPCOM_LIB 33 | ) 34 | 35 | if(VirtualBox_XPCOM_FOUND) 36 | if(NOT TARGET VirtualBox::XPCOM) 37 | add_library(VirtualBox::XPCOM UNKNOWN IMPORTED) 38 | set_target_properties(VirtualBox::XPCOM PROPERTIES 39 | IMPORTED_LINK_INTERFACE_LANGUAGES "C;CXX" 40 | IMPORTED_LINK_INTERFACE_LIBRARIES "dl;pthread" 41 | IMPORTED_LOCATION "${VirtualBox_XPCOM_LIB}" 42 | ) 43 | endif() 44 | endif() 45 | endif() 46 | -------------------------------------------------------------------------------- /lib/bandwidthgroup.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IBandwidthGroup) 22 | 23 | std::u16string VBox::IBandwidthGroup::name() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Name, result); 27 | return result; 28 | } 29 | 30 | VBox::BandwidthGroupType VBox::IBandwidthGroup::type() const 31 | { 32 | COM_Enum(::BandwidthGroupType) result; 33 | COM_GetValue(get_IFC(), Type, result); 34 | return static_cast(result); 35 | } 36 | 37 | uint32_t VBox::IBandwidthGroup::reference() const 38 | { 39 | COM_ULong result; 40 | COM_GetValue(get_IFC(), Reference, result); 41 | return static_cast(result); 42 | } 43 | 44 | int64_t VBox::IBandwidthGroup::maxBytesPerSec() const 45 | { 46 | COM_Long64 result; 47 | COM_GetValue(get_IFC(), MaxBytesPerSec, result); 48 | return static_cast(result); 49 | } 50 | 51 | void VBox::IBandwidthGroup::set_maxBytesPerSec(int64_t value) 52 | { 53 | COM_SetValue(get_IFC(), MaxBytesPerSec, value); 54 | } 55 | -------------------------------------------------------------------------------- /lib/cloudproviderevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(ICloudProviderListChangedEvent) 23 | COM_WRAP_IFC(ICloudProviderRegisteredEvent) 24 | COM_WRAP_IFC(ICloudProviderUninstallEvent) 25 | 26 | bool VBox::ICloudProviderListChangedEvent::registered() const 27 | { 28 | COM_Bool result; 29 | COM_GetValue(get_IFC(), Registered, result); 30 | return static_cast(result); 31 | } 32 | 33 | std::u16string VBox::ICloudProviderRegisteredEvent::id() const 34 | { 35 | std::u16string result; 36 | COM_GetString(get_IFC(), Id, result); 37 | return result; 38 | } 39 | 40 | bool VBox::ICloudProviderRegisteredEvent::registered() const 41 | { 42 | COM_Bool result; 43 | COM_GetValue(get_IFC(), Registered, result); 44 | return static_cast(result); 45 | } 46 | 47 | std::u16string VBox::ICloudProviderUninstallEvent::id() const 48 | { 49 | std::u16string result; 50 | COM_GetString(get_IFC(), Id, result); 51 | return result; 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /lib/audiosettings.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(IAudioSettings) 23 | 24 | VBox::COMPtr VBox::IAudioSettings::adapter() const 25 | { 26 | COMPtr result; 27 | COM_GetValue_Wrap(get_IFC(), Adapter, result); 28 | return result; 29 | } 30 | 31 | VBox::COMPtr 32 | VBox::IAudioSettings::getHostAudioDevice(AudioDirection usage) 33 | { 34 | ::IHostAudioDevice *cResult = nullptr; 35 | 36 | auto rc = get_IFC()->GetHostAudioDevice( 37 | static_cast(usage), &cResult); 38 | COM_ERROR_CHECK(rc); 39 | 40 | return COMPtr::wrap(cResult); 41 | } 42 | 43 | void VBox::IAudioSettings::setHostAudioDevice( 44 | const COMPtr &device, AudioDirection usage) 45 | { 46 | auto rc = get_IFC()->SetHostAudioDevice(device->get_IFC(), 47 | static_cast(usage)); 48 | COM_ERROR_CHECK(rc); 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /lib/hostaudiodevicechangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(IHostAudioDeviceChangedEvent) 23 | 24 | VBox::COMPtr VBox::IHostAudioDeviceChangedEvent::device() const 25 | { 26 | COMPtr result; 27 | COM_GetValue_Wrap(get_IFC(), Device, result); 28 | return result; 29 | } 30 | 31 | bool VBox::IHostAudioDeviceChangedEvent::new_() const 32 | { 33 | COM_Bool result; 34 | COM_GetValue(get_IFC(), New, result); 35 | return static_cast(result); 36 | } 37 | 38 | VBox::AudioDeviceState VBox::IHostAudioDeviceChangedEvent::state() const 39 | { 40 | COM_Enum(::AudioDeviceState) result; 41 | COM_GetValue(get_IFC(), State, result); 42 | return static_cast(result); 43 | } 44 | 45 | VBox::COMPtr VBox::IHostAudioDeviceChangedEvent::error() const 46 | { 47 | COMPtr result; 48 | COM_GetValue_Wrap(get_IFC(), Error, result); 49 | return result; 50 | } 51 | #endif 52 | -------------------------------------------------------------------------------- /lib/nvramstore.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(INvramStore) 23 | 24 | std::u16string VBox::INvramStore::nonVolatileStorageFile() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), NonVolatileStorageFile, result); 28 | return result; 29 | } 30 | 31 | VBox::COMPtr VBox::INvramStore::uefiVariableStore() const 32 | { 33 | COMPtr result; 34 | COM_GetValue_Wrap(get_IFC(), UefiVariableStore, result); 35 | return result; 36 | } 37 | 38 | std::u16string VBox::INvramStore::keyId() const 39 | { 40 | std::u16string result; 41 | COM_GetString(get_IFC(), KeyId, result); 42 | return result; 43 | } 44 | 45 | std::u16string VBox::INvramStore::keyStore() const 46 | { 47 | std::u16string result; 48 | COM_GetString(get_IFC(), KeyStore, result); 49 | return result; 50 | } 51 | 52 | void VBox::INvramStore::initUefiVariableStore(uint32_t size) 53 | { 54 | auto rc = get_IFC()->InitUefiVariableStore(static_cast(size)); 55 | COM_ERROR_CHECK(rc); 56 | } 57 | #endif 58 | -------------------------------------------------------------------------------- /lib/cloudprofileevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(ICloudProfileRegisteredEvent) 23 | COM_WRAP_IFC(ICloudProfileChangedEvent) 24 | 25 | std::u16string VBox::ICloudProfileRegisteredEvent::providerId() const 26 | { 27 | std::u16string result; 28 | COM_GetString(get_IFC(), ProviderId, result); 29 | return result; 30 | } 31 | 32 | std::u16string VBox::ICloudProfileRegisteredEvent::name() const 33 | { 34 | std::u16string result; 35 | COM_GetString(get_IFC(), Name, result); 36 | return result; 37 | } 38 | 39 | bool VBox::ICloudProfileRegisteredEvent::registered() const 40 | { 41 | COM_Bool result; 42 | COM_GetValue(get_IFC(), Registered, result); 43 | return static_cast(result); 44 | } 45 | 46 | std::u16string VBox::ICloudProfileChangedEvent::providerId() const 47 | { 48 | std::u16string result; 49 | COM_GetString(get_IFC(), ProviderId, result); 50 | return result; 51 | } 52 | 53 | std::u16string VBox::ICloudProfileChangedEvent::name() const 54 | { 55 | std::u16string result; 56 | COM_GetString(get_IFC(), Name, result); 57 | return result; 58 | } 59 | #endif 60 | -------------------------------------------------------------------------------- /lib/additionsfacility.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IAdditionsFacility) 22 | 23 | VBox::AdditionsFacilityClass VBox::IAdditionsFacility::classType() const 24 | { 25 | COM_Enum(::AdditionsFacilityClass) result; 26 | COM_GetValue(get_IFC(), ClassType, result); 27 | return static_cast(result); 28 | } 29 | 30 | int64_t VBox::IAdditionsFacility::lastUpdated() const 31 | { 32 | COM_Long64 result; 33 | COM_GetValue(get_IFC(), LastUpdated, result); 34 | return static_cast(result); 35 | } 36 | 37 | std::u16string VBox::IAdditionsFacility::name() const 38 | { 39 | std::u16string result; 40 | COM_GetString(get_IFC(), Name, result); 41 | return result; 42 | } 43 | 44 | VBox::AdditionsFacilityStatus VBox::IAdditionsFacility::status() const 45 | { 46 | COM_Enum(::AdditionsFacilityStatus) result; 47 | COM_GetValue(get_IFC(), Status, result); 48 | return static_cast(result); 49 | } 50 | 51 | VBox::AdditionsFacilityType VBox::IAdditionsFacility::type() const 52 | { 53 | COM_Enum(::AdditionsFacilityType) result; 54 | COM_GetValue(get_IFC(), Type, result); 55 | return static_cast(result); 56 | } 57 | -------------------------------------------------------------------------------- /lib/guestmouseevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IGuestMouseEvent) 22 | 23 | VBox::GuestMouseEventMode VBox::IGuestMouseEvent::mode() const 24 | { 25 | COM_Enum(::GuestMouseEventMode) result; 26 | COM_GetValue(get_IFC(), Mode, result); 27 | return static_cast(result); 28 | } 29 | 30 | int32_t VBox::IGuestMouseEvent::x() const 31 | { 32 | COM_Long result; 33 | COM_GetValue(get_IFC(), X, result); 34 | return static_cast(result); 35 | } 36 | 37 | int32_t VBox::IGuestMouseEvent::y() const 38 | { 39 | COM_Long result; 40 | COM_GetValue(get_IFC(), Y, result); 41 | return static_cast(result); 42 | } 43 | 44 | int32_t VBox::IGuestMouseEvent::z() const 45 | { 46 | COM_Long result; 47 | COM_GetValue(get_IFC(), Z, result); 48 | return static_cast(result); 49 | } 50 | 51 | int32_t VBox::IGuestMouseEvent::w() const 52 | { 53 | COM_Long result; 54 | COM_GetValue(get_IFC(), W, result); 55 | return static_cast(result); 56 | } 57 | 58 | int32_t VBox::IGuestMouseEvent::buttons() const 59 | { 60 | COM_Long result; 61 | COM_GetValue(get_IFC(), Buttons, result); 62 | return static_cast(result); 63 | } 64 | -------------------------------------------------------------------------------- /lib/virtualboxerrorinfo.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IVirtualBoxErrorInfo) 22 | 23 | int32_t VBox::IVirtualBoxErrorInfo::resultCode() const 24 | { 25 | COM_Long result; 26 | COM_GetValue(get_IFC(), ResultCode, result); 27 | return result; 28 | } 29 | 30 | int32_t VBox::IVirtualBoxErrorInfo::resultDetail() const 31 | { 32 | COM_Long result; 33 | COM_GetValue(get_IFC(), ResultDetail, result); 34 | return result; 35 | } 36 | 37 | std::u16string VBox::IVirtualBoxErrorInfo::interfaceID() const 38 | { 39 | std::u16string result; 40 | COM_GetString(get_IFC(), InterfaceID, result); 41 | return result; 42 | } 43 | 44 | std::u16string VBox::IVirtualBoxErrorInfo::component() const 45 | { 46 | std::u16string result; 47 | COM_GetString(get_IFC(), Component, result); 48 | return result; 49 | } 50 | 51 | std::u16string VBox::IVirtualBoxErrorInfo::text() const 52 | { 53 | std::u16string result; 54 | COM_GetString(get_IFC(), Text, result); 55 | return result; 56 | } 57 | 58 | VBox::COMPtr VBox::IVirtualBoxErrorInfo::next() const 59 | { 60 | COMPtr result; 61 | COM_GetValue_Wrap(get_IFC(), Next, result); 62 | return result; 63 | } 64 | -------------------------------------------------------------------------------- /lib/framebufferoverlay.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IFramebufferOverlay) 22 | 23 | uint32_t VBox::IFramebufferOverlay::x() const 24 | { 25 | COM_ULong result; 26 | COM_GetValue(get_IFC(), X, result); 27 | return static_cast(result); 28 | } 29 | 30 | uint32_t VBox::IFramebufferOverlay::y() const 31 | { 32 | COM_ULong result; 33 | COM_GetValue(get_IFC(), Y, result); 34 | return static_cast(result); 35 | } 36 | 37 | bool VBox::IFramebufferOverlay::visible() const 38 | { 39 | COM_Bool result; 40 | COM_GetValue(get_IFC(), Visible, result); 41 | return static_cast(result); 42 | } 43 | 44 | void VBox::IFramebufferOverlay::set_visible(bool value) 45 | { 46 | COM_SetValue(get_IFC(), Visible, value); 47 | } 48 | 49 | uint32_t VBox::IFramebufferOverlay::alpha() const 50 | { 51 | COM_ULong result; 52 | COM_GetValue(get_IFC(), Alpha, result); 53 | return static_cast(result); 54 | } 55 | 56 | void VBox::IFramebufferOverlay::set_alpha(uint32_t value) 57 | { 58 | COM_SetValue(get_IFC(), Alpha, value); 59 | } 60 | 61 | void VBox::IFramebufferOverlay::move(uint32_t x, uint32_t y) 62 | { 63 | auto rc = get_IFC()->Move(x, y); 64 | COM_ERROR_CHECK(rc); 65 | } 66 | -------------------------------------------------------------------------------- /lib/extradatachangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IExtraDataChangedEvent) 22 | COM_WRAP_IFC(IExtraDataCanChangeEvent) 23 | 24 | std::u16string VBox::IExtraDataChangedEvent::machineId() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), MachineId, result); 28 | return result; 29 | } 30 | 31 | std::u16string VBox::IExtraDataChangedEvent::key() const 32 | { 33 | std::u16string result; 34 | COM_GetString(get_IFC(), Key, result); 35 | return result; 36 | } 37 | 38 | std::u16string VBox::IExtraDataChangedEvent::value() const 39 | { 40 | std::u16string result; 41 | COM_GetString(get_IFC(), Value, result); 42 | return result; 43 | } 44 | 45 | std::u16string VBox::IExtraDataCanChangeEvent::machineId() const 46 | { 47 | std::u16string result; 48 | COM_GetString(get_IFC(), MachineId, result); 49 | return result; 50 | } 51 | 52 | std::u16string VBox::IExtraDataCanChangeEvent::key() const 53 | { 54 | std::u16string result; 55 | COM_GetString(get_IFC(), Key, result); 56 | return result; 57 | } 58 | 59 | std::u16string VBox::IExtraDataCanChangeEvent::value() const 60 | { 61 | std::u16string result; 62 | COM_GetString(get_IFC(), Value, result); 63 | return result; 64 | } 65 | -------------------------------------------------------------------------------- /lib/guestprocessevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IGuestProcessEvent) 22 | COM_WRAP_IFC(IGuestProcessRegisteredEvent) 23 | COM_WRAP_IFC(IGuestProcessStateChangedEvent) 24 | 25 | VBox::COMPtr VBox::IGuestProcessEvent::process() const 26 | { 27 | COMPtr result; 28 | COM_GetValue_Wrap(get_IFC(), Process, result); 29 | return result; 30 | } 31 | 32 | uint32_t VBox::IGuestProcessEvent::pid() const 33 | { 34 | COM_ULong result; 35 | COM_GetValue(get_IFC(), Pid, result); 36 | return static_cast(result); 37 | } 38 | 39 | bool VBox::IGuestProcessRegisteredEvent::registered() const 40 | { 41 | COM_Bool result; 42 | COM_GetValue(get_IFC(), Registered, result); 43 | return static_cast(result); 44 | } 45 | 46 | VBox::ProcessStatus VBox::IGuestProcessStateChangedEvent::status() const 47 | { 48 | COM_Enum(::ProcessStatus) result; 49 | COM_GetValue(get_IFC(), Status, result); 50 | return static_cast(result); 51 | } 52 | 53 | VBox::COMPtr 54 | VBox::IGuestProcessStateChangedEvent::error() const 55 | { 56 | COMPtr result; 57 | COM_GetValue_Wrap(get_IFC(), Error, result); 58 | return result; 59 | } 60 | -------------------------------------------------------------------------------- /lib/guestsessionevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IGuestSessionEvent) 22 | COM_WRAP_IFC(IGuestSessionStateChangedEvent) 23 | COM_WRAP_IFC(IGuestSessionRegisteredEvent) 24 | 25 | VBox::COMPtr VBox::IGuestSessionEvent::session() const 26 | { 27 | COMPtr result; 28 | COM_GetValue_Wrap(get_IFC(), Session, result); 29 | return result; 30 | } 31 | 32 | uint32_t VBox::IGuestSessionStateChangedEvent::id() const 33 | { 34 | COM_ULong result; 35 | COM_GetValue(get_IFC(), Id, result); 36 | return static_cast(result); 37 | } 38 | 39 | VBox::GuestSessionStatus VBox::IGuestSessionStateChangedEvent::status() const 40 | { 41 | COM_Enum(::GuestSessionStatus) result; 42 | COM_GetValue(get_IFC(), Status, result); 43 | return static_cast(result); 44 | } 45 | 46 | VBox::COMPtr 47 | VBox::IGuestSessionStateChangedEvent::error() const 48 | { 49 | COMPtr result; 50 | COM_GetValue_Wrap(get_IFC(), Error, result); 51 | return result; 52 | } 53 | 54 | bool VBox::IGuestSessionRegisteredEvent::registered() const 55 | { 56 | COM_Bool result; 57 | COM_GetValue(get_IFC(), Registered, result); 58 | return result; 59 | } 60 | -------------------------------------------------------------------------------- /include/libvbox.h: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #ifndef _LIBVBOX_H 20 | #define _LIBVBOX_H 21 | 22 | #include "libvbox_interfaces.h" 23 | #include "libvbox_errors.h" 24 | 25 | namespace VBox 26 | { 27 | LIBVBOX_API COMPtr virtualBoxClient(); 28 | LIBVBOX_API COMPtr currentError(); 29 | 30 | // Provided by MSCOM/XPCOM 31 | LIBVBOX_API std::string utf16ToUtf8(const std::u16string &text); 32 | LIBVBOX_API std::string utf16ToUtf8(const char16_t *text, size_t size); 33 | LIBVBOX_API std::string utf16ToUtf8(const char16_t *text); 34 | LIBVBOX_API std::u16string utf8ToUtf16(const std::string &text); 35 | LIBVBOX_API std::u16string utf8ToUtf16(const char *text, size_t size); 36 | LIBVBOX_API std::u16string utf8ToUtf16(const char *text); 37 | 38 | // Provided by libvbox 39 | LIBVBOX_API std::wstring utf16ToWide(const std::u16string &text); 40 | LIBVBOX_API std::wstring utf16ToWide(const char16_t *text, size_t size); 41 | LIBVBOX_API std::wstring utf16ToWide(const char16_t *text); 42 | LIBVBOX_API std::u16string wideToUtf16(const std::wstring &text); 43 | LIBVBOX_API std::u16string wideToUtf16(const wchar_t *text, size_t size); 44 | LIBVBOX_API std::u16string wideToUtf16(const wchar_t *text); 45 | } 46 | 47 | #endif /* _LIBVBOX_H */ 48 | -------------------------------------------------------------------------------- /lib/updateagentevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(IUpdateAgentEvent) 23 | COM_WRAP_IFC(IUpdateAgentSettingsChangedEvent) 24 | COM_WRAP_IFC(IUpdateAgentErrorEvent) 25 | COM_WRAP_IFC(IUpdateAgentStateChangedEvent) 26 | 27 | VBox::COMPtr VBox::IUpdateAgentEvent::agent() const 28 | { 29 | COMPtr result; 30 | COM_GetValue_Wrap(get_IFC(), Agent, result); 31 | return result; 32 | } 33 | 34 | std::u16string VBox::IUpdateAgentSettingsChangedEvent::attributeHint() const 35 | { 36 | std::u16string result; 37 | COM_GetString(get_IFC(), AttributeHint, result); 38 | return result; 39 | } 40 | 41 | std::u16string VBox::IUpdateAgentErrorEvent::msg() const 42 | { 43 | std::u16string result; 44 | COM_GetString(get_IFC(), Msg, result); 45 | return result; 46 | } 47 | 48 | int32_t VBox::IUpdateAgentErrorEvent::rcError() const 49 | { 50 | COM_Long result; 51 | COM_GetValue(get_IFC(), RcError, result); 52 | return result; 53 | } 54 | 55 | VBox::UpdateState VBox::IUpdateAgentStateChangedEvent::state() const 56 | { 57 | COM_Enum(::UpdateState) result; 58 | COM_GetValue(get_IFC(), State, result); 59 | return static_cast(result); 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /lib/session.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(ISession) 22 | 23 | VBox::SessionState VBox::ISession::state() const 24 | { 25 | COM_Enum(::SessionState) result; 26 | COM_GetValue(get_IFC(), State, result); 27 | return static_cast(result); 28 | } 29 | 30 | VBox::SessionType VBox::ISession::type() const 31 | { 32 | COM_Enum(::SessionType) result; 33 | COM_GetValue(get_IFC(), Type, result); 34 | return static_cast(result); 35 | } 36 | 37 | std::u16string VBox::ISession::name() const 38 | { 39 | std::u16string result; 40 | COM_GetString(get_IFC(), Name, result); 41 | return result; 42 | } 43 | 44 | void VBox::ISession::set_name(const std::u16string &value) 45 | { 46 | COM_SetString(get_IFC(), Name, value); 47 | } 48 | 49 | VBox::COMPtr VBox::ISession::machine() const 50 | { 51 | COMPtr result; 52 | COM_GetValue_Wrap(get_IFC(), Machine, result); 53 | return result; 54 | } 55 | 56 | VBox::COMPtr VBox::ISession::console() const 57 | { 58 | COMPtr result; 59 | COM_GetValue_Wrap(get_IFC(), Console, result); 60 | return result; 61 | } 62 | 63 | void VBox::ISession::unlockMachine() 64 | { 65 | auto rc = get_IFC()->UnlockMachine(); 66 | COM_ERROR_CHECK(rc); 67 | } 68 | -------------------------------------------------------------------------------- /lib/statechangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IStateChangedEvent) 22 | COM_WRAP_IFC(IAdditionsStateChangedEvent) 23 | COM_WRAP_IFC(IUSBDeviceStateChangedEvent) 24 | COM_WRAP_IFC(IVBoxSVCAvailabilityChangedEvent) 25 | 26 | VBox::MachineState VBox::IStateChangedEvent::state() const 27 | { 28 | COM_Enum(::MachineState) result; 29 | COM_GetValue(get_IFC(), State, result); 30 | return static_cast(result); 31 | } 32 | 33 | VBox::COMPtr VBox::IUSBDeviceStateChangedEvent::device() const 34 | { 35 | COMPtr result; 36 | COM_GetValue_Wrap(get_IFC(), Device, result); 37 | return result; 38 | } 39 | 40 | bool VBox::IUSBDeviceStateChangedEvent::attached() const 41 | { 42 | COM_Bool result; 43 | COM_GetValue(get_IFC(), Attached, result); 44 | return static_cast(result); 45 | } 46 | 47 | VBox::COMPtr 48 | VBox::IUSBDeviceStateChangedEvent::error() const 49 | { 50 | COMPtr result; 51 | COM_GetValue_Wrap(get_IFC(), Error, result); 52 | return result; 53 | } 54 | 55 | bool VBox::IVBoxSVCAvailabilityChangedEvent::available() const 56 | { 57 | COM_Bool result; 58 | COM_GetValue(get_IFC(), Available, result); 59 | return static_cast(result); 60 | } 61 | -------------------------------------------------------------------------------- /lib/usbdevicefilters.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IUSBDeviceFilters) 22 | 23 | std::vector> 24 | VBox::IUSBDeviceFilters::deviceFilters() const 25 | { 26 | std::vector> result; 27 | COM_GetArray_Wrap(get_IFC(), DeviceFilters, result); 28 | return result; 29 | } 30 | 31 | VBox::COMPtr VBox::IUSBDeviceFilters::createDeviceFilter( 32 | const std::u16string &name) 33 | { 34 | ::IUSBDeviceFilter *cResult = nullptr; 35 | COM_StringProxy pName(name); 36 | 37 | auto rc = get_IFC()->CreateDeviceFilter(pName.m_text, &cResult); 38 | COM_ERROR_CHECK(rc); 39 | 40 | return COMPtr::wrap(cResult); 41 | } 42 | 43 | void VBox::IUSBDeviceFilters::insertDeviceFilter(uint32_t position, 44 | const COMPtr &filter) 45 | { 46 | auto rc = get_IFC()->InsertDeviceFilter(position, filter->get_IFC()); 47 | COM_ERROR_CHECK(rc); 48 | } 49 | 50 | VBox::COMPtr VBox::IUSBDeviceFilters::removeDeviceFilter( 51 | uint32_t position) 52 | { 53 | ::IUSBDeviceFilter *cResult = nullptr; 54 | 55 | auto rc = get_IFC()->RemoveDeviceFilter(position, &cResult); 56 | COM_ERROR_CHECK(rc); 57 | 58 | return COMPtr::wrap(cResult); 59 | } 60 | -------------------------------------------------------------------------------- /lib/displaysourcebitmap.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IDisplaySourceBitmap) 22 | 23 | uint32_t VBox::IDisplaySourceBitmap::screenId() const 24 | { 25 | COM_ULong result; 26 | COM_GetValue(get_IFC(), ScreenId, result); 27 | return static_cast(result); 28 | } 29 | 30 | void VBox::IDisplaySourceBitmap::queryBitmapInfo(uint8_t **address, 31 | uint32_t *width, uint32_t *height, uint32_t *bitsPerPixel, 32 | uint32_t *bytesPerLine, BitmapFormat *bitmapFormat) 33 | { 34 | COM_Byte *cAddress = nullptr; 35 | COM_ULong cWidth, cHeight, cBitsPerPixel, cBytesPerLine; 36 | COM_Enum(::BitmapFormat) cBitmapFormat; 37 | 38 | auto rc = get_IFC()->QueryBitmapInfo(&cAddress, &cWidth, &cHeight, 39 | &cBitsPerPixel, &cBytesPerLine, &cBitmapFormat); 40 | COM_ERROR_CHECK(rc); 41 | 42 | if (address) 43 | *address = reinterpret_cast(cAddress); 44 | if (width) 45 | *width = static_cast(cWidth); 46 | if (height) 47 | *height = static_cast(cHeight); 48 | if (bitsPerPixel) 49 | *bitsPerPixel = static_cast(cBitsPerPixel); 50 | if (bytesPerLine) 51 | *bytesPerLine = static_cast(cBytesPerLine); 52 | if (bitmapFormat) 53 | *bitmapFormat = static_cast(cBitmapFormat); 54 | } 55 | -------------------------------------------------------------------------------- /lib/pciaddress.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IPCIAddress) 22 | 23 | int16_t VBox::IPCIAddress::bus() const 24 | { 25 | COM_Short result; 26 | COM_GetValue(get_IFC(), Bus, result); 27 | return static_cast(result); 28 | } 29 | 30 | void VBox::IPCIAddress::set_bus(int16_t value) 31 | { 32 | COM_SetValue(get_IFC(), Bus, value); 33 | } 34 | 35 | int16_t VBox::IPCIAddress::device() const 36 | { 37 | COM_Short result; 38 | COM_GetValue(get_IFC(), Device, result); 39 | return static_cast(result); 40 | } 41 | 42 | void VBox::IPCIAddress::set_device(int16_t value) 43 | { 44 | COM_SetValue(get_IFC(), Device, value); 45 | } 46 | 47 | int16_t VBox::IPCIAddress::devFunction() const 48 | { 49 | COM_Short result; 50 | COM_GetValue(get_IFC(), DevFunction, result); 51 | return static_cast(result); 52 | } 53 | 54 | void VBox::IPCIAddress::set_devFunction(int16_t value) 55 | { 56 | COM_SetValue(get_IFC(), DevFunction, value); 57 | } 58 | 59 | int32_t VBox::IPCIAddress::asLong() 60 | { 61 | COM_Long cResult; 62 | 63 | auto rc = get_IFC()->AsLong(&cResult); 64 | COM_ERROR_CHECK(rc); 65 | 66 | return static_cast(cResult); 67 | } 68 | 69 | void VBox::IPCIAddress::fromLong(int32_t number) 70 | { 71 | auto rc = get_IFC()->FromLong(number); 72 | COM_ERROR_CHECK(rc); 73 | } 74 | -------------------------------------------------------------------------------- /lib/dndbase.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IDnDBase) 22 | 23 | std::vector VBox::IDnDBase::formats() const 24 | { 25 | std::vector result; 26 | COM_GetStringArray(get_IFC(), Formats, result); 27 | return result; 28 | } 29 | 30 | #if VirtualBoxSDK_VERSION < VBox_MAKE_VERSION(7, 0, 0) 31 | uint32_t VBox::IDnDBase::protocolVersion() const 32 | { 33 | COM_ULong result; 34 | COM_GetValue(get_IFC(), ProtocolVersion, result); 35 | return static_cast(result); 36 | } 37 | #endif 38 | 39 | bool VBox::IDnDBase::isFormatSupported(const std::u16string &format) 40 | { 41 | COM_Bool cResult; 42 | COM_StringProxy pFormat(format); 43 | 44 | auto rc = get_IFC()->IsFormatSupported(pFormat.m_text, &cResult); 45 | COM_ERROR_CHECK(rc); 46 | 47 | return static_cast(cResult); 48 | } 49 | 50 | void VBox::IDnDBase::addFormats(const std::vector &formats) 51 | { 52 | COM_StringArrayProxy pFormats(formats); 53 | 54 | auto rc = get_IFC()->AddFormats(COM_ArrayParameter(pFormats)); 55 | COM_ERROR_CHECK(rc); 56 | } 57 | 58 | void VBox::IDnDBase::removeFormats(const std::vector &formats) 59 | { 60 | COM_StringArrayProxy pFormats(formats); 61 | 62 | auto rc = get_IFC()->RemoveFormats(COM_ArrayParameter(pFormats)); 63 | COM_ERROR_CHECK(rc); 64 | } 65 | -------------------------------------------------------------------------------- /lib/dhcpgroupcondition.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 1, 0) 22 | COM_WRAP_IFC(IDHCPGroupCondition) 23 | 24 | bool VBox::IDHCPGroupCondition::inclusive() const 25 | { 26 | COM_Bool result; 27 | COM_GetValue(get_IFC(), Inclusive, result); 28 | return static_cast(result); 29 | } 30 | 31 | void VBox::IDHCPGroupCondition::set_inclusive(bool value) 32 | { 33 | COM_SetValue(get_IFC(), Inclusive, value); 34 | } 35 | 36 | VBox::DHCPGroupConditionType VBox::IDHCPGroupCondition::type() const 37 | { 38 | COM_Enum(::DHCPGroupConditionType) result; 39 | COM_GetValue(get_IFC(), Type, result); 40 | return static_cast(result); 41 | } 42 | 43 | void VBox::IDHCPGroupCondition::set_type(DHCPGroupConditionType value) 44 | { 45 | COM_SetValue(get_IFC(), Type, static_cast(value)); 46 | } 47 | 48 | std::u16string VBox::IDHCPGroupCondition::value() const 49 | { 50 | std::u16string result; 51 | COM_GetString(get_IFC(), Value, result); 52 | return result; 53 | } 54 | 55 | void VBox::IDHCPGroupCondition::set_value(const std::u16string &value) 56 | { 57 | COM_SetString(get_IFC(), Value, value); 58 | } 59 | 60 | void VBox::IDHCPGroupCondition::remove() 61 | { 62 | auto rc = get_IFC()->Remove(); 63 | COM_ERROR_CHECK(rc); 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /lib/recordingevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2024 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 22 | COM_WRAP_IFC(IRecordingStateChangedEvent) 23 | COM_WRAP_IFC(IRecordingScreenStateChangedEvent) 24 | #elif VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 25 | COM_WRAP_IFC(IRecordingChangedEvent) 26 | #endif 27 | 28 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 2, 0) 29 | VBox::RecordingState VBox::IRecordingStateChangedEvent::state() const 30 | { 31 | COM_Enum(::RecordingState) result; 32 | COM_GetValue(get_IFC(), State, result); 33 | return static_cast(result); 34 | } 35 | #elif VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 36 | bool VBox::IRecordingStateChangedEvent::enabled() const 37 | { 38 | COM_Bool result; 39 | COM_GetValue(get_IFC(), Enabled, result); 40 | return static_cast(result); 41 | } 42 | #endif 43 | 44 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 45 | VBox::COMPtr VBox::IRecordingStateChangedEvent::error() const 46 | { 47 | COMPtr result; 48 | COM_GetValue_Wrap(get_IFC(), Error, result); 49 | return result; 50 | } 51 | 52 | uint32_t VBox::IRecordingScreenStateChangedEvent::screen() const 53 | { 54 | COM_ULong result; 55 | COM_GetValue(get_IFC(), Screen, result); 56 | return static_cast(result); 57 | } 58 | #endif 59 | -------------------------------------------------------------------------------- /lib/mousepointershapechangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IMousePointerShapeChangedEvent) 22 | 23 | bool VBox::IMousePointerShapeChangedEvent::visible() const 24 | { 25 | COM_Bool result; 26 | COM_GetValue(get_IFC(), Visible, result); 27 | return result; 28 | } 29 | 30 | bool VBox::IMousePointerShapeChangedEvent::alpha() const 31 | { 32 | COM_Bool result; 33 | COM_GetValue(get_IFC(), Alpha, result); 34 | return result; 35 | } 36 | 37 | uint32_t VBox::IMousePointerShapeChangedEvent::xhot() const 38 | { 39 | COM_ULong result; 40 | COM_GetValue(get_IFC(), Xhot, result); 41 | return result; 42 | } 43 | 44 | uint32_t VBox::IMousePointerShapeChangedEvent::yhot() const 45 | { 46 | COM_ULong result; 47 | COM_GetValue(get_IFC(), Yhot, result); 48 | return result; 49 | } 50 | 51 | uint32_t VBox::IMousePointerShapeChangedEvent::width() const 52 | { 53 | COM_ULong result; 54 | COM_GetValue(get_IFC(), Width, result); 55 | return result; 56 | } 57 | 58 | uint32_t VBox::IMousePointerShapeChangedEvent::height() const 59 | { 60 | COM_ULong result; 61 | COM_GetValue(get_IFC(), Height, result); 62 | return result; 63 | } 64 | 65 | std::vector VBox::IMousePointerShapeChangedEvent::shape() const 66 | { 67 | std::vector result; 68 | COM_GetArray(get_IFC(), Shape, COM_Byte, result); 69 | return result; 70 | } 71 | -------------------------------------------------------------------------------- /lib/mousecapabilitychangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IMouseCapabilityChangedEvent) 22 | 23 | bool VBox::IMouseCapabilityChangedEvent::supportsAbsolute() const 24 | { 25 | COM_Bool result; 26 | COM_GetValue(get_IFC(), SupportsAbsolute, result); 27 | return result; 28 | } 29 | 30 | bool VBox::IMouseCapabilityChangedEvent::supportsRelative() const 31 | { 32 | COM_Bool result; 33 | COM_GetValue(get_IFC(), SupportsRelative, result); 34 | return result; 35 | } 36 | 37 | #if VirtualBoxSDK_VERSION < VBox_MAKE_VERSION(7, 0, 0) 38 | bool VBox::IMouseCapabilityChangedEvent::supportsMultiTouch() const 39 | { 40 | COM_Bool result; 41 | COM_GetValue(get_IFC(), SupportsMultiTouch, result); 42 | return static_cast(result); 43 | } 44 | #else 45 | bool VBox::IMouseCapabilityChangedEvent::supportsTouchScreen() const 46 | { 47 | COM_Bool result; 48 | COM_GetValue(get_IFC(), SupportsTouchScreen, result); 49 | return static_cast(result); 50 | } 51 | 52 | bool VBox::IMouseCapabilityChangedEvent::supportsTouchPad() const 53 | { 54 | COM_Bool result; 55 | COM_GetValue(get_IFC(), SupportsTouchPad, result); 56 | return static_cast(result); 57 | } 58 | #endif 59 | 60 | bool VBox::IMouseCapabilityChangedEvent::needsHostCursor() const 61 | { 62 | COM_Bool result; 63 | COM_GetValue(get_IFC(), NeedsHostCursor, result); 64 | return result; 65 | } 66 | -------------------------------------------------------------------------------- /lib/mousepointershape.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IMousePointerShape) 22 | 23 | bool VBox::IMousePointerShape::visible() const 24 | { 25 | COM_Bool result; 26 | COM_GetValue(get_IFC(), Visible, result); 27 | return static_cast(result); 28 | } 29 | 30 | bool VBox::IMousePointerShape::alpha() const 31 | { 32 | COM_Bool result; 33 | COM_GetValue(get_IFC(), Alpha, result); 34 | return static_cast(result); 35 | } 36 | 37 | uint32_t VBox::IMousePointerShape::hotX() const 38 | { 39 | COM_ULong result; 40 | COM_GetValue(get_IFC(), HotX, result); 41 | return static_cast(result); 42 | } 43 | 44 | uint32_t VBox::IMousePointerShape::hotY() const 45 | { 46 | COM_ULong result; 47 | COM_GetValue(get_IFC(), HotY, result); 48 | return static_cast(result); 49 | } 50 | 51 | uint32_t VBox::IMousePointerShape::width() const 52 | { 53 | COM_ULong result; 54 | COM_GetValue(get_IFC(), Width, result); 55 | return static_cast(result); 56 | } 57 | 58 | uint32_t VBox::IMousePointerShape::height() const 59 | { 60 | COM_ULong result; 61 | COM_GetValue(get_IFC(), Height, result); 62 | return static_cast(result); 63 | } 64 | 65 | std::vector VBox::IMousePointerShape::shape() const 66 | { 67 | std::vector result; 68 | COM_GetArray(get_IFC(), Shape, COM_Byte, result); 69 | return result; 70 | } 71 | -------------------------------------------------------------------------------- /lib/updateagentavailableevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(IUpdateAgentAvailableEvent) 23 | 24 | std::u16string VBox::IUpdateAgentAvailableEvent::version() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), Version, result); 28 | return result; 29 | } 30 | 31 | VBox::UpdateChannel VBox::IUpdateAgentAvailableEvent::channel() const 32 | { 33 | COM_Enum(::UpdateChannel) result; 34 | COM_GetValue(get_IFC(), Channel, result); 35 | return static_cast(result); 36 | } 37 | 38 | VBox::UpdateSeverity VBox::IUpdateAgentAvailableEvent::severity() const 39 | { 40 | COM_Enum(::UpdateSeverity) result; 41 | COM_GetValue(get_IFC(), Severity, result); 42 | return static_cast(result); 43 | } 44 | 45 | std::u16string VBox::IUpdateAgentAvailableEvent::downloadURL() const 46 | { 47 | std::u16string result; 48 | COM_GetString(get_IFC(), DownloadURL, result); 49 | return result; 50 | } 51 | 52 | std::u16string VBox::IUpdateAgentAvailableEvent::webURL() const 53 | { 54 | std::u16string result; 55 | COM_GetString(get_IFC(), WebURL, result); 56 | return result; 57 | } 58 | 59 | std::u16string VBox::IUpdateAgentAvailableEvent::releaseNotes() const 60 | { 61 | std::u16string result; 62 | COM_GetString(get_IFC(), ReleaseNotes, result); 63 | return result; 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /lib/parallelport.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IParallelPort) 22 | 23 | uint32_t VBox::IParallelPort::slot() const 24 | { 25 | COM_ULong result; 26 | COM_GetValue(get_IFC(), Slot, result); 27 | return static_cast(result); 28 | } 29 | 30 | bool VBox::IParallelPort::enabled() const 31 | { 32 | COM_Bool result; 33 | COM_GetValue(get_IFC(), Enabled, result); 34 | return static_cast(result); 35 | } 36 | 37 | void VBox::IParallelPort::set_enabled(bool value) 38 | { 39 | COM_SetValue(get_IFC(), Enabled, value); 40 | } 41 | 42 | uint32_t VBox::IParallelPort::IOBase() const 43 | { 44 | COM_ULong result; 45 | COM_GetValue(get_IFC(), IOBase, result); 46 | return static_cast(result); 47 | } 48 | 49 | void VBox::IParallelPort::set_IOBase(uint32_t value) 50 | { 51 | COM_SetValue(get_IFC(), IOBase, value); 52 | } 53 | 54 | uint32_t VBox::IParallelPort::IRQ() const 55 | { 56 | COM_ULong result; 57 | COM_GetValue(get_IFC(), IRQ, result); 58 | return static_cast(result); 59 | } 60 | 61 | void VBox::IParallelPort::set_IRQ(uint32_t value) 62 | { 63 | COM_SetValue(get_IFC(), IRQ, value); 64 | } 65 | 66 | std::u16string VBox::IParallelPort::path() const 67 | { 68 | std::u16string result; 69 | COM_GetString(get_IFC(), Path, result); 70 | return result; 71 | } 72 | 73 | void VBox::IParallelPort::set_path(const std::u16string &value) 74 | { 75 | COM_SetString(get_IFC(), Path, value); 76 | } 77 | -------------------------------------------------------------------------------- /lib/form.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 1, 0) 22 | COM_WRAP_IFC(IForm) 23 | COM_WRAP_IFC(IVirtualSystemDescriptionForm) 24 | 25 | std::vector> VBox::IForm::values() const 26 | { 27 | std::vector> result; 28 | COM_GetArray_Wrap(get_IFC(), Values, result); 29 | return result; 30 | } 31 | 32 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 33 | std::vector VBox::IForm::getFieldGroup(const std::u16string &field) 34 | { 35 | COM_StringArrayProxy pResult; 36 | COM_StringProxy pField(field); 37 | 38 | auto rc = get_IFC()->GetFieldGroup(pField.m_text, COM_ArrayParameterRef(pResult)); 39 | COM_ERROR_CHECK(rc); 40 | 41 | std::vector result; 42 | pResult.toVector(result); 43 | return result; 44 | } 45 | 46 | VBox::COMPtr VBox::IForm::apply() 47 | { 48 | ::IProgress *cResult = nullptr; 49 | 50 | auto rc = get_IFC()->Apply(&cResult); 51 | COM_ERROR_CHECK(rc); 52 | 53 | return COMPtr::wrap(cResult); 54 | } 55 | #endif 56 | 57 | VBox::COMPtr 58 | VBox::IVirtualSystemDescriptionForm::getVirtualSystemDescription() 59 | { 60 | ::IVirtualSystemDescription *cResult = nullptr; 61 | 62 | auto rc = get_IFC()->GetVirtualSystemDescription(&cResult); 63 | COM_ERROR_CHECK(rc); 64 | 65 | return COMPtr::wrap(cResult); 66 | } 67 | #endif 68 | -------------------------------------------------------------------------------- /lib/internalprogresscontrol.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 22 | COM_WRAP_IFC(IInternalProgressControl) 23 | 24 | void VBox::IInternalProgressControl::setCurrentOperationProgress(uint32_t percent) 25 | { 26 | auto rc = get_IFC()->SetCurrentOperationProgress(percent); 27 | COM_ERROR_CHECK(rc); 28 | } 29 | 30 | void VBox::IInternalProgressControl::waitForOtherProgressCompletion( 31 | const COMPtr &progressOther, uint32_t timeoutMS) 32 | { 33 | auto rc = get_IFC()->WaitForOtherProgressCompletion(progressOther->get_IFC(), 34 | timeoutMS); 35 | COM_ERROR_CHECK(rc); 36 | } 37 | 38 | void VBox::IInternalProgressControl::setNextOperation( 39 | const std::u16string &nextOperationDescription, 40 | uint32_t nextOperationsWeight) 41 | { 42 | COM_StringProxy pNextOperationDescription(nextOperationDescription); 43 | 44 | auto rc = get_IFC()->SetNextOperation(pNextOperationDescription.m_text, 45 | nextOperationsWeight); 46 | COM_ERROR_CHECK(rc); 47 | } 48 | 49 | void VBox::IInternalProgressControl::notifyPointOfNoReturn() 50 | { 51 | auto rc = get_IFC()->NotifyPointOfNoReturn(); 52 | COM_ERROR_CHECK(rc); 53 | } 54 | 55 | void VBox::IInternalProgressControl::notifyComplete(int32_t resultCode, 56 | const COMPtr &errorInfo) 57 | { 58 | auto rc = get_IFC()->NotifyComplete(resultCode, errorInfo->get_IFC()); 59 | COM_ERROR_CHECK(rc); 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /lib/vetoevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IVetoEvent) 22 | 23 | void VBox::IVetoEvent::addVeto(const std::u16string &reason) 24 | { 25 | COM_StringProxy pReason(reason); 26 | auto rc = get_IFC()->AddVeto(pReason.m_text); 27 | COM_ERROR_CHECK(rc); 28 | } 29 | 30 | bool VBox::IVetoEvent::isVetoed() 31 | { 32 | COM_Bool result; 33 | auto rc = get_IFC()->IsVetoed(&result); 34 | COM_ERROR_CHECK(rc); 35 | return result; 36 | } 37 | 38 | std::vector VBox::IVetoEvent::getVetos() 39 | { 40 | COM_StringArrayProxy pResult; 41 | auto rc = get_IFC()->GetVetos(COM_ArrayParameterRef(pResult)); 42 | COM_ERROR_CHECK(rc); 43 | 44 | std::vector result; 45 | pResult.toVector(result); 46 | return result; 47 | } 48 | 49 | void VBox::IVetoEvent::addApproval(const std::u16string &reason) 50 | { 51 | COM_StringProxy pReason(reason); 52 | auto rc = get_IFC()->AddApproval(pReason.m_text); 53 | COM_ERROR_CHECK(rc); 54 | } 55 | 56 | bool VBox::IVetoEvent::isApproved() 57 | { 58 | COM_Bool result; 59 | auto rc = get_IFC()->IsApproved(&result); 60 | COM_ERROR_CHECK(rc); 61 | return result; 62 | } 63 | 64 | std::vector VBox::IVetoEvent::getApprovals() 65 | { 66 | COM_StringArrayProxy pResult; 67 | auto rc = get_IFC()->GetApprovals(COM_ArrayParameterRef(pResult)); 68 | COM_ERROR_CHECK(rc); 69 | 70 | std::vector result; 71 | pResult.toVector(result); 72 | return result; 73 | } 74 | -------------------------------------------------------------------------------- /lib/hostdrive.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(IHostDrive) 23 | 24 | std::u16string VBox::IHostDrive::drivePath() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), DrivePath, result); 28 | return result; 29 | } 30 | 31 | VBox::PartitioningType VBox::IHostDrive::partitioningType() const 32 | { 33 | COM_Enum(::PartitioningType) result; 34 | COM_GetValue(get_IFC(), PartitioningType, result); 35 | return static_cast(result); 36 | } 37 | 38 | std::u16string VBox::IHostDrive::uuid() const 39 | { 40 | std::u16string result; 41 | COM_GetString(get_IFC(), Uuid, result); 42 | return result; 43 | } 44 | 45 | uint32_t VBox::IHostDrive::sectorSize() const 46 | { 47 | COM_ULong result; 48 | COM_GetValue(get_IFC(), SectorSize, result); 49 | return static_cast(result); 50 | } 51 | 52 | int64_t VBox::IHostDrive::size() const 53 | { 54 | COM_Long64 result; 55 | COM_GetValue(get_IFC(), Size, result); 56 | return static_cast(result); 57 | } 58 | 59 | std::u16string VBox::IHostDrive::model() const 60 | { 61 | std::u16string result; 62 | COM_GetString(get_IFC(), Model, result); 63 | return result; 64 | } 65 | 66 | std::vector> VBox::IHostDrive::partitions() const 67 | { 68 | std::vector> result; 69 | COM_GetArray_Wrap(get_IFC(), Partitions, result); 70 | return result; 71 | } 72 | #endif 73 | -------------------------------------------------------------------------------- /lib/dndsource.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IDnDSource) 22 | COM_WRAP_IFC(IGuestDnDSource) 23 | 24 | VBox::DnDAction VBox::IDnDSource::dragIsPending(uint32_t screenId, 25 | std::vector *formats, std::vector *allowedActions) 26 | { 27 | COM_Enum(::DnDAction) cResult; 28 | COM_StringArrayProxy pFormats; 29 | COM_ArrayProxy pAllowedActions; 30 | 31 | auto rc = get_IFC()->DragIsPending(screenId, COM_ArrayParameterRef(pFormats), 32 | COM_ArrayParameterRef(pAllowedActions), &cResult); 33 | COM_ERROR_CHECK(rc); 34 | 35 | if (formats) 36 | pFormats.toVector(*formats); 37 | if (allowedActions) 38 | pAllowedActions.toVector(*allowedActions); 39 | return static_cast(cResult); 40 | } 41 | 42 | VBox::COMPtr VBox::IDnDSource::drop(const std::u16string &format, 43 | DnDAction action) 44 | { 45 | ::IProgress *cResult = nullptr; 46 | COM_StringProxy pFormat(format); 47 | auto cAction = static_cast(action); 48 | 49 | auto rc = get_IFC()->Drop(pFormat.m_text, cAction, &cResult); 50 | COM_ERROR_CHECK(rc); 51 | 52 | return COMPtr::wrap(cResult); 53 | } 54 | 55 | std::vector VBox::IDnDSource::receiveData() 56 | { 57 | COM_ArrayProxy pResult; 58 | 59 | auto rc = get_IFC()->ReceiveData(COM_ArrayParameterRef(pResult)); 60 | COM_ERROR_CHECK(rc); 61 | 62 | std::vector result; 63 | pResult.toVector(result); 64 | return result; 65 | } 66 | -------------------------------------------------------------------------------- /lib/keyboard.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IKeyboard) 22 | 23 | std::vector VBox::IKeyboard::keyboardLEDs() const 24 | { 25 | std::vector result; 26 | COM_GetArray(get_IFC(), KeyboardLEDs, COM_Enum(::KeyboardLED), result); 27 | return result; 28 | } 29 | 30 | VBox::COMPtr VBox::IKeyboard::eventSource() const 31 | { 32 | COMPtr result; 33 | COM_GetValue_Wrap(get_IFC(), EventSource, result); 34 | return result; 35 | } 36 | 37 | void VBox::IKeyboard::putScancode(int32_t scancode) 38 | { 39 | auto rc = get_IFC()->PutScancode(scancode); 40 | COM_ERROR_CHECK(rc); 41 | } 42 | 43 | uint32_t VBox::IKeyboard::putScancodes(const std::vector &scancodes) 44 | { 45 | COM_ULong cResult; 46 | COM_ArrayProxy pScancodes(scancodes); 47 | 48 | auto rc = get_IFC()->PutScancodes(COM_ArrayParameter(pScancodes), &cResult); 49 | COM_ERROR_CHECK(rc); 50 | 51 | return static_cast(cResult); 52 | } 53 | 54 | void VBox::IKeyboard::putCAD() 55 | { 56 | auto rc = get_IFC()->PutCAD(); 57 | COM_ERROR_CHECK(rc); 58 | } 59 | 60 | void VBox::IKeyboard::releaseKeys() 61 | { 62 | auto rc = get_IFC()->ReleaseKeys(); 63 | COM_ERROR_CHECK(rc); 64 | } 65 | 66 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 1, 0) 67 | void VBox::IKeyboard::putUsageCode(int32_t usageCode, int32_t usagePage, 68 | bool keyRelease) 69 | { 70 | auto rc = get_IFC()->PutUsageCode(usageCode, usagePage, keyRelease); 71 | COM_ERROR_CHECK(rc); 72 | } 73 | #endif 74 | -------------------------------------------------------------------------------- /lib/natredirectevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(INATRedirectEvent) 22 | 23 | uint32_t VBox::INATRedirectEvent::slot() const 24 | { 25 | COM_ULong result; 26 | COM_GetValue(get_IFC(), Slot, result); 27 | return static_cast(result); 28 | } 29 | 30 | bool VBox::INATRedirectEvent::remove() const 31 | { 32 | COM_Bool result; 33 | COM_GetValue(get_IFC(), Remove, result); 34 | return static_cast(result); 35 | } 36 | 37 | std::u16string VBox::INATRedirectEvent::name() const 38 | { 39 | std::u16string result; 40 | COM_GetString(get_IFC(), Name, result); 41 | return result; 42 | } 43 | 44 | VBox::NATProtocol VBox::INATRedirectEvent::proto() const 45 | { 46 | COM_Enum(::NATProtocol) result; 47 | COM_GetValue(get_IFC(), Proto, result); 48 | return static_cast(result); 49 | } 50 | 51 | std::u16string VBox::INATRedirectEvent::hostIP() const 52 | { 53 | std::u16string result; 54 | COM_GetString(get_IFC(), HostIP, result); 55 | return result; 56 | } 57 | 58 | int32_t VBox::INATRedirectEvent::hostPort() const 59 | { 60 | COM_Long result; 61 | COM_GetValue(get_IFC(), HostPort, result); 62 | return static_cast(result); 63 | } 64 | 65 | std::u16string VBox::INATRedirectEvent::guestIP() const 66 | { 67 | std::u16string result; 68 | COM_GetString(get_IFC(), GuestIP, result); 69 | return result; 70 | } 71 | 72 | int32_t VBox::INATRedirectEvent::guestPort() const 73 | { 74 | COM_Long result; 75 | COM_GetValue(get_IFC(), GuestPort, result); 76 | return static_cast(result); 77 | } 78 | -------------------------------------------------------------------------------- /lib/guestmultitouchevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IGuestMultiTouchEvent) 22 | 23 | int32_t VBox::IGuestMultiTouchEvent::contactCount() const 24 | { 25 | COM_Long result; 26 | COM_GetValue(get_IFC(), ContactCount, result); 27 | return static_cast(result); 28 | } 29 | 30 | std::vector VBox::IGuestMultiTouchEvent::xPositions() const 31 | { 32 | std::vector result; 33 | COM_GetArray(get_IFC(), XPositions, COM_Short, result); 34 | return result; 35 | } 36 | 37 | std::vector VBox::IGuestMultiTouchEvent::yPositions() const 38 | { 39 | std::vector result; 40 | COM_GetArray(get_IFC(), YPositions, COM_Short, result); 41 | return result; 42 | } 43 | 44 | std::vector VBox::IGuestMultiTouchEvent::contactIds() const 45 | { 46 | std::vector result; 47 | COM_GetArray(get_IFC(), ContactIds, COM_UShort, result); 48 | return result; 49 | } 50 | 51 | std::vector VBox::IGuestMultiTouchEvent::contactFlags() const 52 | { 53 | std::vector result; 54 | COM_GetArray(get_IFC(), ContactFlags, COM_UShort, result); 55 | return result; 56 | } 57 | 58 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 59 | bool VBox::IGuestMultiTouchEvent::isTouchScreen() const 60 | { 61 | COM_Bool result; 62 | COM_GetValue(get_IFC(), IsTouchScreen, result); 63 | return static_cast(result); 64 | } 65 | #endif 66 | 67 | uint32_t VBox::IGuestMultiTouchEvent::scanTime() const 68 | { 69 | COM_ULong result; 70 | COM_GetValue(get_IFC(), ScanTime, result); 71 | return static_cast(result); 72 | } 73 | -------------------------------------------------------------------------------- /lib/performancemetric.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IPerformanceMetric) 22 | 23 | std::u16string VBox::IPerformanceMetric::metricName() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), MetricName, result); 27 | return result; 28 | } 29 | 30 | VBox::COMPtr VBox::IPerformanceMetric::object() const 31 | { 32 | COMPtr result; 33 | COM_GetValue_Wrap(get_IFC(), Object, result); 34 | return result; 35 | } 36 | 37 | std::u16string VBox::IPerformanceMetric::description() const 38 | { 39 | std::u16string result; 40 | COM_GetString(get_IFC(), Description, result); 41 | return result; 42 | } 43 | 44 | uint32_t VBox::IPerformanceMetric::period() const 45 | { 46 | COM_ULong result; 47 | COM_GetValue(get_IFC(), Period, result); 48 | return static_cast(result); 49 | } 50 | 51 | uint32_t VBox::IPerformanceMetric::count() const 52 | { 53 | COM_ULong result; 54 | COM_GetValue(get_IFC(), Count, result); 55 | return static_cast(result); 56 | } 57 | 58 | std::u16string VBox::IPerformanceMetric::unit() const 59 | { 60 | std::u16string result; 61 | COM_GetString(get_IFC(), Unit, result); 62 | return result; 63 | } 64 | 65 | int32_t VBox::IPerformanceMetric::minimumValue() const 66 | { 67 | COM_Long result; 68 | COM_GetValue(get_IFC(), MinimumValue, result); 69 | return static_cast(result); 70 | } 71 | 72 | int32_t VBox::IPerformanceMetric::maximumValue() const 73 | { 74 | COM_Long result; 75 | COM_GetValue(get_IFC(), MaximumValue, result); 76 | return static_cast(result); 77 | } 78 | -------------------------------------------------------------------------------- /lib/guestadditionsstatuschangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 10) \ 22 | || ( VirtualBoxSDK_VERSION < VBox_MAKE_VERSION(6, 0, 0) \ 23 | && VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(5, 2, 32) ) 24 | COM_WRAP_IFC(IGuestAdditionsStatusChangedEvent) 25 | 26 | VBox::AdditionsFacilityType VBox::IGuestAdditionsStatusChangedEvent::facility() const 27 | { 28 | COM_Enum(::AdditionsFacilityType) result; 29 | COM_GetValue(get_IFC(), Facility, result); 30 | return static_cast(result); 31 | } 32 | 33 | #if VirtualBoxSDK_VERSION < VBox_MAKE_VERSION(6, 1, 0) 34 | void VBox::IGuestAdditionsStatusChangedEvent::set_facility(AdditionsFacilityType value) 35 | { 36 | COM_SetValue(get_IFC(), Facility, 37 | static_cast(value)); 38 | } 39 | #endif 40 | 41 | VBox::AdditionsFacilityStatus VBox::IGuestAdditionsStatusChangedEvent::status() const 42 | { 43 | COM_Enum(::AdditionsFacilityStatus) result; 44 | COM_GetValue(get_IFC(), Status, result); 45 | return static_cast(result); 46 | } 47 | 48 | VBox::AdditionsRunLevelType VBox::IGuestAdditionsStatusChangedEvent::runLevel() const 49 | { 50 | COM_Enum(::AdditionsRunLevelType) result; 51 | COM_GetValue(get_IFC(), RunLevel, result); 52 | return static_cast(result); 53 | } 54 | 55 | int64_t VBox::IGuestAdditionsStatusChangedEvent::timestamp() const 56 | { 57 | COM_Long64 result; 58 | COM_GetValue(get_IFC(), Timestamp, result); 59 | return static_cast(result); 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /lib/cloudprovidermanager.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 22 | COM_WRAP_IFC(ICloudProviderManager) 23 | 24 | std::vector> 25 | VBox::ICloudProviderManager::providers() const 26 | { 27 | std::vector> result; 28 | COM_GetArray_Wrap(get_IFC(), Providers, result); 29 | return result; 30 | } 31 | 32 | VBox::COMPtr VBox::ICloudProviderManager::getProviderById( 33 | const std::u16string &providerId) 34 | { 35 | ::ICloudProvider *cResult = nullptr; 36 | COM_StringProxy pProviderId(providerId); 37 | 38 | auto rc = get_IFC()->GetProviderById(pProviderId.m_text, &cResult); 39 | COM_ERROR_CHECK(rc); 40 | 41 | return COMPtr::wrap(cResult); 42 | } 43 | 44 | VBox::COMPtr VBox::ICloudProviderManager::getProviderByShortName( 45 | const std::u16string &providerName) 46 | { 47 | ::ICloudProvider *cResult = nullptr; 48 | COM_StringProxy pProviderName(providerName); 49 | 50 | auto rc = get_IFC()->GetProviderByShortName(pProviderName.m_text, &cResult); 51 | COM_ERROR_CHECK(rc); 52 | 53 | return COMPtr::wrap(cResult); 54 | } 55 | 56 | VBox::COMPtr VBox::ICloudProviderManager::getProviderByName( 57 | const std::u16string &providerName) 58 | { 59 | ::ICloudProvider *cResult = nullptr; 60 | COM_StringProxy pProviderName(providerName); 61 | 62 | auto rc = get_IFC()->GetProviderByName(pProviderName.m_text, &cResult); 63 | COM_ERROR_CHECK(rc); 64 | 65 | return COMPtr::wrap(cResult); 66 | } 67 | #endif 68 | -------------------------------------------------------------------------------- /lib/bandwidthcontrol.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IBandwidthControl) 22 | 23 | uint32_t VBox::IBandwidthControl::numGroups() const 24 | { 25 | COM_ULong result; 26 | COM_GetValue(get_IFC(), NumGroups, result); 27 | return static_cast(result); 28 | } 29 | 30 | void VBox::IBandwidthControl::createBandwidthGroup(const std::u16string &name, 31 | BandwidthGroupType type, int64_t maxBytesPerSec) 32 | { 33 | COM_StringProxy pName(name); 34 | auto cType = static_cast(type); 35 | 36 | auto rc = get_IFC()->CreateBandwidthGroup(pName.m_text, cType, maxBytesPerSec); 37 | COM_ERROR_CHECK(rc); 38 | } 39 | 40 | void VBox::IBandwidthControl::deleteBandwidthGroup(const std::u16string &name) 41 | { 42 | COM_StringProxy pName(name); 43 | 44 | auto rc = get_IFC()->DeleteBandwidthGroup(pName.m_text); 45 | COM_ERROR_CHECK(rc); 46 | } 47 | 48 | VBox::COMPtr VBox::IBandwidthControl::getBandwidthGroup( 49 | const std::u16string &name) const 50 | { 51 | ::IBandwidthGroup *cResult = nullptr; 52 | COM_StringProxy pName(name); 53 | 54 | auto rc = get_IFC()->GetBandwidthGroup(pName.m_text, &cResult); 55 | COM_ERROR_CHECK(rc); 56 | 57 | return COMPtr::wrap(cResult); 58 | } 59 | 60 | std::vector> 61 | VBox::IBandwidthControl::getAllBandwidthGroups() const 62 | { 63 | COM_ArrayProxy<::IBandwidthGroup *> pResult; 64 | 65 | auto rc = get_IFC()->GetAllBandwidthGroups(COM_ArrayParameterRef(pResult)); 66 | COM_ERROR_CHECK(rc); 67 | 68 | std::vector> result; 69 | pResult.toVector(result); 70 | return result; 71 | } 72 | -------------------------------------------------------------------------------- /lib/guestfileevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IGuestFileEvent) 22 | COM_WRAP_IFC(IGuestFileRegisteredEvent) 23 | COM_WRAP_IFC(IGuestFileStateChangedEvent) 24 | 25 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 10) \ 26 | || ( VirtualBoxSDK_VERSION < VBox_MAKE_VERSION(6, 0, 0) \ 27 | && VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(5, 2, 32) ) 28 | COM_WRAP_IFC(IGuestFileSizeChangedEvent) 29 | #endif 30 | 31 | VBox::COMPtr VBox::IGuestFileEvent::file() const 32 | { 33 | COMPtr result; 34 | COM_GetValue_Wrap(get_IFC(), File, result); 35 | return result; 36 | } 37 | 38 | bool VBox::IGuestFileRegisteredEvent::registered() const 39 | { 40 | COM_Bool result; 41 | COM_GetValue(get_IFC(), Registered, result); 42 | return static_cast(result); 43 | } 44 | 45 | VBox::FileStatus VBox::IGuestFileStateChangedEvent::status() const 46 | { 47 | COM_Enum(::FileStatus) result; 48 | COM_GetValue(get_IFC(), Status, result); 49 | return static_cast(result); 50 | } 51 | 52 | VBox::COMPtr 53 | VBox::IGuestFileStateChangedEvent::error() const 54 | { 55 | COMPtr result; 56 | COM_GetValue_Wrap(get_IFC(), Error, result); 57 | return result; 58 | } 59 | 60 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 10) \ 61 | || ( VirtualBoxSDK_VERSION < VBox_MAKE_VERSION(6, 0, 0) \ 62 | && VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(5, 2, 32) ) 63 | int64_t VBox::IGuestFileSizeChangedEvent::newSize() const 64 | { 65 | COM_Long64 result; 66 | COM_GetValue(get_IFC(), NewSize, result); 67 | return static_cast(result); 68 | } 69 | #endif 70 | -------------------------------------------------------------------------------- /lib/guestmonitorchangedevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IGuestMonitorChangedEvent) 22 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 1, 0) 23 | COM_WRAP_IFC(IGuestMonitorInfoChangedEvent) 24 | #endif 25 | 26 | VBox::GuestMonitorChangedEventType VBox::IGuestMonitorChangedEvent::changeType() const 27 | { 28 | COM_Enum(::GuestMonitorChangedEventType) result; 29 | COM_GetValue(get_IFC(), ChangeType, result); 30 | return static_cast(result); 31 | } 32 | 33 | uint32_t VBox::IGuestMonitorChangedEvent::screenId() const 34 | { 35 | COM_ULong result; 36 | COM_GetValue(get_IFC(), ScreenId, result); 37 | return static_cast(result); 38 | } 39 | 40 | uint32_t VBox::IGuestMonitorChangedEvent::originX() const 41 | { 42 | COM_ULong result; 43 | COM_GetValue(get_IFC(), OriginX, result); 44 | return static_cast(result); 45 | } 46 | 47 | uint32_t VBox::IGuestMonitorChangedEvent::originY() const 48 | { 49 | COM_ULong result; 50 | COM_GetValue(get_IFC(), OriginY, result); 51 | return static_cast(result); 52 | } 53 | 54 | uint32_t VBox::IGuestMonitorChangedEvent::width() const 55 | { 56 | COM_ULong result; 57 | COM_GetValue(get_IFC(), Width, result); 58 | return static_cast(result); 59 | } 60 | 61 | uint32_t VBox::IGuestMonitorChangedEvent::height() const 62 | { 63 | COM_ULong result; 64 | COM_GetValue(get_IFC(), Height, result); 65 | return static_cast(result); 66 | } 67 | 68 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 1, 0) 69 | uint32_t VBox::IGuestMonitorInfoChangedEvent::output() const 70 | { 71 | COM_ULong result; 72 | COM_GetValue(get_IFC(), Output, result); 73 | return static_cast(result); 74 | } 75 | #endif 76 | -------------------------------------------------------------------------------- /lib/guestdebugcontrol.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(IGuestDebugControl) 23 | 24 | VBox::GuestDebugProvider VBox::IGuestDebugControl::debugProvider() const 25 | { 26 | COM_Enum(::GuestDebugProvider) result; 27 | COM_GetValue(get_IFC(), DebugProvider, result); 28 | return static_cast(result); 29 | } 30 | 31 | void VBox::IGuestDebugControl::set_debugProvider(GuestDebugProvider value) 32 | { 33 | COM_SetValue(get_IFC(), DebugProvider, 34 | static_cast(value)); 35 | } 36 | 37 | VBox::GuestDebugIoProvider VBox::IGuestDebugControl::debugIoProvider() const 38 | { 39 | COM_Enum(::GuestDebugIoProvider) result; 40 | COM_GetValue(get_IFC(), DebugIoProvider, result); 41 | return static_cast(result); 42 | } 43 | 44 | void VBox::IGuestDebugControl::set_debugIoProvider(GuestDebugIoProvider value) 45 | { 46 | COM_SetValue(get_IFC(), DebugIoProvider, 47 | static_cast(value)); 48 | } 49 | 50 | std::u16string VBox::IGuestDebugControl::debugAddress() const 51 | { 52 | std::u16string result; 53 | COM_GetString(get_IFC(), DebugAddress, result); 54 | return result; 55 | } 56 | 57 | void VBox::IGuestDebugControl::set_debugAddress(const std::u16string &value) 58 | { 59 | COM_SetString(get_IFC(), DebugAddress, value); 60 | } 61 | 62 | uint32_t VBox::IGuestDebugControl::debugPort() const 63 | { 64 | COM_ULong result; 65 | COM_GetValue(get_IFC(), DebugPort, result); 66 | return static_cast(result); 67 | } 68 | 69 | void VBox::IGuestDebugControl::set_debugPort(uint32_t value) 70 | { 71 | COM_SetValue(get_IFC(), DebugPort, value); 72 | } 73 | #endif 74 | -------------------------------------------------------------------------------- /lib/guestdirectoryevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2024 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 22 | COM_WRAP_IFC(IGuestDirectoryEvent) 23 | COM_WRAP_IFC(IGuestDirectoryRegisteredEvent) 24 | COM_WRAP_IFC(IGuestDirectoryStateChangedEvent) 25 | COM_WRAP_IFC(IGuestDirectoryReadEvent) 26 | 27 | VBox::COMPtr VBox::IGuestDirectoryEvent::directory() const 28 | { 29 | COMPtr result; 30 | COM_GetValue_Wrap(get_IFC(), Directory, result); 31 | return result; 32 | } 33 | 34 | bool VBox::IGuestDirectoryRegisteredEvent::registered() const 35 | { 36 | COM_Bool result; 37 | COM_GetValue(get_IFC(), Registered, result); 38 | return static_cast(result); 39 | } 40 | 41 | VBox::DirectoryStatus VBox::IGuestDirectoryStateChangedEvent::status() const 42 | { 43 | COM_Enum(::DirectoryStatus) result; 44 | COM_GetValue(get_IFC(), Status, result); 45 | return static_cast(result); 46 | } 47 | 48 | VBox::COMPtr 49 | VBox::IGuestDirectoryStateChangedEvent::error() const 50 | { 51 | COMPtr result; 52 | COM_GetValue_Wrap(get_IFC(), Error, result); 53 | return result; 54 | } 55 | 56 | std::u16string VBox::IGuestDirectoryReadEvent::path() const 57 | { 58 | std::u16string result; 59 | COM_GetString(get_IFC(), Path, result); 60 | return result; 61 | } 62 | 63 | VBox::COMPtr VBox::IGuestDirectoryReadEvent::objInfo() const 64 | { 65 | COMPtr result; 66 | COM_GetValue_Wrap(get_IFC(), ObjInfo, result); 67 | return result; 68 | } 69 | 70 | std::u16string VBox::IGuestDirectoryReadEvent::owner() const 71 | { 72 | std::u16string result; 73 | COM_GetString(get_IFC(), Owner, result); 74 | return result; 75 | } 76 | 77 | std::u16string VBox::IGuestDirectoryReadEvent::groups() const 78 | { 79 | std::u16string result; 80 | COM_GetString(get_IFC(), Groups, result); 81 | return result; 82 | } 83 | #endif 84 | -------------------------------------------------------------------------------- /lib/errorwrap.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_errors.h" 20 | 21 | std::string VBox::COMError::error_message(uint32_t rc, const char *name) 22 | { 23 | char buffer[64]; 24 | if (name) 25 | snprintf(buffer, sizeof(buffer), "COM Error %#x: %s", rc, name); 26 | else 27 | snprintf(buffer, sizeof(buffer), "COM Error %#x", rc); 28 | return buffer; 29 | } 30 | 31 | void VBox::COMError::raise(uint32_t rc) 32 | { 33 | switch (rc) { 34 | case E_NOTIMPL: 35 | throw ENotImpl(); 36 | case E_POINTER: 37 | throw EPointer(); 38 | case E_ABORT: 39 | throw EAbort(); 40 | case E_FAIL: 41 | throw EFail(); 42 | case E_ACCESSDENIED: 43 | throw EAccessDenied(); 44 | case E_OUTOFMEMORY: 45 | throw EOutOfMemory(); 46 | case E_INVALIDARG: 47 | throw EInvalidArg(); 48 | case E_UNEXPECTED: 49 | throw EUnexpected(); 50 | case E_OBJECT_NOT_FOUND: 51 | throw EObjectNotFound(); 52 | case E_INVALID_VM_STATE: 53 | throw EInvalidVMState(); 54 | case E_VM_ERROR: 55 | throw EVMError(); 56 | case E_FILE_ERROR: 57 | throw EFileError(); 58 | case E_IPRT_ERROR: 59 | throw EIPRTError(); 60 | case E_PDM_ERROR: 61 | throw EPDMError(); 62 | case E_INVALID_OBJECT_STATE: 63 | throw EInvalidObjectState(); 64 | case E_HOST_ERROR: 65 | throw EHostError(); 66 | case E_NOT_SUPPORTED: 67 | throw ENotSupported(); 68 | case E_XML_ERROR: 69 | throw EXMLError(); 70 | case E_INVALID_SESSION_STATE: 71 | throw EInvalidSessionState(); 72 | case E_OBJECT_IN_USE: 73 | throw EObjectInUse(); 74 | case E_PASSWORD_INCORRECT: 75 | throw EPasswordIncorrect(); 76 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 77 | case E_MAXIMUM_REACHED: 78 | throw EMaximumReached(); 79 | case E_GSTCTL_GUEST_ERROR: 80 | throw EGstctlGuestError(); 81 | case E_TIMEOUT: 82 | throw ETimeout(); 83 | #endif 84 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 6) 85 | case E_DND_ERROR: 86 | throw EDndError(); 87 | #endif 88 | default: 89 | throw COMError(rc); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/guestscreeninfo.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(5, 1, 0) 22 | COM_WRAP_IFC(IGuestScreenInfo) 23 | 24 | uint32_t VBox::IGuestScreenInfo::screenId() const 25 | { 26 | COM_ULong result; 27 | COM_GetValue(get_IFC(), ScreenId, result); 28 | return static_cast(result); 29 | } 30 | 31 | VBox::GuestMonitorStatus VBox::IGuestScreenInfo::guestMonitorStatus() const 32 | { 33 | COM_Enum(::GuestMonitorStatus) result; 34 | COM_GetValue(get_IFC(), GuestMonitorStatus, result); 35 | return static_cast(result); 36 | } 37 | 38 | bool VBox::IGuestScreenInfo::primary() const 39 | { 40 | COM_Bool result; 41 | COM_GetValue(get_IFC(), Primary, result); 42 | return static_cast(result); 43 | } 44 | 45 | bool VBox::IGuestScreenInfo::origin() const 46 | { 47 | COM_Bool result; 48 | COM_GetValue(get_IFC(), Origin, result); 49 | return static_cast(result); 50 | } 51 | 52 | int32_t VBox::IGuestScreenInfo::originX() const 53 | { 54 | COM_Long result; 55 | COM_GetValue(get_IFC(), OriginX, result); 56 | return static_cast(result); 57 | } 58 | 59 | int32_t VBox::IGuestScreenInfo::originY() const 60 | { 61 | COM_Long result; 62 | COM_GetValue(get_IFC(), OriginY, result); 63 | return static_cast(result); 64 | } 65 | 66 | uint32_t VBox::IGuestScreenInfo::width() const 67 | { 68 | COM_ULong result; 69 | COM_GetValue(get_IFC(), Width, result); 70 | return static_cast(result); 71 | } 72 | 73 | uint32_t VBox::IGuestScreenInfo::height() const 74 | { 75 | COM_ULong result; 76 | COM_GetValue(get_IFC(), Height, result); 77 | return static_cast(result); 78 | } 79 | 80 | uint32_t VBox::IGuestScreenInfo::bitsPerPixel() const 81 | { 82 | COM_ULong result; 83 | COM_GetValue(get_IFC(), BitsPerPixel, result); 84 | return static_cast(result); 85 | } 86 | 87 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(5, 2, 0) 88 | std::u16string VBox::IGuestScreenInfo::extendedInfo() const 89 | { 90 | std::u16string result; 91 | COM_GetString(get_IFC(), ExtendedInfo, result); 92 | return result; 93 | } 94 | #endif 95 | #endif 96 | -------------------------------------------------------------------------------- /lib/machineevent.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IMachineEvent) 22 | COM_WRAP_IFC(IMachineStateChangedEvent) 23 | COM_WRAP_IFC(IMachineDataChangedEvent) 24 | COM_WRAP_IFC(IMachineRegisteredEvent) 25 | COM_WRAP_IFC(ISessionStateChangedEvent) 26 | COM_WRAP_IFC(IGuestPropertyChangedEvent) 27 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 4) 28 | COM_WRAP_IFC(IMachineGroupsChangedEvent) 29 | #endif 30 | 31 | std::u16string VBox::IMachineEvent::machineId() const 32 | { 33 | std::u16string result; 34 | COM_GetString(get_IFC(), MachineId, result); 35 | return result; 36 | } 37 | 38 | VBox::MachineState VBox::IMachineStateChangedEvent::state() const 39 | { 40 | COM_Enum(::MachineState) result; 41 | COM_GetValue(get_IFC(), State, result); 42 | return static_cast(result); 43 | } 44 | 45 | bool VBox::IMachineDataChangedEvent::temporary() const 46 | { 47 | COM_Bool result; 48 | COM_GetValue(get_IFC(), Temporary, result); 49 | return static_cast(result); 50 | } 51 | 52 | bool VBox::IMachineRegisteredEvent::registered() const 53 | { 54 | COM_Bool result; 55 | COM_GetValue(get_IFC(), Registered, result); 56 | return static_cast(result); 57 | } 58 | 59 | VBox::SessionState VBox::ISessionStateChangedEvent::state() const 60 | { 61 | COM_Enum(::SessionState) result; 62 | COM_GetValue(get_IFC(), State, result); 63 | return static_cast(result); 64 | } 65 | 66 | std::u16string VBox::IGuestPropertyChangedEvent::name() const 67 | { 68 | std::u16string result; 69 | COM_GetString(get_IFC(), Name, result); 70 | return result; 71 | } 72 | 73 | std::u16string VBox::IGuestPropertyChangedEvent::value() const 74 | { 75 | std::u16string result; 76 | COM_GetString(get_IFC(), Value, result); 77 | return result; 78 | } 79 | 80 | std::u16string VBox::IGuestPropertyChangedEvent::flags() const 81 | { 82 | std::u16string result; 83 | COM_GetString(get_IFC(), Flags, result); 84 | return result; 85 | } 86 | 87 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 88 | bool VBox::IGuestPropertyChangedEvent::fWasDeleted() const 89 | { 90 | COM_Bool result; 91 | COM_GetValue(get_IFC(), FWasDeleted, result); 92 | return static_cast(result); 93 | } 94 | #endif 95 | -------------------------------------------------------------------------------- /lib/eventsource.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IEventSource) 22 | 23 | VBox::COMPtr VBox::IEventSource::createListener() 24 | { 25 | ::IEventListener *cResult = nullptr; 26 | 27 | auto rc = get_IFC()->CreateListener(&cResult); 28 | COM_ERROR_CHECK(rc); 29 | 30 | return COMPtr::wrap(cResult); 31 | } 32 | 33 | VBox::COMPtr VBox::IEventSource::createAggregator( 34 | const std::vector> &subordinates) 35 | { 36 | ::IEventSource *cResult = nullptr; 37 | COM_ArrayProxy<::IEventSource *> pSubordinates(subordinates); 38 | 39 | auto rc = get_IFC()->CreateAggregator(COM_ArrayParameter(pSubordinates), &cResult); 40 | COM_ERROR_CHECK(rc); 41 | 42 | return COMPtr::wrap(cResult); 43 | } 44 | 45 | void VBox::IEventSource::registerListener(const COMPtr &listener, 46 | const std::vector &interesting, bool active) 47 | { 48 | COM_ArrayProxy pInteresting(interesting); 49 | 50 | auto rc = get_IFC()->RegisterListener(listener->get_IFC(), 51 | COM_ArrayParameter(pInteresting), active); 52 | COM_ERROR_CHECK(rc); 53 | } 54 | 55 | void VBox::IEventSource::unregisterListener(const COMPtr &listener) 56 | { 57 | auto rc = get_IFC()->UnregisterListener(listener->get_IFC()); 58 | COM_ERROR_CHECK(rc); 59 | } 60 | 61 | bool VBox::IEventSource::fireEvent(const COMPtr &event, int32_t timeout) 62 | { 63 | COM_Bool cResult; 64 | 65 | auto rc = get_IFC()->FireEvent(event->get_IFC(), timeout, &cResult); 66 | COM_ERROR_CHECK(rc); 67 | 68 | return static_cast(cResult); 69 | } 70 | 71 | VBox::COMPtr VBox::IEventSource::getEvent( 72 | const COMPtr &listener, int32_t timeout) 73 | { 74 | ::IEvent *cResult = nullptr; 75 | 76 | auto rc = get_IFC()->GetEvent(listener->get_IFC(), timeout, &cResult); 77 | COM_ERROR_CHECK(rc); 78 | 79 | return COMPtr::wrap(cResult); 80 | } 81 | 82 | void VBox::IEventSource::eventProcessed(const COMPtr &listener, 83 | const COMPtr &event) 84 | { 85 | auto rc = get_IFC()->EventProcessed(listener->get_IFC(), event->get_IFC()); 86 | COM_ERROR_CHECK(rc); 87 | } 88 | -------------------------------------------------------------------------------- /lib/hostonlynetwork.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(IHostOnlyNetwork) 23 | 24 | std::u16string VBox::IHostOnlyNetwork::networkName() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), NetworkName, result); 28 | return result; 29 | } 30 | 31 | void VBox::IHostOnlyNetwork::set_networkName(const std::u16string &value) 32 | { 33 | COM_SetString(get_IFC(), NetworkName, value); 34 | } 35 | 36 | bool VBox::IHostOnlyNetwork::enabled() const 37 | { 38 | COM_Bool result; 39 | COM_GetValue(get_IFC(), Enabled, result); 40 | return static_cast(result); 41 | } 42 | 43 | void VBox::IHostOnlyNetwork::set_enabled(bool value) 44 | { 45 | COM_SetValue(get_IFC(), Enabled, value); 46 | } 47 | 48 | std::u16string VBox::IHostOnlyNetwork::networkMask() const 49 | { 50 | std::u16string result; 51 | COM_GetString(get_IFC(), NetworkMask, result); 52 | return result; 53 | } 54 | 55 | void VBox::IHostOnlyNetwork::set_networkMask(const std::u16string &value) 56 | { 57 | COM_SetString(get_IFC(), NetworkMask, value); 58 | } 59 | 60 | std::u16string VBox::IHostOnlyNetwork::hostIP() const 61 | { 62 | std::u16string result; 63 | COM_GetString(get_IFC(), HostIP, result); 64 | return result; 65 | } 66 | 67 | std::u16string VBox::IHostOnlyNetwork::lowerIP() const 68 | { 69 | std::u16string result; 70 | COM_GetString(get_IFC(), LowerIP, result); 71 | return result; 72 | } 73 | 74 | void VBox::IHostOnlyNetwork::set_lowerIP(const std::u16string &value) 75 | { 76 | COM_SetString(get_IFC(), LowerIP, value); 77 | } 78 | 79 | std::u16string VBox::IHostOnlyNetwork::upperIP() const 80 | { 81 | std::u16string result; 82 | COM_GetString(get_IFC(), UpperIP, result); 83 | return result; 84 | } 85 | 86 | void VBox::IHostOnlyNetwork::set_upperIP(const std::u16string &value) 87 | { 88 | COM_SetString(get_IFC(), UpperIP, value); 89 | } 90 | 91 | std::u16string VBox::IHostOnlyNetwork::id() const 92 | { 93 | std::u16string result; 94 | COM_GetString(get_IFC(), Id, result); 95 | return result; 96 | } 97 | 98 | void VBox::IHostOnlyNetwork::set_id(const std::u16string &value) 99 | { 100 | COM_SetString(get_IFC(), Id, value); 101 | } 102 | #endif 103 | -------------------------------------------------------------------------------- /lib/recordingsettings.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 22 | COM_WRAP_IFC(IRecordingSettings) 23 | 24 | bool VBox::IRecordingSettings::enabled() const 25 | { 26 | COM_Bool result; 27 | COM_GetValue(get_IFC(), Enabled, result); 28 | return static_cast(result); 29 | } 30 | 31 | void VBox::IRecordingSettings::set_enabled(bool value) 32 | { 33 | COM_SetValue(get_IFC(), Enabled, value); 34 | } 35 | 36 | std::vector> 37 | VBox::IRecordingSettings::screens() const 38 | { 39 | std::vector> result; 40 | COM_GetArray_Wrap(get_IFC(), Screens, result); 41 | return result; 42 | } 43 | 44 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 45 | VBox::COMPtr VBox::IRecordingSettings::progress() const 46 | { 47 | COMPtr result; 48 | COM_GetValue_Wrap(get_IFC(), Progress, result); 49 | return result; 50 | } 51 | #endif 52 | 53 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 2, 0) 54 | bool VBox::IRecordingSettings::paused() const 55 | { 56 | COM_Bool result; 57 | COM_GetValue(get_IFC(), Paused, result); 58 | return static_cast(result); 59 | } 60 | 61 | void VBox::IRecordingSettings::set_paused(bool value) 62 | { 63 | COM_SetValue(get_IFC(), Paused, value); 64 | } 65 | #endif 66 | 67 | VBox::COMPtr 68 | VBox::IRecordingSettings::getScreenSettings(uint32_t screenId) 69 | { 70 | ::IRecordingScreenSettings *cResult = nullptr; 71 | 72 | auto rc = get_IFC()->GetScreenSettings(screenId, &cResult); 73 | COM_ERROR_CHECK(rc); 74 | 75 | return COMPtr::wrap(cResult); 76 | } 77 | 78 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 79 | VBox::COMPtr VBox::IRecordingSettings::start() 80 | { 81 | ::IProgress *cResult = nullptr; 82 | 83 | auto rc = get_IFC()->Start(&cResult); 84 | COM_ERROR_CHECK(rc); 85 | 86 | return COMPtr::wrap(cResult); 87 | } 88 | #endif 89 | 90 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 2, 0) 91 | void VBox::IRecordingSettings::resume() 92 | { 93 | auto rc = get_IFC()->Resume(); 94 | COM_ERROR_CHECK(rc); 95 | } 96 | 97 | #endif 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /lib/sharedfolder.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(ISharedFolder) 22 | 23 | std::u16string VBox::ISharedFolder::name() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Name, result); 27 | return result; 28 | } 29 | 30 | std::u16string VBox::ISharedFolder::hostPath() const 31 | { 32 | std::u16string result; 33 | COM_GetString(get_IFC(), HostPath, result); 34 | return result; 35 | } 36 | 37 | bool VBox::ISharedFolder::accessible() const 38 | { 39 | COM_Bool result; 40 | COM_GetValue(get_IFC(), Accessible, result); 41 | return static_cast(result); 42 | } 43 | 44 | bool VBox::ISharedFolder::writable() const 45 | { 46 | COM_Bool result; 47 | COM_GetValue(get_IFC(), Writable, result); 48 | return static_cast(result); 49 | } 50 | 51 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 52 | void VBox::ISharedFolder::set_writable(bool value) 53 | { 54 | COM_SetValue(get_IFC(), Writable, value); 55 | } 56 | #endif 57 | 58 | bool VBox::ISharedFolder::autoMount() const 59 | { 60 | COM_Bool result; 61 | COM_GetValue(get_IFC(), AutoMount, result); 62 | return static_cast(result); 63 | } 64 | 65 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 66 | void VBox::ISharedFolder::set_autoMount(bool value) 67 | { 68 | COM_SetValue(get_IFC(), AutoMount, value); 69 | } 70 | #endif 71 | 72 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 73 | std::u16string VBox::ISharedFolder::autoMountPoint() const 74 | { 75 | std::u16string result; 76 | COM_GetString(get_IFC(), AutoMountPoint, result); 77 | return result; 78 | } 79 | 80 | void VBox::ISharedFolder::set_autoMountPoint(const std::u16string &value) 81 | { 82 | COM_SetString(get_IFC(), AutoMountPoint, value); 83 | } 84 | #endif 85 | 86 | std::u16string VBox::ISharedFolder::lastAccessError() const 87 | { 88 | std::u16string result; 89 | COM_GetString(get_IFC(), LastAccessError, result); 90 | return result; 91 | } 92 | 93 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 94 | VBox::SymlinkPolicy VBox::ISharedFolder::symlinkPolicy() const 95 | { 96 | COM_Enum(::SymlinkPolicy) result; 97 | COM_GetValue(get_IFC(), SymlinkPolicy, result); 98 | return static_cast(result); 99 | } 100 | #endif 101 | -------------------------------------------------------------------------------- /lib/directory.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IDirectory) 22 | COM_WRAP_IFC(IGuestDirectory) 23 | 24 | std::u16string VBox::IDirectory::directoryName() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), DirectoryName, result); 28 | return result; 29 | } 30 | 31 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 32 | VBox::COMPtr VBox::IDirectory::eventSource() const 33 | { 34 | COMPtr result; 35 | COM_GetValue_Wrap(get_IFC(), EventSource, result); 36 | return result; 37 | } 38 | #endif 39 | 40 | std::u16string VBox::IDirectory::filter() const 41 | { 42 | std::u16string result; 43 | COM_GetString(get_IFC(), Filter, result); 44 | return result; 45 | } 46 | 47 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 48 | uint32_t VBox::IDirectory::id() const 49 | { 50 | COM_ULong result; 51 | COM_GetValue(get_IFC(), Id, result); 52 | return static_cast(result); 53 | } 54 | 55 | VBox::DirectoryStatus VBox::IDirectory::status() const 56 | { 57 | COM_Enum(::DirectoryStatus) result; 58 | COM_GetValue(get_IFC(), Status, result); 59 | return static_cast(result); 60 | } 61 | #endif 62 | 63 | void VBox::IDirectory::close() 64 | { 65 | auto rc = get_IFC()->Close(); 66 | COM_ERROR_CHECK(rc); 67 | } 68 | 69 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 70 | std::vector> VBox::IDirectory::list(uint32_t maxEntries) 71 | { 72 | COM_ArrayProxy<::IFsObjInfo *> pResult; 73 | auto cMaxEntries = static_cast(maxEntries); 74 | 75 | auto rc = get_IFC()->List(cMaxEntries, COM_ArrayParameterRef(pResult)); 76 | COM_ERROR_CHECK(rc); 77 | 78 | std::vector> result; 79 | pResult.toVector(result); 80 | return result; 81 | } 82 | #endif 83 | 84 | VBox::COMPtr VBox::IDirectory::read() 85 | { 86 | ::IFsObjInfo *cResult = nullptr; 87 | 88 | auto rc = get_IFC()->Read(&cResult); 89 | COM_ERROR_CHECK(rc); 90 | 91 | return COMPtr::wrap(cResult); 92 | } 93 | 94 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 95 | void VBox::IDirectory::rewind() 96 | { 97 | auto rc = get_IFC()->Rewind(); 98 | COM_ERROR_CHECK(rc); 99 | } 100 | #endif 101 | -------------------------------------------------------------------------------- /lib/snapshot.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(ISnapshot) 22 | 23 | std::u16string VBox::ISnapshot::id() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Id, result); 27 | return result; 28 | } 29 | 30 | std::u16string VBox::ISnapshot::name() const 31 | { 32 | std::u16string result; 33 | COM_GetString(get_IFC(), Name, result); 34 | return result; 35 | } 36 | 37 | void VBox::ISnapshot::set_name(const std::u16string &value) 38 | { 39 | COM_SetString(get_IFC(), Name, value); 40 | } 41 | 42 | std::u16string VBox::ISnapshot::description() const 43 | { 44 | std::u16string result; 45 | COM_GetString(get_IFC(), Description, result); 46 | return result; 47 | } 48 | 49 | void VBox::ISnapshot::set_description(const std::u16string &value) 50 | { 51 | COM_SetString(get_IFC(), Description, value); 52 | } 53 | 54 | int64_t VBox::ISnapshot::timeStamp() const 55 | { 56 | COM_Long64 result; 57 | COM_GetValue(get_IFC(), TimeStamp, result); 58 | return static_cast(result); 59 | } 60 | 61 | bool VBox::ISnapshot::online() const 62 | { 63 | COM_Bool result; 64 | COM_GetValue(get_IFC(), Online, result); 65 | return static_cast(result); 66 | } 67 | 68 | VBox::COMPtr VBox::ISnapshot::machine() const 69 | { 70 | COMPtr result; 71 | COM_GetValue_Wrap(get_IFC(), Machine, result); 72 | return result; 73 | } 74 | 75 | VBox::COMPtr VBox::ISnapshot::parent() const 76 | { 77 | COMPtr result; 78 | COM_GetValue_Wrap(get_IFC(), Parent, result); 79 | return result; 80 | } 81 | 82 | std::vector> VBox::ISnapshot::children() const 83 | { 84 | std::vector> result; 85 | COM_GetArray_Wrap(get_IFC(), Children, result); 86 | return result; 87 | } 88 | 89 | uint32_t VBox::ISnapshot::childrenCount() const 90 | { 91 | COM_ULong result; 92 | 93 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 94 | COM_GetValue(get_IFC(), ChildrenCount, result); 95 | #else 96 | auto rc = get_IFC()->GetChildrenCount(&result); 97 | COM_ERROR_CHECK(rc); 98 | #endif 99 | 100 | return static_cast(result); 101 | } 102 | 103 | uint32_t VBox::ISnapshot::getChildrenCount() const 104 | { 105 | return childrenCount(); 106 | } 107 | -------------------------------------------------------------------------------- /lib/mediumformat.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IMediumFormat) 22 | 23 | std::u16string VBox::IMediumFormat::id() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Id, result); 27 | return result; 28 | } 29 | 30 | std::u16string VBox::IMediumFormat::name() const 31 | { 32 | std::u16string result; 33 | COM_GetString(get_IFC(), Name, result); 34 | return result; 35 | } 36 | 37 | std::vector VBox::IMediumFormat::capabilities() const 38 | { 39 | std::vector result; 40 | COM_GetArray(get_IFC(), Capabilities, COM_Enum(::MediumFormatCapabilities), result); 41 | return result; 42 | } 43 | 44 | void VBox::IMediumFormat::describeFileExtensions( 45 | std::vector *extensions, std::vector *types 46 | #if VirtualBoxSDK_VERSION < VBox_MAKE_VERSION(7, 0, 0) 47 | ) 48 | #else 49 | ) const 50 | #endif 51 | { 52 | COM_StringArrayProxy pExtensions; 53 | COM_ArrayProxy pTypes; 54 | 55 | auto rc = get_IFC()->DescribeFileExtensions(COM_ArrayParameterRef(pExtensions), 56 | COM_ArrayParameterRef(pTypes)); 57 | COM_ERROR_CHECK(rc); 58 | 59 | if (extensions) 60 | pExtensions.toVector(*extensions); 61 | if (types) 62 | pTypes.toVector(*types); 63 | } 64 | 65 | void VBox::IMediumFormat::describeProperties(std::vector *names, 66 | std::vector *descriptions, std::vector *types, 67 | std::vector *flags, std::vector *defaults) const 68 | { 69 | COM_StringArrayProxy pNames; 70 | COM_StringArrayProxy pDescriptions; 71 | COM_ArrayProxy pTypes; 72 | COM_ArrayProxy pFlags; 73 | COM_StringArrayProxy pDefaults; 74 | 75 | auto rc = get_IFC()->DescribeProperties(COM_ArrayParameterRef(pNames), 76 | COM_ArrayParameterRef(pDescriptions), COM_ArrayParameterRef(pTypes), 77 | COM_ArrayParameterRef(pFlags), COM_ArrayParameterRef(pDefaults)); 78 | COM_ERROR_CHECK(rc); 79 | 80 | if (names) 81 | pNames.toVector(*names); 82 | if (descriptions) 83 | pDescriptions.toVector(*descriptions); 84 | if (types) 85 | pTypes.toVector(*types); 86 | if (flags) 87 | pFlags.toVector(*flags); 88 | if (defaults) 89 | pDefaults.toVector(*defaults); 90 | } 91 | -------------------------------------------------------------------------------- /lib/extpackmanager.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IExtPackManager) 22 | 23 | std::vector> 24 | VBox::IExtPackManager::installedExtPacks() const 25 | { 26 | std::vector> result; 27 | COM_GetArray_Wrap(get_IFC(), InstalledExtPacks, result); 28 | return result; 29 | } 30 | 31 | VBox::COMPtr VBox::IExtPackManager::find(const std::u16string &name) 32 | { 33 | ::IExtPack *cResult = nullptr; 34 | COM_StringProxy pName(name); 35 | 36 | auto rc = get_IFC()->Find(pName.m_text, &cResult); 37 | COM_ERROR_CHECK(rc); 38 | 39 | return COMPtr::wrap(cResult); 40 | } 41 | 42 | VBox::COMPtr VBox::IExtPackManager::openExtPackFile( 43 | const std::u16string &path) 44 | { 45 | ::IExtPackFile *cResult = nullptr; 46 | COM_StringProxy pPath(path); 47 | 48 | auto rc = get_IFC()->OpenExtPackFile(pPath.m_text, &cResult); 49 | COM_ERROR_CHECK(rc); 50 | 51 | return COMPtr::wrap(cResult); 52 | } 53 | 54 | VBox::COMPtr VBox::IExtPackManager::uninstall( 55 | const std::u16string &name, bool forcedRemoval, 56 | const std::u16string &displayInfo) 57 | { 58 | ::IProgress *cResult = nullptr; 59 | COM_StringProxy pName(name); 60 | COM_StringProxy pDisplayInfo(displayInfo); 61 | 62 | auto rc = get_IFC()->Uninstall(pName.m_text, forcedRemoval, 63 | pDisplayInfo.m_text, &cResult); 64 | COM_ERROR_CHECK(rc); 65 | 66 | return COMPtr::wrap(cResult); 67 | } 68 | 69 | void VBox::IExtPackManager::cleanup() 70 | { 71 | auto rc = get_IFC()->Cleanup(); 72 | COM_ERROR_CHECK(rc); 73 | } 74 | 75 | std::vector VBox::IExtPackManager::queryAllPlugInsForFrontend( 76 | const std::u16string &frontendName) 77 | { 78 | COM_StringArrayProxy pResult; 79 | COM_StringProxy pFrontendName(frontendName); 80 | 81 | auto rc = get_IFC()->QueryAllPlugInsForFrontend(pFrontendName.m_text, 82 | COM_ArrayParameterRef(pResult)); 83 | COM_ERROR_CHECK(rc); 84 | 85 | std::vector result; 86 | pResult.toVector(result); 87 | return result; 88 | } 89 | 90 | bool VBox::IExtPackManager::isExtPackUsable(const std::u16string &name) 91 | { 92 | COM_Bool cResult; 93 | COM_StringProxy pName(name); 94 | 95 | auto rc = get_IFC()->IsExtPackUsable(pName.m_text, &cResult); 96 | COM_ERROR_CHECK(rc); 97 | 98 | return static_cast(cResult); 99 | } 100 | -------------------------------------------------------------------------------- /lib/mediumattachment.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IMediumAttachment) 22 | 23 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 1, 0) 24 | VBox::COMPtr VBox::IMediumAttachment::machine() const 25 | { 26 | COMPtr result; 27 | COM_GetValue_Wrap(get_IFC(), Machine, result); 28 | return result; 29 | } 30 | #endif 31 | 32 | VBox::COMPtr VBox::IMediumAttachment::medium() const 33 | { 34 | COMPtr result; 35 | COM_GetValue_Wrap(get_IFC(), Medium, result); 36 | return result; 37 | } 38 | 39 | std::u16string VBox::IMediumAttachment::controller() const 40 | { 41 | std::u16string result; 42 | COM_GetString(get_IFC(), Controller, result); 43 | return result; 44 | } 45 | 46 | int32_t VBox::IMediumAttachment::port() const 47 | { 48 | COM_Long result; 49 | COM_GetValue(get_IFC(), Port, result); 50 | return static_cast(result); 51 | } 52 | 53 | int32_t VBox::IMediumAttachment::device() const 54 | { 55 | COM_Long result; 56 | COM_GetValue(get_IFC(), Device, result); 57 | return static_cast(result); 58 | } 59 | 60 | VBox::DeviceType VBox::IMediumAttachment::type() const 61 | { 62 | COM_Enum(::DeviceType) result; 63 | COM_GetValue(get_IFC(), Type, result); 64 | return static_cast(result); 65 | } 66 | 67 | bool VBox::IMediumAttachment::passthrough() const 68 | { 69 | COM_Bool result; 70 | COM_GetValue(get_IFC(), Passthrough, result); 71 | return static_cast(result); 72 | } 73 | 74 | bool VBox::IMediumAttachment::temporaryEject() const 75 | { 76 | COM_Bool result; 77 | COM_GetValue(get_IFC(), TemporaryEject, result); 78 | return static_cast(result); 79 | } 80 | 81 | bool VBox::IMediumAttachment::isEjected() const 82 | { 83 | COM_Bool result; 84 | COM_GetValue(get_IFC(), IsEjected, result); 85 | return static_cast(result); 86 | } 87 | 88 | bool VBox::IMediumAttachment::nonRotational() const 89 | { 90 | COM_Bool result; 91 | COM_GetValue(get_IFC(), NonRotational, result); 92 | return static_cast(result); 93 | } 94 | 95 | bool VBox::IMediumAttachment::discard() const 96 | { 97 | COM_Bool result; 98 | COM_GetValue(get_IFC(), Discard, result); 99 | return static_cast(result); 100 | } 101 | 102 | bool VBox::IMediumAttachment::hotPluggable() const 103 | { 104 | COM_Bool result; 105 | COM_GetValue(get_IFC(), HotPluggable, result); 106 | return static_cast(result); 107 | } 108 | 109 | VBox::COMPtr VBox::IMediumAttachment::bandwidthGroup() const 110 | { 111 | COMPtr result; 112 | COM_GetValue_Wrap(get_IFC(), BandwidthGroup, result); 113 | return result; 114 | } 115 | -------------------------------------------------------------------------------- /lib/cloudprofile.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 22 | COM_WRAP_IFC(ICloudProfile) 23 | 24 | std::u16string VBox::ICloudProfile::name() const 25 | { 26 | std::u16string result; 27 | COM_GetString(get_IFC(), Name, result); 28 | return result; 29 | } 30 | 31 | void VBox::ICloudProfile::set_name(const std::u16string &value) 32 | { 33 | COM_SetString(get_IFC(), Name, value); 34 | } 35 | 36 | std::u16string VBox::ICloudProfile::providerId() const 37 | { 38 | std::u16string result; 39 | COM_GetString(get_IFC(), ProviderId, result); 40 | return result; 41 | } 42 | 43 | std::u16string VBox::ICloudProfile::getProperty(const std::u16string &name) const 44 | { 45 | COM_StringProxy pResult; 46 | COM_StringProxy pName(name); 47 | 48 | auto rc = get_IFC()->GetProperty(pName.m_text, &pResult.m_text); 49 | COM_ERROR_CHECK(rc); 50 | 51 | return pResult.toString(); 52 | } 53 | 54 | void VBox::ICloudProfile::setProperty(const std::u16string &name, 55 | const std::u16string &value) const 56 | { 57 | COM_StringProxy pName(name); 58 | COM_StringProxy pValue(value); 59 | 60 | auto rc = get_IFC()->SetProperty(pName.m_text, pValue.m_text); 61 | COM_ERROR_CHECK(rc); 62 | } 63 | 64 | std::vector VBox::ICloudProfile::getProperties( 65 | const std::u16string &names, std::vector *returnNames) const 66 | { 67 | COM_StringArrayProxy pResult; 68 | COM_StringProxy pNames(names); 69 | COM_StringArrayProxy pReturnNames; 70 | 71 | auto rc = get_IFC()->GetProperties(pNames.m_text, 72 | COM_ArrayParameterRef(pReturnNames), COM_ArrayParameterRef(pResult)); 73 | COM_ERROR_CHECK(rc); 74 | 75 | if (returnNames) 76 | pReturnNames.toVector(*returnNames); 77 | std::vector result; 78 | pResult.toVector(result); 79 | return result; 80 | } 81 | 82 | void VBox::ICloudProfile::setProperties(const std::vector &names, 83 | const std::vector &values) 84 | { 85 | COM_StringArrayProxy pNames(names); 86 | COM_StringArrayProxy pValues(values); 87 | 88 | auto rc = get_IFC()->SetProperties(COM_ArrayParameter(pNames), 89 | COM_ArrayParameter(pValues)); 90 | COM_ERROR_CHECK(rc); 91 | } 92 | 93 | void VBox::ICloudProfile::remove() 94 | { 95 | auto rc = get_IFC()->Remove(); 96 | COM_ERROR_CHECK(rc); 97 | } 98 | 99 | VBox::COMPtr VBox::ICloudProfile::createCloudClient() 100 | { 101 | ::ICloudClient *cResult = nullptr; 102 | 103 | auto rc = get_IFC()->CreateCloudClient(&cResult); 104 | COM_ERROR_CHECK(rc); 105 | 106 | return COMPtr::wrap(cResult); 107 | } 108 | #endif 109 | -------------------------------------------------------------------------------- /lib/fsinfo.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2022 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 0, 0) 22 | COM_WRAP_IFC(IFsInfo) 23 | COM_WRAP_IFC(IGuestFsInfo) 24 | 25 | int64_t VBox::IFsInfo::freeSize() const 26 | { 27 | COM_Long64 result; 28 | COM_GetValue(get_IFC(), FreeSize, result); 29 | return static_cast(result); 30 | } 31 | 32 | int64_t VBox::IFsInfo::totalSize() const 33 | { 34 | COM_Long64 result; 35 | COM_GetValue(get_IFC(), TotalSize, result); 36 | return static_cast(result); 37 | } 38 | 39 | uint32_t VBox::IFsInfo::blockSize() const 40 | { 41 | COM_ULong result; 42 | COM_GetValue(get_IFC(), BlockSize, result); 43 | return static_cast(result); 44 | } 45 | 46 | uint32_t VBox::IFsInfo::sectorSize() const 47 | { 48 | COM_ULong result; 49 | COM_GetValue(get_IFC(), SectorSize, result); 50 | return static_cast(result); 51 | } 52 | 53 | uint32_t VBox::IFsInfo::serialNumber() const 54 | { 55 | COM_ULong result; 56 | COM_GetValue(get_IFC(), SerialNumber, result); 57 | return static_cast(result); 58 | } 59 | 60 | bool VBox::IFsInfo::isRemote() const 61 | { 62 | COM_Bool result; 63 | COM_GetValue(get_IFC(), IsRemote, result); 64 | return static_cast(result); 65 | } 66 | 67 | bool VBox::IFsInfo::isCaseSensitive() const 68 | { 69 | COM_Bool result; 70 | COM_GetValue(get_IFC(), IsCaseSensitive, result); 71 | return static_cast(result); 72 | } 73 | 74 | bool VBox::IFsInfo::isReadOnly() const 75 | { 76 | COM_Bool result; 77 | COM_GetValue(get_IFC(), IsReadOnly, result); 78 | return static_cast(result); 79 | } 80 | 81 | bool VBox::IFsInfo::isCompressed() const 82 | { 83 | COM_Bool result; 84 | COM_GetValue(get_IFC(), IsCompressed, result); 85 | return static_cast(result); 86 | } 87 | 88 | bool VBox::IFsInfo::supportsFileCompression() const 89 | { 90 | COM_Bool result; 91 | COM_GetValue(get_IFC(), SupportsFileCompression, result); 92 | return static_cast(result); 93 | } 94 | 95 | uint32_t VBox::IFsInfo::maxComponent() const 96 | { 97 | COM_ULong result; 98 | COM_GetValue(get_IFC(), MaxComponent, result); 99 | return static_cast(result); 100 | } 101 | 102 | std::u16string VBox::IFsInfo::type() const 103 | { 104 | std::u16string result; 105 | COM_GetString(get_IFC(), Type, result); 106 | return result; 107 | } 108 | 109 | std::u16string VBox::IFsInfo::label() const 110 | { 111 | std::u16string result; 112 | COM_GetString(get_IFC(), Label, result); 113 | return result; 114 | } 115 | 116 | std::u16string VBox::IFsInfo::mountPoint() const 117 | { 118 | std::u16string result; 119 | COM_GetString(get_IFC(), MountPoint, result); 120 | return result; 121 | } 122 | #endif 123 | -------------------------------------------------------------------------------- /lib/mediumio.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 22 | COM_WRAP_IFC(IMediumIO) 23 | 24 | VBox::COMPtr VBox::IMediumIO::medium() const 25 | { 26 | COMPtr result; 27 | COM_GetValue_Wrap(get_IFC(), Medium, result); 28 | return result; 29 | } 30 | 31 | bool VBox::IMediumIO::writable() const 32 | { 33 | COM_Bool result; 34 | COM_GetValue(get_IFC(), Writable, result); 35 | return static_cast(result); 36 | } 37 | 38 | VBox::COMPtr VBox::IMediumIO::explorer() const 39 | { 40 | COMPtr result; 41 | COM_GetValue_Wrap(get_IFC(), Explorer, result); 42 | return result; 43 | } 44 | 45 | std::vector VBox::IMediumIO::read(int64_t offset, uint32_t size) 46 | { 47 | COM_ArrayProxy pResult; 48 | 49 | auto rc = get_IFC()->Read(offset, size, COM_ArrayParameterRef(pResult)); 50 | COM_ERROR_CHECK(rc); 51 | 52 | std::vector result; 53 | pResult.toVector(result); 54 | return result; 55 | } 56 | 57 | uint32_t VBox::IMediumIO::write(int64_t offset, const std::vector &data) 58 | { 59 | COM_ULong cResult; 60 | COM_ArrayProxy pData(data); 61 | 62 | auto rc = get_IFC()->Write(offset, COM_ArrayParameter(pData), &cResult); 63 | COM_ERROR_CHECK(rc); 64 | 65 | return static_cast(cResult); 66 | } 67 | 68 | void VBox::IMediumIO::formatFAT(bool quick) 69 | { 70 | auto rc = get_IFC()->FormatFAT(quick); 71 | COM_ERROR_CHECK(rc); 72 | } 73 | 74 | void VBox::IMediumIO::initializePartitionTable(PartitionTableType format, 75 | bool wholeDiskInOneEntry) 76 | { 77 | auto cFormat = static_cast(format); 78 | 79 | auto rc = get_IFC()->InitializePartitionTable(cFormat, wholeDiskInOneEntry); 80 | COM_ERROR_CHECK(rc); 81 | } 82 | 83 | VBox::COMPtr VBox::IMediumIO::convertToStream( 84 | const std::u16string &format, const std::vector &variant, 85 | uint32_t bufferSize, COMPtr *stream) 86 | { 87 | ::IProgress *cResult = nullptr; 88 | COM_StringProxy pFormat(format); 89 | COM_ArrayProxy pVariant(variant); 90 | ::IDataStream *cStream = nullptr; 91 | 92 | auto rc = get_IFC()->ConvertToStream(pFormat.m_text, 93 | COM_ArrayParameter(pVariant), bufferSize, &cStream, &cResult); 94 | COM_ERROR_CHECK(rc); 95 | 96 | if (stream) 97 | *stream = COMPtr::wrap(cStream); 98 | else if (cStream) 99 | cStream->Release(); 100 | return COMPtr::wrap(cResult); 101 | } 102 | 103 | void VBox::IMediumIO::close() 104 | { 105 | auto rc = get_IFC()->Close(); 106 | COM_ERROR_CHECK(rc); 107 | } 108 | #endif 109 | -------------------------------------------------------------------------------- /lib/graphicsadapter.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 1, 0) 22 | COM_WRAP_IFC(IGraphicsAdapter) 23 | 24 | VBox::GraphicsControllerType VBox::IGraphicsAdapter::graphicsControllerType() const 25 | { 26 | COM_Enum(::GraphicsControllerType) result; 27 | COM_GetValue(get_IFC(), GraphicsControllerType, result); 28 | return static_cast(result); 29 | } 30 | 31 | void VBox::IGraphicsAdapter::set_graphicsControllerType(GraphicsControllerType value) 32 | { 33 | COM_SetValue(get_IFC(), GraphicsControllerType, 34 | static_cast(value)); 35 | } 36 | 37 | uint32_t VBox::IGraphicsAdapter::VRAMSize() const 38 | { 39 | COM_ULong result; 40 | COM_GetValue(get_IFC(), VRAMSize, result); 41 | return static_cast(result); 42 | } 43 | 44 | void VBox::IGraphicsAdapter::set_VRAMSize(uint32_t value) 45 | { 46 | COM_SetValue(get_IFC(), VRAMSize, value); 47 | } 48 | 49 | #if VirtualBoxSDK_VERSION < VBox_MAKE_VERSION(7, 1, 0) 50 | bool VBox::IGraphicsAdapter::accelerate3DEnabled() const 51 | { 52 | COM_Bool result; 53 | COM_GetValue(get_IFC(), Accelerate3DEnabled, result); 54 | return static_cast(result); 55 | } 56 | 57 | void VBox::IGraphicsAdapter::set_accelerate3DEnabled(bool value) 58 | { 59 | COM_SetValue(get_IFC(), Accelerate3DEnabled, value); 60 | } 61 | 62 | bool VBox::IGraphicsAdapter::accelerate2DVideoEnabled() const 63 | { 64 | COM_Bool result; 65 | COM_GetValue(get_IFC(), Accelerate2DVideoEnabled, result); 66 | return static_cast(result); 67 | } 68 | 69 | void VBox::IGraphicsAdapter::set_accelerate2DVideoEnabled(bool value) 70 | { 71 | COM_SetValue(get_IFC(), Accelerate2DVideoEnabled, value); 72 | } 73 | #endif 74 | 75 | uint32_t VBox::IGraphicsAdapter::monitorCount() const 76 | { 77 | COM_ULong result; 78 | COM_GetValue(get_IFC(), MonitorCount, result); 79 | return static_cast(result); 80 | } 81 | 82 | void VBox::IGraphicsAdapter::set_monitorCount(uint32_t value) 83 | { 84 | COM_SetValue(get_IFC(), MonitorCount, value); 85 | } 86 | 87 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(7, 1, 0) 88 | void VBox::IGraphicsAdapter::setFeature(GraphicsFeature feature, bool enabled) 89 | { 90 | auto cFeature = static_cast(feature); 91 | auto cEnabled = static_cast(enabled); 92 | 93 | auto rc = get_IFC()->SetFeature(cFeature, cEnabled); 94 | COM_ERROR_CHECK(rc); 95 | } 96 | 97 | bool VBox::IGraphicsAdapter::isFeatureEnabled(GraphicsFeature feature) const 98 | { 99 | COM_Bool cResult = false; 100 | auto cFeature = static_cast(feature); 101 | 102 | auto rc = get_IFC()->IsFeatureEnabled(cFeature, &cResult); 103 | COM_ERROR_CHECK(rc); 104 | 105 | return static_cast(cResult); 106 | } 107 | #endif 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /lib/storagecontroller.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IStorageController) 22 | 23 | std::u16string VBox::IStorageController::name() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Name, result); 27 | return result; 28 | } 29 | 30 | void VBox::IStorageController::set_name(const std::u16string &value) 31 | { 32 | COM_SetString(get_IFC(), Name, value); 33 | } 34 | 35 | uint32_t VBox::IStorageController::maxDevicesPerPortCount() const 36 | { 37 | COM_ULong result; 38 | COM_GetValue(get_IFC(), MaxDevicesPerPortCount, result); 39 | return static_cast(result); 40 | } 41 | 42 | uint32_t VBox::IStorageController::minPortCount() const 43 | { 44 | COM_ULong result; 45 | COM_GetValue(get_IFC(), MinPortCount, result); 46 | return static_cast(result); 47 | } 48 | 49 | uint32_t VBox::IStorageController::maxPortCount() const 50 | { 51 | COM_ULong result; 52 | COM_GetValue(get_IFC(), MaxPortCount, result); 53 | return static_cast(result); 54 | } 55 | 56 | uint32_t VBox::IStorageController::instance() const 57 | { 58 | COM_ULong result; 59 | COM_GetValue(get_IFC(), Instance, result); 60 | return static_cast(result); 61 | } 62 | 63 | void VBox::IStorageController::set_instance(uint32_t value) 64 | { 65 | COM_SetValue(get_IFC(), Instance, value); 66 | } 67 | 68 | uint32_t VBox::IStorageController::portCount() const 69 | { 70 | COM_ULong result; 71 | COM_GetValue(get_IFC(), PortCount, result); 72 | return static_cast(result); 73 | } 74 | 75 | void VBox::IStorageController::set_portCount(uint32_t value) 76 | { 77 | COM_SetValue(get_IFC(), PortCount, value); 78 | } 79 | 80 | VBox::StorageBus VBox::IStorageController::bus() const 81 | { 82 | COM_Enum(::StorageBus) result; 83 | COM_GetValue(get_IFC(), Bus, result); 84 | return static_cast(result); 85 | } 86 | 87 | VBox::StorageControllerType VBox::IStorageController::controllerType() const 88 | { 89 | COM_Enum(::StorageControllerType) result; 90 | COM_GetValue(get_IFC(), ControllerType, result); 91 | return static_cast(result); 92 | } 93 | 94 | void VBox::IStorageController::set_controllerType(StorageControllerType value) 95 | { 96 | COM_SetValue(get_IFC(), ControllerType, 97 | static_cast(value)); 98 | } 99 | 100 | bool VBox::IStorageController::useHostIOCache() const 101 | { 102 | COM_Bool result; 103 | COM_GetValue(get_IFC(), UseHostIOCache, result); 104 | return static_cast(result); 105 | } 106 | 107 | void VBox::IStorageController::set_useHostIOCache(bool value) 108 | { 109 | COM_SetValue(get_IFC(), UseHostIOCache, value); 110 | } 111 | 112 | bool VBox::IStorageController::bootable() const 113 | { 114 | COM_Bool result; 115 | COM_GetValue(get_IFC(), Bootable, result); 116 | return static_cast(result); 117 | } 118 | -------------------------------------------------------------------------------- /lib/serialport.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(ISerialPort) 22 | 23 | uint32_t VBox::ISerialPort::slot() const 24 | { 25 | COM_ULong result; 26 | COM_GetValue(get_IFC(), Slot, result); 27 | return static_cast(result); 28 | } 29 | 30 | bool VBox::ISerialPort::enabled() const 31 | { 32 | COM_Bool result; 33 | COM_GetValue(get_IFC(), Enabled, result); 34 | return static_cast(result); 35 | } 36 | 37 | void VBox::ISerialPort::set_enabled(bool value) 38 | { 39 | COM_SetValue(get_IFC(), Enabled, value); 40 | } 41 | 42 | #if VirtualBoxSDK_VERSION < VBox_MAKE_VERSION(7, 1, 0) 43 | uint32_t VBox::ISerialPort::IOBase() const 44 | { 45 | COM_ULong result; 46 | COM_GetValue(get_IFC(), IOBase, result); 47 | return static_cast(result); 48 | } 49 | 50 | void VBox::ISerialPort::set_IOBase(uint32_t value) 51 | { 52 | COM_SetValue(get_IFC(), IOBase, value); 53 | } 54 | #else 55 | uint32_t VBox::ISerialPort::IOAddress() const 56 | { 57 | COM_ULong result; 58 | COM_GetValue(get_IFC(), IOAddress, result); 59 | return static_cast(result); 60 | } 61 | 62 | void VBox::ISerialPort::set_IOAddress(uint32_t value) 63 | { 64 | COM_SetValue(get_IFC(), IOAddress, value); 65 | } 66 | #endif 67 | 68 | uint32_t VBox::ISerialPort::IRQ() const 69 | { 70 | COM_ULong result; 71 | COM_GetValue(get_IFC(), IRQ, result); 72 | return static_cast(result); 73 | } 74 | 75 | void VBox::ISerialPort::set_IRQ(uint32_t value) 76 | { 77 | COM_SetValue(get_IFC(), IRQ, value); 78 | } 79 | 80 | VBox::PortMode VBox::ISerialPort::hostMode() const 81 | { 82 | COM_Enum(::PortMode) result; 83 | COM_GetValue(get_IFC(), HostMode, result); 84 | return static_cast(result); 85 | } 86 | 87 | void VBox::ISerialPort::set_hostMode(PortMode value) 88 | { 89 | COM_SetValue(get_IFC(), HostMode, static_cast(value)); 90 | } 91 | 92 | bool VBox::ISerialPort::server() const 93 | { 94 | COM_Bool result; 95 | COM_GetValue(get_IFC(), Server, result); 96 | return static_cast(result); 97 | } 98 | 99 | void VBox::ISerialPort::set_server(bool value) 100 | { 101 | COM_SetValue(get_IFC(), Server, value); 102 | } 103 | 104 | std::u16string VBox::ISerialPort::path() const 105 | { 106 | std::u16string result; 107 | COM_GetString(get_IFC(), Path, result); 108 | return result; 109 | } 110 | 111 | void VBox::ISerialPort::set_path(const std::u16string &value) 112 | { 113 | COM_SetString(get_IFC(), Path, value); 114 | } 115 | 116 | #if VirtualBoxSDK_VERSION >= VBox_MAKE_VERSION(6, 0, 0) 117 | VBox::UartType VBox::ISerialPort::uartType() const 118 | { 119 | COM_Enum(::UartType) result; 120 | COM_GetValue(get_IFC(), UartType, result); 121 | return static_cast(result); 122 | } 123 | 124 | void VBox::ISerialPort::set_uartType(UartType value) 125 | { 126 | COM_SetValue(get_IFC(), UartType, static_cast(value)); 127 | } 128 | #endif 129 | -------------------------------------------------------------------------------- /lib/vfsexplorer.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of libvbox 2 | * Copyright (C) 2019 Michael Hansen 3 | * 4 | * libvbox is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * libvbox is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with libvbox; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "libvbox_p.h" 20 | 21 | COM_WRAP_IFC(IVFSExplorer) 22 | 23 | std::u16string VBox::IVFSExplorer::path() const 24 | { 25 | std::u16string result; 26 | COM_GetString(get_IFC(), Path, result); 27 | return result; 28 | } 29 | 30 | VBox::VFSType VBox::IVFSExplorer::type() const 31 | { 32 | COM_Enum(::VFSType) result; 33 | COM_GetValue(get_IFC(), Type, result); 34 | return static_cast(result); 35 | } 36 | 37 | VBox::COMPtr VBox::IVFSExplorer::update() 38 | { 39 | ::IProgress *cResult = nullptr; 40 | 41 | auto rc = get_IFC()->Update(&cResult); 42 | COM_ERROR_CHECK(rc); 43 | 44 | return COMPtr::wrap(cResult); 45 | } 46 | 47 | VBox::COMPtr VBox::IVFSExplorer::cd(const std::u16string &dir) 48 | { 49 | ::IProgress *cResult = nullptr; 50 | COM_StringProxy pDir(dir); 51 | 52 | auto rc = get_IFC()->Cd(pDir.m_text, &cResult); 53 | COM_ERROR_CHECK(rc); 54 | 55 | return COMPtr::wrap(cResult); 56 | } 57 | 58 | VBox::COMPtr VBox::IVFSExplorer::cdUp() 59 | { 60 | ::IProgress *cResult = nullptr; 61 | 62 | auto rc = get_IFC()->CdUp(&cResult); 63 | COM_ERROR_CHECK(rc); 64 | 65 | return COMPtr::wrap(cResult); 66 | } 67 | 68 | void VBox::IVFSExplorer::entryList(std::vector *names, 69 | std::vector *types, std::vector *sizes, 70 | std::vector *modes) 71 | { 72 | COM_StringArrayProxy pNames; 73 | COM_ArrayProxy pTypes; 74 | COM_ArrayProxy pSizes; 75 | COM_ArrayProxy pModes; 76 | 77 | auto rc = get_IFC()->EntryList(COM_ArrayParameterRef(pNames), 78 | COM_ArrayParameterRef(pTypes), COM_ArrayParameterRef(pSizes), 79 | COM_ArrayParameterRef(pModes)); 80 | COM_ERROR_CHECK(rc); 81 | 82 | if (names) 83 | pNames.toVector(*names); 84 | if (types) 85 | pTypes.toVector(*types); 86 | if (sizes) 87 | pSizes.toVector(*sizes); 88 | if (modes) 89 | pModes.toVector(*modes); 90 | } 91 | 92 | std::vector VBox::IVFSExplorer::exists( 93 | const std::vector &names) 94 | { 95 | COM_StringArrayProxy pResult; 96 | COM_StringArrayProxy pNames(names); 97 | 98 | auto rc = get_IFC()->Exists(COM_ArrayParameter(pNames), 99 | COM_ArrayParameterRef(pResult)); 100 | COM_ERROR_CHECK(rc); 101 | 102 | std::vector result; 103 | pResult.toVector(result); 104 | return result; 105 | } 106 | 107 | VBox::COMPtr VBox::IVFSExplorer::remove( 108 | const std::vector &names) 109 | { 110 | ::IProgress *cResult = nullptr; 111 | COM_StringArrayProxy pNames(names); 112 | 113 | auto rc = get_IFC()->Remove(COM_ArrayParameter(pNames), &cResult); 114 | COM_ERROR_CHECK(rc); 115 | 116 | return COMPtr::wrap(cResult); 117 | } 118 | --------------------------------------------------------------------------------