Added binary and unicode file i/o support to msvcrt.
[reactos.git] / reactos / 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 RootPathName[0] = toupper(_drive +'@');
10 RootPathName[1] = ':';
11 RootPathName[2] = '\\';
12 RootPathName[3] = 0;
13 if ( _diskspace == NULL )
14 return 0;
15
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 }