| 1625 | break; |
| 1626 | default: [[likely]] |
| 1627 | break; |
| 1628 | } |
| 1629 | } |
| 1630 | |
| 1631 | void |
| 1632 | WINAPI |
| 1633 | SK_OutputDebugStringW (LPCWSTR lpOutputString) noexcept |
| 1634 | { |
| 1635 | if ( OutputDebugStringW_Original != nullptr) |
| 1636 | OutputDebugStringW_Original (lpOutputString); |
| 1637 | else OutputDebugStringW (lpOutputString); |
| 1638 | } |
| 1639 | |
| 1640 | void |
| 1641 | WINAPI |
| 1642 | SK_OutputDebugStringA (LPCSTR lpOutputString) noexcept |
| 1643 | { |
| 1644 | if ( OutputDebugStringA_Original != nullptr) |
| 1645 | OutputDebugStringA_Original (lpOutputString); |
| 1646 | else OutputDebugStringA (lpOutputString); |
| 1647 | } |
| 1648 | |
| 1649 | void |
| 1650 | WINAPI |
| 1651 | OutputDebugStringW_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'))) |
nothing calls this directly
no test coverage detected