518 test(entry.iSize == KFile1Sz && entry.iName == KLongName2); |
518 test(entry.iSize == KFile1Sz && entry.iName == KLongName2); |
519 |
519 |
520 |
520 |
521 } |
521 } |
522 |
522 |
523 |
523 //--------------------------------------------- |
524 GLDEF_C void CallTestsL() |
524 /** |
525 // |
525 Test that the created VFAT entryset corresponds to what Windows creates in the |
526 // Call tests that may leave |
526 same situation |
527 // |
527 */ |
|
528 void TestVFatEntryInterop() |
|
529 { |
|
530 test.Next(_L("Testind VFAT entries interoperability\n")); |
|
531 QuickFormat(); |
|
532 |
|
533 TInt nRes; |
|
534 _LIT(KFName, "\\longfilename12345678"); |
|
535 |
|
536 //-- 1. create a file with long FN that isn't multiple of 13 (max unicode characters in VFAT entry) |
|
537 const TUint KFileSize = 24; |
|
538 nRes = CreateEmptyFile(TheFs, KFName, KFileSize); |
|
539 test(nRes == KErrNone); |
|
540 |
|
541 //-- 2. verify that the dir. entries are the same what Windows creates. |
|
542 nRes = TheDisk.Open(TheFs,CurrentDrive()); |
|
543 test(nRes == KErrNone); |
|
544 |
|
545 //-- read 1st dir. entry from the root dir and check it. |
|
546 //-- this is the rest of the LFN |
|
547 TInt64 posEntry = gBootSector.RootDirStartSector() << KDefaultSectorLog2; //-- dir entry1 position |
|
548 |
|
549 TFatDirEntry fatEntry; |
|
550 TPtr8 ptrEntry((TUint8*)&fatEntry, KSizeOfFatDirEntry); |
|
551 |
|
552 nRes = TheDisk.Read(posEntry, ptrEntry); |
|
553 test(nRes == KErrNone); |
|
554 |
|
555 //-- the expected entry #1 contents (what Windows places there). |
|
556 const TUint8 KEntry1[KSizeOfFatDirEntry] = {0x42, 0x32, 0x00, 0x33, 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x0F, 0x00, 0xF7, 0x37, 0x00, |
|
557 0x38, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF }; |
|
558 |
|
559 nRes = Mem::Compare(fatEntry.iData, KSizeOfFatDirEntry, KEntry1, KSizeOfFatDirEntry); |
|
560 test(nRes == KErrNone); |
|
561 |
|
562 //-- read 2nd dir. entry from the root dir and check it. |
|
563 //-- this is the beginning of the LFN |
|
564 |
|
565 posEntry += KSizeOfFatDirEntry; |
|
566 nRes = TheDisk.Read(posEntry, ptrEntry); |
|
567 test(nRes == KErrNone); |
|
568 |
|
569 //-- the expected entry #2 contents (what Windows places there). |
|
570 const TUint8 KEntry2[KSizeOfFatDirEntry] = { 0x01, 0x6C, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x66, 0x00, 0x0F, 0x00, 0xF7, 0x69, 0x00, |
|
571 0x6C, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x00, 0x00, 0x65, 0x00, 0x31, 0x00 }; |
|
572 |
|
573 nRes = Mem::Compare(fatEntry.iData, KSizeOfFatDirEntry, KEntry2, KSizeOfFatDirEntry); |
|
574 test(nRes == KErrNone); |
|
575 |
|
576 //-- read the last, 3rd entry from the root dir and check it. |
|
577 //-- this is the DOS entry |
|
578 |
|
579 posEntry += KSizeOfFatDirEntry; |
|
580 nRes = TheDisk.Read(posEntry, ptrEntry); |
|
581 test(nRes == KErrNone); |
|
582 |
|
583 //-- first 13 bytes of DOS entry SFN, attributes and DIR_NTRes field |
|
584 const TUint8 KEntry3[13] = {'L','O','N','G','F','I','~','1',' ',' ',' ', 0x20, 0x00 }; |
|
585 nRes = Mem::Compare(fatEntry.iData, 13, KEntry3, 13); |
|
586 test(nRes == KErrNone); |
|
587 |
|
588 //-- skip file time stamps, they are not consistent |
|
589 |
|
590 //-- test file size and start cluster of the file |
|
591 test(fatEntry.StartCluster() != gBootSector.RootClusterNum() && fatEntry.StartCluster() != 0); |
|
592 test(fatEntry.Size() == KFileSize); |
|
593 |
|
594 //-- goto the next entry, this must be the end of directory |
|
595 posEntry += KSizeOfFatDirEntry; |
|
596 nRes = TheDisk.Read(posEntry, ptrEntry); |
|
597 test(nRes == KErrNone); |
|
598 test(fatEntry.IsEndOfDirectory()); |
|
599 |
|
600 TheDisk.Close(); |
|
601 |
|
602 } |
|
603 |
|
604 |
|
605 void CallTestsL() |
528 { |
606 { |
529 |
607 |
530 TInt drvNum; |
608 TInt drvNum; |
531 TInt r=TheFs.CharToDrive(gDriveToTest,drvNum); |
609 TInt r=TheFs.CharToDrive(gDriveToTest,drvNum); |
532 test(r==KErrNone); |
610 test(r==KErrNone); |