Commit 9f9ac54a authored by Petr Tesarik's avatar Petr Tesarik Committed by Alexandre Julliard

winedos: Implement true CDROM DOS device driver.

parent d72178a1
......@@ -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*);
......
......@@ -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) );
}
......@@ -197,6 +197,7 @@ static BOOL MZ_InitMemory(void)
TRACE("Initializing DOS memory structures\n");
DOSMEM_MapDosLayout();
DOSDEV_InstallDOSDevices();
MSCDEX_InstallCDROM();
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment