Discussion Locked

registry repair

0 helpful
16 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

i came across this site offering free registry repair of my pc.
(http://registryrepair.1found.com)
it's a good program, the registry can be a big problem. well mine can
be, that's for sure - and the last thing anyone wants is an 'inexperienced'
user fiddling around inside the registry.

if, say, i wanted to write a similar program, or rather,
a program which did a similar thing as other registry repair software,
how would i check for redundant Windows registry keys and files?

i'd want it to be running a registry clean and registry fix
of window registry, that type of thing - just how to check for redundant settings?

i am using Visual Basic.

if you know how i might do this
i'd be greatful to know also, thanks

16 replies

by teentown

you can download free modules from the internet to slot into your application, you can probably find some on freevbcode or planetsourcecode, my fav is freevbcode - you'll probably want to pick th Advanced listings.

But i'd say it's been done before - error nuker is a handy tool. if you want to better it, you'd need to stretch to more than clean and fix in your app.

by teentown

I used to have a little program that let me write an image to the boot sector of a floppy disk. when anyone booted from the disk, it would bring up a picture on the screen.

Anyone know where i can get another copy of this ?

by gogetit

Here are a couple of functions for you to read and write to and from the registry using HKEYS. It's a start...

Just paste the below into your module.
(code is by Agent Smith on PSC)

Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long

Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long

Declare Function RegSetValueEx Lib "advapi32" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal szData As String, ByVal cbData As Long) As Long

Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long

Declare Function RegCreateKeyEx Lib "advapi32" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition As Long) As Long

#If Win32 Then

Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const HKEY_USERS = &H80000003
Public Const KEY_ALL_ACCESS = &H3F
Public Const REG_OPTION_NON_VOLATILE = 0&
Public Const REG_CREATED_NEW_KEY = &H1
Public Const REG_OPENED_EXISTING_KEY = &H2
Public Const ERROR_SUCCESS = 0&
Public Const REG_SZ = (1)
#End If

Type SECURITY_ATTRIBUTES

nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Boolean
End Type

'AND NOW THE FUNCTIONS...

Public Function bSetRegValue(ByVal hKey As Long, ByVal lpszSubKey As String, ByVal sSetValue As String, ByVal sValue As String) As Boolean

On Error Resume Next
Dim phkResult As Long
Dim lResult As Long
Dim SA As SECURITY_ATTRIBUTES
Dim lCreate As Long
RegCreateKeyEx hKey, lpszSubKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, SA, phkResult, lCreate
lResult = RegSetValueEx(phkResult, sSetValue, 0, REG_SZ, sValue, CLng(Len(sValue) + 1))
RegCloseKey phkResult
bSetRegValue = (lResult = ERROR_SUCCESS)

End Function

Public Function bGetRegValue(ByVal hKey As Long, ByVal sKey As String, ByVal sSubKey As String) As String

Dim lResult As Long
Dim phkResult As Long
Dim dWReserved As Long
Dim szBuffer As String
Dim lBuffSize As Long
Dim szBuffer2 As String
Dim lBuffSize2 As Long
Dim lIndex As Long
Dim lType As Long
Dim sCompKey As String

lIndex = 0
lResult = RegOpenKeyEx(hKey, sKey, 0, 1, phkResult)

Do While lResult = ERROR_SUCCESS And Not (bFound)
szBuffer = Space(255)
lBuffSize = Len(szBuffer)
szBuffer2 = Space(255)
lBuffSize2 = Len(szBuffer2)
lResult = RegEnumValue(phkResult, lIndex, szBuffer, lBuffSize, dWReserved, lType, szBuffer2, lBuffSize2)

If (lResult = ERROR_SUCCESS) Then
sCompKey = Left(szBuffer, lBuffSize)

If (sCompKey = sSubKey) Then
bGetRegValue = Left(szBuffer2, lBuffSize2 - 1)
End If
End If
lIndex = lIndex + 1

Loop
RegCloseKey phkResult
End Function

'now you can call the module from your form.

by enub

Thanks for the post GoGetIt

i want to make a registry fixer like others online and want to know how you do the registry fix. Its the registry repair part really.

by thechas

