mirror-ac/user/um/imports.cpp
2023-08-16 19:28:46 +10:00

26 lines
675 B
C++

#include "imports.h"
#include "../common.h"
usermode::Imports::Imports()
{
NtQueryInformationThread = nullptr;
this->ImportMap[ "NtQueryInformationThread" ] = NtQueryInformationThread;
std::map<std::string, void*>::iterator it;
for ( it = this->ImportMap.begin(); it != this->ImportMap.end(); it++ )
{
HMODULE module_handle = GetModuleHandle( L"ntdll.dll" );
if ( !module_handle )
{
LOG_ERROR( "GetModuleHandle failed with status code 0x%x", GetLastError() );
return;
}
it->second = GetProcAddress( module_handle, it->first.c_str());
if ( !it->second )
{
LOG_ERROR( "GetProcAddress failed with status code 0x%x", GetLastError() );
}
}
}