Author: fireball
Date: Tue Feb 24 14:34:08 2009
New Revision: 39737
URL: http://svn.reactos.org/svn/reactos?rev=39737&view=rev
Log:
- If looking up a long name for a process failed, use short one. This fixes the issue with "System" not being displayed correctly.
- Round up process name length more correctly, as suggested by Evgeniy Boltik.
See issue #4087 for more details.
Modified:
trunk/reactos/ntoskrnl/ex/sysinfo.c
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] Tue Feb 24 14:34:08 2009
@@ -753,7 +753,7 @@
ImageNameLength = 0;
Status = SeLocateProcessImageName(Process, &ProcessImageName);
szSrc = NULL;
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(Status) && (ProcessImageName->Length > 0))
{
szSrc = (PWCHAR)((PCHAR)ProcessImageName->Buffer + ProcessImageName->Length);
/* Loop the file name*/
@@ -777,7 +777,10 @@
}
/* Round up the image name length as NT does */
- ImageNameMaximumLength = ROUND_UP(ImageNameLength, 8);
+ if (ImageNameLength > 0)
+ ImageNameMaximumLength = ROUND_UP(ImageNameLength + sizeof(WCHAR), 8);
+ else
+ ImageNameMaximumLength = 0;
TotalSize += CurrentSize + ImageNameMaximumLength;
Author: fireball
Date: Tue Feb 24 14:06:13 2009
New Revision: 39736
URL: http://svn.reactos.org/svn/reactos?rev=39736&view=rev
Log:
- Fix freed memory usage in SeLocateProcessImageName, spotted by Jan Roeloffzen.
- Use a correct structure member in SeAuditProcessCreationInfo (but it's still the same pointer).
- Rewrite bottom part of the function to better match ReactOS coding style.
See issue #4087 for more details.
Modified:
trunk/reactos/ntoskrnl/se/audit.c
Modified: trunk/reactos/ntoskrnl/se/audit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/audit.c?rev=39…
==============================================================================
--- trunk/reactos/ntoskrnl/se/audit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/se/audit.c [iso-8859-1] Tue Feb 24 14:06:13 2009
@@ -139,7 +139,7 @@
{
/* Set it */
if (InterlockedCompareExchangePointer(&Process->
- SeAuditProcessCreationInfo,
+ SeAuditProcessCreationInfo.ImageFileName,
AuditName,
NULL))
{
@@ -153,29 +153,26 @@
if (!NT_SUCCESS(Status)) return Status;
}
+ /* Get audit info again, now we have it for sure */
+ AuditName = Process->SeAuditProcessCreationInfo.ImageFileName;
+
/* Allocate the output string */
ImageName = ExAllocatePoolWithTag(NonPagedPool,
AuditName->Name.MaximumLength +
sizeof(UNICODE_STRING),
TAG_SEPA);
- if (ImageName)
- {
- /* Make a copy of it */
- RtlCopyMemory(ImageName,
- &AuditName->Name,
- AuditName->Name.MaximumLength + sizeof(UNICODE_STRING));
-
- /* Fix up the buffer */
- ImageName->Buffer = (PWSTR)(ImageName + 1);
-
- /* Return it */
- *ProcessImageName = ImageName;
- }
- else
- {
- /* Otherwise, fail */
- Status = STATUS_NO_MEMORY;
- }
+ if (!ImageName) return STATUS_NO_MEMORY;
+
+ /* Make a copy of it */
+ RtlCopyMemory(ImageName,
+ &AuditName->Name,
+ AuditName->Name.MaximumLength + sizeof(UNICODE_STRING));
+
+ /* Fix up the buffer */
+ ImageName->Buffer = (PWSTR)(ImageName + 1);
+
+ /* Return it */
+ *ProcessImageName = ImageName;
/* Return status */
return Status;