-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Ghidra:
int __cdecl16far main(int argc,char **argv, char **envp)
{
byte bVar1;
uint uVar2;
char *unaff_DS;
char *pcVar3;
int iVar4;
_aFchkstk();
pcVar3 = unaff_DS;
_printf((char *)0x1010);
if (argc < 2) goto LAB_1292_0069;
pcVar3 = argv[3];
uVar2 = _strlen(argv[2]);
if (uVar2 != 1) goto LAB_1292_0069;
bVar1 = **(byte **)(argv + 2);
if (bVar1 == 100) {
LAB_1292_00a7:
pcVar3 = (char *)0x1;
}
else {
if (100 < bVar1) goto LAB_1292_0069;
if (bVar1 != 0x43) {
if (bVar1 == 0x44) goto LAB_1292_00a7;
if (bVar1 != 99) goto LAB_1292_0069;
}
pcVar3 = (char *)0x0;
}
LAB_1292_0069:
if ((pcVar3 == (char *)0xffff) || (argc < 3)) {
show_usage((int)pcVar3);
_exit(1);
}
pcVar3 = argv[5];
strcpy((char *)0x4acc,unaff_DS);
for (iVar4 = 3; iVar4 < argc; iVar4 = iVar4 + 1) {
_strcat((char *)0x4acc,unaff_DS);
pcVar3 = argv[iVar4 * 2 + 1];
_strcat((char *)0x4acc,unaff_DS);
}
if (pcVar3 == (char *)0x0) {
iVar4 = dcs_decompress(0x4acc);
}
else {
iVar4 = dcs_compress(0x4acc);
}
return iVar4;
}
BLC:
void _main(__uint16 param_1, int16_t param_2, __uint32 param_3)
{
uint8_t uVar1;
int16_t iVar2;
int16_t iVar3;
__uint16 xVar4;
int16_t unaff_DS;
int16_t iVar5;
__aFchkstk();
_printf(0x13c8, 0x1010);
iVar3 = (int16_t)param_3;
xVar4 = (__uint16)((uint32_t)param_3 >> 0x10);
if (param_2 < 2) {
goto loc_12989;
}
unaff_DS = *(int16_t*)(iVar3 + 6);
iVar2 = _strlen(0x13c8, *(__uint16*)(iVar3 + 4));
if (iVar2 != 1) {
goto loc_12989;
}
uVar1 = **(uint8_t**)(iVar3 + 4);
if (uVar1 == 100) {
loc_129C7:
unaff_DS = 1;
}
else {
if (100 < uVar1) {
goto loc_12989;
}
if (uVar1 != 0x43) {
if (uVar1 == 0x44) {
goto loc_129C7;
}
if (uVar1 != 99) {
goto loc_12989;
}
}
unaff_DS = 0;
}
loc_12989:
if ((unaff_DS == -1) || (param_2 < 3)) {
show_usage(0x13c8, unaff_DS);
_exit(0x1000, 1);
}
iVar2 = *(int16_t*)(iVar3 + 10);
_strcpy(0x13c8, 0x4acc);
iVar5 = 3;
iVar5 < param_2;
iVar5 = iVar5 + 1;
_strcat(0x13c8, 0x4acc);
iVar2 = *(int16_t*)(iVar5 * 4 + iVar3 + 2);
_strcat(0x13c8, 0x4acc);
if (iVar2 == 0) {
dcs_decompress(0x13c8, 0x4acc);
}
else {
dcs_compress(0x13c8, 0x4acc);
}
return;
}
Not having the main and string function signatures and parameters as defined in IDA disassembly I think it hurting the decomp process.
Seems to be missing an obvious loop too.
This is for a DOS 16 Real mode EXE binary. See EXE here
Metadata
Metadata
Assignees
Labels
No labels