winedos: Implement true CDROM DOS device driver.

This commit is contained in:
Petr Tesarik 2006-04-11 10:37:09 +02:00 committed by Alexandre Julliard
parent d72178a1be
commit 9f9ac54a19
3 changed files with 57 additions and 0 deletions

View file

@ -475,6 +475,7 @@ extern void WINAPI DOSVM_Int2aHandler(CONTEXT86*);
/* int2f.c */
extern void WINAPI DOSVM_Int2fHandler(CONTEXT86*);
extern void MSCDEX_InstallCDROM(void);
/* int31.c */
extern void WINAPI DOSVM_Int31Handler(CONTEXT86*);

View file

@ -1024,3 +1024,58 @@ static void MSCDEX_Handler(CONTEXT86* context)
break;
}
}
/* prototypes */
static void WINAPI cdrom_strategy(CONTEXT86*ctx);
static void WINAPI cdrom_interrupt(CONTEXT86*ctx);
/* device info */
static const WINEDEV cdromdev =
{
"WINE_CD_",
ATTR_CHAR|ATTR_REMOVABLE|ATTR_IOCTL,
cdrom_strategy, cdrom_interrupt
};
static REQUEST_HEADER *cdrom_driver_request;
/* Return to caller */
static void do_lret(CONTEXT86*ctx)
{
WORD *stack = CTX_SEG_OFF_TO_LIN(ctx, ctx->SegSs, ctx->Esp);
ctx->Eip = *(stack++);
ctx->SegCs = *(stack++);
ctx->Esp += 2*sizeof(WORD);
}
static void WINAPI cdrom_strategy(CONTEXT86*ctx)
{
cdrom_driver_request = CTX_SEG_OFF_TO_LIN(ctx, ctx->SegEs, ctx->Ebx);
do_lret( ctx );
}
static void WINAPI cdrom_interrupt(CONTEXT86*ctx)
{
if (cdrom_driver_request->unit > CDROM_GetHeap()->hdr.units)
cdrom_driver_request->status = STAT_ERROR | 1; /* unknown unit */
else
MSCDEX_Request((BYTE*)cdrom_driver_request, ISV86(ctx));
do_lret( ctx );
}
/**********************************************************************
* MSCDEX_InstallCDROM [internal]
*
* Install the CDROM driver into the DOS device driver chain.
*/
void MSCDEX_InstallCDROM(void)
{
CDROM_HEAP *cdrom_heap = CDROM_GetHeap();
DOSDEV_SetupDevice( &cdromdev,
cdrom_heap->cdrom_segment,
FIELD_OFFSET(CDROM_HEAP, hdr),
FIELD_OFFSET(CDROM_HEAP, thunk) );
}

View file

@ -197,6 +197,7 @@ static BOOL MZ_InitMemory(void)
TRACE("Initializing DOS memory structures\n");
DOSMEM_MapDosLayout();
DOSDEV_InstallDOSDevices();
MSCDEX_InstallCDROM();
return TRUE;
}