Subversion Repositories pentevo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
716 lvd 1
/*==========================================================================;
2
 *
3
 *
4
 *  File:   dxerr.h
5
 *  Content:    DirectX Error Library Include File
6
 *
7
 ****************************************************************************/
8
 
9
#ifndef _DXERR_H_
10
#define _DXERR_H_
11
 
12
#ifdef __cplusplus
13
extern "C" {
14
#endif //__cplusplus
15
 
719 lvd 16
#ifdef __GNUC__
17
 #define __in
18
 #define __in_z
19
 #define __in_z_opt
20
#endif
21
 
716 lvd 22
//
23
//  DXGetErrorString
24
//  
25
//  Desc:  Converts a DirectX HRESULT to a string 
26
//
27
//  Args:  HRESULT hr   Can be any error code from
28
//                      XACT XAUDIO2 XAPO XINPUT DXGI D3D10 D3DX10 D3D9 D3DX9 DDRAW DSOUND DINPUT DSHOW
29
//
30
//  Return: Converted string 
31
//
32
const char*  WINAPI DXGetErrorStringA(__in HRESULT hr);
33
const WCHAR* WINAPI DXGetErrorStringW(__in HRESULT hr);
34
 
35
#ifdef UNICODE
36
#define DXGetErrorString DXGetErrorStringW
37
#else
38
#define DXGetErrorString DXGetErrorStringA
39
#endif 
40
 
41
 
42
//
43
//  DXGetErrorDescription
44
//  
45
//  Desc:  Returns a string description of a DirectX HRESULT
46
//
47
//  Args:  HRESULT hr   Can be any error code from
48
//                      XACT XAUDIO2 XAPO XINPUT DXGI D3D10 D3DX10 D3D9 D3DX9 DDRAW DSOUND DINPUT DSHOW
49
//
50
//  Return: String description
51
//
52
const char*  WINAPI DXGetErrorDescriptionA(__in HRESULT hr);
53
const WCHAR* WINAPI DXGetErrorDescriptionW(__in HRESULT hr);
54
 
55
#ifdef UNICODE
56
    #define DXGetErrorDescription DXGetErrorDescriptionW
57
#else
58
    #define DXGetErrorDescription DXGetErrorDescriptionA
59
#endif 
60
 
61
 
62
//
63
//  DXTrace
64
//
65
//  Desc:  Outputs a formatted error message to the debug stream
66
//
67
//  Args:  CHAR* strFile   The current file, typically passed in using the 
68
//                         __FILE__ macro.
69
//         DWORD dwLine    The current line number, typically passed in using the 
70
//                         __LINE__ macro.
71
//         HRESULT hr      An HRESULT that will be traced to the debug stream.
72
//         CHAR* strMsg    A string that will be traced to the debug stream (may be NULL)
73
//         BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
74
//
75
//  Return: The hr that was passed in.  
76
//
77
HRESULT WINAPI DXTraceA( __in_z const char* strFile, __in DWORD dwLine, __in HRESULT hr, __in_z_opt const char* strMsg, __in BOOL bPopMsgBox );
78
HRESULT WINAPI DXTraceW( __in_z const char* strFile, __in DWORD dwLine, __in HRESULT hr, __in_z_opt const WCHAR* strMsg, __in BOOL bPopMsgBox );
79
 
80
#ifdef UNICODE
81
#define DXTrace DXTraceW
82
#else
83
#define DXTrace DXTraceA
84
#endif 
85
 
86
 
87
//
88
// Helper macros
89
//
90
#if defined(DEBUG) | defined(_DEBUG)
91
#define DXTRACE_MSG(str)              DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
92
#define DXTRACE_ERR(str,hr)           DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
93
#define DXTRACE_ERR_MSGBOX(str,hr)    DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
94
#else
95
#define DXTRACE_MSG(str)              (0L)
96
#define DXTRACE_ERR(str,hr)           (hr)
97
#define DXTRACE_ERR_MSGBOX(str,hr)    (hr)
98
#endif
99
 
100
 
101
#ifdef __cplusplus
102
}
103
#endif //__cplusplus
104
 
105
#endif // _DXERR_H_