Skip to content
View in the app

A better way to browse. Learn more.

DECODEHUB - Software and reverse engineering community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Decodehub.org rank system
New badge system

A relatively complete and stable VMP license addition tool

Featured Replies

<0> This is a highly comprehensive VMP licensing tool that supports DLLs and offers improved stability and ease of use compared to the previous open-source version.

<1> First, open the VMP_LIC tool as shown in the image below, and then select the file you wish to encrypt.

190200qntraq2t7707sdg4.png

<2> After selecting the executable file, a new .exe or .dll file will appear in the directory. The VMSDK file is located in the vmp directory because the encrypted file cannot be opened without it.

The DLL file needs to be placed there; however, this vmpsdk DLL file is no longer required after encryption. The VMProtectSDK32.dll file can be obtained from the 3.x section of the forum.

As shown in the image below, I created a snippet of assembly code,

added the VMProtectSetSerialNumber function, and used the address PEB+0x500 as a parameter to pass the key. The advantage of this approach is that I can write a DLL to obtain the machine code and the key,

and then pass the key by placing its address at PEB+0x500, thereby enabling one-click authorization.

190806wil7iarl74ilypvp.png

<3> After obtaining the new.exe file, encrypt it using VMP. Lock the original OEP during encryption. You can also add an address to lock the serial number. See the image below.

191011nqsnab5abbr5zl5a.png

<4> After this encryption, the serial number is locked; however, since the machine code and serial number cannot be retrieved directly, the code below is a simplified version designed to obtain them, which you can use to modify the settings.

// dllmain.cpp : 定义 DLL 应用程序的入口点。<font></font>
#include "stdafx.h"<font></font>
#include "VMProtectSDK.h"<font></font>
#pragma comment(lib, "VMProtectSDK32.lib")<font></font>
<font></font>
char ** LicAddr = NULL;<font></font>
<font></font>
void __stdcall GetFs()<font></font>
{<font></font>
    __asm<font></font>
    {<font></font>
        mov eax, dword ptr fs : [0x30]<font></font>
        lea eax, dword ptr ds : [eax + 0x500]<font></font>
        mov LicAddr, eax;<font></font>
    }<font></font>
<font></font>
}<font></font>
<font></font>
void ReadLicense()<font></font>
{<font></font>
    HANDLE hLicFile = CreateFileA("License.Lic", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);<font></font>
    if (INVALID_HANDLE_VALUE == hLicFile)<font></font>
    {<font></font>
        MessageBoxA(NULL, "Lic文件出错!", "Error", MB_OK);<font></font>
    }<font></font>
    DWORD LicSize;<font></font>
    LicSize = GetFileSize(hLicFile, NULL);<font></font>
    if (0 == LicSize)<font></font>
    {<font></font>
        MessageBoxA(NULL, "Lic文件内容为空!", "Error", MB_OK);<font></font>
    }<font></font>
    char* LicBuf = new char[LicSize + 1];<font></font>
    DWORD ReadSize;<font></font>
    ReadFile(hLicFile, LicBuf, LicSize, &ReadSize, NULL);<font></font>
    CloseHandle(hLicFile);<font></font>
    GetFs();<font></font>
    *LicAddr = LicBuf;<font></font>
}<font></font>
<font></font>
<font></font>
void GetHwid_()<font></font>
{<font></font>
    DWORD HwidSize = VMProtectGetCurrentHWID(NULL, 0);<font></font>
    char * HwidStr = new char[HwidSize + 1];<font></font>
    VMProtectGetCurrentHWID(HwidStr, HwidSize);<font></font>
    MessageBoxA(NULL, HwidStr, "机器码", MB_OK);<font></font>
    ReadLicense();<font></font>
}<font></font>
<font></font>
BOOL APIENTRY DllMain(HMODULE hModule,<font></font>
    DWORD  ul_reason_for_call,<font></font>
    LPVOID lpReserved<font></font>
    )<font></font>
{<font></font>
    switch (ul_reason_for_call)<font></font>
    {<font></font>
    case DLL_PROCESS_ATTACH:<font></font>
        GetHwid_();<font></font>
    case DLL_THREAD_ATTACH:<font></font>
    case DLL_THREAD_DETACH:<font></font>
    case DLL_PROCESS_DETACH:<font></font>
        break;<font></font>
    }<font></font>
    return TRUE;<font></font>
}<font></font>
<font></font>
<font></font>

