//
// __acrt_getptd_noexit from 0x180135434 to 0x180135500 (204 bytes)
//
// 11 xrefs:
// > __acrt_errno_map_os_error @ 0x18012fdec
// > __acrt_errno_map_os_error @ 0x18012fe05
// > __doserrno @ 0x18012fe34
// > _errno @ 0x18012fe54
// > common_end_thread @ 0x1801309f8
// > _seh_filter_exe @ 0x180131689
// > Concurrency::details::ScheduleGroupSegmentBase::HasUnrealizedChores @ 0x180132978
// > _invalid_parameter @ 0x180132d0c
// > __acrt_initialize_ptd @ 0x18013551f
// > raise @ 0x1801396ad
// > ??> @ 0x180203374
//
// 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
//
__int64 _acrt_getptd_noexit()
{
DWORD LastError; // eax
DWORD v1; // ecx
DWORD v2; // ebx
__int64 Value; // rax
struct __acrt_ptd *v4; // rdi
struct __acrt_ptd *v5; // rsi
struct __acrt_ptd *v6; // rax
struct __acrt_ptd *v7; // rcx
LastError = GetLastError();
v1 = dword_1801B1870;
v2 = LastError;
if ( dword_1801B1870 == -1 )
{
LABEL_6:
if ( !(unsigned int)_acrt_FlsSetValue(v1, (LPVOID)0xFFFFFFFFFFFFFFFFLL) )
goto LABEL_4;
v6 = (struct __acrt_ptd *)calloc_base(1u, 0x3C8u);
v4 = v6;
if ( v6 )
{
if ( (unsigned int)_acrt_FlsSetValue(dword_1801B1870, v6) )
{
construct_ptd_array(v4);
free_base(nullptr);
goto LABEL_13;
}
_acrt_FlsSetValue(dword_1801B1870, nullptr);
v7 = v4;
}
else
{
_acrt_FlsSetValue(dword_1801B1870, nullptr);
v7 = nullptr;
}
free_base(v7);
goto LABEL_4;
}
Value = _acrt_FlsGetValue();
v4 = (struct __acrt_ptd *)Value;
if ( !Value )
{
v1 = dword_1801B1870;
goto LABEL_6;
}
if ( Value != -1 )
{
LABEL_13:
v5 = v4;
goto LABEL_14;
}
LABEL_4:
v4 = nullptr;
v5 = nullptr;
LABEL_14:
SetLastError(v2);
return (unsigned __int64)v5 & -(__int64)(v4 != nullptr);
}