I have not tried the specific registry repair program you came across.

I have used Norton Win Doctor and V-Com Fix-It.
IMHO, Fix-It works a little bit better than Win Doctor.

As far as writing your own, you need to first learn how the registry functions, and how to validate the keys before starting to write code.

O'Reilly Media has several good books on the registry. They will help you understand how the keys interact, and what they do.

The simplest registry checkers just verify that all linked files exist. Going deeper involves having a table of the "proper" registry keys for specific applications and Windows versions.
You also want to check the syntax of all keys.

The ad-ware and spy-ware detection programs all read the registry looking for specific keys.

Keep in mind that the registry is structured a little differently in each different version of Windows. So, you need to design and test your code on on each version that you wish to support.

Chas

by enub

Firstly, thank you very much for your post Chas, it was great!
:-)
Some good points and sounds like some good advice.

Back on my quest to make a good registry cleaner, like the one in initial discussion (which is more of a registry mechanic really when thinking about it, as in your previous reply, checking for specific words and redundant links etc)
I need to find a good window registry diagram/map/information, start at the top.

Will check on microsoft for registry info

eNub

by smartstuff

...in addition, this might be of interest .. 'There is no way to cover every problem that may arise in the Registry. You should read the help files that come with each piece of software to understand what they can do. This may help you fix a problem. Read the entire sections as well, you may find something in there that might help you fix a problem.

There are basically only two types of Registry problems. The first is being a corrupted database. The Registry is an encrypted database. The second type is invalid entries in the Registry.' If you don't know what you are doing, its a good idea to get a registry cleaner.

by synthetic

Without some serious testing of many of these apps, and a good understanding what is on ones system, I would urge the regular user to shy away from these apps, unless you have a good reason/need. First, just because someone writes a reg prog and puts it out, doesn't mean it will not chew your reg up and spit it out. Honestly, why use a reg "cleaner" without serious need? Speed? So you loss a couple of microseconds while your system routes through errant reg entires. If speed is your issue, a smaller reg will make a little difference, replacing your architecture so your not running a 5200 RPM drive will do a great deal more. Boosting RAM, VMM, video card, etc will give a greater speed enhancement than any scaled down reg could b(and many of these enhancements will cost the same as many chimerical reg utilities). Proper system usage means maintaining your programs, and not installing any goofy program that strikes ones fancy; this will lessen the chances of a bloated reg, and a reg with errant entries. In many cases, a RAM boost will be cheaper than many commercial reg tools, and will grantee system performance. Also, once a system is built, making back-ups of the reg is a for restoration/comparison is a great idea, and will help in places a reg cleaner cannot, especially if your system has a severely corrupted reg. Cheers.

by pupa

---quote---
registry repair
i came across this site offering free registry repair of my pc.
(http://registryrepair.1found.com)
it's a good program, the registry can be a big problem. well mine can
be, that's for sure - and the last thing anyone wants is an 'inexperienced'
user fiddling around inside the registry.

if, say, i wanted to write a similar program, or rather,
a program which did a similar thing as other registry repair software,
how would i check for redundant Windows registry keys and files?

i'd want it to be running a registry clean and registry fix
of window registry, that type of thing - just how to check for redundant settings?

i am using Visual Basic.

if you know how i might do this
i'd be greatful to know also, thanks
---quote---

magic

by pagncub02

Generally I shy away from talking about a specific software, however I have been using Registry Repair ( http://www.stompsoft.com/registry-repair.html ) for while now and have been happy with the results. I say this because I would feel very leery about trying to make changes by myself. I guess that I think that some things should be left to the people who know. :)

by federerfan

Ambitious. I would be terrified and I have been at it (programming) since 1977. I'll stick to "REGISTRY MECHANIC" from PC Tools and I have knowledge of "Windows Registry Repair Pro" from 3B Software. Mechanic has never presented any problems, I have heard tales of terrible conflicts created from running "Reg.Repair Pro 3B" but I suspect the problem was caused by the user misuse, not the software itself.

Great luck with your project, I hope you will keep us posted with the progress of your project.

FedererFAN
Charles, NYC

This discussion is closed to new replies.