[ros-diffs] [mbosma] 23317: Merge 23303

mbosma at svn.reactos.org mbosma at svn.reactos.org
Thu Jul 27 13:32:03 CEST 2006


Author: mbosma
Date: Thu Jul 27 15:32:03 2006
New Revision: 23317

URL: http://svn.reactos.org/svn/reactos?rev=23317&view=rev
Log:
Merge 23303

Modified:
    branches/cache_manager_rewrite/mm/process.c
    branches/cache_manager_rewrite/mm/section.c

Modified: branches/cache_manager_rewrite/mm/process.c
URL: http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/process.c?rev=23317&r1=23316&r2=23317&view=diff
==============================================================================
--- branches/cache_manager_rewrite/mm/process.c (original)
+++ branches/cache_manager_rewrite/mm/process.c Thu Jul 27 15:32:03 2006
@@ -472,7 +472,8 @@
 NTSTATUS
 STDCALL
 MmCreateProcessAddressSpace(IN PEPROCESS Process,
-                            IN PROS_SECTION_OBJECT Section OPTIONAL)
+                            IN PROS_SECTION_OBJECT Section OPTIONAL,
+                            IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL)
 {
     NTSTATUS Status;
     PMADDRESS_SPACE ProcessAddressSpace = (PMADDRESS_SPACE)&Process->VadRoot;
@@ -579,27 +580,37 @@
         /* Determine the image file name and save it to EPROCESS */
         DPRINT("Getting Image name\n");
         FileName = Section->FileObject->FileName;
-        szSrc = (PWCHAR)(FileName.Buffer + (FileName.Length / sizeof(WCHAR)) - 1);
-
-        while(szSrc >= FileName.Buffer)
-        {
-            if(*szSrc == L'\\')
+        szSrc = (PWCHAR)(FileName.Buffer + FileName.Length);
+        while (szSrc >= FileName.Buffer)
+        {
+            /* Make sure this isn't a backslash */
+            if (*--szSrc == OBJ_NAME_PATH_SEPARATOR)
             {
+                /* If so, stop it here */
                 szSrc++;
                 break;
             }
             else
             {
-                szSrc--;
+                /* Otherwise, keep going */
                 lnFName++;
             }
         }
 
         /* Copy the to the process and truncate it to 15 characters if necessary */
-        DPRINT("Copying and truncating\n");
         szDest = Process->ImageFileName;
         lnFName = min(lnFName, sizeof(Process->ImageFileName) - 1);
-        while(lnFName-- > 0) *(szDest++) = (UCHAR)*(szSrc++);
+        while (lnFName--) *szDest++ = (UCHAR)*szSrc++;
+        *szDest = UNICODE_NULL;
+
+        /* Check if caller wants an audit name */
+        if (AuditName)
+        {
+            /* Setup the audit name */
+            SeInitializeProcessAuditName(Section->FileObject,
+                                         FALSE,
+                                         AuditName);
+        }
 
         /* Return status to caller */
         return Status;

Modified: branches/cache_manager_rewrite/mm/section.c
URL: http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/section.c?rev=23317&r1=23316&r2=23317&view=diff
==============================================================================
--- branches/cache_manager_rewrite/mm/section.c (original)
+++ branches/cache_manager_rewrite/mm/section.c Thu Jul 27 15:32:03 2006
@@ -132,6 +132,17 @@
 NTAPI
 MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
                              ULONG Offset);
+
+PFILE_OBJECT
+NTAPI
+MmGetFileObjectForSection(IN PROS_SECTION_OBJECT Section)
+{
+    PAGED_CODE();
+    ASSERT(Section);
+
+    /* Return the file object */
+    return Section->FileObject; // Section->ControlArea->FileObject on NT
+}
 
 /* Note: Mmsp prefix denotes "Memory Manager Section Private". */
 




More information about the Ros-diffs mailing list