Skip to content

Latest commit

 

History

History
185 lines (141 loc) · 4.22 KB

File metadata and controls

185 lines (141 loc) · 4.22 KB

How to Build e2e.dll for mIRC

Prerequisites

1. Visual Studio installation

  • Install Visual Studio 2022 (Community edition is fine).
  • Select workload: Desktop development with C++.
  • In Individual Components, add:
    • MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)

2. Download libsodium (x86 / 32-bit)

Option A: Prebuilt package (recommended)

  1. Go to https://download.libsodium.org/libsodium/releases/
  2. Download the latest MSVC package, for example:
    • libsodium-1.0.20-stable-msvc.zip
  3. Extract to C:\libsodium\
  4. Verify you have:
    C:\libsodium\Win32\Release\v143\static\libsodium.lib
    C:\libsodium\include\sodium.h
    

Option B: Different location

  • Use your own path, then update paths in Visual Studio project settings.

Build (Command Line - quick)

Developer Command Prompt for VS 2022 (x86)

Open x86 Native Tools Command Prompt for VS 2022 and run:

cd C:\Users\majst\source\repos\e2e

cl /LD /MT /O2 ^
   /I"C:\libsodium\include" ^
   e2e.c ^
   /link ^
   /DEF:e2e.def ^
   /MACHINE:X86 ^
   C:\libsodium\Win32\Release\v143\static\libsodium.lib ^
   advapi32.lib user32.lib

Flag summary:

  • /LD - Build a DLL
  • /MT - Static runtime (CRT linked into DLL)
  • /O2 - Optimization
  • /I - Include directory for libsodium
  • /DEF - Module definition file
  • /MACHINE:X86 - 32-bit target (required for mIRC)

Expected output:

e2e.dll   <- copy this to mIRC folder
e2e.lib   <- import library (not required by mIRC)

Build (Visual Studio GUI)

1. Create a new project

  1. Open Visual Studio 2022
  2. Click Create a new project
  3. Select Dynamic-Link Library (DLL) (C++)
  4. Project name: e2e
  5. Location: C:\Users\majst\source\repos\

2. Set platform to Win32

  1. In toolbar, where it says x64, open dropdown
  2. Click Configuration Manager...
  3. Active solution platform -> New...
  4. Select Win32 (x86)
  5. Copy settings from x64
  6. Click OK -> Close
  7. Select Win32 in toolbar dropdown

3. Add source files

  1. In Solution Explorer, right-click Source Files
  2. Add -> Existing Item
  3. Add: e2e.c and e2e.def

4. Project properties (important)

Right-click project -> Properties -> All Configurations -> Win32

C/C++ -> General

  • Additional Include Directories: C:\libsodium\include

C/C++ -> Code Generation

  • Runtime Library: Multi-threaded (/MT)

Linker -> Input

  • Additional Dependencies (append):
    C:\libsodium\Win32\Release\v143\static\libsodium.lib
    advapi32.lib
    

Linker -> Input (second item)

  • Module Definition File: e2e.def

Linker -> Advanced

  • Target Machine: MachineX86 (/MACHINE:X86)

5. Build

  1. Build -> Build Solution (Ctrl+Shift+B)
  2. DLL output:
    • C:\Users\majst\source\repos\e2e\Win32\Release\e2e.dll

Validate the DLL

1. Verify 32-bit

dumpbin /headers e2e.dll | findstr machine

Expected output contains:

machine (x86)

2. Verify exports

dumpbin /exports e2e.dll

You should see exported functions such as:

ordinal hint RVA      name
...                   Decrypt
...                   Encrypt
...                   Test
...                   Version

3. Verify dependencies

dumpbin /dependents e2e.dll

It should not include libsodium.dll (libsodium is statically linked).


Final step: copy to mIRC

copy e2e.dll "C:\Program Files (x86)\mIRC\e2e.dll"

Or use your actual mIRC install path.


Troubleshooting

Cannot find sodium.h

  • Check: C:\libsodium\include\sodium.h
  • Check Include Directories in project properties

Unresolved external symbol sodium_init

  • Ensure linker includes libsodium.lib
  • Verify .lib path is correct

mIRC says Invalid DLL

  • DLL is not 32-bit -> verify with dumpbin /headers
  • Wrong target platform -> must be Win32, not x64

MSVCR143.dll missing

  • Runtime is not statically linked
  • Set Runtime Library to /MT

Next step

After a successful build, test in mIRC:

//echo -a $dll(e2e.dll, Test, hello world)

If you see e2e.dll OK - received: hello world, the DLL is loading correctly.