VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxService/testcase/tstUserInfo.cpp@ 69496

Last change on this file since 69496 was 69496, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1/* $Id: tstUserInfo.cpp 69496 2017-10-28 14:55:58Z vboxsync $ */
2/** @file
3 * Test case for correct user environment.
4 */
5
6/*
7 * Copyright (C) 2010-2017 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
18
19/*********************************************************************************************************************************
20* Header Files *
21*********************************************************************************************************************************/
22#ifdef RT_OS_WINDOWS
23# include <iprt/win/windows.h>
24# include <iprt/win/shlobj.h>
25#endif
26
27#include <iprt/initterm.h>
28#include <iprt/path.h>
29#include <iprt/stream.h>
30#include <iprt/string.h>
31#include <VBox/log.h>
32#include <VBox/version.h>
33#include <VBox/VBoxGuestLib.h>
34
35
36int main()
37{
38 /*
39 * Init globals and such.
40 */
41 RTR3InitExeNoArguments(0);
42
43 int rc = VbglR3Init();
44 if (RT_FAILURE(rc))
45 {
46 RTPrintf("VbglR3Init failed with rc=%Rrc.\n", rc);
47 return -1;
48 }
49#ifdef RT_OS_WINDOWS
50 WCHAR wszPath[MAX_PATH];
51 HRESULT hRes = SHGetFolderPathW(0, CSIDL_APPDATA, 0, 0, wszPath);
52
53 if (SUCCEEDED(hRes))
54 {
55 RTPrintf("SHGetFolderPathW (CSIDL_APPDATA) = %ls\n", wszPath);
56 hRes = SHGetFolderPathW(0, CSIDL_PERSONAL, 0, 0, wszPath);
57 if (SUCCEEDED(hRes))
58 {
59 RTPrintf("SHGetFolderPathW (CSIDL_PERSONAL) = %ls\n", wszPath);
60 }
61 else
62 RTPrintf("SHGetFolderPathW (CSIDL_PERSONAL) returned error: 0x%x\n", hRes);
63 }
64 else
65 RTPrintf("SHGetFolderPathW (CSIDL_APPDATA) returned error: 0x%x\n", hRes);
66
67 if (FAILED(hRes))
68 rc = RTErrConvertFromWin32(hRes);
69
70 /* Dump env bits. */
71 RTPrintf("Environment:\n\n");
72 RTPrintf("APPDATA = %s\n", getenv("APPDATA"));
73#endif
74 return RT_SUCCESS(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
75}
76
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