Pregunta

I have a VB.Net program written with .Net 2.0 I'm trying to write a code that logs entire registry entries into a log file. I have got it to work wit the following code. http://pastebin.com/kmA63cUe However whenever I try to add an additional Registry key to log

LogPrint4("<-----------------HKLM/WebCheck-------------------->")
    If reg.enumvalues(&H8000002, "Software\Microsoft\Windows\CurrentVersion\WebCheck", keys2, types) = 0 Then
        If IsArray(keys2) Then
            For p = 0 To UBound(keys2)
                reg.getstringvalue(&H8000002, "Software\Microsoft\Windows\CurrentVersion\WebCheck", keys2(p), value)
                LogPrint4(keys2(p) & "=" & value)
            Next
        End If
    End If

It comes up with the following error

COMException was unhandled Check the ErrorCode Property of the exception to determine the HRESULT returned by the COM object.

I'm not sure why it is limiting it only to 5 checks. Anyone have any ideas?

¿Fue útil?

Solución

Consider using the built-in Registry support instead of the COM libraries. At a minimum, you'll get clearer error messages. It is supported in .NET 2.0.

http://msdn.microsoft.com/en-us/library/microsoft.win32.registry(v=vs.80).aspx

Good luck!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top