Artifact 9090410cc0efe452797055c378402f4660d4c47d:
- File
src/win32/directx/dxerr.d
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
The problem was __gshared. Replacing it with TLS fixed the issue. Remaining problem is that "hack.d"'s CloseHandle hack is not working anymore.
(user: kinaba) [annotate]
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a /*************** 0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0040: 2a 2a 2a 2a 2a 2a 2a 2a 5c 0d 0a 2a 20 20 20 20 ********\..* 0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0060: 20 20 20 20 20 20 20 20 20 20 20 20 20 64 78 65 dxe 0070: 72 72 2e 64 20 20 20 20 20 20 20 20 20 20 20 20 rr.d 0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0090: 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 20 *..* 00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0d *. 00e0: 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .* 00f0: 20 20 20 20 20 20 20 20 20 57 69 6e 64 6f 77 73 Windows 0100: 20 41 50 49 20 68 65 61 64 65 72 20 6d 6f 64 75 API header modu 0110: 6c 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 le 0120: 20 20 20 20 20 20 20 20 20 2a 0d 0a 2a 20 20 20 *..* 0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0170: 20 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 *..* 0180: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 50 P 0190: 6c 61 63 65 64 20 69 6e 74 6f 20 70 75 62 6c 69 laced into publi 01a0: 63 20 64 6f 6d 61 69 6e 20 20 20 20 20 20 20 20 c domain 01b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a * 01c0: 0d 0a 5c 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ..\************* 01d0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 01e0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 01f0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0200: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2f 0d 0a 6d 6f 64 **********/..mod 0210: 75 6c 65 20 77 69 6e 33 32 2e 64 69 72 65 63 74 ule win32.direct 0220: 78 2e 64 78 65 72 72 3b 0d 0a 0d 0a 69 6d 70 6f x.dxerr;....impo 0230: 72 74 20 77 69 6e 33 32 2e 77 69 6e 64 6f 77 73 rt win32.windows 0240: 3b 0d 0a 0d 0a 70 72 61 67 6d 61 28 6c 69 62 2c ;....pragma(lib, 0250: 20 22 64 78 65 72 72 2e 6c 69 62 22 29 3b 0d 0a "dxerr.lib");.. 0260: 0d 0a 65 78 74 65 72 6e 20 28 57 69 6e 64 6f 77 ..extern (Window 0270: 73 29 20 7b 0d 0a 09 43 48 41 52 2a 20 20 44 58 s) {...CHAR* DX 0280: 47 65 74 45 72 72 6f 72 53 74 72 69 6e 67 41 28 GetErrorStringA( 0290: 48 52 45 53 55 4c 54 20 68 72 29 3b 0d 0a 09 57 HRESULT hr);...W 02a0: 43 48 41 52 2a 20 44 58 47 65 74 45 72 72 6f 72 CHAR* DXGetError 02b0: 53 74 72 69 6e 67 57 28 48 52 45 53 55 4c 54 20 StringW(HRESULT 02c0: 68 72 29 3b 0d 0a 09 43 48 41 52 2a 20 20 44 58 hr);...CHAR* DX 02d0: 47 65 74 45 72 72 6f 72 44 65 73 63 72 69 70 74 GetErrorDescript 02e0: 69 6f 6e 41 28 48 52 45 53 55 4c 54 20 68 72 29 ionA(HRESULT hr) 02f0: 3b 0d 0a 09 57 43 48 41 52 2a 20 44 58 47 65 74 ;...WCHAR* DXGet 0300: 45 72 72 6f 72 44 65 73 63 72 69 70 74 69 6f 6e ErrorDescription 0310: 57 28 48 52 45 53 55 4c 54 20 68 72 29 3b 0d 0a W(HRESULT hr);.. 0320: 09 48 52 45 53 55 4c 54 20 44 58 54 72 61 63 65 .HRESULT DXTrace 0330: 41 28 43 48 41 52 2a 20 73 74 72 46 69 6c 65 2c A(CHAR* strFile, 0340: 20 44 57 4f 52 44 20 64 77 4c 69 6e 65 2c 20 48 DWORD dwLine, H 0350: 52 45 53 55 4c 54 20 68 72 2c 20 43 48 41 52 2a RESULT hr, CHAR* 0360: 20 73 74 72 4d 73 67 2c 0d 0a 09 20 20 42 4f 4f strMsg,... BOO 0370: 4c 20 62 50 6f 70 4d 73 67 42 6f 78 29 3b 0d 0a L bPopMsgBox);.. 0380: 09 48 52 45 53 55 4c 54 20 44 58 54 72 61 63 65 .HRESULT DXTrace 0390: 57 28 43 48 41 52 2a 20 73 74 72 46 69 6c 65 2c W(CHAR* strFile, 03a0: 20 44 57 4f 52 44 20 64 77 4c 69 6e 65 2c 20 48 DWORD dwLine, H 03b0: 52 45 53 55 4c 54 20 68 72 2c 20 57 43 48 41 52 RESULT hr, WCHAR 03c0: 2a 20 73 74 72 4d 73 67 2c 0d 0a 09 20 20 42 4f * strMsg,... BO 03d0: 4f 4c 20 62 50 6f 70 4d 73 67 42 6f 78 29 3b 0d OL bPopMsgBox);. 03e0: 0a 7d 0d 0a 0d 0a 76 65 72 73 69 6f 6e 20 28 55 .}....version (U 03f0: 6e 69 63 6f 64 65 29 20 7b 0d 0a 09 61 6c 69 61 nicode) {...alia 0400: 73 20 44 58 47 65 74 45 72 72 6f 72 53 74 72 69 s DXGetErrorStri 0410: 6e 67 57 20 44 58 47 65 74 45 72 72 6f 72 53 74 ngW DXGetErrorSt 0420: 72 69 6e 67 3b 0d 0a 09 61 6c 69 61 73 20 44 58 ring;...alias DX 0430: 47 65 74 45 72 72 6f 72 44 65 73 63 72 69 70 74 GetErrorDescript 0440: 69 6f 6e 57 20 44 58 47 65 74 45 72 72 6f 72 44 ionW DXGetErrorD 0450: 65 73 63 72 69 70 74 69 6f 6e 3b 0d 0a 09 61 6c escription;...al 0460: 69 61 73 20 44 58 54 72 61 63 65 57 20 44 58 54 ias DXTraceW DXT 0470: 72 61 63 65 3b 0d 0a 7d 20 65 6c 73 65 20 7b 0d race;..} else {. 0480: 0a 09 61 6c 69 61 73 20 44 58 47 65 74 45 72 72 ..alias DXGetErr 0490: 6f 72 53 74 72 69 6e 67 41 20 44 58 47 65 74 45 orStringA DXGetE 04a0: 72 72 6f 72 53 74 72 69 6e 67 3b 0d 0a 09 61 6c rrorString;...al 04b0: 69 61 73 20 44 58 47 65 74 45 72 72 6f 72 44 65 ias DXGetErrorDe 04c0: 73 63 72 69 70 74 69 6f 6e 41 20 44 58 47 65 74 scriptionA DXGet 04d0: 45 72 72 6f 72 44 65 73 63 72 69 70 74 69 6f 6e ErrorDescription 04e0: 3b 0d 0a 09 61 6c 69 61 73 20 44 58 54 72 61 63 ;...alias DXTrac 04f0: 65 41 20 44 58 54 72 61 63 65 3b 0d 0a 7d 0d 0a eA DXTrace;..}.. 0500: 0d 0a 64 65 62 75 67 20 28 64 78 65 72 72 29 20 ..debug (dxerr) 0510: 7b 0d 0a 09 48 52 45 53 55 4c 54 20 44 58 54 52 {...HRESULT DXTR 0520: 41 43 45 5f 4d 53 47 28 54 43 48 41 52 2a 20 73 ACE_MSG(TCHAR* s 0530: 74 72 29 20 7b 0d 0a 09 09 72 65 74 75 72 6e 20 tr) {....return 0540: 44 58 54 72 61 63 65 28 5f 5f 46 49 4c 45 5f 5f DXTrace(__FILE__ 0550: 2c 20 5f 5f 4c 49 4e 45 5f 5f 2c 20 30 2c 20 73 , __LINE__, 0, s 0560: 74 72 2c 20 66 61 6c 73 65 29 3b 0d 0a 09 7d 0d tr, false);...}. 0570: 0a 09 48 52 45 53 55 4c 54 20 44 58 54 52 41 43 ..HRESULT DXTRAC 0580: 45 5f 45 52 52 28 54 43 48 41 52 2a 20 73 74 72 E_ERR(TCHAR* str 0590: 2c 20 48 52 45 53 55 4c 54 20 68 72 29 20 7b 0d , HRESULT hr) {. 05a0: 0a 09 09 72 65 74 75 72 6e 20 44 58 54 72 61 63 ...return DXTrac 05b0: 65 28 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 e(__FILE__, __LI 05c0: 4e 45 5f 5f 2c 20 68 72 2c 20 73 74 72 2c 20 66 NE__, hr, str, f 05d0: 61 6c 73 65 29 3b 0d 0a 09 7d 0d 0a 09 48 52 45 alse);...}...HRE 05e0: 53 55 4c 54 20 44 58 54 52 41 43 45 5f 45 52 52 SULT DXTRACE_ERR 05f0: 5f 4d 53 47 42 4f 58 28 54 43 48 41 52 2a 20 73 _MSGBOX(TCHAR* s 0600: 74 72 2c 20 48 52 45 53 55 4c 54 20 68 72 29 20 tr, HRESULT hr) 0610: 7b 0d 0a 09 09 72 65 74 75 72 6e 20 44 58 54 72 {....return DXTr 0620: 61 63 65 28 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f ace(__FILE__, __ 0630: 4c 49 4e 45 5f 5f 2c 20 68 72 2c 20 73 74 72 2c LINE__, hr, str, 0640: 20 74 72 75 65 29 3b 0d 0a 09 7d 0d 0a 7d 20 65 true);...}..} e 0650: 6c 73 65 20 7b 0d 0a 09 48 52 45 53 55 4c 54 20 lse {...HRESULT 0660: 44 58 54 52 41 43 45 5f 4d 53 47 28 54 43 48 41 DXTRACE_MSG(TCHA 0670: 52 2a 20 73 74 72 29 20 7b 0d 0a 09 09 72 65 74 R* str) {....ret 0680: 75 72 6e 20 30 3b 0d 0a 09 7d 0d 0a 09 48 52 45 urn 0;...}...HRE 0690: 53 55 4c 54 20 44 58 54 52 41 43 45 5f 45 52 52 SULT DXTRACE_ERR 06a0: 28 54 43 48 41 52 2a 20 73 74 72 2c 20 48 52 45 (TCHAR* str, HRE 06b0: 53 55 4c 54 20 68 72 29 20 7b 0d 0a 09 09 72 65 SULT hr) {....re 06c0: 74 75 72 6e 20 68 72 3b 0d 0a 09 7d 0d 0a 09 48 turn hr;...}...H 06d0: 52 45 53 55 4c 54 20 44 58 54 52 41 43 45 5f 45 RESULT DXTRACE_E 06e0: 52 52 5f 4d 53 47 42 4f 58 28 54 43 48 41 52 2a RR_MSGBOX(TCHAR* 06f0: 20 73 74 72 2c 20 48 52 45 53 55 4c 54 20 68 72 str, HRESULT hr 0700: 29 20 7b 0d 0a 09 09 72 65 74 75 72 6e 20 68 72 ) {....return hr 0710: 3b 0d 0a 09 7d 0d 0a 7d ;...}..}