Archived

This topic is now archived and is closed to further replies.

TheGriz42

Install program

Recommended Posts

My question pertains to deleting the installation file of a game. I wrote my own install program, but I would like to know how, in Windows 9x/NT, to delete the install program (Install.exe) once it has completed running?

Share this post


Link to post
Share on other sites
I guess I didn''t quite explain myself properly. I wrote a game and my own custom install program (called Install.exe). After it finishes installing the files to their new location, I would like the Install.exe program to close and somehow delete itself. (The install program is located on the user''s local drive and should be deleted once it is done running, it''s not on a CD or anything, where this question wouldn''t even be pertinent.)

Share this post


Link to post
Share on other sites
If you could get to ring 0 of the Windows OS, you got it. First use VxdBootRingLevel() to go to OS_RING0 and then use the UseDebugEventEx() to wait for the code EXIT_PROCESS and check that the process id is the same as your install program''s process id. Then if it is, use GetModuleFileName() to get the file path and name, then its simply deleting the file.

THEN, you have to use ResetOSSystemTables() to remove any changes you''ve done, then use VxdBootRingLevel() to OS_RING3 (where programs run) and then use ExitProcess() to exit out... your file is deleted before your program ended, in a sense.

Enjoy!
- OldManDave.

Share this post


Link to post
Share on other sites
Where are all those functions declared? I can''t find them, or how to use them anywhere? Do you have a short example of how to use them?

Share this post


Link to post
Share on other sites
I don''t think you want to get into ring zero, for one thing that''s internal stuff and programs normally shouldn''t do that. Also, it would only work for Win9x, not NT, and it''s really complicated (or it seems).

Anyway, here''s a pretty informative article:
click here

If you want to know how I do it, I just use Windows Installer. That way I don''t even have to write my own installation programs, but it is hard and complicated to use.

Share this post


Link to post
Share on other sites
Why not to create yet another exe that is started when install is about to close itself and which will ONLY wait for ten seconds or so and delete the install files...
Or simply, have your main program to delete unnecessary install files.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Ok, I''m tempted to ask this. What the hell is an OS RING?

Share this post


Link to post
Share on other sites
quote:
Original post by Icarus
Why would you want to delete the install executable. Perhaps the user wants to keep it.
-Andreas


agreed... i have a download folder with all sorts of install programs. i burn that folder to CD-R and use it in the case of a (Windows) reinstall...

i''d very much prefer that you don''t delete files on me

- n8





nathany.com

Share this post


Link to post
Share on other sites
drawing on my IT contractor days.....

you can set up a system that deletes the files on the next reboot. You will find a windows program called wininit.exe (part of win95/98) that ALWAYS runs on boot. it reads a file called wininit.ini to see if there are any files that need removing, renaming or replacing. if you place this in the file:

c:\install.exe = NUL

then winint will delete your file on reboot. This is the way MS Office install replaces in use files, and is the reason you need to reboot after upgrading office and many other apps. Once the file is processed it gets renamed to wininit.bak. Look for it in your windows directory and you will see the last install program that used it.

Cool eh?

http://www.positech.co.uk

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Anyone ever tried making a key with the content "del Drive:\Path\Install.exe" at HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''m thinking OS RING has somethin'' to do with NASA''s space shuttle,
although I could be wrong.

Share this post


Link to post
Share on other sites
Here''s what I know about rings (and it could be wrong):

The OS has a bunch of different "rings," sort of like access levels, between it and the hardware. The kernel is on ring 0, which means it operates directly on the hardware, no overhead, the lowest level you can have. In Windows, nothing except drivers and the kernel run on ring 0 (I think). I think I remember hearing somewhere that applications run on like ring 5 or something. Is that correct?

Anyway, as far as I know, a ring is basically a certain logical level above the hardware. The lower the ring, the closer to the hardware, the higher the ring, the more levels of OS code you have to go through to get the job done.

Please, correct me if I''m wrong.

Share this post


Link to post
Share on other sites