// // TIFFReadCustomDirectory from 0xc3bb94 to 0xc3c158 (1476 bytes) // // 2 xrefs: // > TIFFReadEXIFDirectory @ 0xc3c184 // > @ 0x39960 // // 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 TIFFReadCustomDirectory(const char **a1, const char *a2, __int64 a3) { unsigned __int16 v5; // w0 int v6; // w19 unsigned __int16 *v7; // x24 __int64 v8; // x3 char *v9; // x6 unsigned int v10; // w0 __int64 v11; // x19 char *v12; // x4 unsigned int v13; // w5 unsigned __int16 *v14; // x19 const char *v15; // x8 int v16; // w1 unsigned int v17; // w3 unsigned int v18; // w4 const char *v19; // x7 int v20; // w2 unsigned int v21; // w0 unsigned int v22; // w6 int *v23; // x0 int v24; // w0 int v25; // w4 int v26; // w2 int v27; // w1 unsigned int v28; // w5 __int64 v29; // x2 const char *v31; // x5 int v32; // w2 _DWORD *v33; // x1 int v34; // w5 int v35; // w1 unsigned int v36; // w5 unsigned __int64 v37; // x0 unsigned __int64 v38; // x26 bool v39; // cf int v40; // w1 int v41; // w0 unsigned int v42; // w26 const char *v43; // x6 int v44; // w2 _DWORD *v45; // x1 _DWORD *v46; // x2 const char *v47; // x3 _DWORD *v48; // x0 const char *v49; // x3 unsigned __int64 v50; // x0 double v51; // d0 int v52; // [xsp+58h] [xbp+58h] int v53; // [xsp+58h] [xbp+58h] unsigned int v54; // [xsp+64h] [xbp+64h] BYREF void *p; // [xsp+68h] [xbp+68h] BYREF __int64 v56; // [xsp+70h] [xbp+70h] BYREF TIFFSetupFields(a1, a3); v5 = sub_C34538(a1, a2, &p, nullptr); v6 = v5; if ( !v5 ) { TIFFErrorExt(a1[119], "TIFFReadCustomDirectory", "Failed to read custom directory at offset %lu", a2); return 0; } TIFFFreeDirectory((__int64)a1); TIFFmemset(a1 + 7, 0, 0x118u); v7 = (unsigned __int16 *)p; v8 = (unsigned int)(v6 - 1); v9 = (char *)p; LOWORD(v10) = *(_WORD *)p; v11 = 12 * ((unsigned __int16)(v6 - 1) + 1LL); v12 = (char *)p + v11 * 2; while ( 1 ) { v9 += 24; v13 = (unsigned __int16)(v10 + 1); if ( v9 == v12 ) break; v10 = *(unsigned __int16 *)v9; if ( v10 < v13 ) { TIFFWarningExt( a1[119], "TIFFReadDirectoryCheckOrder", "Invalid TIFF directory; tags are not sorted in ascending order", v8, v12); v7 = (unsigned __int16 *)p; break; } } v14 = &v7[v11]; do { v15 = a1[127]; v16 = -1; v17 = *v7; v18 = 0; v19 = a1[126]; v20 = (int)v15; while ( 1 ) { if ( v18 == v20 ) goto LABEL_11; v21 = (v16 + v20) / 2; v22 = **(_DWORD **)&v19[8 * v21]; if ( v22 == v17 ) break; if ( v22 >= v17 ) { v20 = (v16 + v20) / 2; } else { v16 = (v16 + v20) / 2; v18 = v21 + 1; } } if ( !v21 ) goto LABEL_30; v31 = &v19[8 * v21]; v32 = **((_DWORD **)v31 - 1); if ( v32 == v17 ) { while ( --v21 ) { v33 = *((_DWORD **)v31 - 2); v31 -= 8; if ( *v33 != v32 ) goto LABEL_47; } LABEL_30: v21 = 0; goto LABEL_18; } LABEL_47: if ( v21 == -1 ) { LABEL_11: TIFFWarningExt(a1[119], "TIFFReadCustomDirectory", "Unknown field with tag %d (0x%x) encountered", v17, *v7); v23 = (int *)TIFFCreateAnonField((__int64)a1, *v7, v7[1]); if ( !(unsigned int)TIFFMergeFields(a1, v23, 1u) ) { TIFFWarningExt( a1[119], "TIFFReadCustomDirectory", "Registering anonymous field with tag %d (0x%x) failed", *v7, *v7); *v7 = 0; goto LABEL_21; } v15 = a1[127]; v24 = -1; v17 = *v7; v25 = 0; v19 = a1[126]; v26 = (int)v15; while ( 1 ) { if ( v25 == v26 ) { v21 = -1; goto LABEL_18; } v27 = (v24 + v26) / 2; v28 = **(_DWORD **)&v19[8 * v27]; if ( v28 == v17 ) break; if ( v28 >= v17 ) { v26 = (v24 + v26) / 2; } else { v24 = (v24 + v26) / 2; v25 = v27 + 1; } } v21 = (v24 + v26) / 2; if ( !v27 ) goto LABEL_30; v43 = &v19[8 * v27]; v44 = **((_DWORD **)v43 - 1); if ( v44 == v17 ) { while ( --v21 ) { v45 = *((_DWORD **)v43 - 2); v43 -= 8; if ( *v45 != v44 ) goto LABEL_18; } v21 = 0; } else { v21 = v27; } } LABEL_18: if ( !v17 ) goto LABEL_21; v29 = *(_QWORD *)&v19[8 * v21]; if ( !*(_WORD *)(v29 + 24) ) goto LABEL_20; while ( 1 ) { v35 = *(_DWORD *)(v29 + 8); if ( !v35 ) break; v34 = v7[1]; if ( v35 == v34 ) break; if ( v15 == (const char *)++v21 || **(_DWORD **)&v19[8 * v21] != v17 ) goto LABEL_61; v29 = *(_QWORD *)&v19[8 * v21]; } if ( v21 == 0xFFFF ) { v34 = v7[1]; LABEL_61: TIFFWarningExt( a1[119], "TIFFReadCustomDirectory", "Wrong data type %d for \"%s\"; tag ignored", v34, *(const char **)(v29 + 32)); *v7 = 0; } else { v36 = *(__int16 *)(v29 + 4); if ( (v36 & 0xFFFFFFFD) != 0xFFFFFFFD ) { if ( v36 == -2 ) { v36 = *((unsigned __int16 *)a1 + 65); v50 = *((_QWORD *)v7 + 1); v38 = *((unsigned __int16 *)a1 + 65); v39 = v38 >= v50; if ( v38 > v50 ) { LABEL_69: v52 = v36; v46 = TIFFFieldWithTag(a1, v17); if ( v46 ) v47 = *((const char **)v46 + 4); else v47 = "unknown tagname"; TIFFWarningExt( a1[119], *a1, "incorrect count for field \"%s\" (%lu, expecting %u); tag ignored", v47, *((_QWORD *)v7 + 1), v52); LABEL_20: *v7 = 0; goto LABEL_21; } } else { v37 = *((_QWORD *)v7 + 1); v38 = v36; v39 = v36 >= v37; if ( v36 > v37 ) goto LABEL_69; } if ( !v39 ) { v53 = v36; v48 = TIFFFieldWithTag(a1, v17); if ( v48 ) v49 = *((const char **)v48 + 4); else v49 = "unknown tagname"; TIFFWarningExt( a1[119], *a1, "incorrect count for field \"%s\" (%lu, expecting %u); tag trimmed", v49, *((_QWORD *)v7 + 1), v53); *((_QWORD *)v7 + 1) = v38; v17 = *v7; } } if ( !v17 ) goto LABEL_21; if ( v17 == 37382 ) { v56 = 0; v40 = 1; if ( *((_QWORD *)v7 + 1) != 1 ) goto LABEL_45; v40 = 2; if ( v7[1] != 5 ) goto LABEL_45; v41 = *((_DWORD *)a1 + 4); if ( (v41 & 0x80000) != 0 ) { v56 = *((_QWORD *)v7 + 2); } else { v42 = *((_DWORD *)v7 + 4); v54 = v42; if ( (v41 & 0x80) != 0 ) { TIFFSwabLong(&v54); v42 = v54; v41 = *((_DWORD *)a1 + 4); } if ( (v41 & 0x800) != 0 ) { if ( (unsigned __int64)v42 + 8 > (unsigned __int64)a1[116] ) goto LABEL_59; TIFFmemcpy(&v56, &a1[115][v42], 8u); } else if ( v42 != ((__int64 (__fastcall *)(const char *, _QWORD, _QWORD))a1[122])(a1[119], v42, 0) || ((__int64 (__fastcall *)(const char *, __int64 *, __int64))a1[120])(a1[119], &v56, 8) != 8 ) { LABEL_59: v40 = 3; LABEL_45: sub_C34BEC(a1 + 119, v40, (__int64)"TIFFFetchSubjectDistance", (__int64)"SubjectDistance", 1); goto LABEL_21; } v41 = *((_DWORD *)a1 + 4); } if ( (v41 & 0x80) != 0 ) TIFFSwabArrayOfLong(&v56, 2); v51 = 0.0; if ( (_DWORD)v56 ) { if ( (_DWORD)v56 == -1 ) v51 = -1.0; else v51 = (double)(unsigned int)v56 / (double)HIDWORD(v56); } TIFFSetField(a1, *v7, v51); } else { sub_C3879C((__int64)a1, v7, 1); } } LABEL_21: v7 += 12; } while ( v7 != v14 ); if ( p ) TIFFfree(p); return 1; }
GD Web Decomp Icon

GD Web Decomp

Raw Source