ReactOS  0.4.15-dev-489-g75a0787
getdfree.c
Go to the documentation of this file.
1 #include <precomp.h>
2 #include <ctype.h>
3 #include <direct.h>
4 
5 
6 /*
7  * @implemented
8  */
9 unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t* _diskspace)
10 {
11  char RootPathName[10];
12 
13  RootPathName[0] = toupper(_drive +'@');
14  RootPathName[1] = ':';
15  RootPathName[2] = '\\';
16  RootPathName[3] = 0;
17  if (_diskspace == NULL)
18  return 0;
19  if (!GetDiskFreeSpaceA(RootPathName,(LPDWORD)&_diskspace->sectors_per_cluster,(LPDWORD)&_diskspace->bytes_per_sector,
20  (LPDWORD )&_diskspace->avail_clusters,(LPDWORD )&_diskspace->total_clusters))
21  return 0;
22  return _diskspace->avail_clusters;
23 }
unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t *_diskspace)
Definition: getdfree.c:9
smooth NULL
Definition: ftsmooth.c:416
int toupper(int c)
Definition: utclib.c:881
unsigned bytes_per_sector
Definition: direct.h:24
unsigned avail_clusters
Definition: direct.h:22
unsigned total_clusters
Definition: direct.h:21
uint32_t * LPDWORD
Definition: typedefs.h:58
BOOL WINAPI GetDiskFreeSpaceA(IN LPCSTR lpRootPathName, OUT LPDWORD lpSectorsPerCluster, OUT LPDWORD lpBytesPerSector, OUT LPDWORD lpNumberOfFreeClusters, OUT LPDWORD lpTotalNumberOfClusters)
Definition: disk.c:142
unsigned sectors_per_cluster
Definition: direct.h:23