add some comments, add todos

This commit is contained in:
2025-05-31 11:37:06 +03:00
parent 6bd80d9c25
commit c8699adf66

View File

@@ -49,7 +49,7 @@ 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 char *buf = malloc(2*insize);
unsigned char *buf = malloc(2*insize); // TODO WHERE it is used?
if (buf == NULL) {
goto pack_calltrick_fail;
}
@@ -70,17 +70,17 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c
break;
}
unsigned num;
memcpy(&num, infile_ptr, 4);
memcpy(&num, infile_ptr, 4); // read relative jump/call offset
infile_ptr += 4;
num += (infile_ptr - infile);
num += (infile_ptr - infile); // convert it to global offset inside file
if (num >= insize || num >= 0x1000000) { // xxx:
infile_ptr -= 4;
ct1[*infile_ptr] = 1;
} else {
count -= 4;
num = byteswap(num);
memcpy(infile_ptr - 4, &num, 4);
(*ctn)++;
memcpy(infile_ptr - 4, &num, 4); // substitute jmp/call offset with global offset
(*ctn)++; // update substitution counter
memcpy(buf_ptr, &infile_ptr, sizeof(buf_ptr));
buf_ptr += sizeof(buf_ptr);
}