ReactOS 0.4.15-dev-5666-gc548b97
fdo.c File Reference
#include "parport.h"
Include dependency graph for fdo.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI AddDeviceInternal (IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT Pdo, IN PULONG pLptPortNumber OPTIONAL, OUT PDEVICE_OBJECT *pFdo OPTIONAL)
 
NTSTATUS NTAPI FdoStartDevice (IN PDEVICE_OBJECT DeviceObject, IN PCM_RESOURCE_LIST ResourceList, IN PCM_RESOURCE_LIST ResourceListTranslated)
 
static NTSTATUS FdoCreateRawParallelPdo (IN PDEVICE_OBJECT DeviceObject)
 
static NTSTATUS FdoQueryBusRelations (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
 
NTSTATUS NTAPI AddDevice (IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT Pdo)
 
NTSTATUS NTAPI FdoCreate (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI FdoClose (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI FdoCleanup (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI FdoRead (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI FdoWrite (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI FdoPnp (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI FdoPower (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 

Function Documentation

◆ AddDevice()

NTSTATUS NTAPI AddDevice ( IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT  Pdo 
)

Definition at line 388 of file fdo.c.

390{
391 DPRINT("AddDevice(%p %p)\n", DriverObject, Pdo);
392
393 /* Serial.sys is a legacy driver. AddDevice is called once
394 * with a NULL Pdo just after the driver initialization.
395 * Detect this case and return success.
396 */
397 if (Pdo == NULL)
398 return STATUS_SUCCESS;
399
400 /* We have here a PDO not null. It represents a real serial
401 * port. So call the internal AddDevice function.
402 */
404}
#define NULL
Definition: types.h:112
NTSTATUS NTAPI AddDeviceInternal(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT Pdo, IN PULONG pLptPortNumber OPTIONAL, OUT PDEVICE_OBJECT *pFdo OPTIONAL)
Definition: fdo.c:14
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT Pdo
Definition: wdfminiport.h:72

◆ AddDeviceInternal()

NTSTATUS NTAPI AddDeviceInternal ( IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT  Pdo,
IN PULONG pLptPortNumber  OPTIONAL,
OUT PDEVICE_OBJECT *pFdo  OPTIONAL 
)

Definition at line 14 of file fdo.c.

18{
19 PFDO_DEVICE_EXTENSION DeviceExtension = NULL;
21 WCHAR DeviceNameBuffer[32];
24
25 DPRINT("AddDeviceInternal()\n");
26
28 ASSERT(Pdo);
29
30 /* Create new device object */
31 swprintf(DeviceNameBuffer,
32 L"\\Device\\ParallelPort%lu",
33 IoGetConfigurationInformation()->ParallelCount);
35 DeviceNameBuffer);
36
42 FALSE,
43 &Fdo);
44 if (!NT_SUCCESS(Status))
45 {
46 DPRINT1("IoCreateDevice() failed (Status 0x%08lx)\n", Status);
47 Fdo = NULL;
48 goto done;
49 }
50
51 DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
52 RtlZeroMemory(DeviceExtension,
53 sizeof(FDO_DEVICE_EXTENSION));
54
55 DeviceExtension->Common.IsFDO = TRUE;
56 DeviceExtension->Common.PnpState = dsStopped;
57
59 DeviceExtension->Pdo = Pdo;
60
62 Pdo,
63 &DeviceExtension->LowerDevice);
64 if (!NT_SUCCESS(Status))
65 {
66 DPRINT1("IoAttachDeviceToDeviceStackSafe() failed (Status 0x%08lx)\n", Status);
67 goto done;
68 }
69
70 if (DeviceExtension->LowerDevice->Flags & DO_POWER_PAGABLE)
71 Fdo->Flags |= DO_POWER_PAGABLE;
72
73 if (DeviceExtension->LowerDevice->Flags & DO_BUFFERED_IO)
74 Fdo->Flags |= DO_BUFFERED_IO;
75
76 if (DeviceExtension->LowerDevice->Flags & DO_DIRECT_IO)
77 Fdo->Flags |= DO_DIRECT_IO;
78
79 /* Choose default strategy */
80 if ((Fdo->Flags & (DO_BUFFERED_IO | DO_DIRECT_IO)) == 0)
81 Fdo->Flags |= DO_BUFFERED_IO;
82
83 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
84
85 if (pFdo)
86 {
87 *pFdo = Fdo;
88 }
89
90 return STATUS_SUCCESS;
91
92done:
93 if (Fdo)
94 {
96 }
97
98 return Status;
99}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define swprintf
Definition: precomp.h:40
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
FxDevice * pFdo
Status
Definition: gdiplustypes.h:25
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Definition: iorsrce.c:830
@ dsStopped
Definition: isapnp.h:34
#define ASSERT(a)
Definition: mode.c:44
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSTATUS NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: device.c:980
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_PARALLEL_PORT
Definition: winioctl.h:128
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:84
PDEVICE_OBJECT Pdo
Definition: i8042prt.h:128
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461
#define DO_POWER_PAGABLE
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by AddDevice().

◆ FdoCleanup()

NTSTATUS NTAPI FdoCleanup ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 462 of file fdo.c.

464{
465 DPRINT("FdoCleanup()\n");
466
467 Irp->IoStatus.Information = 0;
468 Irp->IoStatus.Status = STATUS_SUCCESS;
470
471 return STATUS_SUCCESS;
472}
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by DispatchCleanup().

◆ FdoClose()

NTSTATUS NTAPI FdoClose ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 442 of file fdo.c.

444{
445 PFDO_DEVICE_EXTENSION pDeviceExtension;
446
447 DPRINT("FdoClose()\n");
448
449 pDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
450 pDeviceExtension->OpenCount--;
451
452 Irp->IoStatus.Information = 0;
453 Irp->IoStatus.Status = STATUS_SUCCESS;
455
456 return STATUS_SUCCESS;
457}
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055

Referenced by DispatchClose().

◆ FdoCreate()

NTSTATUS NTAPI FdoCreate ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 409 of file fdo.c.

411{
412 PFDO_DEVICE_EXTENSION DeviceExtension;
415
416 DPRINT("FdoCreate()\n");
417
419 DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
420
421 if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
422 {
423 DPRINT1("Not a directory\n");
425 goto done;
426 }
427
428 DPRINT("Open parallel port %lu: successful\n", DeviceExtension->PortNumber);
429 DeviceExtension->OpenCount++;
430
431done:
432 Irp->IoStatus.Status = Status;
433 Irp->IoStatus.Information = 0;
435
436 return Status;
437}
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
if(dx< 0)
Definition: linetemp.h:194
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793

Referenced by DispatchCreate().

◆ FdoCreateRawParallelPdo()

static NTSTATUS FdoCreateRawParallelPdo ( IN PDEVICE_OBJECT  DeviceObject)
static

Definition at line 216 of file fdo.c.

218{
219 PFDO_DEVICE_EXTENSION FdoDeviceExtension;
220 PPDO_DEVICE_EXTENSION PdoDeviceExtension = NULL;
222 WCHAR DeviceNameBuffer[32];
223 WCHAR LinkNameBuffer[32];
224 WCHAR LptPortBuffer[32];
226 UNICODE_STRING LinkName;
227 UNICODE_STRING LptPort;
232
233 DPRINT("FdoCreateRawParallelPdo()\n");
234
235 FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
236
237 /* Create new device object */
238 swprintf(DeviceNameBuffer,
239 L"\\Device\\Parallel%lu",
240 FdoDeviceExtension->PortNumber);
242 DeviceNameBuffer);
243
244 Status = IoCreateDevice(DeviceObject->DriverObject,
245 sizeof(PDO_DEVICE_EXTENSION),
246 &DeviceName,
248 0,
249 FALSE,
250 &Pdo);
251 if (!NT_SUCCESS(Status))
252 {
253 DPRINT1("IoCreateDevice() failed with status 0x%08x\n", Status);
254 goto done;
255 }
256
258 Pdo->Flags |= DO_POWER_PAGABLE;
259
260 PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
261 RtlZeroMemory(PdoDeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
262
263 PdoDeviceExtension->Common.IsFDO = FALSE;
264 PdoDeviceExtension->Common.PnpState = dsStopped;
265
266 Pdo->StackSize = DeviceObject->StackSize + 1;
267
268 FdoDeviceExtension->AttachedRawPdo = Pdo;
269 PdoDeviceExtension->AttachedFdo = DeviceObject;
270
271 PdoDeviceExtension->PortNumber = FdoDeviceExtension->PortNumber;
272 PdoDeviceExtension->LptPort = PdoDeviceExtension->PortNumber + 1;
273
274
275 /* Create link \DosDevices\LPTX -> \Device\ParallelY */
276 swprintf(LinkNameBuffer, L"\\DosDevices\\LPT%lu", PdoDeviceExtension->LptPort);
277 RtlInitUnicodeString(&LinkName, LinkNameBuffer);
278 Status = IoCreateSymbolicLink(&LinkName,
279 &DeviceName);
280 if (!NT_SUCCESS(Status))
281 {
282 DPRINT1("IoCreateSymbolicLink() failed with status 0x%08x\n", Status);
283 goto done;
284 }
285
286 swprintf(LptPortBuffer, L"LPT%lu", PdoDeviceExtension->LptPort);
287 RtlInitUnicodeString(&LptPort, LptPortBuffer);
288
289 /* Write an entry value under HKLM\HARDWARE\DeviceMap\PARALLEL PORTS. */
290 /* This step is not mandatory, so do not exit in case of error. */
292 L"\\Registry\\Machine\\HARDWARE\\DeviceMap\\PARALLEL PORTS");
294 &KeyName,
296 NULL,
297 NULL);
298
299 Status = ZwCreateKey(&KeyHandle,
302 0,
303 NULL,
305 NULL);
306 if (NT_SUCCESS(Status))
307 {
308 /* Key = \Device\Parallelx, Value = LPTx */
309 ZwSetValueKey(KeyHandle,
310 &DeviceName,
311 0,
312 REG_SZ,
313 LptPortBuffer,
314 LptPort.Length + sizeof(WCHAR));
316 }
317
318 Pdo->Flags |= DO_BUFFERED_IO;
319 Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
320
321done:
322 if (!NT_SUCCESS(Status))
323 {
324 if (Pdo)
325 {
326 ASSERT(PdoDeviceExtension);
328 }
329 }
330
331 return Status;
332}
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define REG_SZ
Definition: layer.c:22
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:110
PDEVICE_OBJECT AttachedRawPdo
Definition: parport.h:43
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:59
PDEVICE_OBJECT AttachedFdo
Definition: parport.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
#define DO_BUS_ENUMERATED_DEVICE

Referenced by FdoQueryBusRelations().

◆ FdoPnp()

NTSTATUS NTAPI FdoPnp ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 505 of file fdo.c.

507{
513
514 DPRINT("FdoPnp()\n");
515
517 MinorFunction = Stack->MinorFunction;
518
519 switch (MinorFunction)
520 {
521 /* FIXME: do all these minor functions
522 IRP_MN_QUERY_REMOVE_DEVICE 0x1
523 IRP_MN_REMOVE_DEVICE 0x2
524 {
525 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
526 IoAcquireRemoveLock
527 IoReleaseRemoveLockAndWait
528 pass request to DeviceExtension-LowerDriver
529 disable interface
530 IoDeleteDevice(Fdo) and/or IoDetachDevice
531 break;
532 }
533 IRP_MN_CANCEL_REMOVE_DEVICE 0x3
534 IRP_MN_STOP_DEVICE 0x4
535 IRP_MN_QUERY_STOP_DEVICE 0x5
536 IRP_MN_CANCEL_STOP_DEVICE 0x6
537 IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations (optional) 0x7
538 IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations (optional) 0x7
539 IRP_MN_QUERY_INTERFACE (optional) 0x8
540 IRP_MN_QUERY_CAPABILITIES (optional) 0x9
541 IRP_MN_FILTER_RESOURCE_REQUIREMENTS (optional) 0xd
542 IRP_MN_QUERY_PNP_DEVICE_STATE (optional) 0x14
543 IRP_MN_DEVICE_USAGE_NOTIFICATION (required or optional) 0x16
544 IRP_MN_SURPRISE_REMOVAL 0x17
545 */
546 case IRP_MN_START_DEVICE: /* 0x0 */
547 DPRINT("IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
548
549 /* Call lower driver */
550 FdoExtension = DeviceObject->DeviceExtension;
552
553 ASSERT(FdoExtension->Common.PnpState == dsStopped);
554
555 if (IoForwardIrpSynchronously(FdoExtension->LowerDevice, Irp))
556 {
557 Status = Irp->IoStatus.Status;
558 if (NT_SUCCESS(Status))
559 {
561 Stack->Parameters.StartDevice.AllocatedResources,
562 Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
563 }
564 }
565 break;
566
567 case IRP_MN_QUERY_DEVICE_RELATIONS: /* (optional) 0x7 */
568 switch (Stack->Parameters.QueryDeviceRelations.Type)
569 {
570 case BusRelations:
571 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
573 Irp->IoStatus.Status = Status;
575 return Status;
576
577 case RemovalRelations:
578 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
580
581 default:
582 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
583 Stack->Parameters.QueryDeviceRelations.Type);
585 }
586 break;
587
588 case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0xd */
589 DPRINT("IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
591
592 default:
593 DPRINT("Unknown minor function 0x%x\n", MinorFunction);
595 }
596
597 Irp->IoStatus.Information = Information;
598 Irp->IoStatus.Status = Status;
600
601 return Status;
602}
static NTSTATUS FdoStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:393
static NTSTATUS FdoQueryBusRelations(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:208
@ FdoExtension
Definition: precomp.h:48
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1625
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1699
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
@ RemovalRelations
Definition: iotypes.h:2155
@ BusRelations
Definition: iotypes.h:2152
#define IRP_MN_START_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_RELATIONS

Referenced by DispatchPnp().

◆ FdoPower()

NTSTATUS NTAPI FdoPower ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 607 of file fdo.c.

609{
610 PDEVICE_OBJECT LowerDevice;
611
612 DPRINT("FdoPower()\n");
613
614 LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
617 return PoCallDriver(LowerDevice, Irp);
618}
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:746

Referenced by DispatchPower().

◆ FdoQueryBusRelations()

static NTSTATUS FdoQueryBusRelations ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
PIO_STACK_LOCATION  IrpSp 
)
static

Definition at line 337 of file fdo.c.

341{
342 PFDO_DEVICE_EXTENSION DeviceExtension;
343 PDEVICE_RELATIONS DeviceRelations;
344 ULONG Size;
345 ULONG i;
346 ULONG PdoCount = 0;
348
350
351 DPRINT("FdoQueryBusRelations()\n");
352
353 DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
354 ASSERT(DeviceExtension->Common.IsFDO);
355
356 /* TODO: Enumerate parallel devices and create their PDOs */
357
359 if (!NT_SUCCESS(Status))
360 return Status;
361
362 PdoCount++;
363
364 /* Allocate a buffer for the device relations */
365 Size = sizeof(DEVICE_RELATIONS) + sizeof(PDEVICE_OBJECT) * (PdoCount - 1);
366 DeviceRelations = ExAllocatePoolWithTag(PagedPool, Size, PARPORT_TAG);
367 if (DeviceRelations == NULL)
369
370 /* Fill the buffer */
371 i = 0;
372 ObReferenceObject(DeviceExtension->AttachedRawPdo);
373 DeviceRelations->Objects[i] = DeviceExtension->AttachedRawPdo;
374 DeviceRelations->Count = 1;
375
376 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
377
378 DPRINT("Done\n");
379
380 return STATUS_SUCCESS;
381}
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define ULONG_PTR
Definition: config.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
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 UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
static NTSTATUS FdoCreateRawParallelPdo(IN PDEVICE_OBJECT DeviceObject)
Definition: fdo.c:216
#define PARPORT_TAG
Definition: parport.h:68
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
struct _DEVICE_RELATIONS DEVICE_RELATIONS
#define ObReferenceObject
Definition: obfuncs.h:204

◆ FdoRead()

NTSTATUS NTAPI FdoRead ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 477 of file fdo.c.

479{
480 DPRINT("FdoRead()\n");
481
482 Irp->IoStatus.Information = 0;
483 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
486}
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423

Referenced by DispatchRead().

◆ FdoStartDevice()

NTSTATUS NTAPI FdoStartDevice ( IN PDEVICE_OBJECT  DeviceObject,
IN PCM_RESOURCE_LIST  ResourceList,
IN PCM_RESOURCE_LIST  ResourceListTranslated 
)

Definition at line 104 of file fdo.c.

107{
108 PFDO_DEVICE_EXTENSION DeviceExtension;
109 ULONG i;
110// ULONG Vector = 0;
111// KIRQL Dirql = 0;
112// KAFFINITY Affinity = 0;
113// KINTERRUPT_MODE InterruptMode = Latched;
114// BOOLEAN ShareInterrupt = TRUE;
115
116 DPRINT("FdoStartDevice ()\n");
117
118 DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
119
120 ASSERT(DeviceExtension);
121 ASSERT(DeviceExtension->Common.IsFDO == TRUE);
122
123 if (!ResourceList)
124 {
125 DPRINT1("No allocated resources sent to driver\n");
127 }
128
129 if (ResourceList->Count != 1)
130 {
131 DPRINT1("Wrong number of allocated resources sent to driver\n");
133 }
134
135 if ((ResourceList->List[0].PartialResourceList.Version != 1) ||
136 (ResourceList->List[0].PartialResourceList.Revision != 1) ||
137 (ResourceListTranslated->List[0].PartialResourceList.Version != 1) ||
138 (ResourceListTranslated->List[0].PartialResourceList.Revision != 1))
139 {
140 DPRINT1("Revision mismatch: %u.%u != 1.1 or %u.%u != 1.1\n",
141 ResourceList->List[0].PartialResourceList.Version,
142 ResourceList->List[0].PartialResourceList.Revision,
143 ResourceListTranslated->List[0].PartialResourceList.Version,
144 ResourceListTranslated->List[0].PartialResourceList.Revision);
146 }
147
148 DeviceExtension->BaseAddress = 0;
149
150 for (i = 0; i < ResourceList->List[0].PartialResourceList.Count; i++)
151 {
152 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i];
153 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptorTranslated = &ResourceListTranslated->List[0].PartialResourceList.PartialDescriptors[i];
154
155 switch (PartialDescriptor->Type)
156 {
158 DPRINT("Port: BaseAddress 0x%lx Length %lu\n",
159 PartialDescriptor->u.Port.Start.u.LowPart,
160 PartialDescriptor->u.Port.Length);
161
162 if (DeviceExtension->BaseAddress == 0)
163 {
164 if (PartialDescriptor->u.Port.Length < 3)
166
167 DeviceExtension->BaseAddress = PartialDescriptor->u.Port.Start.u.LowPart;
168 }
169 break;
170
172 DPRINT("Interrupt: Level %lu Vector %lu\n",
173 PartialDescriptorTranslated->u.Interrupt.Level,
174 PartialDescriptorTranslated->u.Interrupt.Vector);
175
176// Dirql = (KIRQL)PartialDescriptorTranslated->u.Interrupt.Level;
177// Vector = PartialDescriptorTranslated->u.Interrupt.Vector;
178// Affinity = PartialDescriptorTranslated->u.Interrupt.Affinity;
179
180// if (PartialDescriptorTranslated->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
181// InterruptMode = Latched;
182// else
183// InterruptMode = LevelSensitive;
184
185// ShareInterrupt = (PartialDescriptorTranslated->ShareDisposition == CmResourceShareShared);
186 break;
187
188 default:
189 DPRINT1("Other resource: \n");
190 break;
191 }
192 }
193
194 DPRINT("New LPT port: Base 0x%lx\n",
195 DeviceExtension->BaseAddress);
196
197 if (!DeviceExtension->BaseAddress)
199
200#if 0
201 if (!Dirql)
203#endif
204
205 DeviceExtension->Common.PnpState = dsStarted;
206
207
208 /* We don't really care if the call succeeded or not... */
209
210 return STATUS_SUCCESS;
211}
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
@ dsStarted
Definition: isapnp.h:35
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:325
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@381 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@381::@383 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@381::@384 Interrupt
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309

◆ FdoWrite()

NTSTATUS NTAPI FdoWrite ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 491 of file fdo.c.

493{
494 DPRINT("FdoWrite()\n");
495
496 Irp->IoStatus.Information = 0;
497 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
500}

Referenced by DispatchWrite().