Drive空き容量をもとめる
無印Win95 には GetDiskFreeSpaceEx がないので場合分けが必要。

double GetDiskFreeSpaceBytes(LPCTSTR szDrive)
{
  double dRet;

  BOOL (WINAPI *pGetDiskFreeSpaceEx)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);

#ifdef _UNICODE
  pGetDiskFreeSpaceEx = (BOOL (WINAPI *)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER))
                                        GetProcAddress( GetModuleHandle("kernel32.dll"), "GetDiskFreeSpaceExW");
#else
  pGetDiskFreeSpaceEx = (BOOL (WINAPI *)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER))
                                        GetProcAddress( GetModuleHandle("kernel32.dll"), "GetDiskFreeSpaceExA");
#endif

  if (pGetDiskFreeSpaceEx)
  {
     ULARGE_INTEGER i64FreeBytesToCaller; // bytes available to caller
     ULARGE_INTEGER i64TotalBytes; // bytes on disk
     ULARGE_INTEGER i64FreeBytes;
     if (!pGetDiskFreeSpaceEx(szDrive, &i64FreeBytesToCaller, &i64TotalBytes, &i64FreeBytes))
       return -1.0;

     dRet = (double)(signed __int64)i64FreeBytes.QuadPart;
  }
  else
  {
     DWORD dwSectPerClust;
     DWORD dwBytesPerSect;
     DWORD dwFreeClusters;
     DWORD dwTotalClusters;
     if (!GetDiskFreeSpace (szDrive, &dwSectPerClust, &dwBytesPerSect, &dwFreeClusters, &dwTotalClusters))
       return -1.0;

     dRet = dwFreeClusters * dwSectPerClust * dwBytesPerSect;
  }
  return dRet;
}


VC覚書きページ...