Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Creating Self Patcher Executable

Süleyman Yasir KULA edited this page Mar 5, 2020 · 10 revisions

NOTE: if possible, sign your self patcher with a certificate from a trusted CA to avoid common security/antivirus issues on clients' devices.

A. Using a Pre-existing Self Patcher

A.1. SelfPatcherWinForms

self-patcher-winforms

This project is WinForms-based and thus, it might require Mono to compile this project on OSX and Linux platforms. To create the self patcher, follow these steps:

  1. open SimplePatchToolExtras.sln
  2. rebuild the SelfPatcherWinForms project
  3. the generated self patcher is located at SelfPatcherWinForms\bin\Release: SelfPatcher.exe and SelfPatcherCore.dll

A.2. SelfPatcherConsoleApp

This project is console-based and therefore, can be compiled without any issues on all platforms using Visual Studio. To create the self patcher, follow these steps:

  1. open SimplePatchToolExtras.sln
  2. rebuild the SelfPatcherConsoleApp project
  3. the generated self patcher is located at SelfPatcherConsoleApp\bin\Release: SelfPatcher.exe and SelfPatcherCore.dll

B. Creating Your Own Self Patcher

To create your own self patcher, you should first add a reference to the SelfPatcherCore module; or, if you don't want to ship your self patcher with a SelfPatcherCore.dll file, copy&paste the contents of the SelfPatcherCore module into your project.

An instance of SelfPatcherCore.SelfPatcher handles the self patching. It communicates with your self patcher via a SelfPatcherCore.ISelfPatcherListener object. When self patching is completed, the ISelfPatcherListener.OnSuccess function is called. After this function is invoked, you should call the SelfPatcher.ExecutePostSelfPatcher function to finalize the self patching process. Please note that calling this function will also terminate the self patcher.

Example code: SelfPatcherConsoleApp.Program and SelfPatcherWinForms.SelfPatcherWindow

Clone this wiki locally