Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 19th, 2005, 3:14 PM   #1
MattN
Newbie
 
Join Date: Sep 2005
Posts: 4
Rep Power: 0 MattN is on a distinguished road
Program removal

I want to write a program which will uninstall annother specific program, and run a registry file afterward ( to clean what was left behind by that program in the registry. ).

I'm not trying to make an advanced add/remove programs utility like others on the market, this is for one specific program at a time and would need to be rewritten for every different program that needed to be deleted.

So my idea is basically to have it run the program's existing uninstall utility then run the file I created for removing the registry keys.

What I've done so far:

I've allready discovered all the keys and created the file to remove the keys from the registry and found that the uninstall information is located in an XML document that appears to require something inside windows to run it, but I'm not entirely positive what that may be.

My knowledge of VB isn't too advanced, and I honestly really have no idea if this is even possible. But I'm here to learn, not just copy and paste, I'm not looking for someone to tell me exactly what to do, just a "Yeah it's possible" or a "No Way", and if it is possible, a point in the right direction.
MattN is offline   Reply With Quote
Old Sep 19th, 2005, 4:15 PM   #2
ChiHappens
Programmer
 
ChiHappens's Avatar
 
Join Date: Sep 2005
Location: Brevard, NC
Posts: 35
Rep Power: 0 ChiHappens is an unknown quantity at this point
Send a message via MSN to ChiHappens
Well if you are going to use VB6, then you will need to do a bunch of work to get it to read the registry beyond what VB6 allows you to do. You will need to use Win32 APIs for Enumerating/Reading/Writing/Deleting Registry keys.

If you are going to use VB.NET then you have the ability to use the Registry Class that comes with .NET and it allows you to easily do these things.

If you want to simply run the original install program then change those keys you can do it by ShellExecute Win32 API. You can use that to call the .reg file as well (but you will be prompted by Windows if you want to install the registry keys.)

If you are going to replace the existing uninstaller with your own, then you also need to modify Software/Microsoft/Windows/CurrentVersion/Uninstall path to point to your app instead of the original uninstaller.

Hope this helps,
Chi
__________________
http://www.starshipcombatsimulator.com
They mostly come at night...mostly.
ChiHappens is offline   Reply With Quote
Old Sep 21st, 2005, 1:45 PM   #3
MattN
Newbie
 
Join Date: Sep 2005
Posts: 4
Rep Power: 0 MattN is on a distinguished road
Quote:
Originally Posted by ChiHappens
If you want to simply run the original install program then change those keys you can do it by ShellExecute Win32 API. You can use that to call the .reg file as well (but you will be prompted by Windows if you want to install the registry keys.)
The prompt is fine, I'm not trying to write something that'll delete anything without the user's knowledge. Mostly why I'm trying to write this is because I'm a bit tired of giving out instructions for deleting the keys for this program heh, the whole thing about writing a program that'll uninstall it is basically just showing off I suppose.

Anyway, if the quoted method above would work in VB 6.0, then that's great. I also have Visual C++ at my disposal, but I know nothing about it, and also don't have any books on it, though I'm sure I could look for instruction on the web.

The setup file of this program is strange though, it dosn't seem to use the windows uninstall shield either. I tried out C++'s debugger on the process that starts and figured out that it points to a seperate setup.exe in the program's folders. In that same folder is the uninstall.XML file, but when this EXE is run manually, it says that setup.XML is missing. Copying setup.XML into this folder only makes it ask for a non-existant diskette, and copying uninstall.XML into the other folder apparently does nothing.

So, there's some instruction that takes place beteween clicking on uninstall in the Add/Remove programs window and when it accesses the setup.exe in the program's folder. Not sure weither any of this is really important because I havn't learned how to use ShellExecute yet, but I'm working on that right now.

Thanks alot for your help man.
MattN is offline   Reply With Quote
Old Sep 21st, 2005, 2:26 PM   #4
MattN
Newbie
 
Join Date: Sep 2005
Posts: 4
Rep Power: 0 MattN is on a distinguished road
Found the registry entry you were talking about too, there's a few keys in here, one has the path for the .exe in the folder with uninstall.xml in it with a special instruction... bingo.

EDIT: Sorry about the double post people, I got excited when I found it and am an idgit.
MattN is offline   Reply With Quote
Old Sep 23rd, 2005, 6:18 PM   #5
MattN
Newbie
 
Join Date: Sep 2005
Posts: 4
Rep Power: 0 MattN is on a distinguished road
Program complete as of now, will only work when the program itself is in a default extraction location, as with default locations for the target and it's registry keys. Want to update later so that it will be able to search the HDD for the program and the registry keys, and not need to be extracted to a specific location, but this will work for now. Also added a button to restart the computer using the same method! Only works in full in windows XP as far as I know, havn't tested it on other systems yet.

Thanks again for all your help, it was quite simple once I found the special instruction and learned how to use ShellExecute. I immagine the next step will be a bit more difficult, but I immagine I'll be able to figure it out using your same post. If not I could allways switch to VB.NET which I'm sure would make things a bit easier.

-Matt
MattN is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:21 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC