- Remove PspGetImagePath and use the new SeLocateProcessImageName instead.

It's still not fully XP-compatible, because it should return the entire name with the \Device\HardDisk0 path, but that is easily fixable by modifying the OB Type info for the device object to also use IopQueryNameFile (TODO).
- Update kernel fun with specifics about Cc-branch dereference bug and re-prioritize an I/O Bug.

svn path=/trunk/; revision=23305
This commit is contained in:
Alex Ionescu 2006-07-27 05:03:03 +00:00
parent 55483dc7f6
commit 29a0553ced
2 changed files with 33 additions and 59 deletions

View file

@ -10,9 +10,9 @@
//
// Io:
// - Fix double-reference in IopCreateFile.
// - See why queueing IRPs and cancelling them causes crashes.
// - Add SEH to some places where it's missing (MDLs, etc) (iofunc).
// - Add a generic Cleanup/Exception Routine (iofunc).
// - See why queueing IRPs and cancelling them causes crashes
// - Add another parameter to IopCleanupFailedIrp.
// - Add Access Checks in IopParseDevice.
// - Add validation checks in IoCreateFile.
@ -28,10 +28,9 @@
// - Generate process cookie for user-more thread.
//
// Ob:
// - Possible bug in deferred deletion under Cc Rewrite branch.
// - Fix bug related to Deferred Loading (don't requeue active work item).
// - Add Directory Lock.
// - Use Object Type Mutex/Lock.
// - Implement handle database if anyone needs it.
//
// Ex:
// - Use pushlocks for handle implementation.

View file

@ -48,59 +48,6 @@ PsReferenceProcessFilePointer(IN PEPROCESS Process,
return Section ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
}
/* FIXME:
* This entire API is messed up because:
* 1) Directly pokes SECTION_OBJECT/FILE_OBJECT without special reffing.
* 2) Ignores SeAuditProcessImageFileName stuff added in XP (and ROS).
* 3) Doesn't use ObQueryNameString.
*/
NTSTATUS
NTAPI
PspGetImagePath(IN PEPROCESS Process,
OUT PUNICODE_STRING DstPath,
IN ULONG ProcessInformationLength)
{
NTSTATUS Status;
ULONG ImagePathLen = 0;
PROS_SECTION_OBJECT Section;
PWSTR SrcBuffer = NULL, DstBuffer = (PWSTR)(DstPath + 1);
Section = (PROS_SECTION_OBJECT)Process->SectionObject;
if ((Section)&& (Section->FileObject))
{
/* FIXME - check for SEC_IMAGE and/or SEC_FILE instead
of relying on FileObject being != NULL? */
SrcBuffer = Section->FileObject->FileName.Buffer;
if (SrcBuffer) ImagePathLen = Section->FileObject->FileName.Length;
}
if (ProcessInformationLength < (sizeof(UNICODE_STRING) +
ImagePathLen +
sizeof(WCHAR)))
{
return STATUS_INFO_LENGTH_MISMATCH;
}
Status = STATUS_SUCCESS;
_SEH_TRY
{
/* copy the string manually, don't use RtlCopyUnicodeString with DstPath! */
DstPath->Length = ImagePathLen;
DstPath->MaximumLength = ImagePathLen + sizeof(WCHAR);
DstPath->Buffer = DstBuffer;
if (ImagePathLen) RtlCopyMemory(DstBuffer, SrcBuffer, ImagePathLen);
DstBuffer[ImagePathLen / sizeof(WCHAR)] = L'\0';
}
_SEH_HANDLE
{
Status = _SEH_GetExceptionCode();
}
_SEH_END;
/* Return status */
return Status;
}
/* PUBLIC FUNCTIONS **********************************************************/
/*
@ -126,6 +73,7 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
(PPROCESS_SESSION_INFORMATION)ProcessInformation;
PVM_COUNTERS VmCounters = (PVM_COUNTERS)ProcessInformation;
PROCESS_DEVICEMAP_INFORMATION DeviceMap;
PUNICODE_STRING ImageName;
ULONG Cookie;
PAGED_CODE();
@ -414,9 +362,36 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
case ProcessImageFileName:
/* Get the image path */
Status = PspGetImagePath(Process,
(PUNICODE_STRING)ProcessInformation,
ProcessInformationLength);
Status = SeLocateProcessImageName(Process, &ImageName);
if (NT_SUCCESS(Status))
{
/* Set return length */
Length = ImageName->MaximumLength +
sizeof(OBJECT_NAME_INFORMATION);
/* Make sure it's large enough */
if (Length <= ProcessInformationLength)
{
/* Enter SEH to protect write */
_SEH_TRY
{
/* Copy it */
RtlMoveMemory(ProcessInformation,
ImageName,
Length);
/* Update pointer */
((PUNICODE_STRING)ProcessInformation)->Buffer =
(PWSTR)((PUNICODE_STRING)ProcessInformation + 1);
}
_SEH_HANDLE
{
/* Get the exception code */
Status = _SEH_GetExceptionCode();
}
_SEH_END;
}
}
break;
/* Per-process security cookie */