Page 1 of 2
Reg markers
Posted: Fri Jan 11, 2013 7:44 am
by ck_
Hello.
I'm playing with Enigma demo 3.110
Here is the problem:
Code: Select all
int foo(..) { cout << "foo()\n"; ... }
int bar(..) { cout << "bar()\n"; ... }
int main(..)
{
int (*action)(int, char**);
# include <EnigmaSDK/VC/unreg_crypt_begin1.inc>
action = foo;
cout << "unreg section" << endl;
# include <EnigmaSDK/VC/unreg_crypt_end1.inc>
# include <EnigmaSDK/VC/reg_crypt_begin1.inc>
action = bar;
cout << "reg section" << endl;
# include <EnigmaSDK/VC/reg_crypt_end1.inc>
return action(argc, argv);
}
As I understand, in unregistered version I will see:
unreg section
foo()
and in registered:
reg section
bar()
But actually I see the following in unregistered app:
unreg section
bar()
How this possible, I thought only one of the sections will be executed?
Thanks.
Re: Reg markers
Posted: Fri Jan 11, 2013 10:56 am
by Enigma
Hi ck_,
The code between RegCrypt1 marker will be run only if the registration key, with which program is registered, unlocks the section #1 (see crypted sections in keys generator).
In your case, I assume, the key does not unlock this section and so the code is not executed.
Re: Reg markers
Posted: Fri Jan 11, 2013 11:16 am
by ck_
but it calls
Code: Select all
cout << "unreg section" << endl; // correct
bar(); // incorrect (here foo() must be called)
and I expect:
Code: Select all
cout << "unreg section" << endl;
foo();
Behaviour is strange. If all sections is called then it must display both "unreg section" and "reg section", but it displays "unreg section" which means what reg section is not executed. But why it calls bar() from registered section instead of foo() from unregistered section?
Code: Select all
# include <EnigmaSDK/VC/reg_crypt_begin1.inc>
action = bar; <-- this line executes, but must be skipped
cout << "reg section" << endl; <-- this line skipped - correct
# include <EnigmaSDK/VC/reg_crypt_end1.inc>
Note: I run app without registration.
Re: Reg markers
Posted: Fri Jan 11, 2013 11:42 am
by Enigma
I think this happen due to compiler optimization. Since action variable is being assigned two times, compiler optimizes first assignment and just eliminates it. This exactly explain the behavior you have.
Please take a look at page:
http://msdn.microsoft.com/en-us/library/chh3fb0k.aspx
there is written how to avoid optimization for a particular code.
Re: Reg markers
Posted: Fri Jan 11, 2013 12:13 pm
by ck_
You a right. With disabled optimizations code works as expected. My mistake here is what I thought about begin/end includes as about "scopes" not just plain inline instructions. Anyway thanks for the solution.
PS. There is a typo in the External files checkup dialog: "The installation package had
beed modified!", you probably means "The installation package had
been modified!". Also watermark panel UI is messed up a little; screenshot:
http://screencast.com/t/BLBxJNKC. Maybe this is a Demo "feature"
PPS Is it possible to use relative paths for files? For example, for input files, virtual box files, etc? If not - would be good to have.
Re: Reg markers
Posted: Fri Jan 11, 2013 2:34 pm
by Enigma
ck_ wrote:You a right. With disabled optimizations code works as expected. My mistake here is what I thought about begin/end includes as about "scopes" not just plain inline instructions. Anyway thanks for the solution.
That's good. Unfortunately, nothing we can do with MS compiler that sometimes applies hard code optimization, of course, except disabling of it.
ck_ wrote:PS. There is a typo in the External files checkup dialog: "The installation package had beed modified!", you probably means "The installation package had been modified!".
Thanks you for the point, that's correct! My apologies due to that..
ck_ wrote:PPS Is it possible to use relative paths for files? For example, for input files, virtual box files, etc? If not - would be good to have.
Sure, it is possible to use relative paths. It is good designed for Virtual Box feature and yet more bad for External Files.
For Virtual Box you may set the Root folder, then, based on this, specify any relative one. If you need to add files on a one or more folders over the root, then add a folder with the name ".." (just two dots) to it.
For External Files, there is a special column named Relative Path where you may enter it.
Re: Reg markers
Posted: Fri Jan 11, 2013 2:51 pm
by ck_
Enigma wrote:
Sure, it is possible to use relative paths. It is good designed for Virtual Box feature and yet more bad for External Files.
For Virtual Box you may set the Root folder, then, based on this, specify any relative one. If you need to add files on a one or more folders over the root, then add a folder with the name ".." (just two dots) to it.
For External Files, there is a special column named Relative Path where you may enter it.
I mean does it work for input files? For example in input panel can I specify relative path to the protecting file?
Or in EVB panel set input paths as relative?
I just checked EVB - can't set relative input path.
http://screencast.com/t/ccteBvR1kdqt.
it would be cool to have this feature, because folder with needed files may be safely copied to a different locations.
Re: Reg markers
Posted: Fri Jan 11, 2013 3:22 pm
by Enigma
Ah, yes, this does make sense. It is possible to make, just there is some problem with the interface which does not allow to do that in some cases.
When you click OK in the file property dialog, it may apply the relative path if the current folder of the GUI is set properly.
For eg, within one session, create a new project and save the project file. Then edit the file properties and set the relative path (relative to the path where the project file is located). Then save project file and use console version to pack it. It's just a temporary solution, necessary changes will be made to GUI version to solve this problem.
Re: Reg markers
Posted: Fri Jan 11, 2013 3:35 pm
by ck_
OK, I understand you - just update paths manually with text editor.
Thanks for answers!
Overall enigma seems interesting solution

Re: Reg markers
Posted: Sun Jan 13, 2013 1:24 pm
by Enigma
Thanks you for the suggestions, I'm sure, all of them will be implemented/solved in the next version update!