CreateFileA / CreateFileW
The CreateFile function creates, opens, or truncates a file, pipe, communications resource,
disk device, or console. It returns a handle that can be used to access the object. It can
also open and return a handle to a directory.
HANDLE CreateFile(
LPCTSTR lpFileName, // address of name of the file
DWORD dwDesiredAccess, // access (read-write) mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // address of security descriptor
DWORD dwCreationDistribution, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile // handle of file with attributes to copy
);
Returns
If the function succeeds, the return value is an open handle of the specified file. If the
specified file exists before the function call and dwCreationDistribution is CREATE_ALWAYS
or OPEN_ALWAYS, a call to GetLastError returns ERROR_ALREADY_EXISTS (even though the
function has succeeded). If the file does not exist before the call, GetLastError
returns zero.
If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error
information, call GetLastError.
|
GetDiskFreeSpaceA / GetDiskFreeSpaceW
The GetDiskFreeSpace function retrieves information about the specified disk, including
the amount of free space on the disk.
BOOL GetDiskFreeSpace(
LPCTSTR lpRootPathName, // address of root path
LPDWORD lpSectorsPerCluster, // address of sectors per cluster
LPDWORD lpBytesPerSector, // address of bytes per sector
LPDWORD lpNumberOfFreeClusters, // address of number of free clusters
LPDWORD lpTotalNumberOfClusters // address of total number of clusters
);
Returns
If the function succeeds, the return value is TRUE. If the function fails, the return
value is FALSE. To get extended error information, call GetLastError.
|
GetDriveTypeA / GetDriveTypeW
Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network
drive.
UINT GetDriveType(
LPCTSTR lpRootPathName // address of root path
);
Returns
0 Drive can't be determinded
1 Drive can't be determinded
2 Root Directory does not exist
3 Fixed Drive (Harddisk)
4 Remote Drive (Network)
5 CD-ROM-Drive
6 RAM-Disk (only GetDriveTypeA)
|
GetFullPathNameA / GetFullPathNameW
The GetFullPathName function retrieves the full path and filename of a specified file.
DWORD GetFullPathName(
LPCTSTR lpFileName, // address of name of file to find path for
DWORD nBufferLength, // size, in characters, of path buffer
LPTSTR lpBuffer, // address of path buffer
LPTSTR *lpFilePart // address of filename in path
);
Returns
If the GetFullPathName function succeeds, the return value is the length, in characters,
of the string copied to lpBuffer, not including the terminating null character. If the
lpBuffer buffer is too small, the return value is the size of the buffer, in characters,
required to hold the path. If the function fails, the return value is zero. To get extended
error information, call GetLastError.
|
GetLogicalDrives
Returns a bitmask representing the currently available disk drives.
DWORD GetLogicalDrives(VOID);
Returns
If the function succeeds, the return value is a bitmask representing the currently
available disk drives. Bit position 0 (the least- significant bit) is drive A, bit
position 1 is drive B, bit position 2 is drive C, and so on. If the function fails,
the return value is zero.
|
GetLogicalDriveStringsA / GetLogicalDriveStringsW
Fills a buffer with strings that specify valid drives in the system.
DWORD GetLogicalDriveStrings(
DWORD nBufferLength, // size of buffer
LPTSTR lpBuffer // address of buffer for drive strings
);
Returns
If the function succeeds, the return value is the length, in characters, of the strings
copied to the buffer, not including the terminating null character. Note that an ANSI-ASCII
null character uses one byte, but a Unicode null character uses two bytes.
If the buffer is not large enough, the return value is greater than nBufferLength. It is
the size of the buffer required to hold the drive strings. If the function fails, the
return value is zero. To get extended error information, use the GetLastError function.
|
GetVolumeInformationA / GetVolumeInformationW
The GetVolumeInformation function returns information about a file system and volume
whose root directory is specified.
BOOL GetVolumeInformation(
LPCTSTR lpRootPathName, // address of root directory of the file system
LPTSTR lpVolumeNameBuffer, // address of name of the volume
DWORD nVolumeNameSize, // length of lpVolumeNameBuffer
LPDWORD lpVolumeSerialNumber, // address of volume serial number
LPDWORD lpMaximumComponentLength, // address of system's maximum filename length
LPDWORD lpFileSystemFlags, // address of file system flags
LPTSTR lpFileSystemNameBuffer, // address of name of file system
DWORD nFileSystemNameSize // length of lpFileSystemNameBuffer
);
Returns
If all the requested information is retrieved, the return value is TRUE; otherwise, it
is FALSE. To get extended error information, call GetLastError.
|
|