VirtualBox

source: vbox/trunk/src/VBox/Main/src-all/Global.cpp@ 49900

Last change on this file since 49900 was 49074, checked in by vboxsync, 11 years ago

Main, FE/Qt: Added a triple fault handling OS hint and a new OS/2 1.x guest type.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 42.4 KB
Line 
1/* $Id: Global.cpp 49074 2013-10-13 22:08:34Z vboxsync $ */
2/** @file
3 * VirtualBox COM global definitions
4 *
5 * NOTE: This file is part of both VBoxC.dll and VBoxSVC.exe.
6 */
7
8/*
9 * Copyright (C) 2008-2013 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#include "Global.h"
21
22#include <iprt/assert.h>
23#include <iprt/string.h>
24#include <VBox/err.h>
25
26/* static */
27const Global::OSType Global::sOSTypes[] =
28{
29 /* NOTE1: we assume that unknown is always the first two entries!
30 * NOTE2: please use powers of 2 when specifying the size of harddisks since
31 * '2GB' looks better than '1.95GB' (= 2000MB) */
32 { "Other", "Other", "Other", "Other/Unknown",
33 VBOXOSTYPE_Unknown, VBOXOSHINT_NONE,
34 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
35 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
36 { "Other", "Other", "Other_64", "Other/Unknown (64-bit)",
37 VBOXOSTYPE_Unknown_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
38 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
39 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
40 { "Windows", "Microsoft Windows", "Windows31", "Windows 3.1",
41 VBOXOSTYPE_Win31, VBOXOSHINT_FLOPPY,
42 32, 4, 1 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
43 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 },
44 { "Windows", "Microsoft Windows", "Windows95", "Windows 95",
45 VBOXOSTYPE_Win95, VBOXOSHINT_FLOPPY,
46 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
47 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 },
48 { "Windows", "Microsoft Windows", "Windows98", "Windows 98",
49 VBOXOSTYPE_Win98, VBOXOSHINT_FLOPPY,
50 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
51 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 },
52 { "Windows", "Microsoft Windows", "WindowsMe", "Windows ME",
53 VBOXOSTYPE_WinMe, VBOXOSHINT_FLOPPY | VBOXOSHINT_USBTABLET,
54 128, 4, 4 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
55 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
56 { "Windows", "Microsoft Windows", "WindowsNT4", "Windows NT 4",
57 VBOXOSTYPE_WinNT4, VBOXOSHINT_NONE,
58 128, 16, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
59 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 },
60 { "Windows", "Microsoft Windows", "Windows2000", "Windows 2000",
61 VBOXOSTYPE_Win2k, VBOXOSHINT_USBTABLET,
62 168, 16, 4 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
63 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
64 { "Windows", "Microsoft Windows", "WindowsXP", "Windows XP",
65 VBOXOSTYPE_WinXP, VBOXOSHINT_USBTABLET,
66 192, 16, 10 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
67 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
68 { "Windows", "Microsoft Windows", "WindowsXP_64", "Windows XP (64 bit)",
69 VBOXOSTYPE_WinXP_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
70 192, 16, 10 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
71 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
72 { "Windows", "Microsoft Windows", "Windows2003", "Windows 2003",
73 VBOXOSTYPE_Win2k3, VBOXOSHINT_USBTABLET,
74 256, 16, 20 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
75 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
76 { "Windows", "Microsoft Windows", "Windows2003_64", "Windows 2003 (64 bit)",
77 VBOXOSTYPE_Win2k3_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
78 256, 16, 20 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
79 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_HDA },
80 { "Windows", "Microsoft Windows", "WindowsVista", "Windows Vista",
81 VBOXOSTYPE_WinVista, VBOXOSHINT_USBTABLET,
82 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
83 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
84 { "Windows", "Microsoft Windows", "WindowsVista_64", "Windows Vista (64 bit)",
85 VBOXOSTYPE_WinVista_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
86 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
87 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
88 { "Windows", "Microsoft Windows", "Windows2008", "Windows 2008",
89 VBOXOSTYPE_Win2k8, VBOXOSHINT_USBTABLET,
90 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
91 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
92 { "Windows", "Microsoft Windows", "Windows2008_64", "Windows 2008 (64 bit)",
93 VBOXOSTYPE_Win2k8_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
94 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
95 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
96 { "Windows", "Microsoft Windows", "Windows7", "Windows 7",
97 VBOXOSTYPE_Win7, VBOXOSHINT_USBTABLET,
98 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
99 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
100 { "Windows", "Microsoft Windows", "Windows7_64", "Windows 7 (64 bit)",
101 VBOXOSTYPE_Win7_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
102 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
103 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
104 { "Windows", "Microsoft Windows", "Windows8", "Windows 8",
105 VBOXOSTYPE_Win8, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET | VBOXOSHINT_PAE,
106 1024,128, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
107 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
108 { "Windows", "Microsoft Windows", "Windows8_64", "Windows 8 (64 bit)",
109 VBOXOSTYPE_Win8_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
110 2048,128, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
111 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
112 { "Windows", "Microsoft Windows", "Windows81", "Windows 8.1",
113 VBOXOSTYPE_Win8, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET | VBOXOSHINT_PAE,
114 1024,128, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
115 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
116 { "Windows", "Microsoft Windows", "Windows81_64", "Windows 8.1 (64 bit)",
117 VBOXOSTYPE_Win8_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
118 2048,128, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
119 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
120 { "Windows", "Microsoft Windows", "Windows2012_64", "Windows 2012 (64 bit)",
121 VBOXOSTYPE_Win2k12_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
122 2048,128, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
123 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA },
124 { "Windows", "Microsoft Windows", "WindowsNT", "Other Windows",
125 VBOXOSTYPE_WinNT, VBOXOSHINT_NONE,
126 512, 16, 20 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
127 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
128 { "Windows", "Microsoft Windows", "WindowsNT_64", "Other Windows (64-bit)",
129 VBOXOSTYPE_WinNT_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
130 512, 16, 20 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
131 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
132 { "Linux", "Linux", "Linux22", "Linux 2.2",
133 VBOXOSTYPE_Linux22, VBOXOSHINT_RTCUTC,
134 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
135 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
136 { "Linux", "Linux", "Linux24", "Linux 2.4",
137 VBOXOSTYPE_Linux24, VBOXOSHINT_RTCUTC,
138 128, 4, 4 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
139 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
140 { "Linux", "Linux", "Linux24_64", "Linux 2.4 (64 bit)",
141 VBOXOSTYPE_Linux24_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
142 128, 4, 4 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
143 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
144 { "Linux", "Linux", "Linux26", "Linux 2.6 / 3.x",
145 VBOXOSTYPE_Linux26, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
146 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
147 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
148 { "Linux", "Linux", "Linux26_64", "Linux 2.6 / 3.x (64 bit)",
149 VBOXOSTYPE_Linux26_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
150 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
151 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
152 { "Linux", "Linux", "ArchLinux", "Arch Linux",
153 VBOXOSTYPE_ArchLinux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
154 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
155 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
156 { "Linux", "Linux", "ArchLinux_64", "Arch Linux (64 bit)",
157 VBOXOSTYPE_ArchLinux_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
158 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
159 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
160 { "Linux", "Linux", "Debian", "Debian",
161 VBOXOSTYPE_Debian, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
162 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
163 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
164 { "Linux", "Linux", "Debian_64", "Debian (64 bit)",
165 VBOXOSTYPE_Debian_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
166 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
167 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97},
168 { "Linux", "Linux", "OpenSUSE", "openSUSE",
169 VBOXOSTYPE_OpenSUSE, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
170 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
171 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
172 { "Linux", "Linux", "OpenSUSE_64", "openSUSE (64 bit)",
173 VBOXOSTYPE_OpenSUSE_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
174 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
175 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
176 { "Linux", "Linux", "Fedora", "Fedora",
177 VBOXOSTYPE_FedoraCore, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
178 768, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
179 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
180 { "Linux", "Linux", "Fedora_64", "Fedora (64 bit)",
181 VBOXOSTYPE_FedoraCore_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
182 768, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
183 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
184 { "Linux", "Linux", "Gentoo", "Gentoo",
185 VBOXOSTYPE_Gentoo, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
186 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
187 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
188 { "Linux", "Linux", "Gentoo_64", "Gentoo (64 bit)",
189 VBOXOSTYPE_Gentoo_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
190 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
191 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
192 { "Linux", "Linux", "Mandriva", "Mandriva",
193 VBOXOSTYPE_Mandriva, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
194 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
195 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
196 { "Linux", "Linux", "Mandriva_64", "Mandriva (64 bit)",
197 VBOXOSTYPE_Mandriva_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
198 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
199 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
200 { "Linux", "Linux", "RedHat", "Red Hat",
201 VBOXOSTYPE_RedHat, VBOXOSHINT_RTCUTC | VBOXOSHINT_PAE,
202 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
203 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
204 { "Linux", "Linux", "RedHat_64", "Red Hat (64 bit)",
205 VBOXOSTYPE_RedHat_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
206 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
207 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
208 { "Linux", "Linux", "Turbolinux", "Turbolinux",
209 VBOXOSTYPE_Turbolinux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
210 384, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
211 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
212 { "Linux", "Linux", "Turbolinux_64", "Turbolinux (64 bit)",
213 VBOXOSTYPE_Turbolinux_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
214 384, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
215 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
216 { "Linux", "Linux", "Ubuntu", "Ubuntu",
217 VBOXOSTYPE_Ubuntu, VBOXOSHINT_RTCUTC | VBOXOSHINT_PAE | VBOXOSHINT_USBTABLET,
218 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
219 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
220 { "Linux", "Linux", "Ubuntu_64", "Ubuntu (64 bit)",
221 VBOXOSTYPE_Ubuntu_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
222 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
223 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
224 { "Linux", "Linux", "Xandros", "Xandros",
225 VBOXOSTYPE_Xandros, VBOXOSHINT_RTCUTC,
226 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
227 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
228 { "Linux", "Linux", "Xandros_64", "Xandros (64 bit)",
229 VBOXOSTYPE_Xandros_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
230 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
231 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
232 { "Linux", "Linux", "Oracle", "Oracle",
233 VBOXOSTYPE_Oracle, VBOXOSHINT_RTCUTC | VBOXOSHINT_PAE,
234 512, 12, 12 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
235 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
236 { "Linux", "Linux", "Oracle_64", "Oracle (64 bit)",
237 VBOXOSTYPE_Oracle_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
238 512, 12, 12 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
239 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
240 { "Linux", "Linux", "Linux", "Other Linux",
241 VBOXOSTYPE_Linux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
242 256, 12, 8 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
243 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
244 { "Linux", "Linux", "Linux_64", "Other Linux (64-bit)",
245 VBOXOSTYPE_Linux_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
246 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
247 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
248 { "Solaris", "Solaris", "Solaris", "Oracle Solaris 10 5/09 and earlier",
249 VBOXOSTYPE_Solaris, VBOXOSHINT_NONE,
250 768, 12, 16 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
251 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
252 { "Solaris", "Solaris", "Solaris_64", "Oracle Solaris 10 5/09 and earlier (64 bit)",
253 VBOXOSTYPE_Solaris_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
254 1536, 12, 16 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
255 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
256 { "Solaris", "Solaris", "OpenSolaris", "Oracle Solaris 10 10/09 and later",
257 VBOXOSTYPE_OpenSolaris, VBOXOSHINT_USBTABLET,
258 768, 12, 16 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_IntelAhci, StorageBus_SATA,
259 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
260 { "Solaris", "Solaris", "OpenSolaris_64", "Oracle Solaris 10 10/09 and later (64 bit)",
261 VBOXOSTYPE_OpenSolaris_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
262 1536, 12, 16 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_IntelAhci, StorageBus_SATA,
263 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
264 { "Solaris", "Solaris", "Solaris11_64", "Oracle Solaris 11 (64 bit)",
265 VBOXOSTYPE_Solaris11_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET,
266 1536, 12, 16 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_IntelAhci, StorageBus_SATA,
267 StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 },
268 { "BSD", "BSD", "FreeBSD", "FreeBSD",
269 VBOXOSTYPE_FreeBSD, VBOXOSHINT_NONE,
270 128, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
271 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
272 { "BSD", "BSD", "FreeBSD_64", "FreeBSD (64 bit)",
273 VBOXOSTYPE_FreeBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
274 128, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
275 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
276 { "BSD", "BSD", "OpenBSD", "OpenBSD",
277 VBOXOSTYPE_OpenBSD, VBOXOSHINT_HWVIRTEX,
278 64, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
279 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
280 { "BSD", "BSD", "OpenBSD_64", "OpenBSD (64 bit)",
281 VBOXOSTYPE_OpenBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
282 64, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
283 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
284 { "BSD", "BSD", "NetBSD", "NetBSD",
285 VBOXOSTYPE_NetBSD, VBOXOSHINT_NONE,
286 64, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
287 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
288 { "BSD", "BSD", "NetBSD_64", "NetBSD (64 bit)",
289 VBOXOSTYPE_NetBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
290 64, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
291 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
292 { "OS2", "IBM OS/2", "OS2Warp3", "OS/2 Warp 3",
293 VBOXOSTYPE_OS2Warp3, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_FLOPPY,
294 48, 4, 1 * _1G64, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
295 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 },
296 { "OS2", "IBM OS/2", "OS2Warp4", "OS/2 Warp 4",
297 VBOXOSTYPE_OS2Warp4, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_FLOPPY,
298 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
299 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 },
300 { "OS2", "IBM OS/2", "OS2Warp45", "OS/2 Warp 4.5",
301 VBOXOSTYPE_OS2Warp45, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_FLOPPY,
302 128, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
303 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 },
304 { "OS2", "IBM OS/2", "OS2eCS", "eComStation",
305 VBOXOSTYPE_ECS, VBOXOSHINT_HWVIRTEX,
306 256, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
307 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
308 { "OS2", "IBM OS/2", "OS21x", "OS/2 1.x",
309 VBOXOSTYPE_OS21x, VBOXOSHINT_FLOPPY | VBOXOSHINT_NOUSB | VBOXOSHINT_TFRESET,
310 8, 4, 500 * _1M, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
311 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 },
312 { "OS2", "IBM OS/2", "OS2", "Other OS/2",
313 VBOXOSTYPE_OS2, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_FLOPPY | VBOXOSHINT_NOUSB,
314 96, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
315 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 },
316 { "MacOS", "Mac OS X", "MacOS", "Mac OS X",
317 VBOXOSTYPE_MacOS, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE
318 | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
319 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0,
320 StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA,
321 ChipsetType_ICH9, AudioControllerType_HDA },
322 { "MacOS", "Mac OS X", "MacOS_64", "Mac OS X (64 bit)",
323 VBOXOSTYPE_MacOS_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT
324 | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
325 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0,
326 StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA,
327 ChipsetType_ICH9, AudioControllerType_HDA },
328 { "MacOS", "Mac OS X", "MacOS106", "Mac OS X 10.6 Snow Leopard",
329 VBOXOSTYPE_MacOS106, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE
330 | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
331 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0,
332 StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA,
333 ChipsetType_ICH9, AudioControllerType_HDA },
334 { "MacOS", "Mac OS X", "MacOS106_64", "Mac OS X 10.6 Snow Leopard (64 bit)",
335 VBOXOSTYPE_MacOS106_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT
336 | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
337 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0,
338 StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA,
339 ChipsetType_ICH9, AudioControllerType_HDA },
340 { "MacOS", "Mac OS X", "MacOS107_64", "Mac OS X 10.7 Lion (64 bit)",
341 VBOXOSTYPE_MacOS107_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT
342 | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
343 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0,
344 StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA,
345 ChipsetType_ICH9, AudioControllerType_HDA },
346 { "MacOS", "Mac OS X", "MacOS108_64", "Mac OS X 10.8 Mountain Lion (64 bit)", /* Aka "Mountain Kitten". */
347 VBOXOSTYPE_MacOS108_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT
348 | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
349 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0,
350 StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA,
351 ChipsetType_ICH9, AudioControllerType_HDA },
352 { "MacOS", "Mac OS X", "MacOS109_64", "Mac OS X 10.9 Mavericks (64 bit)", /* Not to be confused with McCain. */
353 VBOXOSTYPE_MacOS109_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT
354 | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
355 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0,
356 StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA,
357 ChipsetType_ICH9, AudioControllerType_HDA },
358 { "Other", "Other", "DOS", "DOS",
359 VBOXOSTYPE_DOS, VBOXOSHINT_FLOPPY | VBOXOSHINT_NOUSB,
360 32, 4, 500 * _1M, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
361 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 },
362 { "Other", "Other", "Netware", "Netware",
363 VBOXOSTYPE_Netware, VBOXOSHINT_HWVIRTEX,
364 512, 4, 4 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
365 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
366 { "Other", "Other", "L4", "L4",
367 VBOXOSTYPE_L4, VBOXOSHINT_NONE,
368 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
369 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
370 { "Other", "Other", "QNX", "QNX",
371#ifdef VBOX_WITH_RAW_RING1
372 VBOXOSTYPE_QNX, VBOXOSHINT_NONE,
373#else
374 VBOXOSTYPE_QNX, VBOXOSHINT_HWVIRTEX,
375#endif
376 512, 4, 4 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
377 StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 },
378 { "Other", "Other", "JRockitVE", "JRockitVE",
379 VBOXOSTYPE_JRockitVE, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_PAE,
380 1024, 4, 8 * _1G64, NetworkAdapterType_I82545EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
381 StorageControllerType_BusLogic, StorageBus_SCSI, ChipsetType_PIIX3, AudioControllerType_AC97 },
382};
383
384uint32_t Global::cOSTypes = RT_ELEMENTS(Global::sOSTypes);
385
386/**
387 * Returns an OS Type ID for the given VBOXOSTYPE value.
388 *
389 * The returned ID will correspond to the IGuestOSType::id value of one of the
390 * objects stored in the IVirtualBox::guestOSTypes
391 * (VirtualBoxImpl::COMGETTER(GuestOSTypes)) collection.
392 */
393/* static */
394const char *Global::OSTypeId(VBOXOSTYPE aOSType)
395{
396 for (size_t i = 0; i < RT_ELEMENTS(sOSTypes); ++i)
397 {
398 if (sOSTypes[i].osType == aOSType)
399 return sOSTypes[i].id;
400 }
401
402 return sOSTypes[0].id;
403}
404
405/*static*/ uint32_t Global::getMaxNetworkAdapters(ChipsetType_T aChipsetType)
406{
407 switch (aChipsetType)
408 {
409 case ChipsetType_PIIX3:
410 return 8;
411 case ChipsetType_ICH9:
412 return 36;
413 default:
414 return 0;
415 }
416}
417
418/*static*/ const char *
419Global::stringifyMachineState(MachineState_T aState)
420{
421 switch (aState)
422 {
423 case MachineState_Null: return "Null";
424 case MachineState_PoweredOff: return "PoweredOff";
425 case MachineState_Saved: return "Saved";
426 case MachineState_Teleported: return "Teleported";
427 case MachineState_Aborted: return "Aborted";
428 case MachineState_Running: return "Running";
429 case MachineState_Paused: return "Paused";
430 case MachineState_Stuck: return "GuruMeditation";
431 case MachineState_Teleporting: return "Teleporting";
432 case MachineState_LiveSnapshotting: return "LiveSnapshotting";
433 case MachineState_Starting: return "Starting";
434 case MachineState_Stopping: return "Stopping";
435 case MachineState_Saving: return "Saving";
436 case MachineState_Restoring: return "Restoring";
437 case MachineState_TeleportingPausedVM: return "TeleportingPausedVM";
438 case MachineState_TeleportingIn: return "TeleportingIn";
439 case MachineState_FaultTolerantSyncing: return "FaultTolerantSyncing";
440 case MachineState_DeletingSnapshotOnline: return "DeletingSnapshotOnline";
441 case MachineState_DeletingSnapshotPaused: return "DeletingSnapshotPaused";
442 case MachineState_RestoringSnapshot: return "RestoringSnapshot";
443 case MachineState_DeletingSnapshot: return "DeletingSnapshot";
444 case MachineState_SettingUp: return "SettingUp";
445 default:
446 {
447 AssertMsgFailed(("%d (%#x)\n", aState, aState));
448 static char s_szMsg[48];
449 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidState-0x%08x\n", aState);
450 return s_szMsg;
451 }
452 }
453}
454
455/*static*/ const char *
456Global::stringifySessionState(SessionState_T aState)
457{
458 switch (aState)
459 {
460 case SessionState_Null: return "Null";
461 case SessionState_Unlocked: return "Unlocked";
462 case SessionState_Locked: return "Locked";
463 case SessionState_Spawning: return "Spawning";
464 case SessionState_Unlocking: return "Unlocking";
465 default:
466 {
467 AssertMsgFailed(("%d (%#x)\n", aState, aState));
468 static char s_szMsg[48];
469 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidState-0x%08x\n", aState);
470 return s_szMsg;
471 }
472 }
473}
474
475/*static*/ const char *
476Global::stringifyDeviceType(DeviceType_T aType)
477{
478 switch (aType)
479 {
480 case DeviceType_Null: return "Null";
481 case DeviceType_Floppy: return "Floppy";
482 case DeviceType_DVD: return "DVD";
483 case DeviceType_HardDisk: return "HardDisk";
484 case DeviceType_Network: return "Network";
485 case DeviceType_USB: return "USB";
486 case DeviceType_SharedFolder: return "ShardFolder";
487 default:
488 {
489 AssertMsgFailed(("%d (%#x)\n", aType, aType));
490 static char s_szMsg[48];
491 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidType-0x%08x\n", aType);
492 return s_szMsg;
493 }
494 }
495}
496
497
498/*static*/ const char *
499Global::stringifyReason(Reason_T aReason)
500{
501 switch (aReason)
502 {
503 case Reason_Unspecified: return "unspecified";
504 case Reason_HostSuspend: return "host suspend";
505 case Reason_HostResume: return "host resume";
506 case Reason_HostBatteryLow: return "host battery low";
507 default:
508 {
509 AssertMsgFailed(("%d (%#x)\n", aReason, aReason));
510 static char s_szMsg[48];
511 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "invalid reason %#010x\n", aReason);
512 return s_szMsg;
513 }
514 }
515}
516
517/*static*/ int
518Global::vboxStatusCodeFromCOM(HRESULT aComStatus)
519{
520 switch (aComStatus)
521 {
522 case S_OK: return VINF_SUCCESS;
523
524 /* Standard COM status codes. See also RTErrConvertFromDarwinCOM */
525 case E_UNEXPECTED: return VERR_COM_UNEXPECTED;
526 case E_NOTIMPL: return VERR_NOT_IMPLEMENTED;
527 case E_OUTOFMEMORY: return VERR_NO_MEMORY;
528 case E_INVALIDARG: return VERR_INVALID_PARAMETER;
529 case E_NOINTERFACE: return VERR_NOT_SUPPORTED;
530 case E_POINTER: return VERR_INVALID_POINTER;
531#ifdef E_HANDLE
532 case E_HANDLE: return VERR_INVALID_HANDLE;
533#endif
534 case E_ABORT: return VERR_CANCELLED;
535 case E_FAIL: return VERR_GENERAL_FAILURE;
536 case E_ACCESSDENIED: return VERR_ACCESS_DENIED;
537
538 /* VirtualBox status codes */
539 case VBOX_E_OBJECT_NOT_FOUND: return VERR_COM_OBJECT_NOT_FOUND;
540 case VBOX_E_INVALID_VM_STATE: return VERR_COM_INVALID_VM_STATE;
541 case VBOX_E_VM_ERROR: return VERR_COM_VM_ERROR;
542 case VBOX_E_FILE_ERROR: return VERR_COM_FILE_ERROR;
543 case VBOX_E_IPRT_ERROR: return VERR_COM_IPRT_ERROR;
544 case VBOX_E_PDM_ERROR: return VERR_COM_PDM_ERROR;
545 case VBOX_E_INVALID_OBJECT_STATE: return VERR_COM_INVALID_OBJECT_STATE;
546 case VBOX_E_HOST_ERROR: return VERR_COM_HOST_ERROR;
547 case VBOX_E_NOT_SUPPORTED: return VERR_COM_NOT_SUPPORTED;
548 case VBOX_E_XML_ERROR: return VERR_COM_XML_ERROR;
549 case VBOX_E_INVALID_SESSION_STATE: return VERR_COM_INVALID_SESSION_STATE;
550 case VBOX_E_OBJECT_IN_USE: return VERR_COM_OBJECT_IN_USE;
551
552 default:
553 if (SUCCEEDED(aComStatus))
554 return VINF_SUCCESS;
555 /** @todo Check for the win32 facility and use the
556 * RTErrConvertFromWin32 function on windows. */
557 return VERR_UNRESOLVED_ERROR;
558 }
559}
560
561
562/*static*/ HRESULT
563Global::vboxStatusCodeToCOM(int aVBoxStatus)
564{
565 switch (aVBoxStatus)
566 {
567 case VINF_SUCCESS: return S_OK;
568
569 /* Standard COM status codes. */
570 case VERR_COM_UNEXPECTED: return E_UNEXPECTED;
571 case VERR_NOT_IMPLEMENTED: return E_NOTIMPL;
572 case VERR_NO_MEMORY: return E_OUTOFMEMORY;
573 case VERR_INVALID_PARAMETER: return E_INVALIDARG;
574 case VERR_NOT_SUPPORTED: return E_NOINTERFACE;
575 case VERR_INVALID_POINTER: return E_POINTER;
576#ifdef E_HANDLE
577 case VERR_INVALID_HANDLE: return E_HANDLE;
578#endif
579 case VERR_CANCELLED: return E_ABORT;
580 case VERR_GENERAL_FAILURE: return E_FAIL;
581 case VERR_ACCESS_DENIED: return E_ACCESSDENIED;
582
583 /* VirtualBox COM status codes */
584 case VERR_COM_OBJECT_NOT_FOUND: return VBOX_E_OBJECT_NOT_FOUND;
585 case VERR_COM_INVALID_VM_STATE: return VBOX_E_INVALID_VM_STATE;
586 case VERR_COM_VM_ERROR: return VBOX_E_VM_ERROR;
587 case VERR_COM_FILE_ERROR: return VBOX_E_FILE_ERROR;
588 case VERR_COM_IPRT_ERROR: return VBOX_E_IPRT_ERROR;
589 case VERR_COM_PDM_ERROR: return VBOX_E_PDM_ERROR;
590 case VERR_COM_INVALID_OBJECT_STATE: return VBOX_E_INVALID_OBJECT_STATE;
591 case VERR_COM_HOST_ERROR: return VBOX_E_HOST_ERROR;
592 case VERR_COM_NOT_SUPPORTED: return VBOX_E_NOT_SUPPORTED;
593 case VERR_COM_XML_ERROR: return VBOX_E_XML_ERROR;
594 case VERR_COM_INVALID_SESSION_STATE: return VBOX_E_INVALID_SESSION_STATE;
595 case VERR_COM_OBJECT_IN_USE: return VBOX_E_OBJECT_IN_USE;
596
597 /* Other errors. */
598 case VERR_UNRESOLVED_ERROR: return E_FAIL;
599
600 default:
601 AssertMsgFailed(("%Rrc\n", aVBoxStatus));
602 if (RT_SUCCESS(aVBoxStatus))
603 return S_OK;
604
605 /* try categorize it */
606 if ( aVBoxStatus < 0
607 && ( aVBoxStatus > -1000
608 || (aVBoxStatus < -22000 && aVBoxStatus > -32766) )
609 )
610 return VBOX_E_IPRT_ERROR;
611 if ( aVBoxStatus < VERR_PDM_NO_SUCH_LUN / 100 * 10
612 && aVBoxStatus > VERR_PDM_NO_SUCH_LUN / 100 * 10 - 100)
613 return VBOX_E_PDM_ERROR;
614 if ( aVBoxStatus <= -1000
615 && aVBoxStatus > -5000 /* wrong, but so what... */)
616 return VBOX_E_VM_ERROR;
617
618 return E_FAIL;
619 }
620}
621
622/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette