ReactOS 0.4.16-dev-1946-g52006dd
fdo.c File Reference
#include "parport.h"
#include <debug.h>
Include dependency graph for fdo.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

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)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 9 of file fdo.c.

Function Documentation

◆ AddDevice()

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

Definition at line 391 of file fdo.c.

393{
394 DPRINT("AddDevice(%p %p)\n", DriverObject, Pdo);
395
396 /* Serial.sys is a legacy driver. AddDevice is called once
397 * with a NULL Pdo just after the driver initialization.
398 * Detect this case and return success.
399 */
400 if (Pdo == NULL)
401 return STATUS_SUCCESS;
402
403 /* We have here a PDO not null. It represents a real serial
404 * port. So call the internal AddDevice function.
405 */
407}
#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:16
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
_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 16 of file fdo.c.

20{
21 PFDO_DEVICE_EXTENSION DeviceExtension = NULL;
23 WCHAR DeviceNameBuffer[32];
26
27 DPRINT("AddDeviceInternal()\n");
28
30 ASSERT(Pdo);
31
32 /* Create new device object */
33 swprintf(DeviceNameBuffer,
34 L"\\Device\\ParallelPort%lu",
35 IoGetConfigurationInformation()->ParallelCount);
37 DeviceNameBuffer);
38
44 FALSE,
45 &Fdo);
46 if (!NT_SUCCESS(Status))
47 {
48 DPRINT1("IoCreateDevice() failed (Status 0x%08lx)\n", Status);
49 Fdo = NULL;
50 goto done;
51 }
52
53 DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
54 RtlZeroMemory(DeviceExtension,
55 sizeof(FDO_DEVICE_EXTENSION));
56
57 DeviceExtension->Common.IsFDO = TRUE;
58 DeviceExtension->Common.PnpState = dsStopped;
59
61 DeviceExtension->Pdo = Pdo;
62
64 Pdo,
65 &DeviceExtension->LowerDevice);
66 if (!NT_SUCCESS(Status))
67 {
68 DPRINT1("IoAttachDeviceToDeviceStackSafe() failed (Status 0x%08lx)\n", Status);
69 goto done;
70 }
71
72 if (DeviceExtension->LowerDevice->Flags & DO_POWER_PAGABLE)
73 Fdo->Flags |= DO_POWER_PAGABLE;
74
75 if (DeviceExtension->LowerDevice->Flags & DO_BUFFERED_IO)
76 Fdo->Flags |= DO_BUFFERED_IO;
77
78 if (DeviceExtension->LowerDevice->Flags & DO_DIRECT_IO)
79 Fdo->Flags |= DO_DIRECT_IO;
80
81 /* Choose default strategy */
82 if ((Fdo->Flags & (DO_BUFFERED_IO | DO_DIRECT_IO)) == 0)
83 Fdo->Flags |= DO_BUFFERED_IO;
84
85 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
86
87 if (pFdo)
88 {
89 *pFdo = Fdo;
90 }
91
92 return STATUS_SUCCESS;
93
94done:
95 if (Fdo)
96 {
98 }
99
100 return Status;
101}
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:33
#define swprintf
Definition: precomp.h:40
#define L(x)
Definition: resources.c:13
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)
Returns a pointer to the I/O manager's global configuration information structure.
Definition: iorsrce.c:998
@ dsStopped
Definition: isapnp.h:30
#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 FILE_DEVICE_PARALLEL_PORT
Definition: winioctl.h:67
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:3281
_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 465 of file fdo.c.

467{
468 DPRINT("FdoCleanup()\n");
469
470 Irp->IoStatus.Information = 0;
471 Irp->IoStatus.Status = STATUS_SUCCESS;
473
474 return STATUS_SUCCESS;
475}
_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 445 of file fdo.c.

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

Referenced by DispatchClose().

◆ FdoCreate()

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

Definition at line 412 of file fdo.c.

414{
415 PFDO_DEVICE_EXTENSION DeviceExtension;
418
419 DPRINT("FdoCreate()\n");
420
422 DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
423
424 if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
425 {
426 DPRINT1("Not a directory\n");
428 goto done;
429 }
430
431 DPRINT("Open parallel port %lu: successful\n", DeviceExtension->PortNumber);
432 DeviceExtension->OpenCount++;
433
434done:
435 Irp->IoStatus.Status = Status;
436 Irp->IoStatus.Information = 0;
438
439 return Status;
440}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#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

Referenced by DispatchCreate().

