ReactOS  0.4.14-dev-342-gdc047f9
device.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: GPLv2+ - See COPYING in the top level directory
3  * PROJECT: ReactOS Virtual DOS Machine
4  * FILE: subsystems/mvdm/ntvdm/dos/dos32krnl/device.c
5  * PURPOSE: DOS Device Support
6  * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include "ntvdm.h"
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 #include "emulator.h"
17 #include "cpu/bop.h"
18 #include "device.h"
19 
20 #include "dos.h"
21 #include "dos/dem.h"
22 #include "memory.h"
23 
24 /* PRIVATE VARIABLES **********************************************************/
25 
26 static const BYTE StrategyRoutine[] = {
29  BOP_DOS,
31  0xCB // retf
32 };
33 
34 static const BYTE InterruptRoutine[] = {
37  BOP_DOS,
39  0xCB // retf
40 };
41 
43 
46 
47 /* PRIVATE FUNCTIONS **********************************************************/
48 
50 {
51  PDOS_DRIVER DriverBlock = (PDOS_DRIVER)FAR_POINTER(Driver);
52  WORD AX = getAX();
53  WORD CX = getCX();
54  WORD DX = getDX();
55  WORD BX = getBX();
56  WORD BP = getBP();
57  WORD SI = getSI();
58  WORD DI = getDI();
59  WORD DS = getDS();
60  WORD ES = getES();
61 
62  /* Set ES:BX to the location of the request */
65 
66  /* Copy the request structure to ES:BX */
67  RtlMoveMemory(&Sda->Request, Request, Request->RequestLength);
68 
69  /* Call the strategy routine, and then the interrupt routine */
72 
73  /* Get the request structure from ES:BX */
74  RtlMoveMemory(Request, &Sda->Request, Request->RequestLength);
75 
76  /* Restore the registers */
77  setAX(AX);
78  setCX(CX);
79  setDX(DX);
80  setBX(BX);
81  setBP(BP);
82  setSI(SI);
83  setDI(DI);
84  setDS(DS);
85  setES(ES);
86 }
87 
89  DWORD Buffer,
90  PWORD Length,
91  BOOLEAN IoControl)
92 {
94 
95  Request.Header.RequestLength = IoControl ? sizeof(DOS_IOCTL_RW_REQUEST)
96  : sizeof(DOS_RW_REQUEST);
97  Request.Header.CommandCode = IoControl ? DOS_DEVCMD_IOCTL_READ : DOS_DEVCMD_READ;
98  Request.BufferPointer = Buffer;
99  Request.Length = *Length;
100 
101  DosCallDriver(DeviceNode->Driver, &Request.Header);
102 
103  *Length = Request.Length;
104  return Request.Header.Status;
105 }
106 
108  DWORD Buffer,
109  PWORD Length,
110  BOOLEAN IoControl)
111 {
113 
114  Request.Header.RequestLength = IoControl ? sizeof(DOS_IOCTL_RW_REQUEST)
115  : sizeof(DOS_RW_REQUEST);
116  Request.Header.CommandCode = IoControl ? DOS_DEVCMD_IOCTL_WRITE : DOS_DEVCMD_WRITE;
117  Request.BufferPointer = Buffer;
118  Request.Length = *Length;
119 
120  DosCallDriver(DeviceNode->Driver, &Request.Header);
121 
122  *Length = Request.Length;
123  return Request.Header.Status;
124 }
125 
127  BYTE CommandCode)
128 {
130 
131  Request.RequestLength = sizeof(DOS_REQUEST_HEADER);
132  Request.CommandCode = CommandCode;
133 
134  DosCallDriver(DeviceNode->Driver, &Request);
135 
136  return Request.Status;
137 }
138 
140  DWORD Buffer,
141  PWORD Length)
142 {
144 }
145 
147  DWORD Buffer,
148  PWORD Length)
149 {
151 }
152 
154  PBYTE Character)
155 {
157 
158  Request.Header.RequestLength = sizeof(DOS_PEEK_REQUEST);
159  Request.Header.CommandCode = DOS_DEVCMD_PEEK;
160 
161  DosCallDriver(DeviceNode->Driver, &Request.Header);
162 
163  *Character = Request.Character;
164  return Request.Header.Status;
165 }
166 
168 {
170 }
171 
173 {
175 }
176 
178  DWORD Buffer,
179  PWORD Length)
180 {
182 }
183 
185  DWORD Buffer,
186  PWORD Length)
187 {
189 }
190 
192 {
194 }
195 
197 {
199 }
200 
202 {
204 }
205 
207 {
209 }
210 
212  DWORD Buffer,
213  PWORD Length)
214 {
216 
217  Request.Header.RequestLength = sizeof(DOS_OUTPUT_BUSY_REQUEST);
218  Request.Header.CommandCode = DOS_DEVCMD_OUTPUT_BUSY;
219  Request.BufferPointer = Buffer;
220  Request.Length = *Length;
221 
222  DosCallDriver(DeviceNode->Driver, &Request.Header);
223 
224  *Length = Request.Length;
225  return Request.Header.Status;
226 }
227 
229 {
230  PDOS_DRIVER LastDriver = &SysVars->NullDevice;
231 
232  /* Find the last driver in the list */
233  while (LOWORD(LastDriver->Link) != 0xFFFF)
234  {
235  LastDriver = (PDOS_DRIVER)FAR_POINTER(LastDriver->Link);
236  }
237 
238  /* Add the new driver to the list */
239  LastDriver->Link = Driver;
240  LastDriver = (PDOS_DRIVER)FAR_POINTER(Driver);
241 
242  if (LastDriver->DeviceAttributes & DOS_DEVATTR_CLOCK)
243  {
244  /* Update the active CLOCK driver */
246  }
247 
248  if (LastDriver->DeviceAttributes
250  {
251  /* Update the active CON driver */
253  }
254 }
255 
257 {
259 
260  while (LOWORD(CurrentDriver) != 0xFFFF)
261  {
262  PDOS_DRIVER DriverHeader = (PDOS_DRIVER)FAR_POINTER(CurrentDriver);
263 
264  if (DriverHeader->Link == Driver)
265  {
266  /* Remove it from the list */
267  DriverHeader->Link = ((PDOS_DRIVER)FAR_POINTER(DriverHeader->Link))->Link;
268  return;
269  }
270 
271  CurrentDriver = DriverHeader->Link;
272  }
273 }
274 
276 {
277  BYTE i;
278  PDOS_DRIVER DriverHeader = (PDOS_DRIVER)FAR_POINTER(Driver);
279  PDOS_DEVICE_NODE Node = RtlAllocateHeap(RtlGetProcessHeap(),
281  sizeof(*Node));
282  if (Node == NULL) return NULL;
283 
284  Node->Driver = Driver;
285  Node->DeviceAttributes = DriverHeader->DeviceAttributes;
286 
287  /* Initialize the name string */
288  Node->Name.Buffer = Node->NameBuffer;
289  Node->Name.MaximumLength = MAX_DEVICE_NAME;
290 
291  for (i = 0; i < MAX_DEVICE_NAME; i++)
292  {
293  if (DriverHeader->DeviceName[i] == ' ') break;
294  Node->Name.Buffer[i] = DriverHeader->DeviceName[i];
295  }
296 
297  Node->Name.Length = i;
298 
299  InsertTailList(&DeviceList, &Node->Entry);
300  return Node;
301 }
302 
303 /* PUBLIC FUNCTIONS ***********************************************************/
304 
306 {
307  PLIST_ENTRY i;
309 
310  for (i = DeviceList.Flink; i != &DeviceList; i = i->Flink)
311  {
313  if (Node->Driver == Driver) break;
314  }
315 
316  if (i == &DeviceList)
317  {
318  DPRINT1("The driver at %04X:%04X has no associated device node. "
319  "Installing automagically.\n",
320  HIWORD(Driver),
321  LOWORD(Driver));
322 
323  /* Create the device node */
325  Node->IoctlReadRoutine = DosDriverDispatchIoctlRead;
326  Node->ReadRoutine = DosDriverDispatchRead;
327  Node->PeekRoutine = DosDriverDispatchPeek;
328  Node->InputStatusRoutine = DosDriverDispatchInputStatus;
329  Node->FlushInputRoutine = DosDriverDispatchFlushInput;
330  Node->IoctlWriteRoutine = DosDriverDispatchIoctlWrite;
331  Node->WriteRoutine = DosDriverDispatchWrite;
332  Node->OutputStatusRoutine = DosDriverDispatchOutputStatus;
333  Node->FlushOutputRoutine = DosDriverDispatchFlushOutput;
334  Node->OpenRoutine = DosDriverDispatchOpen;
335  Node->CloseRoutine = DosDriverDispatchClose;
336  Node->OutputUntilBusyRoutine = DosDriverDispatchOutputUntilBusy;
337  }
338 
339  return Node;
340 }
341 
343 {
345  ANSI_STRING DeviceNameString;
346 
347  RtlInitAnsiString(&DeviceNameString, DeviceName);
348 
349  while (LOWORD(CurrentDriver) != 0xFFFF)
350  {
351  PDOS_DEVICE_NODE Node = DosGetDriverNode(CurrentDriver);
352  PDOS_DRIVER DriverHeader = (PDOS_DRIVER)FAR_POINTER(CurrentDriver);
353 
354  if (RtlEqualString(&Node->Name, &DeviceNameString, TRUE)) return Node;
355  CurrentDriver = DriverHeader->Link;
356  }
357 
358  return NULL;
359 }
360 
362 {
363  BYTE i;
364  WORD Segment;
365  PDOS_DRIVER DriverHeader;
367 
368  /* Make sure this is a character device */
370  {
371  DPRINT1("ERROR: Block devices are not supported.\n");
372  return NULL;
373  }
374 
375  /* Create a driver header for this device */
376  Segment = DosAllocateMemory(sizeof(DOS_DRIVER) + DEVICE_CODE_SIZE + PrivateDataSize, NULL);
377  if (Segment == 0) return NULL;
378 
379  /* Fill the header with data */
380  DriverHeader = SEG_OFF_TO_PTR(Segment, 0);
381  DriverHeader->Link = 0xFFFFFFFF;
382  DriverHeader->DeviceAttributes = Attributes;
383  DriverHeader->StrategyRoutine = sizeof(DOS_DRIVER);
384  DriverHeader->InterruptRoutine = sizeof(DOS_DRIVER) + sizeof(StrategyRoutine);
385 
386  RtlFillMemory(DriverHeader->DeviceName, MAX_DEVICE_NAME, ' ');
387  for (i = 0; i < MAX_DEVICE_NAME; i++)
388  {
389  if (DeviceName[i] == '\0' || DeviceName[i] == ' ') break;
390  DriverHeader->DeviceName[i] = DeviceName[i];
391  }
392 
393  /* Write the routines */
396  sizeof(StrategyRoutine));
399  sizeof(InterruptRoutine));
400 
401  /* Create the node */
403  if (Node == NULL)
404  {
406  return NULL;
407  }
408 
409  DosAddDriver(Node->Driver);
410  return Node;
411 }
412 
414 {
415  /* Call the extended API */
417 }
418 
420 {
421  DosRemoveDriver(DeviceNode->Driver);
422 
423  ASSERT(LOWORD(DeviceNode->Driver) == 0);
424  DosFreeMemory(HIWORD(DeviceNode->Driver));
425 
426  RemoveEntryList(&DeviceNode->Entry);
427  RtlFreeHeap(RtlGetProcessHeap(), 0, DeviceNode);
428 }
429 
431 {
432  /* Save ES:BX */
434 }
435 
437 {
438  PLIST_ENTRY i;
440  DWORD DriverAddress = (getCS() << 4) + getIP() - sizeof(DOS_DRIVER) - 9;
441 
442  /* Get the device node for this driver */
443  for (i = DeviceList.Flink; i != &DeviceList; i = i->Flink)
444  {
446  if (TO_LINEAR(HIWORD(Node->Driver), LOWORD(Node->Driver)) == DriverAddress) break;
447  }
448 
449  if (i == &DeviceList)
450  {
451  DPRINT1("Device interrupt BOP from an unknown location.\n");
452  return;
453  }
454 
455  switch (DeviceRequest->CommandCode)
456  {
458  {
460 
461  DeviceRequest->Status = Node->IoctlReadRoutine(
462  Node,
463  Request->BufferPointer,
464  &Request->Length
465  );
466 
467  break;
468  }
469 
470  case DOS_DEVCMD_READ:
471  {
473 
474  DeviceRequest->Status = Node->ReadRoutine(
475  Node,
476  Request->BufferPointer,
477  &Request->Length
478  );
479 
480  break;
481  }
482 
483  case DOS_DEVCMD_PEEK:
484  {
486  DeviceRequest->Status = Node->PeekRoutine(Node, &Request->Character);
487  break;
488  }
489 
490  case DOS_DEVCMD_INSTAT:
491  {
492  DeviceRequest->Status = Node->InputStatusRoutine(Node);
493  break;
494  }
495 
497  {
498  DeviceRequest->Status = Node->FlushInputRoutine(Node);
499  break;
500  }
501 
503  {
505 
506  DeviceRequest->Status = Node->IoctlWriteRoutine(
507  Node,
508  Request->BufferPointer,
509  &Request->Length
510  );
511 
512  break;
513  }
514 
515  case DOS_DEVCMD_WRITE:
516  {
518 
519  DeviceRequest->Status = Node->WriteRoutine(Node,
520  Request->BufferPointer,
521  &Request->Length
522  );
523 
524  break;
525  }
526 
527  case DOS_DEVCMD_OUTSTAT:
528  {
529  DeviceRequest->Status = Node->OutputStatusRoutine(Node);
530  break;
531  }
532 
534  {
535  DeviceRequest->Status = Node->FlushOutputRoutine(Node);
536  break;
537  }
538 
539  case DOS_DEVCMD_OPEN:
540  {
541  DeviceRequest->Status = Node->OpenRoutine(Node);
542  break;
543  }
544 
545  case DOS_DEVCMD_CLOSE:
546  {
547  DeviceRequest->Status = Node->CloseRoutine(Node);
548  break;
549  }
550 
552  {
554 
555  DeviceRequest->Status = Node->OutputUntilBusyRoutine(
556  Node,
557  Request->BufferPointer,
558  &Request->Length
559  );
560 
561  break;
562  }
563 
564  default:
565  {
566  DPRINT1("Unknown device command code: %u\n", DeviceRequest->CommandCode);
567  }
568  }
569 }
570 
572 {
574  HANDLE FileHandle = INVALID_HANDLE_VALUE, FileMapping = NULL;
575  LPBYTE Address = NULL;
576  DWORD Driver;
577  PDOS_DRIVER DriverHeader;
578  WORD Segment = 0;
579  DWORD FileSize;
580  DWORD DriversLoaded = 0;
583 
584  /* Open a handle to the driver file */
585  FileHandle = CreateFileA(DriverFile,
586  GENERIC_READ,
588  NULL,
591  NULL);
593  {
594  Result = GetLastError();
595  goto Cleanup;
596  }
597 
598  /* Get the file size */
600 
601  /* Allocate DOS memory for the driver */
603  if (Segment == 0)
604  {
606  goto Cleanup;
607  }
608 
609  /* Create a mapping object for the file */
610  FileMapping = CreateFileMapping(FileHandle,
611  NULL,
613  0,
614  0,
615  NULL);
616  if (FileMapping == NULL)
617  {
618  Result = GetLastError();
619  goto Cleanup;
620  }
621 
622  /* Map the file into memory */
623  Address = (LPBYTE)MapViewOfFile(FileMapping, FILE_MAP_READ, 0, 0, 0);
624  if (Address == NULL)
625  {
626  Result = GetLastError();
627  goto Cleanup;
628  }
629 
630  /* Copy the entire file to the DOS memory */
631  Driver = MAKELONG(0, Segment);
632  DriverHeader = (PDOS_DRIVER)FAR_POINTER(Driver);
633  RtlCopyMemory(DriverHeader, Address, FileSize);
634 
635  /* Loop through all the drivers in this file */
636  while (TRUE)
637  {
638  if (!(DriverHeader->DeviceAttributes & DOS_DEVATTR_CHARACTER))
639  {
640  DPRINT1("Error loading driver at %04X:%04X: "
641  "Block device drivers are not supported.\n",
642  HIWORD(Driver),
643  LOWORD(Driver));
644  goto Next;
645  }
646 
647  /* Send the driver an init request */
648  RtlZeroMemory(&Request, sizeof(Request));
649  Request.Header.RequestLength = sizeof(DOS_INIT_REQUEST);
650  Request.Header.CommandCode = DOS_DEVCMD_INIT;
651  // TODO: Set Request.DeviceString to the appropriate line in CONFIG.NT!
652  DosCallDriver(Driver, &Request.Header);
653 
654  if (Request.Header.Status & DOS_DEVSTAT_ERROR)
655  {
656  DPRINT1("Error loading driver at %04X:%04X: "
657  "Initialization routine returned error %u.\n",
658  HIWORD(Driver),
659  LOWORD(Driver),
660  Request.Header.Status & 0x7F);
661  goto Next;
662  }
663 
664  /* Create the device node */
666  DeviceNode->IoctlReadRoutine = DosDriverDispatchIoctlRead;
667  DeviceNode->ReadRoutine = DosDriverDispatchRead;
668  DeviceNode->PeekRoutine = DosDriverDispatchPeek;
669  DeviceNode->InputStatusRoutine = DosDriverDispatchInputStatus;
670  DeviceNode->FlushInputRoutine = DosDriverDispatchFlushInput;
671  DeviceNode->IoctlWriteRoutine = DosDriverDispatchIoctlWrite;
672  DeviceNode->WriteRoutine = DosDriverDispatchWrite;
673  DeviceNode->OutputStatusRoutine = DosDriverDispatchOutputStatus;
674  DeviceNode->FlushOutputRoutine = DosDriverDispatchFlushOutput;
675  DeviceNode->OpenRoutine = DosDriverDispatchOpen;
676  DeviceNode->CloseRoutine = DosDriverDispatchClose;
677  DeviceNode->OutputUntilBusyRoutine = DosDriverDispatchOutputUntilBusy;
678 
680  DriversLoaded++;
681 
682 Next:
683  if (LOWORD(DriverHeader->Link) == 0xFFFF) break;
684  Driver = DriverHeader->Link;
685  DriverHeader = (PDOS_DRIVER)FAR_POINTER(Driver);
686  }
687 
688  DPRINT1("%u drivers loaded from %s.\n", DriversLoaded, DriverFile);
689 
690 Cleanup:
691  if (Result != ERROR_SUCCESS)
692  {
693  /* It was not successful, cleanup the DOS memory */
695  }
696 
697  /* Unmap the file */
699 
700  /* Close the file mapping object */
701  if (FileMapping != NULL) CloseHandle(FileMapping);
702 
703  /* Close the file handle */
705 
706  return Result;
707 }
708 
709 /* EOF */
WORD LastErrorCode
Definition: dos.h:151
#define DOS_DEVCMD_PEEK
Definition: device.h:36
struct _DOS_DRIVER * PDOS_DRIVER
signed char * PCHAR
Definition: retypes.h:7
#define DOS_DATA_OFFSET(x)
Definition: dos.h:35
static WORD NTAPI DosDriverDispatchOutputUntilBusy(PDOS_DEVICE_NODE DeviceNode, DWORD Buffer, PWORD Length)
Definition: device.c:211
static WORD NTAPI DosDriverDispatchOpen(PDOS_DEVICE_NODE DeviceNode)
Definition: device.c:201
USHORT WINAPI getBX(VOID)
Definition: registers.c:170
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define CloseHandle
Definition: compat.h:406
struct _DOS_OUTPUT_BUSY_REQUEST * PDOS_OUTPUT_BUSY_REQUEST
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD Link
Definition: device.h:110
#define MapViewOfFile
Definition: compat.h:410
USHORT WINAPI getSI(VOID)
Definition: registers.c:404
static PDOS_REQUEST_HEADER DeviceRequest
Definition: device.c:45
static VOID DosRemoveDriver(DWORD Driver)
Definition: device.c:256
#define DOS_DEVCMD_OUTSTAT
Definition: device.h:41
#define LOBYTE(W)
Definition: jmemdos.c:487
#define DOS_DEVCMD_READ
Definition: device.h:35
CHAR DeviceName[MAX_DEVICE_NAME]
Definition: device.h:117
static const BYTE InterruptRoutine[]
Definition: device.c:34
USHORT WINAPI getCX(VOID)
Definition: registers.c:228
#define BOP_DRV_STRATEGY
Definition: device.h:18
static WORD NTAPI DosDriverDispatchClose(PDOS_DEVICE_NODE DeviceNode)
Definition: device.c:206
#define DOS_DEVATTR_CON
Definition: device.h:25
VOID WINAPI setAX(USHORT)
Definition: registers.c:121
#define DOS_DEVCMD_WRITE
Definition: device.h:39
VOID WINAPI setDS(USHORT)
Definition: registers.c:515
static PDOS_DEVICE_NODE DosCreateDeviceNode(DWORD Driver)
Definition: device.c:275
DOS_DRIVER NullDevice
Definition: dos.h:89
BOOLEAN DosFreeMemory(WORD BlockData)
Definition: memory.c:418
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define CreateFileMapping
Definition: winbase.h:3574
static WORD NTAPI DosDriverDispatchInputStatus(PDOS_DEVICE_NODE DeviceNode)
Definition: device.c:167
#define HIBYTE(W)
Definition: jmemdos.c:486
static WORD NTAPI DosDriverDispatchPeek(PDOS_DEVICE_NODE DeviceNode, PBYTE Character)
Definition: device.c:153
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define AX
Definition: i386-dis.c:415
struct _DOS_PEEK_REQUEST DOS_PEEK_REQUEST
#define DOS_DEVSTAT_ERROR
Definition: device.h:51
Definition: bidi.c:78
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define InsertTailList(ListHead, Entry)
#define DOS_DEVCMD_INIT
Definition: device.h:31
Definition: parse.h:75
NTSYSAPI BOOLEAN NTAPI RtlEqualString(PSTRING String1, PSTRING String2, BOOLEAN CaseInSensitive)
#define SEG_OFF_TO_PTR(seg, off)
Definition: emulator.h:28
struct _DOS_RW_REQUEST * PDOS_RW_REQUEST
static VOID DosAddDriver(DWORD Driver)
Definition: device.c:228
static int Link(const char **args)
Definition: vfdcmd.c:2414
#define DOS_DEVCMD_INSTAT
Definition: device.h:37
#define FILE_SHARE_READ
Definition: compat.h:125
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
struct _DOS_REQUEST_HEADER DOS_REQUEST_HEADER
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
_In_ NDIS_HANDLE _In_ PNDIS_REQUEST Request
Definition: ndis.h:5173
VOID WINAPI setES(USHORT)
Definition: registers.c:529
HANDLE FileHandle
Definition: stats.c:38
struct _DOS_DRIVER DOS_DRIVER
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DX
Definition: i386-dis.c:416
unsigned char * LPBYTE
Definition: typedefs.h:52
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
static WORD NTAPI DosDriverWriteInternal(PDOS_DEVICE_NODE DeviceNode, DWORD Buffer, PWORD Length, BOOLEAN IoControl)
Definition: device.c:107
static WORD NTAPI DosDriverDispatchIoctlWrite(PDOS_DEVICE_NODE DeviceNode, DWORD Buffer, PWORD Length)
Definition: device.c:177
union node Node
Definition: types.h:1255
WORD InterruptRoutine
Definition: device.h:113
static WORD NTAPI DosDriverDispatchRead(PDOS_DEVICE_NODE DeviceNode, DWORD Buffer, PWORD Length)
Definition: device.c:146
#define BOP_DOS
Definition: dem.h:25
CALLBACK16 DosContext
Definition: dos.c:40
#define BOP_DRV_INTERRUPT
Definition: device.h:19
VOID WINAPI setSI(USHORT)
Definition: registers.c:411
VOID DosDeleteDevice(PDOS_DEVICE_NODE DeviceNode)
Definition: device.c:419
#define MAKELONG(a, b)
Definition: typedefs.h:248
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
PDOS_DEVICE_NODE DosCreateDevice(WORD Attributes, PCHAR DeviceName)
Definition: device.c:413
WORD DosAllocateMemory(WORD Size, WORD *MaxAvailable)
Definition: memory.c:136
DWORD ActiveCon
Definition: dos.h:83
Definition: bufpool.h:45
#define FAR_POINTER(x)
Definition: emulator.h:31
#define FILE_MAP_READ
Definition: compat.h:435
const char * LPCSTR
Definition: xmlstorage.h:183
VOID DeviceStrategyBop(VOID)
Definition: device.c:430
_In_ PCUNICODE_STRING _In_ PVOID Driver
Definition: cmfuncs.h:32
#define OPEN_EXISTING
Definition: compat.h:434
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
DWORD ActiveClock
Definition: dos.h:82
_Inout_ PVOID Segment
Definition: exfuncs.h:893
struct _DOS_REQUEST_HEADER * PDOS_REQUEST_HEADER
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
WORD * PWORD
Definition: pedump.c:67
#define DOS_DATA_SEGMENT
Definition: dos.h:33
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
struct _DOS_IOCTL_RW_REQUEST * PDOS_IOCTL_RW_REQUEST
#define DOS_DEVCMD_OUTPUT_BUSY
Definition: device.h:47
PDOS_DEVICE_NODE DosCreateDeviceEx(WORD Attributes, PCHAR DeviceName, WORD PrivateDataSize)
Definition: device.c:361
#define DOS_DEVCMD_CLOSE
Definition: device.h:45
USHORT WINAPI getES(VOID)
Definition: registers.c:522
USHORT WINAPI getIP(VOID)
Definition: registers.c:464
DOS_RW_REQUEST Request
Definition: dos.h:184
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID DeviceInterruptBop(VOID)
Definition: device.c:436
IN BYTE CommandCode
Definition: device.h:132
VOID WINAPI setBP(USHORT)
Definition: registers.c:381
OUT WORD Status
Definition: device.h:133
Definition: Node.h:9
VOID WINAPI setDX(USHORT)
Definition: registers.c:293
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define TO_LINEAR(seg, off)
Definition: emulator.h:22
struct _DOS_INIT_REQUEST DOS_INIT_REQUEST
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
struct _DOS_OUTPUT_BUSY_REQUEST DOS_OUTPUT_BUSY_REQUEST
USHORT WINAPI getDX(VOID)
Definition: registers.c:286
static WORD NTAPI DosDriverDispatchIoctlRead(PDOS_DEVICE_NODE DeviceNode, DWORD Buffer, PWORD Length)
Definition: device.c:139
USHORT WINAPI getAX(VOID)
Definition: registers.c:114
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
unsigned char BYTE
Definition: mem.h:68
PDOS_SDA Sda
Definition: dos.c:48
#define GENERIC_READ
Definition: compat.h:124
Definition: typedefs.h:117
static const WCHAR Cleanup[]
Definition: register.c:80
VOID WINAPI setBX(USHORT)
Definition: registers.c:177
C_ASSERT((sizeof(StrategyRoutine)+sizeof(InterruptRoutine))==DEVICE_CODE_SIZE)
#define DOS_DEVATTR_CLOCK
Definition: device.h:24
static WORD NTAPI DosDriverDispatchFlushOutput(PDOS_DEVICE_NODE DeviceNode)
Definition: device.c:196
VOID WINAPI setDI(USHORT)
Definition: registers.c:441
WORD DeviceAttributes
Definition: device.h:111
#define DOS_DEVATTR_CHARACTER
Definition: device.h:29
#define DOS_DEVCMD_IOCTL_READ
Definition: device.h:34
struct _DOS_PEEK_REQUEST * PDOS_PEEK_REQUEST
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
#define DOS_DEVCMD_FLUSH_OUTPUT
Definition: device.h:42
PDOS_DEVICE_NODE DosGetDriverNode(DWORD Driver)
Definition: device.c:305
#define EMULATOR_BOP
Definition: bop.h:16
USHORT WINAPI getDI(VOID)
Definition: registers.c:434
PDOS_SYSVARS SysVars
Definition: dos.c:47
PDOS_DEVICE_NODE DosGetDevice(LPCSTR DeviceName)
Definition: device.c:342
static WORD NTAPI DosDriverReadInternal(PDOS_DEVICE_NODE DeviceNode, DWORD Buffer, PWORD Length, BOOLEAN IoControl)
Definition: device.c:88
static WORD NTAPI DosDriverDispatchOutputStatus(PDOS_DEVICE_NODE DeviceNode)
Definition: device.c:191
#define PAGE_READONLY
Definition: compat.h:127
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define DOS_DEVCMD_IOCTL_WRITE
Definition: device.h:43
VOID WINAPI setCX(USHORT)
Definition: registers.c:235
static WORD NTAPI DosDriverGenericRequest(PDOS_DEVICE_NODE DeviceNode, BYTE CommandCode)
Definition: device.c:126
static VOID DosCallDriver(DWORD Driver, PDOS_REQUEST_HEADER Request)
Definition: device.c:49
#define DPRINT1
Definition: precomp.h:8
#define DEVICE_CODE_SIZE
Definition: device.h:15
VOID RunCallback16(IN PCALLBACK16 Context, IN ULONG FarPtr)
Definition: callback.c:93
USHORT WINAPI getDS(VOID)
Definition: registers.c:508
Definition: i386_sup.c:15
#define DOS_DEVCMD_FLUSH_INPUT
Definition: device.h:38
#define HIWORD(l)
Definition: typedefs.h:246
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
static WORD NTAPI DosDriverDispatchWrite(PDOS_DEVICE_NODE DeviceNode, DWORD Buffer, PWORD Length)
Definition: device.c:184
static WORD NTAPI DosDriverDispatchFlushInput(PDOS_DEVICE_NODE DeviceNode)
Definition: device.c:172
#define MAX_DEVICE_NAME
Definition: fdc.h:14
#define DOS_DEVATTR_STDOUT
Definition: device.h:22
USHORT WINAPI getBP(VOID)
Definition: registers.c:374
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
#define DOS_DEVCMD_OPEN
Definition: device.h:44
#define DOS_DEVATTR_STDIN
Definition: device.h:21
WORD StrategyRoutine
Definition: device.h:112
DWORD DosLoadDriver(LPCSTR DriverFile)
Definition: device.c:571
struct _DOS_IOCTL_RW_REQUEST DOS_IOCTL_RW_REQUEST
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define UnmapViewOfFile
Definition: compat.h:411
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
USHORT WINAPI getCS(VOID)
Definition: registers.c:480
BYTE * PBYTE
Definition: pedump.c:66
#define LOWORD(l)
Definition: pedump.c:82
base of all file and directory entries
Definition: entries.h:82
static const BYTE StrategyRoutine[]
Definition: device.c:26
static LIST_ENTRY DeviceList
Definition: device.c:44
Definition: dlist.c:348