Re: FATFS bogus Directory

From: George McCollister (georgem_at_novatech-llc.com)
Date: 04/28/04

  • Next message: Bruce Eitman \(eMVP\): "Re: Add a driver to Wince .net 4.2"
    Date: Wed, 28 Apr 2004 15:45:07 -0500
    
    

    I'm not sure if this is related, but we had major problems with our FATFS in
    Windows CE .NET 4.1 when we deleted files on the parition outside of Windows
    CE. Aparently long file name entries are stored as bogus directory entries.
    Deleting files in a non long file name aware OS seems to cause the directory
    entries to orphaned. We did notice that defragging the file system would
    sometimes mask the problem.

    George McCollister
    NovaTech LLC

    "Johannes Heusel" <development@NO.narda-sts.SPAM.de> wrote in message
    news:1083172833.409687@narda-relay.narda-sts.de...
    Hello,
    We are using WinCE 4.2 and having problems with the flash file system. We
    use stratad.dll, mspart.dll to get a FATFS file system running. It still
    runs but sometimes we got a bogus directory after startup. We still work on,
    but if I try to save a dataset the CreateFile function does not give a
    invalid handle. So the dataset is not saved on disk but Create file returned
    with a valid handle. (see example below)
    Also we use ScanVolumeEx and DefragVolumeEx functions from Fatutil.dll to
    check our file system. Those function tells no problem. But we still have.
    Also is the return value from DefragVolumeEx (DEFRAG_RESULTS including only
    SCAN_RESULTS)not actual. The values from dr.sr are the same as from a scan
    before doing defrag. So what could I do with that result? Is there any
    example code how to use the FATUTIL functions?
    Before we power off the system we dismount all flash partitions and dismount
    the flash volume.
    Then we do a hard power off, because we start our system always new(no
    changing registry)

    Now my questions:
    What went wrong that I get bogus directories?
    How could I detect the bogus directory problem and how could I repair my
    files?
    Why could ScanVolume not detect the bogus directories?
    What happens if power fall down without dismounting all the Flash stuff and
    what could I do to prevent that?
    Must I use the TFAT format, and when yes could I use the "old" formatted
    Volume without data lost?
    Is it enough to dismount all flash stuff or must I do more than this?

    A lot of question with the hope for a helpful answer
    Johannes Heusel
    Thanks!!

    Debug trace:

    906317 PID:edbb6efe TID:edbb62c2 0x8dbb7000: +SetMeasData (tsDATA_PARAM)
    906320 PID:cdfe35a2 TID:edbb62c2 0x8dbb7000: FATFS!FindNext: bogus
    directory!
    906320 PID:cdfe35a2 TID:edbb62c2 0x8dbb7000:
    FATFS!FAT_GetFileAttributesW(\000\040422142439-01.dat) returned 0xffffffff
    (13)
    906321 PID:cdfe35a2 TID:edbb62c2 0x8dbb7000: FATFS!FindNext: bogus
    directory!
    906356 PID:edbb6efe TID:edbb62c2 0x8dbb7000: -SetMeasData:eNO_ERR

    Source code example:

      // create a new file.
      hFile = CreateFile(strFilePath, GENERIC_WRITE, 0,NULL, CREATE_NEW,
    FILE_ATTRIBUTE_NORMAL, NULL);

      if (hFile == INVALID_HANDLE_VALUE)
      {
        nErr = GetLastError();
        if (nErr != ERROR_FILE_EXISTS)
        {
          RETAILMSG(DEBUG_MEAS_API, (_T("-SetMeasData:eERR_ACCESS
    %d=GetLastError()\n"),nErr));
          return eERR_ACCESS;
        }
      }
    //...rest of code


  • Next message: Bruce Eitman \(eMVP\): "Re: Add a driver to Wince .net 4.2"