MCPcopy Create free account
hub / github.com/NtQuery/Scylla / addFunctionToModuleList

Method addFunctionToModuleList

Scylla/ApiReader.cpp:1027–1092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1025}
1026
1027bool ApiReader::addFunctionToModuleList(ApiInfo * apiFound, DWORD_PTR va, DWORD_PTR rva, WORD ordinal, bool valid, bool suspect)
1028{
1029 ImportThunk import;
1030 ImportModuleThunk * module = 0;
1031 std::map<DWORD_PTR, ImportModuleThunk>::iterator iterator1;
1032
1033 if ((*moduleThunkList).size() > 1)
1034 {
1035 iterator1 = (*moduleThunkList).begin();
1036 while (iterator1 != (*moduleThunkList).end())
1037 {
1038 if (rva >= iterator1->second.firstThunk)
1039 {
1040 iterator1++;
1041 if (iterator1 == (*moduleThunkList).end())
1042 {
1043 iterator1--;
1044 module = &(iterator1->second);
1045 break;
1046 }
1047 else if (rva < iterator1->second.firstThunk)
1048 {
1049 iterator1--;
1050 module = &(iterator1->second);
1051 break;
1052 }
1053 }
1054 else
1055 {
1056#ifdef DEBUG_COMMENTS
1057 Scylla::debugLog.log(L"Error iterator1 != (*moduleThunkList).end()");
1058#endif
1059 break;
1060 }
1061 }
1062 }
1063 else
1064 {
1065 iterator1 = (*moduleThunkList).begin();
1066 module = &(iterator1->second);
1067 }
1068
1069 if (!module)
1070 {
1071#ifdef DEBUG_COMMENTS
1072 Scylla::debugLog.log(L"ImportsHandling::addFunction module not found rva " PRINTF_DWORD_PTR_FULL, rva);
1073#endif
1074 return false;
1075 }
1076
1077
1078 import.suspect = suspect;
1079 import.valid = valid;
1080 import.va = va;
1081 import.rva = rva;
1082 import.apiAddressVA = apiFound->va;
1083 import.ordinal = ordinal;
1084 import.hint = (WORD)apiFound->hint;

Callers

nothing calls this directly

Calls 2

logMethod · 0.80
getFilenameMethod · 0.80

Tested by

no test coverage detected