1.取得当前目录
2.取得操作系统盘符
3.取得操作系统盘可用空间的情况
// 判断系统磁盘可用空间的情况。返回可用空间大小情况: TRUE 大于1GB,FALSE 小于1GB。
BOOL CheckSystemDiskFreeSpace( )
{
TCHAR sysDir[128];
GetSystemDirectory(sysDir, 128 * sizeof(TCHAR));
BOOL bret;
ULONGLONG ullMaxSpace = 0;
TCHAR szRootPath[] = { TCHAR('A'), ':', '\\', 0 };//带根目录标记的磁盘符号
szRootPath[0] = sysDir[0];
DWORD dwSectorsPerCluster = 0;//每簇中扇区数
DWORD dwBytesPerSector = 0;//每扇区中字节数
DWORD dwFreeClusters = 0;//剩余簇数
DWORD dwTotalClusters = 0;//总簇数
if (GetDiskFreeSpace(szRootPath, &dwSectorsPerCluster, &dwBytesPerSector,
&dwFreeClusters, &dwTotalClusters))
{
ullMaxSpace = ULONGLONG(dwFreeClusters)*ULONGLONG(dwSectorsPerCluster)*ULONGLONG(dwBytesPerSector);
if (ullMaxSpace > 1024*1024*1024)
{
return TRUE;
}
}
return FALSE;
}