MCPcopy Create free account
hub / github.com/NoMercy-ac/NoMercy / CheckModuleModificationsRoutine

Function CheckModuleModificationsRoutine

Source/Client/NM_Engine/ManualMap.cpp:819–902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

817}
818
819DWORD WINAPI CheckModuleModificationsRoutine(LPVOID)
820{
821 DEBUG_LOG(LL_SYS, "Manual map thread event has been started!");
822
823 auto pMMapRoutineTimer = CTimer<std::chrono::milliseconds>();
824
825 auto currentThread = std::shared_ptr<CThread>();
826 do
827 {
828 if (pMMapRoutineTimer.diff() > 5000)
829 g_nmApp->OnCloseRequest(EXIT_ERR_MANUALMAP_THREAD_TIMEOUT, g_winapiApiTable->GetLastError());
830
831 g_winapiApiTable->Sleep(10);
832 currentThread = g_nmApp->ThreadManagerInstance()->GetThreadFromThreadCode(SELF_THREAD_MMAPMODULES);
833
834 } while (!IS_VALID_SMART_PTR(currentThread));
835
836 // Initilization routine
837 if (g_nmApp->DataInstance()->GetAppType() == NM_CLIENT)
838 {
839 if (g_nmApp->SelfHooksInstance()->InitializeSelfAPIHooks() == false)
840 {
841 g_nmApp->OnCloseRequest(EXIT_ERR_SELF_API_HOOK_INIT_FAIL, g_winapiApiTable->GetLastError());
842 return 0;
843 }
844
845 if (g_nmApp->DynamicWinapiInstance()->PatchWow64Redirection() == false)
846 {
847 g_nmApp->OnCloseRequest(EXIT_ERR_WOW64_FIX_FAIL, g_winapiApiTable->GetLastError());
848 return 0;
849 }
850
851 if (g_nmApp->AccessHelperInstance()->SetMitigationPolicys() == false)
852 {
853 g_nmApp->OnCloseRequest(EXIT_ERR_MITIGATION_INIT_FAIL, g_winapiApiTable->GetLastError());
854 return 0;
855 }
856 }
857
858 // Loop routine
859 static auto iIndex = 0;
860 while (true)
861 {
862 if (iIndex >= INT_MAX - 1)
863 iIndex = 1;
864
865 auto pLimitTimer = CTimer<std::chrono::milliseconds>();
866
867 if (g_nmApp->DataInstance()->GetAppType() == NM_CLIENT && g_nmApp->SelfHooksInstance()->HooksIsInitialized() == false)
868 {
869 if (pLimitTimer.diff() > 10000)
870 {
871 g_nmApp->OnCloseRequest(EXIT_ERR_MMAP_HOOK_CHECK_TIMEOUT, g_winapiApiTable->GetLastError());
872 return 0;
873 }
874
875 DEBUG_LOG(LL_SYS, "Hooks not initialized yet!");
876

Callers

nothing calls this directly

Calls 15

diffMethod · 0.80
OnCloseRequestMethod · 0.80
SleepMethod · 0.80
ThreadManagerInstanceMethod · 0.80
GetAppTypeMethod · 0.80
DataInstanceMethod · 0.80
SelfHooksInstanceMethod · 0.80
PatchWow64RedirectionMethod · 0.80
DynamicWinapiInstanceMethod · 0.80
SetMitigationPolicysMethod · 0.80

Tested by

no test coverage detected