ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2009
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
21 participants
496 discussions
Start a n
N
ew thread
[cwittich] 41661: fix formatting
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 28 17:52:27 2009 New Revision: 41661 URL:
http://svn.reactos.org/svn/reactos?rev=41661&view=rev
Log: fix formatting Modified: trunk/reactos/lib/sdk/crt/stdio/popen.c Modified: trunk/reactos/lib/sdk/crt/stdio/popen.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/popen.c?…
============================================================================== --- trunk/reactos/lib/sdk/crt/stdio/popen.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdio/popen.c [iso-8859-1] Sun Jun 28 17:52:27 2009 @@ -1,20 +1,20 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/crt/?????? - * PURPOSE: Unknown - * PROGRAMER: Unknown - * UPDATE HISTORY: - * 25/11/05: Created - */ +* COPYRIGHT: See COPYING in the top level directory +* PROJECT: ReactOS system libraries +* FILE: lib/crt/?????? +* PURPOSE: Unknown +* PROGRAMER: Unknown +* UPDATE HISTORY: +* 25/11/05: Created +*/ #include <precomp.h> #include <tchar.h> #ifdef _UNICODE - #define sT "S" +#define sT "S" #else - #define sT "s" +#define sT "s" #endif #define MK_STR(s) #s @@ -27,104 +27,102 @@ */ FILE *_tpopen (const _TCHAR *cm, const _TCHAR *md) /* program name, pipe mode */ { - _TCHAR *szCmdLine=NULL; - _TCHAR *szComSpec=NULL; - _TCHAR *s; - FILE *pf; - HANDLE hReadPipe, hWritePipe; - BOOL result; - STARTUPINFO StartupInfo; - PROCESS_INFORMATION ProcessInformation; - SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE}; + _TCHAR *szCmdLine=NULL; + _TCHAR *szComSpec=NULL; + _TCHAR *s; + FILE *pf; + HANDLE hReadPipe, hWritePipe; + BOOL result; + STARTUPINFO StartupInfo; + PROCESS_INFORMATION ProcessInformation; + SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE}; - TRACE(MK_STR(_tpopen)"('%"sT"', '%"sT"')\n", cm, md); + TRACE(MK_STR(_tpopen)"('%"sT"', '%"sT"')\n", cm, md); - if (cm == NULL) - return( NULL ); + if (cm == NULL) + return( NULL ); - szComSpec = _tgetenv(_T("COMSPEC")); - if (szComSpec == NULL) - { - szComSpec = _T("cmd.exe"); - } - - s = max(_tcsrchr(szComSpec, '\\'), _tcsrchr(szComSpec, '/')); - if (s == NULL) - s = szComSpec; - else - s++; - - szCmdLine = malloc((_tcslen(s) + 4 + _tcslen(cm) + 1) * sizeof(_TCHAR)); - if (szCmdLine == NULL) - { - return NULL; - } - - _tcscpy(szCmdLine, s); - s = _tcsrchr(szCmdLine, '.'); - if (s) - *s = 0; - _tcscat(szCmdLine, _T(" /C ")); - _tcscat(szCmdLine, cm); - - if ( !CreatePipe(&hReadPipe,&hWritePipe,&sa,1024)) - { - free (szCmdLine); - return NULL; - } - - memset(&StartupInfo, 0, sizeof(STARTUPINFO)); - StartupInfo.cb = sizeof(STARTUPINFO); - - if (*md == 'r' ) { - StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); - StartupInfo.hStdOutput = hWritePipe; - StartupInfo.dwFlags |= STARTF_USESTDHANDLES; - } - else if ( *md == 'w' ) { - StartupInfo.hStdInput = hReadPipe; - StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); - StartupInfo.dwFlags |= STARTF_USESTDHANDLES; - } - - if (StartupInfo.dwFlags & STARTF_USESTDHANDLES) - StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE); - - result = CreateProcess(szComSpec, - szCmdLine, - NULL, - NULL, - TRUE, - 0, - NULL, - NULL, - &StartupInfo, - &ProcessInformation); - free (szCmdLine); - - if (result == FALSE) - { - CloseHandle(hReadPipe); - CloseHandle(hWritePipe); - return NULL; - } - - CloseHandle(ProcessInformation.hThread); - - if ( *md == 'r' ) + szComSpec = _tgetenv(_T("COMSPEC")); + if (szComSpec == NULL) { - pf = _tfdopen(alloc_fd(hReadPipe, split_oflags(_fmode)) , _T("r")); - CloseHandle(hWritePipe); - } - else - { - pf = _tfdopen( alloc_fd(hWritePipe, split_oflags(_fmode)) , _T("w")); - CloseHandle(hReadPipe); + szComSpec = _T("cmd.exe"); } - //pf->_tmpfname = ProcessInformation.hProcess; + s = max(_tcsrchr(szComSpec, '\\'), _tcsrchr(szComSpec, '/')); + if (s == NULL) + s = szComSpec; + else + s++; - return( pf ); + szCmdLine = malloc((_tcslen(s) + 4 + _tcslen(cm) + 1) * sizeof(_TCHAR)); + if (szCmdLine == NULL) + { + return NULL; + } + + _tcscpy(szCmdLine, s); + s = _tcsrchr(szCmdLine, '.'); + if (s) + *s = 0; + _tcscat(szCmdLine, _T(" /C ")); + _tcscat(szCmdLine, cm); + + if ( !CreatePipe(&hReadPipe,&hWritePipe,&sa,1024)) + { + free (szCmdLine); + return NULL; + } + + memset(&StartupInfo, 0, sizeof(STARTUPINFO)); + StartupInfo.cb = sizeof(STARTUPINFO); + + if (*md == 'r' ) { + StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); + StartupInfo.hStdOutput = hWritePipe; + StartupInfo.dwFlags |= STARTF_USESTDHANDLES; + } + else if ( *md == 'w' ) { + StartupInfo.hStdInput = hReadPipe; + StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); + StartupInfo.dwFlags |= STARTF_USESTDHANDLES; + } + + if (StartupInfo.dwFlags & STARTF_USESTDHANDLES) + StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE); + + result = CreateProcess(szComSpec, + szCmdLine, + NULL, + NULL, + TRUE, + 0, + NULL, + NULL, + &StartupInfo, + &ProcessInformation); + free (szCmdLine); + + if (result == FALSE) + { + CloseHandle(hReadPipe); + CloseHandle(hWritePipe); + return NULL; + } + + CloseHandle(ProcessInformation.hThread); + + if ( *md == 'r' ) + { + pf = _tfdopen(alloc_fd(hReadPipe, split_oflags(_fmode)) , _T("r")); + CloseHandle(hWritePipe); + } + else + { + pf = _tfdopen( alloc_fd(hWritePipe, split_oflags(_fmode)) , _T("w")); + CloseHandle(hReadPipe); + } + + return( pf ); } #ifndef _UNICODE @@ -134,12 +132,12 @@ */ int _pclose (FILE *pp) { - TRACE("_pclose(%x)",pp); + TRACE("_pclose(%x)",pp); - fclose(pp); - //if (!TerminateProcess(pp->_tmpfname ,0)) - // return( -1 ); - return( 0 ); + fclose(pp); + //if (!TerminateProcess(pp->_tmpfname ,0)) + // return( -1 ); + return( 0 ); } #endif
15 years, 5 months
1
0
0
0
[dchapyshev] 41660: - Change icon for msiexec to Tango icon
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sun Jun 28 13:21:47 2009 New Revision: 41660 URL:
http://svn.reactos.org/svn/reactos?rev=41660&view=rev
Log: - Change icon for msiexec to Tango icon Modified: trunk/reactos/base/system/msiexec/msiexec.ico Modified: trunk/reactos/base/system/msiexec/msiexec.ico URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/msiexec/msiexe…
============================================================================== Binary files - no diff available.
15 years, 5 months
1
0
0
0
[ros-arm-bringup] 41659: - Create mmsup.c in ReactOS memory manager directory. It hosts misc support functions: - Copy kmap.c here, since it's the very definition of "misc support function" - Copy some exported functions in mm.c which were listed as "misc functions" - Warn that current implementation of MmIsNonPagedSystemAddressValid will kill kittens. - Rename mm.c to mmfault.c, since other than the misc functions now in mmsup.c, it was all routines to handle page/access faults. - Warn that MmI
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Sun Jun 28 11:52:30 2009 New Revision: 41659 URL:
http://svn.reactos.org/svn/reactos?rev=41659&view=rev
Log: - Create mmsup.c in ReactOS memory manager directory. It hosts misc support functions: - Copy kmap.c here, since it's the very definition of "misc support function" - Copy some exported functions in mm.c which were listed as "misc functions" - Warn that current implementation of MmIsNonPagedSystemAddressValid will kill kittens. - Rename mm.c to mmfault.c, since other than the misc functions now in mmsup.c, it was all routines to handle page/access faults. - Warn that MmIsAddressValid, as currently implemented, kills puppies. - Move WriteWatch functions to virtual.c since they're part of the Virtual API system call set already hosted there. - Move the global variables that people had been throwing in here to mminit.c, which is slightly more appropriate. - Move wset.c's MmTrimUserMemory to balance.c, since that's where all other similar functions are located. - Incidentally, kill wset.c, as this was the only function present. - No functional changes, just refactoring and cleanup (other than warning the critter murder the two broken functions will achieve if called). Added: trunk/reactos/ntoskrnl/mm/mmfault.c - copied, changed from r41647, trunk/reactos/ntoskrnl/mm/mm.c trunk/reactos/ntoskrnl/mm/mmsup.c (with props) Removed: trunk/reactos/ntoskrnl/mm/kmap.c trunk/reactos/ntoskrnl/mm/mm.c trunk/reactos/ntoskrnl/mm/wset.c Modified: trunk/reactos/ntoskrnl/mm/balance.c trunk/reactos/ntoskrnl/mm/mminit.c trunk/reactos/ntoskrnl/mm/virtual.c trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild Modified: trunk/reactos/ntoskrnl/mm/balance.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/balance.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] Sun Jun 28 11:52:30 2009 @@ -161,6 +161,38 @@ { MiMemoryConsumers[Consumer].Trim(Target, 0, &NrFreedPages); } +} + +NTSTATUS +MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages) +{ + PFN_TYPE CurrentPage; + PFN_TYPE NextPage; + NTSTATUS Status; + + (*NrFreedPages) = 0; + + CurrentPage = MmGetLRUFirstUserPage(); + while (CurrentPage != 0 && Target > 0) + { + NextPage = MmGetLRUNextUserPage(CurrentPage); + + Status = MmPageOutPhysicalAddress(CurrentPage); + if (NT_SUCCESS(Status)) + { + DPRINT("Succeeded\n"); + Target--; + (*NrFreedPages)++; + } + else if (Status == STATUS_PAGEFILE_QUOTA) + { + MmRemoveLRUUserPage(CurrentPage); + MmInsertLRULastUserPage(CurrentPage); + } + + CurrentPage = NextPage; + } + return(STATUS_SUCCESS); } VOID Removed: trunk/reactos/ntoskrnl/mm/kmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/kmap.c?rev=416…
============================================================================== --- trunk/reactos/ntoskrnl/mm/kmap.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/kmap.c (removed) @@ -1,58 +1,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/mm/kmap.c - * PURPOSE: Implements the kernel memory pool - * - * PROGRAMMERS: David Welch (welch(a)cwcom.net) - */ - -/* INCLUDES ****************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <debug.h> - -/* GLOBALS *****************************************************************/ - -/* FUNCTIONS ***************************************************************/ - -NTSTATUS -NTAPI -MiZeroPage(PFN_TYPE Page) -{ - KIRQL Irql; - PVOID TempAddress; - - Irql = KeRaiseIrqlToDpcLevel(); - TempAddress = MiMapPageToZeroInHyperSpace(Page); - if (TempAddress == NULL) - { - return(STATUS_NO_MEMORY); - } - memset(TempAddress, 0, PAGE_SIZE); - MiUnmapPagesInZeroSpace(TempAddress, 1); - KeLowerIrql(Irql); - return(STATUS_SUCCESS); -} - -NTSTATUS -NTAPI -MiCopyFromUserPage(PFN_TYPE DestPage, PVOID SourceAddress) -{ - PEPROCESS Process; - KIRQL Irql; - PVOID TempAddress; - - Process = PsGetCurrentProcess(); - TempAddress = MiMapPageInHyperSpace(Process, DestPage, &Irql); - if (TempAddress == NULL) - { - return(STATUS_NO_MEMORY); - } - memcpy(TempAddress, SourceAddress, PAGE_SIZE); - MiUnmapPageInHyperSpace(Process, TempAddress, Irql); - return(STATUS_SUCCESS); -} - -/* EOF */ Removed: trunk/reactos/ntoskrnl/mm/mm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mm.c?rev=41658…
============================================================================== --- trunk/reactos/ntoskrnl/mm/mm.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/mm.c (removed) @@ -1,491 +1,0 @@ -/* - * COPYRIGHT: See COPYING in the top directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/mm/mm.c - * PURPOSE: Kernel memory managment functions - * PROGRAMMERS: David Welch (welch(a)cwcom.net) - */ - -/* INCLUDES *****************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <debug.h> - -/* GLOBALS *****************************************************************/ - -ULONG MmUserProbeAddress = 0; -PVOID MmHighestUserAddress = NULL; -PBOOLEAN Mm64BitPhysicalAddress = FALSE; -PVOID MmSystemRangeStart = NULL; -ULONG MmReadClusterSize; - -MM_STATS MmStats; - -PMMSUPPORT MmKernelAddressSpace; - -/* FUNCTIONS ****************************************************************/ - -VOID -FASTCALL -MiSyncForProcessAttach(IN PKTHREAD Thread, - IN PEPROCESS Process) -{ - PETHREAD Ethread = CONTAINING_RECORD(Thread, ETHREAD, Tcb); - - /* Hack Sync because Mm is broken */ - MmUpdatePageDir(Process, Ethread, sizeof(ETHREAD)); - MmUpdatePageDir(Process, Ethread->ThreadsProcess, sizeof(EPROCESS)); - MmUpdatePageDir(Process, - (PVOID)Thread->StackLimit, - Thread->LargeStack ? - KERNEL_LARGE_STACK_SIZE : KERNEL_STACK_SIZE); -} - -VOID -FASTCALL -MiSyncForContextSwitch(IN PKTHREAD Thread) -{ - PVOID Process = PsGetCurrentProcess(); - PETHREAD Ethread = CONTAINING_RECORD(Thread, ETHREAD, Tcb); - - /* Hack Sync because Mm is broken */ - MmUpdatePageDir(Process, Ethread->ThreadsProcess, sizeof(EPROCESS)); - MmUpdatePageDir(Process, - (PVOID)Thread->StackLimit, - Thread->LargeStack ? - KERNEL_LARGE_STACK_SIZE : KERNEL_STACK_SIZE); -} - -/* - * @implemented - */ -BOOLEAN NTAPI MmIsNonPagedSystemAddressValid(PVOID VirtualAddress) -{ - return MmIsAddressValid(VirtualAddress); -} - -/* - * @implemented - */ -BOOLEAN NTAPI MmIsAddressValid(PVOID VirtualAddress) -/* - * FUNCTION: Checks whether the given address is valid for a read or write - * ARGUMENTS: - * VirtualAddress = address to check - * RETURNS: True if the access would be valid - * False if the access would cause a page fault - * NOTES: This function checks whether a byte access to the page would - * succeed. Is this realistic for RISC processors which don't - * allow byte granular access? - */ -{ - MEMORY_AREA* MemoryArea; - PMMSUPPORT AddressSpace; - - if (VirtualAddress >= MmSystemRangeStart) - { - AddressSpace = MmGetKernelAddressSpace(); - } - else - { - AddressSpace = &PsGetCurrentProcess()->Vm; - } - - MmLockAddressSpace(AddressSpace); - MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, - VirtualAddress); - - if (MemoryArea == NULL || MemoryArea->DeleteInProgress) - { - MmUnlockAddressSpace(AddressSpace); - return(FALSE); - } - MmUnlockAddressSpace(AddressSpace); - return(TRUE); -} - -NTSTATUS -NTAPI -MmpAccessFault(KPROCESSOR_MODE Mode, - ULONG_PTR Address, - BOOLEAN FromMdl) -{ - PMMSUPPORT AddressSpace; - MEMORY_AREA* MemoryArea; - NTSTATUS Status; - BOOLEAN Locked = FromMdl; - - DPRINT("MmAccessFault(Mode %d, Address %x)\n", Mode, Address); - - if (KeGetCurrentIrql() >= DISPATCH_LEVEL) - { - DPRINT1("Page fault at high IRQL was %d\n", KeGetCurrentIrql()); - return(STATUS_UNSUCCESSFUL); - } - if (PsGetCurrentProcess() == NULL) - { - DPRINT("No current process\n"); - return(STATUS_UNSUCCESSFUL); - } - - /* - * Find the memory area for the faulting address - */ - if (Address >= (ULONG_PTR)MmSystemRangeStart) - { - /* - * Check permissions - */ - if (Mode != KernelMode) - { - DPRINT1("MmAccessFault(Mode %d, Address %x)\n", Mode, Address); - return(STATUS_ACCESS_VIOLATION); - } - AddressSpace = MmGetKernelAddressSpace(); - } - else - { - AddressSpace = &PsGetCurrentProcess()->Vm; - } - - if (!FromMdl) - { - MmLockAddressSpace(AddressSpace); - } - do - { - MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, (PVOID)Address); - if (MemoryArea == NULL || MemoryArea->DeleteInProgress) - { - if (!FromMdl) - { - MmUnlockAddressSpace(AddressSpace); - } - return (STATUS_ACCESS_VIOLATION); - } - - switch (MemoryArea->Type) - { - case MEMORY_AREA_SYSTEM: - Status = STATUS_ACCESS_VIOLATION; - break; - - case MEMORY_AREA_PAGED_POOL: - Status = STATUS_SUCCESS; - break; - - case MEMORY_AREA_SECTION_VIEW: - Status = MmAccessFaultSectionView(AddressSpace, - MemoryArea, - (PVOID)Address, - Locked); - break; - - case MEMORY_AREA_VIRTUAL_MEMORY: - Status = STATUS_ACCESS_VIOLATION; - break; - - case MEMORY_AREA_SHARED_DATA: - Status = STATUS_ACCESS_VIOLATION; - break; - - default: - Status = STATUS_ACCESS_VIOLATION; - break; - } - } - while (Status == STATUS_MM_RESTART_OPERATION); - - DPRINT("Completed page fault handling\n"); - if (!FromMdl) - { - MmUnlockAddressSpace(AddressSpace); - } - return(Status); -} - -NTSTATUS -NTAPI -MmNotPresentFault(KPROCESSOR_MODE Mode, - ULONG_PTR Address, - BOOLEAN FromMdl) -{ - PMMSUPPORT AddressSpace; - MEMORY_AREA* MemoryArea; - NTSTATUS Status; - BOOLEAN Locked = FromMdl; - PFN_TYPE Pfn; - - DPRINT("MmNotPresentFault(Mode %d, Address %x)\n", Mode, Address); - - if (KeGetCurrentIrql() >= DISPATCH_LEVEL) - { - DPRINT1("Page fault at high IRQL was %d, address %x\n", KeGetCurrentIrql(), Address); - return(STATUS_UNSUCCESSFUL); - } - - /* - * Find the memory area for the faulting address - */ - if (Address >= (ULONG_PTR)MmSystemRangeStart) - { - /* - * Check permissions - */ - if (Mode != KernelMode) - { - DPRINT1("Address: %x\n", Address); - return(STATUS_ACCESS_VIOLATION); - } - AddressSpace = MmGetKernelAddressSpace(); - } - else - { - AddressSpace = &PsGetCurrentProcess()->Vm; - } - - if (!FromMdl) - { - MmLockAddressSpace(AddressSpace); - } - - /* - * Call the memory area specific fault handler - */ - do - { - MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, (PVOID)Address); - if (MemoryArea == NULL || MemoryArea->DeleteInProgress) - { - if (!FromMdl) - { - MmUnlockAddressSpace(AddressSpace); - } - return (STATUS_ACCESS_VIOLATION); - } - - switch (MemoryArea->Type) - { - case MEMORY_AREA_PAGED_POOL: - { - Status = MmCommitPagedPoolAddress((PVOID)Address, Locked); - break; - } - - case MEMORY_AREA_SYSTEM: - Status = STATUS_ACCESS_VIOLATION; - break; - - case MEMORY_AREA_SECTION_VIEW: - Status = MmNotPresentFaultSectionView(AddressSpace, - MemoryArea, - (PVOID)Address, - Locked); - break; - - case MEMORY_AREA_VIRTUAL_MEMORY: - case MEMORY_AREA_PEB_OR_TEB: - Status = MmNotPresentFaultVirtualMemory(AddressSpace, - MemoryArea, - (PVOID)Address, - Locked); - break; - - case MEMORY_AREA_SHARED_DATA: - Pfn = MmGetPhysicalAddress((PVOID)PCR).LowPart >> PAGE_SHIFT; - Pfn++; - Status = - MmCreateVirtualMapping(PsGetCurrentProcess(), - (PVOID)PAGE_ROUND_DOWN(Address), - PAGE_READONLY, - &Pfn, - 1); - break; - - default: - Status = STATUS_ACCESS_VIOLATION; - break; - } - } - while (Status == STATUS_MM_RESTART_OPERATION); - - DPRINT("Completed page fault handling\n"); - if (!FromMdl) - { - MmUnlockAddressSpace(AddressSpace); - } - return(Status); -} - -extern BOOLEAN Mmi386MakeKernelPageTableGlobal(PVOID Address); - -NTSTATUS -NTAPI -MmAccessFault(IN BOOLEAN StoreInstruction, - IN PVOID Address, - IN KPROCESSOR_MODE Mode, - IN PVOID TrapInformation) -{ - /* Cute little hack for ROS */ - if ((ULONG_PTR)Address >= (ULONG_PTR)MmSystemRangeStart) - { -#ifdef _M_IX86 - /* Check for an invalid page directory in kernel mode */ - if (Mmi386MakeKernelPageTableGlobal(Address)) - { - /* All is well with the world */ - return STATUS_SUCCESS; - } -#endif - } - - /* Keep same old ReactOS Behaviour */ - if (StoreInstruction) - { - /* Call access fault */ - return MmpAccessFault(Mode, (ULONG_PTR)Address, TrapInformation ? FALSE : TRUE); - } - else - { - /* Call not present */ - return MmNotPresentFault(Mode, (ULONG_PTR)Address, TrapInformation ? FALSE : TRUE); - } -} - -NTSTATUS -NTAPI -MmCommitPagedPoolAddress(PVOID Address, BOOLEAN Locked) -{ - NTSTATUS Status; - PFN_TYPE AllocatedPage; - Status = MmRequestPageMemoryConsumer(MC_PPOOL, FALSE, &AllocatedPage); - if (!NT_SUCCESS(Status)) - { - MmUnlockAddressSpace(MmGetKernelAddressSpace()); - Status = MmRequestPageMemoryConsumer(MC_PPOOL, TRUE, &AllocatedPage); - MmLockAddressSpace(MmGetKernelAddressSpace()); - } - Status = - MmCreateVirtualMapping(NULL, - (PVOID)PAGE_ROUND_DOWN(Address), - PAGE_READWRITE, - &AllocatedPage, - 1); - if (Locked) - { - MmLockPage(AllocatedPage); - } - return(Status); -} - - - -/* Miscellanea functions: they may fit somewhere else */ - -/* - * @implemented - */ -BOOLEAN -NTAPI -MmIsRecursiveIoFault (VOID) -{ - PETHREAD Thread = PsGetCurrentThread(); - - return (Thread->DisablePageFaultClustering | Thread->ForwardClusterOnly); -} - -/* - * @unimplemented - */ -NTSTATUS -NTAPI -MmMapUserAddressesToPage(IN PVOID BaseAddress, - IN SIZE_T NumberOfBytes, - IN PVOID PageAddress) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -ULONG NTAPI -MmAdjustWorkingSetSize (ULONG Unknown0, - ULONG Unknown1, - ULONG Unknown2, - ULONG Unknown3) -{ - UNIMPLEMENTED; - return (0); -} - -/* - * @unimplemented - */ -BOOLEAN -NTAPI -MmSetAddressRangeModified ( - IN PVOID Address, - IN ULONG Length -) -{ - UNIMPLEMENTED; - return (FALSE); -} - -/* - * @unimplemented - */ -NTSTATUS -NTAPI -NtGetWriteWatch(IN HANDLE ProcessHandle, - IN ULONG Flags, - IN PVOID BaseAddress, - IN ULONG RegionSize, - IN PVOID *UserAddressArray, - OUT PULONG EntriesInUserAddressArray, - OUT PULONG Granularity) -{ - if (!EntriesInUserAddressArray || !Granularity) - { - return STATUS_ACCESS_VIOLATION; - } - - if (!*EntriesInUserAddressArray || !RegionSize) - { - return STATUS_INVALID_PARAMETER; - } - - if (!UserAddressArray) - { - return STATUS_ACCESS_VIOLATION; - } - - /* HACK: Set granularity to PAGE_SIZE */ - *Granularity = PAGE_SIZE; - - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -NTAPI -NtResetWriteWatch(IN HANDLE ProcessHandle, - IN PVOID BaseAddress, - IN ULONG RegionSize) -{ - if (!RegionSize) - { - return STATUS_INVALID_PARAMETER; - } - - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* EOF */ Copied: trunk/reactos/ntoskrnl/mm/mmfault.c (from r41647, trunk/reactos/ntoskrnl/mm/mm.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mmfault.c?p2=t…
============================================================================== --- trunk/reactos/ntoskrnl/mm/mm.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/mmfault.c [iso-8859-1] Sun Jun 28 11:52:30 2009 @@ -1,30 +1,18 @@ /* * COPYRIGHT: See COPYING in the top directory * PROJECT: ReactOS kernel - * FILE: ntoskrnl/mm/mm.c + * FILE: ntoskrnl/mm/mmfault.c * PURPOSE: Kernel memory managment functions * PROGRAMMERS: David Welch (welch(a)cwcom.net) */ -/* INCLUDES *****************************************************************/ +/* INCLUDES *******************************************************************/ #include <ntoskrnl.h> #define NDEBUG #include <debug.h> -/* GLOBALS *****************************************************************/ - -ULONG MmUserProbeAddress = 0; -PVOID MmHighestUserAddress = NULL; -PBOOLEAN Mm64BitPhysicalAddress = FALSE; -PVOID MmSystemRangeStart = NULL; -ULONG MmReadClusterSize; - -MM_STATS MmStats; - -PMMSUPPORT MmKernelAddressSpace; - -/* FUNCTIONS ****************************************************************/ +/* PRIVATE FUNCTIONS **********************************************************/ VOID FASTCALL @@ -55,54 +43,6 @@ (PVOID)Thread->StackLimit, Thread->LargeStack ? KERNEL_LARGE_STACK_SIZE : KERNEL_STACK_SIZE); -} - -/* - * @implemented - */ -BOOLEAN NTAPI MmIsNonPagedSystemAddressValid(PVOID VirtualAddress) -{ - return MmIsAddressValid(VirtualAddress); -} - -/* - * @implemented - */ -BOOLEAN NTAPI MmIsAddressValid(PVOID VirtualAddress) -/* - * FUNCTION: Checks whether the given address is valid for a read or write - * ARGUMENTS: - * VirtualAddress = address to check - * RETURNS: True if the access would be valid - * False if the access would cause a page fault - * NOTES: This function checks whether a byte access to the page would - * succeed. Is this realistic for RISC processors which don't - * allow byte granular access? - */ -{ - MEMORY_AREA* MemoryArea; - PMMSUPPORT AddressSpace; - - if (VirtualAddress >= MmSystemRangeStart) - { - AddressSpace = MmGetKernelAddressSpace(); - } - else - { - AddressSpace = &PsGetCurrentProcess()->Vm; - } - - MmLockAddressSpace(AddressSpace); - MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, - VirtualAddress); - - if (MemoryArea == NULL || MemoryArea->DeleteInProgress) - { - MmUnlockAddressSpace(AddressSpace); - return(FALSE); - } - MmUnlockAddressSpace(AddressSpace); - return(TRUE); } NTSTATUS @@ -379,113 +319,40 @@ return(Status); } - - -/* Miscellanea functions: they may fit somewhere else */ +/* PUBLIC FUNCTIONS ***********************************************************/ /* * @implemented */ BOOLEAN NTAPI -MmIsRecursiveIoFault (VOID) -{ - PETHREAD Thread = PsGetCurrentThread(); - - return (Thread->DisablePageFaultClustering | Thread->ForwardClusterOnly); -} - -/* - * @unimplemented - */ -NTSTATUS -NTAPI -MmMapUserAddressesToPage(IN PVOID BaseAddress, - IN SIZE_T NumberOfBytes, - IN PVOID PageAddress) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -ULONG NTAPI -MmAdjustWorkingSetSize (ULONG Unknown0, - ULONG Unknown1, - ULONG Unknown2, - ULONG Unknown3) -{ - UNIMPLEMENTED; - return (0); -} - -/* - * @unimplemented - */ -BOOLEAN -NTAPI -MmSetAddressRangeModified ( - IN PVOID Address, - IN ULONG Length -) -{ - UNIMPLEMENTED; - return (FALSE); -} - -/* - * @unimplemented - */ -NTSTATUS -NTAPI -NtGetWriteWatch(IN HANDLE ProcessHandle, - IN ULONG Flags, - IN PVOID BaseAddress, - IN ULONG RegionSize, - IN PVOID *UserAddressArray, - OUT PULONG EntriesInUserAddressArray, - OUT PULONG Granularity) -{ - if (!EntriesInUserAddressArray || !Granularity) - { - return STATUS_ACCESS_VIOLATION; - } - - if (!*EntriesInUserAddressArray || !RegionSize) - { - return STATUS_INVALID_PARAMETER; - } - - if (!UserAddressArray) - { - return STATUS_ACCESS_VIOLATION; - } - - /* HACK: Set granularity to PAGE_SIZE */ - *Granularity = PAGE_SIZE; - - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -NTAPI -NtResetWriteWatch(IN HANDLE ProcessHandle, - IN PVOID BaseAddress, - IN ULONG RegionSize) -{ - if (!RegionSize) - { - return STATUS_INVALID_PARAMETER; - } - - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; +MmIsAddressValid(IN PVOID VirtualAddress) +{ + MEMORY_AREA* MemoryArea; + PMMSUPPORT AddressSpace; + + DPRINT1("WARNING: %s returns bogus result\n", __FUNCTION__); + + if (VirtualAddress >= MmSystemRangeStart) + { + AddressSpace = MmGetKernelAddressSpace(); + } + else + { + AddressSpace = &PsGetCurrentProcess()->Vm; + } + + MmLockAddressSpace(AddressSpace); + MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, + VirtualAddress); + + if (MemoryArea == NULL || MemoryArea->DeleteInProgress) + { + MmUnlockAddressSpace(AddressSpace); + return(FALSE); + } + MmUnlockAddressSpace(AddressSpace); + return(TRUE); } /* EOF */ Modified: trunk/reactos/ntoskrnl/mm/mminit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=4…
============================================================================== --- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Sun Jun 28 11:52:30 2009 @@ -55,6 +55,13 @@ ULONG_PTR MmPfnDatabaseEnd; PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor; MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg; +ULONG MmUserProbeAddress = 0; +PVOID MmHighestUserAddress = NULL; +PBOOLEAN Mm64BitPhysicalAddress = FALSE; +PVOID MmSystemRangeStart = NULL; +ULONG MmReadClusterSize; +MM_STATS MmStats; +PMMSUPPORT MmKernelAddressSpace; extern KMUTANT MmSystemLoadLock; extern HANDLE MpwThreadHandle; extern BOOLEAN MpwThreadShouldTerminate; Added: trunk/reactos/ntoskrnl/mm/mmsup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mmsup.c?rev=41…
============================================================================== --- trunk/reactos/ntoskrnl/mm/mmsup.c (added) +++ trunk/reactos/ntoskrnl/mm/mmsup.c [iso-8859-1] Sun Jun 28 11:52:30 2009 @@ -1,0 +1,120 @@ +/* + * COPYRIGHT: See COPYING in the top directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/mm/mmsup.c + * PURPOSE: Kernel memory managment functions + * PROGRAMMERS: David Welch (welch(a)cwcom.net) + */ + +/* INCLUDES *******************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <debug.h> + +/* PRIVATE FUNCTIONS **********************************************************/ + +NTSTATUS +NTAPI +MiZeroPage(PFN_TYPE Page) +{ + KIRQL Irql; + PVOID TempAddress; + + Irql = KeRaiseIrqlToDpcLevel(); + TempAddress = MiMapPageToZeroInHyperSpace(Page); + if (TempAddress == NULL) + { + return(STATUS_NO_MEMORY); + } + memset(TempAddress, 0, PAGE_SIZE); + MiUnmapPagesInZeroSpace(TempAddress, 1); + KeLowerIrql(Irql); + return(STATUS_SUCCESS); +} + +NTSTATUS +NTAPI +MiCopyFromUserPage(PFN_TYPE DestPage, PVOID SourceAddress) +{ + PEPROCESS Process; + KIRQL Irql; + PVOID TempAddress; + + Process = PsGetCurrentProcess(); + TempAddress = MiMapPageInHyperSpace(Process, DestPage, &Irql); + if (TempAddress == NULL) + { + return(STATUS_NO_MEMORY); + } + memcpy(TempAddress, SourceAddress, PAGE_SIZE); + MiUnmapPageInHyperSpace(Process, TempAddress, Irql); + return(STATUS_SUCCESS); +} + +/* PRIVATE FUNCTIONS **********************************************************/ + +/* Miscellanea functions: they may fit somewhere else */ + +/* + * @implemented + */ +BOOLEAN +NTAPI +MmIsRecursiveIoFault (VOID) +{ + PETHREAD Thread = PsGetCurrentThread(); + + return (Thread->DisablePageFaultClustering | Thread->ForwardClusterOnly); +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +MmMapUserAddressesToPage(IN PVOID BaseAddress, + IN SIZE_T NumberOfBytes, + IN PVOID PageAddress) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +ULONG NTAPI +MmAdjustWorkingSetSize (ULONG Unknown0, + ULONG Unknown1, + ULONG Unknown2, + ULONG Unknown3) +{ + UNIMPLEMENTED; + return (0); +} + +/* + * @unimplemented + */ +BOOLEAN +NTAPI +MmSetAddressRangeModified ( + IN PVOID Address, + IN ULONG Length +) +{ + UNIMPLEMENTED; + return (FALSE); +} + +/* + * @implemented + */ +BOOLEAN NTAPI MmIsNonPagedSystemAddressValid(PVOID VirtualAddress) +{ + DPRINT1("WARNING: %s returns bogus result\n", __FUNCTION__); + return MmIsAddressValid(VirtualAddress); +} + +/* EOF */ Propchange: trunk/reactos/ntoskrnl/mm/mmsup.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/ntoskrnl/mm/mmsup.c ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: trunk/reactos/ntoskrnl/mm/virtual.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/virtual.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] Sun Jun 28 11:52:30 2009 @@ -1151,4 +1151,57 @@ return STATUS_SUCCESS; } +/* + * @unimplemented + */ +NTSTATUS +NTAPI +NtGetWriteWatch(IN HANDLE ProcessHandle, + IN ULONG Flags, + IN PVOID BaseAddress, + IN ULONG RegionSize, + IN PVOID *UserAddressArray, + OUT PULONG EntriesInUserAddressArray, + OUT PULONG Granularity) +{ + if (!EntriesInUserAddressArray || !Granularity) + { + return STATUS_ACCESS_VIOLATION; + } + + if (!*EntriesInUserAddressArray || !RegionSize) + { + return STATUS_INVALID_PARAMETER; + } + + if (!UserAddressArray) + { + return STATUS_ACCESS_VIOLATION; + } + + /* HACK: Set granularity to PAGE_SIZE */ + *Granularity = PAGE_SIZE; + + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +NtResetWriteWatch(IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + IN ULONG RegionSize) +{ + if (!RegionSize) + { + return STATUS_INVALID_PARAMETER; + } + + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + /* EOF */ Removed: trunk/reactos/ntoskrnl/mm/wset.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/wset.c?rev=416…
============================================================================== --- trunk/reactos/ntoskrnl/mm/wset.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/wset.c (removed) @@ -1,48 +1,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/mm/wset.c - * PURPOSE: Manages working sets - * - * PROGRAMMERS: David Welch (welch(a)cwcom.net) - */ - -/* INCLUDES *****************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <debug.h> - -/* FUNCTIONS *****************************************************************/ - -NTSTATUS -MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages) -{ - PFN_TYPE CurrentPage; - PFN_TYPE NextPage; - NTSTATUS Status; - - (*NrFreedPages) = 0; - - CurrentPage = MmGetLRUFirstUserPage(); - while (CurrentPage != 0 && Target > 0) - { - NextPage = MmGetLRUNextUserPage(CurrentPage); - - Status = MmPageOutPhysicalAddress(CurrentPage); - if (NT_SUCCESS(Status)) - { - DPRINT("Succeeded\n"); - Target--; - (*NrFreedPages)++; - } - else if (Status == STATUS_PAGEFILE_QUOTA) - { - MmRemoveLRUUserPage(CurrentPage); - MmInsertLRULastUserPage(CurrentPage); - } - - CurrentPage = NextPage; - } - return(STATUS_SUCCESS); -} Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Sun Jun 28 11:52:30 2009 @@ -374,10 +374,10 @@ <file>balance.c</file> <file>dbgpool.c</file> <file>freelist.c</file> - <file>kmap.c</file> <file>marea.c</file> <file>mdlsup.c</file> - <file>mm.c</file> + <file>mmfault.c</file> + <file>mmsup.c</file> <file>mminit.c</file> <file>mpw.c</file> <file>ncache.c</file> @@ -393,7 +393,6 @@ <file>section.c</file> <file>sysldr.c</file> <file>virtual.c</file> - <file>wset.c</file> <if property="_ELF_" value="1"> <file>elf32.c</file> <file>elf64.c</file>
15 years, 5 months
1
0
0
0
[ros-arm-bringup] 41658: - Move all the functions from drvlck.c and verifier.c to ARM3's drvmgmt.c: - "Managing driver managing" (by David Welch) is no more... the routines have been properly renamed and cleaned up. - Also moved Driver Verifier helper routines in here, and fixed a couple of bugs: - Do not allow hooking of the kernel or HAL image (tested on Windows Server 2003) - Cleanup some useless variable redefinitions and code complexity. - Documented what some of the Mm Lock/Unlock Pageable
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Sun Jun 28 11:32:52 2009 New Revision: 41658 URL:
http://svn.reactos.org/svn/reactos?rev=41658&view=rev
Log: - Move all the functions from drvlck.c and verifier.c to ARM3's drvmgmt.c: - "Managing driver managing" (by David Welch) is no more... the routines have been properly renamed and cleaned up. - Also moved Driver Verifier helper routines in here, and fixed a couple of bugs: - Do not allow hooking of the kernel or HAL image (tested on Windows Server 2003) - Cleanup some useless variable redefinitions and code complexity. - Documented what some of the Mm Lock/Unlock Pageable Section/Driver functions should do, for later if needed. - Made aliasses so the typo "Pagable" functions redirect to the correct "Pageable" functions. - No functional change -- the Verifier functions were unused, and the drvlock.c functions were unimplemented (and still are). - Also move one more *Pageable* function from wset.c to ARM3's drvmgmt.c -- it seemed to have been a lost orphan (Also unimplemented). Added: trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c - copied, changed from r41647, trunk/reactos/ntoskrnl/mm/drvlck.c Removed: trunk/reactos/ntoskrnl/mm/drvlck.c trunk/reactos/ntoskrnl/mm/verifier.c Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h trunk/reactos/ntoskrnl/mm/wset.c trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild trunk/reactos/ntoskrnl/ntoskrnl.pspec Copied: trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c (from r41647, trunk/reactos/ntoskrnl/mm/drvlck.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c…
============================================================================== --- trunk/reactos/ntoskrnl/mm/drvlck.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c [iso-8859-1] Sun Jun 28 11:32:52 2009 @@ -1,102 +1,324 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/mm/drvlck.c - * PURPOSE: Managing driver managing - * - * PROGRAMMERS: David Welch (welch(a)mcmail.com) - */ - -/* INCLUDES *****************************************************************/ + * PROJECT: ReactOS Kernel + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: ntoskrnl/mm/ARM3/drvmgmt.c + * PURPOSE: ARM Memory Manager Driver Management + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ #include <ntoskrnl.h> +#define NDEBUG #include <debug.h> -/* FUNCTIONS *****************************************************************/ - -#undef MmLockPagableDataSection - -#if 0 +#line 15 "ARM³::DRVMGMT" +#define MODULE_INVOLVED_IN_ARM3 +#include "../ARM3/miarm.h" + +/* GLOBALS *******************************************************************/ + +MM_DRIVER_VERIFIER_DATA MmVerifierData; +LIST_ENTRY MiVerifierDriverAddedThunkListHead; +KMUTANT MmSystemLoadLock; +ULONG MiActiveVerifierThunks; +extern LIST_ENTRY PsLoadedModuleList; + +/* PRIVATE FUNCTIONS *********************************************************/ + +PLDR_DATA_TABLE_ENTRY +NTAPI +MiLookupDataTableEntry(IN PVOID Address) +{ + PLDR_DATA_TABLE_ENTRY LdrEntry, FoundEntry = NULL; + PLIST_ENTRY NextEntry; + PAGED_CODE(); + + // + // Loop entries + // + NextEntry = PsLoadedModuleList.Flink; + do + { + // + // Get the loader entry + // + LdrEntry = CONTAINING_RECORD(NextEntry, + LDR_DATA_TABLE_ENTRY, + InLoadOrderLinks); + + // + // Check if the address matches + // + if ((Address >= LdrEntry->DllBase) && + (Address < (PVOID)((ULONG_PTR)LdrEntry->DllBase + + LdrEntry->SizeOfImage))) + { + // + // Found a match + // + FoundEntry = LdrEntry; + break; + } + + // + // Move on + // + NextEntry = NextEntry->Flink; + } while(NextEntry != &PsLoadedModuleList); + + // + // Return the entry + // + return FoundEntry; +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* + * @unimplemented + */ VOID -MmUnlockPagableImageSection(IN PVOID ImageSectionHandle) -/* - * FUNCTION: Releases a section of driver code or driver data, previously - * locked into system space with MmLockPagableCodeSection, - * MmLockPagableDataSection or MmLockPagableSectionByHandle - * ARGUMENTS: - * ImageSectionHandle = Handle returned by MmLockPagableCodeSection or - * MmLockPagableDataSection - */ -{ - // MmUnlockMemoryArea((MEMORY_AREA *)ImageSectionHandle); - UNIMPLEMENTED; -} -#endif - - -/* - * @unimplemented - */ -VOID NTAPI -MmLockPagableSectionByHandle(IN PVOID ImageSectionHandle) -{ - UNIMPLEMENTED; -} - - -#if 0 +NTAPI +MmUnlockPageableImageSection(IN PVOID ImageSectionHandle) +{ + UNIMPLEMENTED; +} + +/* + * @unimplemented + */ +VOID +NTAPI +MmLockPageableSectionByHandle(IN PVOID ImageSectionHandle) +{ + UNIMPLEMENTED; +} + +/* + * @unimplemented + */ PVOID -MmLockPagableCodeSection(IN PVOID AddressWithinSection) -{ - PVOID Handle; - Handle = MmLocateMemoryAreaByAddress(NULL,AddressWithinSection); - MmLockPagableSectionByHandle(Handle); - return(Handle); -} -#endif - +NTAPI +MmLockPageableDataSection(IN PVOID AddressWithinSection) +{ + // + // We should just find the section and call MmLockPageableSectionByHandle + // + UNIMPLEMENTED; + return AddressWithinSection; +} + +/* + * @unimplemented + */ +PVOID +NTAPI +MmPageEntireDriver(IN PVOID AddressWithinSection) +{ + // + // We should find the driver loader entry and return its base address + // + UNIMPLEMENTED; + return NULL; +} + +/* + * @unimplemented + */ +VOID +NTAPI +MmResetDriverPaging(IN PVOID AddressWithinSection) +{ + UNIMPLEMENTED; +} + +/* + * @unimplemented + */ +ULONG +NTAPI +MmTrimAllSystemPageableMemory(IN ULONG PurgeTransitionList) +{ + UNIMPLEMENTED; + return 0; +} /* * @implemented */ -PVOID NTAPI -MmLockPagableDataSection(IN PVOID AddressWithinSection) -{ - PVOID Handle; - Handle = MmLocateMemoryAreaByAddress(MmGetKernelAddressSpace(), - AddressWithinSection); - MmLockPagableSectionByHandle(Handle); - return(Handle); -} - - -/* - * @unimplemented - */ -VOID NTAPI -MmUnlockPagableImageSection(IN PVOID ImageSectionHandle) -{ - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -PVOID NTAPI -MmPageEntireDriver(IN PVOID AddressWithinSection) -{ - UNIMPLEMENTED; - return NULL; -} - - -/* - * @unimplemented - */ -VOID NTAPI -MmResetDriverPaging(IN PVOID AddressWithinSection) -{ - UNIMPLEMENTED; +NTSTATUS +NTAPI +MmAddVerifierThunks(IN PVOID ThunkBuffer, + IN ULONG ThunkBufferSize) +{ + PDRIVER_VERIFIER_THUNK_PAIRS ThunkTable; + ULONG ThunkCount; + PDRIVER_SPECIFIED_VERIFIER_THUNKS DriverThunks; + PLDR_DATA_TABLE_ENTRY LdrEntry; + PVOID ModuleBase, ModuleEnd; + ULONG i; + NTSTATUS Status = STATUS_SUCCESS; + PAGED_CODE(); + + // + // Make sure the driver verifier is initialized + // + if (!MiVerifierDriverAddedThunkListHead.Flink) return STATUS_NOT_SUPPORTED; + + // + // Get the thunk pairs and count them + // + ThunkCount = ThunkBufferSize / sizeof(DRIVER_VERIFIER_THUNK_PAIRS); + if (!ThunkCount) return STATUS_INVALID_PARAMETER_1; + + // + // Now allocate our own thunk table + // + DriverThunks = ExAllocatePoolWithTag(PagedPool, + sizeof(*DriverThunks) + + ThunkCount * + sizeof(DRIVER_VERIFIER_THUNK_PAIRS), + 'tVmM'); + if (!DriverThunks) return STATUS_INSUFFICIENT_RESOURCES; + + // + // Now copy the driver-fed part + // + ThunkTable = (PDRIVER_VERIFIER_THUNK_PAIRS)(DriverThunks + 1); + RtlCopyMemory(ThunkTable, + ThunkBuffer, + ThunkCount * sizeof(DRIVER_VERIFIER_THUNK_PAIRS)); + + // + // Acquire the system load lock + // + KeEnterCriticalRegion(); + KeWaitForSingleObject(&MmSystemLoadLock, + WrVirtualMemory, + KernelMode, + FALSE, + NULL); + + // + // Get the loader entry + // + LdrEntry = MiLookupDataTableEntry(ThunkTable->PristineRoutine); + if (!LdrEntry) + { + // + // Fail + // + Status = STATUS_INVALID_PARAMETER_2; + goto Cleanup; + } + + // + // Get driver base and end + // + ModuleBase = LdrEntry->DllBase; + ModuleEnd = (PVOID)((ULONG_PTR)LdrEntry->DllBase + LdrEntry->SizeOfImage); + + // + // Don't allow hooking the kernel or HAL + // + if (ModuleBase < (PVOID)(KSEG0_BASE + MmBootImageSize)) + { + // + // Fail + // + Status = STATUS_INVALID_PARAMETER_2; + goto Cleanup; + } + + // + // Loop all the thunks + // + for (i = 0; i < ThunkCount; i++) + { + // + // Make sure it's in the driver + // + if (((ULONG_PTR)ThunkTable->PristineRoutine < (ULONG_PTR)ModuleBase) || + ((ULONG_PTR)ThunkTable->PristineRoutine >= (ULONG_PTR)ModuleEnd)) + { + // + // Nope, fail + // + Status = STATUS_INVALID_PARAMETER_2; + goto Cleanup; + } + } + + // + // Otherwise, add this entry + // + DriverThunks->DataTableEntry = LdrEntry; + DriverThunks->NumberOfThunks = ThunkCount; + MiActiveVerifierThunks++; + InsertTailList(&MiVerifierDriverAddedThunkListHead, + &DriverThunks->ListEntry); + DriverThunks = NULL; + +Cleanup: + // + // Release the lock + // + KeReleaseMutant(&MmSystemLoadLock, 1, FALSE, FALSE); + KeLeaveCriticalRegion(); + + // + // Free the table if we failed and return status + // + if (DriverThunks) ExFreePool(DriverThunks); + return Status; +} + +/* + * @implemented + */ +LOGICAL +NTAPI +MmIsDriverVerifying(IN PDRIVER_OBJECT DriverObject) +{ + PLDR_DATA_TABLE_ENTRY LdrEntry; + + // + // Get the loader entry + // + LdrEntry = (PLDR_DATA_TABLE_ENTRY)DriverObject->DriverSection; + if (!LdrEntry) return FALSE; + + // + // Check if we're verifying or not + // + return (LdrEntry->Flags & LDRP_IMAGE_VERIFYING) ? TRUE: FALSE; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +MmIsVerifierEnabled(OUT PULONG VerifierFlags) +{ + // + // Check if we've actually added anything to the list + // + if (MiVerifierDriverAddedThunkListHead.Flink) + { + // + // We have, read the verifier level + // + *VerifierFlags = MmVerifierData.Level; + return STATUS_SUCCESS; + } + + // + // Otherwise, we're disabled + // + *VerifierFlags = 0; + return STATUS_NOT_SUPPORTED; } /* EOF */ Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Sun Jun 28 11:32:52 2009 @@ -52,6 +52,7 @@ extern PMMPTE MiFirstReservedZeroingPte; extern MI_PFN_CACHE_ATTRIBUTE MiPlatformCacheAttributes[2][MmMaximumCacheType]; extern PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock; +extern ULONG MmBootImageSize; VOID NTAPI Removed: trunk/reactos/ntoskrnl/mm/drvlck.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/drvlck.c?rev=4…
============================================================================== --- trunk/reactos/ntoskrnl/mm/drvlck.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/drvlck.c (removed) @@ -1,102 +1,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/mm/drvlck.c - * PURPOSE: Managing driver managing - * - * PROGRAMMERS: David Welch (welch(a)mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include <ntoskrnl.h> -#include <debug.h> - -/* FUNCTIONS *****************************************************************/ - -#undef MmLockPagableDataSection - -#if 0 -VOID -MmUnlockPagableImageSection(IN PVOID ImageSectionHandle) -/* - * FUNCTION: Releases a section of driver code or driver data, previously - * locked into system space with MmLockPagableCodeSection, - * MmLockPagableDataSection or MmLockPagableSectionByHandle - * ARGUMENTS: - * ImageSectionHandle = Handle returned by MmLockPagableCodeSection or - * MmLockPagableDataSection - */ -{ - // MmUnlockMemoryArea((MEMORY_AREA *)ImageSectionHandle); - UNIMPLEMENTED; -} -#endif - - -/* - * @unimplemented - */ -VOID NTAPI -MmLockPagableSectionByHandle(IN PVOID ImageSectionHandle) -{ - UNIMPLEMENTED; -} - - -#if 0 -PVOID -MmLockPagableCodeSection(IN PVOID AddressWithinSection) -{ - PVOID Handle; - Handle = MmLocateMemoryAreaByAddress(NULL,AddressWithinSection); - MmLockPagableSectionByHandle(Handle); - return(Handle); -} -#endif - - -/* - * @implemented - */ -PVOID NTAPI -MmLockPagableDataSection(IN PVOID AddressWithinSection) -{ - PVOID Handle; - Handle = MmLocateMemoryAreaByAddress(MmGetKernelAddressSpace(), - AddressWithinSection); - MmLockPagableSectionByHandle(Handle); - return(Handle); -} - - -/* - * @unimplemented - */ -VOID NTAPI -MmUnlockPagableImageSection(IN PVOID ImageSectionHandle) -{ - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -PVOID NTAPI -MmPageEntireDriver(IN PVOID AddressWithinSection) -{ - UNIMPLEMENTED; - return NULL; -} - - -/* - * @unimplemented - */ -VOID NTAPI -MmResetDriverPaging(IN PVOID AddressWithinSection) -{ - UNIMPLEMENTED; -} - -/* EOF */ Removed: trunk/reactos/ntoskrnl/mm/verifier.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/verifier.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/mm/verifier.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/verifier.c (removed) @@ -1,190 +1,0 @@ -/* -* PROJECT: ReactOS Kernel -* LICENSE: GPL - See COPYING in the top level directory -* FILE: ntoskrnl/mm/verifier.c -* PURPOSE: Mm Driver Verifier Routines -* PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) -*/ - -/* INCLUDES ******************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <debug.h> - -/* GLOBALS *******************************************************************/ - -MM_DRIVER_VERIFIER_DATA MmVerifierData; -LIST_ENTRY MiVerifierDriverAddedThunkListHead; -KMUTANT MmSystemLoadLock; -ULONG MiActiveVerifierThunks; - -extern LIST_ENTRY PsLoadedModuleList; - -/* PRIVATE FUNCTIONS *********************************************************/ - -PLDR_DATA_TABLE_ENTRY -NTAPI -MiLookupDataTableEntry(IN PVOID Address) -{ - PLDR_DATA_TABLE_ENTRY LdrEntry, FoundEntry = NULL; - PLIST_ENTRY NextEntry; - PAGED_CODE(); - - /* Loop entries */ - NextEntry = PsLoadedModuleList.Flink; - do - { - /* Get the loader entry */ - LdrEntry = CONTAINING_RECORD(NextEntry, - LDR_DATA_TABLE_ENTRY, - InLoadOrderLinks); - - /* Check if the address matches */ - if ((Address >= LdrEntry->DllBase) && - (Address < (PVOID)((ULONG_PTR)LdrEntry->DllBase + LdrEntry->SizeOfImage))) - { - /* Found a match */ - FoundEntry = LdrEntry; - break; - } - - /* Move on */ - NextEntry = NextEntry->Flink; - } while(NextEntry != &PsLoadedModuleList); - - /* Return the entry */ - return FoundEntry; -} - -/* PUBLIC FUNCTIONS **********************************************************/ - -/* - * @implemented - */ -NTSTATUS -NTAPI -MmAddVerifierThunks(IN PVOID ThunkBuffer, - IN ULONG ThunkBufferSize) -{ - PDRIVER_VERIFIER_THUNK_PAIRS ThunkPairs, DriverThunkTable; - ULONG ThunkCount; - PDRIVER_SPECIFIED_VERIFIER_THUNKS ThunkTable; - PLDR_DATA_TABLE_ENTRY LdrEntry; - PVOID ModuleBase, ModuleEnd; - ULONG i; - NTSTATUS Status = STATUS_SUCCESS; - PAGED_CODE(); - - /* Make sure the driver verifier is initialized */ - if (!MiVerifierDriverAddedThunkListHead.Flink) return STATUS_NOT_SUPPORTED; - - /* Get the thunk pairs and count them */ - ThunkPairs = (PDRIVER_VERIFIER_THUNK_PAIRS)ThunkBuffer; - ThunkCount = ThunkBufferSize / sizeof(DRIVER_VERIFIER_THUNK_PAIRS); - if (!ThunkCount) return STATUS_INVALID_PARAMETER_1; - - /* Now allocate our own thunk table */ - ThunkTable = ExAllocatePoolWithTag(PagedPool, - sizeof(DRIVER_SPECIFIED_VERIFIER_THUNKS) + - ThunkCount * - sizeof(DRIVER_VERIFIER_THUNK_PAIRS), - TAG('M', 'm', 'V', 't')); - if (!ThunkTable) return STATUS_INSUFFICIENT_RESOURCES; - - /* Now copy the driver-fed part */ - DriverThunkTable = (PDRIVER_VERIFIER_THUNK_PAIRS)(ThunkTable + 1); - RtlCopyMemory(DriverThunkTable, - ThunkPairs, - ThunkCount * sizeof(DRIVER_VERIFIER_THUNK_PAIRS)); - - /* Acquire the system load lock */ - KeEnterCriticalRegion(); - KeWaitForSingleObject(&MmSystemLoadLock, - WrVirtualMemory, - KernelMode, - FALSE, - NULL); - - /* Get the loader entry */ - LdrEntry = MiLookupDataTableEntry(DriverThunkTable->PristineRoutine); - if (!LdrEntry) - { - /* Fail */ - Status = STATUS_INVALID_PARAMETER_2; - goto Cleanup; - } - - /* Get driver base and end */ - ModuleBase = LdrEntry->DllBase; - ModuleEnd = (PVOID)((ULONG_PTR)LdrEntry->DllBase + LdrEntry->SizeOfImage); - - /* Loop all the thunks */ - for (i = 0; i < ThunkCount; i++) - { - /* Make sure it's in the driver */ - if (((ULONG_PTR)DriverThunkTable->PristineRoutine < (ULONG_PTR)ModuleBase) || - ((ULONG_PTR)DriverThunkTable->PristineRoutine >= (ULONG_PTR)ModuleEnd)) - { - /* Nope, fail */ - Status = STATUS_INVALID_PARAMETER_2; - goto Cleanup; - } - } - - /* Otherwise, add this entry */ - ThunkTable->DataTableEntry = LdrEntry; - ThunkTable->NumberOfThunks = ThunkCount; - MiActiveVerifierThunks++; - InsertTailList(&MiVerifierDriverAddedThunkListHead, - &ThunkTable->ListEntry); - ThunkTable = NULL; - -Cleanup: - /* Release the lock */ - KeReleaseMutant(&MmSystemLoadLock, 1, FALSE, FALSE); - KeLeaveCriticalRegion(); - - /* Free the table if we failed and return status */ - if (ThunkTable) ExFreePool(ThunkTable); - return Status; -} - -/* - * @implemented - */ -LOGICAL -NTAPI -MmIsDriverVerifying(IN PDRIVER_OBJECT DriverObject) -{ - PLDR_DATA_TABLE_ENTRY LdrEntry; - - /* Get the loader entry */ - LdrEntry = (PLDR_DATA_TABLE_ENTRY)DriverObject->DriverSection; - if (!LdrEntry) return FALSE; - - /* Check if we're verifying or not */ - return (LdrEntry->Flags & LDRP_IMAGE_VERIFYING) ? TRUE: FALSE; -} - -/* - * @implemented - */ -NTSTATUS -NTAPI -MmIsVerifierEnabled(OUT PULONG VerifierFlags) -{ - /* Check if we've actually added anything to the list */ - if (MiVerifierDriverAddedThunkListHead.Flink) - { - /* We have, read the verifier level */ - *VerifierFlags = MmVerifierData.Level; - return STATUS_SUCCESS; - } - - /* Otherwise, we're disabled */ - *VerifierFlags = 0; - return STATUS_NOT_SUPPORTED; -} - -/* EOF */ Modified: trunk/reactos/ntoskrnl/mm/wset.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/wset.c?rev=416…
============================================================================== --- trunk/reactos/ntoskrnl/mm/wset.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/wset.c [iso-8859-1] Sun Jun 28 11:32:52 2009 @@ -46,16 +46,3 @@ } return(STATUS_SUCCESS); } - -/* - * @unimplemented - */ -ULONG -NTAPI -MmTrimAllSystemPagableMemory ( - IN ULONG PurgeTransitionList - ) -{ - UNIMPLEMENTED; - return 0; -} Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Sun Jun 28 11:32:52 2009 @@ -361,6 +361,7 @@ </if> <directory name="ARM3"> <file>contmem.c</file> + <file>drvmgmt.c</file> <file>dynamic.c</file> <file>hypermap.c</file> <file>init.c</file> @@ -372,7 +373,6 @@ <file>anonmem.c</file> <file>balance.c</file> <file>dbgpool.c</file> - <file>drvlck.c</file> <file>freelist.c</file> <file>kmap.c</file> <file>marea.c</file> @@ -392,7 +392,6 @@ <file>rmap.c</file> <file>section.c</file> <file>sysldr.c</file> - <file>verifier.c</file> <file>virtual.c</file> <file>wset.c</file> <if property="_ELF_" value="1"> Modified: trunk/reactos/ntoskrnl/ntoskrnl.pspec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.pspec?re…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl.pspec [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.pspec [iso-8859-1] Sun Jun 28 11:32:52 2009 @@ -771,9 +771,9 @@ @ stdcall MmIsRecursiveIoFault() @ stdcall MmIsThisAnNtAsSystem() @ stdcall MmIsVerifierEnabled(ptr) -@ stdcall MmLockPagableDataSection(ptr) -@ stdcall MmLockPagableImageSection(ptr) MmLockPagableDataSection -@ stdcall MmLockPagableSectionByHandle(ptr) +@ stdcall MmLockPagableDataSection(ptr) MmLockPageableDataSection +@ stdcall MmLockPagableImageSection(ptr) MmLockPageableDataSection +@ stdcall MmLockPagableSectionByHandle(ptr) MmLockPageableSectionByHandle @ stdcall MmMapIoSpace(long long long long) @ stdcall MmMapLockedPages(ptr long) @ stdcall MmMapLockedPagesSpecifyCache(ptr long long ptr long long) @@ -801,8 +801,8 @@ @ stdcall MmSetBankedSection(long long long long long long) @ stdcall MmSizeOfMdl(ptr long) @ extern MmSystemRangeStart -@ stdcall MmTrimAllSystemPagableMemory(long) -@ stdcall MmUnlockPagableImageSection(ptr) +@ stdcall MmTrimAllSystemPagableMemory(long) MmTrimAllSystemPageableMemory +@ stdcall MmUnlockPagableImageSection(ptr) MmUnlockPageableImageSection @ stdcall MmUnlockPages(ptr) @ stdcall MmUnmapIoSpace(ptr long) @ stdcall MmUnmapLockedPages(ptr ptr)
15 years, 5 months
1
0
0
0
[ros-arm-bringup] 41657: - Reimplement MmAllocateContiguousMemory, MmAllocateContiguousMemorySpecifyCache, MmFreeContiguousMemory, MmFreeContiguousMemorySpecifyCache: - Use a smarter algorithm (as described here: http://www.microsoft.com/whdc/Driver/tips/ContigMem.mspx) to first try to satisfy the allocation by a simple nonpaged pool allocation (for cached requests only). - This range is then checked for physical continuity, since it's not guaranteed for non-initial-pool allocations (and right n
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Sun Jun 28 09:43:12 2009 New Revision: 41657 URL:
http://svn.reactos.org/svn/reactos?rev=41657&view=rev
Log: - Reimplement MmAllocateContiguousMemory, MmAllocateContiguousMemorySpecifyCache, MmFreeContiguousMemory, MmFreeContiguousMemorySpecifyCache: - Use a smarter algorithm (as described here:
http://www.microsoft.com/whdc/Driver/tips/ContigMem.mspx
) to first try to satisfy the allocation by a simple nonpaged pool allocation (for cached requests only). - This range is then checked for physical continuity, since it's not guaranteed for non-initial-pool allocations (and right now in ReactOS, it never is). - As a fallback, Windows NT then attempts to scan free nonpaged pool pages. This is not yet implemented since the ReactOS nonpaged pool is not usually contiguous (to the level that NT's is). - When the ARM pool is implemented and replaces nonpaged pool, this code path will have to be implemented. - As a last resort, the actual PFN database is scanned for contiguous free pages. - ReactOS used MmGetContiguousPages for this, which blindly scanned the PFN database. New MiFindContinuousPages will scan the physical memory descriptor block recently implemented, which avoids going over pages we already know are going to be unusable. - The ReactOS function also held the PFN lock for the entire duration of the scan, which is significant on systems with large memory. Instead, we make an initial unsafe scan first, and only lock when we think we've found a correct range (and we'll then reconfirm the ranges). - Finally, the older function actually did a double-scan to try to avoid using memory ranges under 16MB, which was useless on today's systems and also rather inefficient. - Other than that, the actual setup of the PFN entry is copy-pasted from the old ReactOS function, so nothing's changed there -- the page still looks the same, but the selection algorithm is faster and more accurate. - Once the pages are found, we piggyback on the new I/O mapping mechanism (which uses System PTEs) instead of doing it all over by hand as before. - Since the underlying support is still System PTEs, once again, optimizations to that component will yield significant improvements here too. Added: trunk/reactos/ntoskrnl/mm/ARM3/contmem.c - copied, changed from r41647, trunk/reactos/ntoskrnl/mm/cont.c Removed: trunk/reactos/ntoskrnl/mm/cont.c Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h trunk/reactos/ntoskrnl/mm/freelist.c trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild Copied: trunk/reactos/ntoskrnl/mm/ARM3/contmem.c (from r41647, trunk/reactos/ntoskrnl/mm/cont.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/contmem.c…
============================================================================== --- trunk/reactos/ntoskrnl/mm/cont.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/contmem.c [iso-8859-1] Sun Jun 28 09:43:12 2009 @@ -1,241 +1,440 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/mm/cont.c - * PURPOSE: Manages continuous memory - * - * PROGRAMMERS: David Welch (welch(a)cwcom.net) + * PROJECT: ReactOS Kernel + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: ntoskrnl/mm/ARM3/contmem.c + * PURPOSE: ARM Memory Manager Contiguous Memory Allocator + * PROGRAMMERS: ReactOS Portable Systems Group */ -/* INCLUDES *****************************************************************/ +/* INCLUDES *******************************************************************/ #include <ntoskrnl.h> #define NDEBUG #include <debug.h> -/* FUNCTIONS *****************************************************************/ - -static VOID -MmFreeContinuousPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, - PFN_TYPE Page, SWAPENTRY SwapEntry, - BOOLEAN Dirty) -{ - ASSERT(SwapEntry == 0); - if (Page != 0) - { - MmReleasePageMemoryConsumer(MC_NPPOOL, Page); - } -} - -/********************************************************************** - * NAME EXPORTED - * MmAllocateContiguousMemorySpecifyCache@32 - * - * DESCRIPTION - * Allocates a range of physically contiguous memory - * with a cache parameter. - * - * ARGUMENTS - * NumberOfBytes - * Size of the memory block to allocate; - * - * LowestAcceptableAddress - * Lowest address valid for the caller. - * - * HighestAcceptableAddress - * Highest address valid for the caller. - * - * BoundaryAddressMultiple - * Address multiple not to be crossed by allocated buffer (optional). - * - * CacheType - * Type of caching to use. - * - * RETURN VALUE - * The virtual address of the memory block on success; - * NULL on error. - * - * REVISIONS - * +#line 15 "ARM³::CONTMEM" +#define MODULE_INVOLVED_IN_ARM3 +#include "../ARM3/miarm.h" + +/* PRIVATE FUNCTIONS **********************************************************/ + +PVOID +NTAPI +MiCheckForContiguousMemory(IN PVOID BaseAddress, + IN PFN_NUMBER BaseAddressPages, + IN PFN_NUMBER SizeInPages, + IN PFN_NUMBER LowestPfn, + IN PFN_NUMBER HighestPfn, + IN PFN_NUMBER BoundaryPfn, + IN MI_PFN_CACHE_ATTRIBUTE CacheAttribute) +{ + PMMPTE StartPte, EndPte; + PFN_NUMBER PreviousPage = 0, Page, HighPage, BoundaryMask, Pages = 0; + + // + // Okay, first of all check if the PFNs match our restrictions + // + if (LowestPfn > HighestPfn) return NULL; + if (LowestPfn + SizeInPages <= LowestPfn) return NULL; + if (LowestPfn + SizeInPages - 1 > HighestPfn) return NULL; + if (BaseAddressPages < SizeInPages) return NULL; + + // + // This is the last page we need to get to and the boundary requested + // + HighPage = HighestPfn + 1 - SizeInPages; + BoundaryMask = ~(BoundaryPfn - 1); + + // + // And here's the PTEs for this allocation. Let's go scan them. + // + StartPte = MiAddressToPte(BaseAddress); + EndPte = StartPte + BaseAddressPages; + while (StartPte < EndPte) + { + // + // Get this PTE's page number + // + ASSERT (StartPte->u.Hard.Valid == 1); + Page = PFN_FROM_PTE(StartPte); + + // + // Is this the beginning of our adventure? + // + if (!Pages) + { + // + // Check if this PFN is within our range + // + if ((Page >= LowestPfn) && (Page <= HighPage)) + { + // + // It is! Do you care about boundary (alignment)? + // + if (!(BoundaryPfn) || + (!((Page ^ (Page + SizeInPages - 1)) & BoundaryMask))) + { + // + // You don't care, or you do care but we deliver + // + Pages++; + } + } + + // + // Have we found all the pages we need by now? + // Incidently, this means you only wanted one page + // + if (Pages == SizeInPages) + { + // + // Mission complete + // + return MiPteToAddress(StartPte); + } + } + else + { + // + // Have we found a page that doesn't seem to be contiguous? + // + if (Page != (PreviousPage + 1)) + { + // + // Ah crap, we have to start over + // + Pages = 0; + continue; + } + + // + // Otherwise, we're still in the game. Do we have all our pages? + // + if (++Pages == SizeInPages) + { + // + // We do! This entire range was contiguous, so we'll return it! + // + return MiPteToAddress(StartPte - Pages + 1); + } + } + + // + // Try with the next PTE, remember this PFN + // + PreviousPage = Page; + StartPte++; + continue; + } + + // + // All good returns are within the loop... + // + return NULL; +} + +PVOID +NTAPI +MiFindContiguousMemory(IN PFN_NUMBER LowestPfn, + IN PFN_NUMBER HighestPfn, + IN PFN_NUMBER BoundaryPfn, + IN PFN_NUMBER SizeInPages, + IN MEMORY_CACHING_TYPE CacheType) +{ + PFN_NUMBER Page; + PHYSICAL_ADDRESS PhysicalAddress; + PAGED_CODE (); + ASSERT(SizeInPages != 0); + + // + // Our last hope is to scan the free page list for contiguous pages + // + Page = MiFindContiguousPages(LowestPfn, + HighestPfn, + BoundaryPfn, + SizeInPages, + CacheType); + if (!Page) return NULL; + + // + // We'll just piggyback on the I/O memory mapper + // + PhysicalAddress.QuadPart = Page << PAGE_SHIFT; + return MmMapIoSpace(PhysicalAddress, SizeInPages << PAGE_SHIFT, CacheType); +} + +PVOID +NTAPI +MiAllocateContiguousMemory(IN SIZE_T NumberOfBytes, + IN PFN_NUMBER LowestAcceptablePfn, + IN PFN_NUMBER HighestAcceptablePfn, + IN PFN_NUMBER BoundaryPfn, + IN MEMORY_CACHING_TYPE CacheType) +{ + PVOID BaseAddress; + PFN_NUMBER SizeInPages; + MI_PFN_CACHE_ATTRIBUTE CacheAttribute; + ASSERT(NumberOfBytes != 0); + + // + // Compute size requested + // + SizeInPages = BYTES_TO_PAGES(NumberOfBytes); + + // + // Convert the cache attribute and check for cached requests + // + CacheAttribute = MiPlatformCacheAttributes[FALSE][CacheType]; + if (CacheAttribute == MiCached) + { + // + // Because initial nonpaged pool is supposed to be contiguous, go ahead + // and try making a nonpaged pool allocation first. + // + BaseAddress = ExAllocatePoolWithTag(NonPagedPoolCacheAligned, + NumberOfBytes, + 'mCmM'); + if (BaseAddress) + { + // + // Now make sure it's actually contiguous (if it came from expansion + // it might not be). + // + if (MiCheckForContiguousMemory(BaseAddress, + SizeInPages, + SizeInPages, + LowestAcceptablePfn, + HighestAcceptablePfn, + BoundaryPfn, + CacheAttribute)) + { + // + // Sweet, we're in business! + // + return BaseAddress; + } + + // + // No such luck + // + ExFreePool(BaseAddress); + } + } + + // + // According to MSDN, the system won't try anything else if you're higher + // than APC level. + // + if (KeGetCurrentIrql() > APC_LEVEL) return NULL; + + // + // Otherwise, we'll go try to find some + // + return MiFindContiguousMemory(LowestAcceptablePfn, + HighestAcceptablePfn, + BoundaryPfn, + SizeInPages, + CacheType); +} + +VOID +NTAPI +MiFreeContiguousMemory(IN PVOID BaseAddress) +{ + KIRQL OldIrql; + PFN_NUMBER PageFrameIndex, LastPage, PageCount; + PMMPFN Pfn1, StartPfn; + PAGED_CODE(); + + // + // First, check if the memory came from initial nonpaged pool, or expansion + // + if (((BaseAddress >= MmNonPagedPoolStart) && + (BaseAddress < (PVOID)((ULONG_PTR)MmNonPagedPoolStart + + MmSizeOfNonPagedPoolInBytes))) || + ((BaseAddress >= MmNonPagedPoolExpansionStart) && + (BaseAddress < MmNonPagedPoolEnd))) + { + // + // It did, so just use the pool to free this + // + ExFreePool(BaseAddress); + return; + } + + // + // Otherwise, get the PTE and page number for the allocation + // + PageFrameIndex = PFN_FROM_PTE(MiAddressToPte(BaseAddress)); + + // + // Now get the PFN entry for this, and make sure it's the correct one + // + Pfn1 = MiGetPfnEntry(PageFrameIndex); + if (Pfn1->u3.e1.StartOfAllocation == 0) + { + // + // This probably means you did a free on an address that was in between + // + KeBugCheckEx (BAD_POOL_CALLER, + 0x60, + (ULONG_PTR)BaseAddress, + 0, + 0); + } + + // + // Now this PFN isn't the start of any allocation anymore, it's going out + // + StartPfn = Pfn1; + Pfn1->u3.e1.StartOfAllocation = 0; + + // + // Look the PFNs + // + do + { + // + // Until we find the one that marks the end of the allocation + // + } while (Pfn1++->u3.e1.EndOfAllocation == 0); + + // + // Found it, unmark it + // + Pfn1--; + Pfn1->u3.e1.EndOfAllocation = 0; + + // + // Now compute how many pages this represents + // + PageCount = (ULONG)(Pfn1 - StartPfn + 1); + + // + // So we can know how much to unmap (recall we piggyback on I/O mappings) + // + MmUnmapIoSpace(BaseAddress, PageCount << PAGE_SHIFT); + + // + // Lock the PFN database + // + OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); + + // + // Loop all the pages + // + LastPage = PageFrameIndex + PageCount; + do + { + // + // Free each one, and move on + // + MmReleasePageMemoryConsumer(MC_NPPOOL, PageFrameIndex); + } while (++PageFrameIndex < LastPage); + + // + // Release the PFN lock + // + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* * @implemented */ -PVOID NTAPI +PVOID +NTAPI MmAllocateContiguousMemorySpecifyCache(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS LowestAcceptableAddress OPTIONAL, IN PHYSICAL_ADDRESS HighestAcceptableAddress, IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL, IN MEMORY_CACHING_TYPE CacheType OPTIONAL) { - PMEMORY_AREA MArea; - NTSTATUS Status; - PVOID BaseAddress = NULL; - PFN_TYPE PBase; - ULONG Protect; - ULONG i; - - Protect = PAGE_EXECUTE_READWRITE | PAGE_SYSTEM; - if (CacheType == MmNonCached || CacheType == MmWriteCombined) - { - Protect |= PAGE_NOCACHE; - } - if (CacheType == MmWriteCombined) - { - Protect |= PAGE_WRITECOMBINE; - } - - MmLockAddressSpace(MmGetKernelAddressSpace()); - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_CONTINUOUS_MEMORY, - &BaseAddress, - NumberOfBytes, - PAGE_READWRITE, - &MArea, - FALSE, - 0, - RtlConvertLongToLargeInteger(0)); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); - - if (!NT_SUCCESS(Status)) - { - return(NULL); - } - DPRINT( "Base = %x\n", BaseAddress ); - PBase = MmGetContinuousPages(NumberOfBytes, - LowestAcceptableAddress, - HighestAcceptableAddress, - BoundaryAddressMultiple, - TRUE); - if (PBase == 0) - { - MmLockAddressSpace(MmGetKernelAddressSpace()); - MmFreeMemoryArea(MmGetKernelAddressSpace(), - MArea, - NULL, - NULL); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); - return(NULL); - } - for (i = 0; i < (PAGE_ROUND_UP(NumberOfBytes) / PAGE_SIZE); i++, PBase++) - { - MmCreateVirtualMapping(NULL, - (char*)BaseAddress + (i * PAGE_SIZE), - Protect, - &PBase, - 1); - } - return(BaseAddress); -} - -/********************************************************************** - * NAME EXPORTED - * MmAllocateContiguousMemory@12 - * - * DESCRIPTION - * Allocates a range of physically contiguous cache aligned - * memory from the non-paged pool. - * - * ARGUMENTS - * NumberOfBytes - * Size of the memory block to allocate; - * - * HighestAcceptableAddress - * Highest address valid for the caller. - * - * RETURN VALUE - * The virtual address of the memory block on success; - * NULL on error. - * - * NOTE - * Description taken from include/ddk/mmfuncs.h. - * Code taken from ntoskrnl/mm/special.c. - * - * REVISIONS - * + PFN_NUMBER LowestPfn, HighestPfn, BoundaryPfn; + ASSERT (NumberOfBytes != 0); + + // + // Convert the lowest address into a PFN + // + LowestPfn = (PFN_NUMBER)(LowestAcceptableAddress.QuadPart >> PAGE_SHIFT); + if (BYTE_OFFSET(LowestAcceptableAddress.LowPart)) LowestPfn++; + + // + // Convert and validate the boundary address into a PFN + // + if (BYTE_OFFSET(BoundaryAddressMultiple.LowPart)) return NULL; + BoundaryPfn = (PFN_NUMBER)(BoundaryAddressMultiple.QuadPart >> PAGE_SHIFT); + + // + // Convert the highest address into a PFN + // + HighestPfn = (PFN_NUMBER)(HighestAcceptableAddress.QuadPart >> PAGE_SHIFT); + if (HighestPfn > MmHighestPhysicalPage) HighestPfn = MmHighestPhysicalPage; + + // + // Validate the PFN bounds + // + if (LowestPfn > HighestPfn) return NULL; + + // + // Let the contiguous memory allocator handle it + // + return MiAllocateContiguousMemory(NumberOfBytes, + LowestPfn, + HighestPfn, + BoundaryPfn, + CacheType); +} + +/* * @implemented */ -PVOID NTAPI -MmAllocateContiguousMemory (IN ULONG NumberOfBytes, - IN PHYSICAL_ADDRESS HighestAcceptableAddress) -{ - return MmAllocateContiguousMemorySpecifyCache(NumberOfBytes, - RtlConvertLongToLargeInteger(0), - HighestAcceptableAddress, - RtlConvertLongToLargeInteger(0), - MmCached); -} - - -/********************************************************************** - * NAME EXPORTED - * MmFreeContiguousMemory@4 - * - * DESCRIPTION - * Releases a range of physically contiguous memory allocated - * with MmAllocateContiguousMemory. - * - * ARGUMENTS - * BaseAddress - * Virtual address of the memory to be freed. - * - * RETURN VALUE - * None. - * - * NOTE - * Description taken from include/ddk/mmfuncs.h. - * Code taken from ntoskrnl/mm/special.c. - * - * REVISIONS - * +PVOID +NTAPI +MmAllocateContiguousMemory(IN ULONG NumberOfBytes, + IN PHYSICAL_ADDRESS HighestAcceptableAddress) +{ + PFN_NUMBER HighestPfn; + + // + // Convert and normalize the highest address into a PFN + // + HighestPfn = (PFN_NUMBER)(HighestAcceptableAddress.QuadPart >> PAGE_SHIFT); + if (HighestPfn > MmHighestPhysicalPage) HighestPfn = MmHighestPhysicalPage; + + // + // Let the contiguous memory allocator handle it + // + return MiAllocateContiguousMemory(NumberOfBytes, 0, HighestPfn, 0, MmCached); +} + +/* * @implemented */ -VOID NTAPI +VOID +NTAPI MmFreeContiguousMemory(IN PVOID BaseAddress) { - MmLockAddressSpace(MmGetKernelAddressSpace()); - MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(), - BaseAddress, - MmFreeContinuousPage, - NULL); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); -} - -/********************************************************************** - * NAME EXPORTED - * MmFreeContiguousMemorySpecifyCache@12 - * - * DESCRIPTION - * Releases a range of physically contiguous memory allocated - * with MmAllocateContiguousMemorySpecifyCache. - * - * ARGUMENTS - * BaseAddress - * Virtual address of the memory to be freed. - * - * NumberOfBytes - * Size of the memory block to free. - * - * CacheType - * Type of caching used. - * - * RETURN VALUE - * None. - * - * REVISIONS - * + // + // Let the contiguous memory allocator handle it + // + MiFreeContiguousMemory(BaseAddress); +} + +/* * @implemented */ -VOID NTAPI +VOID +NTAPI MmFreeContiguousMemorySpecifyCache(IN PVOID BaseAddress, IN ULONG NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType) { - MmLockAddressSpace(MmGetKernelAddressSpace()); - MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(), - BaseAddress, - MmFreeContinuousPage, - NULL); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); -} - + // + // Just call the non-cached version (there's no cache issues for freeing) + // + MiFreeContiguousMemory(BaseAddress); +} /* EOF */ Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Sun Jun 28 09:43:12 2009 @@ -47,8 +47,10 @@ extern ULONG MmMaximumNonPagedPoolInBytes; extern PVOID MmNonPagedPoolStart; extern PVOID MmNonPagedPoolExpansionStart; +extern PVOID MmNonPagedPoolEnd; extern PMMPTE MmFirstReservedMappingPte, MmLastReservedMappingPte; extern PMMPTE MiFirstReservedZeroingPte; +extern MI_PFN_CACHE_ATTRIBUTE MiPlatformCacheAttributes[2][MmMaximumCacheType]; extern PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock; VOID @@ -80,4 +82,27 @@ IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType ); + +PFN_NUMBER +NTAPI +MiFindContiguousPages( + IN PFN_NUMBER LowestPfn, + IN PFN_NUMBER HighestPfn, + IN PFN_NUMBER BoundaryPfn, + IN PFN_NUMBER SizeInPages, + IN MEMORY_CACHING_TYPE CacheType +); + +PVOID +NTAPI +MiCheckForContiguousMemory( + IN PVOID BaseAddress, + IN PFN_NUMBER BaseAddressPages, + IN PFN_NUMBER SizeInPages, + IN PFN_NUMBER LowestPfn, + IN PFN_NUMBER HighestPfn, + IN PFN_NUMBER BoundaryPfn, + IN MI_PFN_CACHE_ATTRIBUTE CacheAttribute +); + /* EOF */ Removed: trunk/reactos/ntoskrnl/mm/cont.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/cont.c?rev=416…
============================================================================== --- trunk/reactos/ntoskrnl/mm/cont.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/cont.c (removed) @@ -1,241 +1,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/mm/cont.c - * PURPOSE: Manages continuous memory - * - * PROGRAMMERS: David Welch (welch(a)cwcom.net) - */ - -/* INCLUDES *****************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <debug.h> - -/* FUNCTIONS *****************************************************************/ - -static VOID -MmFreeContinuousPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, - PFN_TYPE Page, SWAPENTRY SwapEntry, - BOOLEAN Dirty) -{ - ASSERT(SwapEntry == 0); - if (Page != 0) - { - MmReleasePageMemoryConsumer(MC_NPPOOL, Page); - } -} - -/********************************************************************** - * NAME EXPORTED - * MmAllocateContiguousMemorySpecifyCache@32 - * - * DESCRIPTION - * Allocates a range of physically contiguous memory - * with a cache parameter. - * - * ARGUMENTS - * NumberOfBytes - * Size of the memory block to allocate; - * - * LowestAcceptableAddress - * Lowest address valid for the caller. - * - * HighestAcceptableAddress - * Highest address valid for the caller. - * - * BoundaryAddressMultiple - * Address multiple not to be crossed by allocated buffer (optional). - * - * CacheType - * Type of caching to use. - * - * RETURN VALUE - * The virtual address of the memory block on success; - * NULL on error. - * - * REVISIONS - * - * @implemented - */ -PVOID NTAPI -MmAllocateContiguousMemorySpecifyCache(IN SIZE_T NumberOfBytes, - IN PHYSICAL_ADDRESS LowestAcceptableAddress OPTIONAL, - IN PHYSICAL_ADDRESS HighestAcceptableAddress, - IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL, - IN MEMORY_CACHING_TYPE CacheType OPTIONAL) -{ - PMEMORY_AREA MArea; - NTSTATUS Status; - PVOID BaseAddress = NULL; - PFN_TYPE PBase; - ULONG Protect; - ULONG i; - - Protect = PAGE_EXECUTE_READWRITE | PAGE_SYSTEM; - if (CacheType == MmNonCached || CacheType == MmWriteCombined) - { - Protect |= PAGE_NOCACHE; - } - if (CacheType == MmWriteCombined) - { - Protect |= PAGE_WRITECOMBINE; - } - - MmLockAddressSpace(MmGetKernelAddressSpace()); - Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), - MEMORY_AREA_CONTINUOUS_MEMORY, - &BaseAddress, - NumberOfBytes, - PAGE_READWRITE, - &MArea, - FALSE, - 0, - RtlConvertLongToLargeInteger(0)); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); - - if (!NT_SUCCESS(Status)) - { - return(NULL); - } - DPRINT( "Base = %x\n", BaseAddress ); - PBase = MmGetContinuousPages(NumberOfBytes, - LowestAcceptableAddress, - HighestAcceptableAddress, - BoundaryAddressMultiple, - TRUE); - if (PBase == 0) - { - MmLockAddressSpace(MmGetKernelAddressSpace()); - MmFreeMemoryArea(MmGetKernelAddressSpace(), - MArea, - NULL, - NULL); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); - return(NULL); - } - for (i = 0; i < (PAGE_ROUND_UP(NumberOfBytes) / PAGE_SIZE); i++, PBase++) - { - MmCreateVirtualMapping(NULL, - (char*)BaseAddress + (i * PAGE_SIZE), - Protect, - &PBase, - 1); - } - return(BaseAddress); -} - -/********************************************************************** - * NAME EXPORTED - * MmAllocateContiguousMemory@12 - * - * DESCRIPTION - * Allocates a range of physically contiguous cache aligned - * memory from the non-paged pool. - * - * ARGUMENTS - * NumberOfBytes - * Size of the memory block to allocate; - * - * HighestAcceptableAddress - * Highest address valid for the caller. - * - * RETURN VALUE - * The virtual address of the memory block on success; - * NULL on error. - * - * NOTE - * Description taken from include/ddk/mmfuncs.h. - * Code taken from ntoskrnl/mm/special.c. - * - * REVISIONS - * - * @implemented - */ -PVOID NTAPI -MmAllocateContiguousMemory (IN ULONG NumberOfBytes, - IN PHYSICAL_ADDRESS HighestAcceptableAddress) -{ - return MmAllocateContiguousMemorySpecifyCache(NumberOfBytes, - RtlConvertLongToLargeInteger(0), - HighestAcceptableAddress, - RtlConvertLongToLargeInteger(0), - MmCached); -} - - -/********************************************************************** - * NAME EXPORTED - * MmFreeContiguousMemory@4 - * - * DESCRIPTION - * Releases a range of physically contiguous memory allocated - * with MmAllocateContiguousMemory. - * - * ARGUMENTS - * BaseAddress - * Virtual address of the memory to be freed. - * - * RETURN VALUE - * None. - * - * NOTE - * Description taken from include/ddk/mmfuncs.h. - * Code taken from ntoskrnl/mm/special.c. - * - * REVISIONS - * - * @implemented - */ -VOID NTAPI -MmFreeContiguousMemory(IN PVOID BaseAddress) -{ - MmLockAddressSpace(MmGetKernelAddressSpace()); - MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(), - BaseAddress, - MmFreeContinuousPage, - NULL); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); -} - -/********************************************************************** - * NAME EXPORTED - * MmFreeContiguousMemorySpecifyCache@12 - * - * DESCRIPTION - * Releases a range of physically contiguous memory allocated - * with MmAllocateContiguousMemorySpecifyCache. - * - * ARGUMENTS - * BaseAddress - * Virtual address of the memory to be freed. - * - * NumberOfBytes - * Size of the memory block to free. - * - * CacheType - * Type of caching used. - * - * RETURN VALUE - * None. - * - * REVISIONS - * - * @implemented - */ -VOID NTAPI -MmFreeContiguousMemorySpecifyCache(IN PVOID BaseAddress, - IN ULONG NumberOfBytes, - IN MEMORY_CACHING_TYPE CacheType) -{ - MmLockAddressSpace(MmGetKernelAddressSpace()); - MmFreeMemoryAreaByPtr(MmGetKernelAddressSpace(), - BaseAddress, - MmFreeContinuousPage, - NULL); - MmUnlockAddressSpace(MmGetKernelAddressSpace()); -} - - -/* EOF */ Modified: trunk/reactos/ntoskrnl/mm/freelist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/freelist.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] Sun Jun 28 09:43:12 2009 @@ -18,6 +18,8 @@ #pragma alloc_text(INIT, MmInitializePageList) #endif +#define MODULE_INVOLVED_IN_ARM3 +#include "ARM3/miarm.h" /* TYPES *******************************************************************/ @@ -235,6 +237,206 @@ } KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql); return 0; +} + +PFN_NUMBER +NTAPI +MiFindContiguousPages(IN PFN_NUMBER LowestPfn, + IN PFN_NUMBER HighestPfn, + IN PFN_NUMBER BoundaryPfn, + IN PFN_NUMBER SizeInPages, + IN MEMORY_CACHING_TYPE CacheType) +{ + PFN_NUMBER Page, PageCount, LastPage, Length, BoundaryMask; + ULONG i = 0; + PMMPFN Pfn1, EndPfn; + KIRQL OldIrql; + PAGED_CODE (); + ASSERT(SizeInPages != 0); + + // + // Convert the boundary PFN into an alignment mask + // + BoundaryMask = ~(BoundaryPfn - 1); + + // + // Loop all the physical memory blocks + // + do + { + // + // Capture the base page and length of this memory block + // + Page = MmPhysicalMemoryBlock->Run[i].BasePage; + PageCount = MmPhysicalMemoryBlock->Run[i].PageCount; + + // + // Check how far this memory block will go + // + LastPage = Page + PageCount; + + // + // Trim it down to only the PFNs we're actually interested in + // + if ((LastPage - 1) > HighestPfn) LastPage = HighestPfn + 1; + if (Page < LowestPfn) Page = LowestPfn; + + // + // Skip this run if it's empty or fails to contain all the pages we need + // + if (!(PageCount) || ((Page + SizeInPages) > LastPage)) continue; + + // + // Now scan all the relevant PFNs in this run + // + Length = 0; + for (Pfn1 = MiGetPfnEntry(Page); Page < LastPage; Page++, Pfn1++) + { + // + // If this PFN is in use, ignore it + // + if (Pfn1->Flags.Type != MM_PHYSICAL_PAGE_FREE) continue; + + // + // If we haven't chosen a start PFN yet and the caller specified an + // alignment, make sure the page matches the alignment restriction + // + if ((!(Length) && (BoundaryPfn)) && + (((Page ^ (Page + SizeInPages - 1)) & BoundaryMask))) + { + // + // It does not, so bail out + // + continue; + } + + // + // Increase the number of valid pages, and check if we have enough + // + if (++Length == SizeInPages) + { + // + // It appears we've amassed enough legitimate pages, rollback + // + Pfn1 -= (Length - 1); + Page -= (Length - 1); + + // + // Acquire the PFN lock + // + OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); + do + { + // + // Things might've changed for us. Is the page still free? + // + if (Pfn1->Flags.Type != MM_PHYSICAL_PAGE_FREE) break; + + // + // So far so good. Is this the last confirmed valid page? + // + if (!--Length) + { + // + // Sanity check that we didn't go out of bounds + // + ASSERT(i != MmPhysicalMemoryBlock->NumberOfRuns); + + // + // Loop until all PFN entries have been processed + // + EndPfn = Pfn1 - SizeInPages + 1; + do + { + // + // If this was an unzeroed page, there are now less + // + if (Pfn1->Flags.Zero == 0) UnzeroedPageCount--; + + // + // One less free page, one more system page + // + MmStats.NrFreePages--; + MmStats.NrSystemPages++; + + // + // This PFN is now a used page, set it up + // + RemoveEntryList(&Pfn1->ListEntry); + Pfn1->Flags.Type = MM_PHYSICAL_PAGE_USED; + Pfn1->Flags.Consumer = MC_NPPOOL; + Pfn1->ReferenceCount = 1; + Pfn1->LockCount = 0; + Pfn1->MapCount = 0; + Pfn1->SavedSwapEntry = 0; + + // + // Check if it was already zeroed + // + if (Pfn1->Flags.Zero == 0) + { + // + // It wasn't, so zero it + // + MiZeroPage(MiGetPfnEntryIndex(Pfn1)); + } + + // + // Check if this is the last PFN, otherwise go on + // + if (Pfn1 == EndPfn) break; + Pfn1--; + } while (TRUE); + + // + // Mark the first and last PFN so we can find them later + // + Pfn1->Flags.StartOfAllocation = 1; + (Pfn1 + SizeInPages - 1)->Flags.EndOfAllocation = 1; + + // + // Now it's safe to let go of the PFN lock + // + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); + + // + // Quick sanity check that the last PFN is consistent + // + EndPfn = Pfn1 + SizeInPages; + ASSERT(EndPfn == MiGetPfnEntry(Page + 1)); + + // + // Compute the first page, and make sure it's consistent + // + Page -= SizeInPages - 1; + ASSERT(Pfn1 == MiGetPfnEntry(Page)); + ASSERT(Page != 0); + return Page; + } + + // + // Keep going. The purpose of this loop is to reconfirm that + // after acquiring the PFN lock these pages are still usable + // + Pfn1++; + Page++; + } while (TRUE); + + // + // If we got here, something changed while we hadn't acquired + // the PFN lock yet, so we'll have to restart + // + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); + Length = 0; + } + } + } while (++i != MmPhysicalMemoryBlock->NumberOfRuns); + + + // + // And if we get here, it means no suitable physical memory runs were found + // + return 0; } PFN_TYPE Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Sun Jun 28 09:43:12 2009 @@ -360,6 +360,7 @@ </directory> </if> <directory name="ARM3"> + <file>contmem.c</file> <file>dynamic.c</file> <file>hypermap.c</file> <file>init.c</file> @@ -370,7 +371,6 @@ </directory> <file>anonmem.c</file> <file>balance.c</file> - <file>cont.c</file> <file>dbgpool.c</file> <file>drvlck.c</file> <file>freelist.c</file>
15 years, 5 months
1
0
0
0
[jimtabor] 41656: - Add more hooks, where wine has them placed. Fixed user32 hooks for win32k.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sun Jun 28 07:02:15 2009 New Revision: 41656 URL:
http://svn.reactos.org/svn/reactos?rev=41656&view=rev
Log: - Add more hooks, where wine has them placed. Fixed user32 hooks for win32k. Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c trunk/reactos/subsystems/win32/win32k/ntuser/focus.c trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Sun Jun 28 07:02:15 2009 @@ -682,13 +682,13 @@ DeleteObject(DesktopRgn); } } -#if 0 - if (ISITHOOKED(WH_CBT)) +//#if 0 +// if (ISITHOOKED(WH_CBT)) { - if (NtUserMessageCall( hWnd, WM_SYSCOMMAND, wParam, (LPARAM)&sizingRect, 0, FNID_DEFWINDOWPROC, FALSE)) + if (NtUserMessageCall( hwnd, WM_CBT, HCBT_MOVESIZE, (LPARAM)&sizingRect, 0, FNID_DEFWINDOWPROC, FALSE)) moved = FALSE; } -#endif +//#endif (void)NtUserSetGUIThreadHandle(MSQ_STATE_MOVESIZE, NULL); SendMessageA( hwnd, WM_EXITSIZEMOVE, 0, 0 ); SendMessageA( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L); @@ -768,13 +768,15 @@ WINDOWPLACEMENT wp; POINT Pt; -#if 0 - if (ISITHOOKED(WH_CBT)) + if (!IsWindowEnabled( hWnd )) return 0; + +//#if 0 +// if (ISITHOOKED(WH_CBT)) { if (NtUserMessageCall( hWnd, WM_SYSCOMMAND, wParam, lParam, 0, FNID_DEFWINDOWPROC, FALSE)) return 0; } -#endif +//#endif switch (wParam & 0xfff0) { case SC_MOVE: @@ -806,8 +808,8 @@ } break; case SC_CLOSE: - SendMessageA(hWnd, WM_CLOSE, 0, 0); - break; + return SendMessageW(hWnd, WM_CLOSE, 0, 0); + case SC_MOUSEMENU: { Pt.x = (short)LOWORD(lParam); Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Sun Jun 28 07:02:15 2009 @@ -559,6 +559,7 @@ // #define WM_SYSTIMER 280 #define WM_POPUPSYSTEMMENU 787 +#define WM_CBT 1023 // ReactOS only. // // Non SDK DCE types. Modified: trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] Sun Jun 28 07:02:15 2009 @@ -12,25 +12,6 @@ #define NDEBUG #include <debug.h> -LRESULT FASTCALL -IntDefWinHandleSysCommand( PWINDOW_OBJECT Window, WPARAM wParam, LPARAM lParam , BOOL Ansi) -{ - DPRINT1("hwnd %p WM_SYSCOMMAND %lx %lx\n", Window->hSelf, wParam, lParam ); - - if (!ISITHOOKED(WH_CBT)) return 0; - -// if (!UserCallNextHookEx(WH_CBT, HCBT_SYSCOMMAND, wParam, lParam, Ansi)) - return 0; - - switch (wParam & 0xfff0) - { - case SC_MOVE: - case SC_SIZE: - // return UserCallNextHookEx(WH_CBT, HCBT_MOVESIZE, (WPARAM)Window->hSelf, lParam, Ansi); - break; - } - return 1; -} /* Win32k counterpart of User DefWindowProc */ @@ -54,7 +35,9 @@ { case WM_SYSCOMMAND: { - lResult = IntDefWinHandleSysCommand( Window, wParam, lParam, Ansi ); + DPRINT1("hwnd %p WM_SYSCOMMAND %lx %lx\n", Window->hSelf, wParam, lParam ); + if (!ISITHOOKED(WH_CBT)) break; + lResult = co_HOOK_CallHooks(WH_CBT, HCBT_SYSCOMMAND, wParam, lParam); break; } case WM_SHOWWINDOW: @@ -76,8 +59,43 @@ } } break; + case WM_CBT: + { + if (!ISITHOOKED(WH_CBT)) break; + + switch (wParam) + { + case HCBT_MOVESIZE: + { + RECTL rt; + + if (lParam) + { + _SEH2_TRY + { + ProbeForRead((PVOID)lParam, + sizeof(RECT), + 1); + + RtlCopyMemory(&rt, + (PVOID)lParam, + sizeof(RECT)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + lResult = 1; + } + _SEH2_END; + } + if (!lResult) + lResult = co_HOOK_CallHooks(WH_CBT, HCBT_MOVESIZE, (WPARAM)Window->hSelf, lParam ? (LPARAM)&rt : 0); + } + break; + } + break; + } + break; } - return lResult; } Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Sun Jun 28 07:02:15 2009 @@ -320,6 +320,7 @@ HWND hWndPrev; HWND hWnd = 0; PWINDOW Wnd; + CBTACTIVATESTRUCT cbt; if (Window) ASSERT_REFS_CO(Window); @@ -346,7 +347,11 @@ return hWndPrev; } - /* FIXME: Call hooks. */ + /* call CBT hook chain */ + cbt.fMouse = FALSE; + cbt.hWndActive = hWndPrev; + if (co_HOOK_CallHooks( WH_CBT, HCBT_ACTIVATE, (WPARAM)hWnd, (LPARAM)&cbt)) + return 0; ThreadQueue->ActiveWindow = hWnd; @@ -382,6 +387,9 @@ return hWndPrev; } + if (co_HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)Window->hSelf, (LPARAM)hWndPrev)) + return 0; + ThreadQueue->FocusWindow = Window->hSelf; co_IntSendKillFocusMessages(hWndPrev, Window->hSelf); @@ -390,6 +398,9 @@ else { ThreadQueue->FocusWindow = 0; + + if (co_HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)0, (LPARAM)hWndPrev)) + return 0; co_IntSendKillFocusMessages(hWndPrev, 0); } Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Sun Jun 28 07:02:15 2009 @@ -307,6 +307,9 @@ Size.x = Wnd->WindowRect.left; Size.y = Wnd->WindowRect.top; WinPosInitInternalPos(Window, &Size, &Wnd->WindowRect); + + if (co_HOOK_CallHooks( WH_CBT, HCBT_MINMAX, (WPARAM)Window->hSelf, ShowFlag)) + return SWP_NOSIZE | SWP_NOMOVE; if (Wnd->Style & WS_MINIMIZE) {
15 years, 5 months
1
0
0
0
[tkreuzer] 41655: unbreak build of rostests
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Jun 28 04:05:51 2009 New Revision: 41655 URL:
http://svn.reactos.org/svn/reactos?rev=41655&view=rev
Log: unbreak build of rostests Modified: trunk/rostests/apitests/w32knapi/w32knapi.rbuild Modified: trunk/rostests/apitests/w32knapi/w32knapi.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/w32knap…
============================================================================== --- trunk/rostests/apitests/w32knapi/w32knapi.rbuild [iso-8859-1] (original) +++ trunk/rostests/apitests/w32knapi/w32knapi.rbuild [iso-8859-1] Sun Jun 28 04:05:51 2009 @@ -9,6 +9,7 @@ <library>advapi32</library> <library>w32kdll</library> <library>dbghelp</library> + <compilerflag compilerset="gcc">-fms-extensions</compilerflag> <file>w32knapi.c</file> <file>osver.c</file> <file>testlist.c</file>
15 years, 5 months
1
0
0
0
[cwittich] 41654: fix advapi32 crypt winetests patch sent to wine
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 28 03:55:29 2009 New Revision: 41654 URL:
http://svn.reactos.org/svn/reactos?rev=41654&view=rev
Log: fix advapi32 crypt winetests patch sent to wine Modified: trunk/reactos/dll/win32/advapi32/crypt/crypt.c Modified: trunk/reactos/dll/win32/advapi32/crypt/crypt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/crypt/c…
============================================================================== --- trunk/reactos/dll/win32/advapi32/crypt/crypt.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/crypt/crypt.c [iso-8859-1] Sun Jun 28 03:55:29 2009 @@ -1192,6 +1192,9 @@ TRACE("(%ld, %p, %08ld, %p, %p, %p)\n", dwIndex, pdwReserved, dwFlags, pdwProvType, pszProvName, pcbProvName); + if (*pcbProvName > INT_MAX) + *pcbProvName = INT_MAX; + if(!CryptEnumProvidersW(dwIndex, pdwReserved, dwFlags, pdwProvType, NULL, &bufsize)) return FALSE; if ( pszProvName && !(str = CRYPT_Alloc(bufsize)) ) @@ -1314,6 +1317,9 @@ TRACE("(%ld, %p, %08ld, %p, %p, %p)\n", dwIndex, pdwReserved, dwFlags, pdwProvType, pszTypeName, pcbTypeName); + if (*pcbTypeName > INT_MAX) + *pcbTypeName = INT_MAX; + if(!CryptEnumProviderTypesW(dwIndex, pdwReserved, dwFlags, pdwProvType, NULL, &bufsize)) return FALSE; if ( pszTypeName && !(str = CRYPT_Alloc(bufsize)) ) @@ -1512,6 +1518,9 @@ BOOL ret = FALSE; TRACE("(%d, %p, %08x, %p, %p)\n", dwProvType, pdwReserved, dwFlags, pszProvName, pcbProvName); + + if (*pcbProvName > INT_MAX) + *pcbProvName = INT_MAX; CryptGetDefaultProviderW(dwProvType, pdwReserved, dwFlags, NULL, &bufsize); if ( pszProvName && !(str = CRYPT_Alloc(bufsize)) )
15 years, 5 months
1
0
0
0
[tkreuzer] 41653: [FORMATTING] Fix indentation, no code change
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Jun 28 03:54:02 2009 New Revision: 41653 URL:
http://svn.reactos.org/svn/reactos?rev=41653&view=rev
Log: [FORMATTING] Fix indentation, no code change Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] Sun Jun 28 03:54:02 2009 @@ -30,37 +30,37 @@ static const COLORREF SysColors[] = { - RGB(212, 208, 200), /* COLOR_SCROLLBAR */ - RGB(58, 110, 165), /* COLOR_BACKGROUND */ - RGB(10, 36, 106), /* COLOR_ACTIVECAPTION */ - RGB(128, 128, 128), /* COLOR_INACTIVECAPTION */ - RGB(212, 208, 200), /* COLOR_MENU */ - RGB(255, 255, 255), /* COLOR_WINDOW */ - RGB(0, 0, 0), /* COLOR_WINDOWFRAME */ - RGB(0, 0, 0), /* COLOR_MENUTEXT */ - RGB(0, 0, 0), /* COLOR_WINDOWTEXT */ - RGB(255, 255, 255), /* COLOR_CAPTIONTEXT */ - RGB(212, 208, 200), /* COLOR_ACTIVEBORDER */ - RGB(212, 208, 200), /* COLOR_INACTIVEBORDER */ - RGB(128, 128, 128), /* COLOR_APPWORKSPACE */ - RGB(10, 36, 106), /* COLOR_HIGHLIGHT */ - RGB(255, 255, 255), /* COLOR_HIGHLIGHTTEXT */ - RGB(212, 208, 200), /* COLOR_BTNFACE */ - RGB(128, 128, 128), /* COLOR_BTNSHADOW */ - RGB(128, 128, 128), /* COLOR_GRAYTEXT */ - RGB(0, 0, 0), /* COLOR_BTNTEXT */ - RGB(212, 208, 200), /* COLOR_INACTIVECAPTIONTEXT */ - RGB(255, 255, 255), /* COLOR_BTNHIGHLIGHT */ - RGB(64, 64, 64), /* COLOR_3DDKSHADOW */ - RGB(212, 208, 200), /* COLOR_3DLIGHT */ - RGB(0, 0, 0), /* COLOR_INFOTEXT */ - RGB(255, 255, 225), /* COLOR_INFOBK */ - RGB(181, 181, 181), /* COLOR_UNKNOWN */ - RGB(0, 0, 128), /* COLOR_HOTLIGHT */ - RGB(166, 202, 240), /* COLOR_GRADIENTACTIVECAPTION */ - RGB(192, 192, 192), /* COLOR_GRADIENTINACTIVECAPTION */ - RGB(49, 106, 197), /* COLOR_MENUHILIGHT */ - RGB(236, 233, 216) /* COLOR_MENUBAR */ + RGB(212, 208, 200), /* COLOR_SCROLLBAR */ + RGB(58, 110, 165), /* COLOR_BACKGROUND */ + RGB(10, 36, 106), /* COLOR_ACTIVECAPTION */ + RGB(128, 128, 128), /* COLOR_INACTIVECAPTION */ + RGB(212, 208, 200), /* COLOR_MENU */ + RGB(255, 255, 255), /* COLOR_WINDOW */ + RGB(0, 0, 0), /* COLOR_WINDOWFRAME */ + RGB(0, 0, 0), /* COLOR_MENUTEXT */ + RGB(0, 0, 0), /* COLOR_WINDOWTEXT */ + RGB(255, 255, 255), /* COLOR_CAPTIONTEXT */ + RGB(212, 208, 200), /* COLOR_ACTIVEBORDER */ + RGB(212, 208, 200), /* COLOR_INACTIVEBORDER */ + RGB(128, 128, 128), /* COLOR_APPWORKSPACE */ + RGB(10, 36, 106), /* COLOR_HIGHLIGHT */ + RGB(255, 255, 255), /* COLOR_HIGHLIGHTTEXT */ + RGB(212, 208, 200), /* COLOR_BTNFACE */ + RGB(128, 128, 128), /* COLOR_BTNSHADOW */ + RGB(128, 128, 128), /* COLOR_GRAYTEXT */ + RGB(0, 0, 0), /* COLOR_BTNTEXT */ + RGB(212, 208, 200), /* COLOR_INACTIVECAPTIONTEXT */ + RGB(255, 255, 255), /* COLOR_BTNHIGHLIGHT */ + RGB(64, 64, 64), /* COLOR_3DDKSHADOW */ + RGB(212, 208, 200), /* COLOR_3DLIGHT */ + RGB(0, 0, 0), /* COLOR_INFOTEXT */ + RGB(255, 255, 225), /* COLOR_INFOBK */ + RGB(181, 181, 181), /* COLOR_UNKNOWN */ + RGB(0, 0, 128), /* COLOR_HOTLIGHT */ + RGB(166, 202, 240), /* COLOR_GRADIENTACTIVECAPTION */ + RGB(192, 192, 192), /* COLOR_GRADIENTINACTIVECAPTION */ + RGB(49, 106, 197), /* COLOR_MENUHILIGHT */ + RGB(236, 233, 216) /* COLOR_MENUBAR */ }; #define NUM_SYSCOLORS (sizeof(SysColors) / sizeof(SysColors[0])) @@ -70,81 +70,88 @@ /* GDI stock objects */ static LOGPEN WhitePen = -{ PS_SOLID, { 0, 0 }, RGB(255,255,255) }; + { PS_SOLID, { 0, 0 }, RGB(255,255,255) }; static LOGPEN BlackPen = -{ PS_SOLID, { 0, 0 }, RGB(0,0,0) }; + { PS_SOLID, { 0, 0 }, RGB(0,0,0) }; static LOGPEN NullPen = -{ PS_NULL, { 0, 0 }, 0 }; + { PS_NULL, { 0, 0 }, 0 }; static LOGFONTW OEMFixedFont = -{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET, - 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"Courier New" }; //Bitstream Vera Sans Mono + { 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET, + 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"Courier New" + }; //Bitstream Vera Sans Mono static LOGFONTW AnsiFixedFont = -{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"Courier New" }; //Bitstream Vera Sans Mono + { 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, + 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"Courier New" + }; //Bitstream Vera Sans Mono static LOGFONTW AnsiVarFont = - { 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" }; + { 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, + 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" + }; static LOGFONTW SystemFont = -{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"Courier New" }; //Bitstream Vera Sans + { 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, + 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"Courier New" + }; //Bitstream Vera Sans static LOGFONTW DeviceDefaultFont = -{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" }; //Bitstream Vera Sans + { 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, + 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" + }; //Bitstream Vera Sans static LOGFONTW SystemFixedFont = -{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"Courier New" }; //Bitstream Vera Sans Mono + { 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, + 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"Courier New" + }; //Bitstream Vera Sans Mono /* FIXME: Is this correct? */ static LOGFONTW DefaultGuiFont = -{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, - 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" }; //Bitstream Vera Sans + { 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, + 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" + }; //Bitstream Vera Sans HGDIOBJ StockObjects[NB_STOCK_OBJECTS]; static HPEN FASTCALL -IntCreateStockPen( DWORD dwPenStyle, - DWORD dwWidth, - ULONG ulBrushStyle, - ULONG ulColor) -{ - HPEN hPen; - PBRUSH pbrushPen = PEN_AllocPenWithHandle(); - - if ((dwPenStyle & PS_STYLE_MASK) == PS_NULL) dwWidth = 1; - - pbrushPen->ptPenWidth.x = abs(dwWidth); - pbrushPen->ptPenWidth.y = 0; - pbrushPen->ulPenStyle = dwPenStyle; - pbrushPen->BrushAttr.lbColor = ulColor; - pbrushPen->ulStyle = ulBrushStyle; - pbrushPen->hbmClient = (HANDLE)NULL; - pbrushPen->dwStyleCount = 0; - pbrushPen->pStyle = 0; - pbrushPen->flAttrs = GDIBRUSH_IS_OLDSTYLEPEN; - - switch (dwPenStyle & PS_STYLE_MASK) - { - case PS_NULL: - pbrushPen->flAttrs |= GDIBRUSH_IS_NULL; - break; - - case PS_SOLID: - pbrushPen->flAttrs |= GDIBRUSH_IS_SOLID; - break; - } - hPen = pbrushPen->BaseObject.hHmgr; - PEN_UnlockPen(pbrushPen); - return hPen; +IntCreateStockPen(DWORD dwPenStyle, + DWORD dwWidth, + ULONG ulBrushStyle, + ULONG ulColor) +{ + HPEN hPen; + PBRUSH pbrushPen = PEN_AllocPenWithHandle(); + + if ((dwPenStyle & PS_STYLE_MASK) == PS_NULL) dwWidth = 1; + + pbrushPen->ptPenWidth.x = abs(dwWidth); + pbrushPen->ptPenWidth.y = 0; + pbrushPen->ulPenStyle = dwPenStyle; + pbrushPen->BrushAttr.lbColor = ulColor; + pbrushPen->ulStyle = ulBrushStyle; + pbrushPen->hbmClient = (HANDLE)NULL; + pbrushPen->dwStyleCount = 0; + pbrushPen->pStyle = 0; + pbrushPen->flAttrs = GDIBRUSH_IS_OLDSTYLEPEN; + + switch (dwPenStyle & PS_STYLE_MASK) + { + case PS_NULL: + pbrushPen->flAttrs |= GDIBRUSH_IS_NULL; + break; + + case PS_SOLID: + pbrushPen->flAttrs |= GDIBRUSH_IS_SOLID; + break; + } + hPen = pbrushPen->BaseObject.hHmgr; + PEN_UnlockPen(pbrushPen); + return hPen; } /*! @@ -153,47 +160,47 @@ VOID FASTCALL CreateStockObjects(void) { - UINT Object; - - DPRINT("Beginning creation of stock objects\n"); - - /* Create GDI Stock Objects from the logical structures we've defined */ - - StockObjects[WHITE_BRUSH] = IntGdiCreateSolidBrush(RGB(255,255,255)); - StockObjects[DC_BRUSH] = IntGdiCreateSolidBrush(RGB(255,255,255)); - StockObjects[LTGRAY_BRUSH] = IntGdiCreateSolidBrush(RGB(192,192,192)); - StockObjects[GRAY_BRUSH] = IntGdiCreateSolidBrush(RGB(128,128,128)); - StockObjects[DKGRAY_BRUSH] = IntGdiCreateSolidBrush(RGB(64,64,64)); - StockObjects[BLACK_BRUSH] = IntGdiCreateSolidBrush(RGB(0,0,0)); - StockObjects[NULL_BRUSH] = IntGdiCreateNullBrush(); - - StockObjects[WHITE_PEN] = IntCreateStockPen(WhitePen.lopnStyle, WhitePen.lopnWidth.x, BS_SOLID, WhitePen.lopnColor); - StockObjects[BLACK_PEN] = IntCreateStockPen(BlackPen.lopnStyle, BlackPen.lopnWidth.x, BS_SOLID, BlackPen.lopnColor); - StockObjects[DC_PEN] = IntCreateStockPen(BlackPen.lopnStyle, BlackPen.lopnWidth.x, BS_SOLID, BlackPen.lopnColor); - StockObjects[NULL_PEN] = IntCreateStockPen(NullPen.lopnStyle, NullPen.lopnWidth.x, BS_SOLID, NullPen.lopnColor); - - StockObjects[20] = NULL; /* TODO: Unknown internal stock object */ - StockObjects[DEFAULT_BITMAP] = IntGdiCreateBitmap(1, 1, 1, 1, NULL); - - (void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]); - (void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]); - (void) TextIntCreateFontIndirect(&AnsiVarFont, (HFONT*)&StockObjects[ANSI_VAR_FONT]); - (void) TextIntCreateFontIndirect(&SystemFont, (HFONT*)&StockObjects[SYSTEM_FONT]); - (void) TextIntCreateFontIndirect(&DeviceDefaultFont, (HFONT*)&StockObjects[DEVICE_DEFAULT_FONT]); - (void) TextIntCreateFontIndirect(&SystemFixedFont, (HFONT*)&StockObjects[SYSTEM_FIXED_FONT]); - (void) TextIntCreateFontIndirect(&DefaultGuiFont, (HFONT*)&StockObjects[DEFAULT_GUI_FONT]); - - StockObjects[DEFAULT_PALETTE] = (HGDIOBJ)PALETTE_Init(); - - for (Object = 0; Object < NB_STOCK_OBJECTS; Object++) - { - if (NULL != StockObjects[Object]) - { - GDIOBJ_ConvertToStockObj(&StockObjects[Object]); - } - } - - DPRINT("Completed creation of stock objects\n"); + UINT Object; + + DPRINT("Beginning creation of stock objects\n"); + + /* Create GDI Stock Objects from the logical structures we've defined */ + + StockObjects[WHITE_BRUSH] = IntGdiCreateSolidBrush(RGB(255,255,255)); + StockObjects[DC_BRUSH] = IntGdiCreateSolidBrush(RGB(255,255,255)); + StockObjects[LTGRAY_BRUSH] = IntGdiCreateSolidBrush(RGB(192,192,192)); + StockObjects[GRAY_BRUSH] = IntGdiCreateSolidBrush(RGB(128,128,128)); + StockObjects[DKGRAY_BRUSH] = IntGdiCreateSolidBrush(RGB(64,64,64)); + StockObjects[BLACK_BRUSH] = IntGdiCreateSolidBrush(RGB(0,0,0)); + StockObjects[NULL_BRUSH] = IntGdiCreateNullBrush(); + + StockObjects[WHITE_PEN] = IntCreateStockPen(WhitePen.lopnStyle, WhitePen.lopnWidth.x, BS_SOLID, WhitePen.lopnColor); + StockObjects[BLACK_PEN] = IntCreateStockPen(BlackPen.lopnStyle, BlackPen.lopnWidth.x, BS_SOLID, BlackPen.lopnColor); + StockObjects[DC_PEN] = IntCreateStockPen(BlackPen.lopnStyle, BlackPen.lopnWidth.x, BS_SOLID, BlackPen.lopnColor); + StockObjects[NULL_PEN] = IntCreateStockPen(NullPen.lopnStyle, NullPen.lopnWidth.x, BS_SOLID, NullPen.lopnColor); + + StockObjects[20] = NULL; /* TODO: Unknown internal stock object */ + StockObjects[DEFAULT_BITMAP] = IntGdiCreateBitmap(1, 1, 1, 1, NULL); + + (void) TextIntCreateFontIndirect(&OEMFixedFont, (HFONT*)&StockObjects[OEM_FIXED_FONT]); + (void) TextIntCreateFontIndirect(&AnsiFixedFont, (HFONT*)&StockObjects[ANSI_FIXED_FONT]); + (void) TextIntCreateFontIndirect(&AnsiVarFont, (HFONT*)&StockObjects[ANSI_VAR_FONT]); + (void) TextIntCreateFontIndirect(&SystemFont, (HFONT*)&StockObjects[SYSTEM_FONT]); + (void) TextIntCreateFontIndirect(&DeviceDefaultFont, (HFONT*)&StockObjects[DEVICE_DEFAULT_FONT]); + (void) TextIntCreateFontIndirect(&SystemFixedFont, (HFONT*)&StockObjects[SYSTEM_FIXED_FONT]); + (void) TextIntCreateFontIndirect(&DefaultGuiFont, (HFONT*)&StockObjects[DEFAULT_GUI_FONT]); + + StockObjects[DEFAULT_PALETTE] = (HGDIOBJ)PALETTE_Init(); + + for (Object = 0; Object < NB_STOCK_OBJECTS; Object++) + { + if (NULL != StockObjects[Object]) + { + GDIOBJ_ConvertToStockObj(&StockObjects[Object]); + } + } + + DPRINT("Completed creation of stock objects\n"); } /*! @@ -204,150 +211,150 @@ HGDIOBJ APIENTRY NtGdiGetStockObject(INT Object) { - DPRINT("NtGdiGetStockObject index %d\n", Object); - - return ((Object < 0) || (NB_STOCK_OBJECTS <= Object)) ? NULL : StockObjects[Object]; + DPRINT("NtGdiGetStockObject index %d\n", Object); + + return ((Object < 0) || (NB_STOCK_OBJECTS <= Object)) ? NULL : StockObjects[Object]; } BOOL FASTCALL IntSetSysColors(UINT nColors, INT *Elements, COLORREF *Colors) { - UINT i; - - ASSERT(Elements); - ASSERT(Colors); - - for(i = 0; i < nColors; i++) - { - if((UINT)(*Elements) < NUM_SYSCOLORS) - { - gpsi->argbSystem[*Elements] = *Colors; - IntGdiSetSolidBrushColor(gpsi->ahbrSystem[*Elements], *Colors); - IntGdiSetSolidPenColor(gpsi->SysColorPens[*Elements], *Colors); - } - Elements++; - Colors++; - } - return nColors > 0; + UINT i; + + ASSERT(Elements); + ASSERT(Colors); + + for (i = 0; i < nColors; i++) + { + if ((UINT)(*Elements) < NUM_SYSCOLORS) + { + gpsi->argbSystem[*Elements] = *Colors; + IntGdiSetSolidBrushColor(gpsi->ahbrSystem[*Elements], *Colors); + IntGdiSetSolidPenColor(gpsi->SysColorPens[*Elements], *Colors); + } + Elements++; + Colors++; + } + return nColors > 0; } BOOL FASTCALL IntGetSysColorBrushes(HBRUSH *pahBrushes, UINT nBrushes) { - UINT i; - - ASSERT(pahBrushes); - - if(nBrushes > NUM_SYSCOLORS) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return FALSE; - } - - for(i = 0; i < nBrushes; i++) - { - pahBrushes[i] = gpsi->ahbrSystem[i]; - } - - return nBrushes > 0; + UINT i; + + ASSERT(pahBrushes); + + if (nBrushes > NUM_SYSCOLORS) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return FALSE; + } + + for (i = 0; i < nBrushes; i++) + { + pahBrushes[i] = gpsi->ahbrSystem[i]; + } + + return nBrushes > 0; } HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object) { - return ((Object < 0) || (NUM_SYSCOLORS <= Object)) ? NULL : gpsi->ahbrSystem[Object]; + return ((Object < 0) || (NUM_SYSCOLORS <= Object)) ? NULL : gpsi->ahbrSystem[Object]; } BOOL FASTCALL IntGetSysColorPens(HPEN *Pens, UINT nPens) { - UINT i; - - ASSERT(Pens); - - if(nPens > NUM_SYSCOLORS) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return FALSE; - } - - for(i = 0; i < nPens; i++) - { - *(Pens++) = gpsi->SysColorPens[i]; - } - - return nPens > 0; + UINT i; + + ASSERT(Pens); + + if (nPens > NUM_SYSCOLORS) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return FALSE; + } + + for (i = 0; i < nPens; i++) + { + *(Pens++) = gpsi->SysColorPens[i]; + } + + return nPens > 0; } BOOL FASTCALL IntGetSysColors(COLORREF *Colors, UINT nColors) { - UINT i; - COLORREF *col; - - ASSERT(Colors); - - if(nColors > NUM_SYSCOLORS) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return FALSE; - } - - col = &gpsi->argbSystem[0]; - for(i = 0; i < nColors; i++) - { - *(Colors++) = *(col++); - } - - return nColors > 0; + UINT i; + COLORREF *col; + + ASSERT(Colors); + + if (nColors > NUM_SYSCOLORS) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return FALSE; + } + + col = &gpsi->argbSystem[0]; + for (i = 0; i < nColors; i++) + { + *(Colors++) = *(col++); + } + + return nColors > 0; } DWORD FASTCALL IntGetSysColor(INT nIndex) { - return (NUM_SYSCOLORS <= (UINT)nIndex) ? 0 : gpsi->argbSystem[nIndex]; + return (NUM_SYSCOLORS <= (UINT)nIndex) ? 0 : gpsi->argbSystem[nIndex]; } VOID FASTCALL CreateSysColorObjects(VOID) { - UINT i; - LOGPEN Pen; - - for(i = 0; i < NUM_SYSCOLORS; i++) - { - gpsi->argbSystem[i] = SysColors[i]; - } - - /* Create the syscolor brushes */ - for(i = 0; i < NUM_SYSCOLORS; i++) - { - if(gpsi->ahbrSystem[i] == NULL) - { - gpsi->ahbrSystem[i] = IntGdiCreateSolidBrush(SysColors[i]); - if(gpsi->ahbrSystem[i] != NULL) - { - GDIOBJ_ConvertToStockObj((HGDIOBJ*)&gpsi->ahbrSystem[i]); - } - } - } - - /* Create the syscolor pens */ - Pen.lopnStyle = PS_SOLID; - Pen.lopnWidth.x = 0; - Pen.lopnWidth.y = 0; - for(i = 0; i < NUM_SYSCOLORS; i++) - { - if(gpsi->SysColorPens[i] == NULL) - { - Pen.lopnColor = SysColors[i]; - gpsi->SysColorPens[i] = IntCreateStockPen(Pen.lopnStyle, Pen.lopnWidth.x, BS_SOLID, Pen.lopnColor); - if(gpsi->SysColorPens[i] != NULL) - { - GDIOBJ_ConvertToStockObj((HGDIOBJ*)&gpsi->SysColorPens[i]); - } - } - } + UINT i; + LOGPEN Pen; + + for (i = 0; i < NUM_SYSCOLORS; i++) + { + gpsi->argbSystem[i] = SysColors[i]; + } + + /* Create the syscolor brushes */ + for (i = 0; i < NUM_SYSCOLORS; i++) + { + if (gpsi->ahbrSystem[i] == NULL) + { + gpsi->ahbrSystem[i] = IntGdiCreateSolidBrush(SysColors[i]); + if (gpsi->ahbrSystem[i] != NULL) + { + GDIOBJ_ConvertToStockObj((HGDIOBJ*)&gpsi->ahbrSystem[i]); + } + } + } + + /* Create the syscolor pens */ + Pen.lopnStyle = PS_SOLID; + Pen.lopnWidth.x = 0; + Pen.lopnWidth.y = 0; + for (i = 0; i < NUM_SYSCOLORS; i++) + { + if (gpsi->SysColorPens[i] == NULL) + { + Pen.lopnColor = SysColors[i]; + gpsi->SysColorPens[i] = IntCreateStockPen(Pen.lopnStyle, Pen.lopnWidth.x, BS_SOLID, Pen.lopnColor); + if (gpsi->SysColorPens[i] != NULL) + { + GDIOBJ_ConvertToStockObj((HGDIOBJ*)&gpsi->SysColorPens[i]); + } + } + } } /* EOF */
15 years, 5 months
1
0
0
0
[tkreuzer] 41652: Update SERVERINFO, PFNCLIENT, PFNCLIENTWORKER to Windows 7 version, add OEMBITMAPINFO, DPISERVERINFO, PERUSERSERVERINFO Add -fms-extensions compilerflag to user32, win32k, csrss, win32csr.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Jun 28 03:33:57 2009 New Revision: 41652 URL:
http://svn.reactos.org/svn/reactos?rev=41652&view=rev
Log: Update SERVERINFO, PFNCLIENT, PFNCLIENTWORKER to Windows 7 version, add OEMBITMAPINFO, DPISERVERINFO, PERUSERSERVERINFO Add -fms-extensions compilerflag to user32, win32k, csrss, win32csr. Modified: trunk/reactos/dll/win32/user32/misc/desktop.c trunk/reactos/dll/win32/user32/user32.rbuild trunk/reactos/dll/win32/user32/windows/defwnd.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/csrss/csrss.rbuild trunk/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild trunk/reactos/subsystems/win32/win32k/ntuser/metric.c trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c trunk/reactos/subsystems/win32/win32k/objects/stockobj.c trunk/reactos/subsystems/win32/win32k/win32k.rbuild Modified: trunk/reactos/dll/win32/user32/misc/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/desk…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/desktop.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/desktop.c [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -102,7 +102,7 @@ GetConnected(); // FIXME("Global Sever Data -> %x\n",g_psi); if (nIndex < 0 || nIndex >= SM_CMETRICS) return 0; - return g_psi->SystemMetrics[nIndex]; + return g_psi->aiSysMet[nIndex]; } Modified: trunk/reactos/dll/win32/user32/user32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/user32.rb…
============================================================================== --- trunk/reactos/dll/win32/user32/user32.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/user32.rbuild [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -11,7 +11,7 @@ <library>win32ksys</library> <library>pseh</library> <library>ntdll</library> - + <compilerflag compilerset="gcc">-fms-extensions</compilerflag> <!-- See
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38269
<directory name="include"> <pch>user32.h</pch> Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -63,7 +63,7 @@ { if(nIndex >= 0 && nIndex < NUM_SYSCOLORS) { - return g_psi->SysColors[nIndex]; + return g_psi->argbSystem[nIndex]; } SetLastError(ERROR_INVALID_PARAMETER); @@ -93,7 +93,7 @@ { if(nIndex >= 0 && nIndex < NUM_SYSCOLORS) { - return g_psi->SysColorBrushes[nIndex]; + return g_psi->ahbrSystem[nIndex]; } SetLastError(ERROR_INVALID_PARAMETER); Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -206,43 +206,51 @@ typedef struct _PFNCLIENT { - PROC pfnScrollBarC; - PROC pfnDefWndC; - PROC pfnMenuC; - PROC pfnDesktopC; - PROC pfnDefWnd1C; - PROC pfnDefWnd2C; - PROC pfnDefWnd3C; - PROC pfnButtomC; - PROC pfnComboBoxC; - PROC pfnComboListBoxC; - PROC pfnDefDlgC; - PROC pfnEditC; - PROC pfnListBoxC; - PROC pfnMDIClientC; - PROC pfnStaticC; - PROC pfnImeC; - PROC pfnHkINLPCWPSTRUCT; - PROC pfnHkINLPCWPRETSTRUCT; - PROC pfnDispatchHookC; - PROC pfnDispatchDefC; + WNDPROC pfnScrollBarWndProc; + WNDPROC pfnTitleWndProc; + WNDPROC pfnMenuWndProc; + WNDPROC pfnDesktopWndProc; + WNDPROC pfnDefWindowProc; + WNDPROC pfnMessageWindowProc; + WNDPROC pfnSwitchWindowProc; + WNDPROC pfnButtonWndProc; + WNDPROC pfnComboBoxWndProc; + WNDPROC pfnComboListBoxProc; + WNDPROC pfnDialogWndProc; + WNDPROC pfnEditWndProc; + WNDPROC pfnListBoxWndProc; + WNDPROC pfnMDIClientWndProc; + WNDPROC pfnStaticWndProc; + WNDPROC pfnImeWndProc; + WNDPROC pfnGhostWndProc; + WNDPROC pfnHkINLPCWPSTRUCT; + WNDPROC pfnHkINLPCWPRETSTRUCT; + WNDPROC pfnDispatchHook; + WNDPROC pfnDispatchDefWindowProc; + WNDPROC pfnDispatchMessage; + WNDPROC pfnMDIActivateDlgProc; } PFNCLIENT, *PPFNCLIENT; typedef struct _PFNCLIENTWORKER { - PROC pfnButtonCW; - PROC pfnComboBoxCW; - PROC pfnComboListBoxCW; - PROC pfnDefDlgCW; - PROC pfnEditCW; - PROC pfnListBoxCW; - PROC pfnMDIClientCW; - PROC pfnStaticCW; - PROC pfnImeCW; + WNDPROC pfnButtonWndProc; + WNDPROC pfnComboBoxWndProc; + WNDPROC pfnComboListBoxProc; + WNDPROC pfnDialogWndProc; + WNDPROC pfnEditWndProc; + WNDPROC pfnListBoxWndProc; + WNDPROC pfnMDIClientWndProc; + WNDPROC pfnStaticWndProc; + WNDPROC pfnImeWndProc; + WNDPROC pfnGhostWndProc; + WNDPROC pfnCtfHookProc; } PFNCLIENTWORKER, *PPFNCLIENTWORKER; +struct _WND; +typedef LONG_PTR (NTAPI *PFN_FNID)(struct _WND*, UINT, WPARAM, LPARAM, ULONG_PTR); // FNID's for NtUserSetWindowFNID, NtUserMessageCall +#define FNID_FIRST 0x029A #define FNID_SCROLLBAR 0x029A #define FNID_ICONTITLE 0x029B #define FNID_MENU 0x029C @@ -269,8 +277,10 @@ #define FNID_UNKNOWN 0x02B6 #define FNID_SENDNOTIFYMESSAGE 0x02B7 #define FNID_SENDMESSAGECALLBACK 0x02B8 - - +#define FNID_LAST 0x02B9 + +#define FNID_NUM FNID_LAST - FNID_FIRST + 1 + #define FNID_DDEML 0x2000 // Registers DDEML #define FNID_DESTROY 0x4000 // This is sent when WM_NCDESTROY or in the support routine. // Seen during WM_CREATE on error exit too. @@ -302,37 +312,106 @@ #define ICLS_NOTUSED 23 #define ICLS_END 31 +#define COLOR_LAST COLOR_MENUBAR +#define MAX_MB_STRINGS 11 + #define SRVINFO_METRICS 0x0020 -typedef struct _SERVERINFO -{ - DWORD SRVINFO_Flags; - DWORD SystemMetrics[SM_CMETRICS]; // System Metrics - COLORREF SysColors[COLOR_MENUBAR+1]; // GetSysColor - HBRUSH SysColorBrushes[COLOR_MENUBAR+1]; // GetSysColorBrush - HPEN SysColorPens[COLOR_MENUBAR+1]; // ReactOS exclusive - HBRUSH hbrGray; - POINTL ptCursor; - // - DWORD cxSysFontChar; - DWORD cySysFontChar; - DWORD cxMsgFontChar; - DWORD cyMsgFontChar; - TEXTMETRICW tmSysFont; - // - RECTL rcScreen; - WORD BitCount; - WORD dmLogPixels; - BYTE BitsPixel; - BYTE Planes; - WORD reserved; - DWORD PUSIFlags; // PERUSERSERVERINFO Flags. - ULONG uCaretWidth; - LANGID UILangID; - UINT LastRITWasKeyboard : 1; - UINT bKeyboardPref : 1; - DWORD TimeTick; - DWORD SrvEventActivity; +typedef struct tagOEMBITMAPINFO +{ + INT x; + INT y; + INT cx; + INT cy; +} OEMBITMAPINFO, *POEMBITMAPINFO; + +typedef struct tagMBSTRING +{ + WCHAR szName[15]; + UINT uID; + UINT uStr; +} MBSTRING, *PMBSTRING; + +typedef struct tagDPISERVERINFO +{ + INT gclBorder; /* 000 */ + HFONT hCaptionFont; /* 004 */ + HFONT hMsgFont; /* 008 */ + INT cxMsgFontChar; /* 00C */ + INT cyMsgFontChar; /* 010 */ + UINT wMaxBtnSize; /* 014 */ +} DPISERVERINFO, *PDPISERVERINFO; + +typedef struct _PERUSERSERVERINFO +{ + INT aiSysMet[SM_CMETRICS]; + ULONG argbSystemUnmatched[COLOR_LAST+1]; + COLORREF argbSystem[COLOR_LAST+1]; + HBRUSH ahbrSystem[COLOR_LAST+1]; + HBRUSH hbrGray; + POINT ptCursor; + POINT ptCursorReal; + DWORD dwLastRITEventTickCount; + INT nEvents; + UINT dtScroll; + UINT dtLBSearch; + UINT dtCaretBlink; + UINT ucWheelScrollLines; + UINT ucWheelScrollChars; + INT wMaxLeftOverlapChars; + INT wMaxRightOverlapChars; + INT cxSysFontChar; + INT cySysFontChar; + TEXTMETRICW tmSysFont; + DPISERVERINFO dpiSystem; + HICON hIconSmWindows; + HICON hIcoWindows; + DWORD dwKeyCache; + DWORD dwAsyncKeyCache; + ULONG cCaptures; + OEMBITMAPINFO oembmi[93]; + RECT rcScreenReal; + USHORT BitCount; + USHORT dmLogPixels; + BYTE Planes; + BYTE BitsPixel; + ULONG PUSIFlags; + UINT uCaretWidth; + USHORT UILangID; + DWORD dwLastSystemRITEventTickCountUpdate; + ULONG adwDBGTAGFlags[35]; + DWORD dwTagCount; + DWORD dwRIPFlags; +} PERUSERSERVERINFO, *PPERUSERSERVERINFO; + +typedef struct tagSERVERINFO +{ + DWORD dwSRVIFlags; + ULONG_PTR cHandleEntries; + PFN_FNID mpFnidPfn[FNID_NUM]; +// WNDPROC aStoCidPfn[7]; +// USHORT mpFnid_serverCBWndProc[31]; + PFNCLIENT apfnClientA; + PFNCLIENT apfnClientW; + PFNCLIENTWORKER apfnClientWorker; + ULONG cbHandleTable; + ATOM atomSysClass[ICLS_NOTUSED+1]; + DWORD dwDefaultHeapBase; + DWORD dwDefaultHeapSize; + UINT uiShellMsg; + MBSTRING MBStrings[MAX_MB_STRINGS]; + ATOM atomIconSmProp; + ATOM atomIconProp; + ATOM atomContextHelpIdProp; + ATOM atomFrostedWindowProp; + CHAR acOemToAnsi[256]; + CHAR acAnsiToOem[256]; + DWORD dwInstalledEventHooks; + PERUSERSERVERINFO; +/////////////////////////////// + /* Reactos specific fields */ + DWORD SrvEventActivity; + HPEN SysColorPens[COLOR_MENUBAR+1]; } SERVERINFO, *PSERVERINFO; #define CTI_INSENDMESSAGE 0x0002 @@ -407,7 +486,7 @@ MSG msgDbcsCB; ULONG Win32ClientInfo3[28]; /* It's just a pointer reference not to be used w the structure in user space. */ - PPROCESSINFO ppi; + PPROCESSINFO ppi; } CLIENTINFO, *PCLIENTINFO; /* Make sure it fits exactly into the TEB */ @@ -444,7 +523,7 @@ DWORD recipients; HDESK hDesk; HWND hWnd; - LUID luid; + LUID luid; } BROADCASTPARM, *PBROADCASTPARM; PW32THREADINFO GetW32ThreadInfo(VOID); @@ -1774,7 +1853,7 @@ NTSTATUS NTAPI NtUserInitializeClientPfnArrays( - PPFNCLIENT pfnClientA, + PPFNCLIENT pfnClientA, PPFNCLIENT pfnClientW, PPFNCLIENTWORKER pfnClientWorker, HINSTANCE hmodUser); Modified: trunk/reactos/subsystems/win32/csrss/csrss.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrss.rbuild [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrss.rbuild [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -6,6 +6,7 @@ <include base="csrss">include</include> <include base="ReactOS">include/reactos/subsys</include> <include base="ReactOS">include/reactos/drivers</include> + <compilerflag compilerset="gcc">-fms-extensions</compilerflag> <library>nt</library> <library>ntdll</library> <library>smdll</library> Modified: trunk/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -7,6 +7,7 @@ <include base="ReactOS">include/reactos/subsys</include> <include base="ReactOS">include/reactos/drivers</include> <include base="console">.</include> + <compilerflag compilerset="gcc">-fms-extensions</compilerflag> <library>ntdll</library> <library>kernel32</library> <library>user32</library> Modified: trunk/reactos/subsystems/win32/win32k/ntuser/metric.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/metric.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/metric.c [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -45,7 +45,7 @@ CurInfo = NULL; } - piSysMet = (INT*)gpsi->SystemMetrics; + piSysMet = gpsi->aiSysMet; /* Screen sizes */ piSysMet[SM_CXSCREEN] = Width; @@ -172,7 +172,7 @@ piSysMet[90] = 0; #endif - gpsi->SRVINFO_Flags |= SRVINFO_METRICS; + gpsi->dwSRVIFlags |= SRVINFO_METRICS; Setup = TRUE; if (NT_SUCCESS(Status)) @@ -193,7 +193,7 @@ /* Get metrics from array */ if (Index < SM_CMETRICS) { - return gpsi->SystemMetrics[Index]; + return gpsi->aiSysMet[Index]; } /* Handle special values */ Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -232,7 +232,7 @@ Result = gspv.bMouseBtnSwap; gspv.bMouseBtnSwap = Param ? TRUE : FALSE; - gpsi->SystemMetrics[SM_SWAPBUTTON] = gspv.bMouseBtnSwap; + gpsi->aiSysMet[SM_SWAPBUTTON] = gspv.bMouseBtnSwap; RETURN(Result); } Modified: trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -857,8 +857,8 @@ /* Verify the new values */ if (rcWorkArea.left < 0 || rcWorkArea.top < 0 || - rcWorkArea.right > gpsi->SystemMetrics[SM_CXSCREEN] || - rcWorkArea.bottom > gpsi->SystemMetrics[SM_CYSCREEN] || + rcWorkArea.right > gpsi->aiSysMet[SM_CXSCREEN] || + rcWorkArea.bottom > gpsi->aiSysMet[SM_CYSCREEN] || rcWorkArea.right <= rcWorkArea.left || rcWorkArea.bottom <= rcWorkArea.top) return 0; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -322,7 +322,7 @@ gpsi->BitCount = gpsi->Planes * gpsi->BitsPixel; gpsi->dmLogPixels = NtGdiGetDeviceCaps(ScreenDeviceContext, LOGPIXELSY); // Font is realized and this dc was previously set to internal DC_ATTR. - gpsi->cxSysFontChar = IntGetCharDimensions(hSystemBM, &tmw, &gpsi->cySysFontChar); + gpsi->cxSysFontChar = IntGetCharDimensions(hSystemBM, &tmw, (DWORD*)&gpsi->cySysFontChar); gpsi->tmSysFont = tmw; return TRUE; Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -28,7 +28,7 @@ #include <debug.h> -static COLORREF SysColors[] = +static const COLORREF SysColors[] = { RGB(212, 208, 200), /* COLOR_SCROLLBAR */ RGB(58, 110, 165), /* COLOR_BACKGROUND */ @@ -221,8 +221,8 @@ { if((UINT)(*Elements) < NUM_SYSCOLORS) { - gpsi->SysColors[*Elements] = *Colors; - IntGdiSetSolidBrushColor(gpsi->SysColorBrushes[*Elements], *Colors); + gpsi->argbSystem[*Elements] = *Colors; + IntGdiSetSolidBrushColor(gpsi->ahbrSystem[*Elements], *Colors); IntGdiSetSolidPenColor(gpsi->SysColorPens[*Elements], *Colors); } Elements++; @@ -246,7 +246,7 @@ for(i = 0; i < nBrushes; i++) { - pahBrushes[i] = gpsi->SysColorBrushes[i]; + pahBrushes[i] = gpsi->ahbrSystem[i]; } return nBrushes > 0; @@ -255,7 +255,7 @@ HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object) { - return ((Object < 0) || (NUM_SYSCOLORS <= Object)) ? NULL : gpsi->SysColorBrushes[Object]; + return ((Object < 0) || (NUM_SYSCOLORS <= Object)) ? NULL : gpsi->ahbrSystem[Object]; } BOOL FASTCALL @@ -293,7 +293,7 @@ return FALSE; } - col = &gpsi->SysColors[0]; + col = &gpsi->argbSystem[0]; for(i = 0; i < nColors; i++) { *(Colors++) = *(col++); @@ -305,7 +305,7 @@ DWORD FASTCALL IntGetSysColor(INT nIndex) { - return (NUM_SYSCOLORS <= (UINT)nIndex) ? 0 : gpsi->SysColors[nIndex]; + return (NUM_SYSCOLORS <= (UINT)nIndex) ? 0 : gpsi->argbSystem[nIndex]; } VOID FASTCALL @@ -316,18 +316,18 @@ for(i = 0; i < NUM_SYSCOLORS; i++) { - gpsi->SysColors[i] = SysColors[i]; + gpsi->argbSystem[i] = SysColors[i]; } /* Create the syscolor brushes */ for(i = 0; i < NUM_SYSCOLORS; i++) { - if(gpsi->SysColorBrushes[i] == NULL) + if(gpsi->ahbrSystem[i] == NULL) { - gpsi->SysColorBrushes[i] = IntGdiCreateSolidBrush(SysColors[i]); - if(gpsi->SysColorBrushes[i] != NULL) + gpsi->ahbrSystem[i] = IntGdiCreateSolidBrush(SysColors[i]); + if(gpsi->ahbrSystem[i] != NULL) { - GDIOBJ_ConvertToStockObj((HGDIOBJ*)&gpsi->SysColorBrushes[i]); + GDIOBJ_ConvertToStockObj((HGDIOBJ*)&gpsi->ahbrSystem[i]); } } } Modified: trunk/reactos/subsystems/win32/win32k/win32k.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/wi…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] Sun Jun 28 03:33:57 2009 @@ -9,6 +9,7 @@ <include base="freetype">include</include> <include base="ReactOS">include/reactos/subsys</include> <include base="ReactOS">include/reactos/drivers</include> + <compilerflag compilerset="gcc">-fms-extensions</compilerflag> <define name="LANGPACK" /> <define name="_WIN32K_" /> <!-- See
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38269
15 years, 5 months
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
50
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Results per page:
10
25
50
100
200