Untitled
unknown
c_cpp
a year ago
15 kB
20
Indexable
undefined4 __thiscall DecryptBMD(void *this,CHAR *folder,char *fileName,char param_3)
{
short sVar1;
longlong lVar2;
char cVar3;
undefined4 uVar4;
FILE *_File;
undefined *puVar5;
int iVar6;
undefined4 *puVar7;
int iVar8;
uint uVar9;
void *pvVar10;
undefined LEA_KEY [772];
char local_170 [64];
undefined4 local_130;
void *idk;
void *local_128;
undefined4 local_124;
undefined4 local_120;
undefined4 local_11c;
undefined4 local_118;
undefined4 local_114;
undefined4 local_110;
int local_10c;
undefined4 local_108;
undefined4 local_104;
undefined4 local_100;
undefined4 local_fc;
undefined4 local_f8;
int local_f4;
undefined4 local_f0;
undefined4 local_ec;
undefined4 local_e8;
undefined4 local_e4;
undefined4 local_e0;
int local_dc;
void *local_d8;
void *decryptedBuffer;
void *local_d0;
void *local_cc;
undefined4 local_c8;
void *local_c4;
void *local_c0;
undefined local_bc [8];
void *local_b4;
undefined4 local_b0;
void *local_ac;
int local_a8;
uint local_a4;
uint local_a0;
uint local_9c;
uint local_98;
uint local_94;
int local_90;
uint local_8c;
uint local_88;
void *local_84;
undefined4 decryptedSize;
void *local_7c;
undefined4 local_78;
undefined4 local_74;
size_t LENGHT;
int local_6c;
byte mk [32];
int local_44;
int local_40;
int local_3c;
int local_28;
void *encryptedBuffer;
int local_14;
void *local_10;
undefined *puStack_c;
undefined4 local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_01a28514;
local_10 = ExceptionList;
if (param_3 == 1) {
ExceptionList = &local_10;
FUN_013df841();
FUN_0199d8d0(local_170,folder);
FUN_0199d8e0(local_170,fileName);
_File = _fopen(local_170,"rb");
if (_File == (FILE *)0x0) {
uVar4 = 0;
}
else {
_fseek(_File,0,2);
LENGHT = len(_File);
_fseek(_File,0,0);
encryptedBuffer = (void *)create_buffer(LENGHT);
idk = encryptedBuffer;
_fread(encryptedBuffer,1,LENGHT,_File);
_fclose(_File);
*(undefined *)((int)this + 0x20) = *(undefined *)((int)encryptedBuffer + 3);
local_14 = 4;
if (*(char *)((int)this + 0x20) == 12) {
local_74 = *(undefined4 *)((int)encryptedBuffer + 4);
local_130 = FUN_00997e52(0,(int)encryptedBuffer + 8,local_74);
local_c0 = (void *)create_buffer(local_130);
local_b4 = local_c0;
FUN_00997e52(local_c0,(int)encryptedBuffer + 8,local_74);
local_c4 = encryptedBuffer;
FID_conflict:_free(encryptedBuffer);
encryptedBuffer = local_b4;
local_14 = 0;
}
else if (*(char *)((int)this + 0x20) == 14) {
local_78 = *(undefined4 *)((int)encryptedBuffer + 4);
local_c8 = FUN_017711fa(0,(int)encryptedBuffer + 8,local_78);
local_cc = (void *)create_buffer(local_c8);
local_7c = local_cc;
FUN_017711fa(local_cc,(int)encryptedBuffer + 8,local_78);
local_d0 = encryptedBuffer;
FID_conflict:_free(encryptedBuffer);
encryptedBuffer = local_7c;
local_14 = 0;
}
else if (*(char *)((int)this + 0x20) == 15) {
mk[0] = 0xcc;
mk[1] = 0x50;
mk[2] = 0x45;
mk[3] = 0x13;
mk[4] = 0xc2;
mk[5] = 0xa6;
mk[6] = 0x57;
mk[7] = 0x4e;
mk[8] = 0xd6;
mk[9] = 0x9a;
mk[10] = 0x45;
mk[0xb] = 0x89;
mk[0xc] = 0xbf;
mk[0xd] = 0x2f;
mk[0xe] = 0xbc;
mk[0xf] = 0xd9;
mk[0x10] = 0x39;
mk[0x11] = 0xb3;
mk[0x12] = 0xb3;
mk[0x13] = 0xbd;
mk[0x14] = 0x50;
mk[0x15] = 0xbd;
mk[0x16] = 0xcc;
mk[0x17] = 0xb6;
mk[0x18] = 0x85;
mk[0x19] = 0x46;
mk[0x1a] = 0xd1;
mk[0x1b] = 0xd6;
mk[0x1c] = 0x16;
mk[0x1d] = 0x54;
mk[0x1e] = 0xe0;
mk[0x1f] = 0x87;
LEA_roundkeyGen(LEA_KEY,mk,0x20);
decryptedSize = *(undefined4 *)((int)encryptedBuffer + 4);
decryptedBuffer = (void *)create_buffer(decryptedSize);
local_84 = decryptedBuffer;
DecryptWIthLea(decryptedBuffer,(int)encryptedBuffer + 8,decryptedSize,LEA_KEY);
if (encryptedBuffer != (void *)0x0) {
local_d8 = encryptedBuffer;
FID_conflict:_free(encryptedBuffer);
}
encryptedBuffer = local_84;
local_14 = 0;
}
FUN_01971170(this,(int)encryptedBuffer + local_14,0x20);
*(undefined2 *)((int)this + 0x24) = *(undefined2 *)((int)encryptedBuffer + local_14 + 0x20);
*(undefined2 *)((int)this + 0x22) = *(undefined2 *)((int)encryptedBuffer + local_14 + 0x22);
*(undefined2 *)((int)this + 0x26) = *(undefined2 *)((int)encryptedBuffer + local_14 + 0x24);
local_14 = local_14 + 0x26;
if (*(short *)((int)this + 0x24) < 1) {
local_88 = 1;
}
else {
local_88 = (uint)*(short *)((int)this + 0x24);
}
local_8c = local_88;
local_6c = create_buffer(-(uint)((int)((ulonglong)local_88 * 0x20 >> 0x20) != 0) |
(uint)((ulonglong)local_88 * 0x20));
local_8 = 0;
if (local_6c == 0) {
local_90 = 0;
}
else {
FUN_009915cb(local_6c,0x20,local_8c,FUN_011567c9);
local_90 = local_6c;
}
local_dc = local_90;
local_8 = 0xffffffff;
*(int *)((int)this + 0x28) = local_90;
if (*(short *)((int)this + 0x22) < 1) {
local_94 = 1;
}
else {
local_94 = (uint)*(short *)((int)this + 0x22);
}
local_e0 = create_buffer(-(uint)((int)((ulonglong)local_94 * 0x8c >> 0x20) != 0) |
(uint)((ulonglong)local_94 * 0x8c));
*(undefined4 *)((int)this + 0x2c) = local_e0;
if (*(short *)((int)this + 0x26) < 1) {
local_98 = 1;
}
else {
local_98 = (uint)*(short *)((int)this + 0x26);
}
local_e4 = create_buffer(-(uint)((int)((ulonglong)local_98 * 0x10 >> 0x20) != 0) |
(uint)((ulonglong)local_98 * 0x10));
*(undefined4 *)((int)this + 0x30) = local_e4;
if (*(short *)((int)this + 0x24) < 1) {
local_9c = 1;
}
else {
local_9c = (uint)*(short *)((int)this + 0x24);
}
local_e8 = create_buffer(-(uint)((int)((ulonglong)local_9c * 0x20 >> 0x20) != 0) |
(uint)((ulonglong)local_9c * 0x20));
*(undefined4 *)((int)this + 0x34) = local_e8;
if (*(short *)((int)this + 0x24) < 1) {
local_a0 = 1;
}
else {
local_a0 = (uint)*(short *)((int)this + 0x24);
}
local_ec = create_buffer(-(uint)((int)((ulonglong)local_a0 * 4 >> 0x20) != 0) |
(uint)((ulonglong)local_a0 * 4));
*(undefined4 *)((int)this + 0x38) = local_ec;
if (*(short *)((int)this + 0x24) < 1) {
local_a4 = 1;
}
else {
local_a4 = (uint)*(short *)((int)this + 0x24);
}
local_f0 = create_buffer(-(uint)((int)((ulonglong)local_a4 * 4 >> 0x20) != 0) |
(uint)((ulonglong)local_a4 * 4));
*(undefined4 *)((int)this + 0x3c) = local_f0;
*(undefined4 *)((int)this + 0x40) = 0;
if (*(short *)((int)this + 0x24) < 1) {
local_a8 = 1;
}
else {
local_a8 = (int)*(short *)((int)this + 0x24);
}
local_f4 = local_a8;
local_f8 = 0;
FUN_0115674d(*(undefined4 *)((int)this + 0x3c),&local_f8,&local_f4);
for (local_28 = 0; local_28 < *(short *)((int)this + 0x24); local_28 = local_28 + 1) {
puVar5 = (undefined *)(local_28 * 0x20 + *(int *)((int)this + 0x28));
*(undefined2 *)(puVar5 + 4) = *(undefined2 *)((int)encryptedBuffer + local_14);
*(undefined2 *)(puVar5 + 6) = *(undefined2 *)((int)encryptedBuffer + local_14 + 2);
*(undefined2 *)(puVar5 + 8) = *(undefined2 *)((int)encryptedBuffer + local_14 + 4);
*(undefined2 *)(puVar5 + 10) = *(undefined2 *)((int)encryptedBuffer + local_14 + 6);
*(undefined2 *)(puVar5 + 2) = *(undefined2 *)((int)encryptedBuffer + local_14 + 8);
*puVar5 = 0;
local_fc = create_buffer(-(uint)((int)((ulonglong)(uint)(int)*(short *)(puVar5 + 4) * 0x10
>> 0x20) != 0) |
(uint)((ulonglong)(uint)(int)*(short *)(puVar5 + 4) * 0x10));
*(undefined4 *)(puVar5 + 0xc) = local_fc;
local_100 = create_buffer(-(uint)((int)((ulonglong)(uint)(int)*(short *)(puVar5 + 6) * 0x14
>> 0x20) != 0) |
(uint)((ulonglong)(uint)(int)*(short *)(puVar5 + 6) * 0x14));
*(undefined4 *)(puVar5 + 0x10) = local_100;
local_104 = create_buffer(-(uint)((int)((ulonglong)(uint)(int)*(short *)(puVar5 + 8) * 8 >>
0x20) != 0) |
(uint)((ulonglong)(uint)(int)*(short *)(puVar5 + 8) * 8));
*(undefined4 *)(puVar5 + 0x14) = local_104;
local_108 = create_buffer(-(uint)((int)((ulonglong)(uint)(int)*(short *)(puVar5 + 10) * 0x24
>> 0x20) != 0) |
(uint)((ulonglong)(uint)(int)*(short *)(puVar5 + 10) * 0x24));
*(undefined4 *)(puVar5 + 0x18) = local_108;
sVar1 = *(short *)(puVar5 + 4);
FUN_01971170(*(undefined4 *)(puVar5 + 0xc),(int)encryptedBuffer + local_14 + 10,sVar1 * 0x10
);
local_14 = local_14 + 10 + sVar1 * 0x10;
sVar1 = *(short *)(puVar5 + 6);
FUN_01971170(*(undefined4 *)(puVar5 + 0x10),(int)encryptedBuffer + local_14,sVar1 * 0x14);
local_14 = local_14 + sVar1 * 0x14;
sVar1 = *(short *)(puVar5 + 8);
FUN_01971170(*(undefined4 *)(puVar5 + 0x14),(int)encryptedBuffer + local_14,sVar1 * 8);
local_14 = local_14 + sVar1 * 8;
local_10c = 0x40;
for (local_44 = 0; local_44 < *(short *)(puVar5 + 10); local_44 = local_44 + 1) {
FUN_01971170(local_44 * 0x24 + *(int *)(puVar5 + 0x18),(int)encryptedBuffer + local_14,
0x24);
local_14 = local_14 + local_10c;
}
FUN_01971170(*(int *)((int)this + 0x34) + local_28 * 0x20,(int)encryptedBuffer + local_14,
0x20);
local_14 = local_14 + 0x20;
FUN_011567ac();
local_8 = 1;
cVar3 = FUN_012a4ea8(*(int *)((int)this + 0x34) + local_28 * 0x20);
if (cVar3 == '\0') {
*(undefined4 *)(puVar5 + 0x1c) = 0;
}
else {
local_ac = operator_new(5);
local_8._0_1_ = 2;
if (local_ac == (void *)0x0) {
local_b0 = 0;
}
else {
local_b0 = FUN_0115677c();
}
local_110 = local_b0;
local_8 = CONCAT31(local_8._1_3_,1);
*(undefined4 *)(puVar5 + 0x1c) = local_b0;
FUN_012a4e61(local_bc);
}
local_8 = 0xffffffff;
FUN_01156838();
}
for (local_28 = 0; local_28 < *(short *)((int)this + 0x26); local_28 = local_28 + 1) {
puVar5 = (undefined *)(local_28 * 0x10 + *(int *)((int)this + 0x30));
*puVar5 = 0;
*(undefined2 *)(puVar5 + 8) = *(undefined2 *)((int)encryptedBuffer + local_14);
puVar5[10] = *(undefined *)((int)encryptedBuffer + local_14 + 2);
local_14 = local_14 + 3;
if (puVar5[10] == '\0') {
*(undefined4 *)(puVar5 + 0xc) = 0;
}
else {
lVar2 = (ulonglong)
(-(uint)((int)((ulonglong)(uint)(int)*(short *)(puVar5 + 8) * 3 >> 0x20) != 0) |
(uint)((ulonglong)(uint)(int)*(short *)(puVar5 + 8) * 3)) * 4;
local_114 = create_buffer(-(uint)((int)((ulonglong)lVar2 >> 0x20) != 0) | (uint)lVar2);
*(undefined4 *)(puVar5 + 0xc) = local_114;
sVar1 = *(short *)(puVar5 + 8);
FUN_01971170(*(undefined4 *)(puVar5 + 0xc),(int)encryptedBuffer + local_14,sVar1 * 0xc);
local_14 = local_14 + sVar1 * 0xc;
}
}
for (local_28 = 0; local_28 < *(short *)((int)this + 0x22); local_28 = local_28 + 1) {
iVar6 = local_28 * 0x8c + *(int *)((int)this + 0x2c);
*(undefined *)(iVar6 + 0x22) = *(undefined *)((int)encryptedBuffer + local_14);
iVar8 = local_14 + 1;
if (*(char *)(iVar6 + 0x22) == '\0') {
FUN_01971170(iVar6,(int)encryptedBuffer + local_14 + 1,0x20);
*(undefined2 *)(iVar6 + 0x20) = *(undefined2 *)((int)encryptedBuffer + local_14 + 0x21);
local_14 = local_14 + 0x23;
lVar2 = (ulonglong)(uint)(int)*(short *)((int)this + 0x26) * 0xc;
local_118 = create_buffer(-(uint)((int)((ulonglong)lVar2 >> 0x20) != 0) | (uint)lVar2);
*(undefined4 *)(iVar6 + 0x24) = local_118;
for (local_3c = 0; iVar8 = local_14, local_3c < *(short *)((int)this + 0x26);
local_3c = local_3c + 1) {
puVar7 = (undefined4 *)(local_3c * 0xc + *(int *)(iVar6 + 0x24));
iVar8 = *(short *)(*(int *)((int)this + 0x30) + 8 + local_3c * 0x10) * 0xc;
uVar9 = (uint)*(short *)(*(int *)((int)this + 0x30) + 8 + local_3c * 0x10);
lVar2 = (ulonglong)
(-(uint)((int)((ulonglong)uVar9 * 3 >> 0x20) != 0) |
(uint)((ulonglong)uVar9 * 3)) * 4;
local_11c = create_buffer(-(uint)((int)((ulonglong)lVar2 >> 0x20) != 0) | (uint)lVar2);
*puVar7 = local_11c;
lVar2 = (ulonglong)
(-(uint)((int)((ulonglong)uVar9 * 3 >> 0x20) != 0) |
(uint)((ulonglong)uVar9 * 3)) * 4;
local_120 = create_buffer(-(uint)((int)((ulonglong)lVar2 >> 0x20) != 0) | (uint)lVar2);
puVar7[1] = local_120;
lVar2 = (ulonglong)
(-(uint)((int)((ulonglong)uVar9 * 4 >> 0x20) != 0) |
(uint)((ulonglong)uVar9 * 4)) * 4;
local_124 = create_buffer(-(uint)((int)((ulonglong)lVar2 >> 0x20) != 0) | (uint)lVar2);
puVar7[2] = local_124;
FUN_01971170(*puVar7,(int)encryptedBuffer + local_14,iVar8);
FUN_01971170(puVar7[1],(int)encryptedBuffer + local_14 + iVar8,iVar8);
local_14 = local_14 + iVar8 + iVar8;
for (local_40 = 0; local_40 < (int)uVar9; local_40 = local_40 + 1) {
FUN_00d8899c(local_40 * 0xc + puVar7[1],local_40 * 0x10 + puVar7[2]);
}
}
}
local_14 = iVar8;
}
local_128 = encryptedBuffer;
FID_conflict:_free(encryptedBuffer);
FUN_013de12a(0);
pvVar10 = _memset((void *)((int)this + 0xb6),-1,0x14);
uVar4 = CONCAT31((int3)((uint)pvVar10 >> 8),1);
}
}
else {
uVar4 = 1;
}
ExceptionList = local_10;
return uVar4;
}
Editor is loading...
Leave a Comment