AuroraRuntime/Source/Process/AuProcessMap.Win32.cpp
Reece 4e6f116925 [*] Refactor
[+] IProcessSectionView::GetStart
[+] IProcessSectionView::GetEnd
2022-12-17 20:14:19 +00:00

45 lines
1.1 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuProcessMap.Win32.cpp
Date: 2021-6-12
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "AuProcessMap.Win32.hpp"
#include "AuProcessMap.NT.hpp"
#include <tlhelp32.h>
namespace Aurora::Process
{
void MakeToolHelp32Snapshot()
{
MODULEENTRY32 me32;
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
if (hModuleSnap == INVALID_HANDLE_VALUE)
{
SysPushErrorGen("CreateToolhelp32Snapshot");
return;
}
me32.dwSize = sizeof(MODULEENTRY32);
if (!Module32First(hModuleSnap, &me32))
{
SysPushErrorGen("Module32First failed");
CloseHandle(hModuleSnap);
return;
}
do
{
auto h = reinterpret_cast<HMODULE>(me32.modBaseAddr);
InvaildateModule(h);
MakeAware(h);
}
while (Module32Next(hModuleSnap, &me32));
CloseHandle(hModuleSnap);
}
}