diff options
| author | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
|---|---|---|
| committer | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
| commit | 76424950e373d3b04ac3dd13019151bfba3e8423 (patch) | |
| tree | 4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/common/impl/kmod_windows.c | |
Add the files
Diffstat (limited to 'src/common/impl/kmod_windows.c')
| -rw-r--r-- | src/common/impl/kmod_windows.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/common/impl/kmod_windows.c b/src/common/impl/kmod_windows.c new file mode 100644 index 0000000..081e5a7 --- /dev/null +++ b/src/common/impl/kmod_windows.c @@ -0,0 +1,28 @@ +#include "common/kmod.h" +#include "common/windows/nt.h" +#include "common/mallocHelper.h" +#include "common/strutil.h" + +bool ffKmodLoaded(const char* modName) { + ULONG bufferSize = 0; + NtQuerySystemInformation(SystemModuleInformation, NULL, 0, &bufferSize); + if (bufferSize == 0) { + return true; // ignore errors + } + + FF_AUTO_FREE RTL_PROCESS_MODULES* buffer = malloc(bufferSize); + + if (!NT_SUCCESS(NtQuerySystemInformation(SystemModuleInformation, buffer, bufferSize, &bufferSize))) { + return true; // ignore errors + } + + for (ULONG i = 0; i < buffer->NumberOfModules; i++) { + const char* name = (const char*) buffer->Modules[i].FullPathName + buffer->Modules[i].OffsetToFileName; + + if (ffStrEqualsIgnCase(name, modName)) { + return true; + } + } + + return false; +} |