<5> Both the VMProtectSDK.h and VMProtectSDK32.lib files used in the code can be obtained from the VMP3.X forum. Once the DLL is compiled, it must be encrypted, as it calls the VMP SDK—which requires encryption—to obtain the machine code.

During the encryption process, select "No" for all protection options. Since this step serves solely to obtain the machine code and add the key, the file should be encrypted only once, as shown in the image below.
191759lg298b62kzkjj2bj.png

<6> After creating the DLL, you can use VMP's DLLBox to encapsulate it. If you prefer not to have an external DLL for the machine code, this method ensures the EXE or DLL remains a single file even after encryption.

When embedding the DLL, select the "Load at startup" option as shown in the image below.
192042nl6bavq6ydrqqagb.png

<7> After encryption, there will be a single file named new.vmp.exe. When you run it, it will execute machine code. If a key is missing, it will create a file named License.Lic.

You can generate a key in VMP and place it into the License.Lic file (the key must not contain newline characters).

See the image below.
192428qxhqj6icyhq8spyx.png

<font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">// Lic.cpp: Konsol uygulamasının giriş noktasını tanımlar.</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
//</font></font><font></font>
<font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
#include "stdafx.h"</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
#include "windows.h"</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
#include <Shlwapi.h></font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
#pragma yorumu(lib, "Shlwapi.lib")</font></font><font></font>
<font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
#define AddSize 0x20000</font></font><font></font>
<font></font>
<font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
unsigned char OepData[0x0042] =</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
{</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    0xeb, 0x10, 0x56, 0x4d, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x20, 0x62, 0x65, 0x67, 0x69,</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    0x6e, 0x00, 0x60, 0x9c, 0x64, 0xa1, 0x30, 0x00, 0x00, 0x00, 0x8b, 0x80, 0x00, 0x05, 0x00, 0x00,</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    0x83, 0xf8, 0x00, 0x74, 0x07, 0x50, 0xff, 0x15, 0x33, 0x71, 0x4b, 0x00, 0x9d, 0x61, 0xe9, 0xda,</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    0x55, 0xfa, 0xff, 0xeb, 0x0e, 0x56, 0x4d, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x20, 0x65,</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    0x6e, 0x64</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
};</font></font><font></font>
<font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
DWORD rva2offset(LPVOID base, DWORD rva)</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
{</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    IMAGE_DOS_HEADER* dosHeader = (IMAGE_DOS_HEADER*)base;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    IMAGE_NT_HEADERS32* ntHeader = (IMAGE_NT_HEADERS32*)(dosHeader->e_lfanew + (DWORD)base);</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    IMAGE_SECTION_HEADER* sectionHeader = (IMAGE_SECTION_HEADER*)((DWORD)ntHeader + sizeof(IMAGE_NT_HEADERS32));</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    if (rva<ntHeader->OptionalHeader.SizeOfHeaders)</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    {</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        rva'yı döndür;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    }</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    for (DWORD i = 1; i <= ntHeader->FileHeader.NumberOfSections; i++)</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    {</font></font><font></font>
        <font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        if (i == ntHeader->FileHeader.NumberOfSections)</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        {</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
            return rva - sectionHeader->VirtualAddress + sectionHeader->PointerToRawData;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        }</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        aksi takdirde eğer (rva >= sectionHeader->VirtualAddress && rva < (sectionHeader + 1)->VirtualAddress)</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        {</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
            return rva - sectionHeader->VirtualAddress + sectionHeader->PointerToRawData;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        }</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        bölüm başlığı++;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    }</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    0 döndür;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
}</font></font><font></font>
<font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
DWORD AddImprot(char *ModulePath)</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
{</font></font><font></font>
<font></font>
<font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    HANDLE hFile = CreateFileA(ModulePath, GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    eğer (hFile == 0 || hFile == INVALID_HANDLE_VALUE)</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    {</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        0 döndür;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    }</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    DWORD dosyaBoyutu = DosyaBoyutunuAl(hDosya, 0);</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    char* buf = new char[fileSize];</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    DWORD Okuma Boyutu;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    ReadFile(hFile, buf, fileSize, &ReadSize, NULL);</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    Kapat(hDosyası);</font></font><font></font>
<font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    DWORD Yeni_Dosya_Boyutu = dosyaBoyutu + Ek Boyut;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    PVOID pNewTempBuffer = (PVOID)malloc(New_File_Size);</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    memset(pNewTempBuffer, 0, New_File_Size);</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    memcpy(pNewTempBuffer, buf, fileSize);</font></font><font></font>
<font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    PIMAGE_NT_HEADERS32 ntHeader = (PIMAGE_NT_HEADERS32)((DWORD)pNewTempBuffer + ((PIMAGE_DOS_HEADER)(pNewTempBuffer))->e_lfanew);</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    eğer ((ntHeader->FileHeader.NumberOfSections + 1)*sizeof(IMAGE_SECTION_HEADER)>ntHeader->OptionalHeader.SizeOfHeaders)</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    {</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        printf("Yetersiz alan.");</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
        0 döndür;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    }</font></font><font></font>
<font></font>
    <font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    PIMAGE_SECTION_HEADER newSection = (PIMAGE_SECTION_HEADER)(ntHeader + 1) + ntHeader->FileHeader.NumberOfSections;</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    memcpy(newSection->Name, "VMPLic", 8);</font></font><font></font><font dir="auto" style="vertical-align: inherit;"><font dir="auto" style="vertical-align: inherit;">
    newSection->Characteristics = 0xE0000020;</font></font><font></font>
    newSection->Misc.VirtualSize = AddSize;<font></font>
    newSection->NumberOfLinenumbers = 0;<font></font>
    newSection->NumberOfRelocations = 0;<font></font>
    newSection->PointerToLinenumbers = 0;<font></font>
    newSection->PointerToRelocations = 0;<font></font>
    newSection->SizeOfRawData = AddSize;<font></font>
<font></font>
    DWORD NewAddSize = (newSection - 1)->Misc.VirtualSize > (newSection - 1)->SizeOfRawData ?<font></font>
        (newSection - 1)->Misc.VirtualSize : (newSection - 1)->SizeOfRawData;<font></font>
<font></font>
    newSection->VirtualAddress = (newSection - 1)->VirtualAddress + NewAddSize;<font></font>
    if (newSection->VirtualAddress % ntHeader->OptionalHeader.SectionAlignment)<font></font>
    {<font></font>
        newSection->VirtualAddress = newSection->VirtualAddress / ntHeader->OptionalHeader.SectionAlignment *<font></font>
            ntHeader->OptionalHeader.SectionAlignment + ntHeader->OptionalHeader.SectionAlignment;<font></font>
    }<font></font>
    newSection->PointerToRawData = (newSection - 1)->PointerToRawData + (newSection - 1)->SizeOfRawData;<font></font>
    if (newSection->PointerToRawData  % ntHeader->OptionalHeader.FileAlignment)<font></font>
    {<font></font>
        newSection->PointerToRawData = newSection->PointerToRawData / ntHeader->OptionalHeader.FileAlignment *<font></font>
            ntHeader->OptionalHeader.FileAlignment + ntHeader->OptionalHeader.FileAlignment;<font></font>
    }<font></font>
<font></font>
<font></font>
    DWORD ImprotAddress = rva2offset(pNewTempBuffer, ntHeader->OptionalHeader.DataDirectory[1].VirtualAddress);<font></font>
    DWORD ImprotSize = ntHeader->OptionalHeader.DataDirectory[1].Size;<font></font>
<font></font>
<font></font>
    char* DLLname = "VMProtectSDK32.dll";<font></font>
    char* FunctionName = "VMProtectSetSerialNumber";<font></font>
<font></font>
<font></font>
    memcpy(PVOID((DWORD)pNewTempBuffer + fileSize), PVOID((DWORD)pNewTempBuffer + ImprotAddress), ImprotSize);<font></font>
<font></font>
<font></font>
    PIMAGE_IMPORT_DESCRIPTOR AddIMpoetAddr = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)pNewTempBuffer + fileSize + ImprotSize - sizeof(IMAGE_IMPORT_DESCRIPTOR));<font></font>
