refactor one if logic and fix two warning
This commit is contained in:
12
kpack_c.c
12
kpack_c.c
@@ -59,13 +59,13 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c
|
|||||||
unsigned char *buf_ptr = buf;
|
unsigned char *buf_ptr = buf;
|
||||||
do {
|
do {
|
||||||
//printf("infile_ptr = %p, count = %u\n", infile_ptr, count);
|
//printf("infile_ptr = %p, count = %u\n", infile_ptr, count);
|
||||||
unsigned al = *(infile_ptr++);
|
unsigned opcode = *(infile_ptr++);
|
||||||
al -= 0x0E8;
|
|
||||||
if (al > 1) { // if != E8 and != E9
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// E8 dword: call rel32
|
// E8 dword: call rel32
|
||||||
// E9 dword: jmp rel32
|
// E9 dword: jmp rel32
|
||||||
|
if (opcode > 0xE9)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (count < 5) {
|
if (count < 5) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c
|
|||||||
memcpy(tmp - 4, cti, 1);
|
memcpy(tmp - 4, cti, 1);
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
return (unsigned)tmp;
|
return 1;//(unsigned)tmp;
|
||||||
|
|
||||||
pack_calltrick_fail:
|
pack_calltrick_fail:
|
||||||
*ctn = 0;
|
*ctn = 0;
|
||||||
|
@@ -99,7 +99,7 @@ static void LZInWindow_Init(void)
|
|||||||
ReadBlock();
|
ReadBlock();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define LZInWindow_Create(a,b,c,d) /* nothing */
|
#define LZInWindow_Create(a,b,c,d) do {(void)(a); (void)(b); (void)(c); (void)(d);} while(0); /* nothing */
|
||||||
#define LZInWindow_Init() _buffer--, _pos++, _streamPos++
|
#define LZInWindow_Init() _buffer--, _pos++, _streamPos++
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user