VirtualBox

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

Last change on this file since 28825 was 28825, checked in by vboxsync, 15 years ago

Make SATA the default harddisk controller for Windows guests (Vista and up) and 2.6 Linux guests

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 29.9 KB
Line 
1/* $Id: Global.cpp 28825 2010-04-27 13:50:46Z 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 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_Am79C973, 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_Am79C973, 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 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 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 256, 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 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 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 256, 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 384, 12, 8 * _1K, NetworkAdapterType_Am79C973, 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 384, 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_Am79C973, 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 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 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 256, 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,
176 384, 12, 8 * _1K, NetworkAdapterType_Am79C973, 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_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
180 384, 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_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE,
185 StorageControllerType_IntelAhci, StorageBus_SATA },
186 { "Linux", "Linux", SchemaDefs_OSTypeId_Turbolinux, "Turbolinux",
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 384, 12, 8 * _1K, NetworkAdapterType_Am79C973, 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 384, 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_Am79C973, 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 384, 12, 8 * _1K, NetworkAdapterType_Am79C973, 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 384, 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_Am79C973, 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_Am79C973, 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",
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 (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_Teleporting: return "Teleporting";
336 case MachineState_LiveSnapshotting: return "LiveSnapshotting";
337 case MachineState_Paused: return "Paused";
338 case MachineState_Stuck: return "GuruMeditation";
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_RestoringSnapshot: return "RestoringSnapshot";
346 case MachineState_DeletingSnapshot: return "DeletingSnapshot";
347 case MachineState_SettingUp: return "SettingUp";
348 default:
349 {
350 AssertMsgFailed(("%d (%#x)\n", aState, aState));
351 static char s_szMsg[48];
352 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidState-0x%08x\n", aState);
353 return s_szMsg;
354 }
355 }
356}
357
358/*static*/ const char *
359Global::stringifySessionState(SessionState_T aState)
360{
361 switch (aState)
362 {
363 case SessionState_Null: return "Null";
364 case SessionState_Closed: return "Closed";
365 case SessionState_Open: return "Open";
366 case SessionState_Spawning: return "Spawning";
367 case SessionState_Closing: return "Closing";
368 default:
369 {
370 AssertMsgFailed(("%d (%#x)\n", aState, aState));
371 static char s_szMsg[48];
372 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidState-0x%08x\n", aState);
373 return s_szMsg;
374 }
375 }
376}
377
378/*static*/ const char *
379Global::stringifyDeviceType(DeviceType_T aType)
380{
381 switch (aType)
382 {
383 case DeviceType_Null: return "Null";
384 case DeviceType_Floppy: return "Floppy";
385 case DeviceType_DVD: return "DVD";
386 case DeviceType_HardDisk: return "HardDisk";
387 case DeviceType_Network: return "Network";
388 case DeviceType_USB: return "USB";
389 case DeviceType_SharedFolder: return "ShardFolder";
390 default:
391 {
392 AssertMsgFailed(("%d (%#x)\n", aType, aType));
393 static char s_szMsg[48];
394 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidType-0x%08x\n", aType);
395 return s_szMsg;
396 }
397 }
398}
399
400/*static*/ int
401Global::vboxStatusCodeFromCOM(HRESULT aComStatus)
402{
403 switch (aComStatus)
404 {
405 case S_OK: return VINF_SUCCESS;
406 case E_FAIL: return VERR_GENERAL_FAILURE;
407 case E_INVALIDARG: return VERR_INVALID_PARAMETER;
408 case E_POINTER: return VERR_INVALID_POINTER;
409
410 case VBOX_E_OBJECT_NOT_FOUND: return VERR_COM_OBJECT_NOT_FOUND;
411 case VBOX_E_INVALID_VM_STATE: return VERR_COM_INVALID_VM_STATE;
412 case VBOX_E_VM_ERROR: return VERR_COM_VM_ERROR;
413 case VBOX_E_FILE_ERROR: return VERR_COM_FILE_ERROR;
414 case VBOX_E_IPRT_ERROR: return VERR_COM_IPRT_ERROR;
415 case VBOX_E_PDM_ERROR: return VERR_COM_PDM_ERROR;
416 case VBOX_E_INVALID_OBJECT_STATE: return VERR_COM_INVALID_OBJECT_STATE;
417 case VBOX_E_HOST_ERROR: return VERR_COM_HOST_ERROR;
418 case VBOX_E_NOT_SUPPORTED: return VERR_COM_NOT_SUPPORTED;
419 case VBOX_E_XML_ERROR: return VERR_COM_XML_ERROR;
420 case VBOX_E_INVALID_SESSION_STATE: return VERR_COM_INVALID_SESSION_STATE;
421 case VBOX_E_OBJECT_IN_USE: return VERR_COM_OBJECT_IN_USE;
422
423 default:
424 if (SUCCEEDED(aComStatus))
425 return VINF_SUCCESS;
426 return VERR_UNRESOLVED_ERROR;
427 }
428}
429
430
431/*static*/ HRESULT
432Global::vboxStatusCodeToCOM(int aVBoxStatus)
433{
434 switch (aVBoxStatus)
435 {
436 case VINF_SUCCESS: return S_OK;
437 case VERR_GENERAL_FAILURE: return E_FAIL;
438 case VERR_UNRESOLVED_ERROR: return E_FAIL;
439 case VERR_INVALID_PARAMETER: return E_INVALIDARG;
440 case VERR_INVALID_POINTER: return E_POINTER;
441
442 case VERR_COM_OBJECT_NOT_FOUND: return VBOX_E_OBJECT_NOT_FOUND;
443 case VERR_COM_INVALID_VM_STATE: return VBOX_E_INVALID_VM_STATE;
444 case VERR_COM_VM_ERROR: return VBOX_E_VM_ERROR;
445 case VERR_COM_FILE_ERROR: return VBOX_E_FILE_ERROR;
446 case VERR_COM_IPRT_ERROR: return VBOX_E_IPRT_ERROR;
447 case VERR_COM_PDM_ERROR: return VBOX_E_PDM_ERROR;
448 case VERR_COM_INVALID_OBJECT_STATE: return VBOX_E_INVALID_OBJECT_STATE;
449 case VERR_COM_HOST_ERROR: return VBOX_E_HOST_ERROR;
450 case VERR_COM_NOT_SUPPORTED: return VBOX_E_NOT_SUPPORTED;
451 case VERR_COM_XML_ERROR: return VBOX_E_XML_ERROR;
452 case VERR_COM_INVALID_SESSION_STATE: return VBOX_E_INVALID_SESSION_STATE;
453 case VERR_COM_OBJECT_IN_USE: return VBOX_E_OBJECT_IN_USE;
454
455 default:
456 AssertMsgFailed(("%Rrc\n", aVBoxStatus));
457 if (RT_SUCCESS(aVBoxStatus))
458 return S_OK;
459
460 /* try categorize it */
461 if (aVBoxStatus < 0 && aVBoxStatus > -1000)
462 return VBOX_E_IPRT_ERROR;
463 if ( aVBoxStatus < VERR_PDM_NO_SUCH_LUN / 100 * 10
464 && aVBoxStatus > VERR_PDM_NO_SUCH_LUN / 100 * 10 - 100)
465 return VBOX_E_PDM_ERROR;
466 if ( aVBoxStatus <= -1000
467 && aVBoxStatus > -5000 /* wrong, but so what... */)
468 return VBOX_E_VM_ERROR;
469
470 return E_FAIL;
471 }
472}
473
474
475/* 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