VirtualBox

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

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

Additions/VBoxCredProv: Fixes for Windows 10 guests.

  • 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 67772 2017-07-04 11:42:31Z vboxsync $ */
2/** @file
3 * VBoxCredProvUtils - Misc. utility functions for VBoxCredProv.
4 */
5
6/*
7 * Copyright (C) 2012-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#include <iprt/win/windows.h>
23
24#ifdef LOG_ENABLED
25# include <iprt/stream.h>
26#endif
27#include <iprt/string.h>
28#include <VBox/log.h>
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