Page 1 of 1

Problem with protected x64 DLL

PostPosted: Fri Jul 03, 2015 2:15 am
by mqsymth
I protected my 64bit DLL with Enigma x64. When it was loaded by the platform Multicharts64, it caused the program to crash immediately with an empty message box with a big red X on my win7. On my win8.1 32/64 laptop below is the exception generated. The unprotected DLL ran fine on the same MultiCharts64 platform. In addition, I have a 32bit version of this DLL. The protected 32bit DLL ran fine on the 32bit TradeStation 9.5 platform.

The 64bit DLL was constructed using VC++2012 with thread classes

Attached is the enigma64 file that I used. I had to take out the dot in the file because it would not upload with this msg

Is there another option I should check or uncheck when I protect the DLL?
==================================================================
Below is the error MC64 generated on my win8.1 32/64 laptop

<<EXCEPTION>>
Code: 0xFFFFFFFF80000001 ( -2147483647 )
Continuable: 0x0000000000000000 ( 0 )
Description: {EXCEPTION} Guard Page Exception A page of memory that marks the end of a data Structure,
such as a stack or an array, has been accessed.
ErrorCode: 0xFFFFFFFF80000001 ( -2147483647 )
ExceptionType: 0x0000000000000000 ( 0 )
Module: C:\Program Files\TS Support\MultiCharts64\1pwfov4x64tpb.dll
Process: C:\Program Files\TS Support\MultiCharts64\MultiCharts64.exe
Thread ID: 0x0000000000000570 ( 1392 )
Time: 03.07.2015 - 13:54:08.393
===============================================================
Below is the output from loadlibrary64.exe for the protected and unprotected DLL. The unprotected DLL runs without problems on MultiCharts64

Microsoft Windows [Version 6.3.9600]
c:\>loadlibrary64 1pwfov4x64tpbProtected.dll
Loading DLL 1pwfov4x64tpbProtected.dll
LoadLibrary OK
Loaded modules:
LoadLibrary64.exe 0xd2ce0000 c:\LoadLibrary64.exe
ntdll.dll 0x2a270000 C:\Windows\SYSTEM32\ntdll.dll
KERNEL32.DLL 0x292f0000 C:\Windows\system32\KERNEL32.DLL
KERNELBASE.dll 0x278f0000 C:\Windows\system32\KERNELBASE.dll
1pwfov4x64tpbProtected.dll 0x5590000 c:\1pwfov4x64tpbProtected.dll
user32.dll 0x29b00000 C:\Windows\system32\user32.dll
advapi32.dll 0x29850000 C:\Windows\system32\advapi32.dll
oleaut32.dll 0x2a1b0000 C:\Windows\system32\oleaut32.dll
gdi32.dll 0x27bf0000 C:\Windows\system32\gdi32.dll
shell32.dll 0x27ee0000 C:\Windows\system32\shell32.dll
version.dll 0x20f70000 C:\Windows\SYSTEM32\version.dll
MSVCP110.dll 0x1bf60000 C:\Windows\SYSTEM32\MSVCP110.dll
MSVCR110.dll 0x1be80000 C:\Windows\SYSTEM32\MSVCR110.dll
msvcrt.dll 0x29620000 C:\Windows\system32\msvcrt.dll
sechost.dll 0x27e80000 C:\Windows\SYSTEM32\sechost.dll
RPCRT4.dll 0x29430000 C:\Windows\system32\RPCRT4.dll
combase.dll 0x29dd0000 C:\Windows\system32\combase.dll
SHLWAPI.dll 0x29c80000 C:\Windows\system32\SHLWAPI.dll
IMM32.DLL 0x29cf0000 C:\Windows\system32\IMM32.DLL
MSCTF.dll 0x27d40000 C:\Windows\system32\MSCTF.dll
comctl32.dll 0x27a00000 C:\Windows\WinSxS\amd64_microsoft.windows.common
-controls_6595b64144ccf1df_5.82.9600.16384_none_34a8918f959016ea\comctl32.dll
ole32.dll 0x296d0000 C:\Windows\system32\ole32.dll
psapi.dll 0x27b10000 C:\Windows\system32\psapi.dll
SHFolder.dll 0x23b60000 C:\Windows\SYSTEM32\SHFolder.dll
msimg32.dll 0x24360000 C:\Windows\SYSTEM32\msimg32.dll
uxtheme.dll 0x262d0000 C:\Windows\SYSTEM32\uxtheme.dll
kernel.appcore.dll 0x264c0000 C:\Windows\SYSTEM32\kernel.appcore.dll
CRYPTBASE.dll 0x27530000 C:\Windows\SYSTEM32\CRYPTBASE.dll
bcryptPrimitives.dll 0x274d0000 C:\Windows\SYSTEM32\bcryptPrimitives.dll

SHCORE.dll 0x25ed0000 C:\Windows\SYSTEM32\SHCORE.dll
profapi.dll 0x275f0000 C:\Windows\SYSTEM32\profapi.dll
SspiCli.dll 0x274a0000 C:\Windows\SYSTEM32\SspiCli.dll
Freeing DLLs...
Done

///////////////////////////////////////////////////
loadlibrary64 of unprotected DLL
//////////////////////////////////////////////////
Microsoft Windows [Version 6.3.9600]
c:\>loadlibrary64 1pwfov4x64tpb.dll
Loading DLL 1pwfov4x64tpb.dll
LoadLibrary OK
Loaded modules:
LoadLibrary64.exe 0xd2ce0000 c:\LoadLibrary64.exe
ntdll.dll 0x2a270000 C:\Windows\SYSTEM32\ntdll.dll
KERNEL32.DLL 0x292f0000 C:\Windows\system32\KERNEL32.DLL
KERNELBASE.dll 0x278f0000 C:\Windows\system32\KERNELBASE.dll
1pwfov4x64tpb.dll 0x234c0000 c:\1pwfov4x64tpb.dll
OLEAUT32.dll 0x2a1b0000 C:\Windows\system32\OLEAUT32.dll
MSVCP110.dll 0x25660000 C:\Windows\SYSTEM32\MSVCP110.dll
MSVCR110.dll 0x233e0000 C:\Windows\SYSTEM32\MSVCR110.dll
msvcrt.dll 0x29620000 C:\Windows\system32\msvcrt.dll
combase.dll 0x29dd0000 C:\Windows\system32\combase.dll
RPCRT4.dll 0x29430000 C:\Windows\system32\RPCRT4.dll
Freeing DLLs...
Done

Re: Problem with protected x64 DLL

PostPosted: Fri Jul 03, 2015 7:44 pm
by mqsymth
I thought the error in the protected DLL might be from my code statement.
std::unique_ptr<float[]> gTmpArr(new float[lArrSize]);
So I replace it with
Thread static float gTmpArr[lArrSize];
and received the below error .

The unprotected DLL with std::unique_ptr<float[]> gTmpArr(new float[lArrSize]); worked fine with not errors.

<<EXCEPTION>>
Code: 0xFFFFFFFFC0000005 ( -1073741819 )
Continuable: 0x0000000000000000 ( 0 )
Description: The instruction at 0x
ErrorCode: 0xFFFFFFFFC0000005 ( -1073741819 )
ExceptionType: 0x0000000000000000 ( 0 )
Module: C:\Program Files\TS Support\MultiCharts64\1pwfov4x64tpb.dll
Process: C:\Program Files\TS Support\MultiCharts64\MultiCharts64.exe
Thread ID: 0x0000000000001218 ( 4632 )
Time: 03.07.2015 - 14:36:48.187