MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2LockIrp

Function Ext2LockIrp

Ext4Fsd/dispatch.c:85–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83 */
84
85VOID
86Ext2LockIrp (
87 IN PVOID Context,
88 IN PIRP Irp
89)
90{
91 PIO_STACK_LOCATION IrpSp;
92 PEXT2_IRP_CONTEXT IrpContext;
93
94 if (Irp == NULL) {
95 return;
96 }
97
98 IrpSp = IoGetCurrentIrpStackLocation(Irp);
99
100 IrpContext = (PEXT2_IRP_CONTEXT) Context;
101
102 if ( IrpContext->MajorFunction == IRP_MJ_READ ||
103 IrpContext->MajorFunction == IRP_MJ_WRITE ) {
104
105 //
106 // lock the user's buffer to MDL, if the I/O is bufferred
107 //
108
109 if (!IsFlagOn(IrpContext->MinorFunction, IRP_MN_MDL)) {
110
111 Ext2LockUserBuffer( Irp, IrpSp->Parameters.Write.Length,
112 (IrpContext->MajorFunction == IRP_MJ_READ) ?
113 IoWriteAccess : IoReadAccess );
114 }
115
116 } else if (IrpContext->MajorFunction == IRP_MJ_DIRECTORY_CONTROL
117 && IrpContext->MinorFunction == IRP_MN_QUERY_DIRECTORY) {
118
119 ULONG Length = ((PEXTENDED_IO_STACK_LOCATION) IrpSp)->Parameters.QueryDirectory.Length;
120 Ext2LockUserBuffer(Irp, Length, IoWriteAccess);
121
122 } else if (IrpContext->MajorFunction == IRP_MJ_QUERY_EA) {
123
124 ULONG Length = ((PEXTENDED_IO_STACK_LOCATION) IrpSp)->Parameters.QueryEa.Length;
125 Ext2LockUserBuffer(Irp, Length, IoWriteAccess);
126
127 } else if (IrpContext->MajorFunction == IRP_MJ_SET_EA) {
128 ULONG Length = ((PEXTENDED_IO_STACK_LOCATION) IrpSp)->Parameters.SetEa.Length;
129 Ext2LockUserBuffer(Irp, Length, IoReadAccess);
130
131 } else if ( (IrpContext->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL) &&
132 (IrpContext->MinorFunction == IRP_MN_USER_FS_REQUEST) ) {
133 PEXTENDED_IO_STACK_LOCATION EIrpSp = (PEXTENDED_IO_STACK_LOCATION)IrpSp;
134 if ( (EIrpSp->Parameters.FileSystemControl.FsControlCode == FSCTL_GET_VOLUME_BITMAP) ||
135 (EIrpSp->Parameters.FileSystemControl.FsControlCode == FSCTL_GET_RETRIEVAL_POINTERS) ||
136 (EIrpSp->Parameters.FileSystemControl.FsControlCode == FSCTL_GET_RETRIEVAL_POINTER_BASE) ) {
137 ULONG Length = EIrpSp->Parameters.FileSystemControl.OutputBufferLength;
138 Ext2LockUserBuffer(Irp, Length, IoWriteAccess);
139 }
140 }
141
142 // Mark the request as pending status

Callers 1

Ext2QueueRequestFunction · 0.85

Calls 1

Ext2LockUserBufferFunction · 0.85

Tested by

no test coverage detected