BOOL WINAPI OnSetConsoleTitleW(LPCWSTR lpConsoleTitle) { //typedef BOOL (WINAPI* OnSetConsoleTitleW_t)(LPCWSTR lpConsoleTitle); ORIGINALFASTEX(SetConsoleTitleW,NULL); #ifdef DEBUG_CON_TITLE if (!gpLastSetConTitle) gpLastSetConTitle = new CEStr(lstrdup(lpConsoleTitle)); else gpLastSetConTitle->Set(lpConsoleTitle); CEStr lsDbg(lstrmerge(L"SetConsoleTitleW('", lpConsoleTitle, L"')\n")); OutputDebugString(lsDbg); #endif BOOL bRc = FALSE; if (F(SetConsoleTitleW)) bRc = F(SetConsoleTitleW)(lpConsoleTitle); return bRc; }
int WINAPI OnGetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount) { //typedef int (WINAPI* OnGetWindowTextW_t)(HWND hWnd, LPWSTR lpString, int nMaxCount); ORIGINAL_EX(GetWindowTextW); int iRc = 0; FixHwnd4ConText(hWnd); if (F(GetWindowTextW)) iRc = F(GetWindowTextW)(hWnd, lpString, nMaxCount); #ifdef DEBUG_CON_TITLE wchar_t szPrefix[32]; _wsprintf(szPrefix, SKIPCOUNT(szPrefix) L"GetWindowTextW(x%08X)='", (DWORD)(DWORD_PTR)hWnd); CEStr lsDbg(lstrmerge(szPrefix, lpString, L"'\n")); OutputDebugString(lsDbg); if (gFarMode.cbSize && lpString && gpLastSetConTitle && gpLastSetConTitle->ms_Arg) { int iCmp = lstrcmp(gpLastSetConTitle->ms_Arg, lpString); _ASSERTE((iCmp == 0) && "Console window title was changed outside or was not applied yet"); } #endif return iRc; }