Author: fireball
Date: Wed Aug 26 21:50:18 2009
New Revision: 42947

URL: http://svn.reactos.org/svn/reactos?rev=42947&view=rev
Log:
- Remove unused shared user heap code.

Removed:
    branches/arwinss/reactos/subsystems/win32/win32k/main/usrheap.c
Modified:
    branches/arwinss/reactos/subsystems/win32/win32k/main/init.c
    branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild

Modified: branches/arwinss/reactos/subsystems/win32/win32k/main/init.c
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/main/init.c?rev=42947&r1=42946&r2=42947&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/main/init.c [iso-8859-1] 
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/main/init.c [iso-8859-1] 
Wed Aug 26 21:50:18 2009
@@ -26,8 +26,6 @@
 
 /* GLOBALS *******************************************************************/
 
-HANDLE GlobalUserHeap = NULL;
-PSECTION_OBJECT GlobalUserHeapSection = NULL;
 PGDI_HANDLE_TABLE GdiHandleTable = NULL;
 PSECTION_OBJECT GdiTableSection = NULL;
 LIST_ENTRY GlobalDriverListHead;
@@ -49,11 +47,6 @@
     DPRINT("Win32Process %p, Create %d\n", Win32Process, Create);
     if (Create && !Win32Process)
     {
-        SIZE_T ViewSize = 0;
-        LARGE_INTEGER Offset;
-        PVOID UserBase = NULL;
-        NTSTATUS Status;
-        extern PSECTION_OBJECT GlobalUserHeapSection;
         DPRINT("Creating W32 process PID:%d at IRQ level: %lu\n", 
Process->UniqueProcessId, KeGetCurrentIrql());
 
         /* Allocate one if needed */
@@ -69,28 +62,6 @@
         PsSetProcessWin32Process(Process, Win32Process);
         Win32Process->peProcess = Process;
         /* FIXME - unlock the process */
-
-        /* map the global heap into the process */
-        Offset.QuadPart = 0;
-        Status = MmMapViewOfSection(GlobalUserHeapSection,
-                                    PsGetCurrentProcess(),
-                                    &UserBase,
-                                    0,
-                                    0,
-                                    &Offset,
-                                    &ViewSize,
-                                    ViewUnmap,
-                                    SEC_NO_CHANGE,
-                                    PAGE_EXECUTE_READ);
-        if (!NT_SUCCESS(Status))
-        {
-            DPRINT1("Failed to map the global heap! 0x%x\n", Status);
-            return Status;
-        }
-        Win32Process->HeapMappings.Next = NULL;
-        Win32Process->HeapMappings.KernelMapping = (PVOID)GlobalUserHeap;
-        Win32Process->HeapMappings.UserMapping = UserBase;
-        Win32Process->HeapMappings.Count = 1;
 
         list_init(&Win32Process->Classes);
         Win32Process->handles = alloc_handle_table(Win32Process, 0);
@@ -301,7 +272,6 @@
             PUNICODE_STRING RegistryPath)
 {
     WIN32_CALLOUTS_FPNS CalloutData;
-    PVOID GlobalUserHeapBase = NULL;
 
     DPRINT1("Win32k initialization: DO %p, RegPath %wZ\n", DriverObject,
         RegistryPath);
@@ -345,16 +315,6 @@
     /* Initialize user implementation */
     UserInitialize();
 
-    /* Create global heap */
-    GlobalUserHeap = UserCreateHeap(&GlobalUserHeapSection,
-                                    &GlobalUserHeapBase,
-                                    1 * 1024 * 1024); /* FIXME - 1 MB for 
now... */
-    if (GlobalUserHeap == NULL)
-    {
-        DPRINT1("Failed to initialize the global heap!\n");
-        return STATUS_UNSUCCESSFUL;
-    }
-
     /* Init object directories implementation */
     init_directories();
 

Removed: branches/arwinss/reactos/subsystems/win32/win32k/main/usrheap.c
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/main/usrheap.c?rev=42946&view=auto
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/main/usrheap.c 
[iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/main/usrheap.c (removed)
@@ -1,216 +1,0 @@
-/*
- *  ReactOS W32 Subsystem
- *  Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <win32k.h>
-
-#define NDEBUG
-#include <debug.h>
-
-
-static NTSTATUS APIENTRY
-IntUserHeapCommitRoutine(IN PVOID Base,
-                         IN OUT PVOID *CommitAddress,
-                         IN OUT PSIZE_T CommitSize)
-{
-    PPROCESSINFO W32Process;
-    PW32HEAP_USER_MAPPING Mapping;
-    PVOID UserBase = NULL;
-    NTSTATUS Status;
-    SIZE_T Delta = (SIZE_T)((ULONG_PTR)(*CommitAddress) - (ULONG_PTR)Base);
-
-    W32Process = (PPROCESSINFO)PsGetCurrentProcessWin32Process();
-
-    if (W32Process != NULL)
-    {
-        /* search for the mapping */
-        Mapping = &W32Process->HeapMappings;
-        while (Mapping != NULL)
-        {
-            if (Mapping->KernelMapping == Base)
-            {
-                UserBase = Mapping->UserMapping;
-                break;
-            }
-
-            Mapping = Mapping->Next;
-        }
-
-        ASSERT(UserBase != NULL);
-    }
-    else
-    {
-        SIZE_T ViewSize = 0;
-        LARGE_INTEGER Offset;
-        extern PSECTION_OBJECT GlobalUserHeapSection;
-
-        /* HACK: This needs to be handled during startup only... */
-        ASSERT(Base == (PVOID)GlobalUserHeap);
-
-        /* temporarily map it into user space */
-        Offset.QuadPart = 0;
-        Status = MmMapViewOfSection(GlobalUserHeapSection,
-                                    PsGetCurrentProcess(),
-                                    &UserBase,
-                                    0,
-                                    0,
-                                    &Offset,
-                                    &ViewSize,
-                                    ViewUnmap,
-                                    SEC_NO_CHANGE,
-                                    PAGE_EXECUTE_READ); /* would prefer 
PAGE_READONLY, but thanks to RTL heaps... */
-
-        if (!NT_SUCCESS(Status))
-            return Status;
-    }
-
-    /* commit! */
-    UserBase = (PVOID)((ULONG_PTR)UserBase + Delta);
-
-    Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
-                                     &UserBase,
-                                     0,
-                                     CommitSize,
-                                     MEM_COMMIT,
-                                     PAGE_EXECUTE_READ);
-    if (NT_SUCCESS(Status))
-    {
-        *CommitAddress = (PVOID)((ULONG_PTR)UserBase + Delta);
-    }
-
-    if (W32Process == NULL)
-    {
-        MmUnmapViewOfSection(PsGetCurrentProcess(),
-                             UserBase);
-    }
-
-    return Status;
-}
-
-static PWIN32HEAP
-IntUserHeapCreate(IN PSECTION_OBJECT SectionObject,
-                  IN PVOID *SystemMappedBase,
-                  IN ULONG HeapSize)
-{
-    PVOID MappedView = NULL;
-    LARGE_INTEGER Offset;
-    SIZE_T ViewSize = PAGE_SIZE;
-    RTL_HEAP_PARAMETERS Parameters = {0};
-    PVOID pHeap;
-    NTSTATUS Status;
-
-    Offset.QuadPart = 0;
-
-    /* Commit the first page before creating the heap! */
-    Status = MmMapViewOfSection(SectionObject,
-                                PsGetCurrentProcess(),
-                                &MappedView,
-                                0,
-                                0,
-                                &Offset,
-                                &ViewSize,
-                                ViewUnmap,
-                                SEC_NO_CHANGE,
-                                PAGE_EXECUTE_READ); /* would prefer 
PAGE_READONLY, but thanks to RTL heaps... */
-    if (!NT_SUCCESS(Status))
-        return NULL;
-
-    Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
-                                     &MappedView,
-                                     0,
-                                     &ViewSize,
-                                     MEM_COMMIT,
-                                     PAGE_EXECUTE_READ); /* would prefer 
PAGE_READONLY, but thanks to RTL heaps... */
-
-    MmUnmapViewOfSection(PsGetCurrentProcess(),
-                         MappedView);
-
-    if (!NT_SUCCESS(Status))
-        return NULL;
-
-    /* Create the heap, don't serialize in kmode! The caller is responsible
-       to synchronize the heap! */
-    Parameters.Length = sizeof(Parameters);
-    Parameters.InitialCommit = ViewSize;
-    Parameters.InitialReserve = (SIZE_T)HeapSize;
-    Parameters.CommitRoutine = IntUserHeapCommitRoutine;
-
-    pHeap = RtlCreateHeap(HEAP_ZERO_MEMORY | HEAP_NO_SERIALIZE,
-                          *SystemMappedBase,
-                          (SIZE_T)HeapSize,
-                          ViewSize,
-                          NULL,
-                          &Parameters);
-
-    return pHeap;
-}
-
-PWIN32HEAP
-UserCreateHeap(OUT PSECTION_OBJECT *SectionObject,
-               IN OUT PVOID *SystemBase,
-               IN SIZE_T HeapSize)
-{
-    LARGE_INTEGER SizeHeap;
-    PWIN32HEAP pHeap = NULL;
-    NTSTATUS Status;
-
-    SizeHeap.QuadPart = HeapSize;
-
-    /* create the section and map it into session space */
-    Status = MmCreateSection((PVOID*)SectionObject,
-                             SECTION_ALL_ACCESS,
-                             NULL,
-                             &SizeHeap,
-                             PAGE_EXECUTE_READWRITE, /* would prefer 
PAGE_READWRITE, but thanks to RTL heaps... */
-                             SEC_RESERVE,
-                             NULL,
-                             NULL);
-
-    if (!NT_SUCCESS(Status))
-    {
-        SetLastNtError(Status);
-        return FALSE;
-    }
-
-    Status = MmMapViewInSystemSpace(*SectionObject,
-                                    SystemBase,
-                                    &HeapSize);
-    if (!NT_SUCCESS(Status))
-    {
-        ObDereferenceObject(*SectionObject);
-        *SectionObject = NULL;
-
-        SetLastNtError(Status);
-        return FALSE;
-    }
-
-    /* create the heap */
-    pHeap = IntUserHeapCreate(*SectionObject,
-                              SystemBase,
-                              HeapSize);
-
-    if (pHeap == NULL)
-    {
-        ObDereferenceObject(*SectionObject);
-        *SectionObject = NULL;
-
-        SetLastNtError(STATUS_UNSUCCESSFUL);
-    }
-
-    return pHeap;
-}

Modified: branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild
URL: 
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild?rev=42947&r1=42946&r2=42947&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] 
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] 
Wed Aug 26 21:50:18 2009
@@ -111,7 +111,6 @@
                <file>csr.c</file>
                <file>err.c</file>
                <file>init.c</file>
-               <file>usrheap.c</file>
                <file>cursor.c</file>
                <file>monitor.c</file>
                <file>kbdlayout.c</file>


Reply via email to