VirtualBox

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

Last change on this file since 94377 was 93115, checked in by vboxsync, 3 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.9 KB
Line 
1/* $Id: VBoxCredProvUtils.cpp 93115 2022-01-01 11:31:46Z vboxsync $ */
2/** @file
3 * VBoxCredProvUtils - Misc. utility functions for VBoxCredProv.
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.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#include <iprt/win/windows.h>
23
24#include <iprt/string.h>
25#include <VBox/log.h>
26#ifdef LOG_ENABLED
27# include <iprt/stream.h>
28#endif
29#include <VBox/VBoxGuestLib.h>
30
31
32/*********************************************************************************************************************************
33* Global Variables *
34*********************************************************************************************************************************/
35/** Verbosity flag for guest logging. */
36DWORD g_dwVerbosity = 0;
37
38
39/**
40 * Displays a verbose message.
41 *
42 * @param dwLevel Minimum log level required to display this message.
43 * @param pszFormat The message text.
44 * @param ... Format arguments.
45 */
46void VBoxCredProvVerbose(DWORD dwLevel, const char *pszFormat, ...)
47{
48 if (dwLevel <= g_dwVerbosity)
49 {
50 va_list args;
51 va_start(args, pszFormat);
52 char *psz = NULL;
53 RTStrAPrintfV(&psz, pszFormat, args);
54 va_end(args);
55
56 AssertPtr(psz);
57 LogRel(("%s", psz));
58
59#ifdef LOG_ENABLED
60 PRTSTREAM pStream;
61 int rc2 = RTStrmOpen("C:\\VBoxCredProvLog.txt", "a", &pStream);
62 if (RT_SUCCESS(rc2))
63 {
64 RTStrmPrintf(pStream, "%s", psz);
65 RTStrmClose(pStream);
66 }
67#endif
68 RTStrFree(psz);
69 }
70}
71
72
73/**
74 * Reports VBoxGINA's status to the host (treated as a guest facility).
75 *
76 * @return IPRT status code.
77 * @param enmStatus Status to report to the host.
78 */
79int VBoxCredProvReportStatus(VBoxGuestFacilityStatus enmStatus)
80{
81 VBoxCredProvVerbose(0, "VBoxCredProv: reporting status %d\n", enmStatus);
82
83 int rc = VbglR3AutoLogonReportStatus(enmStatus);
84 if (RT_FAILURE(rc))
85 VBoxCredProvVerbose(0, "VBoxCredProv: failed to report status %d, rc=%Rrc\n", enmStatus, rc);
86 return rc;
87}
88
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