MemoryModule icon indicating copy to clipboard operation
MemoryModule copied to clipboard

Prevent program from exiting when calling MemoryCallEntryPoint

Open illera88 opened this issue 7 years ago • 1 comments

In the code I can see this:

/**
 * Execute entry point (EXE only). The entry point can only be executed
 * if the EXE has been loaded to the correct base address or it could
 * be relocated (i.e. relocation information have not been stripped by
 * the linker).
 *
 * Important: calling this function will not return, i.e. once the loaded
 * EXE finished running, the process will terminate.
 *
 * Returns a negative value if the entry point could not be executed.
 */
int MemoryCallEntryPoint(HMEMORYMODULE);

Why does the program ends when calling MemoryCallEntryPoint? How can I prevent the program to do so? I want to call the Entry Point in a different thread and keep doing other stuff.

Thank you

illera88 avatar Sep 27 '18 01:09 illera88

As far as I know an application calls TerminateProcess() or a similiar function when it is done. Running the executable code in a thread brings the very probable risk of creating a huge memory leak. Most applications do not care about freeing their memory properly when they exit.

Elmue avatar Jul 02 '20 15:07 Elmue