<font></font>
<font></font>
    AddIMpoetAddr->OriginalFirstThunk = newSection->VirtualAddress + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR) + strlen(DLLname) + 1;<font></font>
    AddIMpoetAddr->FirstThunk = AddIMpoetAddr->OriginalFirstThunk + sizeof(IMAGE_THUNK_DATA32) * 2;<font></font>
    AddIMpoetAddr->ForwarderChain = 0;<font></font>
    AddIMpoetAddr->Name = newSection->VirtualAddress + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR);<font></font>
    AddIMpoetAddr->TimeDateStamp = 0;<font></font>
<font></font>
<font></font>
<font></font>
    memcpy((PVOID)((DWORD)pNewTempBuffer + fileSize + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR)), DLLname, strlen(DLLname) + 1);<font></font>
    memcpy((PVOID)((DWORD)pNewTempBuffer + fileSize + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR) + strlen(DLLname) + 1 + 101 + 2), FunctionName, strlen(FunctionName) + 1);<font></font>
    DWORD ByName = newSection->VirtualAddress + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR) + strlen(DLLname) + 1 + 101;<font></font>
<font></font>
    DWORD* OFT = PDWORD((DWORD)pNewTempBuffer + fileSize + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR) + strlen(DLLname) + 1);<font></font>
    DWORD* IAT = PDWORD((DWORD)pNewTempBuffer + fileSize + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR) + strlen(DLLname) + 1 + sizeof(IMAGE_THUNK_DATA32) * 2);<font></font>
