First of all. A terminating null characters makes no sense after binary data because binary data most likely will contain null characters on their own.
If you want to extract the binary data you always have to use a label before and after the data and calculate the difference in bytes like so:
Code: Select all
DataSection
RustDesk_Client_begin:
IncludeBinary "..\#includes_files\rustdesk-1.3.7-x86_64.exe"
RustDesk_Client_end:
RustDesk_Toml_begin:
IncludeBinary "..\#includes_files\RustDesk.toml"
RustDesk_Toml_end:
RustDesk_Toml2_begin:
IncludeBinary "..\#includes_files\RustDesk2.toml"
RustDesk_Toml2_end:
EndDataSection
Procedure ExportFromDataSectionAsFile(filePath.s, *begin, *end)
Protected hFile.i
hFile = CreateFile(#PB_Any, filePath)
If Not hFile
ProcedureReturn #False
EndIf
WriteData(hFile, *begin, *end - *begin)
CloseFile(hFile)
ProcedureReturn #True
EndProcedure
; Example call
ExportFromDataSectionAsFile("C:\rustdesk.exe", ?RustDesk_Client_begin, ?RustDesk_Client_end)
And as you can see you can not handle the labels as strings because at runtime these names are gone. You directly have to use their value which is a pointer to the data.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.