Ignore:
Timestamp:
Apr 18, 2001, 7:17:09 PM (24 years ago)
Author:
umoeller
Message:

Misc updates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/dosh.c

    r55 r60  
    572572                       | OPEN_SHARE_DENYNONE,
    573573                 0);
     574
    574575    if (rc == NO_ERROR)
    575576    {
     
    589590
    590591/*
    591  *@@ doshQueryDiskFree:
    592  *       returns the number of bytes remaining on the disk
    593  *       specified by the given logical drive.
    594  *
    595  *       Note: This returns a "double" value, because a ULONG
    596  *       can only hold values of some 4 billion, which would
    597  *       lead to funny results for drives > 4 GB.
    598  *
    599  *@@changed V0.9.0 [umoeller]: fixed another > 4 GB bug (thanks to Rdiger Ihle)
    600  *@@changed V0.9.7 (2000-12-01) [umoeller]: changed prototype
    601  */
    602 
    603 APIRET doshQueryDiskFree(ULONG ulLogicalDrive, // in: 1 for A:, 2 for B:, 3 for C:, ...
    604                          double *pdFree)
     592 *@@ doshQueryDiskSize:
     593 *      returns the size of the specified disk in bytes.
     594 *
     595 *      Note: This returns a "double" value, because a ULONG
     596 *      can only hold values of some 4 billion, which would
     597 *      lead to funny results for drives > 4 GB.
     598 *
     599 *@@added V0.9.11 (2001-04-18) [umoeller]
     600 */
     601
     602APIRET doshQueryDiskSize(ULONG ulLogicalDrive, // in: 1 for A:, 2 for B:, 3 for C:, ...
     603                         double *pdSize)
    605604{
    606605    APIRET      arc = NO_ERROR;
     
    608607    double      dbl = -1;
    609608
    610     arc = DosQueryFSInfo(ulLogicalDrive, FSIL_ALLOC, &fsa, sizeof(fsa));
    611     if (arc == NO_ERROR)
     609    if (!(arc = DosQueryFSInfo(ulLogicalDrive, FSIL_ALLOC, &fsa, sizeof(fsa))))
     610        *pdSize = ((double)fsa.cSectorUnit * fsa.cbSector * fsa.cUnit);
     611
     612    return (arc);
     613}
     614
     615/*
     616 *@@ doshQueryDiskFree:
     617 *      returns the number of bytes remaining on the disk
     618 *      specified by the given logical drive.
     619 *
     620 *      Note: This returns a "double" value, because a ULONG
     621 *      can only hold values of some 4 billion, which would
     622 *      lead to funny results for drives > 4 GB.
     623 *
     624 *@@changed V0.9.0 [umoeller]: fixed another > 4 GB bug (thanks to Rdiger Ihle)
     625 *@@changed V0.9.7 (2000-12-01) [umoeller]: changed prototype
     626 */
     627
     628APIRET doshQueryDiskFree(ULONG ulLogicalDrive, // in: 1 for A:, 2 for B:, 3 for C:, ...
     629                         double *pdFree)
     630{
     631    APIRET      arc = NO_ERROR;
     632    FSALLOCATE  fsa;
     633    double      dbl = -1;
     634
     635    if (!(arc = DosQueryFSInfo(ulLogicalDrive, FSIL_ALLOC, &fsa, sizeof(fsa))))
    612636        *pdFree = ((double)fsa.cSectorUnit * fsa.cbSector * fsa.cUnitAvail);
    613637                   // ^ fixed V0.9.0
Note: See TracChangeset for help on using the changeset viewer.