Page MenuHomePhabricator

Public | Fix "Runtime Error 76" (path not found)
Closed, ResolvedPublic


Thank you, JW C:

Hasher 2.3 installed on Dell T500/Win2000SP4 periodically comes up with error box text with "runtime error 76" and "path not found" when attempting to add a folder to a group of files to calculate a hash.

  • Problem goes away temporarily if un-install & re-install program, but returns unpredictably another time.
  • Search of the Internet for "runtime error 76" "path not found", and found at least one reference where this occurred for the Outlook Express Backup program, and the solution was a registry error for that program which pointed it to the wrong folder.

Using Regedit and checked the similar registry location for Hasher, and found that under HKEY_CURRENT_USER\Software\KarenWare\Power Tools\Hasher, the PrevFolder key pointed to H:\FirefoxPortable\ (drive H: is CD drive in this case), and when this text was deleted, Hasher worked OK to add a folder to a group of files for hash calculation. The PrevFolder key text then shows the test folder just used.
Looks like that if the folder location text for the registry PrevFolder key points to a folder that is not accessible the next time (e.g. on removable drive), Hasher will look for this non-accessible folder and gives the "runtime error 76" "path not found" error. Solution for programmer is to not have this key or have it cleared if a folder is not accessible?

Event Timeline

Joe created this task.Jul 11 2018, 9:52 AM
Joe created this object in space S5 Public.
Joe triaged this task as High priority.
Joe created this object with visibility "Public (No Login Required)".
Joe added a comment.Jul 11 2018, 11:01 AM



  • Started Hasher
  • Hashed group of files in Desktop folder "Hasher Test Files"
  • Closed Hasher
  • Changed the name of the Desktop folder
  • Started Hasher
  • On tab Hash Group of Files, clicked Add Folder to Group... and error appeared
Joe added a comment.Jul 11 2018, 11:16 AM

Preparation for fixing this

  • Created VB6 project folder
  • Verified new compiled version comes up with the same SHA-1 hashes
Joe added a comment.Jul 11 2018, 11:23 AM

FolderBrowser is specifically raising the error code. The exception just needs to be handled outside of this spot.

(near the bottom Err.Raise 76 ' path not found)

Public Property Let FullPath(ByVal NewPath As String)
    Dim sa() As String
    Dim Level As Long
    Dim Parent As MSComctlLib.Node
    Dim Child As MSComctlLib.Node
    Dim Sibling As MSComctlLib.Node

    If (Len(NewPath) <= 0) Or (tvBrowse.Nodes.Count <= 0) Then
        MakeSelection Nothing
        Exit Property
    End If

    sa = Split(NewPath, "\")
    If InStr(1, NewPath, ":") > 0 Then ' drive letter
        Set Parent = tvBrowse.Nodes(KEY_LOCALROOT)
        Parent.Expanded = True
        Set Child = Parent.Child
        If ExtractKeyCode(Child) = KEY_SPECIALROOT Then
            Set Child = Child.Next
        End If
        Level = 0
    ElseIf Left(NewPath, 2) = "\\" Then ' network path
        Set Parent = tvBrowse.Nodes(KEY_NETROOT)
        Parent.Expanded = True
        If MWN_PRESENT Then
            Set Parent = tvBrowse.Nodes(KEY_CONTAINER_MWN)
            Parent.Expanded = True
            If Parent.Children > 0 Then
                Set Parent = Parent.Child
                Parent.Expanded = True
            End If
            Set Child = Parent.Child
            Set Child = Parent.Child
        End If
        Level = 2
        sa(Level) = "\\" & sa(Level)
        Set Parent = tvBrowse.Nodes(KEY_LOCALROOT).Root
        Parent.Expanded = True
        Set Child = Parent.FirstSibling
        Level = 0
    End If

    For Level = Level To UBound(sa)
        If Len(sa(Level)) > 0 Then
            Set Sibling = Child
            Do While Not (Sibling Is Nothing)
                If StrComp(sa(Level), Sibling.Text, vbTextCompare) = 0 Then Exit Do
                Set Sibling = Sibling.Next
            If Sibling Is Nothing Then
                Err.Raise 76 ' path not found
                MakeSelection Nothing
                Exit Property
            End If
            Sibling.Expanded = True
            Set Child = Sibling.Child
        End If
    Next Level

    MakeSelection Sibling
End Property
Joe added a comment.Jul 11 2018, 11:44 AM

Fixed by adding On Error handing to the button handlers in Main.frm like:

Private Sub btnGroupFolder_Click()
    Dim Cancelled As Boolean
    Dim Recurse As Boolean

    Load frmBrowse
    If Len(PrevFolder) > 0 Then
        On Error GoTo FolderError
        frmBrowse.ShowFiles = PrevShowFiles
        frmBrowse.ShowNetwork = PrevShowNetwork
        frmBrowse.AddSubfolders = PrevSubfolders
        frmBrowse.SelFolder = PrevFolder
        GoTo FolderSuccess

        Unload frmBrowse
        Load frmBrowse
    End If

    frmBrowse.Show vbModal
    Cancelled = frmBrowse.Cancelled
Joe closed this task as Resolved.Jul 26 2018, 3:36 PM

Fixed... Adding to website, informing cool bug reporters...