CDINFO


CDINFO MSCDEX.EXE, CD-ROM, , -.

, CDINFO DOS Microsoft Windows 95:

CDINFO, (c) A. Frolov, 1997

MSCDEX version: 2.95

Found 1 CD Unit, start unit: G

CD-ROM letters: G

Status of CD Drive G: 00000390

VolumeSize: 29460 blocks

Tracks: (1 - 1) 8252

track 1: location: 512, info: 41 * digital, copy prohibited *

CD?ROM, -.

, , CD-ROM. (H:) , (I:) - :

CDINFO, (c) A. Frolov, 1997

MSCDEX version: 2.21

Found 2 CD Unit, start unit: H

CD-ROM letters: H I

Status of CD Drive H: 00000390

VolumeSize: 302375 blocks

Tracks: (1 - 15) 2866

track 1: location: 512, info: 01 * audio, copy prohibited *

track 2: location: 79922, info: 01 * audio, copy prohibited *

track 3: location: 466492, info: 01 * audio, copy prohibited *

track 4: location: 788490, info: 01 * audio, copy prohibited *

track 5: location: 1120281, info: 01 * audio, copy prohibited *

track 6: location: 1453334, info: 01 * audio, copy prohibited *

track 7: location: 1778979, info: 01 * audio, copy prohibited *

track 8: location: 2042649, info: 01 * audio, copy prohibited *

track 9: location: 2363412, info: 01 * audio, copy prohibited *

track 10: location: 2565639, info: 01 * audio, copy prohibited *

track 11: location: 2823479, info: 01 * audio, copy prohibited *

track 12: location: 3094814, info: 01 * audio, copy prohibited *

track 13: location: 3419404, info: 01 * audio, copy prohibited *

track 14: location: 3740478, info: 01 * audio, copy prohibited *


track 15: location: 4130306, info: 01 * audio, copy prohibited *

Status of CD Drive I: 00000390

VolumeSize: 278505 blocks

Tracks: (1 - 4) 13598

track 1: location: 512, info: 41 * digital, copy prohibited *

track 2: location: 3282733, info: 01 * audio, copy prohibited *

track 3: location: 3608079, info: 01 * audio, copy prohibited *

track 4: location: 3801921, info: 01 * audio, copy prohibited *

, Microsoft Windows NT . - MSCDEX.

CDINFO 9.1.

9.1. cdinfo\cdinfo.

// =====================================================

//

// CD-ROM -

// MSCDEX

// CD-ROM

//

// (C) ., 1997

//

// E-mail: frolov@glas.apc.org

// WWW: http://www.glasnet.ru/~frolov

//

// http://www.dials.ccas.ru/frolov

// =====================================================

#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

#include <dos.h>

#include <memory.h>



typedef unsigned char BYTE;

typedef unsigned int WORD;

typedef unsigned long DWORD;

//

//

#pragma pack(1)

//

typedef struct _ReqHdr

{

BYTE bSize;

BYTE bSubUnit;

BYTE bCmd;

WORD wStatus;

BYTE bReserved[8];

} ReqHdr;



// IOCTL Input

typedef struct _IOCTL_Input

{

ReqHdr rh;

BYTE bMediaDescriptor;

DWORD lpTransferAddress;

WORD wDataSize;

WORD wStartSector;

DWORD lpVolID;

} IOCTL_Input;

// -

typedef struct _DiskInfo

{

BYTE bControl;



BYTE bLowest;

BYTE bHighest;

DWORD dwTotal;

} DiskInfo;

//

// -

typedef struct _TrackInfo

{

BYTE bControl;

BYTE bTrack;

DWORD dwLoc;

BYTE bInfo;

} TrackInfo;

//

// CD-ROM

typedef struct _DeviceStatus

{

BYTE bControl;

DWORD dwParam;

} DeviceStatus;

//

// -

typedef struct _VolumeSize

{

BYTE bControl;

DWORD dwVolumeSize;

} VolumeSize;

