ReactOS  0.4.15-dev-309-g7c8d563
getdfree.c File Reference
#include <precomp.h>
#include <ctype.h>
#include <direct.h>
Include dependency graph for getdfree.c:

Go to the source code of this file.

Functions

unsigned int _getdiskfree (unsigned int _drive, struct _diskfree_t *_diskspace)
 

Function Documentation

◆ _getdiskfree()

unsigned int _getdiskfree ( unsigned int  _drive,
struct _diskfree_t _diskspace 
)

Definition at line 9 of file getdfree.c.

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 }
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