- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
void CExeTuner::ResFill2Tree(uchar *baddr, uchar *addr, TRes *now, int level)
{
int len;
now->size1=*(uword *)(addr+0x0C); now->size2=*(uword *)(addr+0x0E);
if (now->size1+now->size2) now->mas=new TRes * [(now->size1+now->size2)];
ulong long1,long2;
for (int i=0; i<(now->size1+now->size2); i++)
{
now->mas[i]=new TRes;
now->mas[i]->back=now;
now->mas[i]->name=new char [32];
now->mas[i]->mas=NULL; now->mas[i]->data=NULL;
long1=*(ulong *)(addr+0x10+(i<<3));
long2=*(ulong *)(addr+0x14+(i<<3));
if (long1&0x80000000) {
long1&=0x7FFFFFFF;
now->mas[i]->isname=true;
len=*(uword *)(baddr+long1);
now->mas[i]->rname1=new uchar [len*2+2+1];
now->mas[i]->rname1[len*2+2]=0;
memcpy(now->mas[i]->rname1,baddr+long1,len*2+2);
now->mas[i]->name=new char [len+1];
now->mas[i]->name[len]=0;
for (int j=0; j<=len; j++)
now->mas[i]->name[j]=now->mas[i]->rname1[(j+1)*2];
} else {
now->mas[i]->isname=false;
now->mas[i]->rname2=long1;
if (!ResNumToStr(long1,now->mas[i]->name,level)) _itoa(long1,now->mas[i]->name,10);
}
if (long2&0x80000000) {
long2&=0x7FFFFFFF;
now->mas[i]->isdir=true;
ResFill2Tree(baddr, baddr+long2, now->mas[i], level+1);
} else {
now->mas[i]->isdir=false;
now->mas[i]->size1=*(ulong *)(baddr+long2+4);
now->mas[i]->data=new uchar [now->mas[i]->size1];
if ((*(ulong *)(baddr+long2)+now->mas[i]->size1)>(*ExeMain.ResDirAddrOBJ+*ObjMas[ExeMain.ResPosInObj].size))
{ now->mas[i]->data=NULL; now->mas[i]->size1=0;
} else memcpy(now->mas[i]->data,baddr-*ExeMain.ResDirAddrOBJ+*(ulong *)(baddr+long2),now->mas[i]->size1);
}
}
}
guest 22.09.2009 01:20 # +1
guest 04.10.2009 20:31 # +1
k06a 04.10.2009 21:05 # 0