ReactOS  0.4.13-dev-563-g0561610
devctrl.c File Reference
#include "cdprocs.h"
Include dependency graph for devctrl.c:

Go to the source code of this file.

Macros

#define BugCheckFileId   (CDFS_BUG_CHECK_DEVCTRL)
 

Functions

NTSTATUS NTAPI CdDevCtrlCompletionRoutine (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_reads_opt_(_Inexpressible_("varies")) PVOID Contxt)
 
NTSTATUS CdCommonDevControl (_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
 

Variables

IO_COMPLETION_ROUTINE CdDevCtrlCompletionRoutine
 

Macro Definition Documentation

◆ BugCheckFileId

#define BugCheckFileId   (CDFS_BUG_CHECK_DEVCTRL)

Definition at line 23 of file devctrl.c.

Function Documentation

◆ CdCommonDevControl()

NTSTATUS CdCommonDevControl ( _Inout_ PIRP_CONTEXT  IrpContext,
_Inout_ PIRP  Irp 
)

Definition at line 46 of file devctrl.c.

61 {
63 
65  PFCB Fcb;
66  PCCB Ccb;
67 
69  PIO_STACK_LOCATION NextIrpSp;
70 
71  PAGED_CODE();
72 
73  //
74  // Extract and decode the file object.
75  //
76 
78 
79  TypeOfOpen = CdDecodeFileObject( IrpContext,
81  &Fcb,
82  &Ccb );
83 
84  //
85  // The only type of opens we accept are user volume opens.
86  //
87 
88  if (TypeOfOpen != UserVolumeOpen) {
89 
92  }
93 
94  if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_CDROM_READ_TOC) {
95 
96  //
97  // Verify the Vcb in this case to detect if the volume has changed.
98  //
99 
100  CdVerifyVcb( IrpContext, Fcb->Vcb );
101 
102  //
103  // Handle the case of the disk type ourselves.
104  //
105 
106  } else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_CDROM_DISK_TYPE) {
107 
108  //
109  // Verify the Vcb in this case to detect if the volume has changed.
110  //
111 
112  CdVerifyVcb( IrpContext, Fcb->Vcb );
113 
114  //
115  // Check the size of the output buffer.
116  //
117 
118  if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof( CDROM_DISK_DATA )) {
119 
122  }
123 
124  //
125  // Copy the data from the Vcb.
126  //
127 
128  ((PCDROM_DISK_DATA) Irp->AssociatedIrp.SystemBuffer)->DiskData = Fcb->Vcb->DiskFlags;
129 
130  Irp->IoStatus.Information = sizeof( CDROM_DISK_DATA );
131  CdCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
132  return STATUS_SUCCESS;
133  }
134 
135  //
136  // Get the next stack location, and copy over the stack parameter
137  // information.
138  //
139 
140  NextIrpSp = IoGetNextIrpStackLocation( Irp );
141 
142  *NextIrpSp = *IrpSp;
143 
144  //
145  // Set up the completion routine
146  //
147 
150  NULL,
151  TRUE,
152  TRUE,
153  TRUE );
154 
155  //
156  // Send the request.
157  //
158 
159  Status = IoCallDriver( IrpContext->Vcb->TargetDeviceObject, Irp );
160 
161  //
162  // Cleanup our Irp Context. The driver has completed the Irp.
163  //
164 
165  CdCompleteRequest( IrpContext, NULL, STATUS_SUCCESS );
166 
167  return Status;
168 }
#define TRUE
Definition: types.h:120
_In_ PIRP Irp
Definition: csq.h:116
Definition: cdstruc.h:908
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
Definition: cdstruc.h:1073
LONG NTSTATUS
Definition: precomp.h:26
ULONG DiskFlags
Definition: cdstruc.h:646
#define PAGED_CODE()
Definition: video.h:57
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
#define IOCTL_CDROM_DISK_TYPE
Definition: ntddcdrm.h:67
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
Definition: cdprocs.h:593
VOID CdCompleteRequest(_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
Definition: cddata.c:914
smooth NULL
Definition: ftsmooth.c:416
struct _CDROM_DISK_DATA * PCDROM_DISK_DATA
enum _TYPE_OF_OPEN TYPE_OF_OPEN
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
Status
Definition: gdiplustypes.h:24
VOID CdVerifyVcb(_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb)
Definition: verfysup.c:411
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
struct _CDROM_DISK_DATA CDROM_DISK_DATA
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
PVCB Vcb
Definition: cdstruc.h:939
#define IOCTL_CDROM_READ_TOC
Definition: ntddcdrm.h:73
IO_COMPLETION_ROUTINE CdDevCtrlCompletionRoutine
Definition: devctrl.c:30
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2777

Referenced by _IRQL_requires_max_(), and CdFspDispatch().

◆ CdDevCtrlCompletionRoutine()

NTSTATUS NTAPI CdDevCtrlCompletionRoutine ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp,
_In_reads_opt_(_Inexpressible_("varies")) PVOID  Contxt 
)

Definition at line 177 of file devctrl.c.

183 {
184  //
185  // Add the hack-o-ramma to fix formats.
186  //
187 
188  if (Irp->PendingReturned) {
189 
191  }
192 
193  return STATUS_SUCCESS;
194 
196  UNREFERENCED_PARAMETER( Contxt );
197 }
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
return STATUS_SUCCESS
Definition: btrfs.c:2777
IoMarkIrpPending(Irp)

Variable Documentation

◆ CdDevCtrlCompletionRoutine

NTSTATUS NTAPI CdDevCtrlCompletionRoutine

Definition at line 30 of file devctrl.c.

Referenced by CdCommonDevControl().