<font></font>
    *OFT = ByName;<font></font>
    *IAT = ByName;<font></font>
<font></font>
<font></font>
    ntHeader->FileHeader.NumberOfSections++;<font></font>
    ntHeader->OptionalHeader.SizeOfImage += AddSize;<font></font>
<font></font>
<font></font>
<font></font>
    DWORD NewOep = newSection->VirtualAddress + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR) + strlen(DLLname) + 1 + 101 + 200;<font></font>
    memcpy(PVOID((DWORD)pNewTempBuffer + fileSize + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR) + strlen(DLLname) + 1 + 101 + 200), OepData, 0x42);<font></font>
<font></font>
<font></font>
    PDWORD CallIat = PDWORD((DWORD)pNewTempBuffer + fileSize + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR) + strlen(DLLname) + 1 + 101 + 200 + 0x28);<font></font>
    DWORD C_value = AddIMpoetAddr->FirstThunk + ntHeader->OptionalHeader.ImageBase;<font></font>
    *CallIat = C_value;<font></font>
<font></font>
<font></font>
    PDWORD JmpOep = PDWORD((DWORD)pNewTempBuffer + fileSize + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR) + strlen(DLLname) + 1 + 101 + 200 + 0x2F);<font></font>
    DWORD J_value = ntHeader->OptionalHeader.AddressOfEntryPoint -<font></font>
        (newSection->VirtualAddress + ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR) + strlen(DLLname) + 1 + 101 + 200 + 0x2F) - 4;<font></font>
    *JmpOep = J_value;<font></font>
<font></font>
<font></font>
    ntHeader->OptionalHeader.AddressOfEntryPoint = NewOep;<font></font>
<font></font>
<font></font>
    ntHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT].Size = 0;<font></font>
    ntHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT].VirtualAddress = 0;<font></font>
