Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: FAFFind Returns Duplicate Directories Documents and Settings Application Data Reparse Point Directory Junction Tracverse Recurse Recursive Hang Crash Issue GetFileAttributesW FILE_ATTRIBUTE_REPARSE_POINT
File and Folder Finder Extender: Version 44005 Aug. 28, 2013 Added support for a new flag value of 128 (no reparse points)to the fafOpen function's flags parameter. When set this flag prevents the extender from including file system objects implemented with reparse points in searches performed using the returned seach context. Reparse points are used by the NTFS file system to implement symbolic links, directory junctions and directory mount points among other things. Reparse points, and their associated filters and applications provided by 3rd party vender may also be present on a system.
The issue appears to relate to "Application Data" related directories for each User on the Computer. Each user has Application data folders which FAFOpen reports contains the same files yet when you use Windows Explorer and look at the directories it reports them as empty, 'Access Denied' or that the Directories do not exist?
For Example:
C:\Documents and Settings\FRED\AppData\Local\Application Data\Application Data\Microsoft\Windows\Temporary Internet Files C:\Documents and Settings\FRED\AppData\Local\Application Data\Application Data\Application Data\Microsoft\Windows\Temporary Internet Files C:\ProgramData\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Documents\My Music\Sample Music\These directories get longer and longer with another level of \Application Data\ until the Windows reports that the WinBatch Application has stopped responding and kills the application.
; Initialize flags for readability fsHidden = 1 ; Include hidden files fsSystem = 2 ; Include system files fsRecurse = 16 ; Look in sub directories File = FileOpen(DatFile, "WRITE") Drives = DiskScan(2) For A = 1 to ItemCount(Drives, @Tab) DriveID = ItemExtract(A, Drives, @Tab) ; Open a search handle fsHandle = fafOpen("%DriveID%\", "*.*", fsHidden|fsSystem|fsRecurse) LastFilePath = "" ; Perform the search While @TRUE sFound = fafFind(fsHandle) If sFound == "" Then Break FPath = FilePAth(SFound) If LastFilePath <> FPath Then FileWrite(File, "") FileWrite(File, "[%FPath%]") LastFilePath = FPath EndIf If FileExist(SFound) Then FName = FileRoot(SFound) Extension = StrUpper(FileExtension(SFound)) FileName = StrCat(FName, ".", Extension) If Extension == "EXE" || Extension == "COM" || Extension == "DLL" Then FVersion = FileVerInfo(SFound, "", "FileVersion") Else FVersion = "" Endif Details = StrCat(FileName, "=F|", FileSizeEx(SFound, 1), "|", FileYMDHMS(SFound), "|", FVersion) EndIf FileWrite(File, Details) EndWhile FafClose(fsHandle) Next A FileClose(File)
The extender has been tested with all the flavors of reparse points and there are no known issues with reparse points. Directory junctions are presented to the extender by the system as normal directory paths.
Since your script is running as a native NT service, as local system, then it is going to have a level of access that is greater than what members of the Administrators group have, and the restrictive deny permissions that are present on some of the junctions under user profiles will not prevent the script from traversing those junctions. With that said, it is almost a certainty that there is, in fact, a recursive junction or directory symbolic link present in the path on the affected computer. If you want to investigate this further, use the "psexec" utility in the SysInternals Suite to run an instance of "cmd.exe" as local system, then use the CD and DIR commands to interrogate the file system contents under the user profile in question.
Note that you would need to use "dir /a" to see hidden directory junctions.
Possible workaround: There may be better ones. You would need to modify it according to your needs, of course. You will need to check for then ignore all reparse points.
FILE_ATTRIBUTE_REPARSE_POINT = 1024 hKernel32 = DllLoad("kernel32") strDir= "C:\Users\username\Application Data" if DllCall(hKernel32, long:"GetFileAttributesW", lpwstr:strDir) & FILE_ATTRIBUTE_REPARSE_POINT then strText = "is" else strText = "is not" DllFree(hKernel32) Message( strDir, strText:" a reparse point")
Article ID: W17572
Filename: FAFFind Returns duplicated Directories.txt
File Created: 2013:10:16:08:34:12
Last Updated: 2013:10:16:08:34:12