1 | /* $Id: tstSupVerify.cpp 69498 2017-10-28 15:07:25Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * SUP Testcase - Test SUPR3HardenedVerifyPlugIn.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2016 Oracle Corporation
|
---|
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 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 |
|
---|
28 | /*********************************************************************************************************************************
|
---|
29 | * Header Files *
|
---|
30 | *********************************************************************************************************************************/
|
---|
31 | #include <VBox/sup.h>
|
---|
32 | #include <VBox/err.h>
|
---|
33 |
|
---|
34 | #include <iprt/getopt.h>
|
---|
35 | #include <iprt/initterm.h>
|
---|
36 | #include <iprt/mem.h>
|
---|
37 | #include <iprt/message.h>
|
---|
38 | #include <iprt/path.h>
|
---|
39 | #include <iprt/stream.h>
|
---|
40 |
|
---|
41 |
|
---|
42 | int main(int argc, char **argv)
|
---|
43 | {
|
---|
44 | /*
|
---|
45 | * Init.
|
---|
46 | */
|
---|
47 | int rc = RTR3InitExe(argc, &argv, 0);
|
---|
48 | if (RT_FAILURE(rc))
|
---|
49 | return RTMsgInitFailure(rc);
|
---|
50 | rc = SUPR3HardenedVerifyInit();
|
---|
51 | if (RT_FAILURE(rc))
|
---|
52 | return RTMsgErrorExit(RTEXITCODE_FAILURE, "SUPR3HardenedVerifyInit failed: %Rrc", rc);
|
---|
53 |
|
---|
54 | /*
|
---|
55 | * Process arguments.
|
---|
56 | */
|
---|
57 | static const RTGETOPTDEF s_aOptions[] =
|
---|
58 | {
|
---|
59 | { "--dummy", 'd', RTGETOPT_REQ_NOTHING },
|
---|
60 | };
|
---|
61 |
|
---|
62 | //bool fKeepLoaded = false;
|
---|
63 |
|
---|
64 | int ch;
|
---|
65 | RTGETOPTUNION ValueUnion;
|
---|
66 | RTGETOPTSTATE GetState;
|
---|
67 | RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0);
|
---|
68 | while ((ch = RTGetOpt(&GetState, &ValueUnion)))
|
---|
69 | {
|
---|
70 | switch (ch)
|
---|
71 | {
|
---|
72 | case VINF_GETOPT_NOT_OPTION:
|
---|
73 | {
|
---|
74 | RTERRINFOSTATIC ErrInfo;
|
---|
75 | RTErrInfoInitStatic(&ErrInfo);
|
---|
76 | rc = SUPR3HardenedVerifyPlugIn(ValueUnion.psz, &ErrInfo.Core);
|
---|
77 | if (RT_SUCCESS(rc))
|
---|
78 | RTMsgInfo("SUPR3HardenedVerifyPlugIn: %Rrc for '%s'\n", rc, ValueUnion.psz);
|
---|
79 | else
|
---|
80 | RTMsgError("SUPR3HardenedVerifyPlugIn: %Rrc for '%s' ErrInfo: %s\n",
|
---|
81 | rc, ValueUnion.psz, ErrInfo.Core.pszMsg);
|
---|
82 | break;
|
---|
83 | }
|
---|
84 |
|
---|
85 | case 'h':
|
---|
86 | RTPrintf("%s [dll1 [dll2...]]\n", argv[0]);
|
---|
87 | return 1;
|
---|
88 |
|
---|
89 | case 'V':
|
---|
90 | RTPrintf("$Revision: 69498 $\n");
|
---|
91 | return 0;
|
---|
92 |
|
---|
93 | default:
|
---|
94 | return RTGetOptPrintError(ch, &ValueUnion);
|
---|
95 | }
|
---|
96 | }
|
---|
97 |
|
---|
98 | return 0;
|
---|
99 | }
|
---|
100 |
|
---|