xref: /reactos/drivers/filesystems/fastfat/lfn.h (revision dfb7e2d6)
1 /*++
2 
3 Copyright (c) 1989-2000 Microsoft Corporation
4 
5 Module Name:
6 
7     Lfn.h
8 
9 Abstract:
10 
11     This module defines the on-disk structure of long file names on FAT.
12 
13 
14 --*/
15 
16 #ifndef _LFN_
17 #define _LFN_
18 
19 //
20 //  This strucure defines the on disk format on long file name dirents.
21 //
22 
23 typedef struct _PACKED_LFN_DIRENT {
24     UCHAR     Ordinal;    //  offset =  0
25     UCHAR     Name1[10];  //  offset =  1 (Really 5 chars, but not WCHAR aligned)
26     UCHAR     Attributes; //  offset = 11
27     UCHAR     Type;       //  offset = 12
28     UCHAR     Checksum;   //  offset = 13
29     WCHAR     Name2[6];   //  offset = 14
30     USHORT    MustBeZero; //  offset = 26
31     WCHAR     Name3[2];   //  offset = 28
32 } PACKED_LFN_DIRENT;      //  sizeof = 32
33 typedef PACKED_LFN_DIRENT *PPACKED_LFN_DIRENT;
34 
35 #define FAT_LAST_LONG_ENTRY             0x40 // Ordinal field
36 #define FAT_LONG_NAME_COMP              0x0  // Type field
37 
38 //
39 //  A packed lfn dirent is already quadword aligned so simply declare a
40 //  lfn dirent as a packed lfn dirent.
41 //
42 
43 typedef PACKED_LFN_DIRENT LFN_DIRENT;
44 typedef LFN_DIRENT *PLFN_DIRENT;
45 
46 //
47 //  This is the largest size buffer we would ever need to read an Lfn
48 //
49 
50 #define MAX_LFN_CHARACTERS              260
51 #define MAX_LFN_DIRENTS                 20
52 
53 #define FAT_LFN_DIRENTS_NEEDED(NAME) (((NAME)->Length/sizeof(WCHAR) + 12)/13)
54 
55 #endif // _LFN_
56 
57