VirtualBox

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

Last change on this file since 9380 was 9360, checked in by vboxsync, 17 years ago

Main: Return the correct value for IGuest::OSTypeId as reported by the guest additions when they are active (fixes #1761#c77).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 5.4 KB
Line 
1/* $Id: Global.cpp 9360 2008-06-03 17:10:09Z 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
30/* static */
31const Global::OSType Global::sOSTypes [SchemaDefs::OSTypeId_COUNT] =
32{
33 /* NOTE1: we assume that unknown is always the first entry!
34 * NOTE2: please use powers of 2 when specifying the size of harddisks since
35 * '2GB' looks better than '1.95GB' (= 2000MB) */
36 { SchemaDefs_OSTypeId_unknown, "Other/Unknown", VBOXOSTYPE_Unknown, 64, 4, 2 * _1K },
37 { SchemaDefs_OSTypeId_dos, "DOS", VBOXOSTYPE_DOS, 32, 4, 512 },
38 { SchemaDefs_OSTypeId_win31, "Windows 3.1", VBOXOSTYPE_Win31, 32, 4, 1 * _1K },
39 { SchemaDefs_OSTypeId_win95, "Windows 95", VBOXOSTYPE_Win95, 64, 4, 2 * _1K },
40 { SchemaDefs_OSTypeId_win98, "Windows 98", VBOXOSTYPE_Win98, 64, 4, 2 * _1K },
41 { SchemaDefs_OSTypeId_winme, "Windows Me", VBOXOSTYPE_WinMe, 64, 4, 4 * _1K },
42 { SchemaDefs_OSTypeId_winnt4, "Windows NT 4", VBOXOSTYPE_WinNT4, 128, 4, 2 * _1K },
43 { SchemaDefs_OSTypeId_win2k, "Windows 2000", VBOXOSTYPE_Win2k, 168, 12, 4 * _1K },
44 { SchemaDefs_OSTypeId_winxp, "Windows XP", VBOXOSTYPE_WinXP, 192, 12, 10 * _1K },
45 { SchemaDefs_OSTypeId_win2k3, "Windows Server 2003", VBOXOSTYPE_Win2k3, 256, 12, 20 * _1K },
46 { SchemaDefs_OSTypeId_winvista, "Windows Vista", VBOXOSTYPE_WinVista, 512, 12, 20 * _1K },
47 { SchemaDefs_OSTypeId_win2k8, "Windows Server 2008", VBOXOSTYPE_Win2k8, 256, 12, 20 * _1K },
48 { SchemaDefs_OSTypeId_os2warp3, "OS/2 Warp 3", VBOXOSTYPE_OS2Warp3, 48, 4, 1 * _1K },
49 { SchemaDefs_OSTypeId_os2warp4, "OS/2 Warp 4", VBOXOSTYPE_OS2Warp4, 64, 4, 2 * _1K },
50 { SchemaDefs_OSTypeId_os2warp45, "OS/2 Warp 4.5", VBOXOSTYPE_OS2Warp45, 96, 4, 2 * _1K },
51 { SchemaDefs_OSTypeId_ecs, "eComStation", VBOXOSTYPE_ECS, 96, 4, 2 * _1K },
52 { SchemaDefs_OSTypeId_linux22, "Linux 2.2", VBOXOSTYPE_Linux22, 64, 4, 2 * _1K },
53 { SchemaDefs_OSTypeId_linux24, "Linux 2.4", VBOXOSTYPE_Linux24, 128, 4, 4 * _1K },
54 { SchemaDefs_OSTypeId_linux26, "Linux 2.6", VBOXOSTYPE_Linux26, 256, 4, 8 * _1K },
55 { SchemaDefs_OSTypeId_archlinux, "Arch Linux", VBOXOSTYPE_ArchLinux, 256, 12, 8 * _1K },
56 { SchemaDefs_OSTypeId_debian, "Debian", VBOXOSTYPE_Debian, 256, 12, 8 * _1K },
57 { SchemaDefs_OSTypeId_opensuse, "openSUSE", VBOXOSTYPE_OpenSUSE, 256, 12, 8 * _1K },
58 { SchemaDefs_OSTypeId_fedoracore, "Fedora", VBOXOSTYPE_FedoraCore, 256, 12, 8 * _1K },
59 { SchemaDefs_OSTypeId_gentoo, "Gentoo Linux", VBOXOSTYPE_Gentoo, 256, 12, 8 * _1K },
60 { SchemaDefs_OSTypeId_mandriva, "Mandriva", VBOXOSTYPE_Mandriva, 256, 12, 8 * _1K },
61 { SchemaDefs_OSTypeId_redhat, "Red Hat", VBOXOSTYPE_RedHat, 256, 12, 8 * _1K },
62 { SchemaDefs_OSTypeId_ubuntu, "Ubuntu", VBOXOSTYPE_Ubuntu, 256, 12, 8 * _1K },
63 { SchemaDefs_OSTypeId_xandros, "Xandros", VBOXOSTYPE_Xandros, 256, 12, 8 * _1K },
64 { SchemaDefs_OSTypeId_freebsd, "FreeBSD", VBOXOSTYPE_FreeBSD, 64, 4, 2 * _1K },
65 { SchemaDefs_OSTypeId_openbsd, "OpenBSD", VBOXOSTYPE_OpenBSD, 64, 4, 2 * _1K },
66 { SchemaDefs_OSTypeId_netbsd, "NetBSD", VBOXOSTYPE_NetBSD, 64, 4, 2 * _1K },
67 { SchemaDefs_OSTypeId_netware, "Netware", VBOXOSTYPE_Netware, 128, 4, 4 * _1K },
68 { SchemaDefs_OSTypeId_solaris, "Solaris", VBOXOSTYPE_Solaris, 512, 12, 16 * _1K },
69 { SchemaDefs_OSTypeId_opensolaris, "OpenSolaris", VBOXOSTYPE_OpenSolaris, 512, 12, 16 * _1K },
70 { SchemaDefs_OSTypeId_l4, "L4", VBOXOSTYPE_L4, 64, 4, 2 * _1K }
71};
72
73/**
74 * Returns an OS Type ID for the given VBOXOSTYPE value.
75 *
76 * The returned ID will correspond to the IGuestOSType::id value of one of the
77 * objects stored in the IVirtualBox::guestOSTypes
78 * (VirtualBoxImpl::COMGETTER(GuestOSTypes)) collection.
79 */
80/* static */
81const char *Global::OSTypeId (VBOXOSTYPE aOSType)
82{
83 for (size_t i = 0; i < RT_ELEMENTS (sOSTypes); ++ i)
84 {
85 if (sOSTypes [i].osType == aOSType)
86 return sOSTypes [i].id;
87 }
88
89 AssertMsgFailed (("No record for VBOXOSTYPE %d\n", aOSType));
90 return sOSTypes [0].id;
91}
92
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