Changeset 68283 in vbox
- Timestamp:
- Aug 3, 2017 12:12:25 PM (7 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/shared
- Files:
-
- 2 edited
-
VBoxDispMpLogger.cpp (modified) (1 diff)
-
VBoxDispMpLogger.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/shared/VBoxDispMpLogger.cpp
r68261 r68283 243 243 vboxDispMpLoggerDumpBuf(pCaps, sizeof (*pCaps), VBOXDISPIFESCAPE_DBGDUMPBUF_TYPE_D3DCAPS9); 244 244 } 245 246 /* 247 * Prefix the output string with module name and pid/tid. 248 */ 249 static const char *vboxUmLogGetModuleName(void) 250 { 251 static int s_fModuleNameInited = 0; 252 static char s_szModuleName[MAX_PATH]; 253 254 if (!s_fModuleNameInited) 255 { 256 const DWORD cchName = GetModuleFileNameA(NULL, s_szModuleName, RT_ELEMENTS(s_szModuleName)); 257 if (cchName == 0) 258 { 259 return "<no module>"; 260 } 261 s_fModuleNameInited = 1; 262 } 263 return &s_szModuleName[0]; 264 } 265 266 DECLCALLBACK(void) VBoxWddmUmLog(const char *pszString) 267 { 268 char szBuffer[4096]; 269 const int cbBuffer = sizeof(szBuffer); 270 char *pszBuffer = &szBuffer[0]; 271 272 int cbWritten = _snprintf(pszBuffer, cbBuffer, "['%s' 0x%x.0x%x]: ", 273 vboxUmLogGetModuleName(), GetCurrentProcessId(), GetCurrentThreadId()); 274 if (cbWritten < 0 || cbWritten >= cbBuffer) 275 { 276 AssertFailed(); 277 pszBuffer[0] = 0; 278 cbWritten = 0; 279 } 280 281 const size_t cbLeft = cbBuffer - cbWritten; 282 const size_t cbString = strlen(pszString) + 1; 283 if (cbString <= cbLeft) 284 { 285 memcpy(pszBuffer + cbWritten, pszString, cbString); 286 } 287 else 288 { 289 memcpy(pszBuffer + cbWritten, pszString, cbLeft - 1); 290 pszBuffer[cbWritten + cbLeft - 1] = 0; 291 } 292 293 VBoxDispMpLoggerLog(szBuffer); 294 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/shared/VBoxDispMpLogger.h
r68261 r68283 48 48 VBOXDISPMPLOGGER_DECL(void) VBoxDispMpLoggerLogF(const char *pszString, ...); 49 49 50 DECLCALLBACK(void) VBoxWddmUmLog(const char *pszString); 51 50 52 RT_C_DECLS_END 51 53
Note:
See TracChangeset
for help on using the changeset viewer.

