Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6918869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:54:54+00:00 2026-05-27T09:54:54+00:00

Summary I have a need to embed an executable in my software. This executable

  • 0

Summary
I have a need to embed an executable in my software. This executable is provided by my client and the client wishes that the executable should be embedded into the software that I am developing and should be extracted into memory and executed from there.

Details
Details that I can reveal here:

We have build a software that is automating Adobe Photoshop for performing some tasks. In this software our client asked us to add facility to write/record user selected photos to a DVD/CD. DVD/CD recorded thus is not copyable!

For performing this task, the client supplied us with an executable that can record content to DVD/CD based on a text file (containing list of files to be burned) supplied to it! We are using this executable for writing/recording.

Now the client want us to embedded this file in the software that we have developed and when the user selects the option for writing/recording to DVD/CD the executable should be extracted in memory and executed from memory.

When we try to protect this executable with available software protection, software like SoftLocx, Enigma, SoftDog, WinICE, etc. the executable crashes that is why we took the decision to embed it in our software.

I hope now I have provided enough details.

Can we do something like this in VB6/Delphi?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:54:54+00:00Added an answer on May 27, 2026 at 9:54 am

    Have you tried the last version of Enigma Virtual Box? I’ve been able to invoke a bundled EXE using this free tool. I think the latest enhancements to the virtual box tech shows up EVB first. If you try, make sure click share virtual system to child process.

    http://enigmaprotector.com/en/aboutvb.html

    Here is some (untested) code I found if you want to run EXE from memory. Maybe this can help.

    unit uExecFromMem;
    { uExecFromMem
    
      Author: steve10120
      Description: Run an executable from another's memory.
      Credits: Tan Chew Keong: Dynamic Forking of Win32 EXE; Author of BTMemoryModule: PerformBaseRelocation().
      Reference: http://www.security.org.sg/code/loadexe.html
      Release Date: 26th August 2009
      Website: http://ic0de.org
      History: First try
    
      Additions by testest 15th July 2010:
        - Parameter support
        - Win7 x64 support
    }
    
    interface
    
    uses Windows;
    
    function ExecuteFromMem(szFilePath, szParams: string; pFile: Pointer):DWORD;
    
    implementation
    
    function NtUnmapViewOfSection(ProcessHandle:DWORD; BaseAddress:Pointer):DWORD; stdcall; external 'ntdll';
    
    type
      PImageBaseRelocation = ^TImageBaseRelocation;
      TImageBaseRelocation = packed record
         VirtualAddress: DWORD;
         SizeOfBlock: DWORD;
      end;
    
    procedure PerformBaseRelocation(f_module: Pointer; INH:PImageNtHeaders; f_delta: Cardinal); stdcall;
    var
      l_i: Cardinal;
      l_codebase: Pointer;
      l_relocation: PImageBaseRelocation;
      l_dest: Pointer;
      l_relInfo: ^Word;
      l_patchAddrHL: ^DWord;
      l_type, l_offset: integer;
    begin
      l_codebase := f_module;
      if INH^.OptionalHeader.DataDirectory[5].Size > 0 then
      begin
        l_relocation := PImageBaseRelocation(Cardinal(l_codebase) + INH^.OptionalHeader.DataDirectory[5].VirtualAddress);
        while l_relocation.VirtualAddress > 0 do
        begin
          l_dest := Pointer((Cardinal(l_codebase) + l_relocation.VirtualAddress));
          l_relInfo := Pointer(Cardinal(l_relocation) + 8);
          for l_i := 0 to (trunc(((l_relocation.SizeOfBlock - 8) / 2)) - 1) do
          begin
            l_type := (l_relInfo^ shr 12);
            l_offset := l_relInfo^ and $FFF;
            if l_type = 3 then
            begin
              l_patchAddrHL := Pointer(Cardinal(l_dest) + Cardinal(l_offset));
              l_patchAddrHL^ := l_patchAddrHL^ + f_delta;
            end;
            inc(l_relInfo);
          end;
          l_relocation := Pointer(cardinal(l_relocation) + l_relocation.SizeOfBlock);
        end;
      end;
    end;
    
    function AlignImage(pImage:Pointer):Pointer;
    var
      IDH:          PImageDosHeader;
      INH:          PImageNtHeaders;
      ISH:          PImageSectionHeader;
      i:            WORD;
    begin
      IDH := pImage;
      INH := Pointer(Integer(pImage) + IDH^._lfanew);
      GetMem(Result, INH^.OptionalHeader.SizeOfImage);
      ZeroMemory(Result, INH^.OptionalHeader.SizeOfImage);
      CopyMemory(Result, pImage, INH^.OptionalHeader.SizeOfHeaders);
      for i := 0 to INH^.FileHeader.NumberOfSections - 1 do
      begin
        ISH := Pointer(Integer(pImage) + IDH^._lfanew + 248 + i * 40);
        CopyMemory(Pointer(DWORD(Result) + ISH^.VirtualAddress), Pointer(DWORD(pImage) + ISH^.PointerToRawData), ISH^.SizeOfRawData);
      end;
    end;
    
    function Get4ByteAlignedContext(var Base: PContext): PContext;
    begin
      Base := VirtualAlloc(nil, SizeOf(TContext) + 4, MEM_COMMIT, PAGE_READWRITE);
      Result := Base;
      if Base <> nil then
        while ((DWORD(Result) mod 4) <> 0) do
          Result := Pointer(DWORD(Result) + 1);
    end;
    
    function ExecuteFromMem(szFilePath, szParams:string; pFile:Pointer):DWORD;
    var
      PI:           TProcessInformation;
      SI:           TStartupInfo;
      CT:           PContext;
      CTBase:       PContext;
      IDH:          PImageDosHeader;
      INH:          PImageNtHeaders;
      dwImageBase:  DWORD;
      pModule:      Pointer;
      dwNull:       DWORD;
    begin
      if szParams <> '' then szParams := '"'+szFilePath+'" '+szParams;
    
      Result := 0;
      IDH := pFile;
      if IDH^.e_magic = IMAGE_DOS_SIGNATURE then
      begin
        INH := Pointer(Integer(pFile) + IDH^._lfanew);
        if INH^.Signature = IMAGE_NT_SIGNATURE then
        begin
          FillChar(SI, SizeOf(TStartupInfo), #0);
          FillChar(PI, SizeOf(TProcessInformation), #0);
          SI.cb := SizeOf(TStartupInfo);
          if CreateProcess(PChar(szFilePath), PChar(szParams), nil, nil, FALSE, CREATE_SUSPENDED, nil, nil, SI, PI) then
          begin
            CT := Get4ByteAlignedContext(CTBase);
            if CT <> nil then
            begin
              CT.ContextFlags := CONTEXT_FULL;
              if GetThreadContext(PI.hThread, CT^) then
              begin
                ReadProcessMemory(PI.hProcess, Pointer(CT.Ebx + 8), @dwImageBase, 4, dwNull);
                if dwImageBase = INH^.OptionalHeader.ImageBase then
                begin
                  if NtUnmapViewOfSection(PI.hProcess, Pointer(INH^.OptionalHeader.ImageBase)) = 0 then
                    pModule := VirtualAllocEx(PI.hProcess, Pointer(INH^.OptionalHeader.ImageBase), INH^.OptionalHeader.SizeOfImage, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE)
                  else
                    pModule := VirtualAllocEx(PI.hProcess, nil, INH^.OptionalHeader.SizeOfImage, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
                end
                else
                  pModule := VirtualAllocEx(PI.hProcess, Pointer(INH^.OptionalHeader.ImageBase), INH^.OptionalHeader.SizeOfImage, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
                if pModule <> nil then
                begin
                  pFile := AlignImage(pFile);
                  if DWORD(pModule) <> INH^.OptionalHeader.ImageBase then
                  begin
                    PerformBaseRelocation(pFile, INH, (DWORD(pModule) - INH^.OptionalHeader.ImageBase));
                    INH^.OptionalHeader.ImageBase := DWORD(pModule);
                    CopyMemory(Pointer(Integer(pFile) + IDH^._lfanew), INH, 248);
                  end;
                  WriteProcessMemory(PI.hProcess, pModule, pFile, INH.OptionalHeader.SizeOfImage, dwNull);
                  WriteProcessMemory(PI.hProcess, Pointer(CT.Ebx + 8), @pModule, 4, dwNull);
                  CT.Eax := DWORD(pModule) + INH^.OptionalHeader.AddressOfEntryPoint;
                  SetThreadContext(PI.hThread, CT^);
                  ResumeThread(PI.hThread);
                  Result := PI.hThread;
                end;
              end;
              VirtualFree(CTBase, 0, MEM_RELEASE);
            end;
            if Result = 0 then
              TerminateProcess(PI.hProcess, 0);
          end;
        end;
      end;
    end;
    
    end.
    

    Example of use:

    procedure TMainFrm.BtnStartClick(Sender: TObject);
    var
     Reg: TRegistry;
     CommandLine: string;
     ABuffer: array of byte;
     Res: TResourceStream;
     LauncherMS: TStream;
    begin
    ...
    ...
    ...
    ...
    
     Res := TResourceStream.Create(HInstance,'MEXE','Data');
     LauncherMS := TMemoryStream.Create;
     LauncherMS.CopyFrom(Res,Res.Size);
     LauncherMS.Position := 0;
     CommandLine := '';
     try
      SetLength(ABuffer, LauncherMS.Size);
      LauncherMS.ReadBuffer(ABuffer[0], LauncherMS.Size);
      ExecuteFromMem(ExtractFilePath(Application.ExeName)+'m.exe', 'connect', @ABuffer[0]);
     finally
      LauncherMS.Free;
     end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an SSRS report where I need to collapse data into a summary
Summary: I have a struct that is read/written to file. This struct changes frequently,
I need to have a summary field in each page of the report and
Quick summary: I have a Rails app that is a personal checklist / to-do
--Summary (shortened)-- I have a controller that loads a profile object from the corresponding
I have an object Title : foo Summary : foo bar Body : this
You may have noticed that we now show an edit summary on Community Wiki
I have a report that we need to link (which we've checked to be
Say I have a summary table like this: AcitivityCache ( pkId (bigint, PK), Date
I have a page that is definitely not a form but I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.