Index: ntoskrnl/fsrtl/filelock.c =================================================================== --- ntoskrnl/fsrtl/filelock.c (revision 62493) +++ ntoskrnl/fsrtl/filelock.c (working copy) @@ -1028,6 +1028,8 @@ IN PEPROCESS Process, IN PVOID Context OPTIONAL) { + NTSTATUS Status; + PEPROCESS EProcess = NULL; PLIST_ENTRY ListEntry; PCOMBINED_LOCK_ELEMENT Entry; PLOCK_INFORMATION InternalInfo = FileLock->LockInformation; @@ -1046,15 +1048,18 @@ ListEntry = ListEntry->Flink; if (Range->ProcessId != Process->UniqueProcessId) continue; + Status = PsLookupProcessByProcessId(Range->ProcessId, &EProcess); + ASSERT(NT_SUCCESS(Status)); FsRtlFastUnlockSingle (FileLock, FileObject, &Range->Start, &Length, - Range->ProcessId, + EProcess, Range->Key, Context, TRUE); + ObDereferenceObject((PVOID)EProcess); } for (Entry = RtlEnumerateGenericTable(&InternalInfo->RangeTable, TRUE); Entry; @@ -1061,6 +1066,8 @@ Entry = RtlEnumerateGenericTable(&InternalInfo->RangeTable, FALSE)) { LARGE_INTEGER Length; + Status = PsLookupProcessByProcessId(Entry->Exclusive.FileLock.ProcessId, &EProcess); + ASSERT(NT_SUCCESS(Status)); // We'll take the first one to be the list head, and free the others first... Length.QuadPart = Entry->Exclusive.FileLock.EndingByte.QuadPart - @@ -1070,10 +1077,11 @@ Entry->Exclusive.FileLock.FileObject, &Entry->Exclusive.FileLock.StartingByte, &Length, - Entry->Exclusive.FileLock.ProcessId, + EProcess, Entry->Exclusive.FileLock.Key, Context, TRUE); + ObDereferenceObject((PVOID)EProcess); } DPRINT("Done %wZ\n", &FileObject->FileName); return STATUS_SUCCESS; @@ -1090,6 +1098,8 @@ IN ULONG Key, IN PVOID Context OPTIONAL) { + NTSTATUS Status; + PEPROCESS EProcess = NULL; PLIST_ENTRY ListEntry; PCOMBINED_LOCK_ELEMENT Entry; PLOCK_INFORMATION InternalInfo = FileLock->LockInformation; @@ -1108,15 +1118,18 @@ if (Range->ProcessId != Process->UniqueProcessId || Range->Key != Key) continue; + Status = PsLookupProcessByProcessId(Range->ProcessId, &EProcess); + ASSERT(NT_SUCCESS(Status)); FsRtlFastUnlockSingle (FileLock, FileObject, &Range->Start, &Length, - Range->ProcessId, + EProcess, Range->Key, Context, TRUE); + ObDereferenceObject((PVOID)EProcess); } for (Entry = RtlEnumerateGenericTable(&InternalInfo->RangeTable, TRUE); Entry; @@ -1130,15 +1143,18 @@ if (Entry->Exclusive.FileLock.Key == Key && Entry->Exclusive.FileLock.ProcessId == Process->UniqueProcessId) { + Status = PsLookupProcessByProcessId(Entry->Exclusive.FileLock.ProcessId, &EProcess); + ASSERT(NT_SUCCESS(Status)); FsRtlFastUnlockSingle (FileLock, Entry->Exclusive.FileLock.FileObject, &Entry->Exclusive.FileLock.StartingByte, &Length, - Entry->Exclusive.FileLock.ProcessId, + EProcess, Entry->Exclusive.FileLock.Key, Context, TRUE); + ObDereferenceObject((PVOID)EProcess); } }