2023-08-16 11:28:46 +02:00
|
|
|
#include "imports.h"
|
|
|
|
|
|
|
|
#include "../common.h"
|
|
|
|
|
|
|
|
usermode::Imports::Imports()
|
|
|
|
{
|
|
|
|
NtQueryInformationThread = nullptr;
|
2023-09-05 18:04:06 +02:00
|
|
|
RtlDosPathNameToNtPathName_U = nullptr;
|
2023-08-16 11:28:46 +02:00
|
|
|
|
|
|
|
this->ImportMap[ "NtQueryInformationThread" ] = NtQueryInformationThread;
|
2023-09-05 18:04:06 +02:00
|
|
|
this->ImportMap[ "RtlDosPathNameToNtPathName_U" ] = RtlDosPathNameToNtPathName_U;
|
2023-08-16 11:28:46 +02:00
|
|
|
|
|
|
|
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() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|