ReactOS 0.4.16-dev-555-g690643f
dos.h File Reference
#include <corecrt.h>
#include <io.h>
Include dependency graph for dos.h:

Go to the source code of this file.

Classes

struct  _diskfree_t
 

Macros

#define _DISKFREE_T_DEFINED
 
#define _A_NORMAL   0x00
 
#define _A_RDONLY   0x01
 
#define _A_HIDDEN   0x02
 
#define _A_SYSTEM   0x04
 
#define _A_VOLID   0x08
 
#define _A_SUBDIR   0x10
 
#define _A_ARCH   0x20
 
#define _GETDISKFREE_DEFINED
 
#define diskfree_t   _diskfree_t
 

Functions

_CRTIMP unsigned __cdecl _getdiskfree (unsigned _Drive, struct _diskfree_t *_DiskFree)
 

Macro Definition Documentation

◆ _A_ARCH

#define _A_ARCH   0x20

Definition at line 35 of file dos.h.

◆ _A_HIDDEN

#define _A_HIDDEN   0x02

Definition at line 31 of file dos.h.

◆ _A_NORMAL

#define _A_NORMAL   0x00

Definition at line 29 of file dos.h.

◆ _A_RDONLY

#define _A_RDONLY   0x01

Definition at line 30 of file dos.h.

◆ _A_SUBDIR

#define _A_SUBDIR   0x10

Definition at line 34 of file dos.h.

◆ _A_SYSTEM

#define _A_SYSTEM   0x04

Definition at line 32 of file dos.h.

◆ _A_VOLID

#define _A_VOLID   0x08

Definition at line 33 of file dos.h.

◆ _DISKFREE_T_DEFINED

#define _DISKFREE_T_DEFINED

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER within this package.

Definition at line 19 of file dos.h.

◆ _GETDISKFREE_DEFINED

#define _GETDISKFREE_DEFINED

Definition at line 38 of file dos.h.

◆ diskfree_t

#define diskfree_t   _diskfree_t

Definition at line 48 of file dos.h.

Function Documentation

◆ _getdiskfree()

_CRTIMP unsigned __cdecl _getdiskfree ( unsigned  _Drive,
struct _diskfree_t _DiskFree 
)

Definition at line 19 of file drivfree.cpp.

23{
26
28
29 wchar_t drive_name_buffer[4] = { '_', ':', '\\', '\0' };
30
31 wchar_t const* const drive_name = drive_number == 0
32 ? nullptr
33 : drive_name_buffer;
34
35 if (drive_number != 0)
36 {
37 drive_name_buffer[0] = static_cast<wchar_t>(drive_number) + static_cast<wchar_t>(L'A' - 1);
38 }
39
40 static_assert(sizeof(result->sectors_per_cluster) == sizeof(DWORD), "Unexpected sizeof long");
41
42 if (!GetDiskFreeSpaceW(drive_name,
43 reinterpret_cast<LPDWORD>(&result->sectors_per_cluster),
44 reinterpret_cast<LPDWORD>(&result->bytes_per_sector),
45 reinterpret_cast<LPDWORD>(&result->avail_clusters),
46 reinterpret_cast<LPDWORD>(&result->total_clusters)))
47 {
48 int const os_error = GetLastError();
50
51 return os_error;
52 }
53
54 return 0;
55}
#define EINVAL
Definition: acclib.h:90
int __cdecl __acrt_errno_from_os_error(unsigned long)
Definition: errno.cpp:103
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOL WINAPI GetDiskFreeSpaceW(IN LPCWSTR lpRootPathName, OUT LPDWORD lpSectorsPerCluster, OUT LPDWORD lpBytesPerSector, OUT LPDWORD lpNumberOfFreeClusters, OUT LPDWORD lpTotalNumberOfClusters)
Definition: disk.c:173
return nullptr
Definition: expand.cpp:78
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint64EXT * result
Definition: glext.h:11304
__u8 drive_number
Definition: mkdosfs.c:0
#define L(x)
Definition: ntvdm.h:50
#define errno
Definition: errno.h:18
uint32_t * LPDWORD
Definition: typedefs.h:59
DWORD WINAPI GetLastError(void)
Definition: except.c:1042