MCPcopy Create free account
hub / github.com/SpecialKO/SpecialK / OutputDebugStringW_Detour

Function OutputDebugStringW_Detour

src/diagnostics/debug_utils.cpp:1627–1670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1625 break;
1626 default: [[likely]]
1627 break;
1628 }
1629}
1630
1631void
1632WINAPI
1633SK_OutputDebugStringW (LPCWSTR lpOutputString) noexcept
1634{
1635 if ( OutputDebugStringW_Original != nullptr)
1636 OutputDebugStringW_Original (lpOutputString);
1637 else OutputDebugStringW (lpOutputString);
1638}
1639
1640void
1641WINAPI
1642SK_OutputDebugStringA (LPCSTR lpOutputString) noexcept
1643{
1644 if ( OutputDebugStringA_Original != nullptr)
1645 OutputDebugStringA_Original (lpOutputString);
1646 else OutputDebugStringA (lpOutputString);
1647}
1648
1649void
1650WINAPI
1651OutputDebugStringW_Detour (LPCWSTR lpOutputString)
1652{
1653 // Anti-debug survival kit
1654 DWORD dwLastErr =
1655 GetLastError ();
1656
1657 if (! lpOutputString) // This is meaningless, just pass it along
1658 {
1659 OutputDebugStringW_Original (lpOutputString);
1660 SK_SetLastError (dwLastErr);
1661
1662 return;
1663 }
1664
1665 wchar_t wszModule [MAX_PATH + 2] = { };
1666 wcsncpy_s (wszModule, MAX_PATH,
1667 SK_GetModuleFullNameFromAddr (
1668 _ReturnAddress ()
1669 ).c_str (), _TRUNCATE );
1670
1671 game_debug->LogEx (true, L"%-72ws: %ws", wszModule, lpOutputString);
1672
1673 if ((! wcschr (lpOutputString, L'\n')))

Callers

nothing calls this directly

Calls 5

SK_SetLastErrorFunction · 0.85
SK_GetCurrentGameIDFunction · 0.85
LogExMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected