VirtualBox

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

Last change on this file since 4725 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1/* $Id: tstLdrLoad.cpp 4071 2007-08-07 17:07:59Z vboxsync $ */
2/** @file
3 * innotek Portable Runtime Testcase - Native Loader.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19#include <iprt/ldr.h>
20#include <iprt/stream.h>
21#include <iprt/runtime.h>
22#include <iprt/err.h>
23
24int main(int argc, const char * const *argv)
25{
26 int rcRet = 0;
27 RTR3Init();
28
29 /*
30 * If no args, display usage.
31 */
32 if (argc <= 1)
33 {
34 RTPrintf("Syntax: %s [so/dll [so/dll [..]]\n", argv[0]);
35 return 1;
36 }
37
38 /*
39 * Iterate the arguments and treat all of them as so/dll paths.
40 */
41 for (int i = 1; i < argc; i++)
42 {
43 RTLDRMOD hLdrMod = (RTLDRMOD)0xbaadffaa;
44 int rc = RTLdrLoad(argv[i], &hLdrMod);
45 if (RT_SUCCESS(rc))
46 {
47 RTPrintf("tstLdrLoad: %d - %s\n", i, argv[i]);
48 rc = RTLdrClose(hLdrMod);
49 if (RT_FAILURE(rc))
50 {
51 RTPrintf("tstLdrLoad: rc=%Rrc RTLdrClose()\n", rc);
52 rcRet++;
53 }
54 }
55 else
56 {
57 RTPrintf("tstLdrLoad: rc=%Rrc RTLdrOpen('%s')\n", rc, argv[i]);
58 rcRet++;
59 }
60 }
61
62 /*
63 * Summary.
64 */
65 if (!rcRet)
66 RTPrintf("tstLdrLoad: SUCCESS\n");
67 else
68 RTPrintf("tstLdrLoad: FAILURE - %d errors\n", rcRet);
69
70 return !!rcRet;
71}
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