Not Protect API
-
- Posts: 13
- Joined: Mon Nov 26, 2012 8:07 am
Not Protect API
My .Net application using ApplicationSettingsBase (a class on the System.Coniguration namespace of .NET) to save user data to user scoped folder. All process is completly successfull when there's no protection on the exe. But if I protect the exe with Enigma protect button from Enigma GUI then saving of application settings is impossible. I think protection code can not handle this class's save method.
I know, I can get this codes an external c# dll and make unprotected this dll. In this way application settings will be saved but my software architecture and OOP design will be broken.
Is there any Enigma API or a code technique which can bypass some piece of code while protecting an exe?
All exe code must be protect without this special marked piece of code.
Any suggestion please?
I know, I can get this codes an external c# dll and make unprotected this dll. In this way application settings will be saved but my software architecture and OOP design will be broken.
Is there any Enigma API or a code technique which can bypass some piece of code while protecting an exe?
All exe code must be protect without this special marked piece of code.
Any suggestion please?
Re: Not Protect API
To my mind, the problem happens not due to incompatibility with the protection. Probably, there are some settings in the .config file that your application uses. Eg, if your application names app.exe, then there can be a file app.exe.config.
After you protect the exe, the name of your app changes to app_protected.exe and it is unable to find the config.
Try to rename protected app back to app.exe and check if it will fix the problem.
If nothing helps, can you please let me know what method exactly fails? And can you please make some sample for testing?
After you protect the exe, the name of your app changes to app_protected.exe and it is unable to find the config.
Try to rename protected app back to app.exe and check if it will fix the problem.
If nothing helps, can you please let me know what method exactly fails? And can you please make some sample for testing?
-
- Posts: 13
- Joined: Mon Nov 26, 2012 8:07 am
Re: Not Protect API
I renamed the exe but again no way to save application settings.
Re: Not Protect API
OK, can you please make some exe sample that demonstrates the problem and send it to support@enigmaprotector.com?
We will check it out what is wrong there.
We will check it out what is wrong there.
-
- Posts: 13
- Joined: Mon Nov 26, 2012 8:07 am
Re: Not Protect API
I send an application and some codes to support@enigmaprotector.com.
E-mail subject is ApplicationSettingsBase saving problem.
E-mail subject is ApplicationSettingsBase saving problem.
-
- Posts: 13
- Joined: Mon Nov 26, 2012 8:07 am
Re: Not Protect API
Stage of the decision-making for buying Enigma...
Can you analyze my sample? Can you explain me what's going wrong with my Enigma protected application?
Can you analyze my sample? Can you explain me what's going wrong with my Enigma protected application?
Re: Not Protect API
Please excuse me for the delay, the sample will be analyzed today.
Re: Not Protect API
This is a known limitation, problem, that can't be solved from our side, but there is a workaround.
In the project properties you should add a post build option
as written in this post:
http://forum.enigmaprotector.com/viewto ... f=6&t=1789
After compilation of your application, you will get two main files bugtest.exe and bugtest.xmlserializers.dll. You should protect the file bugtest.exe, and note, output name of protected file also should be bugtest.exe and not bugtest_protected.exe as Enigma Protector assigns by default. bugtest.xmlserializers.dll should also be distributed with your application, or, the better way, you may use Virtual Box - Files feature and add this dll to the %DEFAULT FOLDER%, in this case protection will link this dll to the protected file.
In the project properties you should add a post build option
Code: Select all
“$(FrameworkSDKDir)\Bin\sgen” /a:"$(TargetPath)" /force
http://forum.enigmaprotector.com/viewto ... f=6&t=1789
After compilation of your application, you will get two main files bugtest.exe and bugtest.xmlserializers.dll. You should protect the file bugtest.exe, and note, output name of protected file also should be bugtest.exe and not bugtest_protected.exe as Enigma Protector assigns by default. bugtest.xmlserializers.dll should also be distributed with your application, or, the better way, you may use Virtual Box - Files feature and add this dll to the %DEFAULT FOLDER%, in this case protection will link this dll to the protected file.
-
- Posts: 13
- Joined: Mon Nov 26, 2012 8:07 am
Re: Not Protect API
Hi Enigma,
I made all things that you said and my e-mail application (BugTest.exe) worked well and read/write to user config file is succesfull.
But my real application is saving some values from a dll and from a main exe (BugTest.exe). In this case, I adapted BugTest.exe to simulate my real application but then some problems occured again:
1) My application have two executables: BugTest.exe and MyLibrary.dll
2) BugTest.exe uses MyLibrary.dll and referenced it.
3) If I protect only Bugtest.exe, not protect MyLibrary.dll then evertyhing is ok with application.
4) If I protect BugTest.exe (using "Input" option from Enigma GUI) and Mylibrary.dll (using "Advanced Input" option from Enigma GUI) separately and when saving user data, Application crashes.
5) If I first merge Bugtest.exe and MyLibrary.dll with ILmerge tool (from MS) and then protect this merged Bugtest.exe then application is ok but Again user data will not be saved correctly.
What's your suggestion? I want to protect also MyLibrary.dll with enigma but when I try to protect it my applications functionalty is broken. I really want to use your product but without this headache.
NOTE: I send a new Visual Studio application to support@enigmaprotector.com. You can check it to see my problem.
Thank you for your help again.
I made all things that you said and my e-mail application (BugTest.exe) worked well and read/write to user config file is succesfull.
But my real application is saving some values from a dll and from a main exe (BugTest.exe). In this case, I adapted BugTest.exe to simulate my real application but then some problems occured again:
1) My application have two executables: BugTest.exe and MyLibrary.dll
2) BugTest.exe uses MyLibrary.dll and referenced it.
3) If I protect only Bugtest.exe, not protect MyLibrary.dll then evertyhing is ok with application.
4) If I protect BugTest.exe (using "Input" option from Enigma GUI) and Mylibrary.dll (using "Advanced Input" option from Enigma GUI) separately and when saving user data, Application crashes.
5) If I first merge Bugtest.exe and MyLibrary.dll with ILmerge tool (from MS) and then protect this merged Bugtest.exe then application is ok but Again user data will not be saved correctly.
What's your suggestion? I want to protect also MyLibrary.dll with enigma but when I try to protect it my applications functionalty is broken. I really want to use your product but without this headache.
NOTE: I send a new Visual Studio application to support@enigmaprotector.com. You can check it to see my problem.
Thank you for your help again.
Re: Not Protect API
Hi Poseidon77,
No, your steps are not correct.
Firstly, note, that Enigma Protector does not support protection .NET dll files, so putting .NET dll into Advanced Files tab will make this dll damaged. This is a specific of .NET dll files and nothing can be done there.
You should add your dll into Virtual Box - Files feature, in the %DEFAULT FOLDER%.
But this also won't work for you. It will work only if you also enable all options on Virtual Box - Options tab.
Let me explain what and why is failing there. When .NET application saves your options to the file, it calls xml serializer, to build an xml file. No ideas why, but it can't just save the options to the xml file. Instead, your .NET application creates a special .cs class for xml serialization and call C# compiler csc.exe. After compilation, you will get the .NET dll that will be called and it will save data to xml file. All is looking well there, but csc.exe requires a main exe file as a parameter for compilation. After protection, main file becomes to look as unmanaged file and not managed, and csc.exe does not accept it and so does not compile the class. That's because protected application does not work.
When you move the part of code to external dll, this dll is carried to the parameter to csc.exe and it succeeds with the compilation. This is because this dll should be added to virtual box, and also the options "Share Virtual System to Child Processes" should be enabled (otherwise, csc.exe won't get this dll and will also fail).
I do not like the idea of Microsoft, when csc.exe compiler runs while application works. It would be faster and better if you won't carry your code to external dll. Keep everything in the single exe file. Instead, create a "bugtest.xmlserializers.dll" with the way I described you. Then, protect your exe and add this "bugtest.xmlserializers.dll" into Virtual Box - Files tree (no need to enable specific options on Virtual Box - Options panel, keep it default). In this case, protected application won't call csc.exe compiler at runtime and protected application will be working well.
No, your steps are not correct.
Firstly, note, that Enigma Protector does not support protection .NET dll files, so putting .NET dll into Advanced Files tab will make this dll damaged. This is a specific of .NET dll files and nothing can be done there.
You should add your dll into Virtual Box - Files feature, in the %DEFAULT FOLDER%.
But this also won't work for you. It will work only if you also enable all options on Virtual Box - Options tab.
Let me explain what and why is failing there. When .NET application saves your options to the file, it calls xml serializer, to build an xml file. No ideas why, but it can't just save the options to the xml file. Instead, your .NET application creates a special .cs class for xml serialization and call C# compiler csc.exe. After compilation, you will get the .NET dll that will be called and it will save data to xml file. All is looking well there, but csc.exe requires a main exe file as a parameter for compilation. After protection, main file becomes to look as unmanaged file and not managed, and csc.exe does not accept it and so does not compile the class. That's because protected application does not work.
When you move the part of code to external dll, this dll is carried to the parameter to csc.exe and it succeeds with the compilation. This is because this dll should be added to virtual box, and also the options "Share Virtual System to Child Processes" should be enabled (otherwise, csc.exe won't get this dll and will also fail).
I do not like the idea of Microsoft, when csc.exe compiler runs while application works. It would be faster and better if you won't carry your code to external dll. Keep everything in the single exe file. Instead, create a "bugtest.xmlserializers.dll" with the way I described you. Then, protect your exe and add this "bugtest.xmlserializers.dll" into Virtual Box - Files tree (no need to enable specific options on Virtual Box - Options panel, keep it default). In this case, protected application won't call csc.exe compiler at runtime and protected application will be working well.