The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Jackal on August 31, 2006, 08:01:21 AM

Title: Install Shield
Post by: Jackal on August 31, 2006, 08:01:21 AM
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.
Title: Re: Install Shield
Post by: hutch-- on August 31, 2006, 09:12:27 AM
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.
Title: Re: Install Shield
Post by: Ehtyar on August 31, 2006, 08:50:23 PM
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.
Title: Re: Install Shield
Post by: Jackal on September 03, 2006, 03:51:52 PM
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..
Title: Re: Install Shield
Post by: Jackal on September 03, 2006, 04:47:03 PM
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..
Title: Re: Install Shield
Post by: Jackal on September 03, 2006, 06:43:11 PM
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.
Title: Re: Install Shield
Post by: Jackal on September 03, 2006, 09:43:39 PM
Nevermind.. I figure out that I can allocate memory and write code to this memory and use CreateRemoteThread to get the job done.
Title: Re: Install Shield
Post by: Ehtyar on September 04, 2006, 03:12:16 AM
Good job Jackal, always nice to see people who work hard at their own problems and come up with good solutions :)