| 1978 | |
| 1979 | |
| 1980 | void LogModuleLoaded(LPCWSTR pwszModule, HMODULE hModule) |
| 1981 | { |
| 1982 | // Update gnExeFlags |
| 1983 | // For cmd.exe |
| 1984 | if (gbIsCmdProcess || gbIsPowerShellProcess) |
| 1985 | { |
| 1986 | if (lstrcmpi(PointToName(pwszModule), CLINK_DLL_NAME_v1) == 0 |
| 1987 | || lstrcmpi(PointToName(pwszModule), CLINK_DLL_NAME_v0) == 0) |
| 1988 | gnExeFlags |= caf_Clink; |
| 1989 | } |
| 1990 | |
| 1991 | CShellProc* sp = nullptr; |
| 1992 | |
| 1993 | if (!gnLastLogSetChange || ((GetTickCount() - gnLastLogSetChange) > 2000)) |
| 1994 | { |
| 1995 | sp = new CShellProc(); |
| 1996 | if (sp) |
| 1997 | { |
| 1998 | gnLastLogSetChange = GetTickCount(); |
| 1999 | gbLogLibraries = sp->LoadSrvMapping(TRUE) && sp->GetLogLibraries(); |
| 2000 | } |
| 2001 | } |
| 2002 | else if (gbLogLibraries) |
| 2003 | { |
| 2004 | sp = new CShellProc(); |
| 2005 | if (!sp) |
| 2006 | { |
| 2007 | gbLogLibraries = FALSE; |
| 2008 | } |
| 2009 | } |
| 2010 | |
| 2011 | if (gbLogLibraries) |
| 2012 | { |
| 2013 | CESERVER_REQ* pIn = nullptr; |
| 2014 | |
| 2015 | wchar_t szInfo[64] = L""; |
| 2016 | FormatModuleHandle(hModule, L"Module=0x%08X", L"Module=0x%08X%08X", szInfo, countof(szInfo)); |
| 2017 | |
| 2018 | pIn = sp->NewCmdOnCreate(eLoadLibrary, nullptr, pwszModule, szInfo, nullptr, nullptr, nullptr, nullptr, nullptr, WIN3264TEST(32,64), 0, nullptr, nullptr, nullptr); |
| 2019 | if (pIn) |
| 2020 | { |
| 2021 | const MWnd hConWnd(GetRealConsoleWindow()); |
| 2022 | CESERVER_REQ* pOut = ExecuteGuiCmd(hConWnd, pIn, hConWnd); |
| 2023 | ExecuteFreeResult(pIn); |
| 2024 | if (pOut) ExecuteFreeResult(pOut); |
| 2025 | } |
| 2026 | } |
| 2027 | |
| 2028 | SafeDelete(sp); |
| 2029 | } |
| 2030 | |
| 2031 | void LogModuleUnloaded(LPCWSTR pwszModule, HMODULE hModule) |
| 2032 | { |
no test coverage detected