Extracting IncludeBinary files to disk?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

If I use the IncludeBinary command to wrap a file into my exe, how can I extract it back to disk later during runtime? I assume it's got to do with the WriteMemory commands, but I'm unsure of how to proceed. Thanks!

PB - Registered PureBasic Coder


Edited by - PB on 16 November 2001 04:45:29
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.
If I use the IncludeBinary command to wrap a file into my exe, how can I extract it back to disk later during runtime?
Replying to my own post here, with an answer provided by Fred by E-Mail:

Code: Select all

r=openfile(1,"c:\file.exe")
if r0
  WriteData(?MyFile,xxx) ; xxx = File size (in bytes) of included binary.
  closefile(1)
endif

end

MyFile:
IncludeBinary "c:\file.exe"

PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

Interresting, a Pointer to a label inside the code.
This gives us the chance to make 'Selfmodified Code'.

Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.
Interresting, a Pointer to a label inside the code.
This gives us the chance to make 'Selfmodified Code'.
You're crazy ;-D.. BTW, I think than under windows code is as read-only (default behavior, so it wouldn't work..

Fred - AlphaSND
Post Reply