Changeset 9317 for trunk/src


Ignore:
Timestamp:
Oct 3, 2002, 12:36:36 PM (23 years ago)
Author:
sandervl
Message:

PF: Implemented IOCTL_CDROM_RAW_READ

File:
1 edited

Legend:

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

    r9310 r9317  
    1 /* $Id: hmdisk.cpp,v 1.57 2002-09-30 12:53:27 sandervl Exp $ */
     1/* $Id: hmdisk.cpp,v 1.58 2002-10-03 10:36:36 sandervl Exp $ */
    22
    33/*
     
    14161416        return (ret == ERROR_SUCCESS);
    14171417    }
    1418 
     1418   
     1419    case IOCTL_CDROM_RAW_READ:
     1420    {
     1421#pragma pack(1)
     1422       struct
     1423       {
     1424        ULONG       ID_code;
     1425        UCHAR       address_mode;
     1426        USHORT      transfer_count;
     1427        ULONG       start_sector;
     1428        UCHAR       reserved;
     1429        UCHAR       interleave_size;
     1430        UCHAR       interleave_skip_factor;
     1431       } ParameterBlock;
     1432
     1433       struct OutputBlock
     1434       {
     1435         BYTE Sync[12];
     1436         BYTE Header[4];
     1437         BYTE DataArea[2048];
     1438         BYTE EDCECC[288];
     1439       } *PWinOutput;
     1440
     1441#pragma pack()
     1442
     1443        PRAW_READ_INFO rInfo = (PRAW_READ_INFO)lpInBuffer;
     1444        PWinOutput = (struct OutputBlock*)lpOutBuffer;
     1445
     1446        if( (nOutBufferSize < (sizeof(OutputBlock)*rInfo->SectorCount))
     1447            || !lpOutBuffer) {
     1448            SetLastError(ERROR_INSUFFICIENT_BUFFER);
     1449            return FALSE;
     1450        }
     1451
     1452        // setup the parameter block
     1453        memcpy(&ParameterBlock.ID_code, drvInfo->signature, 4);
     1454        ParameterBlock.address_mode = 0;
     1455        ParameterBlock.transfer_count = rInfo->SectorCount;
     1456        ParameterBlock.start_sector = rInfo->DiskOffset.LowPart / 2048;
     1457        ParameterBlock.reserved = 0;
     1458        ParameterBlock.interleave_size = 0;
     1459        ParameterBlock.interleave_skip_factor = 0;
     1460
     1461        DWORD dwParameterSize = sizeof( ParameterBlock );
     1462        DWORD dwDataSize      = ParameterBlock.transfer_count * sizeof(struct OutputBlock);
     1463        DWORD ret;
     1464
     1465        ret = OSLibDosDevIOCtl(pHMHandleData->hHMHandle,
     1466                             0x80,  // IOCTL_CDROMAUDIO
     1467                             0x72,  // CDROMDISK_READLONG
     1468                             &ParameterBlock,
     1469                             sizeof( ParameterBlock ),
     1470                             &dwParameterSize,
     1471                             PWinOutput,
     1472                             ParameterBlock.transfer_count * sizeof(struct OutputBlock),
     1473                             &dwDataSize);
     1474
     1475        if(lpBytesReturned) {
     1476            *lpBytesReturned = dwDataSize;
     1477        }
     1478
     1479       if(ret != ERROR_SUCCESS) {
     1480          dprintf(("CDROMDISK_READLONG, CDROMDISK_READLONG failed with %x!!", ret));
     1481          SetLastError(ERROR_IO_DEVICE);
     1482          return FALSE;
     1483      }
     1484      return TRUE;
     1485    }
    14191486    case IOCTL_CDROM_GET_LAST_SESSION:
    1420     case IOCTL_CDROM_RAW_READ:
    14211487    case IOCTL_CDROM_DISK_TYPE:
    14221488    case IOCTL_CDROM_GET_DRIVE_GEOMETRY:
Note: See TracChangeset for help on using the changeset viewer.