I am rare new to PureBasic so i got some problems with IncludeBinary keyword.
Well my goal is to Include an exe in my project through Dataselection and then
run this attached exe from memory without to copy it on Disk.
I use PurePROCS library in order to run exe from memory but in the example
it opens a file on a Disk and not in memory.
Example from Readme :
Code: Select all
Stream = ReadFile(#PB_Any, "YourExe")
If Stream
*Buffer = AllocateMemory(Lof(Stream))
If *Buffer
ReadData(Stream, *Buffer, Lof(Stream))
CloseFile(Stream)
ProcessID = PurePROCS_Execute(ProgramFilename(), *Buffer)
Delay(20000)
PurePROCS_KillProcessID(ProcessID)
EndIf
EndIf
Code: Select all
DataSection
EXE_Start:
IncludeBinary "MyFile.exe"
EXE_End:
EndDataSection
datalenght.l = ?Exe_Start - ?Exe_End
Stream = ReadFile(#PB_Any, ?EXE_Start - ?Exe_End)
*Buff = AllocateMemory(Lof(datalenght))
If *Buff
bytes = ReadData(0, *Buff, Lof(datalenght))
ProcessID = PurePROCS_Execute(ProgramFilename(), *Buff)
EndIf