From 85c856b94027cd3c2155c62e27bec717b03e7112 Mon Sep 17 00:00:00 2001 From: vxunderground <57078196+vxunderground@users.noreply.github.com> Date: Thu, 14 Jul 2022 23:12:56 -0500 Subject: [PATCH] Create GetLinkedDllCount.cpp --- Windows API/GetLinkedDllCount.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Windows API/GetLinkedDllCount.cpp diff --git a/Windows API/GetLinkedDllCount.cpp b/Windows API/GetLinkedDllCount.cpp new file mode 100644 index 0000000..a5e8ba5 --- /dev/null +++ b/Windows API/GetLinkedDllCount.cpp @@ -0,0 +1,18 @@ +DWORD GetLinkedDllCount(VOID) +{ + PPEB Peb = GetPeb(); + PLDR_MODULE Module = NULL; + DWORD dwIndexHash = 0; + DWORD dwCount = 0; + + Module = (PLDR_MODULE)((PBYTE)Peb->LoaderData->InMemoryOrderModuleList.Flink - 16); + + for (; TRUE; dwCount++) + { + Module = (PLDR_MODULE)((PBYTE)Module->InMemoryOrderModuleList.Flink - 16); + if (Module->BaseDllName.Buffer == NULL) + break; + } + + return dwCount; +}