
Originally Posted by
Trass3r
Thanks. I just can't seem to get it to break, neither memory bp nor hardware bps break..
You can find it with IDA, you only need to define everything 
look at this:
Code:
int __thiscall sub_591070(struct unkstruc6 *this, char *fname)
{
int idx; // eax@1
struct unkstruc6 *this1; // edi@1
int result; // eax@2
struct eheapitm1 *v5; // esi@3
int v6; // ebx@4
FILE *v7; // ST0C_4@3
int v8; // eax@3
int v9; // ecx@4
int v10; // eax@4
int vtable; // eax@8
void *v12; // eax@8
signed int DstBuf; // [sp+8h] [bp-18h]@3
signed int v14; // [sp+4h] [bp-1Ch]@3
struct eheapitm1 *v15; // [sp+10h] [bp-10h]@3
signed int v16; // [sp+1Ch] [bp-4h]@3
size_t ElementSize; // [sp+Ch] [bp-14h]@8
this1 = this;
idx = get_slot_for_texture_file(&this->field_434, fname);
if ( idx >= 0 )
{
fseek(this1->texturesFile, this1->field_434.field_410[idx].field_0, 0);
v7 = this1->texturesFile;
DstBuf = -1;
v14 = -1;
fname = (char *)-1;
read_from_file(&DstBuf, 4u, 1u, v7);
read_from_file(&v14, 4u, 1u, this1->texturesFile);
read_from_file(&fname, 4u, 1u, this1->texturesFile);
v8 = allocate_engine_heap(28);
v5 = (struct eheapitm1 *)v8;
v15 = (struct eheapitm1 *)v8;
v16 = 0;
if ( v8 )
{
v9 = v14;
v10 = DstBuf;
v6 = (int)fname;
v5->ptrfield_10 = (int)&unk_792D98;
v5->vtable = (int)&unkn_vtable1;
v5->field_4 = v10;
v5->field_8 = v9;
v5->field_C = v10 * dword_792DA0;
LOBYTE(v16) = 1;
v5->vtable = (int)&off_67039C;
v5->ptrfield_14 = 0;
if ( v6 )
v5->ptrfield_14 = allocate_engine_heap(v6);
v5->mem14_len = v6;
}
else
{
v5 = 0;
}
ElementSize = 0;
vtable = v5->vtable;
v16 = -1;
v12 = (void *)(*(int (__thiscall **)(_DWORD, _DWORD))(vtable + 32))(v5, &ElementSize);
read_from_file(v12, ElementSize, 1u, this1->texturesFile);
result = (int)v5;
}
else
{
result = 0;
}
return result;
}
As you see, it's easier to read if you'll define the function calling convention properly (most of them are __thiscall and they get "this" pointer in ecx).
Also, defining structures helps a lot, even if you can't properly name them.
Code:
struct unkstruc2
{
unsigned long ptrfield_0[9];
unsigned long field_24;
unsigned char field_28[16];
unsigned char field_38;
unsigned char field_39[3];
unsigned char field_3C;
unsigned char field_3D[3];
unsigned char field_40;
unsigned char field_41;
unsigned char field_42[970];
void *ptrfield_40C;
unkstruc2_sub2 field_410[2];
};
struct unkstruc6
{
unsigned long field_0;
void *field_4;
void *texturesFile;
unsigned char field_C[1060];
unsigned long field_430;
unkstruc2 field_434;
};