| 1605 | } |
| 1606 | |
| 1607 | BOOL DllMain_ProcessAttach(HANDLE hModule, DWORD ul_reason_for_call) |
| 1608 | { |
| 1609 | BOOL lbAllow = TRUE; |
| 1610 | DLOG0("DllMain.DLL_PROCESS_ATTACH",ul_reason_for_call); |
| 1611 | gDllMainCallInfo[DLL_PROCESS_ATTACH].OnCall(); |
| 1612 | |
| 1613 | ghOurModule = (HMODULE)hModule; |
| 1614 | ghWorkingModule = hModule; |
| 1615 | |
| 1616 | InitBaseDir(); |
| 1617 | |
| 1618 | #ifdef USEHOOKLOG |
| 1619 | QueryPerformanceFrequency(&HookLogger::g_freq); |
| 1620 | #endif |
| 1621 | |
| 1622 | gnDllState |= ds_DllProcessAttach; |
| 1623 | #ifdef _DEBUG |
| 1624 | HANDLE hProcHeap = GetProcessHeap(); |
| 1625 | #endif |
| 1626 | HeapInitialize(); |
| 1627 | gnDllState |= ds_HeapInitialized; |
| 1628 | |
| 1629 | hkFunc.SetInternalMode(); |
| 1630 | |
| 1631 | DLOG1("DllMain.LoadStartupEnv",ul_reason_for_call); |
| 1632 | /* *** DEBUG PURPOSES */ |
| 1633 | gpStartEnv = LoadStartupEnv::Create(); |
| 1634 | DLOGEND1(); |
| 1635 | //if (gpStartEnv && gpStartEnv->hIn.hStd && !(gpStartEnv->hIn.nMode & 0x80000000)) |
| 1636 | //{ |
| 1637 | // if ((gpStartEnv->hIn.nMode & 0xF0) == 0xE0) |
| 1638 | // { |
| 1639 | // _ASSERTE(FALSE && "ENABLE_MOUSE_INPUT was disabled! Enabling..."); |
| 1640 | // SetConsoleMode(gpStartEnv->hIn.hStd, gpStartEnv->hIn.nMode|ENABLE_MOUSE_INPUT); |
| 1641 | // } |
| 1642 | //} |
| 1643 | /* *** DEBUG PURPOSES */ |
| 1644 | |
| 1645 | DLOG1_("DllMain.Console",ul_reason_for_call); |
| 1646 | ghConWnd = GetRealConsoleWindow(); |
| 1647 | if (ghConWnd) |
| 1648 | GetConsoleTitle(gsInitConTitle, countof(gsInitConTitle)); |
| 1649 | gnSelfPID = GetCurrentProcessId(); |
| 1650 | DLOGEND1(); |
| 1651 | |
| 1652 | |
| 1653 | InitExeName(); |
| 1654 | |
| 1655 | if (ghConWnd) |
| 1656 | { |
| 1657 | HandleInformation Info = {}; |
| 1658 | HandleKeeper::AllocHandleInfo(GetStdHandle(STD_INPUT_HANDLE), HandleSource::StdIn, 0, nullptr, &Info); |
| 1659 | _ASSERTE(!gbConEmuConnector || (Info.is_input)); |
| 1660 | HandleKeeper::AllocHandleInfo(GetStdHandle(STD_OUTPUT_HANDLE), HandleSource::StdOut, 0, nullptr, &Info); |
| 1661 | _ASSERTE(!gbConEmuConnector || (Info.is_ansi && Info.is_output)); |
| 1662 | HandleKeeper::AllocHandleInfo(GetStdHandle(STD_ERROR_HANDLE), HandleSource::StdErr, 0, nullptr, &Info); |
| 1663 | _ASSERTE(!gbConEmuConnector || (Info.is_ansi && Info.is_error)); |
| 1664 | ZeroStruct(Info); // for debug breakpoint |
no test coverage detected