Ignore:
Timestamp:
Jun 16, 2001, 6:10:13 PM (24 years ago)
Author:
sandervl
Message:

disk updates

File:
1 edited

Legend:

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

    r5974 r6029  
    1 /* $Id: oslibdos.cpp,v 1.64 2001-06-12 17:03:33 sandervl Exp $ */
     1/* $Id: oslibdos.cpp,v 1.65 2001-06-16 16:10:12 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    2727#include <win32api.h>
    2828#include <winconst.h>
     29#include <win\winioctl.h>
    2930#include <misc.h>
    3031#include "initterm.h"
     
    23392340}
    23402341//******************************************************************************
     2342//******************************************************************************
     2343BOOL  OSLibDosGetDiskGeometry(DWORD cDisk, PVOID pdiskgeom)
     2344{
     2345   PDISK_GEOMETRY pGeom = (PDISK_GEOMETRY)pdiskgeom;
     2346   BYTE  param[2] = {0, 0};
     2347   ULONG parsize = 2;
     2348   BIOSPARAMETERBLOCK bpb;
     2349   ULONG datasize = sizeof(bpb);
     2350   APIRET rc;
     2351
     2352   param[1] = cDisk - 'A';
     2353   rc = DosDevIOCtl(-1, IOCTL_DISK, DSK_GETDEVICEPARAMS, param, 2, &parsize, &bpb, sizeof(bpb), &datasize);
     2354   if(rc == 0)
     2355   {
     2356        pGeom->SectorsPerTrack   = bpb.usSectorsPerTrack;
     2357        pGeom->BytesPerSector    = bpb.usBytesPerSector;
     2358        pGeom->TracksPerCylinder = 80;  //TODO:!!!!!
     2359        pGeom->Cylinders.u.LowPart  = bpb.cCylinders;
     2360        pGeom->Cylinders.u.HighPart = 0;
     2361        switch(bpb.bDeviceType) {
     2362        case DEVTYPE_48TPI:
     2363            pGeom->MediaType = F5_360_512;  //?????
     2364            break;
     2365        case DEVTYPE_96TPI:
     2366            pGeom->MediaType = F5_1Pt2_512; //?????
     2367            break;
     2368        case DEVTYPE_35:
     2369            pGeom->MediaType = F3_720_512;
     2370            break;
     2371        case DEVTYPE_8SD:
     2372        case DEVTYPE_8DD:
     2373            pGeom->MediaType = RemovableMedia;
     2374            break;
     2375        case DEVTYPE_FIXED:
     2376            pGeom->MediaType = FixedMedia;
     2377            break;
     2378        case DEVTYPE_TAPE:
     2379            pGeom->MediaType = RemovableMedia;
     2380            break;
     2381        case DEVTYPE_UNKNOWN: //others, include 1.44 3.5 inch disk drive
     2382            pGeom->MediaType = F3_1Pt44_512;
     2383            break;
     2384        case 8: //RW optical disk
     2385            pGeom->MediaType = RemovableMedia;
     2386            break;
     2387        case 9: //2.88 3.5 inch disk
     2388            pGeom->MediaType = F3_2Pt88_512;
     2389            break;
     2390        }
     2391        SetLastError(ERROR_SUCCESS_W);
     2392        return TRUE;
     2393   }
     2394   SetLastError(error2WinError(rc));
     2395   return FALSE;
     2396}
     2397//******************************************************************************
    23412398//Returns bit map where with the mapping of the logical drives
    23422399//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.