Author: ion
Date: Thu Jul 27 09:03:03 2006
New Revision: 23305
URL:
http://svn.reactos.org/svn/reactos?rev=23305&view=rev
Log:
- 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.
Modified:
trunk/reactos/ntoskrnl/KrnlFun.c
trunk/reactos/ntoskrnl/ps/query.c
Modified: trunk/reactos/ntoskrnl/KrnlFun.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/KrnlFun.c?rev=233…
==============================================================================
--- trunk/reactos/ntoskrnl/KrnlFun.c (original)
+++ trunk/reactos/ntoskrnl/KrnlFun.c Thu Jul 27 09:03:03 2006
@@ -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.
Modified: trunk/reactos/ntoskrnl/ps/query.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=23…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/query.c (original)
+++ trunk/reactos/ntoskrnl/ps/query.c Thu Jul 27 09:03:03 2006
@@ -46,59 +46,6 @@
/* Return status */
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 @@
(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 @@
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 */