Benjamin
Benjamin

Reputation: 10393

What does the CCHAR mean in Windows types?

typedef struct _FILE_BOTH_DIR_INFORMATION {
ULONG NextEntryOffset;
ULONG FileIndex;
LARGE_INTEGER CreationTime;
LARGE_INTEGER LastAccessTime;
LARGE_INTEGER LastWriteTime;
LARGE_INTEGER ChangeTime;
LARGE_INTEGER EndOfFile;
LARGE_INTEGER AllocationSize;
ULONG FileAttributes;
ULONG FileNameLength;
ULONG EaSize;
CCHAR ShortNameLength;
WCHAR ShortName[12];
WCHAR FileName[1];
} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;

FileNameLength is declared ULONG. I guessed this is byte-count because all(or most) string lengths are byte-count in the kernel.
Yesterday, I wrote wrong code, because I misunderstood that it means count of char when I see CCHAR ShortNameLength. Now, I know ShortNameLength requires bytes-count.
Then, what does C mean in CCHAR?

Upvotes: 0

Views: 626

Answers (1)

Joel Spolsky
Joel Spolsky

Reputation: 33667

C means count in Hungarian Notation. A variable named cch would be a "count of chars" and you would expect it to contain a string length. So CCHAR is the type that can contain a count of chars.

It's a horrible abuse of Hungarian notation typical of the Windows team.

Upvotes: 2

Related Questions