Click here to Skip to main content
15,884,778 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have been all over the internet now for two days to try and find a lead on how to remove invalid registry entries. I have been able to find code to read, create and delete registry keys but have nothing to compare the registry to so that it will know what entires are invalid and which are still in use by the programs that use them. What im looking for is a pointer in the right direction because i have not found any information about what to even ask.

thanks in advance!
Posted

1 solution

Assuming you are trying to make something that will clean out the registry...

The registry can be used to store many different things, so you'll have to consider each of those things when trying to clean out the registry.

Let's look at an example. Back in my days working with VB6, there were these OCX files that had to be registered in order to make use of them. When you registered them, an entry got created in the registry (in some particular locations... Google can help you out with that). Working as a developer, there would be tons of old entries in the registry for OCX files that were no longer being used. You could scan these registry entries and look for ones that point to OCX files that no longer exist on the file system, and you could remove those entries and the entries associated with them.

I don't think there is a general purpose solution to "clean the registry". You're gonna have to do some research and find the types of things that get put into the registry and how you can detect if they are still valid (e.g., in the example above, you detect if they're valid by checking if the file still exists).
 
Share this answer
 
Comments
Dale 2012 19-Dec-10 21:58pm    
This is some real usefull information and it is greatly appricated!!!.. How can i scan for old OCX files or entries? do I need to make a backup of some kind or somehow check these OCX files against the programs that are installed or uninstalled?... You are very clear about your topic and it would be just as usefull if you had some example code, but if not then I thank you for your input and encourage anyone to add to this.......Please! also how can I use the file exists if I am unsure of the file to delete?
Dale 2012 20-Dec-10 4:26am    
ahhhhh more info please about OCX files and how to itterate through the registry to find theese files......
Dale 2012 20-Dec-10 4:27am    
what other types of entries can i look for? guid?......
AspDotNetDev 20-Dec-10 13:19pm    
The OCX entries will point to a file path. If there is no file at that path, the entry is invalid. Google or use trial and error or some diagnostics to figure it out. For example, you can export your entire registry to a file. If you do that, then register an OCX, then do it again, you can then use WinMerge (or a similar tool) to compare the 2 files and find registry entries that were modified.
Dale 2012 20-Dec-10 18:05pm    
There is very little information on the net to point me in the right direction and would love to know where the COM and OLE objects are located (Path?) then how would I use exists or not to perform an action on that object?.....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900