(Win32) Filesystem allocation page size?

Started by
0 comments, last by Jan Wassenberg 16 years, 3 months ago
In Win32 is there a way to determine the size of an allocation page on a filesystem? I'm writing a function to truncate a file from the current position by changing the EOF value. I want to also free any allocation pages no longer used after this is done, but I have to know the size of an allocation page to accomplish this. I know that typically the allocation pages on an NTFS filesystem are 4 KB, but I can't depend on that value, as I want to be able to use this code on any PC with Windows. Any help is appreciated.
---------------------------------Upon thine ass shall I bust but a single cap.
Advertisement
To determine cluster size, use GetDiskFreeSpace. Note however that the FS is responsible for trimming away unneeded clusters when you SetEndOfFile.

HTH+HAND
E8 17 00 42 CE DC D2 DC E4 EA C4 40 CA DA C2 D8 CC 40 CA D0 E8 40E0 CA CA 96 5B B0 16 50 D7 D4 02 B2 02 86 E2 CD 21 58 48 79 F2 C3

This topic is closed to new replies.

Advertisement