//
// try_get_function from 0x180124fe0 to 0x18012512e (334 bytes)
//
// 6 xrefs:
// > __vcrt_FlsAlloc @ 0x180125150
// > __vcrt_FlsFree @ 0x18012519a
// > __vcrt_FlsGetValue @ 0x1801251e2
// > __vcrt_FlsSetValue @ 0x180125231
// > __vcrt_InitializeCriticalSectionEx @ 0x18012528d
// > ??> @ 0x18020278c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 10:54:54 +0000
//
FARPROC __fastcall try_get_function(unsigned int a1, const CHAR *a2, unsigned int *a3, unsigned int *a4)
{
__int64 v4; // rdi
unsigned int *v6; // rbp
FARPROC result; // rax
bool i; // zf
__int64 v10; // rsi
HMODULE Library; // rbx
const WCHAR *v12; // r15
v4 = a1;
v6 = a3;
result = (FARPROC)qword_1801F4BA0[a1];
if ( result != (FARPROC)-1LL )
{
if ( result )
return result;
for ( i = a3 == a4; !i; i = v6 == a4 )
{
v10 = *v6;
Library = (HMODULE)qword_1801F4B88[v10];
if ( Library )
{
if ( Library != (HMODULE)-1LL )
goto LABEL_16;
}
else
{
v12 = off_1801709F0[v10];
Library = LoadLibraryExW(v12, nullptr, 0x800u);
if ( Library
|| GetLastError() == 87
&& wcsncmp(v12, L"api-ms-", 7u)
&& (Library = LoadLibraryExW(v12, nullptr, 0)) != nullptr )
{
if ( _InterlockedExchange64(&qword_1801F4B88[v10], (__int64)Library) )
FreeLibrary(Library);
LABEL_16:
result = GetProcAddress(Library, a2);
if ( result )
{
_InterlockedExchange64(&qword_1801F4BA0[v4], (__int64)result);
return result;
}
break;
}
_InterlockedExchange64(&qword_1801F4B88[v10], -1);
}
++v6;
}
_InterlockedExchange64(&qword_1801F4BA0[v4], -1);
}
return nullptr;
}