+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Aug 2005
    Posts
    1,431

    How to extract files from inside running executable at runtime.

    The basis of this article is to demonstrate a way of including other files within you're executable without corruption (too much anyway .

    The basics:
    The reason this is so simple is you can append data to the end of you're executable file, along with delimiters you could append files, their privilages, even an entire directory tree with compression and encryption.

    Some code:
    to add a file to you're executable
    Code:
    public function AddFile(ExecPath as string, FileToAdd_Path as string, Result as string)
    dim TMP as string
    
    open execpath for binary access read as #1
    tmp = input(lof(1),1)
    close #1
    
    tmp = tmp & "[START]"
    
    open filetoadd_path for binary access read as #1
    tmp = tmp & input(lof(1),1)
    close #1
    
    open Result for binary access write as #1
    put #1,1, tmp
    close #1
    
    end function
    Code to put inside you're executable to enable extraction of the file.
    Code:
    public function ExtractFile()
    dim TMP as string
    
    open app.path & "\" & app.exename & ".exe" for binary access read as #1
    tmp = input(lof(1),1)
    close #1
    
    tmp = mid(tmp, instr(tmp, "[START]") + 7, len(tmp))
    
    open app.path & "\" & app.exename & "-Extracted.exe" for binary access write as #1
    put #1,1, tmp
    close #1
    end function
    This will cause the executable to open and read its contents into the TMP variable, it will then parse all data after the string "[START]" and output that to a file, this is our extracted data, ofcourse its only one file with no compression/encryption and the extraction could be improved by only reading the data from the end of the executable and not the entire thing, but im sure you grasp the idea.

    Executable Map:
    [Extractor]
    [Extractor's Code]
    [End of Extractor]

    [COMPRESSION + ENCRYPTION START]
    [START1]
    [Test.TXT]
    [Test.TXT's contents]
    [PRIVS]
    [777]
    [START2]
    [Whatever.exe]
    [Whatever.exe's Contents]
    [PRIVS]
    [755]

    article / example source found : VB: Self extracting executable

  2. #2
    Junior Member
    Join Date
    May 2008
    Location
    x 12BE45
    Posts
    18
    we havn't understood the aim of this code!
    can't you explain more ?

  3. #3
    Senior Member
    Join Date
    Mar 2008
    Posts
    115
    Ï ;nÃŽn→Ì©P\æ6M5♣:BÜ◙À►x: > Your code , explian plz

  4. #4
    Senior Member
    Join Date
    Jan 2010
    Location
    PLUTO
    Posts
    256
    What about .RES method?

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. edit variable inside exe
    By bubzuru in forum Visual Basic Help
    Replies: 5
    Last Post: 02-11-2007, 11:37
  2. extract
    By codewar in forum Delphi Help
    Replies: 0
    Last Post: 08-06-2007, 21:40
  3. Replies: 7
    Last Post: 07-09-2005, 19:56
  4. Replies: 8
    Last Post: 03-09-2005, 23:10
  5. a running movie inside picture??
    By LttCoder in forum Off-Topic
    Replies: 7
    Last Post: 03-05-2005, 15:54

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT +1. The time now is 21:50.
www.opensc.ws
Copyright ©2005 - 2012, OpenSC Forums



Search Engine Friendly URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.