<font></font>
    ntHeader->OptionalHeader.DataDirectory[1].VirtualAddress = newSection->VirtualAddress;<font></font>
    ntHeader->OptionalHeader.DataDirectory[1].Size = ImprotSize + sizeof(IMAGE_IMPORT_DESCRIPTOR);;<font></font>
<font></font>
    if (0 != ntHeader->OptionalHeader.DataDirectory[1].VirtualAddress)<font></font>
    {<font></font>
<font></font>
        DWORD RelocAddr = rva2offset(pNewTempBuffer, ntHeader->OptionalHeader.DataDirectory[5].VirtualAddress);<font></font>
        DWORD RelocSize = ntHeader->OptionalHeader.DataDirectory[5].Size;<font></font>
<font></font>
        memcpy(PVOID((DWORD)pNewTempBuffer + fileSize + ImprotSize + 1000), PVOID((DWORD)pNewTempBuffer + RelocAddr), RelocSize);<font></font>
<font></font>
        ntHeader->OptionalHeader.DataDirectory[5].VirtualAddress = newSection->VirtualAddress + +ImprotSize + 1000;<font></font>
        ntHeader->OptionalHeader.DataDirectory[5].Size = ntHeader->OptionalHeader.DataDirectory[5].Size;<font></font>
<font></font>
        DWORD* RelocBase = PDWORD((DWORD)pNewTempBuffer + fileSize + ImprotSize + 1000 + ntHeader->OptionalHeader.DataDirectory[5].Size);<font></font>
        *RelocBase = newSection->VirtualAddress;<font></font>
        *(RelocBase + 1) = 0xC;<font></font>
        *(PWORD(RelocBase + 2)) = NewOep + 0x28 - newSection->VirtualAddress + 0x3000;<font></font>
        ntHeader->OptionalHeader.DataDirectory[5].Size += 0xC;<font></font>
<font></font>
    }<font></font>
<font></font>
<font></font>
    char* newFileName = (ntHeader->FileHeader.Characteristics & IMAGE_FILE_DLL) ? "New.dll" : "New.exe";<font></font>
    CHAR parentPath[MAX_PATH];<font></font>
    CHAR newPath[MAX_PATH];<font></font>
    PathRemoveFileSpecA(ModulePath);<font></font>
    lstrcpyA(parentPath, ModulePath);<font></font>
    PathCombineA(newPath, parentPath, newFileName);<font></font>
<font></font>
    HANDLE hFile2 = CreateFileA(<font></font>
        newPath, GENERIC_WRITE | GENERIC_READ,<font></font>
        0,<font></font>
        NULL,<font></font>
        CREATE_ALWAYS,<font></font>
        FILE_ATTRIBUTE_NORMAL,<font></font>
        NULL);<font></font>
    DWORD WriteSize = 0;<font></font>
    WriteFile(hFile2, pNewTempBuffer, New_File_Size, &WriteSize, NULL);<font></font>
    CloseHandle(hFile2);<font></font>
<font></font>
}<font></font>
<font></font>
int main(int argc, char *argv[])<font></font>
{<font></font>
    char * filepath = argv[1];<font></font>
    AddImprot(filepath);<font></font>
    return 0;<font></font>
}<font></font>
<font></font>

<9> In short, although I have explained a lot, the usage should be quite simple.

First, use VMP_LIC to select the file to be encrypted, then create a new file named new.exe, load it into VMP for encryption, initiate authorization during the encryption process, and lock the source code's OEP.

Second, compile the DLL as shown above; you can only use this specific DLL after encryption. You are free to modify this DLL or even add SDKs and the like.

Third, import the DLL and select the "load at startup" option. These are three very simple steps; it is quite convenient, and you are free to modify the source code.

Of course, you can also write a 64-bit version based on this approach.

Below is my main program, compiled using MFC; there is nothing else to it.

This is the hidden content, please

PROFESSIONAL

  • Replies 3
  • Views 2.4k
  • Created
  • Last Reply

Top Posters In This Topic

Posted Images

Great release, thanks!
Thanks for sharing!
Thanks for sharing!

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.