Пример #1
0
// Get the letters of the first two removable drives and put them into
// the passed in string in the form: a:0b:0 (two zero terminated strings)
static int GetFloppyDrives (LPSTR lpString)
{
#ifdef WIN32
    return 0;
#else
    int i, drive;
    WORD wType;
    int count = 0;
    int idx = 0;

    drive = CURRENTDRIVE;
    for (i = 0 ; i <= 26 ; i++)
    {
        if (! (GetDriveType (i)) )
            continue;
        wType = GetExtendedDriveType (i);
        if (i != drive && (wType == DRIVE_REMOVABLE))
        {
            lpString[idx++] = toupper('a' + i);
            lpString[idx++] = ':';
            lpString[idx++] = 0;
            count++;
            if (count >= 2)
                return count;
        }
    }
    return count;
#endif
}
Пример #2
0
LPSTR DriveName(
/************************************************************************/
int 	iDrive,
LPSTR 	lpName)
{
#ifdef WIN32

#else
STRING szString;
struct find_t vol;
WORD	wType;

lpName[0] = 'a' + iDrive;
lpName[1] = ':';
lpName[2] = '\0';
lstrcpy( szString, lpName );
lstrcat( szString, "\\*.*" ); /* wildcard search of root dir */

lstrcat( lpName, " [" );
wType = GetExtendedDriveType(iDrive);
if ( iDrive != CURRENTDRIVE &&
	(wType == DRIVE_REMOVABLE || wType == DRIVE_CDROM) )
	lstrcat( lpName, "unknown" );
else
	{
	if ( !_dos_findfirst( szString, _A_VOLID, &vol ) )
		lstrcat( lpName, RemoveDots(vol.name) );
	else	lstrcat( lpName, "unlabeled" );
	}
lstrcat( lpName, "]" );
#endif

return( lpName );
}
Пример #3
0
LPSTR DriveSize(
/************************************************************************/
int 	iDrive,
LPSTR 	lpSize)
{
#ifdef WIN32

#else
char szString[MAX_STR_LEN];
DWORD dwSize;
WORD wType;
struct diskfree_t DiskFree;

wType = GetExtendedDriveType(iDrive);
if ( iDrive != CURRENTDRIVE &&
	(wType == DRIVE_REMOVABLE || wType == DRIVE_CDROM) )
	*lpSize = '\0';
else	{
	if ( !_dos_getdiskfree( iDrive+1, &DiskFree ) )
		{
		dwSize = (DWORD)DiskFree.avail_clusters *
				DiskFree.sectors_per_cluster * 
				DiskFree.bytes_per_sector;
		SizeToAscii( dwSize, szString );
		lstrcpy( lpSize, szString );
		lstrcat( lpSize, " / " );
		dwSize = (DWORD)DiskFree.total_clusters *
				DiskFree.sectors_per_cluster * 
				DiskFree.bytes_per_sector;
		SizeToAscii( dwSize, szString );
		lstrcat( lpSize, szString );
		}
	}
	
#endif
return( lpSize );
}