#pragma pack()

//

void GetCDLetters(BYTE *bLetters);

void CallCDDriver(void *rh, int nCDUnit);

int GetDiskInfo(int nCDUnit);

int GetDeviceStatus(int nCDUnit);

int GetVolumeSize(int nCDUnit);

int GetTrackInfo(int iTrack, int nCDUnit);

void delay(int ms);

// int86

union REGS rg;

// CD-ROM

int nCDUnits;

// CD-ROM

int nCDStartUnit;

// CD-ROM

int iStatus;

// -

DiskInfo di;

// CD-ROM

DeviceStatus ds;

// -

VolumeSize vs;

//

TrackInfo ti;

BYTE bLetters[26];

// ---------------------------------------------------

// main

//

// ---------------------------------------------------

int main()

{

int iRetry;

int i, j;



printf("CDINFO, (c) A. Frolov, 1997\n\n");



// , MSCDEX

rg.x.ax = 0x1500;

rg.x.bx = 0;

int86(0x2f, &rg, &rg);

if(rg.x.bx == 0)

{

printf("MSCDEX is not installed\n");

return -1;

}



else

{

// CD-ROM



nCDUnits = rg.x.bx;



//

nCDStartUnit = rg.x.cx;

// MSCDEX

rg.x.ax = 0x150c;

int86(0x2f, &rg, &rg);

printf("MSCDEX version: %d.%d\n", rg.h.bh, rg.h.bl);

//

// CD-ROM

printf("Found % d CD Unit, start unit: %c\n",

nCDUnits, nCDStartUnit + 'A');

}

// CD-ROM

GetCDLetters(bLetters);



// CD-ROM

printf("CD-ROM letters: ");

for(i = 0; i < nCDUnits; i++)

{

printf("%c ", bLetters[i] + 'A');

}

printf("\n");

// CD-ROM

for(i = 0; i < nCDUnits; i++)

{

//

iStatus = GetDeviceStatus(bLetters[i]);

if(iStatus != 0x0100)

{

printf("GetDeviceStatus status: %04.4X\n", iStatus);

printf("GetDeviceStatus failed\n");

exit(1);

}

printf("\nStatus of CD Drive %c: %08.8X\n",

bLetters[i] + 'A', ds.dwParam);

//

iStatus = GetVolumeSize(bLetters[i]);

if(iStatus != 0x0100)

{

printf("GetVolumeSize status: %04.4X\n", iStatus);

printf("GetVolumeSize failed\n");

}

else

printf("VolumeSize: %ld blocks\n", vs.dwVolumeSize);

//

// -

iStatus = GetDiskInfo(bLetters[i]);



//

iRetry = 0;

while(iStatus != 0x0100)

{

printf("GetDiskInfo status: %04.4X\n", iStatus);



// 1

delay(1000);



iRetry++;





if(iRetry == 3)

{

printf("GetDiskInfo failed\n");

break;

}

iStatus = GetDiskInfo(bLetters[i]);

}



// -,

//

if(iRetry != 3)

{

//

printf("Tracks: (%d - %d) %d\n",

di.bLowest, di.bHighest, di.dwTotal);

//

for(j = di.bLowest; j <= di.bHighest; j++)

{

//

GetTrackInfo(j, bLetters[i]);

printf("track %d: location: %ld, info: %02.2X",

j, ti.dwLoc, ti.bInfo);



// -

//

if(ti.bInfo & 0x40)

printf(" * digital");

else

printf(" * audio");

// ,

if(ti.bInfo & 0x20)

printf(", copy permitted *\n");

else

printf(", copy prohibited *\n");

}

}

}

return 0;

}

// ---------------------------------------------------

// GetDiskInfo

// -

// ---------------------------------------------------

int GetDiskInfo(int nCDUnit)

