branch update for HEAD-2003021201
[reactos.git] / lib / crtdll / direct / getdfree.c
1 #include <windows.h>
2 #include <msvcrt/ctype.h>
3 #include <msvcrt/direct.h>
4
5
6 unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t* _diskspace)
7 {
8     char RootPathName[10];
9
10     RootPathName[0] = toupper(_drive +'@');
11     RootPathName[1] = ':';
12     RootPathName[2] = '\\';
13     RootPathName[3] = 0;
14     if (_diskspace == NULL)
15         return 0;
16     if (!GetDiskFreeSpaceA(RootPathName,(LPDWORD)&_diskspace->sectors_per_cluster,(LPDWORD)&_diskspace->bytes_per_sector,
17             (LPDWORD )&_diskspace->avail_clusters,(LPDWORD )&_diskspace->total_clusters))
18         return 0;
19     return _diskspace->avail_clusters;
20 }