Announcement

Collapse
No announcement yet.

Embedding a DLL or an EXE file in my EXE.......

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Embedding a DLL or an EXE file in my EXE.......

    I can call external programs using shell o Shellexecute,
    but is there a way to embed an EXE (RAR.exe for example, wich
    is the one o most use) in my Exe?

    or is at least a way to extract some of the functions?

    ------------------
    Learning is not the capacity to retain information, It is the capacity to compare old information with new information... And make new Knowledge.

  • #2
    The easiest way is just whack it on the end of your exe. Assume your exe is 10000 bytes in size, the code might be something like this:
    Code:
    DIM sFile AS STRING
    OPEN MyExename FOR BINARY ACCESS READ LOCK SHARED AS #1
     GET$ #1, LOF(1) - 10000, sFile
    CLOSE #1
    OPEN "c:\dumped.exe" FOR BINARY ACCESS WRITE LOCK SHARED AS #1
     PUT #1, 1, sFile
    CLOSE #1
    SHELL "c:\dumped.exe"

    ------------------
    The PowerBASIC Crypto Archives - My Email - What's mine is yours...
    -

    Comment


    • #3

      can i still run it this way? if so, how?

      ------------------
      Learning is not the capacity to retain information, It is the capacity to compare old information with new information... And make new Knowledge.

      Comment


      • #4
        I don't know if you can add an EXE to an EX, but PEBundle among others can add DLL's to an EXE:
        http://www.collakesoftware.com

        Fred.

        ------------------

        Comment


        • #5
          Elias, yes - the SHELL line in the code above executes the file after it has been extracted



          ------------------
          The PowerBASIC Crypto Archives - My Email - What's mine is yours...
          -

          Comment


          • #6
            If you want to actually embeda binary file within an EXE file,
            use a DB sequence to store the data.
            Code:
              label:
                ! db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
                etc ....
            You will need a utility to do the conversion and they are easy
            enough to write, just load the file into memory and write the
            value for each byte in the above DB format.

            Regards,

            [email protected]

            ------------------
            hutch at movsd dot com
            The MASM Forum - SLL Modules and PB Libraries

            http://www.masm32.com/board/index.php?board=69.0

            Comment


            • #7
              Real simple...

              (1) Attach it as a raw data resource
              (2) Extract the resoruce and save it to disk when necessary
              (3) SHELL to where you saved it to run it
              (4) Clean-up (delete) when done running it when your application ends

              ------------------
              Every day I try to learn one thing new,
              but new things to learn are increasing exponentially.
              At this rate I’m becoming an idiot faster and faster !!!
              ------------------
              George W. Bleck
              Lead Computer Systems Engineer
              KeySpan Corporation
              <b>George W. Bleck</b>
              <img src='http://www.blecktech.com/myemail.gif'>

              Comment


              • #8
                awhile back i posted some source code to embed and extract files like dll, exe, etc.

                see:
                http://www.powerbasic.com/support/pb...ad.php?t=23527



                ------------------
                "i haven't lost my mind... its backed up on tape... i think??"
                "I haven't lost my mind... its backed up on tape... I think??" :D

                Comment

                Working...
                X