// // ENGINE_ctrl from 0xd9c418 to 0xd9c804 (1004 bytes) // // 10 xrefs: // > sub_BB78D0 @ 0xbb7fb8 // > ENGINE_cmd_is_executable @ 0xd9c81c // > ENGINE_ctrl_cmd @ 0xd9c8a4 // > ENGINE_ctrl_cmd @ 0xd9c8c8 // > ENGINE_ctrl_cmd_string @ 0xd9c9b4 // > ENGINE_ctrl_cmd_string @ 0xd9c9ec // > ENGINE_ctrl_cmd_string @ 0xd9cb74 // > ENGINE_ctrl_cmd_string @ 0xd9cb98 // > ENGINE_ctrl_cmd_string @ 0xd9cbdc // > @ 0x9df98 // // 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 // __int64 __fastcall ENGINE_ctrl(__int64 a1, __int64 a2, __int64 a3, const char *a4, __int64 a5) { int v6; // w21 __int64 (__fastcall *v7)(__int64, __int64, __int64, const char *, __int64); // x5 _BOOL4 v8; // w19 const char *v9; // x3 int v10; // w6 __int64 result; // x0 __int64 v12; // x9 unsigned int v13; // w4 __int64 v14; // x5 int v15; // w6 unsigned int v16; // t1 _QWORD *v17; // x1 const char *v18; // x19 unsigned __int64 v19; // x1 __int64 v20; // x6 __int64 v21; // x6 unsigned int v22; // w1 __int64 v23; // x21 __int64 v24; // x19 int v25; // w20 int v26; // w0 int v27; // t1 const char *v32; // [xsp+48h] [xbp+48h] const char *v33; // [xsp+48h] [xbp+48h] if ( !a1 ) { ERR_put_error(38, 142, 67, "crypto/engine/eng_ctrl.c", 137); return 0; } CRYPTO_THREAD_write_lock(global_engine_lock); v6 = *(_DWORD *)(a1 + 156); CRYPTO_THREAD_unlock(global_engine_lock); v7 = *(__int64 (__fastcall **)(__int64, __int64, __int64, const char *, __int64))(a1 + 112); v8 = v7 != nullptr; v9 = a4; if ( v6 <= 0 ) { ERR_put_error(38, 142, 130, "crypto/engine/eng_ctrl.c", 145); return 0; } if ( (_DWORD)a2 == 10 ) return v8; if ( (int)a2 < 10 || (int)a2 > 18 ) { if ( v7 ) return v7(a1, a2, a3, a4, a5); ERR_put_error(38, 142, 120, "crypto/engine/eng_ctrl.c", 179); return v8; } if ( v7 ) { v10 = *(_DWORD *)(a1 + 152); result = v10 & 2; if ( (v10 & 2) != 0 ) return v7(a1, a2, a3, a4, a5); if ( (_DWORD)a2 == 11 ) { v17 = *(_QWORD **)(a1 + 144); if ( v17 && *(_DWORD *)v17 ) { if ( v17[1] ) return *(unsigned int *)v17; else return 0; } } else if ( ((a2 & 0xFFFFFFFD) == 0xD || (_DWORD)a2 == 17) && !a4 ) { ERR_put_error(38, 172, 67, "crypto/engine/eng_ctrl.c", 77); return 0xFFFFFFFFLL; } else if ( (_DWORD)a2 == 13 ) { v23 = *(_QWORD *)(a1 + 144); if ( v23 && *(_DWORD *)v23 && *(_QWORD *)(v23 + 8) ) { v24 = *(_QWORD *)(a1 + 144); v25 = 0; while ( 1 ) { v33 = v9; v26 = strcmp(*(const char **)(v24 + 8), v9); v9 = v33; if ( !v26 ) return *(unsigned int *)(v23 + 32LL * v25); v27 = *(_DWORD *)(v24 + 32); v24 += 32; ++v25; if ( !v27 || !*(_QWORD *)(v24 + 8) ) goto LABEL_58; } } else { LABEL_58: ERR_put_error(38, 172, 137, "crypto/engine/eng_ctrl.c", 85); return 0xFFFFFFFFLL; } } else { v12 = *(_QWORD *)(a1 + 144); if ( !v12 ) goto LABEL_29; v13 = *(_DWORD *)v12; if ( *(_DWORD *)v12 ) { if ( *(_QWORD *)(v12 + 8) && v13 < (unsigned int)a3 ) { v14 = *(_QWORD *)(a1 + 144); v15 = 0; do { v16 = *(_DWORD *)(v14 + 32); v14 += 32; v13 = v16; ++v15; } while ( v16 && (unsigned int)a3 > v13 && *(_QWORD *)(v14 + 8) ); } else { v15 = 0; } } else { v15 = 0; } if ( v13 == (_DWORD)a3 ) { switch ( (int)a2 ) { case 12: v21 = 32LL * (v15 + 1); v22 = *(_DWORD *)(v12 + v21); if ( v22 ) { if ( *(_QWORD *)(v12 + v21 + 8) ) result = v22; else result = 0; } break; case 14: result = strlen(*(const char **)(v12 + 32LL * v15 + 8)); break; case 15: v32 = a4; v18 = *(const char **)(v12 + 32LL * v15 + 8); goto LABEL_42; case 16: v20 = v12 + 32LL * v15; if ( *(_QWORD *)(v20 + 16) ) result = strlen(*(const char **)(v20 + 16)); break; case 17: v18 = *(const char **)(v12 + 32LL * v15 + 16); if ( v18 ) { v32 = a4; LABEL_42: v19 = strlen(v18) + 1; result = BIO_snprintf(v32, v19, "%s", v18); } else { result = BIO_snprintf(a4, 1u, "%s", &byte_F288A0); } break; case 18: result = *(unsigned int *)(v12 + 32LL * v15 + 24); break; } } else { LABEL_29: ERR_put_error(38, 172, 138, "crypto/engine/eng_ctrl.c", 97); return 0xFFFFFFFFLL; } } } else { ERR_put_error(38, 142, 120, "crypto/engine/eng_ctrl.c", 166); return 0xFFFFFFFFLL; } return result; }