1 /***********************************************************************\
2 *                                 dxerr.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                       Placed into public domain                       *
7 \***********************************************************************/
8 module win32.directx.dxerr;
9 version(Windows):
10 
11 import win32.windows;
12 
13 pragma(lib, "dxerr.lib");
14 
15 extern (Windows) {
16 	CHAR*  DXGetErrorStringA(HRESULT hr);
17 	WCHAR* DXGetErrorStringW(HRESULT hr);
18 	CHAR*  DXGetErrorDescriptionA(HRESULT hr);
19 	WCHAR* DXGetErrorDescriptionW(HRESULT hr);
20 	HRESULT DXTraceA(CHAR* strFile, DWORD dwLine, HRESULT hr, CHAR* strMsg,
21 	  BOOL bPopMsgBox);
22 	HRESULT DXTraceW(CHAR* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg,
23 	  BOOL bPopMsgBox);
24 }
25 
26 version (Unicode) {
27 	alias DXGetErrorStringW DXGetErrorString;
28 	alias DXGetErrorDescriptionW DXGetErrorDescription;
29 	alias DXTraceW DXTrace;
30 } else {
31 	alias DXGetErrorStringA DXGetErrorString;
32 	alias DXGetErrorDescriptionA DXGetErrorDescription;
33 	alias DXTraceA DXTrace;
34 }
35 
36 debug (dxerr) {
37 	HRESULT DXTRACE_MSG(TCHAR* str) {
38 		return DXTrace(__FILE__, __LINE__, 0, str, false);
39 	}
40 	HRESULT DXTRACE_ERR(TCHAR* str, HRESULT hr) {
41 		return DXTrace(__FILE__, __LINE__, hr, str, false);
42 	}
43 	HRESULT DXTRACE_ERR_MSGBOX(TCHAR* str, HRESULT hr) {
44 		return DXTrace(__FILE__, __LINE__, hr, str, true);
45 	}
46 } else {
47 	HRESULT DXTRACE_MSG(TCHAR* str) {
48 		return 0;
49 	}
50 	HRESULT DXTRACE_ERR(TCHAR* str, HRESULT hr) {
51 		return hr;
52 	}
53 	HRESULT DXTRACE_ERR_MSGBOX(TCHAR* str, HRESULT hr) {
54 		return hr;
55 	}
56 }