// // copy_environment from 0x18013b4d4 to 0x18013b5c3 (239 bytes) // // 3 xrefs: // > common_set_variable_in_environment_nolock @ 0x18013b13e // > common_set_variable_in_environment_nolock @ 0x18013b18c // > @ 0x1802038f0 // // 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 // _BYTE *__fastcall copy_environment(const wchar_t **a1) { const wchar_t **v1; // rdi __int64 v3; // rcx const wchar_t **i; // rax _BYTE *v5; // rbx const wchar_t *v6; // rax signed __int64 v7; // r14 __int64 v8; // rsi wchar_t *v9; // rcx v1 = a1; if ( !a1 ) return nullptr; v3 = 0; for ( i = v1; *i; ++i ) ++v3; v5 = calloc_base(v3 + 1, 8u); if ( !v5 ) LABEL_15: abort(); v6 = *v1; if ( *v1 ) { v7 = v5 - (_BYTE *)v1; do { v8 = -1; do ++v8; while ( v6[v8] ); *(const wchar_t **)((char *)v1 + v7) = (const wchar_t *)calloc_base(v8 + 1, 2u); free_base(nullptr); v9 = *(wchar_t **)((char *)v1 + v7); if ( !v9 ) goto LABEL_15; if ( wcscpy_s(v9, v8 + 1, *v1) ) invoke_watson(nullptr, nullptr, nullptr, 0, 0); v6 = *++v1; } while ( *v1 ); } free_base(nullptr); return v5; }