ReactOS  0.4.14-dev-606-g14ebc0b
block.c
Go to the documentation of this file.
1 /*
2  * FFS File System Driver for Windows
3  *
4  * block.c
5  *
6  * 2004.5.6 ~
7  *
8  * Lee Jae-Hong, http://www.pyrasis.com
9  *
10  * See License.txt
11  *
12  */
13 
14 #include "ntifs.h"
15 #include "ffsdrv.h"
16 
17 /* Globals */
18 
19 extern PFFS_GLOBAL FFSGlobal;
20 
21 
22 /* Definitions */
23 
24 typedef struct _FFS_RW_CONTEXT {
31 
32 #ifdef _PREFAST_
33 IO_COMPLETION_ROUTINE FFSReadWriteBlockSyncCompletionRoutine;
34 IO_COMPLETION_ROUTINE FFSReadWriteBlockAsyncCompletionRoutine;
35 IO_COMPLETION_ROUTINE FFSMediaEjectControlCompletion;
36 #endif // _PREFAST_
37 
41  IN PIRP Irp,
42  IN PVOID Context);
43 
47  IN PIRP Irp,
48  IN PVOID Context);
49 
53  IN PIRP Irp,
54  IN PVOID Contxt);
55 
56 
57 #ifdef ALLOC_PRAGMA
58 #pragma alloc_text(PAGE, FFSLockUserBuffer)
59 #pragma alloc_text(PAGE, FFSGetUserBuffer)
60 #pragma alloc_text(PAGE, FFSReadSync)
61 #pragma alloc_text(PAGE, FFSReadDisk)
62 #pragma alloc_text(PAGE, FFSDiskIoControl)
63 #pragma alloc_text(PAGE, FFSReadWriteBlocks)
64 #pragma alloc_text(PAGE, FFSMediaEjectControl)
65 #pragma alloc_text(PAGE, FFSDiskShutDown)
66 #endif
67 
68 
71  IN PIRP Irp,
72  IN ULONG Length,
74 {
76 
77  PAGED_CODE();
78 
79  ASSERT(Irp != NULL);
80 
81  if (Irp->MdlAddress != NULL)
82  {
83  return STATUS_SUCCESS;
84  }
85 
86  IoAllocateMdl(Irp->UserBuffer, Length, FALSE, FALSE, Irp);
87 
88  if (Irp->MdlAddress == NULL)
89  {
91  }
92 
93  _SEH2_TRY
94  {
95  MmProbeAndLockPages(Irp->MdlAddress, Irp->RequestorMode, Operation);
96 
98  }
100  {
101  IoFreeMdl(Irp->MdlAddress);
102 
103  Irp->MdlAddress = NULL;
104 
105  FFSBreakPoint();
106 
108  } _SEH2_END;
109 
110  return Status;
111 }
112 
113 
114 PVOID
116  IN PIRP Irp)
117 {
118  PAGED_CODE();
119 
120  ASSERT(Irp != NULL);
121 
122  if (Irp->MdlAddress)
123  {
124 #if (_WIN32_WINNT >= 0x0500)
126 #else
127  return MmGetSystemAddressForMdl(Irp->MdlAddress);
128 #endif
129  }
130  else
131  {
132  return Irp->UserBuffer;
133  }
134 }
135 
136 
140  IN PIRP Irp,
141  IN PVOID Context)
142 {
144 
145  if (!NT_SUCCESS(Irp->IoStatus.Status))
146  {
147 
148  pContext->MasterIrp->IoStatus = Irp->IoStatus;
149  }
150 
151  IoFreeMdl(Irp->MdlAddress);
152  IoFreeIrp(Irp);
153 
154  if (InterlockedDecrement(&pContext->Blocks) == 0)
155  {
156  pContext->MasterIrp->IoStatus.Information = 0;
157 
158  if (NT_SUCCESS(pContext->MasterIrp->IoStatus.Status))
159  {
160  pContext->MasterIrp->IoStatus.Information =
161  pContext->Length;
162  }
163 
164  KeSetEvent(&pContext->Event, 0, FALSE);
165  }
166 
168 
170 }
171 
175  IN PIRP Irp,
176  IN PVOID Context)
177 {
179 
180  if (!NT_SUCCESS(Irp->IoStatus.Status))
181  {
182  pContext->MasterIrp->IoStatus = Irp->IoStatus;
183  }
184 
185  if (InterlockedDecrement(&pContext->Blocks) == 0)
186  {
187  pContext->MasterIrp->IoStatus.Information = 0;
188 
189  if (NT_SUCCESS(pContext->MasterIrp->IoStatus.Status))
190  {
191  pContext->MasterIrp->IoStatus.Information =
192  pContext->Length;
193  }
194 
195  IoMarkIrpPending(pContext->MasterIrp);
196 
197  ExFreePool(pContext);
198  }
199 
201 
202  return STATUS_SUCCESS;
203 
204 }
205 
206 NTSTATUS
208  IN PFFS_IRP_CONTEXT IrpContext,
209  IN PFFS_VCB Vcb,
210  IN PFFS_BDL FFSBDL,
211  IN ULONG Length,
212  IN ULONG Count,
214 {
215  PMDL Mdl;
216  PIRP Irp;
217  PIRP MasterIrp = IrpContext->Irp;
220  PFFS_RW_CONTEXT pContext = NULL;
221  ULONG i;
222  BOOLEAN bBugCheck = FALSE;
223 
224  PAGED_CODE();
225 
226  ASSERT(MasterIrp);
227 
228  _SEH2_TRY
229  {
230 
232 
233  if (!pContext)
234  {
236  _SEH2_LEAVE;
237  }
238 
239  RtlZeroMemory(pContext, sizeof(FFS_RW_CONTEXT));
240 
241  pContext->Wait = IrpContext->IsSynchronous;
242  pContext->MasterIrp = MasterIrp;
243  pContext->Blocks = Count;
244  pContext->Length = 0;
245 
246  if (pContext->Wait)
247  {
249  }
250 
251  for (i = 0; i < Count; i++)
252  {
253 
254  Irp = IoMakeAssociatedIrp(MasterIrp,
255  (CCHAR)(Vcb->TargetDeviceObject->StackSize + 1));
256  if (!Irp)
257  {
258 #ifdef __REACTOS__
259  ExFreePoolWithTag(pContext, FFS_POOL_TAG);
260  pContext = NULL;
261 #endif
263  _SEH2_LEAVE;
264  }
265 
266  Mdl = IoAllocateMdl((PCHAR)MasterIrp->UserBuffer +
267  FFSBDL[i].Offset,
268  FFSBDL[i].Length,
269  FALSE,
270  FALSE,
271  Irp);
272 
273  if (!Mdl)
274  {
275 #ifdef __REACTOS__
276  ExFreePoolWithTag(pContext, FFS_POOL_TAG);
277  pContext = NULL;
278 #endif
280  _SEH2_LEAVE;
281  }
282 
283  IoBuildPartialMdl(MasterIrp->MdlAddress,
284  Mdl,
285  (PCHAR)MasterIrp->UserBuffer + FFSBDL[i].Offset,
286  FFSBDL[i].Length);
287 
290 
291 
292  IrpSp->MajorFunction = IrpContext->MajorFunction;
293  IrpSp->Parameters.Read.Length = FFSBDL[i].Length;
294  IrpSp->Parameters.Read.ByteOffset.QuadPart = FFSBDL[i].Lba;
295 
297  IrpContext->IsSynchronous ?
300  (PVOID) pContext,
301  TRUE,
302  TRUE,
303  TRUE);
304 
306 
307  IrpSp->MajorFunction = IrpContext->MajorFunction;
308  IrpSp->Parameters.Read.Length = FFSBDL[i].Length;
309  IrpSp->Parameters.Read.ByteOffset.QuadPart = FFSBDL[i].Lba;
310 
311  if (bVerify)
312  {
314  }
315 
316  FFSBDL[i].Irp = Irp;
317  }
318 
319  MasterIrp->AssociatedIrp.IrpCount = Count;
320 
321  if (IrpContext->IsSynchronous)
322  {
323  MasterIrp->AssociatedIrp.IrpCount += 1;
324  }
325 
326  pContext->Length = Length;
327 
328  bBugCheck = TRUE;
329 
330  for (i = 0; i < Count; i++)
331  {
332  Status = IoCallDriver(Vcb->TargetDeviceObject,
333  FFSBDL[i].Irp);
334  }
335 
336  if (IrpContext->IsSynchronous)
337  {
338  KeWaitForSingleObject(&(pContext->Event),
340 
341  KeClearEvent(&(pContext->Event));
342  }
343  }
344 
346  {
347  if (IrpContext->IsSynchronous)
348  {
349  if (MasterIrp)
350  Status = MasterIrp->IoStatus.Status;
351 
352  if (pContext)
353  ExFreePool(pContext);
354 
355  }
356  else
357  {
358  IrpContext->Irp = NULL;
360  }
361 
363  {
364  if (bBugCheck)
365  {
366  FFSBugCheck(FFS_BUGCHK_BLOCK, 0, 0, 0);
367  }
368 
369  for (i = 0; i < Count; i++)
370  {
371  if (FFSBDL[i].Irp != NULL)
372  {
373  if (FFSBDL[i].Irp->MdlAddress != NULL)
374  {
375  IoFreeMdl(FFSBDL[i].Irp->MdlAddress);
376  }
377 
378  IoFreeIrp(FFSBDL[i].Irp);
379  }
380  }
381  }
382  } _SEH2_END;
383 
384  return Status;
385 }
386 
387 
388 NTSTATUS
390  IN PFFS_VCB Vcb,
392  IN ULONG Length,
393  OUT PVOID Buffer,
395 {
396  KEVENT Event;
397  PIRP Irp;
400 
401  PAGED_CODE();
402 
403  ASSERT(Vcb != NULL);
404  ASSERT(Vcb->TargetDeviceObject != NULL);
405  ASSERT(Buffer != NULL);
406 
408 
410  IRP_MJ_READ,
411  Vcb->TargetDeviceObject,
412  Buffer,
413  Length,
415  &Event,
416  &IoStatus);
417 
418  if (!Irp)
419  {
421  }
422 
423  if (bVerify)
424  {
427  }
428 
429  Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
430 
431  if (Status == STATUS_PENDING)
432  {
434  &Event,
435  Suspended,
436  KernelMode,
437  FALSE,
438  NULL);
439 
440  Status = IoStatus.Status;
441  }
442 
443  return Status;
444 }
445 
446 
447 NTSTATUS
449  IN PFFS_VCB Vcb,
451  IN ULONG Size,
452  IN PVOID Buffer,
454 {
456  PUCHAR Buf;
457  ULONG Length;
458  ULONGLONG Lba;
459 
460  PAGED_CODE();
461 
462  Lba = Offset & (~((ULONGLONG)SECTOR_SIZE - 1));
463  Length = (ULONG)(Size + Offset + SECTOR_SIZE - 1 - Lba) &
464  (~((ULONG)SECTOR_SIZE - 1));
465 
467  if (!Buf)
468  {
469  FFSPrint((DBG_ERROR, "FFSReadDisk: no enough memory.\n"));
471 
472  goto errorout;
473  }
474 
476  Lba,
477  Length,
478  Buf,
479  FALSE);
480 
481  if (!NT_SUCCESS(Status))
482  {
483  FFSPrint((DBG_ERROR, "FFSReadDisk: Read Block Device error.\n"));
484 
485  goto errorout;
486  }
487 
488  RtlCopyMemory(Buffer, &Buf[Offset - Lba], Size);
489 
490 errorout:
491 
492  if (Buf)
493  ExFreePool(Buf);
494 
495  return Status;
496 }
497 
498 
499 NTSTATUS
502  IN ULONG IoctlCode,
504  IN ULONG InputBufferSize,
506  IN OUT PULONG OutputBufferSize)
507 {
508  ULONG OutBufferSize = 0;
509  KEVENT Event;
510  PIRP Irp;
513 
514  PAGED_CODE();
515 
517 
518  if (OutputBufferSize)
519  {
520  OutBufferSize = *OutputBufferSize;
521  }
522 
524 
526  IoctlCode,
527  DeviceObject,
528  InputBuffer,
529  InputBufferSize,
530  OutputBuffer,
532  FALSE,
533  &Event,
534  &IoStatus);
535 
536  if (Irp == NULL)
537  {
538  FFSPrint((DBG_ERROR, "FFSDiskIoControl: Building IRQ error!\n"));
540  }
541 
543 
544  if (Status == STATUS_PENDING)
545  {
547  Status = IoStatus.Status;
548  }
549 
550  if (OutputBufferSize)
551  {
552  *OutputBufferSize = (ULONG) IoStatus.Information;
553  }
554 
555  return Status;
556 }
557 
558 
562  IN PIRP Irp,
563  IN PVOID Contxt)
564 {
565  PKEVENT Event = (PKEVENT)Contxt;
566 
567  KeSetEvent(Event, 0, FALSE);
568 
570 
571  return STATUS_SUCCESS;
572 }
573 
574 
576 VOID
578  IN PFFS_IRP_CONTEXT IrpContext,
579  IN PFFS_VCB Vcb,
580  IN BOOLEAN bPrevent)
581 {
582  PIRP Irp;
583  KEVENT Event;
585  PREVENT_MEDIA_REMOVAL Prevent;
587 
588  PAGED_CODE();
589 
591  &Vcb->MainResource,
592  TRUE);
593 
594  if (bPrevent != IsFlagOn(Vcb->Flags, VCB_REMOVAL_PREVENTED))
595  {
596  if (bPrevent)
597  {
599  }
600  else
601  {
603  }
604  }
605 
607  &Vcb->MainResource,
609 
610  Prevent.PreventMediaRemoval = bPrevent;
611 
613 
615  Vcb->TargetDeviceObject,
616  &Prevent,
617  sizeof(PREVENT_MEDIA_REMOVAL),
618  NULL,
619  0,
620  FALSE,
621  NULL,
622  &IoStatus);
623 
624  if (Irp != NULL)
625  {
628  &Event,
629  TRUE,
630  TRUE,
631  TRUE);
632 
633  Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
634 
635  if (Status == STATUS_PENDING)
636  {
638  Executive,
639  KernelMode,
640  FALSE,
641  NULL);
642  }
643  }
644 }
645 
646 
647 NTSTATUS
649  PFFS_VCB Vcb)
650 {
651  PIRP Irp;
652  KEVENT Event;
655 
656  PAGED_CODE();
657 
659 
661  Vcb->TargetDeviceObject,
662  NULL,
663  0,
664  NULL,
665  &Event,
666  &IoStatus);
667 
668  if (Irp)
669  {
670  Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
671 
672  if (Status == STATUS_PENDING)
673  {
675  Executive,
676  KernelMode,
677  FALSE,
678  NULL);
679 
680  Status = IoStatus.Status;
681  }
682  }
683  else
684  {
685  Status = IoStatus.Status;
686  }
687 
688  return Status;
689 }
signed char * PCHAR
Definition: retypes.h:7
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define IN
Definition: typedefs.h:38
__drv_mustHoldCriticalRegion VOID FFSMediaEjectControl(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN BOOLEAN bPrevent)
Definition: block.c:577
NTSTATUS NTAPI FFSReadWriteBlockAsyncCompletionRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: block.c:173
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _KEVENT * PKEVENT
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define __drv_mustHoldCriticalRegion
Definition: ffsdrv.h:34
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
PFFS_GLOBAL FFSGlobal
Definition: init.c:22
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:1069
#define IRP_MJ_SHUTDOWN
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
unsigned char * PUCHAR
Definition: retypes.h:3
NTSTATUS FFSReadSync(IN PFFS_VCB Vcb, IN ULONGLONG Offset, IN ULONG Length, OUT PVOID Buffer, IN BOOLEAN bVerify)
Definition: block.c:389
LONG NTSTATUS
Definition: precomp.h:26
#define FFSBugCheck(A, B, C, D)
Definition: ffsdrv.h:194
_In_ PIRP _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG OutBufferSize
Definition: classpnp.h:429
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define PAGED_CODE()
Definition: video.h:57
CHAR InputBuffer[80]
Definition: conmgr.c:33
_SEH2_TRY
Definition: create.c:4250
#define FFSBreakPoint()
Definition: ffsdrv.h:43
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
VOID NTAPI IoBuildPartialMdl(IN PMDL SourceMdl, IN PMDL TargetMdl, IN PVOID VirtualAddress, IN ULONG Length)
Definition: iomdl.c:96
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
PIRP MasterIrp
Definition: block.c:25
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
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
long LONG
Definition: pedump.c:60
BOOLEAN Wait
Definition: block.c:27
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
NTSTATUS FFSLockUserBuffer(IN PIRP Irp, IN ULONG Length, IN LOCK_OPERATION Operation)
Definition: block.c:70
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:13
NTSTATUS FFSReadWriteBlocks(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN PFFS_BDL FFSBDL, IN ULONG Length, IN ULONG Count, IN BOOLEAN bVerify)
Definition: block.c:207
#define SL_OVERRIDE_VERIFY_VOLUME
Definition: iotypes.h:1780
Definition: bufpool.h:45
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
PIRP NTAPI IoMakeAssociatedIrp(IN PIRP Irp, IN CCHAR StackSize)
Definition: irp.c:1925
static BOOL bVerify
Definition: verify.c:27
#define FFS_BUGCHK_BLOCK
Definition: ffsdrv.h:168
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
char CCHAR
Definition: typedefs.h:50
uint64_t ULONGLONG
Definition: typedefs.h:65
#define Vcb
Definition: cdprocs.h:1425
struct _FFS_RW_CONTEXT * PFFS_RW_CONTEXT
#define VCB_REMOVAL_PREVENTED
Definition: ext2fs.h:798
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
BOOLEAN PreventMediaRemoval
Definition: ntddstor.h:251
#define InterlockedDecrement
Definition: armddk.h:52
#define DBG_ERROR
Definition: ffsdrv.h:1031
#define FFS_POOL_TAG
Definition: ffsdrv.h:817
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
KEVENT Event
Definition: block.c:26
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
Status
Definition: gdiplustypes.h:24
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
NTSTATUS FFSReadDisk(IN PFFS_VCB Vcb, IN ULONGLONG Offset, IN ULONG Size, IN PVOID Buffer, IN BOOLEAN bVerify)
Definition: block.c:448
_SEH2_END
Definition: create.c:4424
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:935
enum _LOCK_OPERATION LOCK_OPERATION
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
_SEH2_FINALLY
Definition: create.c:4395
unsigned int * PULONG
Definition: retypes.h:1
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define IRP_MJ_READ
Definition: rdpdr.c:46
struct _FFS_RW_CONTEXT FFS_RW_CONTEXT
NTSTATUS FFSDiskIoControl(IN PDEVICE_OBJECT DeviceObject, IN ULONG IoctlCode, IN PVOID InputBuffer, IN ULONG InputBufferSize, IN OUT PVOID OutputBuffer, IN OUT PULONG OutputBufferSize)
Definition: block.c:500
NTSTATUS NTAPI FFSMediaEjectControlCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Contxt)
Definition: block.c:560
#define OUT
Definition: typedefs.h:39
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
unsigned int ULONG
Definition: retypes.h:1
#define MmGetSystemAddressForMdl(Mdl)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define SECTOR_SIZE
Definition: fs.h:22
NTSTATUS NTAPI FFSReadWriteBlockSyncCompletionRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: block.c:138
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define IOCTL_DISK_MEDIA_REMOVAL
Definition: cdrw_usr.h:176
#define _SEH2_LEAVE
Definition: filesup.c:20
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
return STATUS_SUCCESS
Definition: btrfs.c:2938
IoMarkIrpPending(Irp)
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2632
NTSTATUS FFSDiskShutDown(PFFS_VCB Vcb)
Definition: block.c:648
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
ULONG Length
Definition: block.c:29
PVOID FFSGetUserBuffer(IN PIRP Irp)
Definition: block.c:115
LONG Blocks
Definition: block.c:28