1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4//*****************************************************************************
5// UtilCode.h
6//
7// Utility functions implemented in UtilCode.lib.
8//
9
10//*****************************************************************************
11
12#ifndef __PostError_h__
13#define __PostError_h__
14
15#include "switches.h"
16
17//*****************************************************************************
18// This function will post an error for the client. If the LOWORD(hrRpt) can
19// be found as a valid error message, then it is loaded and formatted with
20// the arguments passed in. If it cannot be found, then the error is checked
21// against FormatMessage to see if it is a system error. System errors are
22// not formatted so no add'l parameters are required. If any errors in this
23// process occur, hrRpt is returned for the client with no error posted.
24//*****************************************************************************
25extern "C"
26HRESULT __cdecl PostError( // Returned error.
27 HRESULT hrRpt, // Reported error.
28 ...); // Error arguments.
29
30extern "C"
31HRESULT __cdecl PostErrorVA( // Returned error.
32 HRESULT hrRpt, // Reported error.
33 va_list marker); // Error arguments.
34
35//*****************************************************************************
36// This function formats an error message, but doesn't fill the IErrorInfo.
37//*****************************************************************************
38HRESULT __cdecl FormatRuntimeErrorVa(
39 __out_ecount(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
40 ULONG cchMsg, // Size of buffer, characters.
41 HRESULT hrRpt, // The HR to report.
42 va_list marker); // Optional args.
43
44HRESULT __cdecl FormatRuntimeError(
45 __out_ecount(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
46 ULONG cchMsg, // Size of buffer, characters.
47 HRESULT hrRpt, // The HR to report.
48 ...); // Optional args.
49
50#endif // __PostError_h__
51