seems like finished preprocess_calltrick todo check it
This commit is contained in:
18
kpack_c.c
18
kpack_c.c
@@ -43,7 +43,6 @@ unsigned pack_lzma(unsigned char *infile, unsigned char *outfile, unsigned insiz
|
|||||||
|
|
||||||
unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned char ct1[256], unsigned *ctn, unsigned char *cti)
|
unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned char ct1[256], unsigned *ctn, unsigned char *cti)
|
||||||
{
|
{
|
||||||
// TODO: check
|
|
||||||
unsigned char *buf = malloc(2*insize);
|
unsigned char *buf = malloc(2*insize);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
goto pack_calltrick_fail;
|
goto pack_calltrick_fail;
|
||||||
@@ -78,7 +77,7 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c
|
|||||||
buf_ptr += 8;
|
buf_ptr += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while(count > 0); //
|
} while(count > 0);
|
||||||
|
|
||||||
unsigned idx = 0;
|
unsigned idx = 0;
|
||||||
while (idx < 256 && ct1[idx] != 0) {
|
while (idx < 256 && ct1[idx] != 0) {
|
||||||
@@ -89,23 +88,18 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c
|
|||||||
}
|
}
|
||||||
*cti = ~(unsigned char)256;
|
*cti = ~(unsigned char)256;
|
||||||
|
|
||||||
if (buf_ptr == buf) {
|
unsigned tmp;
|
||||||
free(buf);
|
while (buf_ptr != buf) {
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
buf_ptr -= 8;
|
buf_ptr -= 8;
|
||||||
unsigned tmp;
|
|
||||||
memcpy(&tmp, *buf_ptr, 4);
|
memcpy(&tmp, *buf_ptr, 4);
|
||||||
memcpy(tmp - 4, cti, 1);
|
memcpy(tmp - 4, cti, 1);
|
||||||
// TDOO here jmp @b
|
|
||||||
}
|
}
|
||||||
|
free(buf);
|
||||||
// TODO !
|
return tmp;
|
||||||
|
|
||||||
pack_calltrick_fail:
|
pack_calltrick_fail:
|
||||||
*ctn = 0;
|
*ctn = 0;
|
||||||
// ebx = 0; // TODO what
|
return 0;
|
||||||
return 0; // 0?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user