1
votes

I need to communicate with a legacy software wrote in Visual Basic 6 to launch a report (with output in pdf format) from a .net application (using full framework 4.5). I have to istantiate an ActiveX COM Dll that internally use COM Crystal Report 11 runtime objects.

My .net application (which project target x86 platform) instantiate COM Dll "MyInterop.dll" which contains the class "Ambient" that runs the job.. do something like this (simplified code):

Type type = Type.GetTypeFromProgID("MyInterop.Ambient", true);
printerObj = Activator.CreateInstance(type);
printerObj.init();
printerObj.print();

If I run the application on a desktop system (in my case on Windows 8.1) everything works well!

If I move application on a Windows Server 2012 R2 (but I tried with a Windows Server 2016 too) it crashes! I can not get a detailed error, I get "vshost32.exe has stopped working".

It's not easy to debug but It seems to crash when, in the code contained in the COM dll, attempt to read the report query string:

query = CRAXDRT.Report.SQLQueryString

(aobut CRAXDRT, I found on Dll Com Project a reference to "Program Files (x86)\Common Files\Business Objects\3.0\bin\craxdrt.dll#Crystal Reports ActiveX Designer Run Time Library 11.0")

I cannot understand why, on a windows server system, the attempt to read the query string causes the application crash.. I do not know where to search information.. any suggestion is very welcome

Thanks in advance

1
I found the cause of the problem: Windows Data Execution Prevention (DEP)!but now when I try to add my program to DEP exceptions it returns a message that says that I can't disable it for that application: There's a way to force DEP disabled for a specific .net application?girtri

1 Answers

0
votes

Finally I found the solution:

1) first I have to modify exe binary of my .net application with this command (from VS cmd prompt): editbin.exe /NXCOMPAT:NO [my binary path]
2) add the exe to the DEP exceptions (on Advanced System settings-> Performance option-> Data Execution Prevention)

Then it works!