News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Install Shield

Started by Jackal, August 31, 2006, 08:01:21 AM

Previous topic - Next topic

Jackal

I was wondering how i would go about including my application into a different one like i was creating a setup file. I know there are programs that do this for you but all the ones i have seen or used tend to make the setup file very large compared to what my application is and i was thinking that if i wrote my own that i can keep the overall size cut down. I was thinking and thought maybe there was a way to have my app stored in the resource file or in the .data section however that seems like it would be a bad idea. If there is a way to store it in the resource file then how would i go about saving it to the computer? I know i can use the api calls to write a file but i am not sure how i would do it from the resource file if my app can be placed in there.

hutch--

If you want to embedd any file in an EXE file, try the dedicated utility in the current MASM32 called FDA or FDA2. Both will convert any file into an object module that you link in with the rest of your app. Both create an include file that has the start address and the byte length of the data and it is far more flexible than messing around with binary resource files.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Ehtyar

Call FindResource, SizeOfResource, LoadResource, LockResource, then CreateFile, and use the pointer from LockResource as the data for a call to WriteFile and you will have your program written to disk.

Jackal

Thank you for both replys. I went ahead and followed the second suggestion and i do have this working but i have one question which does not make sense to me. The api LockResource has the return value of a pointer the start of the resources position but to make this work i add to add 24(decimal) to the pointer in order to reach the start of my application itself. Is this normal and what are those 24 bytes? Anyways thanks for the help as usual..

Jackal

Nevermind.. I had a mistake in my code from misreading MSDN the first time but i have figured it out and i have this working. Thanks again..

Jackal

Now that i have that figured out is there a way i can make a file that is able to remove it self. This is for a uninstall application. So far using this method i was able to make a install app that is much smaller than any that i have done using programs which are written for this type of thing.

Jackal

Nevermind.. I figure out that I can allocate memory and write code to this memory and use CreateRemoteThread to get the job done.

Ehtyar

Good job Jackal, always nice to see people who work hard at their own problems and come up with good solutions :)