Ignore:
Timestamp:
Sep 4, 2000, 8:24:43 PM (25 years ago)
Author:
sandervl
Message:

GetDiskFreeSpace(Ex) changes/fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/oslibdos.cpp

    r4008 r4189  
    1 /* $Id: oslibdos.cpp,v 1.39 2000-08-14 08:10:16 sandervl Exp $ */
     1/* $Id: oslibdos.cpp,v 1.40 2000-09-04 18:24:42 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    19381938//******************************************************************************
    19391939//******************************************************************************
    1940 
    1941 
     1940BOOL OSLibGetDiskFreeSpace(LPSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
     1941                           LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters,
     1942                           LPDWORD lpTotalNumberOfClusters)
     1943{
     1944 ULONG diskNum;
     1945 FSALLOCATE fsAlloc;
     1946 APIRET rc;
     1947
     1948   if(lpRootPathName == 0)
     1949      diskNum = 0;
     1950   else
     1951   if('A' <= *lpRootPathName && *lpRootPathName <= 'Z' )
     1952      diskNum = *lpRootPathName - 'A' + 1;
     1953   else
     1954   if('a' <= *lpRootPathName && *lpRootPathName <= 'z' )
     1955      diskNum = *lpRootPathName - 'a' + 1;
     1956   else
     1957      diskNum = 0;
     1958
     1959   DosError(FERR_DISABLEHARDERR);
     1960   rc = DosQueryFSInfo(diskNum, FSIL_ALLOC, &fsAlloc, sizeof(fsAlloc));
     1961   DosError(FERR_ENABLEHARDERR);
     1962
     1963   if(rc == 0)
     1964   {
     1965        *lpSectorsPerCluster     = fsAlloc.cSectorUnit;
     1966        *lpBytesPerSector        = fsAlloc.cbSector;
     1967        *lpNumberOfFreeClusters  = fsAlloc.cUnitAvail;
     1968        *lpTotalNumberOfClusters = fsAlloc.cUnit;
     1969        SetLastError(ERROR_SUCCESS_W);
     1970        return TRUE;
     1971   }
     1972   SetLastError(error2WinError(rc));
     1973   return FALSE;
     1974}
    19421975//******************************************************************************
    19431976//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.