C ++ migration - CLI shells from .NET 4.0 to 4.5 causes winsock error in Windows Server 2012 R2

I am creating a C ++ CLI wrapper for the middleware for the communications we use. The wrapper was in .NET 4.5 and works great on Windows 7 and Windows Server 2008 R2. But in Windows Server 2012 R2 it crashes with the "Access Violation" error in mswsock.dll

The interesting part is that if I create a shell and test the application for the target .NET 4.0, it will work. But when I redirect them to .NET 4.5.x, it throws an exception.

I tried to research security, strong name, hot-fix'ing.NET, but to no avail.

What bothers me is that it runs on a 2012 R2 server in .NET 4.0, but not on 4.5.x. And this is obvious when native code accesses the winsock API that an access violation occurs.

Does anyone have the same problem or a similar 2012.NET 4.0 vs 4.5.x wiredness server?

Are there any security mechanisms activated in Server 2012 when running .NET 4.5 applications that are inactive for 4.0 applications. In particular, regarding CLI modules?

Technical: native code compiled with VS2010, and thus the wrapper is compiled using this compiler in VS2012. The C ++ CLI project file has been edited to install the target target platform. The testing application is written in C #.

+1
source share
2 answers

Server 2012 R2 with .NET 4.5 always allocates memory outside the 32-bit address area

, , Dumpbin.exe/headers EXE . :

        4.00 operating system version
        0.00 image version
        6.00 subsystem version                      // <== here
           0 Win32 version
        8000 size of image
         200 size of headers
           0 checksum
           3 subsystem (Windows CUI)
        8560 DLL characteristics
               High Entropy Virtual Addresses       // <=== here
               Dynamic base
               NX compatible
               No structured exception handler
               Terminal Server Aware

.NET 4.5. 6.00 - Vista, 4.00. , XP Server 2003. 6 - Windows. , Vista .

High Entropy Virtual Addresses . , . ASLR ( ), . , , .

ASLR, Dynamic base, 256 . . 64- , . /HIGHENTROPYVA linker . , -, 4- . , .

.NET 4.5 , 4.5 , 4.0 . XP Server 2003 ( 4.5) .

+1

, . 64- . , , 64- .

.NET 4.5, . , Server 2012 R2 .NET 4.5 32- . , . .

+1

Source: https://habr.com/ru/post/1606433/


All Articles