ReactOS  0.4.14-dev-317-g96040ec
lockctrl.cpp File Reference
#include "udffs.h"
Include dependency graph for lockctrl.cpp:

Go to the source code of this file.

Macros

#define UDF_BUG_CHECK_ID   UDF_FILE_SHUTDOWN
 

Functions

NTSTATUS NTAPI UDFLockControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI UDFCommonLockControl (IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp)
 
BOOLEAN NTAPI UDFFastLock (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, PEPROCESS ProcessId, ULONG Key, BOOLEAN FailImmediately, BOOLEAN ExclusiveLock, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI UDFFastUnlockSingle (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, PEPROCESS ProcessId, ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI UDFFastUnlockAll (IN PFILE_OBJECT FileObject, PEPROCESS ProcessId, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI UDFFastUnlockAllByKey (IN PFILE_OBJECT FileObject, PEPROCESS ProcessId, ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 

Macro Definition Documentation

◆ UDF_BUG_CHECK_ID

#define UDF_BUG_CHECK_ID   UDF_FILE_SHUTDOWN

Definition at line 20 of file lockctrl.cpp.

Function Documentation

◆ UDFCommonLockControl()

NTSTATUS NTAPI UDFCommonLockControl ( IN PtrUDFIrpContext  PtrIrpContext,
IN PIRP  Irp 
)

Definition at line 105 of file lockctrl.cpp.

108 {
111  //IO_STATUS_BLOCK LocalIoStatus;
112 // BOOLEAN CompleteRequest = FALSE;
113  BOOLEAN PostRequest = FALSE;
114  BOOLEAN CanWait = FALSE;
116  BOOLEAN AcquiredFCB = FALSE;
118  PtrUDFFCB Fcb = NULL;
119  PtrUDFCCB Ccb = NULL;
120 
121  UDFPrint(("UDFCommonLockControl\n"));
122 
123  _SEH2_TRY {
124  // First, get a pointer to the current I/O stack location.
126  ASSERT(IrpSp);
127 
130 
131  // Get the FCB and CCB pointers.
132  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
133  ASSERT(Ccb);
134  Fcb = Ccb->Fcb;
135  ASSERT(Fcb);
136  // Validate the sent-in FCB
137  if ( (Fcb->NodeIdentifier.NodeType == UDF_NODE_TYPE_VCB) ||
138  (Fcb->FCBFlags & UDF_FCB_DIRECTORY)) {
139 
140 // CompleteRequest = TRUE;
142  }
143 
144  NtReqFcb = Fcb->NTRequiredFCB;
145  CanWait = ((PtrIrpContext->IrpContextFlags & UDF_IRP_CONTEXT_CAN_BLOCK) ? TRUE : FALSE);
146 
147  // Acquire the FCB resource shared
149  if (!UDFAcquireResourceExclusive(&(NtReqFcb->MainResource), CanWait)) {
150  PostRequest = TRUE;
152  }
153  AcquiredFCB = TRUE;
154 
155  RC = FsRtlProcessFileLock(&(NtReqFcb->FileLock), Irp, NULL);
156 // CompleteRequest = TRUE;
157 
158 try_exit: NOTHING;
159 
160  } _SEH2_FINALLY {
161 
162  // Release the FCB resources if acquired.
163  if (AcquiredFCB) {
165  UDFReleaseResource(&(NtReqFcb->MainResource));
166  AcquiredFCB = FALSE;
167  }
168  if (PostRequest) {
169  // Perform appropriate post related processing here
170  RC = UDFPostRequest(PtrIrpContext, Irp);
171  } else
173  // Simply free up the IrpContext since the IRP has been queued or
174  // Completed by FsRtlProcessFileLock
175  UDFReleaseIrpContext(PtrIrpContext);
176  }
177  } _SEH2_END; // end of "__finally" processing
178 
179  return(RC);
180 } // end UDFCommonLockControl()
#define UDFAcquireResourceExclusive(Resource, CanWait)
Definition: env_spec_w32.h:656
VOID UDFReleaseIrpContext(PtrUDFIrpContext PtrIrpContext)
Definition: misc.cpp:1086
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
struct _UDFContextControlBlock * PtrUDFCCB
struct _FCB::@710::@713 Fcb
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define UDF_NODE_TYPE_VCB
Definition: struct.h:61
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
LONG NTSTATUS
Definition: precomp.h:26
#define UDF_IRP_CONTEXT_CAN_BLOCK
Definition: struct.h:385
_SEH2_TRY
Definition: create.c:4250
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:13
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define STATUS_PENDING
Definition: ntstatus.h:82
#define try_return(S)
Definition: cdprocs.h:2189
#define UDF_FCB_DIRECTORY
Definition: struct.h:303
* PFILE_OBJECT
Definition: iotypes.h:1955
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define NtReqFcb
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define NOTHING
Definition: env_spec_w32.h:461
NTSTATUS NTAPI FsRtlProcessFileLock(IN PFILE_LOCK FileLock, IN PIRP Irp, IN PVOID Context OPTIONAL)
Definition: filelock.c:1153
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
NTSTATUS UDFPostRequest(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp)
Definition: misc.cpp:1128
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
_SEH2_END
Definition: create.c:4424
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define UDF_CHECK_PAGING_IO_RESOURCE(NTReqFCB)
Definition: udffs.h:262
_SEH2_FINALLY
Definition: create.c:4395
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by UDFLockControl().

◆ UDFFastLock()

BOOLEAN NTAPI UDFFastLock ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN PLARGE_INTEGER  Length,
PEPROCESS  ProcessId,
ULONG  Key,
BOOLEAN  FailImmediately,
BOOLEAN  ExclusiveLock,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject 
)

Definition at line 205 of file lockctrl.cpp.

216 {
217  BOOLEAN Results = FALSE;
218 
219 // BOOLEAN AcquiredFCB = FALSE;
220  PtrUDFFCB Fcb = NULL;
221  PtrUDFCCB Ccb = NULL;
222 
223  UDFPrint(("UDFFastLock\n"));
224  // Decode the type of file object we're being asked to process and make
225  // sure it is only a user file open.
226 
227 
228  // Get the FCB and CCB pointers.
229  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
230  ASSERT(Ccb);
231  Fcb = Ccb->Fcb;
232  ASSERT(Fcb);
233  // Validate the sent-in FCB
234  if ( (Fcb->NodeIdentifier.NodeType == UDF_NODE_TYPE_VCB) ||
235  (Fcb->FCBFlags & UDF_FCB_DIRECTORY)) {
236 
238  IoStatus->Information = 0;
239  return TRUE;
240  }
241 
242  // Acquire exclusive access to the Fcb this operation can always wait
243 
245 
246  // BUGBUG: kenr
247  // (VOID) ExAcquireResourceShared( Fcb->Header.Resource, TRUE );
248 
249  _SEH2_TRY {
250 
251  // We check whether we can proceed
252  // based on the state of the file oplocks.
253 
254  // Now call the FsRtl routine to do the actual processing of the
255  // Lock request
256  if ((Results = FsRtlFastLock( &(Fcb->NTRequiredFCB->FileLock),
257  FileObject,
258  FileOffset,
259  Length,
260  ProcessId,
261  Key,
264  IoStatus,
265  NULL,
266  FALSE ))) {
267 
268  // Set the flag indicating if Fast I/O is possible
269  Fcb->NTRequiredFCB->CommonFCBHeader.IsFastIoPossible = UDFIsFastIoPossible(Fcb);
270  }
271 
272 //try_exit: NOTHING;
273  } _SEH2_FINALLY {
274 
275  // Release the Fcb, and return to our caller
276 
277  // BUGBUG: kenr
278  // UDFReleaseResource( (Fcb)->Header.Resource );
279 
281 
282  } _SEH2_END;
283 
284  return Results;
285 } // end UDFFastLock()
FILE_LOCK FileLock
Definition: fatstruc.h:1070
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
struct _UDFContextControlBlock * PtrUDFCCB
#define FsRtlEnterFileSystem
struct _FCB::@710::@713 Fcb
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define UDF_NODE_TYPE_VCB
Definition: struct.h:61
_SEH2_TRY
Definition: create.c:4250
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN FailImmediately
Definition: fatprocs.h:2697
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define UDF_FCB_DIRECTORY
Definition: struct.h:303
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
FAST_IO_POSSIBLE NTAPI UDFIsFastIoPossible(IN PtrUDFFCB Fcb)
Definition: fastio.cpp:118
_SEH2_END
Definition: create.c:4424
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
_SEH2_FINALLY
Definition: create.c:4395
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN BOOLEAN ExclusiveLock
Definition: fatprocs.h:2697
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FsRtlFastLock(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)
Definition: fsrtlfuncs.h:1581

Referenced by UDFInitializeFunctionPointers().

◆ UDFFastUnlockAll()

BOOLEAN NTAPI UDFFastUnlockAll ( IN PFILE_OBJECT  FileObject,
PEPROCESS  ProcessId,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject 
)

Definition at line 404 of file lockctrl.cpp.

411 {
412  BOOLEAN Results = FALSE;
413 
414 // BOOLEAN AcquiredFCB = FALSE;
415  PtrUDFFCB Fcb = NULL;
416  PtrUDFCCB Ccb = NULL;
417 
418  UDFPrint(("UDFFastUnlockAll\n"));
419 
420  IoStatus->Information = 0;
421  // Decode the type of file object we're being asked to process and make
422  // sure it is only a user file open.
423 
424  // Get the FCB and CCB pointers.
425  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
426  ASSERT(Ccb);
427  Fcb = Ccb->Fcb;
428  ASSERT(Fcb);
429  // Validate the sent-in FCB
430  if ( (Fcb->NodeIdentifier.NodeType == UDF_NODE_TYPE_VCB) ||
431  (Fcb->FCBFlags & UDF_FCB_DIRECTORY)) {
432 
434  return TRUE;
435  }
436 
437  // Acquire shared access to the Fcb this operation can always wait
438 
440 
441  UDF_CHECK_PAGING_IO_RESOURCE(Fcb->NTRequiredFCB);
442  UDFAcquireResourceShared( &(Fcb->NTRequiredFCB->MainResource),TRUE );
443 
444  _SEH2_TRY {
445 
446  // We check whether we can proceed
447  // based on the state of the file oplocks.
448 
449  // Now call the FsRtl routine to do the actual processing of the
450  // Lock request
451  Results = TRUE;
452  IoStatus->Status = FsRtlFastUnlockAll( &(Fcb->NTRequiredFCB->FileLock),
453  FileObject,
454  ProcessId,
455  NULL );
456 
457  // Set the flag indicating if Fast I/O is questionable
458 
459  Fcb->NTRequiredFCB->CommonFCBHeader.IsFastIoPossible = UDFIsFastIoPossible( Fcb );
460 
461 //try_exit: NOTHING;
462  } _SEH2_FINALLY {
463 
464  // Release the Fcb, and return to our caller
465 
466  UDF_CHECK_PAGING_IO_RESOURCE(Fcb->NTRequiredFCB);
467  UDFReleaseResource(&(Fcb->NTRequiredFCB->MainResource));
469 
470  } _SEH2_END;
471 
472  return Results;
473 } // end UDFFastUnlockAll()
FILE_LOCK FileLock
Definition: fatstruc.h:1070
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
struct _UDFContextControlBlock * PtrUDFCCB
#define FsRtlEnterFileSystem
struct _FCB::@710::@713 Fcb
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define UDF_NODE_TYPE_VCB
Definition: struct.h:61
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
_SEH2_TRY
Definition: create.c:4250
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define UDF_FCB_DIRECTORY
Definition: struct.h:303
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
NTSTATUS NTAPI FsRtlFastUnlockAll(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN PVOID Context OPTIONAL)
Definition: filelock.c:1026
#define UDFAcquireResourceShared(Resource, CanWait)
Definition: env_spec_w32.h:658
ERESOURCE MainResource
Definition: ntfs.h:524
FAST_IO_POSSIBLE NTAPI UDFIsFastIoPossible(IN PtrUDFFCB Fcb)
Definition: fastio.cpp:118
_SEH2_END
Definition: create.c:4424
#define UDF_CHECK_PAGING_IO_RESOURCE(NTReqFCB)
Definition: udffs.h:262
_SEH2_FINALLY
Definition: create.c:4395
_In_ PFCB Fcb
Definition: cdprocs.h:151

Referenced by UDFInitializeFunctionPointers().

◆ UDFFastUnlockAllByKey()

BOOLEAN NTAPI UDFFastUnlockAllByKey ( IN PFILE_OBJECT  FileObject,
PEPROCESS  ProcessId,
ULONG  Key,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject 
)

Definition at line 494 of file lockctrl.cpp.

502 {
503  BOOLEAN Results = FALSE;
504 
505 // BOOLEAN AcquiredFCB = FALSE;
506  PtrUDFFCB Fcb = NULL;
507  PtrUDFCCB Ccb = NULL;
508 
509  UDFPrint(("UDFFastUnlockAllByKey\n"));
510 
511  IoStatus->Information = 0;
512  // Decode the type of file object we're being asked to process and make
513  // sure it is only a user file open.
514 
515  // Get the FCB and CCB pointers.
516  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
517  ASSERT(Ccb);
518  Fcb = Ccb->Fcb;
519  ASSERT(Fcb);
520  // Validate the sent-in FCB
521  if ( (Fcb->NodeIdentifier.NodeType == UDF_NODE_TYPE_VCB) ||
522  (Fcb->FCBFlags & UDF_FCB_DIRECTORY)) {
523 
525  return TRUE;
526  }
527 
528  // Acquire shared access to the Fcb this operation can always wait
529 
531 
532  UDF_CHECK_PAGING_IO_RESOURCE(Fcb->NTRequiredFCB);
533  UDFAcquireResourceShared( &(Fcb->NTRequiredFCB->MainResource),TRUE );
534 
535  _SEH2_TRY {
536 
537  // We check whether we can proceed
538  // based on the state of the file oplocks.
539 
540  // Now call the FsRtl routine to do the actual processing of the
541  // Lock request
542  Results = TRUE;
543  IoStatus->Status = FsRtlFastUnlockAllByKey( &(Fcb->NTRequiredFCB->FileLock),
544  FileObject,
545  ProcessId,
546  Key,
547  NULL );
548 
549  // Set the flag indicating if Fast I/O is possible
550 
551  Fcb->NTRequiredFCB->CommonFCBHeader.IsFastIoPossible = UDFIsFastIoPossible( Fcb );
552 
553 //try_exit: NOTHING;
554  } _SEH2_FINALLY {
555 
556  // Release the Fcb, and return to our caller
557 
558  UDF_CHECK_PAGING_IO_RESOURCE(Fcb->NTRequiredFCB);
559  UDFReleaseResource(&(Fcb->NTRequiredFCB->MainResource));
561 
562  } _SEH2_END;
563 
564  return Results;
565 } // end UDFFastUnlockAllByKey()
FILE_LOCK FileLock
Definition: fatstruc.h:1070
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
struct _UDFContextControlBlock * PtrUDFCCB
#define FsRtlEnterFileSystem
struct _FCB::@710::@713 Fcb
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define UDF_NODE_TYPE_VCB
Definition: struct.h:61
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
_SEH2_TRY
Definition: create.c:4250
NTSTATUS NTAPI FsRtlFastUnlockAllByKey(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN ULONG Key, IN PVOID Context OPTIONAL)
Definition: filelock.c:1087
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define UDF_FCB_DIRECTORY
Definition: struct.h:303
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define UDFAcquireResourceShared(Resource, CanWait)
Definition: env_spec_w32.h:658
ERESOURCE MainResource
Definition: ntfs.h:524
FAST_IO_POSSIBLE NTAPI UDFIsFastIoPossible(IN PtrUDFFCB Fcb)
Definition: fastio.cpp:118
_SEH2_END
Definition: create.c:4424
#define UDF_CHECK_PAGING_IO_RESOURCE(NTReqFCB)
Definition: udffs.h:262
_SEH2_FINALLY
Definition: create.c:4395
_In_ PFCB Fcb
Definition: cdprocs.h:151

Referenced by UDFInitializeFunctionPointers().

◆ UDFFastUnlockSingle()

BOOLEAN NTAPI UDFFastUnlockSingle ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN PLARGE_INTEGER  Length,
PEPROCESS  ProcessId,
ULONG  Key,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject 
)

Definition at line 309 of file lockctrl.cpp.

319 {
320  BOOLEAN Results = FALSE;
321 
322 // BOOLEAN AcquiredFCB = FALSE;
323  PtrUDFFCB Fcb = NULL;
324  PtrUDFCCB Ccb = NULL;
325 
326  UDFPrint(("UDFFastUnlockSingle\n"));
327  // Decode the type of file object we're being asked to process and make
328  // sure it is only a user file open.
329 
330  IoStatus->Information = 0;
331 
332  // Get the FCB and CCB pointers.
333  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
334  ASSERT(Ccb);
335  Fcb = Ccb->Fcb;
336  ASSERT(Fcb);
337  // Validate the sent-in FCB
338  if ( (Fcb->NodeIdentifier.NodeType == UDF_NODE_TYPE_VCB) ||
339  (Fcb->FCBFlags & UDF_FCB_DIRECTORY)) {
340 
342  return TRUE;
343  }
344 
345  // Acquire exclusive access to the Fcb this operation can always wait
346 
348 
349  // BUGBUG: kenr
350  // (VOID) ExAcquireResourceShared( Fcb->Header.Resource, TRUE );
351 
352  _SEH2_TRY {
353 
354  // We check whether we can proceed
355  // based on the state of the file oplocks.
356 
357  // Now call the FsRtl routine to do the actual processing of the
358  // Lock request
359  Results = TRUE;
360  IoStatus->Status = FsRtlFastUnlockSingle( &(Fcb->NTRequiredFCB->FileLock),
361  FileObject,
362  FileOffset,
363  Length,
364  ProcessId,
365  Key,
366  NULL,
367  FALSE );
368  // Set the flag indicating if Fast I/O is possible
369  Fcb->NTRequiredFCB->CommonFCBHeader.IsFastIoPossible = UDFIsFastIoPossible(Fcb);
370 
371 //try_exit: NOTHING;
372  } _SEH2_FINALLY {
373 
374  // Release the Fcb, and return to our caller
375 
376  // BUGBUG: kenr
377  // UDFReleaseResource( (Fcb)->Header.Resource );
378 
380 
381  } _SEH2_END;
382 
383  return Results;
384 } // end UDFFastUnlockSingle()
FILE_LOCK FileLock
Definition: fatstruc.h:1070
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
struct _UDFContextControlBlock * PtrUDFCCB
#define FsRtlEnterFileSystem
struct _FCB::@710::@713 Fcb
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define UDF_NODE_TYPE_VCB
Definition: struct.h:61
_SEH2_TRY
Definition: create.c:4250
NTSTATUS NTAPI FsRtlFastUnlockSingle(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, IN PVOID Context OPTIONAL, IN BOOLEAN AlreadySynchronized)
Definition: filelock.c:829
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define UDF_FCB_DIRECTORY
Definition: struct.h:303
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
FAST_IO_POSSIBLE NTAPI UDFIsFastIoPossible(IN PtrUDFFCB Fcb)
Definition: fastio.cpp:118
_SEH2_END
Definition: create.c:4424
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
_SEH2_FINALLY
Definition: create.c:4395
_In_ PFCB Fcb
Definition: cdprocs.h:151

Referenced by UDFInitializeFunctionPointers().

◆ UDFLockControl()

NTSTATUS NTAPI UDFLockControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 38 of file lockctrl.cpp.

41 {
43  PtrUDFIrpContext PtrIrpContext = NULL;
44  BOOLEAN AreWeTopLevel = FALSE;
45 
46  UDFPrint(("UDFLockControl\n"));
47 // BrutePoint();
48 
51  ASSERT(Irp);
52 
53  // set the top level context
54  AreWeTopLevel = UDFIsIrpTopLevel(Irp);
55  // Call the common Lock Control routine, with blocking allowed if
56  // synchronous
57  _SEH2_TRY {
58 
59  // get an IRP context structure and issue the request
60  PtrIrpContext = UDFAllocateIrpContext(Irp, DeviceObject);
61  if(PtrIrpContext) {
62  RC = UDFCommonLockControl(PtrIrpContext, Irp);
63  } else {
65  Irp->IoStatus.Status = RC;
66  Irp->IoStatus.Information = 0;
67  // complete the IRP
69  }
70 
72 
73  RC = UDFExceptionHandler(PtrIrpContext, Irp);
74 
76  } _SEH2_END;
77 
78  if (AreWeTopLevel) {
80  }
81 
83 
84  return(RC);
85 } // end UDFLockControl()
PtrUDFIrpContext UDFAllocateIrpContext(PIRP Irp, PDEVICE_OBJECT PtrTargetDeviceObject)
Definition: misc.cpp:985
#define UDFPrint(Args)
Definition: udffs.h:225
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
NTSTATUS NTAPI UDFCommonLockControl(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp)
Definition: lockctrl.cpp:105
VOID UDFLogEvent(NTSTATUS UDFEventLogId, NTSTATUS RC)
Definition: misc.cpp:575
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_TRY
Definition: create.c:4250
#define IO_DISK_INCREMENT
Definition: iotypes.h:568
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:11
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
NTSTATUS UDFExceptionHandler(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: misc.cpp:358
BOOLEAN __fastcall UDFIsIrpTopLevel(PIRP Irp)
Definition: misc.cpp:228
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
long UDFExceptionFilter(PtrUDFIrpContext PtrIrpContext, PEXCEPTION_POINTERS PtrExceptionPointers)
Definition: misc.cpp:265
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define UDF_ERROR_INTERNAL_ERROR
Definition: errmsg.h:71
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by UDFInitializeFunctionPointers().