mirror-ac/user/um/imports.cpp

31 lines
679 B
C++
Raw Normal View History

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