MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / DXTraceW

Function DXTraceW

SampleFramework12/v1.00/Graphics/DXErr.cpp:3227–3275  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3225
3226//-----------------------------------------------------------------------------
3227HRESULT WINAPI DXTraceW( _In_z_ const wchar* strFile, _In_ DWORD dwLine, _In_ HRESULT hr,
3228 _In_opt_ const wchar* strMsg, _In_ bool bPopMsgBox )
3229{
3230 wchar strBufferFile[MAX_PATH];
3231 wchar strBufferLine[128];
3232 wchar strBufferError[256];
3233 wchar strBufferMsg[1024];
3234 wchar strBuffer[BUFFER_SIZE];
3235
3236 swprintf_s( strBufferLine, 128, L"%lu", dwLine );
3237 if( strFile )
3238 {
3239 swprintf_s( strBuffer, BUFFER_SIZE, L"%s(%s): ", strFile, strBufferLine );
3240 OutputDebugStringW( strBuffer );
3241 }
3242
3243 size_t nMsgLen = (strMsg) ? wcsnlen_s( strMsg, 1024 ) : 0;
3244 if( nMsgLen > 0 )
3245 {
3246 OutputDebugStringW( strMsg );
3247 OutputDebugStringW( L" " );
3248 }
3249
3250 swprintf_s( strBufferError, 256, L"%s (0x%0.8x)", DXGetErrorStringW(hr), hr );
3251 swprintf_s( strBuffer, BUFFER_SIZE, L"hr=%s", strBufferError );
3252 OutputDebugStringW( strBuffer );
3253
3254 OutputDebugStringW( L"\n" );
3255
3256 if( bPopMsgBox )
3257 {
3258 wcscpy_s( strBufferFile, MAX_PATH, L"" );
3259 if( strFile )
3260 wcscpy_s( strBufferFile, MAX_PATH, strFile );
3261
3262 wcscpy_s( strBufferMsg, 1024, L"" );
3263 if( nMsgLen > 0 )
3264 swprintf_s( strBufferMsg, 1024, L"Calling: %s\n", strMsg );
3265
3266 swprintf_s( strBuffer, BUFFER_SIZE, L"File: %s\nLine: %s\nError Code: %s\n%sDo you want to debug the application?",
3267 strBufferFile, strBufferLine, strBufferError, strBufferMsg );
3268
3269 int nResult = MessageBoxW( GetForegroundWindow(), strBuffer, L"Unexpected error encountered", MB_YESNO | MB_ICONERROR );
3270 if( nResult == IDYES )
3271 DebugBreak();
3272 }
3273
3274 return hr;
3275}

Callers

nothing calls this directly

Calls 1

DXGetErrorStringWFunction · 0.85

Tested by

no test coverage detected