winedos: Remove unused functions from devices.c.
This commit is contained in:
parent
ca82e0f5b3
commit
7bf39d4b14
|
@ -476,140 +476,6 @@ void DOSDEV_InstallDOSDevices(void)
|
|||
dataseg->lol.ptr_CON_dev_hdr = MAKESEGPTR(seg, DOS_DATASEG_OFF(dev[0]));
|
||||
}
|
||||
|
||||
DWORD DOSDEV_Console(void)
|
||||
{
|
||||
return DOSMEM_LOL()->ptr_CON_dev_hdr;
|
||||
}
|
||||
|
||||
DWORD DOSDEV_FindCharDevice(char*name)
|
||||
{
|
||||
SEGPTR cur_ptr = MAKESEGPTR(HIWORD(DOS_LOLSeg), FIELD_OFFSET(DOS_LISTOFLISTS,NUL_dev));
|
||||
DOS_DEVICE_HEADER *cur = PTR_REAL_TO_LIN(SELECTOROF(cur_ptr),OFFSETOF(cur_ptr));
|
||||
char dname[8];
|
||||
int cnt;
|
||||
|
||||
/* get first 8 characters */
|
||||
/* if less than 8 characters, pad with spaces */
|
||||
for (cnt=0; name[cnt] && cnt<8; cnt++)
|
||||
dname[cnt]=name[cnt];
|
||||
|
||||
while(cnt<8) dname[cnt++] = ' ';
|
||||
|
||||
/* search for char devices with the right name */
|
||||
while (cur &&
|
||||
((!(cur->attr & ATTR_CHAR)) ||
|
||||
memcmp(cur->name,dname,8))) {
|
||||
cur_ptr = cur->next_dev;
|
||||
if (cur_ptr == NONEXT) cur=NULL;
|
||||
else cur = PTR_REAL_TO_LIN(SELECTOROF(cur_ptr),OFFSETOF(cur_ptr));
|
||||
}
|
||||
return cur_ptr;
|
||||
}
|
||||
|
||||
static void DOSDEV_DoReq(void*req, DWORD dev)
|
||||
{
|
||||
REQUEST_HEADER *hdr = (REQUEST_HEADER *)req;
|
||||
DOS_DEVICE_HEADER *dhdr;
|
||||
CONTEXT86 ctx;
|
||||
char *phdr;
|
||||
|
||||
dhdr = PTR_REAL_TO_LIN(SELECTOROF(dev),OFFSETOF(dev));
|
||||
phdr = ((char*)DOSMEM_LOL()) + DOS_DATASEG_OFF(req);
|
||||
|
||||
/* copy request to request scratch area */
|
||||
memcpy(phdr, req, hdr->size);
|
||||
|
||||
/* prepare to call device driver */
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
ctx.EFlags |= V86_FLAG;
|
||||
|
||||
/* ES:BX points to request for strategy routine */
|
||||
ctx.SegEs = HIWORD(DOS_LOLSeg);
|
||||
ctx.Ebx = DOS_DATASEG_OFF(req);
|
||||
|
||||
/* call strategy routine */
|
||||
ctx.SegCs = SELECTOROF(dev);
|
||||
ctx.Eip = dhdr->strategy;
|
||||
DPMI_CallRMProc(&ctx, 0, 0, 0);
|
||||
|
||||
/* call interrupt routine */
|
||||
ctx.SegCs = SELECTOROF(dev);
|
||||
ctx.Eip = dhdr->interrupt;
|
||||
DPMI_CallRMProc(&ctx, 0, 0, 0);
|
||||
|
||||
/* completed, copy request back */
|
||||
memcpy(req, phdr, hdr->size);
|
||||
|
||||
if (hdr->status & STAT_ERROR) {
|
||||
switch (hdr->status & STAT_MASK) {
|
||||
case 0x0F: /* invalid disk change */
|
||||
/* this error seems to fit the bill */
|
||||
SetLastError(ERROR_NOT_SAME_DEVICE);
|
||||
break;
|
||||
default:
|
||||
SetLastError((hdr->status & STAT_MASK) + 0x13);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int DOSDEV_IO(unsigned cmd, DWORD dev, DWORD buf, int buflen)
|
||||
{
|
||||
REQ_IO req;
|
||||
|
||||
req.hdr.size=sizeof(req);
|
||||
req.hdr.unit=0; /* not dealing with block devices yet */
|
||||
req.hdr.command=cmd;
|
||||
req.hdr.status=STAT_BUSY;
|
||||
req.media=0; /* not dealing with block devices yet */
|
||||
req.buffer=buf;
|
||||
req.count=buflen;
|
||||
req.sector=0; /* block devices */
|
||||
req.volume=0; /* block devices */
|
||||
|
||||
DOSDEV_DoReq(&req, dev);
|
||||
|
||||
return req.count;
|
||||
}
|
||||
|
||||
int DOSDEV_Peek(DWORD dev, BYTE*data)
|
||||
{
|
||||
REQ_SAFEINPUT req;
|
||||
|
||||
req.hdr.size=sizeof(req);
|
||||
req.hdr.unit=0; /* not dealing with block devices yet */
|
||||
req.hdr.command=CMD_SAFEINPUT;
|
||||
req.hdr.status=STAT_BUSY;
|
||||
req.data=0;
|
||||
|
||||
DOSDEV_DoReq(&req, dev);
|
||||
|
||||
if (req.hdr.status & STAT_BUSY) return 0;
|
||||
|
||||
*data = req.data;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int DOSDEV_Read(DWORD dev, DWORD buf, int buflen)
|
||||
{
|
||||
return DOSDEV_IO(CMD_INPUT, dev, buf, buflen);
|
||||
}
|
||||
|
||||
int DOSDEV_Write(DWORD dev, DWORD buf, int buflen, int verify)
|
||||
{
|
||||
return DOSDEV_IO(verify?CMD_SAFEOUTPUT:CMD_OUTPUT, dev, buf, buflen);
|
||||
}
|
||||
|
||||
int DOSDEV_IoctlRead(DWORD dev, DWORD buf, int buflen)
|
||||
{
|
||||
return DOSDEV_IO(CMD_INIOCTL, dev, buf, buflen);
|
||||
}
|
||||
|
||||
int DOSDEV_IoctlWrite(DWORD dev, DWORD buf, int buflen)
|
||||
{
|
||||
return DOSDEV_IO(CMD_OUTIOCTL, dev, buf, buflen);
|
||||
}
|
||||
|
||||
void DOSDEV_SetSharingRetry(WORD delay, WORD count)
|
||||
{
|
||||
DOSMEM_LOL()->sharing_retry_delay = delay;
|
||||
|
|
|
@ -368,13 +368,6 @@ extern UINT WINAPI DOSVM_GetTimer( void );
|
|||
extern void DOSDEV_InstallDOSDevices(void);
|
||||
extern void DOSDEV_SetupDevice(const WINEDEV * devinfo,
|
||||
WORD seg, WORD off_dev, WORD off_thunk);
|
||||
extern DWORD DOSDEV_Console(void);
|
||||
extern DWORD DOSDEV_FindCharDevice(char*name);
|
||||
extern int DOSDEV_Peek(DWORD dev, BYTE*data);
|
||||
extern int DOSDEV_Read(DWORD dev, DWORD buf, int buflen);
|
||||
extern int DOSDEV_Write(DWORD dev, DWORD buf, int buflen, int verify);
|
||||
extern int DOSDEV_IoctlRead(DWORD dev, DWORD buf, int buflen);
|
||||
extern int DOSDEV_IoctlWrite(DWORD dev, DWORD buf, int buflen);
|
||||
extern void DOSDEV_SetSharingRetry(WORD delay, WORD count);
|
||||
extern SEGPTR DOSDEV_GetLOL(BOOL v86);
|
||||
|
||||
|
|
Loading…
Reference in New Issue