VirtualBox

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

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

Main, FE: HPET review feedback

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