//
// _beginthreadex from 0x180130ab0 to 0x180130b84 (212 bytes)
//
// 2 xrefs:
// > FMOD_OS_Thread_Create @ 0x1800c1646
// > ??> @ 0x180202e7c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
uintptr_t __cdecl beginthreadex(
void *Security,
unsigned int StackSize,
_beginthreadex_proc_type StartAddress,
void *ArgList,
unsigned int InitFlag,
unsigned int *ThrdAddr)
{
SIZE_T v6; // rdi
struct __acrt_thread_parameter *thread_parameter; // rbx
HANDLE v10; // rdi
DWORD LastError; // eax
void *v12; // rcx
HMODULE v13; // rcx
DWORD ThreadId; // [rsp+50h] [rbp+18h] BYREF
v6 = StackSize;
if ( !StartAddress )
{
*errno() = 22;
invalid_parameter_noinfo();
return 0;
}
thread_parameter = create_thread_parameter((LPCWSTR)StartAddress, ArgList);
if ( thread_parameter )
{
v10 = CreateThread(
(LPSECURITY_ATTRIBUTES)Security,
v6,
(LPTHREAD_START_ROUTINE)unknown_libname_61,
thread_parameter,
InitFlag,
&ThreadId);
if ( v10 )
{
if ( ThrdAddr )
*ThrdAddr = ThreadId;
thread_parameter = nullptr;
goto LABEL_7;
}
LastError = GetLastError();
_acrt_errno_map_os_error(LastError);
}
v10 = nullptr;
LABEL_7:
if ( thread_parameter )
{
v12 = *((void **)thread_parameter + 2);
if ( v12 )
CloseHandle(v12);
v13 = *((HMODULE *)thread_parameter + 3);
if ( v13 )
FreeLibrary(v13);
free_base(thread_parameter);
}
return (uintptr_t)v10;
}