none
Error accessing the ole registry after windows fall update. RRS feed

  • Question

  • I know this is probably too vague but..

    I have an application the reads and writes to an access database. After the Windows fall update an error is thrown saying 
    'Error accessing the ole registry' when the application loads

    There is a splash screen so that something displays as data is being read from the db. The error message appears behind the splash screen.

    If I click ok (The only option) The application loads and runs (as far as I can tell) correctly.

    The operating system is Windows 10

    There is an old VB6 registration free dll in there but that appears to be working correctly too.
    Don't know if this rings any bells with anyone?

    Andy

    Tuesday, December 12, 2017 12:44 PM

Answers

  • Hi,

    So in the end I transferred everything to the new account. I also noticed another problem with ht e old account in that my Onedrive was not updating correctly. I could create new folders from the old account but from any other account they were not there.

    I have not deleted the old account as there are some things in my documents that I'm not sure if they will still be available. I guess the answer is to transfer them to my D drive before deleting it?


    Yes, you should copy anything related to the old account, that you want to keep, to the new account before deleting the old account. I wouldn't rely on it sticking around after you have deleted the old account.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    • Marked as answer by AndyNakamura Thursday, January 18, 2018 4:33 PM
    Wednesday, January 17, 2018 1:02 PM

All replies

  • Try running the app as Administrator to see if that makes any difference. You can also try running it in Compatibility mode (app shortcut properties).

    If you could identify where in the code this error occurs, such as debugging it through the VS IDE, it could help to resolve it.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, December 12, 2017 1:06 PM
  • Hi Paul,

    The strange thing is if I use a non-administrator account it works fine. The account that is causing the problem is an administrator.

    How do I get to the app shortcut properties?

    Unfortunately it's not so easy to run from the id I get path errors and stuff. I'll need change some parts of the program. I'll do this later.

    Tuesday, December 12, 2017 1:42 PM
  • Hi Paul,

    The strange thing is if I use a non-administrator account it works fine. The account that is causing the problem is an administrator.

    How do I get to the app shortcut properties?

    Unfortunately it's not so easy to run from the id I get path errors and stuff. I'll need change some parts of the program. I'll do this later.


    If the accounts are actually different then this sounds like a user profile issue. Was there an installation or registration of any dependent components that may need to be done for the administrator account?

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, December 12, 2017 2:19 PM
  • I've tried uninstalling and re-installing on both accounts, but I just get the error on the administrator account.
    As I said if I dismiss the error message the app loads as usual. In fact it seems to be filling datatables, combo boxes etc even as the error message is there because as soon as I click ok the application pops up fully loaded, so to speak. I've tried reading and writing to the db and all seems well. The reg-free dll seems to be working as normal too.

    I've just had this error since the fall update this morning.

    I'll also mention that the app is installed with clickonce so it's a separate install for each account

    Tuesday, December 12, 2017 2:40 PM
  • You will probably need to identify where in the code this message is generated, or whether it's generated outside of the app by a dependent component. It definitely appears to be COM/ActiveX related which would lead me to suspect it has something to do with your VB 6.0 component or one of its dependent components (if there are any).

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, December 12, 2017 2:53 PM
  • Hi Paul,

    The dll has references to:
    ActiveX Data Objects 2.8 library
    ADO.ext.2.8 for ddl and security

    I'll have to investigate further later.

    Thanks

    Andy

    Tuesday, December 12, 2017 3:50 PM
  • Hi Paul,

    The dll has references to:
    ActiveX Data Objects 2.8 library
    ADO.ext.2.8 for ddl and security

    I'll have to investigate further later.

    Thanks

    Andy

    Those are Windows components so I wouldn't expect an issue there.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, December 13, 2017 12:01 AM
  • Hi Paul,

    So I had some time to investigate further. I'm pretty sure the error is being thrown when the application tries to list network providers etc with some code I got  (As far as I remember) from here. It involves using the windows API so I am pretty lost trying to find out what's wrong. I guess though that is something to do with the account, seeing as it is fine on the same computer but with a different account.

    There is a form that displays network drives, so that the user can connect to a DB on another computer. This, on further checking does not work on the account with the error.

    Code below:

    Imports System.Runtime.InteropServices
    
    Public Class clsGetNet
        <DllImport("mpr.dll", CharSet:=CharSet.Auto)> _
        Private Shared Function WNetEnumResource(ByVal hEnum As IntPtr, ByRef lpcCount As Integer, ByVal lpBuffer As IntPtr, ByRef lpBufferSize As Integer) As Integer
        End Function
    
        <DllImport("mpr.dll", CharSet:=CharSet.Auto)> _
        Private Shared Function WNetOpenEnum(ByVal dwScope As RESOURCE_SCOPE, ByVal dwType As RESOURCE_TYPE, ByVal dwUsage As RESOURCE_USAGE, ByRef lpNetResource As NETRESOURCE, ByRef lphEnum As IntPtr) As Integer
        End Function
    
        <DllImport("mpr.dll", CharSet:=CharSet.Auto)> _
        Private Shared Function WNetGetResourceParent(ByRef lpNetResource As NETRESOURCE, ByVal lpBuffer As IntPtr, ByRef lpBufferSize As Integer) As Integer
        End Function
    
        <DllImport("mpr.dll", CharSet:=CharSet.Auto)> _
        Private Shared Function WNetCloseEnum(ByVal hEnum As IntPtr) As Integer
        End Function
    
    
        Private Enum RESOURCE_SCOPE
            CONNECTED = &H1
            GLOBALNET = &H2
            REMEMBERED = &H3
            RECENT = &H4
            CONTEXT = &H5
        End Enum
        Private Enum RESOURCE_TYPE
            ANY = &H0
            DISK = &H1
            PRINT = &H2
            RESERVED = &H8
        End Enum
        Private Enum RESOURCE_USAGE
            CONNECTABLE = &H1
            CONTAINER = &H2
            NOLOCALDEVICE = &H4
            SIBLING = &H8
            ATTACHED = &H10
            ALL = (CONNECTABLE Or CONTAINER Or ATTACHED)
        End Enum
        Private Enum RESOURCE_DISPLAYTYPE
            GENERIC = &H0
            DOMAIN = &H1
            SERVER = &H2
            SHARE = &H3
            FILE = &H4
            GROUP = &H5
            NETWORK = &H6
            ROOT = &H7
            SHAREADMIN = &H8
            DIRECTORY = &H9
            TREE = &HA
            NDSCONTAINER = &HB
        End Enum
        Private Enum NERR
            Success = 0
            MORE_DATA = 234
            NO_BROWSER_SERVERS_FOUND = 6118
            INVALID_LEVEL = 124
            ACCESS_DENIED = 5
            INVALID_PARAMETER = 87
            NOT_ENOUGH_MEMORY = 8
            NETWORK_BUSY = 54
            BAD_NETPATH = 53
            NO_NETWORK = 1222
            INVALID_HANDLE_STATE = 1609
            EXTENDED_ERROR = 1208
        End Enum
    
        Private Structure NETRESOURCE
            Public dwScope As RESOURCE_SCOPE
            Public dwType As RESOURCE_TYPE
            Public dwDisplayType As RESOURCE_DISPLAYTYPE
            Public dwUsage As RESOURCE_USAGE
            <MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> Public lpLocalName As String
            <MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> Public lpRemoteName As String
            <MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> Public lpComment As String
            <MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> Public lpProvider As String
        End Structure
    
        Private Shared FoundItems As ArrayList
    
        Private Shared Function WNETOE(ByVal o As Object) As Boolean
            Dim iRet As NERR
            Dim ptrHandle As IntPtr = New IntPtr()
            Dim I As Integer
    
            Try
                iRet = WNetOpenEnum(RESOURCE_SCOPE.GLOBALNET, RESOURCE_TYPE.DISK Or RESOURCE_TYPE.PRINT, RESOURCE_USAGE.ALL, o, ptrHandle)
    
                If (iRet <> NERR.Success) Then
                    Exit Function
                End If
    
                Dim entries As Integer
                Dim buffer As Integer = 16384
    
                Dim ptrBuffer As IntPtr = Marshal.AllocHGlobal(buffer)
    
                Dim nr As NETRESOURCE
    
                Do
                    entries = -1
                    buffer = 16384
    
                    iRet = WNetEnumResource(ptrHandle, entries, ptrBuffer, buffer)
    
                    If ((iRet <> NERR.Success) Or (entries < 1)) Then
                        Exit Do
                    End If
    
                    Dim ptr As Integer = ptrBuffer.ToInt32()
    
                    For I = 0 To entries - 1
                        nr = Marshal.PtrToStructure(New IntPtr(ptr), GetType(NETRESOURCE))
                        'MsgBox(Hex(nr.dwUsage))
    
                        ptr += Marshal.SizeOf(nr)
                        FoundItems.Add(nr.lpRemoteName)
                    Next
    
                Loop
    
                Marshal.FreeHGlobal(ptrBuffer)
    
                iRet = WNetCloseEnum(ptrHandle)
    
            Catch ex As Exception
                MsgBox("wnetoe error in clsGetNet  " & ex.Message)
            End Try
    
            Return True
        End Function
        Private Shared Function WNETGP(ByVal o As Object) As String
            Dim iRet As NERR
            Dim I As Integer
    
            Dim buffer As Integer = 16384
    
            Dim ptrBuffer As IntPtr = Marshal.AllocHGlobal(buffer)
    
            Dim nr As NETRESOURCE
    
            buffer = 16384
    
            iRet = WNetGetResourceParent(o, ptrBuffer, buffer)
    
            If (iRet = NERR.Success) Then
                Dim ptr As Integer = ptrBuffer.ToInt32()
                nr = Marshal.PtrToStructure(New IntPtr(ptr), GetType(NETRESOURCE))
            End If
    
            Marshal.FreeHGlobal(ptrBuffer)
    
            Return nr.lpRemoteName
        End Function
    
        Public Shared Function GetProviders() As String()
            MsgBox("Get Providers")
            Dim i As Integer
    
            If FoundItems Is Nothing Then FoundItems = New ArrayList()
            FoundItems.Clear()
            If WNETOE(Nothing) = True Then
                For i = FoundItems.Count - 1 To 0 Step -1
                    If FoundItems(i).ToString.StartsWith("Microsoft Windows") = False Then
                        FoundItems.RemoveAt(i)
                    End If
                Next
                Return FoundItems.ToArray(GetType(String))
            Else
                Throw New Exception("Could not access resource")
            End If
            MsgBox("Get providers finished")
        End Function
    
        Public Shared Function GetServers() As String()
            Dim deSearchPath As New DirectoryServices.DirectoryEntry("WinNT:")
            Dim deItem As DirectoryServices.DirectoryEntry
    
            If FoundItems Is Nothing Then FoundItems = New ArrayList()
            FoundItems.Clear()
    
            deSearchPath.Children.SchemaFilter.Add("Computer")
            deSearchPath.Children.SchemaFilter.Add("Domain")
    
            For Each deItem In deSearchPath.Children
                FoundItems.Add(deItem.Name)
            Next
    
            Return FoundItems.ToArray(GetType(String))
    
        End Function
        Public Shared Function GetSubItems(ByVal Server As String) As String()
            Dim nr As NETRESOURCE
    
            If FoundItems Is Nothing Then FoundItems = New ArrayList()
            FoundItems.Clear()
    
            nr.lpRemoteName = Server
            nr.dwScope = RESOURCE_SCOPE.GLOBALNET
            nr.dwUsage = RESOURCE_USAGE.CONTAINER
    
            If WNETOE(nr) = True Then
                Return FoundItems.ToArray(GetType(String))
    
            Else
                Throw New Exception("Could not access resource")
            End If
        End Function
        Public Shared Function GetParent(ByVal Item As String, ByVal Provider As String) As String
            Dim nr As NETRESOURCE
    
            If FoundItems Is Nothing Then FoundItems = New ArrayList()
            FoundItems.Clear()
    
            nr.lpRemoteName = Item
            nr.lpProvider = Provider
    
            Return WNETGP(nr)
        End Function
    End Class

    If it is the user profile is there any way to fix it?

    Friday, January 5, 2018 4:50 PM
  • Have you been able to identify the line of code that generates the exception? You should be using Try...Catch blocks in all of your Functions, especially when you are accessing network resources or Active Directory.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, January 5, 2018 10:38 PM
  • Hi Paul,

    The line that causes the error is:

    Public Shared Function GetServers() As String()
            Dim deSearchPath As New DirectoryServices.DirectoryEntry("WinNT:")
            Dim deItem As DirectoryServices.DirectoryEntry
    
            If FoundItems Is Nothing Then FoundItems = New ArrayList()
            FoundItems.Clear()
    
    'Error occurs on next line
    
            deSearchPath.Children.SchemaFilter.Add("Computer")
            deSearchPath.Children.SchemaFilter.Add("Domain")
    
            For Each deItem In deSearchPath.Children
                FoundItems.Add(deItem.Name)
            Next
    
            Return FoundItems.ToArray(GetType(String))
    
        End Function
    

    I put this into a Try-Catch with a message box and this error was thrown

    ---------------------------
    TEST-APP
    ---------------------------
    System.Runtime.InteropServices.COMException (0x8002801C): Error accessing the OLE registry.
       at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
       at System.DirectoryServices.DirectoryEntry.Bind()
       at System.DirectoryServices.DirectoryEntry.get_IsContainer()
       at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
       at System.DirectoryServices.DirectoryEntries.get_SchemaFilter()
       at TEST-APP_2_3_0_8_OleReg_Error.clsGetNet.GetServers()
    ---------------------------
    OK  
    ---------------------------

    As I said this only occurs on my administrator account.

    Monday, January 8, 2018 1:36 PM
  • Does it make any difference if you add the domain name to:

    Dim deSearchPath As New DirectoryServices.DirectoryEntry("WinNT://DomainName")



    Paul ~~~~ Microsoft MVP (Visual Basic)

    Monday, January 8, 2018 2:25 PM
  • Hi Paul,

    Not sure what you mean. Should I replace :

    Dim deSearchPath As New DirectoryServices.DirectoryEntry("WinNT://DomainName")

    By inserting my actual domain name? As in:

    Dim deSearchPath As New DirectoryServices.DirectoryEntry("WinNT://MyDomainName")

    I'll just say this is just a peer to peer type windows workgroup network

    Monday, January 8, 2018 3:11 PM
  • I see, so there is no domain.

    The exception indicates to me that there is a permissions issue for the account but I wouldn't really be able to identify it without access to the system. Have you looked in the Event Log to see if there are any corresponding messages when this occurs? I would also try seeing if you could identify the issue using the Process Monitor utility. Set the filter for your app to so as not to display all of the other application messages. It will display both file and Registry access messages and you may be able to identify something that is amiss by comparing the log for different users.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Monday, January 8, 2018 4:00 PM
  • Hi Paul,

    I tried using procmon to view what was happening. Filtered for my app and tried comparing with one of the accounts that are working correctly. I couldn't find anything obvious between the two. I was looking for an 'access denied' result in particular.

    There are plenty of  'Name not found' & some 'Path not found' & a few others but these seem to happen regardless of my app running or not.

    After that I tried looking at all events around the time of the error. I did find some access denied results but these seemed related to keyboard:

    RegCreateKey HKLM\Software\Microsoft\Input\State     Access Denied

    These don't seem to be related to my error.

    Any idea what I should be looking for?

    Tuesday, January 9, 2018 6:37 PM
  • Part of the problem is that I don't know what to tell you to look for exactly. Have you tried adding a different user to the Administrators group to see if you encounter the same issue? Or, remove the administrator user from the Administrators group and see if it makes any difference. This should at least tell you whether the issue is with the Administrators group or the current administrator user account.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, January 10, 2018 3:34 PM
  • Hi Paul,

    I checked other administrator accounts and they all work correctly. It appears to be just this one particular account.

    Is there any way to rebuild or reset the user profile?

    How do I remove the Administrator from the Administrator group?

    Thursday, January 11, 2018 8:29 AM
  • Hi Paul,

    I checked other administrator accounts and they all work correctly. It appears to be just this one particular account.

    Is there any way to rebuild or reset the user profile?

    How do I remove the Administrator from the Administrator group?


    Are you referring to the built-in Administrator account? You should never use this account as you would a normal user. If you want a normal user that is an administrator on the machine then create a new account and add it to the Administrators group.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thursday, January 11, 2018 3:30 PM
  • Andy, 

    Just a guess, can it be that the user account has in some places more rights than the administrator. 

    AFAIK is the administrator just an account which has most rights, but that does not mean all while you can set individual rights for individual users. 

    So maybe are your administrators rights with the last update shortened (not such a strange behaviour with Windows 10) 


    Did you really try it with a "new" user as Paul suggested.


    Just a guess Cor


    Thursday, January 11, 2018 4:12 PM
  • Hi Paul, Cor.

    The administrator account that I referred to as working ok was actually pre-existing, so I created a brand new one. This works fine too.

    As far as the account that is not working correctly I don't know if it's the built in one or not. This computer is a good few years old and has been updated from windows 7 Pro to windows 8 to windows 10.

    One thing I did notice about the new admin account is that I don't automatically have the permission to view the contents of some folders in the C drive. Maybe because these were created by another user?
    If I try there is a window pops up saying click here to get access to this folder (Or something similar to that).

    Thursday, January 11, 2018 6:00 PM
  • Hi Paul, Cor.

    The administrator account that I referred to as working ok was actually pre-existing, so I created a brand new one. This works fine too.

    As far as the account that is not working correctly I don't know if it's the built in one or not. This computer is a good few years old and has been updated from windows 7 Pro to windows 8 to windows 10.

    One thing I did notice about the new admin account is that I don't automatically have the permission to view the contents of some folders in the C drive. Maybe because these were created by another user?
    If I try there is a window pops up saying click here to get access to this folder (Or something similar to that).

    The built-in account is called "administrator". If the account you are having a problem with is not called "administrator" then I would delete it using the User Accounts Control Panel applet. You will need to use another Administrator account to perform this operation.

    Keep in mind that under Windows UAC, all users (including accounts in the Administrators group) run with standard privileges by default. The only difference is that Administrator accounts can be elevated (e.g. Run as administrator) in order to perform administrative functions, such as updating files under the Program Files folder. That is why you are seeing the UAC dialog.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thursday, January 11, 2018 8:47 PM
  • Hi,

    So in the end I transferred everything to the new account. I also noticed another problem with ht e old account in that my Onedrive was not updating correctly. I could create new folders from the old account but from any other account they were not there.

    I have not deleted the old account as there are some things in my documents that I'm not sure if they will still be available. I guess the answer is to transfer them to my D drive before deleting it?

    Wednesday, January 17, 2018 12:53 PM
  • Hi,

    So in the end I transferred everything to the new account. I also noticed another problem with ht e old account in that my Onedrive was not updating correctly. I could create new folders from the old account but from any other account they were not there.

    I have not deleted the old account as there are some things in my documents that I'm not sure if they will still be available. I guess the answer is to transfer them to my D drive before deleting it?


    Yes, you should copy anything related to the old account, that you want to keep, to the new account before deleting the old account. I wouldn't rely on it sticking around after you have deleted the old account.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    • Marked as answer by AndyNakamura Thursday, January 18, 2018 4:33 PM
    Wednesday, January 17, 2018 1:02 PM