Changeset 60


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

Misc updates.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/dosh.h

    r59 r60  
    6464     ********************************************************************/
    6565
    66     VOID doshEnumDrives(PSZ pszBuffer,
    67                         const char *pcszFileSystem,
    68                         BOOL fSkipRemoveables);
     66    VOID XWPENTRY doshEnumDrives(PSZ pszBuffer,
     67                                 const char *pcszFileSystem,
     68                                 BOOL fSkipRemoveables);
     69    typedef VOID XWPENTRY DOSHENUMDRIVES(PSZ pszBuffer,
     70                                         const char *pcszFileSystem,
     71                                         BOOL fSkipRemoveables);
     72    typedef DOSHENUMDRIVES *PDOSHENUMDRIVES;
    6973
    7074    CHAR doshQueryBootDrive(VOID);
     
    7478    APIRET doshSetLogicalMap(ULONG ulLogicalDrive);
    7579
    76     APIRET doshQueryDiskFree(ULONG ulLogicalDrive,
    77                              double *pdFree);
    78 
    79     APIRET doshQueryDiskFSType(ULONG ulLogicalDrive,
    80                                PSZ pszBuf,
    81                                ULONG cbBuf);
     80    APIRET XWPENTRY doshQueryDiskSize(ULONG ulLogicalDrive, double *pdSize);
     81    typedef APIRET XWPENTRY DOSHQUERYDISKSIZE(ULONG ulLogicalDrive, double *pdSize);
     82    typedef DOSHQUERYDISKSIZE *PDOSHQUERYDISKSIZE;
     83
     84    APIRET XWPENTRY doshQueryDiskFree(ULONG ulLogicalDrive, double *pdFree);
     85    typedef APIRET XWPENTRY DOSHQUERYDISKFREE(ULONG ulLogicalDrive, double *pdFree);
     86    typedef DOSHQUERYDISKFREE *PDOSHQUERYDISKFREE;
     87
     88    APIRET XWPENTRY doshQueryDiskFSType(ULONG ulLogicalDrive, PSZ pszBuf, ULONG cbBuf);
     89    typedef APIRET XWPENTRY DOSHQUERYDISKFSTYPE(ULONG ulLogicalDrive, PSZ pszBuf, ULONG cbBuf);
     90    typedef DOSHQUERYDISKFSTYPE *PDOSHQUERYDISKFSTYPE;
    8291
    8392    APIRET doshIsFixedDisk(ULONG  ulLogicalDrive,
  • 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.