Skip to main content

Overview

This guide covers complete integration of SysWhispers4 with Microsoft Visual Studio (MSVC) projects, including console applications, DLLs, and shellcode loaders.

Quick Integration

1

Generate MSVC-compatible files

Generated files:
  • SW4Syscalls_Types.h
  • SW4Syscalls.h
  • SW4Syscalls.c
  • SW4Syscalls.asm ← MASM assembly file
2

Add files to Visual Studio project

  1. Right-click project in Solution Explorer → Add → Existing Item
  2. Select all 4 generated files
  3. Click Add
3

Enable MASM build customization

  1. Right-click project → Build Customizations…
  2. Check masm (.targets, .props)
  3. Click OK
This allows Visual Studio to compile .asm files using the Microsoft Macro Assembler (MASM).
4

Include the header and initialize

5

Build the project

Press F7 or select Build → Build SolutionExpected output:

Complete Console Application Example

Project Setup

1

Create new Visual Studio project

  1. File → New → Project
  2. Select Console App
  3. Name: SyscallInjector
  4. Click Create
2

Generate SysWhispers4 files

3

Add files to project

Copy the 4 generated files to your project directory, then add them to the project:
  • Syscalls_Types.h
  • Syscalls.h
  • Syscalls.c
  • Syscalls.asm
4

Enable MASM

Right-click project → Build Customizations → check masm

Source Code

main.c:

Build Configuration

Recommended settings for Release build:
  1. Configuration Properties → General
    • Configuration Type: Application (.exe)
    • Platform Toolset: Visual Studio 2022 (v143)
  2. C/C++ → General
    • Warning Level: Level3 (/W3)
  3. C/C++ → Optimization (Release only)
    • Optimization: Maximum Optimization (/O2)
    • Inline Function Expansion: Any Suitable (/Ob2)
  4. Linker → General
    • Enable Incremental Linking: No
  5. Linker → Advanced
    • Randomized Base Address: Yes (/DYNAMICBASE)

Build Output Example

DLL Project Integration

1

Create DLL project

  1. File → New → Project
  2. Select Dynamic-Link Library (DLL)
  3. Name: InjectionPayload
2

Generate syscall stubs

3

Add files and enable MASM

Add the 4 generated files and enable MASM build customization.
4

Implement DllMain

dllmain.c:
5

Build DLL

Press F7 to build. Output: InjectionPayload.dll

Advanced MSVC Features

Using Evasion Features

Generate with all evasion enabled:
Initialize in correct order:

Egg Hunt Method

Generate:
Usage:

Multi-Architecture Builds

x64 Configuration:
x86 Configuration:
WoW64 (32-bit PE, 64-bit syscalls):
Create separate configurations in Visual Studio for each architecture.

Troubleshooting

Error: “MASM not found”

Solution:
  1. Install Desktop development with C++ workload in Visual Studio Installer
  2. Ensure MSVC v143 - VS 2022 C++ x64/x86 build tools is installed
  3. Enable masm in Build Customizations

Error: “Unresolved external symbol SW4_NtAllocateVirtualMemory”

Cause: ASM file not being compiled. Solution:
  1. Verify SW4Syscalls.asm is in the project
  2. Right-click SW4Syscalls.asmProperties
  3. Check Item Type is set to Microsoft Macro Assembler
  4. Rebuild project

Error: “A2008: syntax error : syscall”

Cause: Trying to use x64 instructions in x86 build. Solution:
  • Ensure project platform is x64 (not Win32)
  • Or regenerate with --arch x86 for 32-bit target

Warning: “C4996: ‘strcpy’: This function or variable may be unsafe”

Solution: Add to preprocessor definitions:
Or use secure functions (strcpy_s, sprintf_s).

Initialization Fails

Symptoms: SW4_Initialize() returns 0/FALSE. Debugging:
Common causes:
  • Incompatible resolution method for Windows version
  • Permissions issue (for from_disk method)
  • Heavy EDR hooks (try --resolve recycled or --resolve from_disk)

Best Practices

  1. Always initialize before use:
  2. Check NTSTATUS return values:
  3. Close handles:
  4. Unhook before initialize:
  5. Use Release builds for testing: Debug builds add extra symbols and checks that affect evasion.

Next Steps

MinGW Integration

Alternative compiler: MinGW and Clang

Advanced Evasion

Learn about all evasion techniques