VBoxCredProvUtils.cpp revision 677d56e09bab8713dc546b66c93f8bb92a7881c3
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/* $Id$ */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/** @file
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * VBoxCredProvUtils - Misc. utility functions for VBoxCredProv.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/*
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Copyright (C) 2012 Oracle Corporation
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync *
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * available from http://www.virtualbox.org. This file is free software;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * you can redistribute it and/or modify it under the terms of the GNU
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * General Public License (GPL) as published by the Free Software
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync */
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/*******************************************************************************
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* Header Files *
*******************************************************************************/
#include <Windows.h>
#include <iprt/string.h>
#include <VBox/log.h>
#include <VBox/VBoxGuestLib.h>
/*******************************************************************************
* Global Variables *
*******************************************************************************/
/** Verbosity flag for guest logging. */
DWORD g_dwVerbosity = 0;
/**
* Displays a verbose message.
*
* @param iLevel Minimum log level required to display this message.
* @param pszFormat The message text.
* @param ... Format arguments.
*/
void VBoxCredProvVerbose(DWORD dwLevel, const char *pszFormat, ...)
{
if (dwLevel <= g_dwVerbosity)
{
va_list args;
va_start(args, pszFormat);
char *psz = NULL;
RTStrAPrintfV(&psz, pszFormat, args);
va_end(args);
AssertPtr(psz);
LogRel(("%s", psz));
RTStrFree(psz);
}
}
/**
* Reports VBoxGINA's status to the host (treated as a guest facility).
*
* @return IPRT status code.
* @param enmStatus Status to report to the host.
*/
int VBoxCredProvReportStatus(VBoxGuestFacilityStatus enmStatus)
{
VBoxCredProvVerbose(0, "VBoxCredProv: reporting status %d\n", enmStatus);
int rc = VbglR3AutoLogonReportStatus(enmStatus);
if (RT_FAILURE(rc))
VBoxCredProvVerbose(0, "VBoxCredProv: failed to report status %d, rc=%Rrc\n", enmStatus, rc);
return rc;
}