Any plan to unify marker between x86 and x64 versions?

x64 version issues
Post Reply
dje
Posts: 5
Joined: Wed Jun 20, 2012 8:49 am

Any plan to unify marker between x86 and x64 versions?

Post by dje »

Hello,

I'm evaluating Enigma Protector to protect x86 and x64 versions of the same application.
The tool seems great, but I've been a little bit confused by the differences between the x86 and x64 package SDKs.
The x64 package looks fine (and seems already compatible with the x86 version as I can include enigma_ide64.h in both x86 and x64 projects without any issue) but the x86 way of using marker (#include instead of EP_Marker) makes unified code quite confused.

For instance, if I want to put a VM marker in my code, I'm forced to do:

#ifdef _WIN64
EP_Marker("vm_end");
#else
#include "EnigmaSDK/VC/vm_end.inc"
#endif

Would it be possible to have the EP_Marker function integrated into enigma_ide.lib ?

Thanks,
Jerome
Enigma
Site Admin
Posts: 2939
Joined: Wed Aug 20, 2008 2:24 pm

Re: Any plan to unify marker between x86 and x64 versions?

Post by Enigma »

Jerome, unfortunately, there is such difference between x86 and x64.

#include "EnigmaSDK/VC/vm_end.inc" - is the good choice for x86 but it does not work in x64 at all, because Visual Studio does not allow to include inline assembler for x64 executables.

EP_Marker("vm_end"); - works well for x64, but it can't be used for x86. With this kind of marker Enigma Protector searches for a code inside the application where this function is being called (to find the marker start position). In the different implementation of C++ compilers, this way won't always work for x86. This is because we divided the ways how to use same functionality for x86 and x64.

Just curious (did not try it yet), won't your code work if place it into macro?

#ifdef _WIN64
EP_Marker("vm_end");
#else
#include "EnigmaSDK/VC/vm_end.inc"
#endif
dje
Posts: 5
Joined: Wed Jun 20, 2012 8:49 am

Re: Any plan to unify marker between x86 and x64 versions?

Post by dje »

Understood. Thanks for the answer.
Making a macro as you're suggesting is not supported by VC, it doesn't support "#include" in a macro with a macro parameter (as far as I know).
Another solution could be to provide for x64 the same include file set than for the x86 version (vm_begin.inc, etc.) with inside a call to EP_Marker instead of asm emit.
This way both x86 and x64 versions would have the same "code" (#include "vm_begin.inc") with different include paths.

x86 vm_begin.inc
__asm
{
_emit 0xEB
_emit 0x08
_emit 0x56
_emit 0x4D
_emit 0x42
_emit 0x45
_emit 0x47
_emit 0x49
_emit 0x4E
_emit 0x00
}

x64 vm_begin.inc
EP_Marker("vm_begin");
Enigma
Site Admin
Posts: 2939
Joined: Wed Aug 20, 2008 2:24 pm

Re: Any plan to unify marker between x86 and x64 versions?

Post by Enigma »

Yes, thanks, that can be a workaround.

The one disadvantage I see there, is using of include file for x64.

Imagine, for x86 it requires only to add only the string to the code:

Code: Select all

#include "EnigmaSDK/VC/vm_begin.inc"
But for x64, you will have to add a .lib file definition to each .c module that calls this marker. Otherwise, VC won't find definition of EP_Marker function.

Anyway, this is good idea, we may incorporate both solutions (current and your's one, using .inc file for x64). Users will choose the preferred for their needs.
dje
Posts: 5
Joined: Wed Jun 20, 2012 8:49 am

Re: Any plan to unify marker between x86 and x64 versions?

Post by dje »

Great, it will improve integration (especially for people like me who are doing win32 cross-platform applications using the same source codes).
Post Reply