VirtualBox

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

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

Main and FE/Qt: enable the USB tablet device by default for most Linux guests

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 25.3 KB
Line 
1/* $Id: Global.cpp 28227 2010-04-12 22:01:19Z 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 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
22 * Clara, CA 95054 USA or visit http://www.sun.com if you need
23 * additional information or have any questions.
24 */
25
26#include "Global.h"
27
28#include <iprt/assert.h>
29#include <iprt/string.h>
30#include <VBox/err.h>
31
32/* static */
33const Global::OSType Global::sOSTypes[SchemaDefs::OSTypeId_COUNT] =
34{
35 /* NOTE1: we assume that unknown is always the first entry!
36 * NOTE2: please use powers of 2 when specifying the size of harddisks since
37 * '2GB' looks better than '1.95GB' (= 2000MB) */
38 { "Other", "Other", SchemaDefs_OSTypeId_Other, "Other/Unknown",
39 VBOXOSTYPE_Unknown, VBOXOSHINT_NONE,
40 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
41 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows31, "Windows 3.1",
42 VBOXOSTYPE_Win31, VBOXOSHINT_NONE,
43 32, 4, 1 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
44 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows95, "Windows 95",
45 VBOXOSTYPE_Win95, VBOXOSHINT_NONE,
46 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
47 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows98, "Windows 98",
48 VBOXOSTYPE_Win98, VBOXOSHINT_NONE,
49 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
50 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsMe, "Windows Me",
51 VBOXOSTYPE_WinMe, VBOXOSHINT_NONE,
52 64, 4, 4 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
53 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsNT4, "Windows NT 4",
54 VBOXOSTYPE_WinNT4, VBOXOSHINT_NONE,
55 128, 16, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
56 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows2000, "Windows 2000",
57 VBOXOSTYPE_Win2k, VBOXOSHINT_NONE,
58 168, 16, 4 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
59 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsXP, "Windows XP",
60 VBOXOSTYPE_WinXP, VBOXOSHINT_NONE,
61 192, 16, 10 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
62 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsXP_64, "Windows XP (64 bit)",
63 VBOXOSTYPE_WinXP_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
64 192, 16, 10 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
65 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows2003, "Windows 2003",
66 VBOXOSTYPE_Win2k3, VBOXOSHINT_NONE,
67 256, 16, 20 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
68 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows2003_64, "Windows 2003 (64 bit)",
69 VBOXOSTYPE_Win2k3_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
70 256, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
71 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsVista, "Windows Vista",
72 VBOXOSTYPE_WinVista, VBOXOSHINT_NONE,
73 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
74 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsVista_64, "Windows Vista (64 bit)",
75 VBOXOSTYPE_WinVista_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
76 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
77 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows2008, "Windows 2008",
78 VBOXOSTYPE_Win2k8, VBOXOSHINT_NONE,
79 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
80 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows2008_64, "Windows 2008 (64 bit)",
81 VBOXOSTYPE_Win2k8_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
82 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
83 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows7, "Windows 7",
84 VBOXOSTYPE_Win7, VBOXOSHINT_NONE,
85 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
86 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_Windows7_64, "Windows 7 (64 bit)",
87 VBOXOSTYPE_Win7_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
88 512, 16, 20 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
89 { "Windows", "Microsoft Windows", SchemaDefs_OSTypeId_WindowsNT, "Other Windows",
90 VBOXOSTYPE_WinNT, VBOXOSHINT_NONE,
91 512, 16, 20 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
92 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux22, "Linux 2.2",
93 VBOXOSTYPE_Linux22, VBOXOSHINT_RTCUTC,
94 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
95 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux24, "Linux 2.4",
96 VBOXOSTYPE_Linux24, VBOXOSHINT_RTCUTC,
97 128, 4, 4 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
98 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux24_64, "Linux 2.4 (64 bit)",
99 VBOXOSTYPE_Linux24_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
100 128, 4, 4 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
101 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux26, "Linux 2.6",
102 VBOXOSTYPE_Linux26, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
103 256, 4, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
104 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux26_64, "Linux 2.6 (64 bit)",
105 VBOXOSTYPE_Linux26_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
106 256, 4, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
107 { "Linux", "Linux", SchemaDefs_OSTypeId_ArchLinux, "Arch Linux",
108 VBOXOSTYPE_ArchLinux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
109 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
110 { "Linux", "Linux", SchemaDefs_OSTypeId_ArchLinux_64, "Arch Linux (64 bit)",
111 VBOXOSTYPE_ArchLinux_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
112 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
113 { "Linux", "Linux", SchemaDefs_OSTypeId_Debian, "Debian",
114 VBOXOSTYPE_Debian, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
115 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
116 { "Linux", "Linux", SchemaDefs_OSTypeId_Debian_64, "Debian (64 bit)",
117 VBOXOSTYPE_Debian_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
118 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
119 { "Linux", "Linux", SchemaDefs_OSTypeId_OpenSUSE, "openSUSE",
120 VBOXOSTYPE_OpenSUSE, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
121 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
122 { "Linux", "Linux", SchemaDefs_OSTypeId_OpenSUSE_64, "openSUSE (64 bit)",
123 VBOXOSTYPE_OpenSUSE_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
124 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
125 { "Linux", "Linux", SchemaDefs_OSTypeId_Fedora, "Fedora",
126 VBOXOSTYPE_FedoraCore, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
127 384, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
128 { "Linux", "Linux", SchemaDefs_OSTypeId_Fedora_64, "Fedora (64 bit)",
129 VBOXOSTYPE_FedoraCore_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
130 384, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
131 { "Linux", "Linux", SchemaDefs_OSTypeId_Gentoo, "Gentoo",
132 VBOXOSTYPE_Gentoo, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
133 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
134 { "Linux", "Linux", SchemaDefs_OSTypeId_Gentoo_64, "Gentoo (64 bit)",
135 VBOXOSTYPE_Gentoo_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
136 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
137 { "Linux", "Linux", SchemaDefs_OSTypeId_Mandriva, "Mandriva",
138 VBOXOSTYPE_Mandriva, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
139 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
140 { "Linux", "Linux", SchemaDefs_OSTypeId_Mandriva_64, "Mandriva (64 bit)",
141 VBOXOSTYPE_Mandriva_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
142 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
143 { "Linux", "Linux", SchemaDefs_OSTypeId_RedHat, "Red Hat",
144 VBOXOSTYPE_RedHat, VBOXOSHINT_RTCUTC,
145 384, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
146 { "Linux", "Linux", SchemaDefs_OSTypeId_RedHat_64, "Red Hat (64 bit)",
147 VBOXOSTYPE_RedHat_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
148 384, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
149 { "Linux", "Linux", SchemaDefs_OSTypeId_Turbolinux, "Turbolinux",
150 VBOXOSTYPE_Turbolinux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
151 384, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
152 { "Linux", "Linux", SchemaDefs_OSTypeId_Turbolinux, "Turbolinux",
153 VBOXOSTYPE_Turbolinux_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
154 384, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
155 { "Linux", "Linux", SchemaDefs_OSTypeId_Ubuntu, "Ubuntu",
156 VBOXOSTYPE_Ubuntu, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
157 384, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
158 { "Linux", "Linux", SchemaDefs_OSTypeId_Ubuntu_64, "Ubuntu (64 bit)",
159 VBOXOSTYPE_Ubuntu_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
160 384, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
161 { "Linux", "Linux", SchemaDefs_OSTypeId_Xandros, "Xandros",
162 VBOXOSTYPE_Xandros, VBOXOSHINT_RTCUTC,
163 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
164 { "Linux", "Linux", SchemaDefs_OSTypeId_Xandros_64, "Xandros (64 bit)",
165 VBOXOSTYPE_Xandros_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
166 256, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
167 { "Linux", "Linux", SchemaDefs_OSTypeId_Oracle, "Oracle",
168 VBOXOSTYPE_Oracle, VBOXOSHINT_RTCUTC,
169 384, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
170 { "Linux", "Linux", SchemaDefs_OSTypeId_Oracle_64, "Oracle (64 bit)",
171 VBOXOSTYPE_Oracle_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
172 384, 12, 8 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
173 { "Linux", "Linux", SchemaDefs_OSTypeId_Linux, "Other Linux",
174 VBOXOSTYPE_Linux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
175 256, 12, 8 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
176 { "Solaris", "Solaris", SchemaDefs_OSTypeId_Solaris, "Solaris",
177 VBOXOSTYPE_Solaris, VBOXOSHINT_NONE,
178 768, 12, 16 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
179 { "Solaris", "Solaris", SchemaDefs_OSTypeId_Solaris_64, "Solaris (64 bit)",
180 VBOXOSTYPE_Solaris_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
181 768, 12, 16 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
182 { "Solaris", "Solaris", SchemaDefs_OSTypeId_OpenSolaris, "OpenSolaris",
183 VBOXOSTYPE_OpenSolaris, VBOXOSHINT_NONE,
184 768, 12, 16 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
185 { "Solaris", "Solaris", SchemaDefs_OSTypeId_OpenSolaris_64, "OpenSolaris (64 bit)",
186 VBOXOSTYPE_OpenSolaris_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
187 768, 12, 16 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
188 { "BSD", "BSD", SchemaDefs_OSTypeId_FreeBSD, "FreeBSD",
189 VBOXOSTYPE_FreeBSD, VBOXOSHINT_NONE,
190 128, 4, 2 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
191 { "BSD", "BSD", SchemaDefs_OSTypeId_FreeBSD_64, "FreeBSD (64 bit)",
192 VBOXOSTYPE_FreeBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
193 128, 4, 2 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
194 { "BSD", "BSD", SchemaDefs_OSTypeId_OpenBSD, "OpenBSD",
195 VBOXOSTYPE_OpenBSD, VBOXOSHINT_HWVIRTEX,
196 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
197 { "BSD", "BSD", SchemaDefs_OSTypeId_OpenBSD_64, "OpenBSD (64 bit)",
198 VBOXOSTYPE_OpenBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
199 64, 4, 2 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
200 { "BSD", "BSD", SchemaDefs_OSTypeId_NetBSD, "NetBSD",
201 VBOXOSTYPE_NetBSD, VBOXOSHINT_NONE,
202 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
203 { "BSD", "BSD", SchemaDefs_OSTypeId_NetBSD_64, "NetBSD (64 bit)",
204 VBOXOSTYPE_NetBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC,
205 64, 4, 2 * _1K, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4 },
206 { "OS2", "IBM OS/2", SchemaDefs_OSTypeId_OS2Warp3, "OS/2 Warp 3",
207 VBOXOSTYPE_OS2Warp3, VBOXOSHINT_HWVIRTEX,
208 48, 4, 1 * _1K, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4 },
209 { "OS2", "IBM OS/2", SchemaDefs_OSTypeId_OS2Warp4, "OS/2 Warp 4",
210 VBOXOSTYPE_OS2Warp4, VBOXOSHINT_HWVIRTEX,
211 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4 },
212 { "OS2", "IBM OS/2", SchemaDefs_OSTypeId_OS2Warp45, "OS/2 Warp 4.5",
213 VBOXOSTYPE_OS2Warp45, VBOXOSHINT_HWVIRTEX,
214 96, 4, 2 * _1K, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4 },
215 { "OS2", "IBM OS/2", SchemaDefs_OSTypeId_OS2eCS, "eComStation",
216 VBOXOSTYPE_ECS, VBOXOSHINT_HWVIRTEX,
217 96, 4, 2 * _1K, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4 },
218 { "OS2", "IBM OS/2", SchemaDefs_OSTypeId_OS2, "Other OS/2",
219 VBOXOSTYPE_OS2, VBOXOSHINT_HWVIRTEX,
220 96, 4, 2 * _1K, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4 },
221 { "MacOS", "Mac OS X", SchemaDefs_OSTypeId_MacOS, "Mac OS X",
222 VBOXOSTYPE_MacOS, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_USBTABLET,
223 1024, 4, 20 * _1K, NetworkAdapterType_I82543GC, 0, StorageControllerType_ICH6 },
224 { "MacOS", "Mac OS X", SchemaDefs_OSTypeId_MacOS_64, "Mac OS X (64 bit)",
225 VBOXOSTYPE_MacOS_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_USBTABLET,
226 1024, 4, 20 * _1K, NetworkAdapterType_I82543GC, 0, StorageControllerType_ICH6 },
227 { "Other", "Other", SchemaDefs_OSTypeId_DOS, "DOS",
228 VBOXOSTYPE_DOS, VBOXOSHINT_NONE,
229 32, 4, 512, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
230 { "Other", "Other", SchemaDefs_OSTypeId_Netware, "Netware",
231 VBOXOSTYPE_Netware, VBOXOSHINT_HWVIRTEX,
232 512, 4, 4 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
233 { "Other", "Other", SchemaDefs_OSTypeId_L4, "L4",
234 VBOXOSTYPE_L4, VBOXOSHINT_NONE,
235 64, 4, 2 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
236 { "Other", "Other", SchemaDefs_OSTypeId_QNX, "QNX",
237 VBOXOSTYPE_QNX, VBOXOSHINT_HWVIRTEX,
238 512, 4, 4 * _1K, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4 },
239};
240
241/**
242 * Returns an OS Type ID for the given VBOXOSTYPE value.
243 *
244 * The returned ID will correspond to the IGuestOSType::id value of one of the
245 * objects stored in the IVirtualBox::guestOSTypes
246 * (VirtualBoxImpl::COMGETTER(GuestOSTypes)) collection.
247 */
248/* static */
249const char *Global::OSTypeId(VBOXOSTYPE aOSType)
250{
251 for (size_t i = 0; i < RT_ELEMENTS(sOSTypes); ++i)
252 {
253 if (sOSTypes[i].osType == aOSType)
254 return sOSTypes[i].id;
255 }
256
257 AssertMsgFailed(("No record for VBOXOSTYPE %d\n", aOSType));
258 return sOSTypes[0].id;
259}
260
261/*static*/ const char *
262Global::stringifyMachineState(MachineState_T aState)
263{
264 switch (aState)
265 {
266 case MachineState_Null: return "Null";
267 case MachineState_PoweredOff: return "PoweredOff";
268 case MachineState_Saved: return "Saved";
269 case MachineState_Teleported: return "Teleported";
270 case MachineState_Aborted: return "Aborted";
271 case MachineState_Running: return "Running";
272 case MachineState_Teleporting: return "Teleporting";
273 case MachineState_LiveSnapshotting: return "LiveSnapshotting";
274 case MachineState_Paused: return "Paused";
275 case MachineState_Stuck: return "GuruMeditation";
276 case MachineState_Starting: return "Starting";
277 case MachineState_Stopping: return "Stopping";
278 case MachineState_Saving: return "Saving";
279 case MachineState_Restoring: return "Restoring";
280 case MachineState_TeleportingPausedVM: return "TeleportingPausedVM";
281 case MachineState_TeleportingIn: return "TeleportingIn";
282 case MachineState_RestoringSnapshot: return "RestoringSnapshot";
283 case MachineState_DeletingSnapshot: return "DeletingSnapshot";
284 case MachineState_SettingUp: return "SettingUp";
285 default:
286 {
287 AssertMsgFailed(("%d (%#x)\n", aState, aState));
288 static char s_szMsg[48];
289 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidState-0x%08x\n", aState);
290 return s_szMsg;
291 }
292 }
293}
294
295/*static*/ const char *
296Global::stringifySessionState(SessionState_T aState)
297{
298 switch (aState)
299 {
300 case SessionState_Null: return "Null";
301 case SessionState_Closed: return "Closed";
302 case SessionState_Open: return "Open";
303 case SessionState_Spawning: return "Spawning";
304 case SessionState_Closing: return "Closing";
305 default:
306 {
307 AssertMsgFailed(("%d (%#x)\n", aState, aState));
308 static char s_szMsg[48];
309 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidState-0x%08x\n", aState);
310 return s_szMsg;
311 }
312 }
313}
314
315/*static*/ const char *
316Global::stringifyDeviceType(DeviceType_T aType)
317{
318 switch (aType)
319 {
320 case DeviceType_Null: return "Null";
321 case DeviceType_Floppy: return "Floppy";
322 case DeviceType_DVD: return "DVD";
323 case DeviceType_HardDisk: return "HardDisk";
324 case DeviceType_Network: return "Network";
325 case DeviceType_USB: return "USB";
326 case DeviceType_SharedFolder: return "ShardFolder";
327 default:
328 {
329 AssertMsgFailed(("%d (%#x)\n", aType, aType));
330 static char s_szMsg[48];
331 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidType-0x%08x\n", aType);
332 return s_szMsg;
333 }
334 }
335}
336
337/*static*/ int
338Global::vboxStatusCodeFromCOM(HRESULT aComStatus)
339{
340 switch (aComStatus)
341 {
342 case S_OK: return VINF_SUCCESS;
343 case E_FAIL: return VERR_GENERAL_FAILURE;
344 case E_INVALIDARG: return VERR_INVALID_PARAMETER;
345 case E_POINTER: return VERR_INVALID_POINTER;
346
347 case VBOX_E_OBJECT_NOT_FOUND: return VERR_COM_OBJECT_NOT_FOUND;
348 case VBOX_E_INVALID_VM_STATE: return VERR_COM_INVALID_VM_STATE;
349 case VBOX_E_VM_ERROR: return VERR_COM_VM_ERROR;
350 case VBOX_E_FILE_ERROR: return VERR_COM_FILE_ERROR;
351 case VBOX_E_IPRT_ERROR: return VERR_COM_IPRT_ERROR;
352 case VBOX_E_PDM_ERROR: return VERR_COM_PDM_ERROR;
353 case VBOX_E_INVALID_OBJECT_STATE: return VERR_COM_INVALID_OBJECT_STATE;
354 case VBOX_E_HOST_ERROR: return VERR_COM_HOST_ERROR;
355 case VBOX_E_NOT_SUPPORTED: return VERR_COM_NOT_SUPPORTED;
356 case VBOX_E_XML_ERROR: return VERR_COM_XML_ERROR;
357 case VBOX_E_INVALID_SESSION_STATE: return VERR_COM_INVALID_SESSION_STATE;
358 case VBOX_E_OBJECT_IN_USE: return VERR_COM_OBJECT_IN_USE;
359
360 default:
361 if (SUCCEEDED(aComStatus))
362 return VINF_SUCCESS;
363 return VERR_UNRESOLVED_ERROR;
364 }
365}
366
367
368/*static*/ HRESULT
369Global::vboxStatusCodeToCOM(int aVBoxStatus)
370{
371 switch (aVBoxStatus)
372 {
373 case VINF_SUCCESS: return S_OK;
374 case VERR_GENERAL_FAILURE: return E_FAIL;
375 case VERR_UNRESOLVED_ERROR: return E_FAIL;
376 case VERR_INVALID_PARAMETER: return E_INVALIDARG;
377 case VERR_INVALID_POINTER: return E_POINTER;
378
379 case VERR_COM_OBJECT_NOT_FOUND: return VBOX_E_OBJECT_NOT_FOUND;
380 case VERR_COM_INVALID_VM_STATE: return VBOX_E_INVALID_VM_STATE;
381 case VERR_COM_VM_ERROR: return VBOX_E_VM_ERROR;
382 case VERR_COM_FILE_ERROR: return VBOX_E_FILE_ERROR;
383 case VERR_COM_IPRT_ERROR: return VBOX_E_IPRT_ERROR;
384 case VERR_COM_PDM_ERROR: return VBOX_E_PDM_ERROR;
385 case VERR_COM_INVALID_OBJECT_STATE: return VBOX_E_INVALID_OBJECT_STATE;
386 case VERR_COM_HOST_ERROR: return VBOX_E_HOST_ERROR;
387 case VERR_COM_NOT_SUPPORTED: return VBOX_E_NOT_SUPPORTED;
388 case VERR_COM_XML_ERROR: return VBOX_E_XML_ERROR;
389 case VERR_COM_INVALID_SESSION_STATE: return VBOX_E_INVALID_SESSION_STATE;
390 case VERR_COM_OBJECT_IN_USE: return VBOX_E_OBJECT_IN_USE;
391
392 default:
393 AssertMsgFailed(("%Rrc\n", aVBoxStatus));
394 if (RT_SUCCESS(aVBoxStatus))
395 return S_OK;
396
397 /* try categorize it */
398 if (aVBoxStatus < 0 && aVBoxStatus > -1000)
399 return VBOX_E_IPRT_ERROR;
400 if ( aVBoxStatus < VERR_PDM_NO_SUCH_LUN / 100 * 10
401 && aVBoxStatus > VERR_PDM_NO_SUCH_LUN / 100 * 10 - 100)
402 return VBOX_E_PDM_ERROR;
403 if ( aVBoxStatus <= -1000
404 && aVBoxStatus > -5000 /* wrong, but so what... */)
405 return VBOX_E_VM_ERROR;
406
407 return E_FAIL;
408 }
409}
410
411
412/* 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