2021-06-27 21:25:29 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
2022-12-17 20:14:19 +00:00
|
|
|
File: AuProcessMap.Win32.cpp
|
2021-06-27 21:25:29 +00:00
|
|
|
Date: 2021-6-12
|
|
|
|
Author: Reece
|
|
|
|
***/
|
2021-09-30 14:57:41 +00:00
|
|
|
#include <Source/RuntimeInternal.hpp>
|
2022-12-17 20:14:19 +00:00
|
|
|
#include "AuProcessMap.Win32.hpp"
|
|
|
|
#include "AuProcessMap.NT.hpp"
|
2022-01-24 18:37:06 +00:00
|
|
|
#include <tlhelp32.h>
|
2021-06-27 21:25:29 +00:00
|
|
|
|
|
|
|
namespace Aurora::Process
|
|
|
|
{
|
2022-01-24 18:37:06 +00:00
|
|
|
void MakeToolHelp32Snapshot()
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2022-01-24 18:37:06 +00:00
|
|
|
MODULEENTRY32 me32;
|
|
|
|
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
|
|
|
|
|
|
|
|
hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
|
|
|
|
if (hModuleSnap == INVALID_HANDLE_VALUE)
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2022-01-24 18:37:06 +00:00
|
|
|
SysPushErrorGen("CreateToolhelp32Snapshot");
|
|
|
|
return;
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
2022-01-24 18:37:06 +00:00
|
|
|
me32.dwSize = sizeof(MODULEENTRY32);
|
2021-06-27 21:25:29 +00:00
|
|
|
|
2022-01-24 18:37:06 +00:00
|
|
|
if (!Module32First(hModuleSnap, &me32))
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2022-01-24 18:37:06 +00:00
|
|
|
SysPushErrorGen("Module32First failed");
|
|
|
|
CloseHandle(hModuleSnap);
|
|
|
|
return;
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
|
|
|
|
2022-01-24 18:37:06 +00:00
|
|
|
do
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2022-01-24 18:37:06 +00:00
|
|
|
auto h = reinterpret_cast<HMODULE>(me32.modBaseAddr);
|
|
|
|
InvaildateModule(h);
|
|
|
|
MakeAware(h);
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
2022-01-24 18:37:06 +00:00
|
|
|
while (Module32Next(hModuleSnap, &me32));
|
2021-06-27 21:25:29 +00:00
|
|
|
|
2022-01-24 18:37:06 +00:00
|
|
|
CloseHandle(hModuleSnap);
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
|
|
|
}
|