Author: tkreuzer Date: Sat Dec 22 17:58:53 2012 New Revision: 57971
URL: http://svn.reactos.org/svn/reactos?rev=57971&view=rev Log: [WIN32K] - Move some files to more appropriate locations - Remove an empty file
Added: trunk/reactos/win32ss/gdi/eng/math.c - copied unchanged from r57947, trunk/reactos/win32ss/user/ntuser/misc/math.c trunk/reactos/win32ss/user/ntuser/usrheap.c - copied unchanged from r57947, trunk/reactos/win32ss/user/ntuser/misc/usrheap.c Removed: trunk/reactos/win32ss/user/ntuser/misc/driver.c trunk/reactos/win32ss/user/ntuser/misc/math.c trunk/reactos/win32ss/user/ntuser/misc/usrheap.c Modified: trunk/reactos/win32ss/CMakeLists.txt
Modified: trunk/reactos/win32ss/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/CMakeLists.txt?rev=... ============================================================================== --- trunk/reactos/win32ss/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/win32ss/CMakeLists.txt [iso-8859-1] Sat Dec 22 17:58:53 2012 @@ -70,6 +70,7 @@ gdi/eng/lineto.c gdi/eng/ldevobj.c gdi/eng/mapping.c + gdi/eng/math.c gdi/eng/mem.c gdi/eng/engmisc.c gdi/eng/mouse.c @@ -87,11 +88,9 @@ gdi/eng/xlateobj.c user/ntuser/main.c user/ntuser/misc/file.c - user/ntuser/misc/math.c user/ntuser/misc/rtlstr.c user/ntuser/misc/copy.c user/ntuser/misc/registry.c - user/ntuser/misc/usrheap.c reactx/ntddraw/ddraw.c reactx/ntddraw/dd.c reactx/ntddraw/ddsurf.c @@ -135,6 +134,7 @@ user/ntuser/sysparams.c user/ntuser/timer.c user/ntuser/useratom.c + user/ntuser/usrheap.c user/ntuser/vis.c user/ntuser/windc.c user/ntuser/window.c
Removed: trunk/reactos/win32ss/user/ntuser/misc/driver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/dr... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/misc/driver.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/misc/driver.c (removed) @@ -1,1 +1,0 @@ -
Removed: trunk/reactos/win32ss/user/ntuser/misc/math.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/ma... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/misc/math.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/misc/math.c (removed) @@ -1,73 +1,0 @@ -/* Math functions for i387. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by John C. Bowman bowman@ipp-garching.mpg.de, 1995. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <win32k.h> - -/* - * FIXME: Is there a better algorithm, like FT_MulDiv? - * - * @implemented - */ -INT APIENTRY EngMulDiv( - INT nMultiplicand, - INT nMultiplier, - INT nDivisor) -{ -#if SIZEOF_LONG_LONG >= 8 - long long ret; - - if (!nDivisor) return -1; - - /* We want to deal with a positive divisor to simplify the logic. */ - if (nDivisor < 0) - { - nMultiplicand = - nMultiplicand; - nDivisor = -nDivisor; - } - - /* If the result is positive, we "add" to round. else, we subtract to round. */ - if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) || - ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) ) - ret = (((long long)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor; - else - ret = (((long long)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor; - - if ((ret > 2147483647) || (ret < -2147483647)) return -1; - return ret; -#else - if (!nDivisor) return -1; - - /* We want to deal with a positive divisor to simplify the logic. */ - if (nDivisor < 0) - { - nMultiplicand = - nMultiplicand; - nDivisor = -nDivisor; - } - - /* If the result is positive, we "add" to round. else, we subtract to round. */ - if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) || - ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) ) - return ((nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor; - - return ((nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor; - -#endif -}
Removed: trunk/reactos/win32ss/user/ntuser/misc/usrheap.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/us... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/misc/usrheap.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/misc/usrheap.c (removed) @@ -1,227 +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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <win32k.h> - -#define NDEBUG -#include <debug.h> - - -_Function_class_(RTL_HEAP_COMMIT_ROUTINE) -_IRQL_requires_same_ -static -NTSTATUS -NTAPI -IntUserHeapCommitRoutine( - _In_ PVOID Base, - _Inout_ PVOID *CommitAddress, - _Inout_ PSIZE_T CommitSize) -{ - PPROCESSINFO W32Process; - PW32HEAP_USER_MAPPING Mapping; - PVOID UserBase = NULL; - NTSTATUS Status; - SIZE_T Delta; - PVOID UserCommitAddress; - - W32Process = 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; - } - - /* Apply the commit address offset to the user base address */ - Delta = (SIZE_T) ((ULONG_PTR) (*CommitAddress) - (ULONG_PTR) (Base)); - UserCommitAddress = (PVOID) ((ULONG_PTR) (UserBase) + Delta); - - /* Perform the actual commit */ - Status = ZwAllocateVirtualMemory(NtCurrentProcess(), - &UserCommitAddress, - 0, - CommitSize, - MEM_COMMIT, - PAGE_EXECUTE_READ); - - if (NT_SUCCESS(Status)) - { - /* Determine the address to return */ - Delta = (SIZE_T) ((ULONG_PTR) (UserCommitAddress) - (ULONG_PTR) (UserBase)); - *CommitAddress = (PVOID) ((ULONG_PTR) (Base) + 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 | 1, - NULL, - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - return FALSE; - } - - Status = MmMapViewInSessionSpace(*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; -}