Page 1 of 1

Posted: Sun Apr 21, 2002 6:33 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

Hi all,

The following code should scan drive c and write the Directory tree to the File
c:\scan.log, but it always crashes on a certain Directory.
Is there someting wrong in this code? Can someone help me?

Code: Select all

; ++++++++++++++++++++++++++++++++++++++++++
  
Procedure SearchDisk(path.s)
  WriteStringN(path)
  name.s = path + "*"
  handle.l = FindFirstFile_(name, info.WIN32_FIND_DATA)
  If handle  #INVALID_HANDLE_VALUE
    Repeat
      Entry.s = PeekS(@info\cFileName[0]) 
      If info\dwFileAttributes & #FILE_ATTRIBUTE_DIRECTORY
        If Entry  "." And Entry  ".."
          SearchDisk(path + Entry + "\")
        EndIf
      EndIf
    Until FindNextFile_(handle, info)= #FALSE
    FindClose_(handle)
  EndIf
EndProcedure
  
CreateFile(0, "c:\scan.log")
  SearchDisk("C:\")
CloseFile(0)
  
; ++++++++++++++++++++++++++++++++++++++++++
Timo



A debugged program is one for which you have not yet found the conditions that make it fail.

Posted: Sun Apr 21, 2002 9:06 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

WIN32_FIND_DATA structure is wrong, only 32 bytes for the filename (instead of 260). It's fixed, but you have to wait for v3.10 (in a week) or redo the structure...

Fred - AlphaSND

Posted: Sun Apr 21, 2002 9:16 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

Yes, I redid the structure, thanks.

A debugged program is one for which you have not yet found the conditions that make it fail.