ReactOS 0.4.15-dev-8102-g108db8f
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
184 DriverObject->MajorFunction[IRP_MJ_CREATE] = FdcCreate;
185 DriverObject->MajorFunction[IRP_MJ_CLOSE] = FdcClose;
186// DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = FdcDeviceControl;
187 DriverObject->MajorFunction[IRP_MJ_PNP] = FdcPnp;
188 DriverObject->MajorFunction[IRP_MJ_POWER] = FdcPower;
189
190 DriverObject->DriverExtension->AddDevice = FdcAddDevice;
191 DriverObject->DriverUnload = FdcDriverUnload;
192
193 return STATUS_SUCCESS;
194}
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
static NTSTATUS NTAPI FdcClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdc.c:104
static NTSTATUS NTAPI FdcPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdc.c:121
static VOID NTAPI FdcDriverUnload(IN PDRIVER_OBJECT DriverObject)
Definition: fdc.c:78
static NTSTATUS NTAPI FdcPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdc.c:143
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
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define IRP_MJ_POWER

◆ 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;
32
33 DPRINT("FdcAddDevice()\n");
34
36 ASSERT(Pdo);
37
38 /* Create functional device object */
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
57 if (!NT_SUCCESS(Status))
58 {
59 DPRINT1("IoAttachDeviceToDeviceStackSafe() failed with status 0x%08lx\n", Status);
61 return Status;
62 }
63
64
65 Fdo->Flags |= DO_DIRECT_IO;
66 Fdo->Flags |= DO_POWER_PAGABLE;
67
68 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
69 }
70
71 return Status;
72}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
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_CONTROLLER
Definition: winioctl.h:110
PDEVICE_OBJECT DeviceObject
Definition: kstypes.h:153
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_ WDFDEVICE Fdo
Definition: wdffdo.h:461
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
#define DO_POWER_PAGABLE

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
#define IO_NO_INCREMENT
Definition: iotypes.h:598

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}
#define FILE_OPENED
Definition: nt_native.h:769

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}

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{
124 PCOMMON_DEVICE_EXTENSION Common = DeviceObject->DeviceExtension;
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}
NTSTATUS NTAPI FdcPdoPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:98
NTSTATUS NTAPI FdcFdoPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:444
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055

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;
148 PFDO_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
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 {
165 case IRP_MN_SET_POWER:
167 break;
168 }
170 Irp->IoStatus.Status = Status;
172 return Status;
173 }
174}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758
#define IRP_MN_SET_POWER
#define IRP_MN_QUERY_POWER

Referenced by DriverEntry().

Variable Documentation

◆ ControllerCount

ULONG ControllerCount = 0

Definition at line 18 of file fdc.c.

Referenced by EnumerateBiosDiskEntries().