/*	Report.c - Run-time error reporting.
*
*******************************************************************************
* Copyright (c) 1996-97 Digi International Inc., All Rights Reserved          *
*                                                                             *
* This  software  contains  proprietary  and  confidential   information   of *
* Digi International  Inc.   By  accepting  transfer  of this copy, Recipient *
* agrees to retain this software in  confidence,  to  prevent  disclosure  to *
* others,  and  to make no  use of this software other than that for which it *
* was delivered.  This is an unpublished copyright work  Digi   International *
* Inc.    Except   as   permitted   by  federal  law,  17 USC 117, copying is *
* strictly prohibited.                                                        *
*                                                                             *
* Digi  International  Inc.  CONFIDENTIAL  -   (Digi    International    Inc. *
* Confidential  when   combined   with   the   aggregated  modules  for  this *
* product) OBJECT CODE ONLY SOURCE MATERIALS                                  *
*                                                                             *
* (C) COPYRIGHT Digi International Inc. 1996-97                               *
*                                                                             *
* All Rights Reserved                                                         *
*                                                                             *
* US   Government   Users   Restricted   Rights   -   Use,   duplication   or *
* disclosure  restricted by GSA ADP Schedule Contract with Digi International *
* Inc.                                                                        *
*                                                                             *
*******************************************************************************
*
*/

#include "DS_RAS.h"
#include "Report.h"

static HANDLE hEventLog = NULL;

BOOL ReportInitialize(char const * const pszModule)
{
	hEventLog = RegisterEventSource(NULL, pszModule);
	
	DebugAssert2(hEventLog != NULL, "Unable to register event source for %s, GLE=%u\n", pszModule, GetLastError());

	return (hEventLog != NULL);
}

void ReportTearDown()
{
	if (hEventLog != NULL)
	{
		DeregisterEventSource(hEventLog);
		hEventLog = NULL;
	}
}

void ReportFailureToUser(DWORD idString, size_t cStrings, char const * * const ppsz)
{
	BOOL fSuccess;

	if (hEventLog == NULL) goto Error;

	fSuccess = ReportEvent(hEventLog, EVENTLOG_ERROR_TYPE, 0, idString, NULL, LoWord(cStrings), 0, ppsz, NULL);
	DebugAssert2(fSuccess, "unable to report event %u, GLE=%u\n", idString, GetLastError());

Error:

	return;
}