{

// IOCTL Input

IOCTL_Input cmd;



//

memset(&cmd, 0, sizeof(IOCTL_Input ));



//

cmd.rh.bSize = 26;

cmd.rh.bSubUnit = 0;

cmd.rh.bCmd = 3;



cmd.bMediaDescriptor = 0;

cmd.lpTransferAddress = (DWORD)(void far *)&di;

cmd.wDataSize = 7;

cmd.wStartSector = 0;

cmd.lpVolID = (DWORD)(void far *)NULL;



di.bControl = 10;



//

CallCDDriver(&cmd, nCDUnit);



return cmd.rh.wStatus;

}

// ---------------------------------------------------



// GetTrackInfo

// -

// ---------------------------------------------------

int GetTrackInfo(int iTrack, int nCDUnit)

{

IOCTL_Input cmd;



memset(&cmd, 0, sizeof(IOCTL_Input ));



cmd.rh.bSize = 26;

cmd.rh.bSubUnit = 0;

cmd.rh.bCmd = 3;



cmd.bMediaDescriptor = 0;

cmd.lpTransferAddress = (DWORD)(void far *)&ti;

cmd.wDataSize = 7;

cmd.wStartSector = 0;

cmd.lpVolID = (DWORD)(void far *)NULL;



ti.bControl = 11;

ti.bTrack = iTrack;



CallCDDriver(&cmd, nCDUnit);



return cmd.rh.wStatus;

}

// ---------------------------------------------------

// GetDeviceStatus

// CD-ROM

// ---------------------------------------------------

int GetDeviceStatus(int nCDUnit)

{

IOCTL_Input cmd;



memset(&cmd, 0, sizeof(IOCTL_Input ));



cmd.rh.bSize = 26;

cmd.rh.bSubUnit = 0;

cmd.rh.bCmd = 3;



cmd.bMediaDescriptor = 0;

cmd.lpTransferAddress = (DWORD)(void far *)&ds;

cmd.wDataSize = 5;

cmd.wStartSector = 0;

cmd.lpVolID = (DWORD)(void far *)NULL;



ds.bControl = 6;



CallCDDriver(&cmd, nCDUnit);

return cmd.rh.wStatus;

}

// ---------------------------------------------------

// GetVolumeSize

// -

// ---------------------------------------------------

int GetVolumeSize(int nCDUnit)

{

IOCTL_Input cmd;



memset(&cmd, 0, sizeof(IOCTL_Input ));



cmd.rh.bSize = 26;

cmd.rh.bSubUnit = 0;

cmd.rh.bCmd = 3;



cmd.bMediaDescriptor = 0;

cmd.lpTransferAddress = (DWORD)(void far *)&vs;

cmd.wDataSize = 5;

cmd.wStartSector = 0;

cmd.lpVolID = (DWORD)(void far *)NULL;



vs.bControl = 8;



CallCDDriver(&cmd, nCDUnit);

return cmd.rh.wStatus;

}

// ---------------------------------------------------



// CallCDDriver

// -

// ---------------------------------------------------

void CallCDDriver(void *rh, int nCDUnit)

{

static union REGS rg;

static struct SREGS srg;



segread(&srg);

rg.x.ax = 0x1510;

rg.x.cx = nCDUnit;

rg.x.bx = FP_OFF(rh);



int86x(0x2f, &rg, &rg, &srg);

}

// ---------------------------------------------------

// GetCDLetters

//

// -

// ---------------------------------------------------

void GetCDLetters(BYTE *bLetters)

{

static union REGS rg;

static struct SREGS srg;



segread(&srg);

rg.x.ax = 0x150d;

rg.x.bx = FP_OFF(bLetters);



int86x(0x2f, &rg, &rg, &srg);

}

// ---------------------------------------------------

// delay

//

// ---------------------------------------------------

void delay(int ms)

{

int ticks;



ticks = ms / 55;

_asm

{

push si

mov si, ticks

mov ah, 0

int 1ah

mov bx, dx

add bx, si

delay_loop:

int 1ah

cmp dx, bx

jne delay_loop

pop si

}

}










Forekc.ru
, , , , , , , , , ,