Managed vs Unmanaged code

Case of Silenttrinity and Donut project

When creating a shellcode through donut it is important to remember that x64 built instance of the donut project will create x64 bit shellcodes that should run in a x64 processs and vice versa. Program we would like to turn into a shellcode should also be compiled for the desired architecture. This can be achieved by compiling a project with 2019 MSVC compiler from a development command prompt:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"

Resulted binary can be easily confirmed with sigcheck.exe from Sysinternals:

C:\Users\user\Desktop\donut-dev>nmake debug -f Makefile.msvc
Microsoft (R) Program Maintenance Utility Version 14.23.28106.4
Copyright (C) Microsoft Corporation. All rights reserved.
cl -Zp8 -nologo -DDEBUG -DDONUT_EXE -I include donut.c hash.c encrypt.c payload/clib.c
donut.c
hash.c
encrypt.c
clib.c
Generating Code...
cl -Zp8 -nologo -DDEBUG -DDLL -LD -I include donut.c hash.c encrypt.c payload/clib.c
donut.c
hash.c
encrypt.c
clib.c
Generating Code...
Creating library donut.lib and object donut.exp
move donut.lib lib/donut.lib
1 file(s) moved.
move donut.exp lib/donut.exp
1 file(s) moved.
move donut.dll lib/donut.dll
1 file(s) moved.
C:\Users\user\Desktop\donut-dev>..\sigcheck.exe donut.exe
Sigcheck v2.73 - File version and signature viewer
Copyright (C) 2004-2019 Mark Russinovich
Sysinternals - www.sysinternals.com
C:\Users\admin\Desktop\donut-dev\donut.exe:
Verified: Unsigned
Link date: 00:09 14/10/2019
Publisher: n/a
Company: n/a
Description: n/a
Product: n/a
Prod version: n/a
File version: n/a
MachineType: 64-bit

If needed x86 path is located in

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat