1 | /* $Id: tstVBoxGINA.cpp 95874 2022-07-27 08:01:09Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * tstVBoxGINA.cpp - Simple testcase for invoking VBoxGINA.dll.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2022 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.alldomusa.eu.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 |
|
---|
18 | #include <iprt/win/windows.h>
|
---|
19 | #include <iprt/stream.h>
|
---|
20 |
|
---|
21 | int main()
|
---|
22 | {
|
---|
23 | DWORD dwErr;
|
---|
24 |
|
---|
25 | /*
|
---|
26 | * Be sure that:
|
---|
27 | * - the debug VBoxGINA gets loaded instead of a maybe installed
|
---|
28 | * release version in "C:\Windows\system32".
|
---|
29 | */
|
---|
30 |
|
---|
31 | HMODULE hMod = LoadLibraryW(L"VBoxGINA.dll");
|
---|
32 | if (hMod)
|
---|
33 | {
|
---|
34 | RTPrintf("VBoxGINA found\n");
|
---|
35 |
|
---|
36 | FARPROC pfnDebug = GetProcAddress(hMod, "VBoxGINADebug");
|
---|
37 | if (!pfnDebug)
|
---|
38 | {
|
---|
39 | RTPrintf("Calling VBoxGINA ...\n");
|
---|
40 | dwErr = pfnDebug();
|
---|
41 | }
|
---|
42 | else
|
---|
43 | {
|
---|
44 | dwErr = GetLastError();
|
---|
45 | RTPrintf("Could not load VBoxGINADebug, error=%u\n", dwErr);
|
---|
46 | }
|
---|
47 |
|
---|
48 | FreeLibrary(hMod);
|
---|
49 | }
|
---|
50 | else
|
---|
51 | {
|
---|
52 | dwErr = GetLastError();
|
---|
53 | RTPrintf("VBoxGINA.dll not found, error=%u\n", dwErr);
|
---|
54 | }
|
---|
55 |
|
---|
56 | RTPrintf("Test returned: %s (%u)\n", dwErr == ERROR_SUCCESS ? "SUCCESS" : "FAILURE", dwErr);
|
---|
57 | return dwErr == ERROR_SUCCESS ? 0 : 1;
|
---|
58 | }
|
---|
59 |
|
---|