VirtualBox

source: vbox/trunk/src/VBox/Main/Global.cpp@ 31907

Last change on this file since 31907 was 31716, checked in by vboxsync, 14 years ago

Main/Global.cpp: MachineState_FaultTolerantSyncing to string.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 31.5 KB
Line 
1/* $Id: Global.cpp 31716 2010-08-17 09:50:17Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM global definitions
6 *
7 * NOTE: This file is part of both VBoxC.dll and VBoxSVC.exe.
8 */
9
10/*
11 * Copyright (C) 2008-2010 Oracle Corporation
12 *
13 * This file is part of VirtualBox Open Source Edition (OSE), as
14 * available from http://www.virtualbox.org. This file is free software;
15 * you can redistribute it and/or modify it under the terms of the GNU
16 * General Public License (GPL) as published by the Free Software
17 * Foundation, in version 2 as it comes in the "COPYING" file of the
18 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
19 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
20 */
21
22#include "Global.h"
23
24#include <iprt/assert.h>
25#include <iprt/string.h>
26#include <VBox/err.h>
27
28/* static */
29const Global::OSType Global::sOSTypes[SchemaDefs::OSTypeId_COUNT] =
30{
31 /* NOTE1: we assume that unknown is always the first entry!
32 * NOTE2: please use powers of 2 when specifying the size of harddisks since
33 * '2GB' looks better than '1.95GB' (= 2000MB) */
34 { "Other", "Other", SchemaDefs_OSTypeId_Other, "Other/Unknown",
35 VBOXOSTYPE_Unknown, VBOXOSHINT_NONE,
36 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
37 StorageControllerType_PIIX4, StorageBus_IDE },
38 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows31, "Windows 3.1",
39 VBOXOSTYPE_Win31, VBOXOSHINT_NONE,
40 32, 4, 1 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
41 StorageControllerType_PIIX4, StorageBus_IDE },
42 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows95, "Windows 95",
43 VBOXOSTYPE_Win95, VBOXOSHINT_NONE,
44 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
45 StorageControllerType_PIIX4, StorageBus_IDE },
46 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows98, "Windows 98",
47 VBOXOSTYPE_Win98, VBOXOSHINT_NONE,
48 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
49 StorageControllerType_PIIX4, StorageBus_IDE },
50 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsMe, "Windows Me",
51 VBOXOSTYPE_WinMe, VBOXOSHINT_NONE,
52 64, 4, 4 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
53 StorageControllerType_PIIX4, StorageBus_IDE },
54 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsNT4, "Windows NT 4",
55 VBOXOSTYPE_WinNT4, VBOXOSHINT_NONE,
56 128, 16, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
57 StorageControllerType_PIIX4, StorageBus_IDE },
58 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows2000, "Windows 2000",
59 VBOXOSTYPE_Win2k, VBOXOSHINT_NONE,
60 168, 16, 4 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
61 StorageControllerType_PIIX4, StorageBus_IDE },
62 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsXP, "Windows XP",
63 VBOXOSTYPE_WinXP, VBOXOSHINT_NONE,
64 192, 16, 10 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
65 StorageControllerType_PIIX4, StorageBus_IDE },
66 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsXP_64, "Windows XP (64 bit)",
67 VBOXOSTYPE_WinXP_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
68 192, 16, 10 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
69 StorageControllerType_PIIX4, StorageBus_IDE },
70 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows2003, "Windows 2003",
71 VBOXOSTYPE_Win2k3, VBOXOSHINT_NONE,
72 256, 16, 20 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
73 StorageControllerType_PIIX4, StorageBus_IDE },
74 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows2003_64, "Windows 2003 (64 bit)",
75 VBOXOSTYPE_Win2k3_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
76 256, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
77 StorageControllerType_PIIX4, StorageBus_IDE },
78 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsVista, "Windows Vista",
79 VBOXOSTYPE_WinVista, VBOXOSHINT_NONE,
80 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
81 StorageControllerType_IntelAhci, StorageBus_SATA },
82 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsVista_64, "Windows Vista (64 bit)",
83 VBOXOSTYPE_WinVista_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
84 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
85 StorageControllerType_IntelAhci, StorageBus_SATA },
86 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows2008, "Windows 2008",
87 VBOXOSTYPE_Win2k8, VBOXOSHINT_NONE,
88 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
89 StorageControllerType_IntelAhci, StorageBus_SATA },
90 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows2008_64, "Windows 2008 (64 bit)",
91 VBOXOSTYPE_Win2k8_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
92 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
93 StorageControllerType_IntelAhci, StorageBus_SATA },
94 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows7, "Windows 7",
95 VBOXOSTYPE_Win7, VBOXOSHINT_NONE,
96 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
97 StorageControllerType_IntelAhci, StorageBus_SATA },
98 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows7_64, "Windows 7 (64 bit)",
99 VBOXOSTYPE_Win7_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
100 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
101 StorageControllerType_IntelAhci, StorageBus_SATA },
102 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsNT, "Other Windows",
103 VBOXOSTYPE_WinNT, VBOXOSHINT_NONE,
104 512, 16, 20 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
105 StorageControllerType_PIIX4, StorageBus_IDE },
106 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux22, "Linux 2.2",
107 VBOXOSTYPE_Linux22, VBOXOSHINT_RTCUTC,
108 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
109 StorageControllerType_PIIX4, StorageBus_IDE },
110 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux24, "Linux 2.4",
111 VBOXOSTYPE_Linux24, VBOXOSHINT_RTCUTC,
112 128, 4, 4 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
113 StorageControllerType_PIIX4, StorageBus_IDE },
114 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux24_64, "Linux 2.4 (64 bit)",
115 VBOXOSTYPE_Linux24_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
116 128, 4, 4 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
117 StorageControllerType_IntelAhci, StorageBus_SATA },
118 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux26, "Linux 2.6",
119 VBOXOSTYPE_Linux26, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
120 256, 4, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
121 StorageControllerType_IntelAhci, StorageBus_SATA },
122 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux26_64, "Linux 2.6 (64 bit)",
123 VBOXOSTYPE_Linux26_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
124 256, 4, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
125 StorageControllerType_IntelAhci, StorageBus_SATA },
126 { "Linux", "Linux", SchemaDefs_OSTypeId_ArchLinux, "Arch Linux",
127 VBOXOSTYPE_ArchLinux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
128 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
129 StorageControllerType_IntelAhci, StorageBus_SATA },
130 { "Linux", "Linux", SchemaDefs_OSTypeId_ArchLinux_64, "Arch Linux (64 bit)",
131 VBOXOSTYPE_ArchLinux_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
132 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
133 StorageControllerType_IntelAhci, StorageBus_SATA },
134 { "Linux", "Linux", SchemaDefs_OSTypeId_Debian, "Debian",
135 VBOXOSTYPE_Debian, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
136 384, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
137 StorageControllerType_IntelAhci, StorageBus_SATA },
138 { "Linux", "Linux", SchemaDefs_OSTypeId_Debian_64, "Debian (64 bit)",
139 VBOXOSTYPE_Debian_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
140 384, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
141 StorageControllerType_IntelAhci, StorageBus_SATA },
142 { "Linux", "Linux", SchemaDefs_OSTypeId_OpenSUSE, "openSUSE",
143 VBOXOSTYPE_OpenSUSE, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
144 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
145 StorageControllerType_IntelAhci, StorageBus_SATA },
146 { "Linux", "Linux", SchemaDefs_OSTypeId_OpenSUSE_64, "openSUSE (64 bit)",
147 VBOXOSTYPE_OpenSUSE_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
148 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
149 StorageControllerType_IntelAhci, StorageBus_SATA },
150 { "Linux", "Linux", SchemaDefs_OSTypeId_Fedora, "Fedora",
151 VBOXOSTYPE_FedoraCore, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
152 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
153 StorageControllerType_IntelAhci, StorageBus_SATA },
154 { "Linux", "Linux", SchemaDefs_OSTypeId_Fedora_64, "Fedora (64 bit)",
155 VBOXOSTYPE_FedoraCore_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
156 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
157 StorageControllerType_IntelAhci, StorageBus_SATA },
158 { "Linux", "Linux", SchemaDefs_OSTypeId_Gentoo, "Gentoo",
159 VBOXOSTYPE_Gentoo, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
160 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
161 StorageControllerType_IntelAhci, StorageBus_SATA },
162 { "Linux", "Linux", SchemaDefs_OSTypeId_Gentoo_64, "Gentoo (64 bit)",
163 VBOXOSTYPE_Gentoo_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
164 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
165 StorageControllerType_IntelAhci, StorageBus_SATA },
166 { "Linux", "Linux", SchemaDefs_OSTypeId_Mandriva, "Mandriva",
167 VBOXOSTYPE_Mandriva, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
168 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
169 StorageControllerType_IntelAhci, StorageBus_SATA },
170 { "Linux", "Linux", SchemaDefs_OSTypeId_Mandriva_64, "Mandriva (64 bit)",
171 VBOXOSTYPE_Mandriva_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
172 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
173 StorageControllerType_IntelAhci, StorageBus_SATA },
174 { "Linux", "Linux", SchemaDefs_OSTypeId_RedHat, "Red Hat",
175 VBOXOSTYPE_RedHat, VBOXOSHINT_RTCUTC | VBOXOSHINT_PAE,
176 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
177 StorageControllerType_IntelAhci, StorageBus_SATA },
178 { "Linux", "Linux", SchemaDefs_OSTypeId_RedHat_64, "Red Hat (64 bit)",
179 VBOXOSTYPE_RedHat_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
180 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
181 StorageControllerType_IntelAhci, StorageBus_SATA },
182 { "Linux", "Linux", SchemaDefs_OSTypeId_Turbolinux, "Turbolinux",
183 VBOXOSTYPE_Turbolinux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
184 384, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
185 StorageControllerType_IntelAhci, StorageBus_SATA },
186 { "Linux", "Linux", SchemaDefs_OSTypeId_Turbolinux, "Turbolinux (64 bit)",
187 VBOXOSTYPE_Turbolinux_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
188 384, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
189 StorageControllerType_IntelAhci, StorageBus_SATA },
190 { "Linux", "Linux", SchemaDefs_OSTypeId_Ubuntu, "Ubuntu",
191 VBOXOSTYPE_Ubuntu, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
192 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
193 StorageControllerType_IntelAhci, StorageBus_SATA },
194 { "Linux", "Linux", SchemaDefs_OSTypeId_Ubuntu_64, "Ubuntu (64 bit)",
195 VBOXOSTYPE_Ubuntu_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
196 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
197 StorageControllerType_IntelAhci, StorageBus_SATA },
198 { "Linux", "Linux", SchemaDefs_OSTypeId_Xandros, "Xandros",
199 VBOXOSTYPE_Xandros, VBOXOSHINT_RTCUTC,
200 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
201 StorageControllerType_IntelAhci, StorageBus_SATA },
202 { "Linux", "Linux", SchemaDefs_OSTypeId_Xandros_64, "Xandros (64 bit)",
203 VBOXOSTYPE_Xandros_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
204 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
205 StorageControllerType_IntelAhci, StorageBus_SATA },
206 { "Linux", "Linux", SchemaDefs_OSTypeId_Oracle, "Oracle",
207 VBOXOSTYPE_Oracle, VBOXOSHINT_RTCUTC,
208 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
209 StorageControllerType_IntelAhci, StorageBus_SATA },
210 { "Linux", "Linux", SchemaDefs_OSTypeId_Oracle_64, "Oracle (64 bit)",
211 VBOXOSTYPE_Oracle_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
212 512, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
213 StorageControllerType_IntelAhci, StorageBus_SATA },
214 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux, "Other Linux",
215 VBOXOSTYPE_Linux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
216 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
217 StorageControllerType_PIIX4, StorageBus_IDE },
218 { "Solaris", "Solaris", SchemaDefs_OSTypeId_Solaris, "Solaris",
219 VBOXOSTYPE_Solaris, VBOXOSHINT_NONE,
220 768, 12, 16 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
221 StorageControllerType_PIIX4, StorageBus_IDE },
222 { "Solaris", "Solaris", SchemaDefs_OSTypeId_Solaris_64, "Solaris (64 bit)",
223 VBOXOSTYPE_Solaris_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
224 768, 12, 16 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
225 StorageControllerType_PIIX4, StorageBus_IDE },
226 { "Solaris", "Solaris", SchemaDefs_OSTypeId_OpenSolaris, "OpenSolaris",
227 VBOXOSTYPE_OpenSolaris, VBOXOSHINT_NONE,
228 768, 12, 16 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
229 StorageControllerType_PIIX4, StorageBus_IDE },
230 { "Solaris", "Solaris", SchemaDefs_OSTypeId_OpenSolaris_64, "OpenSolaris (64 bit)",
231 VBOXOSTYPE_OpenSolaris_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
232 768, 12, 16 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
233 StorageControllerType_PIIX4, StorageBus_IDE },
234 { "BSD", "BSD", SchemaDefs_OSTypeId_FreeBSD, "FreeBSD",
235 VBOXOSTYPE_FreeBSD, VBOXOSHINT_NONE,
236 128, 4, 2 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
237 StorageControllerType_PIIX4, StorageBus_IDE },
238 { "BSD", "BSD", SchemaDefs_OSTypeId_FreeBSD_64, "FreeBSD (64 bit)",
239 VBOXOSTYPE_FreeBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
240 128, 4, 2 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
241 StorageControllerType_PIIX4, StorageBus_IDE },
242 { "BSD", "BSD", SchemaDefs_OSTypeId_OpenBSD, "OpenBSD",
243 VBOXOSTYPE_OpenBSD, VBOXOSHINT_HWVIRTEX,
244 64, 4, 2 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
245 StorageControllerType_PIIX4, StorageBus_IDE },
246 { "BSD", "BSD", SchemaDefs_OSTypeId_OpenBSD_64, "OpenBSD (64 bit)",
247 VBOXOSTYPE_OpenBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
248 64, 4, 2 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
249 StorageControllerType_PIIX4, StorageBus_IDE },
250 { "BSD", "BSD", SchemaDefs_OSTypeId_NetBSD, "NetBSD",
251 VBOXOSTYPE_NetBSD, VBOXOSHINT_NONE,
252 64, 4, 2 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
253 StorageControllerType_PIIX4, StorageBus_IDE },
254 { "BSD", "BSD", SchemaDefs_OSTypeId_NetBSD_64, "NetBSD (64 bit)",
255 VBOXOSTYPE_NetBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
256 64, 4, 2 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
257 StorageControllerType_PIIX4, StorageBus_IDE },
258 { "OS2", "IBM OS/2", SchemaDefs_OSTypeId_OS2Warp3, "OS/2 Warp 3",
259 VBOXOSTYPE_OS2Warp3, VBOXOSHINT_HWVIRTEX,
260 48, 4, 1 * _1K, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
261 StorageControllerType_PIIX4, StorageBus_IDE },
262 { "OS2", "IBM OS/2", SchemaDefs_OSTypeId_OS2Warp4, "OS/2 Warp 4",
263 VBOXOSTYPE_OS2Warp4, VBOXOSHINT_HWVIRTEX,
264 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
265 StorageControllerType_PIIX4, StorageBus_IDE },
266 { "OS2", "IBM OS/2", SchemaDefs_OSTypeId_OS2Warp45, "OS/2 Warp 4.5",
267 VBOXOSTYPE_OS2Warp45, VBOXOSHINT_HWVIRTEX,
268 96, 4, 2 * _1K, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
269 StorageControllerType_PIIX4, StorageBus_IDE },
270 { "OS2", "IBM OS/2", SchemaDefs_OSTypeId_OS2eCS, "eComStation",
271 VBOXOSTYPE_ECS, VBOXOSHINT_HWVIRTEX,
272 96, 4, 2 * _1K, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
273 StorageControllerType_PIIX4, StorageBus_IDE },
274 { "OS2", "IBM OS/2", SchemaDefs_OSTypeId_OS2, "Other OS/2",
275 VBOXOSTYPE_OS2, VBOXOSHINT_HWVIRTEX,
276 96, 4, 2 * _1K, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
277 StorageControllerType_PIIX4, StorageBus_IDE },
278 { "MacOS", "Mac OS X", SchemaDefs_OSTypeId_MacOS, "Mac OS X Server",
279 VBOXOSTYPE_MacOS, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_USBTABLET,
280 1024, 4, 20 * _1K, NetworkAdapterType_I82543GC, 0, StorageControllerType_ICH6, StorageBus_IDE,
281 StorageControllerType_ICH6, StorageBus_IDE },
282 { "MacOS", "Mac OS X", SchemaDefs_OSTypeId_MacOS_64, "Mac OS X Server (64 bit)",
283 VBOXOSTYPE_MacOS_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_USBTABLET,
284 1024, 4, 20 * _1K, NetworkAdapterType_I82543GC, 0, StorageControllerType_ICH6, StorageBus_IDE,
285 StorageControllerType_ICH6, StorageBus_IDE },
286 { "Other", "Other", SchemaDefs_OSTypeId_DOS, "DOS",
287 VBOXOSTYPE_DOS, VBOXOSHINT_NONE,
288 32, 4, 512, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
289 StorageControllerType_PIIX4, StorageBus_IDE },
290 { "Other", "Other", SchemaDefs_OSTypeId_Netware, "Netware",
291 VBOXOSTYPE_Netware, VBOXOSHINT_HWVIRTEX,
292 512, 4, 4 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
293 StorageControllerType_PIIX4, StorageBus_IDE },
294 { "Other", "Other", SchemaDefs_OSTypeId_L4, "L4",
295 VBOXOSTYPE_L4, VBOXOSHINT_NONE,
296 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
297 StorageControllerType_PIIX4, StorageBus_IDE },
298 { "Other", "Other", SchemaDefs_OSTypeId_QNX, "QNX",
299 VBOXOSTYPE_QNX, VBOXOSHINT_HWVIRTEX,
300 512, 4, 4 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
301 StorageControllerType_PIIX4, StorageBus_IDE },
302};
303
304/**
305 * Returns an OS Type ID for the given VBOXOSTYPE value.
306 *
307 * The returned ID will correspond to the IGuestOSType::id value of one of the
308 * objects stored in the IVirtualBox::guestOSTypes
309 * (VirtualBoxImpl::COMGETTER(GuestOSTypes)) collection.
310 */
311/* static */
312const char *Global::OSTypeId(VBOXOSTYPE aOSType)
313{
314 for (size_t i = 0; i < RT_ELEMENTS(sOSTypes); ++i)
315 {
316 if (sOSTypes[i].osType == aOSType)
317 return sOSTypes[i].id;
318 }
319
320 AssertMsgFailed(("No record for VBOXOSTYPE %d\n", aOSType));
321 return sOSTypes[0].id;
322}
323
324/*static*/ const char *
325Global::stringifyMachineState(MachineState_T aState)
326{
327 switch (aState)
328 {
329 case MachineState_Null: return "Null";
330 case MachineState_PoweredOff: return "PoweredOff";
331 case MachineState_Saved: return "Saved";
332 case MachineState_Teleported: return "Teleported";
333 case MachineState_Aborted: return "Aborted";
334 case MachineState_Running: return "Running";
335 case MachineState_Paused: return "Paused";
336 case MachineState_Stuck: return "GuruMeditation";
337 case MachineState_Teleporting: return "Teleporting";
338 case MachineState_LiveSnapshotting: return "LiveSnapshotting";
339 case MachineState_Starting: return "Starting";
340 case MachineState_Stopping: return "Stopping";
341 case MachineState_Saving: return "Saving";
342 case MachineState_Restoring: return "Restoring";
343 case MachineState_TeleportingPausedVM: return "TeleportingPausedVM";
344 case MachineState_TeleportingIn: return "TeleportingIn";
345 case MachineState_FaultTolerantSyncing: return "FaultTolerantSyncing";
346 case MachineState_DeletingSnapshotOnline: return "DeletingSnapshotOnline";
347 case MachineState_DeletingSnapshotPaused: return "DeletingSnapshotPaused";
348 case MachineState_RestoringSnapshot: return "RestoringSnapshot";
349 case MachineState_DeletingSnapshot: return "DeletingSnapshot";
350 case MachineState_SettingUp: return "SettingUp";
351 default:
352 {
353 AssertMsgFailed(("%d (%#x)\n", aState, aState));
354 static char s_szMsg[48];
355 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidState-0x%08x\n", aState);
356 return s_szMsg;
357 }
358 }
359}
360
361/*static*/ const char *
362Global::stringifySessionState(SessionState_T aState)
363{
364 switch (aState)
365 {
366 case SessionState_Null: return "Null";
367 case SessionState_Unlocked: return "Unlocked";
368 case SessionState_Locked: return "Locked";
369 case SessionState_Spawning: return "Spawning";
370 case SessionState_Unlocking: return "Unlocking";
371 default:
372 {
373 AssertMsgFailed(("%d (%#x)\n", aState, aState));
374 static char s_szMsg[48];
375 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidState-0x%08x\n", aState);
376 return s_szMsg;
377 }
378 }
379}
380
381/*static*/ const char *
382Global::stringifyDeviceType(DeviceType_T aType)
383{
384 switch (aType)
385 {
386 case DeviceType_Null: return "Null";
387 case DeviceType_Floppy: return "Floppy";
388 case DeviceType_DVD: return "DVD";
389 case DeviceType_HardDisk: return "HardDisk";
390 case DeviceType_Network: return "Network";
391 case DeviceType_USB: return "USB";
392 case DeviceType_SharedFolder: return "ShardFolder";
393 default:
394 {
395 AssertMsgFailed(("%d (%#x)\n", aType, aType));
396 static char s_szMsg[48];
397 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidType-0x%08x\n", aType);
398 return s_szMsg;
399 }
400 }
401}
402
403/*static*/ int
404Global::vboxStatusCodeFromCOM(HRESULT aComStatus)
405{
406 switch (aComStatus)
407 {
408 case S_OK: return VINF_SUCCESS;
409
410 /* Standard COM status codes. See also RTErrConvertFromDarwinCOM */
411 case E_UNEXPECTED: return VERR_COM_UNEXPECTED;
412 case E_NOTIMPL: return VERR_NOT_IMPLEMENTED;
413 case E_OUTOFMEMORY: return VERR_NO_MEMORY;
414 case E_INVALIDARG: return VERR_INVALID_PARAMETER;
415 case E_NOINTERFACE: return VERR_NOT_SUPPORTED;
416 case E_POINTER: return VERR_INVALID_POINTER;
417#ifdef E_HANDLE
418 case E_HANDLE: return VERR_INVALID_HANDLE;
419#endif
420 case E_ABORT: return VERR_CANCELLED;
421 case E_FAIL: return VERR_GENERAL_FAILURE;
422 case E_ACCESSDENIED: return VERR_ACCESS_DENIED;
423
424 /* VirtualBox status codes */
425 case VBOX_E_OBJECT_NOT_FOUND: return VERR_COM_OBJECT_NOT_FOUND;
426 case VBOX_E_INVALID_VM_STATE: return VERR_COM_INVALID_VM_STATE;
427 case VBOX_E_VM_ERROR: return VERR_COM_VM_ERROR;
428 case VBOX_E_FILE_ERROR: return VERR_COM_FILE_ERROR;
429 case VBOX_E_IPRT_ERROR: return VERR_COM_IPRT_ERROR;
430 case VBOX_E_PDM_ERROR: return VERR_COM_PDM_ERROR;
431 case VBOX_E_INVALID_OBJECT_STATE: return VERR_COM_INVALID_OBJECT_STATE;
432 case VBOX_E_HOST_ERROR: return VERR_COM_HOST_ERROR;
433 case VBOX_E_NOT_SUPPORTED: return VERR_COM_NOT_SUPPORTED;
434 case VBOX_E_XML_ERROR: return VERR_COM_XML_ERROR;
435 case VBOX_E_INVALID_SESSION_STATE: return VERR_COM_INVALID_SESSION_STATE;
436 case VBOX_E_OBJECT_IN_USE: return VERR_COM_OBJECT_IN_USE;
437
438 default:
439 if (SUCCEEDED(aComStatus))
440 return VINF_SUCCESS;
441 /** @todo Check for the win32 facility and use the
442 * RTErrConvertFromWin32 function on windows. */
443 return VERR_UNRESOLVED_ERROR;
444 }
445}
446
447
448/*static*/ HRESULT
449Global::vboxStatusCodeToCOM(int aVBoxStatus)
450{
451 switch (aVBoxStatus)
452 {
453 case VINF_SUCCESS: return S_OK;
454
455 /* Standard COM status codes. */
456 case VERR_COM_UNEXPECTED: return E_UNEXPECTED;
457 case VERR_NOT_IMPLEMENTED: return E_NOTIMPL;
458 case VERR_NO_MEMORY: return E_OUTOFMEMORY;
459 case VERR_INVALID_PARAMETER: return E_INVALIDARG;
460 case VERR_NOT_SUPPORTED: return E_NOINTERFACE;
461 case VERR_INVALID_POINTER: return E_POINTER;
462#ifdef E_HANDLE
463 case VERR_INVALID_HANDLE: return E_HANDLE;
464#endif
465 case VERR_CANCELLED: return E_ABORT;
466 case VERR_GENERAL_FAILURE: return E_FAIL;
467 case VERR_ACCESS_DENIED: return E_ACCESSDENIED;
468
469 /* VirtualBox COM status codes */
470 case VERR_COM_OBJECT_NOT_FOUND: return VBOX_E_OBJECT_NOT_FOUND;
471 case VERR_COM_INVALID_VM_STATE: return VBOX_E_INVALID_VM_STATE;
472 case VERR_COM_VM_ERROR: return VBOX_E_VM_ERROR;
473 case VERR_COM_FILE_ERROR: return VBOX_E_FILE_ERROR;
474 case VERR_COM_IPRT_ERROR: return VBOX_E_IPRT_ERROR;
475 case VERR_COM_PDM_ERROR: return VBOX_E_PDM_ERROR;
476 case VERR_COM_INVALID_OBJECT_STATE: return VBOX_E_INVALID_OBJECT_STATE;
477 case VERR_COM_HOST_ERROR: return VBOX_E_HOST_ERROR;
478 case VERR_COM_NOT_SUPPORTED: return VBOX_E_NOT_SUPPORTED;
479 case VERR_COM_XML_ERROR: return VBOX_E_XML_ERROR;
480 case VERR_COM_INVALID_SESSION_STATE: return VBOX_E_INVALID_SESSION_STATE;
481 case VERR_COM_OBJECT_IN_USE: return VBOX_E_OBJECT_IN_USE;
482
483 /* Other errors. */
484 case VERR_UNRESOLVED_ERROR: return E_FAIL;
485
486 default:
487 AssertMsgFailed(("%Rrc\n", aVBoxStatus));
488 if (RT_SUCCESS(aVBoxStatus))
489 return S_OK;
490
491 /* try categorize it */
492 if (aVBoxStatus < 0 && aVBoxStatus > -1000)
493 return VBOX_E_IPRT_ERROR;
494 if ( aVBoxStatus < VERR_PDM_NO_SUCH_LUN / 100 * 10
495 && aVBoxStatus > VERR_PDM_NO_SUCH_LUN / 100 * 10 - 100)
496 return VBOX_E_PDM_ERROR;
497 if ( aVBoxStatus <= -1000
498 && aVBoxStatus > -5000 /* wrong, but so what... */)
499 return VBOX_E_VM_ERROR;
500
501 return E_FAIL;
502 }
503}
504
505
506/* 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