[11725] | 1 | /* $Id: hardenedmain.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * VirtualBox - Hardened main().
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[28800] | 7 | * Copyright (C) 2008 Oracle Corporation
|
---|
[11725] | 8 | *
|
---|
| 9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
| 10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
| 11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
| 12 | * General Public License (GPL) as published by the Free Software
|
---|
| 13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
| 14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
| 15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
[18789] | 18 | #include <string.h>
|
---|
[11725] | 19 | #include <VBox/sup.h>
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | int main(int argc, char **argv, char **envp)
|
---|
| 23 | {
|
---|
| 24 | /*
|
---|
| 25 | * First check whether we're about to start a VM.
|
---|
| 26 | */
|
---|
| 27 | uint32_t fFlags = SUPSECMAIN_FLAGS_DONT_OPEN_DEV;
|
---|
| 28 | for (int i = 1; i < argc; i++)
|
---|
[24252] | 29 | /* NOTE: the check here must match the corresponding check for the
|
---|
| 30 | * options to start a VM in main.cpp and VBoxGlobal.cpp exactly,
|
---|
| 31 | * otherwise there will be weird error messages. */
|
---|
| 32 | if ( !::strcmp(argv[i], "--startvm")
|
---|
| 33 | || !::strcmp(argv[i], "-startvm"))
|
---|
[11725] | 34 | {
|
---|
| 35 | fFlags &= ~SUPSECMAIN_FLAGS_DONT_OPEN_DEV;
|
---|
| 36 | break;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | return SUPR3HardenedMain("VirtualBox", fFlags, argc, argv, envp);
|
---|
| 40 | }
|
---|
| 41 |
|
---|