News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Embedding & extracting files in masm.

Started by xwwwx, August 08, 2012, 05:32:51 AM

Previous topic - Next topic

xwwwx

I need to create an application that after pressing a button it should extract a few files into the specified location (no it will not extract and execute another .exe file don't worry, it's for a game update, images and some other files I don't even know what they are).

I was thinking about just adding the files encoded with hex, and then using some hex 2 bin function to convert it back and write the file to the disk, would this work?

If not, could someone point me in the right direction on how to create, embed and extract resource files on masm?

You may be wondering why I want to use masm if I don't know what the heck i am doing, well mostly because I want to learn how to use it, and I like the fact that it would use the windows apis without any extra dependency which caused problems to me in the past in c++ with programs not working in some computers.

P1

http://www.madwizard.org/programming/snippets?id=55

Here is a code snippet, I did a while back to extract a file from resources.  Does this meet your need ???

This is only one of many ways to do this.

Regards,  P1   8)

xwwwx

It does help, thank you.

But how do i ADD a resource in masm?

qWord

You need a resource file (e.g. rsrc.rc), which is processed with the resource compiler rc.exe. The resulting *.res is added to the linker call.
The resource file could be:
QuoteResID RCDATA "whatever.file"
MREAL macros - when you need floating point arithmetic while assembling!


Vortex

Hi xwwwx,

Another option is to use a tool like fda.exe , File Data Assembler.

hfheatherfox07

@ xwwwx are you looking for an installer written in masm by any chance? if you embed the files into the rsrc.rc your app.exe will be big!

here is an installer in masm32 that was posted on the old forum --- Easy Installation System   http://code.google.com/p/eis/

Revisions 2-4


Revision 2:

http://code.google.com/p/eis/source/browse/?r=2

Revision 3:

http://code.google.com/p/eis/source/browse/?r=3

Revision 4:

http://code.google.com/p/eis/source/browse/?r=4

Click on the folder called "trunk" .... From there you can navigate to download all sub folders....

you might want to view all the folders carefully so you do not miss any thing that may not be in the release folder , called "_DISTRIBUTE"


Here is the source code that you can download



Revision 2  : http://eis.googlecode.com/svn-history/r2/trunk/_DISTRIBUTE/eissrc1301.RAR

Revision 3  : http://eis.googlecode.com/svn-history/r3/trunk/_DISTRIBUTE/eissrc1301.RAR

Revision 4  : http://eis.googlecode.com/svn-history/r4/trunk/_DISTRIBUTE/eissrc1301.RAR
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

hfheatherfox07

Here is something that I have not seen before on the Masm forum I have this in my Goodies tool Box and I feel like sharing   :t
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

Vortex

Hi Hi xwwwx,

Here is an example for you :



include     Extract.inc
include     test.inc

.data

filename    db 'test.htm',0
msg         db 'test.htm is extracted.',13,10,0

.code

start:

    invoke  WriteFileToDisc,ADDR filename,ADDR HtmFile,ln_HtmFile
    invoke  StdOut,ADDR msg
    invoke  ExitProcess,0

END start