VirtualBox

source: vbox/trunk/src/VBox/Runtime/testcase/tstLdrLoad.cpp@ 19897

Last change on this file since 19897 was 14831, checked in by vboxsync, 16 years ago

whole bunch: avoid runtime.h, include individual headers indead.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1/* $Id: tstLdrLoad.cpp 14831 2008-11-30 10:31:16Z vboxsync $ */
2/** @file
3 * IPRT Testcase - Native Loader.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31
32#include <iprt/ldr.h>
33#include <iprt/stream.h>
34#include <iprt/initterm.h>
35#include <iprt/err.h>
36
37int main(int argc, const char * const *argv)
38{
39 int rcRet = 0;
40 RTR3Init();
41
42 /*
43 * If no args, display usage.
44 */
45 if (argc <= 1)
46 {
47 RTPrintf("Syntax: %s [so/dll [so/dll [..]]\n", argv[0]);
48 return 1;
49 }
50
51 /*
52 * Iterate the arguments and treat all of them as so/dll paths.
53 */
54 for (int i = 1; i < argc; i++)
55 {
56 RTLDRMOD hLdrMod = (RTLDRMOD)0xbaadffaa;
57 int rc = RTLdrLoad(argv[i], &hLdrMod);
58 if (RT_SUCCESS(rc))
59 {
60 RTPrintf("tstLdrLoad: %d - %s\n", i, argv[i]);
61 rc = RTLdrClose(hLdrMod);
62 if (RT_FAILURE(rc))
63 {
64 RTPrintf("tstLdrLoad: rc=%Rrc RTLdrClose()\n", rc);
65 rcRet++;
66 }
67 }
68 else
69 {
70 RTPrintf("tstLdrLoad: rc=%Rrc RTLdrOpen('%s')\n", rc, argv[i]);
71 rcRet++;
72 }
73 }
74
75 /*
76 * Summary.
77 */
78 if (!rcRet)
79 RTPrintf("tstLdrLoad: SUCCESS\n");
80 else
81 RTPrintf("tstLdrLoad: FAILURE - %d errors\n", rcRet);
82
83 return !!rcRet;
84}
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