VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProvUtils.cpp@ 104124

Last change on this file since 104124 was 98103, checked in by vboxsync, 22 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/* $Id: VBoxCredProvUtils.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBoxCredProvUtils - Misc. utility functions for VBoxCredProv.
4 */
5
6/*
7 * Copyright (C) 2012-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#include <iprt/win/windows.h>
33
34#include <iprt/string.h>
35#include <VBox/log.h>
36#ifdef LOG_ENABLED
37# include <iprt/stream.h>
38#endif
39#include <VBox/VBoxGuestLib.h>
40
41
42/*********************************************************************************************************************************
43* Global Variables *
44*********************************************************************************************************************************/
45/** Verbosity flag for guest logging. */
46DWORD g_dwVerbosity = 0;
47
48
49/**
50 * Displays a verbose message.
51 *
52 * @param dwLevel Minimum log level required to display this message.
53 * @param pszFormat The message text.
54 * @param ... Format arguments.
55 */
56void VBoxCredProvVerbose(DWORD dwLevel, const char *pszFormat, ...)
57{
58 if (dwLevel <= g_dwVerbosity)
59 {
60 va_list args;
61 va_start(args, pszFormat);
62 char *psz = NULL;
63 RTStrAPrintfV(&psz, pszFormat, args);
64 va_end(args);
65
66 AssertPtr(psz);
67 LogRel(("%s", psz));
68
69#ifdef LOG_ENABLED
70 PRTSTREAM pStream;
71 int rc2 = RTStrmOpen("C:\\VBoxCredProvLog.txt", "a", &pStream);
72 if (RT_SUCCESS(rc2))
73 {
74 RTStrmPrintf(pStream, "%s", psz);
75 RTStrmClose(pStream);
76 }
77#endif
78 RTStrFree(psz);
79 }
80}
81
82
83/**
84 * Reports VBoxGINA's status to the host (treated as a guest facility).
85 *
86 * @return IPRT status code.
87 * @param enmStatus Status to report to the host.
88 */
89int VBoxCredProvReportStatus(VBoxGuestFacilityStatus enmStatus)
90{
91 VBoxCredProvVerbose(0, "VBoxCredProv: reporting status %d\n", enmStatus);
92
93 int rc = VbglR3AutoLogonReportStatus(enmStatus);
94 if (RT_FAILURE(rc))
95 VBoxCredProvVerbose(0, "VBoxCredProv: failed to report status %d, rc=%Rrc\n", enmStatus, rc);
96 return rc;
97}
98
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