Author: arty
Date: Mon Jul 23 18:50:16 2012
New Revision: 56952
URL:
http://svn.reactos.org/svn/reactos?rev=56952&view=rev
Log:
[FORMATTING]
Removing tabs, no code change.
Modified:
trunk/reactos/ntoskrnl/fsrtl/filelock.c
Modified: trunk/reactos/ntoskrnl/fsrtl/filelock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/filelock.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/filelock.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/filelock.c [iso-8859-1] Mon Jul 23 18:50:16 2012
@@ -65,23 +65,23 @@
static PVOID NTAPI LockAllocate(PRTL_GENERIC_TABLE Table, CLONG Bytes)
{
- PVOID Result;
- Result = ExAllocatePoolWithTag(NonPagedPool, Bytes, 'LTAB');
- DPRINT("LockAllocate(%d) => %p\n", Bytes, Result);
- return Result;
+ PVOID Result;
+ Result = ExAllocatePoolWithTag(NonPagedPool, Bytes, 'LTAB');
+ DPRINT("LockAllocate(%d) => %p\n", Bytes, Result);
+ return Result;
}
static VOID NTAPI LockFree(PRTL_GENERIC_TABLE Table, PVOID Buffer)
{
- DPRINT("LockFree(%p)\n", Buffer);
- ExFreePoolWithTag(Buffer, 'LTAB');
+ DPRINT("LockFree(%p)\n", Buffer);
+ ExFreePoolWithTag(Buffer, 'LTAB');
}
static RTL_GENERIC_COMPARE_RESULTS NTAPI LockCompare
(PRTL_GENERIC_TABLE Table, PVOID PtrA, PVOID PtrB)
{
- PCOMBINED_LOCK_ELEMENT A = PtrA, B = PtrB;
- RTL_GENERIC_COMPARE_RESULTS Result;
+ PCOMBINED_LOCK_ELEMENT A = PtrA, B = PtrB;
+ RTL_GENERIC_COMPARE_RESULTS Result;
#if 0
DPRINT("Starting to compare element %x to element %x\n", PtrA, PtrB);
#endif
@@ -96,22 +96,22 @@
A->Exclusive.FileLock.StartingByte.QuadPart)))
return GenericEqual;
/* Otherwise, key on the starting byte */
- Result =
- (A->Exclusive.FileLock.StartingByte.QuadPart <
- B->Exclusive.FileLock.StartingByte.QuadPart) ? GenericLessThan :
- (A->Exclusive.FileLock.StartingByte.QuadPart >
- B->Exclusive.FileLock.StartingByte.QuadPart) ? GenericGreaterThan :
- GenericEqual;
+ Result =
+ (A->Exclusive.FileLock.StartingByte.QuadPart <
+ B->Exclusive.FileLock.StartingByte.QuadPart) ? GenericLessThan :
+ (A->Exclusive.FileLock.StartingByte.QuadPart >
+ B->Exclusive.FileLock.StartingByte.QuadPart) ? GenericGreaterThan :
+ GenericEqual;
#if 0
- DPRINT("Compare(%x:%x) %x-%x to %x-%x => %d\n",
- A,B,
- A->Exclusive.FileLock.StartingByte.LowPart,
- A->Exclusive.FileLock.EndingByte.LowPart,
- B->Exclusive.FileLock.StartingByte.LowPart,
- B->Exclusive.FileLock.EndingByte.LowPart,
- Result);
+ DPRINT("Compare(%x:%x) %x-%x to %x-%x => %d\n",
+ A,B,
+ A->Exclusive.FileLock.StartingByte.LowPart,
+ A->Exclusive.FileLock.EndingByte.LowPart,
+ B->Exclusive.FileLock.StartingByte.LowPart,
+ B->Exclusive.FileLock.EndingByte.LowPart,
+ Result);
#endif
- return Result;
+ return Result;
}
/* CSQ methods */
@@ -121,24 +121,24 @@
PIRP Irp,
PVOID InsertContext)
{
- PLOCK_INFORMATION LockInfo = CONTAINING_RECORD(Csq, LOCK_INFORMATION, Csq);
- InsertTailList(&LockInfo->CsqList, &Irp->Tail.Overlay.ListEntry);
- return STATUS_SUCCESS;
+ PLOCK_INFORMATION LockInfo = CONTAINING_RECORD(Csq, LOCK_INFORMATION, Csq);
+ InsertTailList(&LockInfo->CsqList, &Irp->Tail.Overlay.ListEntry);
+ return STATUS_SUCCESS;
}
static VOID NTAPI LockRemoveIrp(PIO_CSQ Csq, PIRP Irp)
{
- RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
+ RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
}
static PIRP NTAPI LockPeekNextIrp(PIO_CSQ Csq, PIRP Irp, PVOID PeekContext)
{
- // Context will be a COMBINED_LOCK_ELEMENT. We're looking for a
- // lock that can be acquired, now that the lock matching PeekContext
- // has been removed.
- COMBINED_LOCK_ELEMENT LockElement;
+ // Context will be a COMBINED_LOCK_ELEMENT. We're looking for a
+ // lock that can be acquired, now that the lock matching PeekContext
+ // has been removed.
+ COMBINED_LOCK_ELEMENT LockElement;
PCOMBINED_LOCK_ELEMENT WhereUnlock = PeekContext;
- PLOCK_INFORMATION LockInfo = CONTAINING_RECORD(Csq, LOCK_INFORMATION, Csq);
+ PLOCK_INFORMATION LockInfo = CONTAINING_RECORD(Csq, LOCK_INFORMATION, Csq);
PLIST_ENTRY Following;
DPRINT("PeekNextIrp(IRP %p, Context %p)\n", Irp, PeekContext);
if (!Irp)
@@ -188,30 +188,30 @@
static VOID NTAPI
LockAcquireQueueLock(PIO_CSQ Csq, PKIRQL Irql)
{
- PLOCK_INFORMATION LockInfo = CONTAINING_RECORD(Csq, LOCK_INFORMATION, Csq);
- KeAcquireSpinLock(&LockInfo->CsqLock, Irql);
+ PLOCK_INFORMATION LockInfo = CONTAINING_RECORD(Csq, LOCK_INFORMATION, Csq);
+ KeAcquireSpinLock(&LockInfo->CsqLock, Irql);
}
static VOID NTAPI
LockReleaseQueueLock(PIO_CSQ Csq, KIRQL Irql)
{
- PLOCK_INFORMATION LockInfo = CONTAINING_RECORD(Csq, LOCK_INFORMATION, Csq);
- KeReleaseSpinLock(&LockInfo->CsqLock, Irql);
+ PLOCK_INFORMATION LockInfo = CONTAINING_RECORD(Csq, LOCK_INFORMATION, Csq);
+ KeReleaseSpinLock(&LockInfo->CsqLock, Irql);
}
static VOID NTAPI
LockCompleteCanceledIrp(PIO_CSQ Csq, PIRP Irp)
{
- NTSTATUS Status;
- PLOCK_INFORMATION LockInfo = CONTAINING_RECORD(Csq, LOCK_INFORMATION, Csq);
- DPRINT("Complete cancelled IRP %p Status %x\n", Irp, STATUS_CANCELLED);
- FsRtlCompleteLockIrpReal
- (LockInfo->BelongsTo->CompleteLockIrpRoutine,
- NULL,
- Irp,
- STATUS_CANCELLED,
- &Status,
- NULL);
+ NTSTATUS Status;
+ PLOCK_INFORMATION LockInfo = CONTAINING_RECORD(Csq, LOCK_INFORMATION, Csq);
+ DPRINT("Complete cancelled IRP %p Status %x\n", Irp, STATUS_CANCELLED);
+ FsRtlCompleteLockIrpReal
+ (LockInfo->BelongsTo->CompleteLockIrpRoutine,
+ NULL,
+ Irp,
+ STATUS_CANCELLED,
+ &Status,
+ NULL);
}
VOID
@@ -253,11 +253,11 @@
FsRtlGetNextFileLock(IN PFILE_LOCK FileLock,
IN BOOLEAN Restart)
{
- PCOMBINED_LOCK_ELEMENT Entry;
- if (!FileLock->LockInformation) return NULL;
- Entry = RtlEnumerateGenericTable(FileLock->LockInformation, Restart);
- if (!Entry) return NULL;
- else return &Entry->Exclusive.FileLock;
+ PCOMBINED_LOCK_ELEMENT Entry;
+ if (!FileLock->LockInformation) return NULL;
+ Entry = RtlEnumerateGenericTable(FileLock->LockInformation, Restart);
+ if (!Entry) return NULL;
+ else return &Entry->Exclusive.FileLock;
}
/* This function expands the conflicting range Conflict by removing and reinserting it,
@@ -331,10 +331,10 @@
IN BOOLEAN AlreadySynchronized)
{
NTSTATUS Status;
- COMBINED_LOCK_ELEMENT ToInsert;
- PCOMBINED_LOCK_ELEMENT Conflict;
- PLOCK_INFORMATION LockInfo;
- BOOLEAN InsertedNew;
+ COMBINED_LOCK_ELEMENT ToInsert;
+ PCOMBINED_LOCK_ELEMENT Conflict;
+ PLOCK_INFORMATION LockInfo;
+ BOOLEAN InsertedNew;
DPRINT("FsRtlPrivateLock(%wZ, Offset %08x%08x, Length %08x%08x, Key %x,
FailImmediately %d, Exclusive %d)\n",
&FileObject->FileName,
@@ -368,86 +368,86 @@
/* Initialize the lock, if necessary */
if (!FileLock->LockInformation)
{
- LockInfo = ExAllocatePoolWithTag(NonPagedPool, sizeof(LOCK_INFORMATION),
'FLCK');
- FileLock->LockInformation = LockInfo;
- if (!FileLock) {
+ LockInfo = ExAllocatePoolWithTag(NonPagedPool, sizeof(LOCK_INFORMATION),
'FLCK');
+ FileLock->LockInformation = LockInfo;
+ if (!FileLock) {
IoStatus->Status = STATUS_NO_MEMORY;
- return FALSE;
- }
-
- LockInfo->BelongsTo = FileLock;
+ return FALSE;
+ }
+
+ LockInfo->BelongsTo = FileLock;
InitializeListHead(&LockInfo->SharedLocks);
- RtlInitializeGenericTable
- (&LockInfo->RangeTable,
- LockCompare,
- LockAllocate,
- LockFree,
- NULL);
-
- KeInitializeSpinLock(&LockInfo->CsqLock);
+ RtlInitializeGenericTable
+ (&LockInfo->RangeTable,
+ LockCompare,
+ LockAllocate,
+ LockFree,
+ NULL);
+
+ KeInitializeSpinLock(&LockInfo->CsqLock);
InitializeListHead(&LockInfo->CsqList);
- IoCsqInitializeEx
- (&LockInfo->Csq,
- LockInsertIrpEx,
- LockRemoveIrp,
- LockPeekNextIrp,
- LockAcquireQueueLock,
- LockReleaseQueueLock,
- LockCompleteCanceledIrp);
- }
-
- LockInfo = FileLock->LockInformation;
- ToInsert.Exclusive.FileLock.FileObject = FileObject;
- ToInsert.Exclusive.FileLock.StartingByte = *FileOffset;
- ToInsert.Exclusive.FileLock.EndingByte.QuadPart = FileOffset->QuadPart +
Length->QuadPart;
- ToInsert.Exclusive.FileLock.ProcessId = Process->UniqueProcessId;
- ToInsert.Exclusive.FileLock.Key = Key;
- ToInsert.Exclusive.FileLock.ExclusiveLock = ExclusiveLock;
-
- Conflict = RtlInsertElementGenericTable
- (FileLock->LockInformation,
- &ToInsert,
- sizeof(ToInsert),
- &InsertedNew);
-
- if (Conflict && !InsertedNew)
- {
- if (Conflict->Exclusive.FileLock.ExclusiveLock || ExclusiveLock)
- {
- if (FailImmediately)
- {
- IoStatus->Status = STATUS_FILE_LOCK_CONFLICT;
- if (Irp)
- {
- FsRtlCompleteLockIrpReal
- (FileLock->CompleteLockIrpRoutine,
- Context,
- Irp,
- IoStatus->Status,
- &Status,
- FileObject);
- }
- return FALSE;
- }
- else
- {
- IoStatus->Status = STATUS_PENDING;
- if (Irp)
- {
- IoMarkIrpPending(Irp);
- IoCsqInsertIrpEx
- (&LockInfo->Csq,
- Irp,
- NULL,
- NULL);
- }
- }
- return FALSE;
- }
- else
- {
+ IoCsqInitializeEx
+ (&LockInfo->Csq,
+ LockInsertIrpEx,
+ LockRemoveIrp,
+ LockPeekNextIrp,
+ LockAcquireQueueLock,
+ LockReleaseQueueLock,
+ LockCompleteCanceledIrp);
+ }
+
+ LockInfo = FileLock->LockInformation;
+ ToInsert.Exclusive.FileLock.FileObject = FileObject;
+ ToInsert.Exclusive.FileLock.StartingByte = *FileOffset;
+ ToInsert.Exclusive.FileLock.EndingByte.QuadPart = FileOffset->QuadPart +
Length->QuadPart;
+ ToInsert.Exclusive.FileLock.ProcessId = Process->UniqueProcessId;
+ ToInsert.Exclusive.FileLock.Key = Key;
+ ToInsert.Exclusive.FileLock.ExclusiveLock = ExclusiveLock;
+
+ Conflict = RtlInsertElementGenericTable
+ (FileLock->LockInformation,
+ &ToInsert,
+ sizeof(ToInsert),
+ &InsertedNew);
+
+ if (Conflict && !InsertedNew)
+ {
+ if (Conflict->Exclusive.FileLock.ExclusiveLock || ExclusiveLock)
+ {
+ if (FailImmediately)
+ {
+ IoStatus->Status = STATUS_FILE_LOCK_CONFLICT;
+ if (Irp)
+ {
+ FsRtlCompleteLockIrpReal
+ (FileLock->CompleteLockIrpRoutine,
+ Context,
+ Irp,
+ IoStatus->Status,
+ &Status,
+ FileObject);
+ }
+ return FALSE;
+ }
+ else
+ {
+ IoStatus->Status = STATUS_PENDING;
+ if (Irp)
+ {
+ IoMarkIrpPending(Irp);
+ IoCsqInsertIrpEx
+ (&LockInfo->Csq,
+ Irp,
+ NULL,
+ NULL);
+ }
+ }
+ return FALSE;
+ }
+ else
+ {
ULONG i;
/* We know of at least one lock in range that's shared. We need to
* find out if any more exist and any are exclusive. */
@@ -528,7 +528,7 @@
Conflict->Exclusive.FileLock.EndingByte.HighPart,
Conflict->Exclusive.FileLock.EndingByte.LowPart);
if (!FsRtlpSubsumeSharedLock(FileLock, LockInfo, &ToInsert, Conflict))
- {
+ {
IoStatus->Status = STATUS_NO_MEMORY;
if (Irp)
{
@@ -541,7 +541,7 @@
FileObject);
}
return FALSE;
- }
+ }
IoStatus->Status = STATUS_SUCCESS;
if (Irp)
{
@@ -553,28 +553,28 @@
&Status,
FileObject);
}
- return TRUE;
- }
- }
- else if (!Conflict)
- {
- /* Conflict here is (or would be) the newly inserted element, but we ran
- * out of space probably. */
- IoStatus->Status = STATUS_NO_MEMORY;
- if (Irp)
- {
- FsRtlCompleteLockIrpReal
- (FileLock->CompleteLockIrpRoutine,
- Context,
- Irp,
- IoStatus->Status,
- &Status,
- FileObject);
- }
- return FALSE;
- }
- else
- {
+ return TRUE;
+ }
+ }
+ else if (!Conflict)
+ {
+ /* Conflict here is (or would be) the newly inserted element, but we ran
+ * out of space probably. */
+ IoStatus->Status = STATUS_NO_MEMORY;
+ if (Irp)
+ {
+ FsRtlCompleteLockIrpReal
+ (FileLock->CompleteLockIrpRoutine,
+ Context,
+ Irp,
+ IoStatus->Status,
+ &Status,
+ FileObject);
+ }
+ return FALSE;
+ }
+ else
+ {
DPRINT("Inserted new lock %wZ %08x%08x %08x%08x exclusive %d\n",
&FileObject->FileName,
Conflict->Exclusive.FileLock.StartingByte.HighPart,
@@ -610,23 +610,23 @@
InsertTailList(&LockInfo->SharedLocks,
&NewSharedRange->Entry);
}
- /* Assume all is cool, and lock is set */
- IoStatus->Status = STATUS_SUCCESS;
-
- if (Irp)
- {
- /* Complete the request */
- FsRtlCompleteLockIrpReal(FileLock->CompleteLockIrpRoutine,
- Context,
- Irp,
- IoStatus->Status,
- &Status,
- FileObject);
+ /* Assume all is cool, and lock is set */
+ IoStatus->Status = STATUS_SUCCESS;
+
+ if (Irp)
+ {
+ /* Complete the request */
+ FsRtlCompleteLockIrpReal(FileLock->CompleteLockIrpRoutine,
+ Context,
+ Irp,
+ IoStatus->Status,
+ &Status,
+ FileObject);
- /* Update the status */
- IoStatus->Status = Status;
- }
- }
+ /* Update the status */
+ IoStatus->Status = Status;
+ }
+ }
return TRUE;
}
@@ -640,31 +640,31 @@
IN PIRP Irp)
{
BOOLEAN Result;
- PIO_STACK_LOCATION IoStack = IoGetCurrentIrpStackLocation(Irp);
- COMBINED_LOCK_ELEMENT ToFind;
- PCOMBINED_LOCK_ELEMENT Found;
+ PIO_STACK_LOCATION IoStack = IoGetCurrentIrpStackLocation(Irp);
+ COMBINED_LOCK_ELEMENT ToFind;
+ PCOMBINED_LOCK_ELEMENT Found;
DPRINT("CheckLockForReadAccess(%wZ, Offset %08x%08x, Length %x)\n",
&IoStack->FileObject->FileName,
IoStack->Parameters.Read.ByteOffset.HighPart,
IoStack->Parameters.Read.ByteOffset.LowPart,
IoStack->Parameters.Read.Length);
- if (!FileLock->LockInformation) {
+ if (!FileLock->LockInformation) {
DPRINT("CheckLockForReadAccess(%wZ) => TRUE\n",
&IoStack->FileObject->FileName);
return TRUE;
}
- ToFind.Exclusive.FileLock.StartingByte = IoStack->Parameters.Read.ByteOffset;
- ToFind.Exclusive.FileLock.EndingByte.QuadPart =
- ToFind.Exclusive.FileLock.StartingByte.QuadPart +
- IoStack->Parameters.Read.Length;
- Found = RtlLookupElementGenericTable
- (FileLock->LockInformation,
- &ToFind);
- if (!Found) {
+ ToFind.Exclusive.FileLock.StartingByte = IoStack->Parameters.Read.ByteOffset;
+ ToFind.Exclusive.FileLock.EndingByte.QuadPart =
+ ToFind.Exclusive.FileLock.StartingByte.QuadPart +
+ IoStack->Parameters.Read.Length;
+ Found = RtlLookupElementGenericTable
+ (FileLock->LockInformation,
+ &ToFind);
+ if (!Found) {
DPRINT("CheckLockForReadAccess(%wZ) => TRUE\n",
&IoStack->FileObject->FileName);
return TRUE;
}
- Result = !Found->Exclusive.FileLock.ExclusiveLock ||
- IoStack->Parameters.Read.Key == Found->Exclusive.FileLock.Key;
+ Result = !Found->Exclusive.FileLock.ExclusiveLock ||
+ IoStack->Parameters.Read.Key == Found->Exclusive.FileLock.Key;
DPRINT("CheckLockForReadAccess(%wZ) => %s\n",
&IoStack->FileObject->FileName, Result ? "TRUE" : "FALSE");
return Result;
}
@@ -678,31 +678,31 @@
IN PIRP Irp)
{
BOOLEAN Result;
- PIO_STACK_LOCATION IoStack = IoGetCurrentIrpStackLocation(Irp);
- COMBINED_LOCK_ELEMENT ToFind;
- PCOMBINED_LOCK_ELEMENT Found;
- PEPROCESS Process = Irp->Tail.Overlay.Thread->ThreadsProcess;
+ PIO_STACK_LOCATION IoStack = IoGetCurrentIrpStackLocation(Irp);
+ COMBINED_LOCK_ELEMENT ToFind;
+ PCOMBINED_LOCK_ELEMENT Found;
+ PEPROCESS Process = Irp->Tail.Overlay.Thread->ThreadsProcess;
DPRINT("CheckLockForWriteAccess(%wZ, Offset %08x%08x, Length %x)\n",
&IoStack->FileObject->FileName,
IoStack->Parameters.Write.ByteOffset.HighPart,
IoStack->Parameters.Write.ByteOffset.LowPart,
IoStack->Parameters.Write.Length);
- if (!FileLock->LockInformation) {
+ if (!FileLock->LockInformation) {
DPRINT("CheckLockForWriteAccess(%wZ) => TRUE\n",
&IoStack->FileObject->FileName);
return TRUE;
}
- ToFind.Exclusive.FileLock.StartingByte = IoStack->Parameters.Write.ByteOffset;
- ToFind.Exclusive.FileLock.EndingByte.QuadPart =
- ToFind.Exclusive.FileLock.StartingByte.QuadPart +
- IoStack->Parameters.Write.Length;
- Found = RtlLookupElementGenericTable
- (FileLock->LockInformation,
- &ToFind);
- if (!Found) {
+ ToFind.Exclusive.FileLock.StartingByte = IoStack->Parameters.Write.ByteOffset;
+ ToFind.Exclusive.FileLock.EndingByte.QuadPart =
+ ToFind.Exclusive.FileLock.StartingByte.QuadPart +
+ IoStack->Parameters.Write.Length;
+ Found = RtlLookupElementGenericTable
+ (FileLock->LockInformation,
+ &ToFind);
+ if (!Found) {
DPRINT("CheckLockForWriteAccess(%wZ) => TRUE\n",
&IoStack->FileObject->FileName);
return TRUE;
}
- Result = Process->UniqueProcessId == Found->Exclusive.FileLock.ProcessId;
+ Result = Process->UniqueProcessId == Found->Exclusive.FileLock.ProcessId;
DPRINT("CheckLockForWriteAccess(%wZ) => %s\n",
&IoStack->FileObject->FileName, Result ? "TRUE" : "FALSE");
return Result;
}
@@ -719,9 +719,9 @@
IN PFILE_OBJECT FileObject,
IN PVOID Process)
{
- PEPROCESS EProcess = Process;
- COMBINED_LOCK_ELEMENT ToFind;
- PCOMBINED_LOCK_ELEMENT Found;
+ PEPROCESS EProcess = Process;
+ COMBINED_LOCK_ELEMENT ToFind;
+ PCOMBINED_LOCK_ELEMENT Found;
DPRINT("FsRtlFastCheckLockForRead(%wZ, Offset %08x%08x, Length %08x%08x, Key
%x)\n",
&FileObject->FileName,
FileOffset->HighPart,
@@ -729,16 +729,16 @@
Length->HighPart,
Length->LowPart,
Key);
- ToFind.Exclusive.FileLock.StartingByte = *FileOffset;
- ToFind.Exclusive.FileLock.EndingByte.QuadPart =
- FileOffset->QuadPart + Length->QuadPart;
- if (!FileLock->LockInformation) return TRUE;
- Found = RtlLookupElementGenericTable
- (FileLock->LockInformation,
- &ToFind);
- if (!Found || !Found->Exclusive.FileLock.ExclusiveLock) return TRUE;
- return Found->Exclusive.FileLock.Key == Key &&
- Found->Exclusive.FileLock.ProcessId == EProcess->UniqueProcessId;
+ ToFind.Exclusive.FileLock.StartingByte = *FileOffset;
+ ToFind.Exclusive.FileLock.EndingByte.QuadPart =
+ FileOffset->QuadPart + Length->QuadPart;
+ if (!FileLock->LockInformation) return TRUE;
+ Found = RtlLookupElementGenericTable
+ (FileLock->LockInformation,
+ &ToFind);
+ if (!Found || !Found->Exclusive.FileLock.ExclusiveLock) return TRUE;
+ return Found->Exclusive.FileLock.Key == Key &&
+ Found->Exclusive.FileLock.ProcessId == EProcess->UniqueProcessId;
}
/*
@@ -754,9 +754,9 @@
IN PVOID Process)
{
BOOLEAN Result;
- PEPROCESS EProcess = Process;
- COMBINED_LOCK_ELEMENT ToFind;
- PCOMBINED_LOCK_ELEMENT Found;
+ PEPROCESS EProcess = Process;
+ COMBINED_LOCK_ELEMENT ToFind;
+ PCOMBINED_LOCK_ELEMENT Found;
DPRINT("FsRtlFastCheckLockForWrite(%wZ, Offset %08x%08x, Length %08x%08x, Key
%x)\n",
&FileObject->FileName,
FileOffset->HighPart,
@@ -764,22 +764,22 @@
Length->HighPart,
Length->LowPart,
Key);
- ToFind.Exclusive.FileLock.StartingByte = *FileOffset;
- ToFind.Exclusive.FileLock.EndingByte.QuadPart =
- FileOffset->QuadPart + Length->QuadPart;
- if (!FileLock->LockInformation) {
+ ToFind.Exclusive.FileLock.StartingByte = *FileOffset;
+ ToFind.Exclusive.FileLock.EndingByte.QuadPart =
+ FileOffset->QuadPart + Length->QuadPart;
+ if (!FileLock->LockInformation) {
DPRINT("CheckForWrite(%wZ) => TRUE\n",
&FileObject->FileName);
return TRUE;
}
- Found = RtlLookupElementGenericTable
- (FileLock->LockInformation,
- &ToFind);
- if (!Found) {
+ Found = RtlLookupElementGenericTable
+ (FileLock->LockInformation,
+ &ToFind);
+ if (!Found) {
DPRINT("CheckForWrite(%wZ) => TRUE\n",
&FileObject->FileName);
return TRUE;
}
- Result = Found->Exclusive.FileLock.Key == Key &&
- Found->Exclusive.FileLock.ProcessId == EProcess->UniqueProcessId;
+ Result = Found->Exclusive.FileLock.Key == Key &&
+ Found->Exclusive.FileLock.ProcessId == EProcess->UniqueProcessId;
DPRINT("CheckForWrite(%wZ) => %s\n", &FileObject->FileName,
Result ? "TRUE" : "FALSE");
return Result;
}
@@ -801,10 +801,10 @@
BOOLEAN FoundShared = FALSE;
PLIST_ENTRY SharedEntry;
PLOCK_SHARED_RANGE SharedRange = NULL;
- COMBINED_LOCK_ELEMENT Find;
- PCOMBINED_LOCK_ELEMENT Entry;
- PIRP NextMatchingLockIrp;
- PLOCK_INFORMATION InternalInfo = FileLock->LockInformation;
+ COMBINED_LOCK_ELEMENT Find;
+ PCOMBINED_LOCK_ELEMENT Entry;
+ PIRP NextMatchingLockIrp;
+ PLOCK_INFORMATION InternalInfo = FileLock->LockInformation;
DPRINT("FsRtlFastUnlockSingle(%wZ, Offset %08x%08x, Length %08x%08x, Key
%x)\n",
&FileObject->FileName,
FileOffset->HighPart,
@@ -812,15 +812,15 @@
Length->HighPart,
Length->LowPart,
Key);
- // The region to unlock must correspond exactly to a previously locked region
- // -- msdn
- // But Windows 2003 doesn't assert on it and simply ignores that parameter
- // ASSERT(AlreadySynchronized);
- Find.Exclusive.FileLock.StartingByte = *FileOffset;
- Find.Exclusive.FileLock.EndingByte.QuadPart =
- FileOffset->QuadPart + Length->QuadPart;
- Entry = RtlLookupElementGenericTable(&InternalInfo->RangeTable, &Find);
- if (!Entry) {
+ // The region to unlock must correspond exactly to a previously locked region
+ // -- msdn
+ // But Windows 2003 doesn't assert on it and simply ignores that parameter
+ // ASSERT(AlreadySynchronized);
+ Find.Exclusive.FileLock.StartingByte = *FileOffset;
+ Find.Exclusive.FileLock.EndingByte.QuadPart =
+ FileOffset->QuadPart + Length->QuadPart;
+ Entry = RtlLookupElementGenericTable(&InternalInfo->RangeTable, &Find);
+ if (!Entry) {
DPRINT("Range not locked %wZ\n", &FileObject->FileName);
return STATUS_RANGE_NOT_LOCKED;
}
@@ -916,7 +916,7 @@
}
}
- // this is definitely the thing we want
+ // this is definitely the thing we want
NextMatchingLockIrp = IoCsqRemoveNextIrp(&InternalInfo->Csq, &Find);
while (NextMatchingLockIrp)
{
@@ -930,7 +930,7 @@
}
DPRINT("Success %wZ\n", &FileObject->FileName);
- return STATUS_SUCCESS;
+ return STATUS_SUCCESS;
}
/*
@@ -943,33 +943,33 @@
IN PEPROCESS Process,
IN PVOID Context OPTIONAL)
{
- PCOMBINED_LOCK_ELEMENT Entry;
- PRTL_GENERIC_TABLE InternalInfo = FileLock->LockInformation;
+ PCOMBINED_LOCK_ELEMENT Entry;
+ PRTL_GENERIC_TABLE InternalInfo = FileLock->LockInformation;
DPRINT("FsRtlFastUnlockAll(%wZ)\n", &FileObject->FileName);
- // XXX Synchronize somehow
- if (!FileLock->LockInformation) {
+ // XXX Synchronize somehow
+ if (!FileLock->LockInformation) {
DPRINT("Not locked %wZ\n", &FileObject->FileName);
return STATUS_RANGE_NOT_LOCKED; // no locks
}
- for (Entry = RtlEnumerateGenericTable(InternalInfo, TRUE);
+ for (Entry = RtlEnumerateGenericTable(InternalInfo, TRUE);
Entry;
- Entry = RtlEnumerateGenericTable(InternalInfo, FALSE))
- {
- LARGE_INTEGER Length;
- // We'll take the first one to be the list head, and free the others first...
- Length.QuadPart =
- Entry->Exclusive.FileLock.EndingByte.QuadPart -
- Entry->Exclusive.FileLock.StartingByte.QuadPart;
- FsRtlFastUnlockSingle
- (FileLock,
- Entry->Exclusive.FileLock.FileObject,
- &Entry->Exclusive.FileLock.StartingByte,
- &Length,
- Entry->Exclusive.FileLock.ProcessId,
- Entry->Exclusive.FileLock.Key,
- Context,
- TRUE);
- }
+ Entry = RtlEnumerateGenericTable(InternalInfo, FALSE))
+ {
+ LARGE_INTEGER Length;
+ // We'll take the first one to be the list head, and free the others
first...
+ Length.QuadPart =
+ Entry->Exclusive.FileLock.EndingByte.QuadPart -
+ Entry->Exclusive.FileLock.StartingByte.QuadPart;
+ FsRtlFastUnlockSingle
+ (FileLock,
+ Entry->Exclusive.FileLock.FileObject,
+ &Entry->Exclusive.FileLock.StartingByte,
+ &Length,
+ Entry->Exclusive.FileLock.ProcessId,
+ Entry->Exclusive.FileLock.Key,
+ Context,
+ TRUE);
+ }
DPRINT("Done %wZ\n", &FileObject->FileName);
return STATUS_SUCCESS;
}
@@ -985,36 +985,36 @@
IN ULONG Key,
IN PVOID Context OPTIONAL)
{
- PCOMBINED_LOCK_ELEMENT Entry;
- PLOCK_INFORMATION InternalInfo = FileLock->LockInformation;
+ PCOMBINED_LOCK_ELEMENT Entry;
+ PLOCK_INFORMATION InternalInfo = FileLock->LockInformation;
DPRINT("FsRtlFastUnlockAllByKey(%wZ,Key %x)\n",
&FileObject->FileName, Key);
- // XXX Synchronize somehow
- if (!FileLock->LockInformation) return STATUS_RANGE_NOT_LOCKED; // no locks
- for (Entry = RtlEnumerateGenericTable(&InternalInfo->RangeTable, TRUE);
+ // XXX Synchronize somehow
+ if (!FileLock->LockInformation) return STATUS_RANGE_NOT_LOCKED; // no locks
+ for (Entry = RtlEnumerateGenericTable(&InternalInfo->RangeTable, TRUE);
Entry;
- Entry = RtlEnumerateGenericTable(&InternalInfo->RangeTable, FALSE))
- {
- LARGE_INTEGER Length;
- // We'll take the first one to be the list head, and free the others first...
- Length.QuadPart =
- Entry->Exclusive.FileLock.EndingByte.QuadPart -
- Entry->Exclusive.FileLock.StartingByte.QuadPart;
- if (Entry->Exclusive.FileLock.Key == Key &&
- Entry->Exclusive.FileLock.ProcessId == Process->UniqueProcessId)
- {
- FsRtlFastUnlockSingle
- (FileLock,
- Entry->Exclusive.FileLock.FileObject,
- &Entry->Exclusive.FileLock.StartingByte,
- &Length,
- Entry->Exclusive.FileLock.ProcessId,
- Entry->Exclusive.FileLock.Key,
- Context,
- TRUE);
- }
- }
+ Entry = RtlEnumerateGenericTable(&InternalInfo->RangeTable, FALSE))
+ {
+ LARGE_INTEGER Length;
+ // We'll take the first one to be the list head, and free the others
first...
+ Length.QuadPart =
+ Entry->Exclusive.FileLock.EndingByte.QuadPart -
+ Entry->Exclusive.FileLock.StartingByte.QuadPart;
+ if (Entry->Exclusive.FileLock.Key == Key &&
+ Entry->Exclusive.FileLock.ProcessId == Process->UniqueProcessId)
+ {
+ FsRtlFastUnlockSingle
+ (FileLock,
+ Entry->Exclusive.FileLock.FileObject,
+ &Entry->Exclusive.FileLock.StartingByte,
+ &Length,
+ Entry->Exclusive.FileLock.ProcessId,
+ Entry->Exclusive.FileLock.Key,
+ Context,
+ TRUE);
+ }
+ }
return STATUS_SUCCESS;
}
@@ -1151,8 +1151,8 @@
NTAPI
FsRtlUninitializeFileLock(IN PFILE_LOCK FileLock)
{
- if (FileLock->LockInformation)
- {
+ if (FileLock->LockInformation)
+ {
PIRP Irp;
PLOCK_INFORMATION InternalInfo = FileLock->LockInformation;
PCOMBINED_LOCK_ELEMENT Entry;
@@ -1175,9 +1175,9 @@
{
FsRtlProcessFileLock(FileLock, Irp, NULL);
}
- ExFreePoolWithTag(InternalInfo, 'FLCK');
- FileLock->LockInformation = NULL;
- }
+ ExFreePoolWithTag(InternalInfo, 'FLCK');
+ FileLock->LockInformation = NULL;
+ }
}
/*