A version of this page is also available for
This function obtains the following information about the amount of space available on a disk volume:
- Total amount of space
- Amount of free space
- Amount of free space available to the user associated with the calling thread
BOOL GetDiskFreeSpaceEx( LPCWSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes );
[in] Pointer to a null-terminated string that specifies a directory on the specified disk. This string can be a Universal Naming Convention (UNC) name.
If this parameter is set to NULL, this function obtains information about the object store.
This parameterdoes not have to specify the root directory on a disk. This function accepts any directory on the disk.
[out] Pointer to a variable to receive the number of free bytes on the disk that are available to the user associated with the calling thread.
[out] Pointer to a variable to receive the number of bytes on the disk that are available to the user associated with the calling thread.
[out] Pointer to a variable to receive the total number of free bytes on the disk.
This parameter can be set to NULL.
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
The values obtained by this function are of type ULARGE_INTEGER. Be sure not to truncate these values to 32 bits.
When Mobile Encryption is enabled, the reporting behavior of this function changes. Each encrypted file has at least one 4-KB page of overhead associated. This function takes this overhead into account when it reports the amount pf space available. That is, if a 128-KB disk contains a single 60-KB file, this function reports that 64 KB is available, subtracting the space occupied by both the file and its associated overhead.
Although this function reports the total available space, keep the space requirement for encrypted files in mind when estimating whether multiple new files will fit into the remaining space. Include the amount of space required for overhead when Mobile Encryption is enabled. Each file requires at least an additional 4 KB. For example, a single 60-KB file requires 64 KB, but two 30-KB files actually require 68 KB.
|Windows Embedded CE||Windows CE 2.0 and later|
|Windows Mobile||Windows Mobile Version 5.0 and later|