Create your own Windows service using Mason Service Builder This tool allows you to convert a regular executable into a native Windows Service, with full control over its file format, icon, and assembly metadata
Developed by ABOLHB — MasonGroup
The tool features a clean, focused, and purpose-built design, created exclusively for service construction Any usage outside this scope is the sole responsibility of the user
The builder allows exporting the final service binary in multiple executable formats:
.exe.scr.com.pif.bat.cmd
The output format is selected dynamically through:
guna2ComboBox1_SelectedIndexChangedThis does not alter the internal logic of the service; it only affects how the file is represented and registered by Windows
The builder is responsible for preparing, configuring, and compiling the final service binary
- Accepting an input executable via Drag & Drop or file picker
- Converting the executable into position-independent shellcode using Donut
- Injecting the generated shellcode into a predefined service stub
- Compiling the final service using
CSharpCodeProvider
The builder invokes donut.dll to transform the selected executable into raw shellcode:
- The output is written to a temporary
.binfile - The shellcode bytes are read and converted into a hexadecimal string
- This string is injected directly into the stub source code at compile time
This ensures the final service contains no external payload files.
When AssemblyCheckBox1 is enabled, the builder extracts metadata from any selected .exe file using:
FileVersionInfo
The following attributes are cloned and embedded into the final service:
- Title
- Description
- Product
- Company
- Copyright
- Trademark
If disabled, all assembly attributes are fully stripped from the stub source before compilation.
When IconCheckBox1 is enabled:
- Any
.icofile can be selected - The icon is injected at compile time using
/win32icon - The selected icon is previewed inside the UI
This affects both Explorer appearance and Service Manager visuals.
The final service is compiled with:
- Embedded application manifest
- Administrator execution level
- Optimized WinExe target
- Optional icon and assembly metadata
All compilation is performed in-memory using source generation.
The stub is the runtime core of the generated service. It is designed to be self-contained, single-instance, and persistent.
- The service name is generated dynamically from the executable filename
- Invalid characters are stripped
- Windows service naming rules are strictly enforced
This guarantees compatibility with sc.exe and the Service Control Manager.
On first execution:
- The binary copies itself into the Windows System32 directory
- The copied file is marked as Hidden and System
- Execution continues only from the system directory
File.SetAttributes(targetPath, FileAttributes.Hidden | FileAttributes.System);This prevents casual discovery by standard users.
This is how the service appears in the process list:
The service is created using the same name as the executable:
The binary is stored inside the system directory:
- When executed interactively, the binary installs itself as a service
- When started with
/service, it runs underServiceBase
Service installation is performed using native sc.exe commands:
- create
- description
- failure policy
- auto-start configuration
A global mutex ensures that only one instance of the service can run system-wide. If a second instance is detected, it terminates immediately.
- Shellcode is allocated using
VirtualAlloc - Memory is marked as executable
- Execution is performed via
CreateThread - The service continuously monitors the thread state
- If the thread exits unexpectedly, it is relaunched (only by the main instance)
This provides controlled persistence without spawning additional processes.
- Windows Error Reporting (WER) is fully disabled
- Thread state is monitored using
GetExitCodeThread - Memory and thread handles are cleaned safely on shutdown
The service binary is hidden from standard file browsing:
When manually searching for the file path, the average user will not notice it due to system-level attributes.
We hereby declare that we disclaim any liability for any improper or unintended use of this software. This project is provided for technical and educational purposes only. By using this software, you assume full responsibility for its usage.
Copyright © Freemasonry 2025




