MANSTIR: i think it can decompile using c decompiler... i've have 2 c & C++ decompiler.. we can see the source code.. HMM do u have any else suggestions?
The question is : how "usable" code are you going to get.
Metatrader ex4 p-code can be decopiled almost to the letter (except for the variable names). C code, if it does not contain debug info or it is not a .net assembly (p-code aggain), can not. Decompiler can produce a funny mixture of 10% C and the rest is assembler.
For illustration, what does the following C decompiled code do :
signed int __stdcall whatever(int a1, int a2, int a3, int a4, int a5, int a6, int a7, double a8, int a9, int a10, int a11, int a12, double a13, double a14)
{
int v14; // ebx@1
int v15; // edx@7
int v16; // ecx@7
__int64 v46; // [sp+0h] @7
__int64 v49; // [sp+10h] @7
v14 = a5;
__asm
{
fld [ebp+arg_1C]
fld [ebp+arg_34]
}
if ( a1 == 1 & a2 < a4 && a3 < a4 )
{
__asm
{
fld ds:flt_6154F018
fld st(1)
fsub st, st(3)
fxch st(1)
fmul [ebp+arg_3C]
fucom st(1)
fnstsw ax
fstp st(1)
sahf
}
if ( _CF | _ZF )
{
__asm
{
fxch st(2)
fsubrp st(1), st
fxch st(1)
fucompp
fnstsw ax
sahf
}
if ( _CF | _ZF )
goto LABEL_7;
}
else
{
__asm
{
fstp st
fstp st
fstp st
}
}
return 0;
}
__asm
{
fstp st
fstp st
}
LABEL_7:
__asm { fild [ebp+arg_18] }
*((_DWORD *)&v46 + 1) = a5;
__asm
{
fild dword ptr [esp+20h+anonymous_0+4]
fxch st(1)
}
*((_DWORD *)&v46 + 1) = a7 / a5;
__asm
{
fstp [ebp+var_1C]
fild dword ptr [esp+20h+anonymous_0+4]
fxch st(1)
fstp [ebp+var_C]
fst qword ptr [esp]
fstp [ebp+var_14]
}
floor(a4, a7 % a5);
__asm { fmul [ebp+var_C] }
v16 = v46;
__asm
{
fld [ebp+var_1C]
fsubrp st(1), st
fld1
fxch st(1)
fucom st(1)
fnstsw ax
fstp st(1)
fstp [ebp+var_1C]
sahf
}
if ( !_CF )
{
v46 = v49;
floor(v16, v15);
__asm
{
fstp st
fld [ebp+var_1C]
}
*((_DWORD *)&v46 + 1) = v14 - 1;
__asm
{
fild dword ptr [esp+20h+anonymous_0+4]
fucompp
fnstsw ax
sahf
}
if ( !_CF )
return 0;
}
return 1;
}
There are people that use assembler on a regular base, and, even them will have some problem "reading" this code. Code decompiled in this way, is, more or less, useless for further working.
As for protecting EAs from a dll (meaning executing on an authorized machine only and similar), there is a trick or two still left in sleeves, and it can be done, decompiled or not. Is anybody going to show the way how to do it : of course, anybody that knows how is rushing to show it to everybody that would like to remove that protection
You could write the EA as DLL en compile the code with a high encryption algorithm. That's one way .
excellent answer, this works
You could write the EA as DLL en compile the code with a high encryption algorithm. That's one way .
i think it can decompile using c decompiler... i've have 2 c & C++ decompiler.. we can see the source code.. HMM do u have any else suggestions?
i think it can decompile using c decompiler... i've have 2 c & C++ decompiler.. we can see the source code.. HMM do u have any else suggestions?
Of course, one of the best.
Members could send/sell signals using our new service: https://www.mql5.com/en/forum/178803/page27 keeping the code secure on his computer
Of "decompiling" and decompiling
Of course that everything can be "decompiled".
The question is : how "usable" code are you going to get.
Metatrader ex4 p-code can be decopiled almost to the letter (except for the variable names). C code, if it does not contain debug info or it is not a .net assembly (p-code aggain), can not. Decompiler can produce a funny mixture of 10% C and the rest is assembler.
For illustration, what does the following C decompiled code do :
signed int __stdcall whatever(int a1, int a2, int a3, int a4, int a5, int a6, int a7, double a8, int a9, int a10, int a11, int a12, double a13, double a14)
{
int v14; // ebx@1
int v15; // edx@7
int v16; // ecx@7
__int64 v46; // [sp+0h] @7
__int64 v49; // [sp+10h] @7
v14 = a5;
__asm
{
fld [ebp+arg_1C]
fld [ebp+arg_34]
}
if ( a1 == 1 & a2 < a4 && a3 < a4 )
{
__asm
{
fld ds:flt_6154F018
fld st(1)
fsub st, st(3)
fxch st(1)
fmul [ebp+arg_3C]
fucom st(1)
fnstsw ax
fstp st(1)
sahf
}
if ( _CF | _ZF )
{
__asm
{
fxch st(2)
fsubrp st(1), st
fxch st(1)
fucompp
fnstsw ax
sahf
}
if ( _CF | _ZF )
goto LABEL_7;
}
else
{
__asm
{
fstp st
fstp st
fstp st
}
}
return 0;
}
__asm
{
fstp st
fstp st
}
LABEL_7:
__asm { fild [ebp+arg_18] }
*((_DWORD *)&v46 + 1) = a5;
__asm
{
fild dword ptr [esp+20h+anonymous_0+4]
fxch st(1)
}
*((_DWORD *)&v46 + 1) = a7 / a5;
__asm
{
fstp [ebp+var_1C]
fild dword ptr [esp+20h+anonymous_0+4]
fxch st(1)
fstp [ebp+var_C]
fst qword ptr [esp]
fstp [ebp+var_14]
}
floor(a4, a7 % a5);
__asm { fmul [ebp+var_C] }
v16 = v46;
__asm
{
fld [ebp+var_1C]
fsubrp st(1), st
fld1
fxch st(1)
fucom st(1)
fnstsw ax
fstp st(1)
fstp [ebp+var_1C]
sahf
}
if ( !_CF )
{
v46 = v49;
floor(v16, v15);
__asm
{
fstp st
fld [ebp+var_1C]
}
*((_DWORD *)&v46 + 1) = v14 - 1;
__asm
{
fild dword ptr [esp+20h+anonymous_0+4]
fucompp
fnstsw ax
sahf
}
if ( !_CF )
return 0;
}
return 1;
}
There are people that use assembler on a regular base, and, even them will have some problem "reading" this code. Code decompiled in this way, is, more or less, useless for further working.
As for protecting EAs from a dll (meaning executing on an authorized machine only and similar), there is a trick or two still left in sleeves, and it can be done, decompiled or not. Is anybody going to show the way how to do it : of course, anybody that knows how is rushing to show it to everybody that would like to remove that protection

Happy decompiling
hehhehe agreed
... Happy decompiling
Happy Olly decompiling