◆ FdoCreateRawParallelPdo()

static NTSTATUS FdoCreateRawParallelPdo ( IN PDEVICE_OBJECT  DeviceObject)
static

Definition at line 219 of file fdo.c.

221{
222 PFDO_DEVICE_EXTENSION FdoDeviceExtension;
223 PPDO_DEVICE_EXTENSION PdoDeviceExtension = NULL;
225 WCHAR DeviceNameBuffer[32];
226 WCHAR LinkNameBuffer[32];
227 WCHAR LptPortBuffer[32];
229 UNICODE_STRING LinkName;
230 UNICODE_STRING LptPort;
235
236 DPRINT("FdoCreateRawParallelPdo()\n");
237
238 FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
239
240 /* Create new device object */
241 swprintf(DeviceNameBuffer,
242 L"\\Device\\Parallel%lu",
243 FdoDeviceExtension->PortNumber);
245 DeviceNameBuffer);
246
247 Status = IoCreateDevice(DeviceObject->DriverObject,
248 sizeof(PDO_DEVICE_EXTENSION),
249 &DeviceName,
251 0,
252 FALSE,
253 &Pdo);
254 if (!NT_SUCCESS(Status))
255 {
256 DPRINT1("IoCreateDevice() failed with status 0x%08x\n", Status);
257 goto done;
258 }
259
261 Pdo->Flags |= DO_POWER_PAGABLE;
262
263 PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
264 RtlZeroMemory(PdoDeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
265
266 PdoDeviceExtension->Common.IsFDO = FALSE;
267 PdoDeviceExtension->Common.PnpState = dsStopped;
268
269 Pdo->StackSize = DeviceObject->StackSize + 1;
270
271 FdoDeviceExtension->AttachedRawPdo = Pdo;
272 PdoDeviceExtension->AttachedFdo = DeviceObject;
273
274 PdoDeviceExtension->PortNumber = FdoDeviceExtension->PortNumber;
275 PdoDeviceExtension->LptPort = PdoDeviceExtension->PortNumber + 1;
276
277
278 /* Create link \DosDevices\LPTX -> \Device\ParallelY */
279 swprintf(LinkNameBuffer, L"\\DosDevices\\LPT%lu", PdoDeviceExtension->LptPort);
280 RtlInitUnicodeString(&LinkName, LinkNameBuffer);
281 Status = IoCreateSymbolicLink(&LinkName,
282 &DeviceName);
283 if (!NT_SUCCESS(Status))
284 {
285 DPRINT1("IoCreateSymbolicLink() failed with status 0x%08x\n", Status);
286 goto done;
287 }
288
289 swprintf(LptPortBuffer, L"LPT%lu", PdoDeviceExtension->LptPort);
290 RtlInitUnicodeString(&LptPort, LptPortBuffer);
291
292 /* Write an entry value under HKLM\HARDWARE\DeviceMap\PARALLEL PORTS. */
293 /* This step is not mandatory, so do not exit in case of error. */
295 L"\\Registry\\Machine\\HARDWARE\\DeviceMap\\PARALLEL PORTS");
297 &KeyName,
299 NULL,
300 NULL);
301
302 Status = ZwCreateKey(&KeyHandle,
305 0,
306 NULL,
308 NULL);
309 if (NT_SUCCESS(Status))
310 {
311 /* Key = \Device\Parallelx, Value = LPTx */
312 ZwSetValueKey(KeyHandle,
313 &DeviceName,
314 0,
315 REG_SZ,
316 LptPortBuffer,
317 LptPort.Length + sizeof(WCHAR));
319 }
320
321 Pdo->Flags |= DO_BUFFERED_IO;
322 Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
323
324done:
325 if (!NT_SUCCESS(Status))
326 {
327 if (Pdo)
328 {
329 ASSERT(PdoDeviceExtension);
331 }
332 }
333
334 return Status;
335}
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:1063
#define KEY_SET_VALUE
Definition: nt_native.h:1020
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:49
PDEVICE_OBJECT AttachedRawPdo
Definition: parport.h:40
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:59
PDEVICE_OBJECT AttachedFdo
Definition: parport.h:56
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2705
#define DO_BUS_ENUMERATED_DEVICE

Referenced by FdoQueryBusRelations().

◆ FdoPnp()

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

Definition at line 508 of file fdo.c.

