[NTOS:FSRTL]

- FILE_LOCK_INFO::ProcessId is really an EPROCESS pointer, not a process id

svn path=/trunk/; revision=70144
This commit is contained in:
Thomas Faber 2015-11-27 07:49:31 +00:00
parent 5440e3e226
commit d1f13dc28b

View file

@ -418,7 +418,7 @@ FsRtlPrivateLock(IN PFILE_LOCK FileLock,
ToInsert.Exclusive.FileLock.FileObject = FileObject; ToInsert.Exclusive.FileLock.FileObject = FileObject;
ToInsert.Exclusive.FileLock.StartingByte = *FileOffset; ToInsert.Exclusive.FileLock.StartingByte = *FileOffset;
ToInsert.Exclusive.FileLock.EndingByte.QuadPart = FileOffset->QuadPart + Length->QuadPart; ToInsert.Exclusive.FileLock.EndingByte.QuadPart = FileOffset->QuadPart + Length->QuadPart;
ToInsert.Exclusive.FileLock.ProcessId = Process->UniqueProcessId; ToInsert.Exclusive.FileLock.ProcessId = Process;
ToInsert.Exclusive.FileLock.Key = Key; ToInsert.Exclusive.FileLock.Key = Key;
ToInsert.Exclusive.FileLock.ExclusiveLock = ExclusiveLock; ToInsert.Exclusive.FileLock.ExclusiveLock = ExclusiveLock;
@ -643,7 +643,7 @@ FsRtlPrivateLock(IN PFILE_LOCK FileLock,
NewSharedRange->Start = *FileOffset; NewSharedRange->Start = *FileOffset;
NewSharedRange->End.QuadPart = FileOffset->QuadPart + Length->QuadPart; NewSharedRange->End.QuadPart = FileOffset->QuadPart + Length->QuadPart;
NewSharedRange->Key = Key; NewSharedRange->Key = Key;
NewSharedRange->ProcessId = Process->UniqueProcessId; NewSharedRange->ProcessId = Process;
InsertTailList(&LockInfo->SharedLocks, &NewSharedRange->Entry); InsertTailList(&LockInfo->SharedLocks, &NewSharedRange->Entry);
} }
@ -739,7 +739,7 @@ FsRtlCheckLockForWriteAccess(IN PFILE_LOCK FileLock,
DPRINT("CheckLockForWriteAccess(%wZ) => TRUE\n", &IoStack->FileObject->FileName); DPRINT("CheckLockForWriteAccess(%wZ) => TRUE\n", &IoStack->FileObject->FileName);
return TRUE; return TRUE;
} }
Result = Process->UniqueProcessId == Found->Exclusive.FileLock.ProcessId; Result = Process == Found->Exclusive.FileLock.ProcessId;
DPRINT("CheckLockForWriteAccess(%wZ) => %s\n", &IoStack->FileObject->FileName, Result ? "TRUE" : "FALSE"); DPRINT("CheckLockForWriteAccess(%wZ) => %s\n", &IoStack->FileObject->FileName, Result ? "TRUE" : "FALSE");
return Result; return Result;
} }
@ -775,7 +775,7 @@ FsRtlFastCheckLockForRead(IN PFILE_LOCK FileLock,
&ToFind); &ToFind);
if (!Found || !Found->Exclusive.FileLock.ExclusiveLock) return TRUE; if (!Found || !Found->Exclusive.FileLock.ExclusiveLock) return TRUE;
return Found->Exclusive.FileLock.Key == Key && return Found->Exclusive.FileLock.Key == Key &&
Found->Exclusive.FileLock.ProcessId == EProcess->UniqueProcessId; Found->Exclusive.FileLock.ProcessId == EProcess;
} }
/* /*
@ -816,7 +816,7 @@ FsRtlFastCheckLockForWrite(IN PFILE_LOCK FileLock,
return TRUE; return TRUE;
} }
Result = Found->Exclusive.FileLock.Key == Key && Result = Found->Exclusive.FileLock.Key == Key &&
Found->Exclusive.FileLock.ProcessId == EProcess->UniqueProcessId; Found->Exclusive.FileLock.ProcessId == EProcess;
DPRINT("CheckForWrite(%wZ) => %s\n", &FileObject->FileName, Result ? "TRUE" : "FALSE"); DPRINT("CheckForWrite(%wZ) => %s\n", &FileObject->FileName, Result ? "TRUE" : "FALSE");
return Result; return Result;
} }
@ -879,7 +879,7 @@ FsRtlFastUnlockSingle(IN PFILE_LOCK FileLock,
if (Entry->Exclusive.FileLock.ExclusiveLock) if (Entry->Exclusive.FileLock.ExclusiveLock)
{ {
if (Entry->Exclusive.FileLock.Key != Key || if (Entry->Exclusive.FileLock.Key != Key ||
Entry->Exclusive.FileLock.ProcessId != Process->UniqueProcessId || Entry->Exclusive.FileLock.ProcessId != Process ||
Entry->Exclusive.FileLock.StartingByte.QuadPart != FileOffset->QuadPart || Entry->Exclusive.FileLock.StartingByte.QuadPart != FileOffset->QuadPart ||
Entry->Exclusive.FileLock.EndingByte.QuadPart != Entry->Exclusive.FileLock.EndingByte.QuadPart !=
FileOffset->QuadPart + Length->QuadPart) FileOffset->QuadPart + Length->QuadPart)
@ -907,7 +907,7 @@ FsRtlFastUnlockSingle(IN PFILE_LOCK FileLock,
if (SharedRange->Start.QuadPart == FileOffset->QuadPart && if (SharedRange->Start.QuadPart == FileOffset->QuadPart &&
SharedRange->End.QuadPart == FileOffset->QuadPart + Length->QuadPart && SharedRange->End.QuadPart == FileOffset->QuadPart + Length->QuadPart &&
SharedRange->Key == Key && SharedRange->Key == Key &&
SharedRange->ProcessId == Process->UniqueProcessId) SharedRange->ProcessId == Process)
{ {
FoundShared = TRUE; FoundShared = TRUE;
DPRINT("Found shared element to delete %wZ Start %08x%08x End %08x%08x Key %x\n", DPRINT("Found shared element to delete %wZ Start %08x%08x End %08x%08x Key %x\n",
@ -1044,7 +1044,7 @@ FsRtlFastUnlockAll(IN PFILE_LOCK FileLock,
PLOCK_SHARED_RANGE Range = CONTAINING_RECORD(ListEntry, LOCK_SHARED_RANGE, Entry); PLOCK_SHARED_RANGE Range = CONTAINING_RECORD(ListEntry, LOCK_SHARED_RANGE, Entry);
Length.QuadPart = Range->End.QuadPart - Range->Start.QuadPart; Length.QuadPart = Range->End.QuadPart - Range->Start.QuadPart;
ListEntry = ListEntry->Flink; ListEntry = ListEntry->Flink;
if (Range->ProcessId != Process->UniqueProcessId) if (Range->ProcessId != Process)
continue; continue;
FsRtlFastUnlockSingle FsRtlFastUnlockSingle
(FileLock, (FileLock,
@ -1105,7 +1105,7 @@ FsRtlFastUnlockAllByKey(IN PFILE_LOCK FileLock,
LARGE_INTEGER Length; LARGE_INTEGER Length;
Length.QuadPart = Range->End.QuadPart - Range->Start.QuadPart; Length.QuadPart = Range->End.QuadPart - Range->Start.QuadPart;
ListEntry = ListEntry->Flink; ListEntry = ListEntry->Flink;
if (Range->ProcessId != Process->UniqueProcessId || if (Range->ProcessId != Process ||
Range->Key != Key) Range->Key != Key)
continue; continue;
FsRtlFastUnlockSingle FsRtlFastUnlockSingle
@ -1128,7 +1128,7 @@ FsRtlFastUnlockAllByKey(IN PFILE_LOCK FileLock,
Entry->Exclusive.FileLock.EndingByte.QuadPart - Entry->Exclusive.FileLock.EndingByte.QuadPart -
Entry->Exclusive.FileLock.StartingByte.QuadPart; Entry->Exclusive.FileLock.StartingByte.QuadPart;
if (Entry->Exclusive.FileLock.Key == Key && if (Entry->Exclusive.FileLock.Key == Key &&
Entry->Exclusive.FileLock.ProcessId == Process->UniqueProcessId) Entry->Exclusive.FileLock.ProcessId == Process)
{ {
FsRtlFastUnlockSingle FsRtlFastUnlockSingle
(FileLock, (FileLock,