Help us improve Softanics
We use analytics cookies to understand which pages and downloads are useful. No ads. Privacy Policy

How to Run an EXE from Memory

BoxedApp SDK lets you run an executable directly from memory: the EXE is placed in the virtual file system and launched with standard Windows APIs (e.g., ShellExecute) - without creating a physical file on disk.

The executable is visible only to the current process and child processes that inherit the same virtual environment. From the OS perspective no real file exists; all I/O is served by the BoxedApp virtualization layer. This is useful when you need a truly self-contained app, want to prevent extraction/tampering, or wish to run embedded tools without leaving traces or temporary files.

Create a virtual EXE, write embedded bytes into it, and launch it via ShellExecute.

C++ Sample

BoxedAppSDK_Init();
 
HMODULE hModule = GetModuleHandle(NULL);
HRSRC hResInfo = FindResource(hModule, _T("BIN1"), _T("BIN"));
HGLOBAL hResData = LoadResource(hModule, hResInfo);
LPVOID lpData = LockResource(hResData);
DWORD dwSize = SizeofResource(hModule, hResInfo);
 
HANDLE hFile = 
   BoxedAppSDK_CreateVirtualFile(
      _T("app1.exe"), 
      GENERIC_WRITE, 
      FILE_SHARE_READ, 
      NULL, 
      CREATE_NEW, 
      0, 
      NULL);
 
DWORD temp;
WriteFile(hFile, lpData, dwSize, &temp, NULL);
 
CloseHandle(hFile);
 
ShellExecute(NULL, NULL, _T("app1.exe"), NULL, NULL, SW_SHOW);