[RESENT 1/4] winedos: implement true CDROM DOS device driver

Petr Tesarik hat at tesarici.cz
Tue Apr 11 03:33:16 CDT 2006


Hi,

while I was trying to make Kindler Literaturlexikon work in Wine, I
found out that this program uses a DOS program to access the CDROM,
and that it requires a real working MSCDEX device driver (and not only
that, the driver has to reside in a different segment than the DOS
core).

To make the patches as small as possible, I've split the patch into
several parts.

This part just moves some declarations from devices.c to dosexe.h, so
that the code in devices.c can be used from other source files.

ChangeLog:

* dlls/winedos/devices.c, dlls/winedos/dosexe.h:
winedos: move some declarations to the header file
-------------- next part --------------
Index: devices.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/devices.c,v
retrieving revision 1.14
diff -u -r1.14 devices.c
--- devices.c	21 Jun 2005 20:53:14 -0000	1.14
+++ devices.c	10 Apr 2006 13:52:12 -0000
@@ -26,44 +26,6 @@
 
 #include "pshpack1.h"
 
-typedef struct {
-  BYTE ljmp1;
-  RMCBPROC strategy;
-  BYTE ljmp2;
-  RMCBPROC interrupt;
-} WINEDEV_THUNK;
-
-typedef struct {
-  BYTE size; /* length of header + data */
-  BYTE unit; /* unit (block devices only) */
-  BYTE command;
-  WORD status;
-  BYTE reserved[8];
-} REQUEST_HEADER;
-
-typedef struct {
-  REQUEST_HEADER hdr;
-  BYTE media; /* media descriptor from BPB */
-  SEGPTR buffer;
-  WORD count; /* byte/sector count */
-  WORD sector; /* starting sector (block devices) */
-  DWORD volume; /* volume ID (block devices) */
-} REQ_IO;
-
-typedef struct {
-  REQUEST_HEADER hdr;
-  BYTE data;
-} REQ_SAFEINPUT;
-
-typedef struct
-{
-    DWORD next_dev;
-    WORD  attr;
-    WORD  strategy;
-    WORD  interrupt;
-    char  name[8];
-} DOS_DEVICE_HEADER;
-
 /* Warning: need to return LOL ptr w/ offset 0 (&ptr_first_DPB) to programs ! */
 typedef struct _DOS_LISTOFLISTS
 {
@@ -111,45 +73,6 @@
 
 static void *strategy_data[NB_SYSTEM_STRATEGIES];
 
-#define NONEXT ((DWORD)-1)
-
-#define ATTR_STDIN     0x0001
-#define ATTR_STDOUT    0x0002
-#define ATTR_NUL       0x0004
-#define ATTR_CLOCK     0x0008
-#define ATTR_FASTCON   0x0010
-#define ATTR_RAW       0x0020
-#define ATTR_NOTEOF    0x0040
-#define ATTR_DEVICE    0x0080
-#define ATTR_REMOVABLE 0x0800
-#define ATTR_NONIBM    0x2000 /* block devices */
-#define ATTR_UNTILBUSY 0x2000 /* char devices */
-#define ATTR_IOCTL     0x4000
-#define ATTR_CHAR      0x8000
-
-#define CMD_INIT       0
-#define CMD_MEDIACHECK 1 /* block devices */
-#define CMD_BUILDBPB   2 /* block devices */
-#define CMD_INIOCTL    3
-#define CMD_INPUT      4 /* read data */
-#define CMD_SAFEINPUT  5 /* "non-destructive input no wait", char devices */
-#define CMD_INSTATUS   6 /* char devices */
-#define CMD_INFLUSH    7 /* char devices */
-#define CMD_OUTPUT     8 /* write data */
-#define CMD_SAFEOUTPUT 9 /* write data with verify */
-#define CMD_OUTSTATUS 10 /* char devices */
-#define CMD_OUTFLUSH  11 /* char devices */
-#define CMD_OUTIOCTL  12
-#define CMD_DEVOPEN   13
-#define CMD_DEVCLOSE  14
-#define CMD_REMOVABLE 15 /* block devices */
-#define CMD_UNTILBUSY 16 /* output until busy */
-
-#define STAT_MASK  0x00FF
-#define STAT_DONE  0x0100
-#define STAT_BUSY  0x0200
-#define STAT_ERROR 0x8000
-
 #define LJMP 0xea
 
 
@@ -160,14 +83,6 @@
 static void WINAPI con_interrupt(CONTEXT86*ctx);
 
 /* devices */
-typedef struct
-{
-    char name[8];
-    WORD attr;
-    RMCBPROC strategy;
-    RMCBPROC interrupt;
-} WINEDEV;
-
 static WINEDEV devs[] =
 {
   { "NUL     ",
Index: dosexe.h
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosexe.h,v
retrieving revision 1.38
diff -u -r1.38 dosexe.h
--- dosexe.h	27 Mar 2006 11:30:41 -0000	1.38
+++ dosexe.h	10 Apr 2006 13:52:12 -0000
@@ -245,6 +245,105 @@
 
 #include <poppack.h>
 
+/* Device driver header */
+
+#define NONEXT ((DWORD)-1)
+
+#define ATTR_STDIN     0x0001
+#define ATTR_STDOUT    0x0002
+#define ATTR_NUL       0x0004
+#define ATTR_CLOCK     0x0008
+#define ATTR_FASTCON   0x0010
+#define ATTR_RAW       0x0020
+#define ATTR_NOTEOF    0x0040
+#define ATTR_DEVICE    0x0080
+#define ATTR_REMOVABLE 0x0800
+#define ATTR_NONIBM    0x2000 /* block devices */
+#define ATTR_UNTILBUSY 0x2000 /* char devices */
+#define ATTR_IOCTL     0x4000
+#define ATTR_CHAR      0x8000
+
+#include <pshpack1.h>
+
+typedef struct
+{
+    DWORD next_dev;
+    WORD  attr;
+    WORD  strategy;
+    WORD  interrupt;
+    char  name[8];
+} DOS_DEVICE_HEADER;
+
+#include <poppack.h>
+
+/* DOS Device requests */
+
+#define CMD_INIT       0
+#define CMD_MEDIACHECK 1 /* block devices */
+#define CMD_BUILDBPB   2 /* block devices */
+#define CMD_INIOCTL    3
+#define CMD_INPUT      4 /* read data */
+#define CMD_SAFEINPUT  5 /* "non-destructive input no wait", char devices */
+#define CMD_INSTATUS   6 /* char devices */
+#define CMD_INFLUSH    7 /* char devices */
+#define CMD_OUTPUT     8 /* write data */
+#define CMD_SAFEOUTPUT 9 /* write data with verify */
+#define CMD_OUTSTATUS 10 /* char devices */
+#define CMD_OUTFLUSH  11 /* char devices */
+#define CMD_OUTIOCTL  12
+#define CMD_DEVOPEN   13
+#define CMD_DEVCLOSE  14
+#define CMD_REMOVABLE 15 /* block devices */
+#define CMD_UNTILBUSY 16 /* output until busy */
+
+#define STAT_MASK  0x00FF
+#define STAT_DONE  0x0100
+#define STAT_BUSY  0x0200
+#define STAT_ERROR 0x8000
+
+#include <pshpack1.h>
+
+typedef struct {
+    BYTE size;          /* length of header + data */
+    BYTE unit;          /* unit (block devices only) */
+    BYTE command;
+    WORD status;
+    BYTE reserved[8];
+} REQUEST_HEADER;
+
+typedef struct {
+    REQUEST_HEADER hdr;
+    BYTE media;         /* media descriptor from BPB */
+    SEGPTR buffer;
+    WORD count;         /* byte/sector count */
+    WORD sector;        /* starting sector (block devices) */
+    DWORD volume;       /* volume ID (block devices) */
+} REQ_IO;
+
+typedef struct {
+    REQUEST_HEADER hdr;
+    BYTE data;
+} REQ_SAFEINPUT;
+
+/* WINE device driver thunk from RM */
+typedef struct {
+    BYTE ljmp1;
+    FARPROC16 strategy;
+    BYTE ljmp2;
+    FARPROC16 interrupt;
+} WINEDEV_THUNK;
+
+#include <poppack.h>
+
+/* Device driver info (used for initialization) */
+typedef struct
+{
+    char name[8];
+    WORD attr;
+    RMCBPROC strategy;
+    RMCBPROC interrupt;
+} WINEDEV;
+
 /* module.c */
 extern void WINAPI MZ_LoadImage( LPCSTR filename, HANDLE hFile );
 extern BOOL WINAPI MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID paramblk );


More information about the wine-patches mailing list