ReactOS  0.4.14-dev-599-g2d4d3f5
fdc.c File Reference
#include "fdc.h"
#include <debug.h>
Include dependency graph for fdc.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static NTSTATUS NTAPI FdcAddDevice (IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT Pdo)
 
static VOID NTAPI FdcDriverUnload (IN PDRIVER_OBJECT DriverObject)
 
static NTSTATUS NTAPI FdcCreate (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI FdcClose (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI FdcPnp (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI FdcPower (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI DriverEntry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
 

Variables

ULONG ControllerCount = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file fdc.c.

Function Documentation

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( IN PDRIVER_OBJECT  DriverObject,
IN PUNICODE_STRING  RegistryPath 
)

Definition at line 179 of file fdc.c.

181 {
182  DPRINT("FDC: DriverEntry()\n");
183 
186 // DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = FdcDeviceControl;
189 
192 
193  return STATUS_SUCCESS;
194 }
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
static VOID NTAPI FdcDriverUnload(IN PDRIVER_OBJECT DriverObject)
Definition: fdc.c:78
static NTSTATUS NTAPI FdcCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdc.c:87
static NTSTATUS NTAPI FdcAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT Pdo)
Definition: fdc.c:25
static NTSTATUS NTAPI FdcPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdc.c:143
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
static NTSTATUS NTAPI FdcPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdc.c:121
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2174
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
void DPRINT(...)
Definition: polytest.cpp:61
static NTSTATUS NTAPI FdcClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdc.c:104
#define IRP_MJ_POWER
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2180
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2112
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ FdcAddDevice()

static NTSTATUS NTAPI FdcAddDevice ( IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT  Pdo 
)
static

Definition at line 25 of file fdc.c.

28 {
29  PFDO_DEVICE_EXTENSION DeviceExtension = NULL;
30  PDEVICE_OBJECT Fdo = NULL;
32 
33  DPRINT("FdcAddDevice()\n");
34 
36  ASSERT(Pdo);
37 
38  /* Create functional device object */
40  sizeof(FDO_DEVICE_EXTENSION),
41  NULL,
44  FALSE,
45  &Fdo);
46  if (NT_SUCCESS(Status))
47  {
48  DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
49  RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
50 
51  DeviceExtension->Common.IsFDO = TRUE;
52  DeviceExtension->Common.DeviceObject = Fdo;
53 
54  DeviceExtension->Pdo = Pdo;
55 
56  Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice);
57  if (!NT_SUCCESS(Status))
58  {
59  DPRINT1("IoAttachDeviceToDeviceStackSafe() failed with status 0x%08lx\n", Status);
60  IoDeleteDevice(Fdo);
61  return Status;
62  }
63 
64 
65  Fdo->Flags |= DO_DIRECT_IO;
66  Fdo->Flags |= DO_POWER_PAGABLE;
67 
69  }
70 
71  return Status;
72 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define DO_POWER_PAGABLE
#define TRUE
Definition: types.h:120
_In_ PDEVICE_OBJECT Pdo
Definition: classpnp.h:301
LONG NTSTATUS
Definition: precomp.h:26
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
PDEVICE_OBJECT DeviceObject
Definition: kstypes.h:153
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:109
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: device.c:980
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:80
Status
Definition: gdiplustypes.h:24
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define DPRINT1
Definition: precomp.h:8
PDEVICE_OBJECT Pdo
Definition: i8042prt.h:128
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
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130

Referenced by DriverEntry().

◆ FdcClose()

static NTSTATUS NTAPI FdcClose ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 104 of file fdc.c.

106 {
107  DPRINT("FdcClose()\n");
108 
109  Irp->IoStatus.Status = STATUS_SUCCESS;
110  Irp->IoStatus.Information = 0;
111 
113 
114  return STATUS_SUCCESS;
115 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IO_NO_INCREMENT
Definition: iotypes.h:566
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by DriverEntry().

◆ FdcCreate()

static NTSTATUS NTAPI FdcCreate ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 87 of file fdc.c.

89 {
90  DPRINT("FdcCreate()\n");
91 
92  Irp->IoStatus.Status = STATUS_SUCCESS;
93  Irp->IoStatus.Information = FILE_OPENED;
94 
96 
97  return STATUS_SUCCESS;
98 }
_In_ PIRP Irp
Definition: csq.h:116
#define FILE_OPENED
Definition: nt_native.h:769
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IO_NO_INCREMENT
Definition: iotypes.h:566
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by DriverEntry().

◆ FdcDriverUnload()

static VOID NTAPI FdcDriverUnload ( IN PDRIVER_OBJECT  DriverObject)
static

Definition at line 78 of file fdc.c.

79 {
80  DPRINT("FdcDriverUnload()\n");
81 }
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by DriverEntry().

◆ FdcPnp()

static NTSTATUS NTAPI FdcPnp ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 121 of file fdc.c.

123 {
125 
126  DPRINT("FdcPnP()\n");
127  if (Common->IsFDO)
128  {
129  return FdcFdoPnp(DeviceObject,
130  Irp);
131  }
132  else
133  {
134  return FdcPdoPnp(DeviceObject,
135  Irp);
136  }
137 }
_In_ PIRP Irp
Definition: csq.h:116
PVOID DeviceExtension
Definition: env_spec_w32.h:418
NTSTATUS NTAPI FdcFdoPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:491
void DPRINT(...)
Definition: polytest.cpp:61
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
NTSTATUS NTAPI FdcPdoPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:98

Referenced by DriverEntry().

◆ FdcPower()

static NTSTATUS NTAPI FdcPower ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 143 of file fdc.c.

145 {
147  NTSTATUS Status = Irp->IoStatus.Status;
149 
150  DPRINT("FdcPower()\n");
151 
153 
154  if (DeviceExtension->Common.IsFDO)
155  {
158  return PoCallDriver(DeviceExtension->LowerDevice, Irp);
159  }
160  else
161  {
162  switch (IrpSp->MinorFunction)
163  {
164  case IRP_MN_QUERY_POWER:
165  case IRP_MN_SET_POWER:
167  break;
168  }
170  Irp->IoStatus.Status = Status;
172  return Status;
173  }
174 }
#define IRP_MN_QUERY_POWER
NTSTATUS NTAPI PoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
Definition: power.c:485
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IRP_MN_SET_POWER
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:80
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IO_NO_INCREMENT
Definition: iotypes.h:566
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by DriverEntry().

Variable Documentation

◆ ControllerCount

ULONG ControllerCount = 0

Definition at line 18 of file fdc.c.

Referenced by EnumerateBiosDiskEntries().