510{
516
517 DPRINT("FdoPnp()\n");
518
520 MinorFunction = Stack->MinorFunction;
521
522 switch (MinorFunction)
523 {
524 /* FIXME: do all these minor functions
525 IRP_MN_QUERY_REMOVE_DEVICE 0x1
526 IRP_MN_REMOVE_DEVICE 0x2
527 {
528 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
529 IoAcquireRemoveLock
530 IoReleaseRemoveLockAndWait
531 pass request to DeviceExtension-LowerDriver
532 disable interface
533 IoDeleteDevice(Fdo) and/or IoDetachDevice
534 break;
535 }
536 IRP_MN_CANCEL_REMOVE_DEVICE 0x3
537 IRP_MN_STOP_DEVICE 0x4
538 IRP_MN_QUERY_STOP_DEVICE 0x5
539 IRP_MN_CANCEL_STOP_DEVICE 0x6
540 IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations (optional) 0x7
541 IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations (optional) 0x7
542 IRP_MN_QUERY_INTERFACE (optional) 0x8
543 IRP_MN_QUERY_CAPABILITIES (optional) 0x9
544 IRP_MN_FILTER_RESOURCE_REQUIREMENTS (optional) 0xd
545 IRP_MN_QUERY_PNP_DEVICE_STATE (optional) 0x14
546 IRP_MN_DEVICE_USAGE_NOTIFICATION (required or optional) 0x16
547 IRP_MN_SURPRISE_REMOVAL 0x17
548 */
549 case IRP_MN_START_DEVICE: /* 0x0 */
550 DPRINT("IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
551
552 /* Call lower driver */
553 FdoExtension = DeviceObject->DeviceExtension;
555
556 ASSERT(FdoExtension->Common.PnpState == dsStopped);
557
558 if (IoForwardIrpSynchronously(FdoExtension->LowerDevice, Irp))
559 {
560 Status = Irp->IoStatus.Status;
561 if (NT_SUCCESS(Status))
562 {
564 Stack->Parameters.StartDevice.AllocatedResources,
565 Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
566 }
567 }
568 break;
569
570 case IRP_MN_QUERY_DEVICE_RELATIONS: /* (optional) 0x7 */
571 switch (Stack->Parameters.QueryDeviceRelations.Type)
572 {
573 case BusRelations:
574 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
576 Irp->IoStatus.Status = Status;
578 return Status;
579
580 case RemovalRelations:
581 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
583
584 default:
585 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
586 Stack->Parameters.QueryDeviceRelations.Type);
588 }
589 break;
590
591 case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0xd */
592 DPRINT("IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
594
595 default:
596 DPRINT("Unknown minor function 0x%x\n", MinorFunction);
598 }
599
600 Irp->IoStatus.Information = Information;
601 Irp->IoStatus.Status = Status;
603
604 return Status;
605}
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
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1625
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1705
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
@ RemovalRelations
Definition: iotypes.h:2157
@ BusRelations
Definition: iotypes.h:2154
#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 610 of file fdo.c.

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

Referenced by DispatchPower().

◆ FdoQueryBusRelations()

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

Definition at line 340 of file fdo.c.

344{
345 PFDO_DEVICE_EXTENSION DeviceExtension;
346 PDEVICE_RELATIONS DeviceRelations;
347 ULONG Size;
348 ULONG i;
349 ULONG PdoCount = 0;
351
353
354 DPRINT("FdoQueryBusRelations()\n");
355
356 DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
357 ASSERT(DeviceExtension->Common.IsFDO);
358
359 /* TODO: Enumerate parallel devices and create their PDOs */
360
362 if (!NT_SUCCESS(Status))
363 return Status;
364
365 PdoCount++;
366
367 /* Allocate a buffer for the device relations */
368 Size = sizeof(DEVICE_RELATIONS) + sizeof(PDEVICE_OBJECT) * (PdoCount - 1);
369 DeviceRelations = ExAllocatePoolWithTag(PagedPool, Size, PARPORT_TAG);
370 if (DeviceRelations == NULL)
372
373 /* Fill the buffer */
374 i = 0;
375 ObReferenceObject(DeviceExtension->AttachedRawPdo);
376 DeviceRelations->Objects[i] = DeviceExtension->AttachedRawPdo;
377 DeviceRelations->Count = 1;
378
379 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
380
381 DPRINT("Done\n");
382
383 return STATUS_SUCCESS;
384}
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4138
#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:329
static NTSTATUS FdoCreateRawParallelPdo(IN PDEVICE_OBJECT DeviceObject)
Definition: fdo.c:219
#define PARPORT_TAG
Definition: parport.h:65
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2165
#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:4539
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 480 of file fdo.c.

482{
483 DPRINT("FdoRead()\n");
484
485 Irp->IoStatus.Information = 0;
486 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
489}
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48

Referenced by DispatchRead().

◆ FdoStartDevice()

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

Definition at line 106 of file fdo.c.

109{
110 PFDO_DEVICE_EXTENSION DeviceExtension;
111 ULONG i;
112// ULONG Vector = 0;
113// KIRQL Dirql = 0;
114// KAFFINITY Affinity = 0;
115// KINTERRUPT_MODE InterruptMode = Latched;
116// BOOLEAN ShareInterrupt = TRUE;
117
118 DPRINT("FdoStartDevice ()\n");
119
120 DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
121
122 ASSERT(DeviceExtension);
123 ASSERT(DeviceExtension->Common.IsFDO == TRUE);
124
125 if (!ResourceList)
126 {
127 DPRINT1("No allocated resources sent to driver\n");
129 }
130
131 if (ResourceList->Count != 1)
132 {
133 DPRINT1("Wrong number of allocated resources sent to driver\n");
135 }
136
137 if ((ResourceList->List[0].PartialResourceList.Version != 1) ||
138 (ResourceList->List[0].PartialResourceList.Revision != 1) ||
139 (ResourceListTranslated->List[0].PartialResourceList.Version != 1) ||
140 (ResourceListTranslated->List[0].PartialResourceList.Revision != 1))
141 {
142 DPRINT1("Revision mismatch: %u.%u != 1.1 or %u.%u != 1.1\n",
143 ResourceList->List[0].PartialResourceList.Version,
144 ResourceList->List[0].PartialResourceList.Revision,
145 ResourceListTranslated->List[0].PartialResourceList.Version,
146 ResourceListTranslated->List[0].PartialResourceList.Revision);
148 }
149
150 DeviceExtension->BaseAddress = 0;
151
152 for (i = 0; i < ResourceList->List[0].PartialResourceList.Count; i++)
153 {
154 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i];
155 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptorTranslated = &ResourceListTranslated->List[0].PartialResourceList.PartialDescriptors[i];
156
157 switch (PartialDescriptor->Type)
158 {
160 DPRINT("Port: BaseAddress 0x%lx Length %lu\n",
161 PartialDescriptor->u.Port.Start.u.LowPart,
162 PartialDescriptor->u.Port.Length);
163
164 if (DeviceExtension->BaseAddress == 0)
165 {
166 if (PartialDescriptor->u.Port.Length < 3)
168
169 DeviceExtension->BaseAddress = PartialDescriptor->u.Port.Start.u.LowPart;
170 }
171 break;
172
174 DPRINT("Interrupt: Level %lu Vector %lu\n",
175 PartialDescriptorTranslated->u.Interrupt.Level,
176 PartialDescriptorTranslated->u.Interrupt.Vector);
177
178 (VOID)PartialDescriptorTranslated;
179// Dirql = (KIRQL)PartialDescriptorTranslated->u.Interrupt.Level;
180// Vector = PartialDescriptorTranslated->u.Interrupt.Vector;
181// Affinity = PartialDescriptorTranslated->u.Interrupt.Affinity;
182
183// if (PartialDescriptorTranslated->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
184// InterruptMode = Latched;
185// else
186// InterruptMode = LevelSensitive;
187
188// ShareInterrupt = (PartialDescriptorTranslated->ShareDisposition == CmResourceShareShared);
189 break;
190
191 default:
192 DPRINT1("Other resource: \n");
193 break;
194 }
195 }
196
197 DPRINT("New LPT port: Base 0x%lx\n",
198 DeviceExtension->BaseAddress);
199
200 if (!DeviceExtension->BaseAddress)
202
203#if 0
204 if (!Dirql)
206#endif
207
208 DeviceExtension->Common.PnpState = dsStarted;
209
210
211 /* We don't really care if the call succeeded or not... */
212
213 return STATUS_SUCCESS;
214}
#define VOID
Definition: acefi.h:82
@ dsStarted
Definition: isapnp.h:31
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:419
#define CmResourceTypePort
Definition: restypes.h:104
#define CmResourceTypeInterrupt
Definition: restypes.h:105
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@430::@433 Interrupt
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@430::@432 Port
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@430 u
_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 494 of file fdo.c.

496{
497 DPRINT("FdoWrite()\n");
498
499 Irp->IoStatus.Information = 0;
500 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
503}

Referenced by DispatchWrite().