AuroraRuntime/Source/Process/ProcessMap.Win32.cpp
Reece e5e36bd887 Large Commit
[*] Fix deadlock in the async subsystem (NoLockShutdown vs Shutdown in exception handler)
[+] Added ProccessMap NT variant
[+] Added ToolHelp image profiling
[*] Improved exception awareness
[*] Delegated SpawnThread to isolated TU, ready for reuse for RunAs and XNU Open - now with horrible evil alloc that could fail
[+] Added header for future api 'UtilRun'
[*] Improve NT core detection
[*] Changed small affinity bitmap to AuUInt64 instead of AuUInt32
[+] Added data structure to hold cpuids/affinity masks
[+] Implemented logger sinks
[+] Implemented logger glue logic
[*] Began migrating older loggers to sink-based default devices
[*] Minor refactors
[*] Improved internal exception discarding, not yet nothrow capable
[*] Minor create directory fix
2022-01-24 18:43:53 +00:00

45 lines
1.1 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: ProcessMap.Win32.cpp
Date: 2021-6-12
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "ProcessMap.Win32.hpp"
#include "ProcessMap.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);
}
}