//
// try_get_function from 0x180135560 to 0x180135736 (470 bytes)
//
// 23 xrefs:
// > __acrt_AppPolicyGetProcessTerminationMethodInternal @ 0x18013575b
// > __acrt_AppPolicyGetShowDeveloperDiagnosticInternal @ 0x1801357ab
// > __acrt_AppPolicyGetThreadInitializationTypeInternal @ 0x1801357fb
// > __acrt_AppPolicyGetWindowingModelInternal @ 0x18013584b
// > __acrt_AreFileApisANSI @ 0x180135893
// > __acrt_CompareStringEx @ 0x1801358ed
// > __acrt_FlsAlloc @ 0x1801359b3
// > __acrt_FlsFree @ 0x1801359fa
// > __acrt_FlsGetValue @ 0x180135a42
// > __acrt_FlsSetValue @ 0x180135a91
// > __vcrt_InitializeCriticalSectionEx_0 @ 0x180135aed
// > __acrt_LCMapStringEx @ 0x180135b59
// > __acrt_LocaleNameToLCID @ 0x180135c25
// > __acrt_MessageBoxW @ 0x180135c86
// > __acrt_RoInitialize @ 0x180135ce2
// > __acrt_RoUninitialize @ 0x180135d1e
// > __acrt_can_show_message_box @ 0x180135d64
// > __acrt_can_show_message_box @ 0x180135d86
// > __acrt_get_parent_window @ 0x180135dc4
// > __acrt_get_parent_window @ 0x180135df6
// > __acrt_is_interactive @ 0x180135e83
// > __acrt_is_interactive @ 0x180135eaa
// > ??> @ 0x180203398
//
// 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:55:00 +0000
//
FARPROC __fastcall try_get_function(unsigned int a1, const CHAR *a2, unsigned int *a3, unsigned int *a4)
{
__int64 v4; // r15
unsigned int *v6; // rbp
uintptr_t v8; // r10
__int64 v9; // rdx
FARPROC result; // rax
__int64 v11; // rsi
HMODULE Library; // rbx
const WCHAR *v13; // r14
v4 = a1;
v6 = a3;
v8 = _security_cookie;
v9 = __ROR8__(qword_1801F5040[a1] ^ _security_cookie, _security_cookie & 0x3F);
if ( v9 == -1 )
return nullptr;
if ( v9 )
return (FARPROC)v9;
if ( a3 == a4 )
{
LABEL_21:
Library = nullptr;
goto LABEL_22;
}
while ( 1 )
{
v11 = *v6;
Library = (HMODULE)qword_1801F4FA0[v11];
if ( !Library )
break;
if ( Library != (HMODULE)-1LL )
goto LABEL_25;
LABEL_19:
if ( ++v6 == a4 )
{
v8 = _security_cookie;
goto LABEL_21;
}
}
v13 = off_180174480[v11];
Library = LoadLibraryExW(v13, nullptr, 0x800u);
if ( !Library )
{
if ( GetLastError() != 87 || !wcsncmp(v13, L"api-ms-", 7u) || !wcsncmp(v13, L"ext-ms-", 7u) )
Library = nullptr;
else
Library = LoadLibraryExW(v13, nullptr, 0);
}
if ( !Library )
{
_InterlockedExchange64(&qword_1801F4FA0[v11], -1);
goto LABEL_19;
}
if ( _InterlockedExchange64(&qword_1801F4FA0[v11], (__int64)Library) )
FreeLibrary(Library);
LABEL_25:
v8 = _security_cookie;
LABEL_22:
if ( Library )
{
result = GetProcAddress(Library, a2);
if ( result )
{
_InterlockedExchange64(
&qword_1801F5040[v4],
_security_cookie ^ __ROR8__(result, 64 - ((unsigned __int8)_security_cookie & 0x3Fu)));
return result;
}
v8 = _security_cookie;
}
_InterlockedExchange64(&qword_1801F5040[v4], v8 ^ __ROR8__(-1, 64 - ((unsigned __int8)v8 & 0x3Fu)));
return nullptr;
}