Page MenuHomePhabricator

Public | Error 3 - The system cannot find the path specified
Closed, ResolvedPublic

Description

Denys contacted support:

I am experiencing the dreaded Error 3 in Replicator on Windows 8.1, and after reading Joe's post in the FAQ (https://helpdesk.karenware.com/kb/faq.php?id=21), I am wondering if my observations on the issue might be helpful in solving this, both for me and for other users with the same problem.

I just found the reason this happens. Thank you, Denys!

I'll document this well once tested by a few users who have been experiencing the problem.

Also concerns:

Event Timeline

Joe created this task.Apr 13 2020, 3:46 PM
Joe added a comment.EditedApr 13 2020, 3:54 PM

(excerpt from Microsoft's Win32 API docs added here for programmer's reference)

FindFirstFileW

https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstfilew

As stated previously, you cannot use a trailing backslash () in the lpFileName input string for FindFirstFile, therefore it may not be obvious how to search root directories. If you want to see files or get the attributes of a root directory, the following options would apply:

  • To examine files in a root directory, you can use "C:\*" and step through the directory by using FindNextFile.
  • To get the attributes of a root directory, use the GetFileAttributes function.

Note Prepending the string "\\?\" does not allow access to the root directory.

On network shares, you can use an lpFileName in the form of the following: "\\Server\Share\*". However, you cannot use an lpFileName that points to the share itself; for example, "\\Server\Share" is not valid.

To examine a directory that is not a root directory, use the path to that directory, without a trailing backslash. For example, an argument of "C:\Windows" returns information about the directory "C:\Windows", not about a directory or file in "C:\Windows". To examine the files and directories in "C:\Windows", use an lpFileName of "C:\Windows*".

Joe added a comment.Apr 13 2020, 4:00 PM

Notes from Win10 v1909:

Line 4808 API.bas 
   call to ApiFolderCreate( "C:\test-backup\subfolder\" )
 from Global 401 functiuon MakeDir



 If Not ApiFolderExists(s, frmMain.dirTest) Then
                ' 20190105 JMW https://phabricator.karenware.com/T116
                '     Should create with source folder attributes + archive, IMHO, but
                '     afraid of rocking the boat too much, so carry forward the READONLY bit alone
                '     If Not ApiFolderCreate(s, PT_ATTR_ARCHIVE Or PT_ATTR_NORMAL) Then
                If Not ApiFolderCreate(s, PT_ATTR_ARCHIVE Or PT_ATTR_NORMAL _

ApiFolderCreate called for subfolder on Win10 but not 8?  line 4802 API
  called from Global.MakeDir()
  called from ProcFiles in frmMain which checks for the existence of destination folders

Notes from Win10 v1703 (Creator's Update) which exhibits the problem:

Private Declare Function CopyFileExW Lib "kernel32.dll" ( _
    ByRef lpExistingFileName As Byte, _
    ByRef lpNewFileName As Byte, _
    ByVal lpProgressRoutine As Long, _
    ByRef lpCallbackData As Long, _
    ByRef pbCancel As Boolean, _
    ByVal dwCopyFlags As Long) As Long
#End If ' API_BACKUP



Line 5865 API.bas
 If ApiFileExists(dfi.FullName) Then


fails in 5882 ** BECAUSE THE DIRECTORY DOESN'T EXIST???E?E what
 result = CopyFileExW(usa(0), uda(0), lpCopyProgRoutine, 0, False, 0)

                
Line 3457 API.bas
   Attrs = GetFileAttributesW(uba(0))
   ** This returns -1 because C:\backup-test\subfolder\More HOWDY.bmp is an invalid path 
   -- subfolder isn't there yet in Destination Folder



Line 6092 API.bas
Private Function SetApiError(Optional Msg1 As String = "", Optional Msg2 As String = "") As String
    ApiLastError = Err.LastDllError
    If ApiLastError = 0 Then ApiLastError = GetLastError()
    If ApiLastError = 0 Then ApiLastError = -1
    SetApiError = Msg1 & " (" & ApiError(ApiLastError) & "): " & Msg2
End Function

Line 4195 API.bas
    Function ApiFileExists(Filename) returns TRUE if a file exists
 
    The call to ApiAttrsGet("C:\backup-test\subfolder\More HOWDY.bmp") 
          fails error 3 path not found (because subflder in the Dest hasn't been created yet)
          ApiSetError is called
          ApiFileExists  returns -1  because subfolder doesn't exist
Joe added a comment.EditedApr 13 2020, 4:19 PM

Helpful tip from Microsoft on https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstfilew

If you are writing a 32-bit application to list all the files in a directory and the application may be run on a 64-bit computer, you should call the Wow64DisableWow64FsRedirectionfunction before calling FindFirstFile and call Wow64RevertWow64FsRedirection after the last call to FindNextFile. For more information, see File System Redirector.

(this isn't necessarily related)

Joe added a comment.Apr 17 2020, 12:11 PM

I sent a few emails out to some sufferers of the Error 3 Path Not Found problems, asking them to please run the test attached via .zip file here, KarenWare_T188.

On a few machines, this test fails:

It fails if it believes that folder exists and it really doesn't.

sha256 71d142f2de932fefc79081562ab4e8de5fd7d4a482bf2dcb6c89a7fee5b754a1

Joe closed this task as Resolved.Apr 23 2020, 10:57 AM

Sending this to testers