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
November 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
23 participants
444 discussions
Start a n
N
ew thread
[fireball] 44116: [Unused ReactOS setup] - Move duplicate code from LoadSetupData to a separate function - Fix a bug on line 1054 of the original file: SetupData.LangCount should be SetupData.KbLayoutCount (copy-paste mistake). This would have probably gone unnoticed if SetupData.LangCount > SetupData.KbLayoutCount due to other end of section checking. - Based on a patch from bug 4933.
by fireball@svn.reactos.org
Author: fireball Date: Thu Nov 12 13:35:01 2009 New Revision: 44116 URL:
http://svn.reactos.org/svn/reactos?rev=44116&view=rev
Log: [Unused ReactOS setup] - Move duplicate code from LoadSetupData to a separate function - Fix a bug on line 1054 of the original file: SetupData.LangCount should be SetupData.KbLayoutCount (copy-paste mistake). This would have probably gone unnoticed if SetupData.LangCount > SetupData.KbLayoutCount due to other end of section checking. - Based on a patch from bug 4933. Modified: trunk/reactos/base/setup/reactos/reactos.c Modified: trunk/reactos/base/setup/reactos/reactos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/reactos/reactos…
============================================================================== --- trunk/reactos/base/setup/reactos/reactos.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/reactos/reactos.c [iso-8859-1] Thu Nov 12 13:35:01 2009 @@ -103,6 +103,8 @@ HINSTANCE hInstance; BOOL isUnattend; +LONG LoadGenentry(HINF hinf,PCTSTR name,PGENENTRY gen,PINFCONTEXT context); + /* FUNCTIONS ****************************************************************/ static VOID @@ -995,13 +997,12 @@ if (hTxtsetupSif != INVALID_HANDLE_VALUE) { // get language list - Count = SetupGetLineCount(hTxtsetupSif, _T("Language")); - if (Count > 0) - { - SetupData.pLanguages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LANG) * Count); + SetupData.LangCount = SetupGetLineCount(hTxtsetupSif, _T("Language")); + if (SetupData.LangCount > 0) + { + SetupData.pLanguages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LANG) * SetupData.LangCount); if (SetupData.pLanguages != NULL) { - SetupData.LangCount = Count; Count = 0; if (SetupFindFirstLine(hTxtsetupSif, _T("Language"), NULL, &InfContext)) { @@ -1020,19 +1021,18 @@ &LineLength); ++Count; } - while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.LangCount); + while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.LangCount); } } } // get keyboard layout list - Count = SetupGetLineCount(hTxtsetupSif, _T("KeyboardLayout")); - if (Count > 0) - { - SetupData.pKbLayouts = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(KBLAYOUT) * Count); + SetupData.KbLayoutCount = SetupGetLineCount(hTxtsetupSif, _T("KeyboardLayout")); + if (SetupData.KbLayoutCount > 0) + { + SetupData.pKbLayouts = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(KBLAYOUT) * SetupData.KbLayoutCount); if (SetupData.pKbLayouts != NULL) { - SetupData.KbLayoutCount = Count; Count = 0; if (SetupFindFirstLine(hTxtsetupSif, _T("KeyboardLayout"), NULL, &InfContext)) { @@ -1051,7 +1051,7 @@ &LineLength); ++Count; } - while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.LangCount); + while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.KbLayoutCount); } } } @@ -1084,99 +1084,13 @@ } // get computers list - Count = SetupGetLineCount(hTxtsetupSif, _T("Computer")); - if (Count > 0) - { - SetupData.pComputers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); - if (SetupData.pComputers != NULL) - { - SetupData.CompCount = Count; - Count = 0; - if (SetupFindFirstLine(hTxtsetupSif, _T("Computer"), NULL, &InfContext)) - { - do - { - SetupGetStringField(&InfContext, - 0, - SetupData.pComputers[Count].Id, - sizeof(SetupData.pComputers[Count].Id) / sizeof(TCHAR), - &LineLength); - - SetupGetStringField(&InfContext, - 1, - SetupData.pComputers[Count].Value, - sizeof(SetupData.pComputers[Count].Value) / sizeof(TCHAR), - &LineLength); - ++Count; - } - while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.CompCount); - } - } - } + SetupData.CompCount = LoadGenentry(hTxtsetupSif,_T("Computer"),SetupData.pComputers,&InfContext); // get display list - Count = SetupGetLineCount(hTxtsetupSif, _T("Display")); - if (Count > 0) - { - SetupData.pDisplays = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); - if (SetupData.pDisplays != NULL) - { - SetupData.DispCount = Count; - Count = 0; - - if (SetupFindFirstLine(hTxtsetupSif, _T("Display"), NULL, &InfContext)) - { - do - { - SetupGetStringField(&InfContext, - 0, - SetupData.pDisplays[Count].Id, - sizeof(SetupData.pDisplays[Count].Id) / sizeof(TCHAR), - &LineLength); - - SetupGetStringField(&InfContext, - 1, - SetupData.pDisplays[Count].Value, - sizeof(SetupData.pDisplays[Count].Value) / sizeof(TCHAR), - &LineLength); - ++Count; - } - while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.DispCount); - } - } - } + SetupData.DispCount = LoadGenentry(hTxtsetupSif,_T("Display"),SetupData.pDisplays,&InfContext); // get keyboard list - Count = SetupGetLineCount(hTxtsetupSif, _T("Keyboard")); - if (Count > 0) - { - SetupData.pKeyboards = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); - if (SetupData.pKeyboards != NULL) - { - SetupData.KeybCount = Count; - Count = 0; - - if (SetupFindFirstLine(hTxtsetupSif, _T("Keyboard"), NULL, &InfContext)) - { - do - { - SetupGetStringField(&InfContext, - 0, - SetupData.pKeyboards[Count].Id, - sizeof(SetupData.pKeyboards[Count].Id) / sizeof(TCHAR), - &LineLength); - - SetupGetStringField(&InfContext, - 1, - SetupData.pKeyboards[Count].Value, - sizeof(SetupData.pKeyboards[Count].Value) / sizeof(TCHAR), - &LineLength); - ++Count; - } - while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.KeybCount); - } - } - } + SetupData.KeybCount = LoadGenentry(hTxtsetupSif, _T("Keyboard"),SetupData.pKeyboards,&InfContext); // get install directory if (SetupFindFirstLine(hTxtsetupSif, _T("SetupData"), _T("DefaultPath"), &InfContext)) @@ -1189,6 +1103,42 @@ } SetupCloseInfFile(hTxtsetupSif); } +} + +LONG LoadGenentry(HINF hinf,PCTSTR name,PGENENTRY gen,PINFCONTEXT context) +{ + LONG TotalCount; + + TotalCount = SetupGetLineCount(hinf, name); + if (TotalCount > 0) + { + gen = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * TotalCount); + if (gen != NULL) + { + if (SetupFindFirstLine(hinf, name, NULL, context)) + { + LONG Count = 0; + do + { + SetupGetStringField(context, + 0, + gen[Count].Id, + sizeof(gen[Count].Id) / sizeof(TCHAR), + NULL); + + SetupGetStringField(context, + 1, + gen[Count].Value, + sizeof(gen[Count].Value) / sizeof(TCHAR), + NULL); + Count++; + } + while (SetupFindNextLine(context, context) && Count < TotalCount); + } + } + } + + return TotalCount; } BOOL isUnattendSetup()
15 years, 1 month
1
0
0
0
[sginsberg] 44115: - Add inital support for PCI and ISA interrupts. - Use different register allocation to be more efficient on certain systems. - Add tables and initial code for Lazy IRQL support.
by sginsberg@svn.reactos.org
Author: sginsberg Date: Wed Nov 11 23:29:16 2009 New Revision: 44115 URL:
http://svn.reactos.org/svn/reactos?rev=44115&view=rev
Log: - Add inital support for PCI and ISA interrupts. - Use different register allocation to be more efficient on certain systems. - Add tables and initial code for Lazy IRQL support. Modified: trunk/reactos/hal/halx86/generic/irq.S trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S Modified: trunk/reactos/hal/halx86/generic/irq.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/irq.S?r…
============================================================================== --- trunk/reactos/hal/halx86/generic/irq.S [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/irq.S [iso-8859-1] Wed Nov 11 23:29:16 2009 @@ -69,25 +69,73 @@ .long 0xFFFFFFFB /* IRQL 30 */ .long 0xFFFFFFFB /* IRQL 31 */ -HalpSysIntHandler: -.rept 7 +FindHigherIrqlMask: + .long 0xFFFFFFFE /* IRQL 0 */ + .long 0xFFFFFFFC /* IRQL 1 */ + .long 0xFFFFFFF8 /* IRQL 2 */ + .long 0xFFFFFFF0 /* IRQL 3 */ + .long 0x7FFFFF0 /* IRQL 4 */ + .long 0x3FFFFF0 /* IRQL 5 */ + .long 0x1FFFFF0 /* IRQL 6 */ + .long 0x0FFFFF0 /* IRQL 7 */ + .long 0x7FFFF0 /* IRQL 8 */ + .long 0x3FFFF0 /* IRQL 9 */ + .long 0x1FFFF0 /* IRQL 10 */ + .long 0x0FFFF0 /* IRQL 11 */ + .long 0x7FFF0 /* IRQL 12 */ + .long 0x3FFF0 /* IRQL 13 */ + .long 0x1FFF0 /* IRQL 14 */ + .long 0x0FFF0 /* IRQL 15 */ + .long 0x7FF0 /* IRQL 16 */ + .long 0x3FF0 /* IRQL 17 */ + .long 0x1FF0 /* IRQL 18 */ + .long 0x1FF0 /* IRQL 19 */ + .long 0x17F0 /* IRQL 20 */ + .long 0x13F0 /* IRQL 21 */ + .long 0x11F0 /* IRQL 22 */ + .long 0x10F0 /* IRQL 23 */ + .long 0x1070 /* IRQL 24 */ + .long 0x1030 /* IRQL 25 */ + .long 0x1010 /* IRQL 26 */ + .long 0x10 /* IRQL 27 */ + .long 0 /* IRQL 28 */ + .long 0 /* IRQL 29 */ + .long 0 /* IRQL 30 */ + .long 0 /* IRQL 31 */ + +HalpSpecialDismissTable: + .rept 7 .long GenericIRQ /* IRQ 0-7 */ -.endr + .endr .long IRQ7 /* IRQ 7 */ -.rept 7 - .long GenericIRQ /* IRQ 8-15 */ -.endr + .rept 5 + .long GenericIRQ /* IRQ 8-12 */ + .endr + .long IRQ13 /* IRQ 13 */ + .long GenericIRQ /* IRQ 14 */ .long IRQ15 /* IRQ 15 */ -.rept 20 + .rept 20 .long GenericIRQ /* IRQ 16-35 */ -.endr + .endr #if DBG .rept 172 .long InvalidIRQ /* IRQ 36-207 */ .endr #endif -SoftIntByteTable: +HalpSpecialDismissLevelTable: + .rept 7 + .long GenericIRQLevel /* IRQ 0-7 */ + .endr + .long IRQ7Level /* IRQ 7 */ + .rept 5 + .long GenericIRQLevel /* IRQ 8-12 */ + .endr + .long IRQ13Level /* IRQ 13 */ + .long GenericIRQLevel /* IRQ 14 */ + .long IRQ15Level /* IRQ 15 */ + +SWInterruptLookUpTable: .byte PASSIVE_LEVEL /* IRR 0 */ .byte PASSIVE_LEVEL /* IRR 1 */ .byte APC_LEVEL /* IRR 2 */ @@ -97,12 +145,12 @@ .byte DISPATCH_LEVEL /* IRR 6 */ .byte DISPATCH_LEVEL /* IRR 7 */ -SoftIntHandlerTable: +SWInterruptHandlerTable: .long _KiUnexpectedInterrupt /* PASSIVE_LEVEL */ .long _HalpApcInterrupt /* APC_LEVEL */ .long _HalpDispatchInterrupt /* DISPATCH_LEVEL */ -SoftIntHandlerTable2: +SWInterruptHandlerTable2: .long _KiUnexpectedInterrupt /* PASSIVE_LEVEL */ .long _HalpApcInterrupt2ndEntry /* APC_LEVEL */ .long _HalpDispatchInterrupt2ndEntry /* DISPATCH_LEVEL */ @@ -111,6 +159,39 @@ .asciz "\n\x7\x7!!! Unhandled or Unexpected Code at line: %lx!!!\n" /* FUNCTIONS *****************************************************************/ + +/* HAL interrupt handlers */ +GENERATE_HAL_INT_HANDLERS + +.globl _HalpHardwareInterruptLevel +.func HalpHardwareInterruptLevel +_HalpHardwareInterruptLevel: + + /* Get IRQL and check for pending interrupts */ + mov eax, PCR[KPCR_IRQL] + mov ecx, PCR[KPCR_IRR] + and ecx, FindHigherIrqlMask[eax*4] + jz NothingHardware + + /* Check the active IRR */ + test dword ptr PCR[KPCR_IRR_ACTIVE], 0xFFFFFFF0 + jnz NothingHardware + + /* Check for pending software interrupts */ + mov eax, ecx + bsr ecx, eax + mov eax, 1 + shl eax, cl + + /* Clear IRR */ + xor PCR[KPCR_IRR], eax + + /* Now dispatch the interrupt */ + call SWInterruptHandlerTable[ecx*4] + +NothingHardware: + ret +.endfunc .globl _HalpInitPICs@0 .func HalpInitPICs@0 @@ -150,7 +231,23 @@ cmp ax, 0 jnz InitLoop - /* Restore interrupts and return */ + /* Read EISA Edge/Level Register */ + mov edx, 0x4D1 + in al, dx + mov ah, al + dec edx + in al, dx + + /* Clear reserved bits and see if there's anything there */ + and eax, 0xDEF8 + cmp eax, 0xDEF8 + jz NoEisa + + /* FIXME */ + //UNHANDLED_PATH + +/* Restore interrupts and return */ +NoEisa: popf pop esi ret @@ -192,12 +289,12 @@ /* Get highest pending software interrupt and check if it's higher */ xor edx, edx - mov dl, SoftIntByteTable[eax] + mov dl, SWInterruptLookUpTable[eax] cmp dl, cl jbe AfterCall /* Call the pending interrupt */ - call SoftIntHandlerTable[edx*4] + call SWInterruptHandlerTable[edx*4] AfterCall: @@ -249,38 +346,53 @@ cmp ecx, CLOCK2_LEVEL jnb Invalid - /* Get the current PCI Edge/Level control registers */ - mov edx, 0x4D1 - in al, dx - shl ax, 8 - mov edx, 0x4D0 - in al, dx - mov dx, 1 - shl dx, cl - and dx, 0xDEF8 - - /* Check if this is a latched interrupt */ - cmp dword ptr [esp+12], 0 +#if 0 + /* Is PCI IRQ Routing enabled? */ + cmp byte ptr _HalpIrqMiniportInitialized, 0 + jz NoMiniport + + /* UNHANDLED */ + UNHANDLED_PATH + +NoMiniport: + /* Check if this is an EISA IRQ */ + bt _HalpEisaIrqIgnore, ecx + jb IgnoredIrq + + /* Clear the EISA Edge/Level Control Register */ + btr _HalpEisaELCR, ecx + + /* Get the interrupt type */ + mov al, [esp+12] + cmp al, 0 jnz Latched - /* Use OR for edge interrupt */ - or ax, dx - jmp AfterMask + /* Check the register again */ + bt _HalpEisaELCR, ecx + jb Dismiss + + /* Check if the miniport is active */ + cmp byte ptr _HalpIrqMiniportInitialized, 0 + jz Dismiss + + /* Update the EISA Edge/Level Control Register */ + bts _HalpEisaELCR, ecx + +Dismiss: + /* Use the level hardware interrupt handler */ + mov dword ptr SWInterruptHandlerTableHardware[ecx*4], offset _HalpHardwareInterruptLevel + mov edx, HalpSpecialDismissLevelTable[ecx*4] + mov HalpSpecialDismissTable[ecx*4], edx + Latched: - - /* Mask it out for level interrupt */ - not dx - and ax, dx - -AfterMask: - - /* Set the PCI Edge/Level control registers */ - mov edx, 0x4D0 - out dx, al - shr ax, 8 - mov edx, 0x4D1 - out dx, al - + /* Is PCI IRQ Routing enabled? */ + cmp byte ptr _HalpIrqMiniportInitialized, 0 + jz IgnoredIrq + + /* UNHANDLED */ + UNHANDLED_PATH +#endif +IgnoredIrq: /* Calculate the new IDR */ mov eax, 1 shl eax, cl @@ -316,9 +428,10 @@ _HalBeginSystemInterrupt@12: /* Convert to IRQ and call the handler */ - movzx ebx, byte ptr [esp+8] - sub ebx, PRIMARY_VECTOR_BASE - jmp HalpSysIntHandler[ebx*4] + xor ecx, ecx + mov cl, byte ptr [esp+8] + sub ecx, PRIMARY_VECTOR_BASE + jmp HalpSpecialDismissTable[ecx*4] IRQ15: /* This is IRQ 15, check if it's spurious */ @@ -330,6 +443,7 @@ jnz GenericIRQ /* Cascaded interrupt... dismiss it and return FALSE */ +CascadedInterrupt: mov al, 0x62 out 0x20, al mov eax, 0 @@ -348,15 +462,21 @@ mov eax, 0 ret 12 +IRQ13: + /* AT 80287 latch clear */ + xor al, al + out 0xF0, al + GenericIRQ: - /* Return the current IRQL */ - mov eax, [esp+12] - mov ecx, PCR[KPCR_IRQL] - mov [eax], cl - - /* Set the new IRQL */ - movzx eax, byte ptr [esp+4] + /* Get current and new IRQL */ + xor eax, eax + mov al, byte ptr [esp+4] + mov ebx, PCR[KPCR_IRQL] + + /* Set and save old */ mov PCR[KPCR_IRQL], eax + mov edx, [esp+12] + mov [edx], bl /* Set IRQ mask in the PIC */ mov eax, KiI8259MaskTable[eax*4] @@ -366,14 +486,18 @@ out 0xA1, al /* Check to which PIC the EOI was sent */ - mov eax, ebx + mov eax, ecx cmp eax, 8 jnb Pic1 /* Write mask to master PIC */ or al, 0x60 out 0x20, al - jmp DoneBegin + + /* Enable interrupts and return TRUE */ + sti + mov eax, 1 + ret 12 Pic1: /* Write mask to slave PIC */ @@ -382,9 +506,7 @@ mov al, 0x62 out 0x20, al -DoneBegin: /* Enable interrupts and return TRUE */ - in al, 0x21 sti mov eax, 1 ret 12 @@ -397,12 +519,111 @@ #endif .endfunc +IRQ15Level: + /* This is IRQ 15, check if it's spurious */ + mov al, 0xB + out 0xA0, al + jmp $+2 + in al, 0xA0 + test al, 0x80 + jnz GenericIRQLevel + jmp CascadedInterrupt + +IRQ7Level: + /* This is IRQ 7, check if it's spurious */ + mov al, 0xB + out 0x20, al + jmp $+2 + in al, 0x20 + test al, 0x80 + jnz GenericIRQLevel + + /* It is, return FALSE */ +SpuriousInterrupt: + mov eax, 0 + ret 12 + +IRQ13Level: + /* AT 80287 latch clear */ + xor al, al + out 0xF0, al + +GenericIRQLevel: + /* Save IRQL */ + xor eax, eax + mov al, [esp+4] + + /* Set IRQ mask in the PIC */ + mov eax, KiI8259MaskTable[eax*4] + or eax, PCR[KPCR_IDR] + out 0x21, al + shr eax, 8 + out 0xA1, al + + /* Compute new IRR */ + mov eax, ecx + mov ebx, 1 + add ecx, 4 + shl ebx, cl + or PCR[KPCR_IRR], ebx + + /* Get IRQLs */ + mov cl, [esp+4] + mov bl, PCR[KPCR_IRQL] + mov edx, [esp+12] + + /* Check to which PIC the EOI was sent */ + cmp eax, 8 + jnb Pic1Level + + /* Write mask to master PIC */ + or al, 0x60 + out 0x20, al + + /* Check for spurious */ + cmp cl, bl + jbe SpuriousInterrupt + + /* Write IRQL values */ + movzx ecx, cl + mov PCR[KPCR_IRQL], ecx + mov [edx], bl + + /* Enable interrupts and return TRUE */ + sti + mov eax, 1 + ret 12 + +Pic1Level: + /* Write mask to slave and master PIC */ + add al, 0x58 + out 0xA0, al + mov al, 0x62 + out 0x20, al + + /* Was this a lower interrupt? */ + cmp cl, bl + jbe SpuriousInterrupt + + /* Write IRQL values */ + movzx ecx, cl + mov PCR[KPCR_IRQL], ecx + mov [edx], bl + + /* Enable interrupts and return TRUE */ + sti + mov eax, 1 + ret 12 + .globl _HalEndSystemInterrupt@8 .func HalEndSystemInterrupt@8 _HalEndSystemInterrupt@8: - /* Get the IRQL and check if it's a software interrupt */ - movzx ecx, byte ptr [esp+4] + /* Read IRQL */ + xor ecx, ecx + mov cl, [esp+4] + + /* Check if it's a software interrupt */ cmp dword ptr PCR[KPCR_IRQL], DISPATCH_LEVEL jbe SkipMask2 @@ -418,7 +639,7 @@ /* Set IRQL and check if there are pending software interrupts */ mov PCR[KPCR_IRQL], ecx mov eax, PCR[KPCR_IRR] - mov al, SoftIntByteTable[eax] + mov al, SWInterruptLookUpTable[eax] cmp al, cl ja DoCall ret 8 @@ -427,7 +648,7 @@ /* There are pending software interrupts, call their handlers */ add esp, 12 - jmp SoftIntHandlerTable2[eax*4] + jmp SWInterruptHandlerTable2[eax*4] .endfunc .globl @KfLowerIrql@4 @@ -435,19 +656,21 @@ _@KfLowerIrql@4: @KfLowerIrql@4: + /* Cleanup IRQL */ + and ecx, 0xFF + + /* Validate IRQL */ + #if DBG + cmp cl, PCR[KPCR_IRQL] + ja InvalidIrql + #endif + /* Save flags since we'll disable interrupts */ pushf - - /* Validate IRQL */ - movzx ecx, cl -#if DBG - cmp cl, PCR[KPCR_IRQL] - ja InvalidIrql -#endif + cli /* Disable interrupts and check if IRQL is below DISPATCH_LEVEL */ cmp dword ptr PCR[KPCR_IRQL], DISPATCH_LEVEL - cli jbe SkipMask /* Clear interrupt masks since there's a pending hardware interrupt */ @@ -462,7 +685,7 @@ /* Set the new IRQL and check if there's a pending software interrupt */ mov PCR[KPCR_IRQL], ecx mov eax, PCR[KPCR_IRR] - mov al, SoftIntByteTable[eax] + mov al, SWInterruptLookUpTable[eax] cmp al, cl ja DoCall3 @@ -487,7 +710,7 @@ DoCall3: /* There is, call it */ - call SoftIntHandlerTable[eax*4] + call SWInterruptHandlerTable[eax*4] /* Restore interrupts and return */ popf @@ -499,9 +722,9 @@ _@KfRaiseIrql@4: @KfRaiseIrql@4: - /* Get the IRQL */ + /* Get the IRQL */ + movzx ecx, cl mov eax, PCR[KPCR_IRQL] - movzx ecx, cl #if DBG /* Validate it */ @@ -521,7 +744,7 @@ cli /* Set the new IRQL */ - mov PCR[KPCR_IRQL], cl + mov PCR[KPCR_IRQL], ecx /* Mask the interrupts in the PIC */ mov eax, KiI8259MaskTable[ecx*4] @@ -536,7 +759,6 @@ ret SetIrql: - /* Set the IRQL and return */ mov PCR[KPCR_IRQL], ecx ret @@ -598,29 +820,17 @@ .func KeRaiseIrqlToSynchLevel@0 _KeRaiseIrqlToSynchLevel@0: - /* Disable interrupts */ - pushf - cli - - /* Mask out interrupts */ - mov eax, KiI8259MaskTable[SYNCH_LEVEL*4] - or eax, PCR[KPCR_IDR] - out 0x21, al - shr eax, 8 - out 0xA1, al - - /* Return the old IRQL, enable interrupts and set to SYNCH */ + /* Get the current IRQL */ mov eax, PCR[KPCR_IRQL] + + /* Set SYNCH_LEVEL */ mov dword ptr PCR[KPCR_IRQL], SYNCH_LEVEL - popf #if DBG - /* Validate raise */ + /* Make sure we were not higher then dispatch */ cmp eax, SYNCH_LEVEL ja InvalidSyRaise #endif - - /* Return */ ret #if DBG @@ -737,7 +947,7 @@ /* Check if there are pending software interrupts */ mov PCR[KPCR_IRQL], ecx mov eax, PCR[KPCR_IRR] - mov al, SoftIntByteTable[eax] + mov al, SWInterruptLookUpTable[eax] cmp al, cl ja DoCall2 ret 4 @@ -745,5 +955,5 @@ DoCall2: /* There are pending softwate interrupts, call their handlers */ add esp, 8 - jmp SoftIntHandlerTable2[eax*4] -.endfunc + jmp SWInterruptHandlerTable2[eax*4] +.endfunc Modified: trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S [iso-8859-1] Wed Nov 11 23:29:16 2009 @@ -192,6 +192,40 @@ .endm // +// @name GENERATE_HAL_INT_HANDLER +// +// This macro creates a HAL hardware interrupt handler. +// +// @param None. +// +// @remark None. +// +.macro GENERATE_HAL_INT_HANDLER Number +.func HalpHardwareInterrupt&Number +_HalpHardwareInterrupt&Number: + int PRIMARY_VECTOR_BASE + Number + ret +.endfunc +.endm + +// +// @name GENERATE_HAL_INT_HANDLERS +// +// This macro creates the unexpected interrupt handlers. +// +// @param None. +// +// @remark None. +// +.macro GENERATE_HAL_INT_HANDLERS +.set i, 0 +.rept 16 + GENERATE_HAL_INT_HANDLER %i + .set i, i + 1 +.endr +.endm + +// // @name INVALID_V86_OPCODE // // This macro creates one or more entries for unhandled V86 Opcodes
15 years, 1 month
1
0
0
0
[fireball] 44114: [SWM] - Start implementing window hide/show support.
by fireball@svn.reactos.org
Author: fireball Date: Wed Nov 11 23:01:19 2009 New Revision: 44114 URL:
http://svn.reactos.org/svn/reactos?rev=44114&view=rev
Log: [SWM] - Start implementing window hide/show support. Modified: branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c branches/arwinss/reactos/include/reactos/win32k/rosuser.h branches/arwinss/reactos/subsystems/win32/win32k/include/swm.h branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db Modified: branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] Wed Nov 11 23:01:19 2009 @@ -876,6 +876,13 @@ FIXME("change2\n"); } } + + /* Pass show/hide information to the window manager */ + if (swp_flags & SWP_SHOWWINDOW) + SwmShowWindow(hwnd, TRUE); + else if (swp_flags & SWP_HIDEWINDOW) + SwmShowWindow(hwnd, FALSE); + // visible: 0x1843, hide: 0x1883. 1843 = 1 + 2 + 64 + 2048 + 4096 //RosDrv_UpdateZOrder(hwnd, (RECT*)visible_rect); } Modified: branches/arwinss/reactos/include/reactos/win32k/rosuser.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/reactos…
============================================================================== --- branches/arwinss/reactos/include/reactos/win32k/rosuser.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/reactos/win32k/rosuser.h [iso-8859-1] Wed Nov 11 23:01:19 2009 @@ -157,5 +157,7 @@ HWND NTAPI SwmGetWindowFromPoint(LONG x, LONG y); +VOID NTAPI +SwmShowWindow(HWND hWnd, BOOLEAN Show); #endif /* __WIN32K_NTUSER_H */ Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/swm.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/swm.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/swm.h [iso-8859-1] Wed Nov 11 23:01:19 2009 @@ -6,6 +6,7 @@ HWND hwnd; rectangle_t Window; struct region *Visible; + BOOLEAN Hidden; LIST_ENTRY Entry; } SWM_WINDOW, *PSWM_WINDOW; Modified: branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c [iso-8859-1] Wed Nov 11 23:01:19 2009 @@ -124,6 +124,14 @@ { Window = CONTAINING_RECORD(Current, SWM_WINDOW, Entry); + /* Skip hidden windows */ + if (Window->Hidden) + { + /* Advance to the next window */ + Current = Current->Flink; + continue; + } + /* Get window's region */ WindowRegion = create_empty_region(); set_region_rect(WindowRegion, &Window->Window); @@ -178,6 +186,14 @@ { Window = CONTAINING_RECORD(Current, SWM_WINDOW, Entry); + /* Skip hidden windows */ + if (Window->Hidden) + { + /* Advance to the next window */ + Current = Current->Flink; + continue; + } + /* Get window's region */ WindowRegion = create_empty_region(); set_region_rect(WindowRegion, &Window->Window); @@ -231,6 +247,14 @@ while(Current != &SwmWindows) { Window = CONTAINING_RECORD(Current, SWM_WINDOW, Entry); + + /* Skip hidden windows */ + if (Window->Hidden) + { + /* Advance to the next window */ + Current = Current->Blink; + continue; + } union_region(Region, Region, Window->Visible); @@ -525,6 +549,48 @@ SwmRelease(); } +VOID +NTAPI +SwmShowWindow(HWND hWnd, BOOLEAN Show) +{ + PSWM_WINDOW Win; + + /* Acquire the lock */ + SwmAcquire(); + + DPRINT1("SwmShowWindow %x, Show %d\n", hWnd, Show); + + /* Allocate entry */ + Win = SwmFindByHwnd(hWnd); + if (!Win) + { + /* Release the lock */ + SwmRelease(); + return; + } + + if (Show && Win->Hidden) + { + /* Change state from hidden to visible */ + Win->Hidden = FALSE; + } + else if (!Show && !Win->Hidden) + { + /* Change state from visible to hidden */ + Win->Hidden = TRUE; + + /* Mark its region as visible */ + SwmMarkVisible(Win->Visible); + + /* Its visible region is now empty */ + free_region(Win->Visible); + Win->Visible = create_empty_region(); + } + + /* Release the lock */ + SwmRelease(); +} + HWND NTAPI SwmGetWindowFromPoint(LONG x, LONG y) @@ -540,6 +606,14 @@ while(Current != &SwmWindows) { Window = CONTAINING_RECORD(Current, SWM_WINDOW, Entry); + + /* Skip hidden windows */ + if (Window->Hidden) + { + /* Advance to the next window */ + Current = Current->Flink; + continue; + } if (point_in_region(Window->Visible, x, y)) { Modified: branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Wed Nov 11 23:01:19 2009 @@ -90,4 +90,5 @@ SwmSetForeground 1 SwmPosChanging 2 SwmPosChanged 3 -SwmGetWindowFromPoint 2 +SwmGetWindowFromPoint 2 +SwmShowWindow 2
15 years, 1 month
1
0
0
0
[janderwald] 44113: - Fix building of cmidriver - Required a few hacks, which were documented as //HACK
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Nov 11 21:43:58 2009 New Revision: 44113 URL:
http://svn.reactos.org/svn/reactos?rev=44113&view=rev
Log: - Fix building of cmidriver - Required a few hacks, which were documented as //HACK Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/adapter.cpp trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/adapter.hpp trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/cmidriver.rbuild trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/common.cpp trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/common.hpp trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.hpp trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopotables.hpp trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.cpp trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.hpp trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwavetables.hpp trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/property.h Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/adapter.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/adapter.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/adapter.cpp [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -30,6 +30,84 @@ #include "adapter.hpp" //#pragma code_seg("PAGE") + +const GUID KSNODETYPE_DAC = {0x507AE360L, 0xC554, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_ADC = {0x4D837FE0L, 0xC555, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_AGC = {0xE88C9BA0L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_LOUDNESS = {0x41887440L, 0xC558, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_MUTE = {0x02B223C0L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_TONE = {0x7607E580L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_VOLUME = {0x3A5ACC00L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_PEAKMETER = {0xa085651e, 0x5f0d, 0x4b36, {0xa8, 0x69, 0xd1, 0x95, 0xd6, 0xab, 0x4b, 0x9e}}; +const GUID KSNODETYPE_MUX = {0x2CEAF780, 0xC556, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_STEREO_WIDE = {0xA9E69800L, 0xC558, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_CHORUS = {0x20173F20L, 0xC559, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_REVERB = {0xEF0328E0L, 0xC558, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_SUPERMIX = {0xE573ADC0L, 0xC555, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_SUM = {0xDA441A60L, 0xC556, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_SRC = {0x9DB7B9E0L, 0xC555, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_3D_EFFECTS = {0x55515860L, 0xC559, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_SPDIF_INTERFACE = {0x0605+0xDFF219E0, 0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; +const GUID KSNODETYPE_MICROPHONE = {0x0201+0xDFF219E0,0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; +const GUID KSNODETYPE_CD_PLAYER = {0x0703+0xDFF219E0,0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; +const GUID KSNODETYPE_LINE_CONNECTOR = {0x0603+0xDFF219E0,0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; +const GUID KSNODETYPE_ANALOG_CONNECTOR = {0x601+0xDFF219E0,0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; +const GUID KSNODETYPE_SPEAKER = {0x0301+0xDFF219E0,0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; + +const GUID KSPROPTYPESETID_General = {0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; +const GUID KSPROPSETID_General = {0x1464EDA5L, 0x6A8F, 0x11D1, {0x9A, 0xA7, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; +const GUID KSPROPSETID_Audio = {0x45FFAAA0L, 0x6E1B, 0x11D0, {0xBC, 0xF2, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}; +const GUID GUID_NULL ={0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}; +const GUID KSCATEGORY_AUDIO = {0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; + + +const GUID KSDATAFORMAT_TYPE_AUDIO = {0x73647561L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; +const GUID KSDATAFORMAT_SUBTYPE_PCM = {0x00000001L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; +const GUID KSDATAFORMAT_SPECIFIER_WAVEFORMATEX = {0x05589f81L, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}}; +const GUID KSDATAFORMAT_SPECIFIER_DSOUND = {0x518590a2L, 0xa184, 0x11d0, {0x85, 0x22, 0x00, 0xc0, 0x4f, 0xd9, 0xba, 0xf3}}; +const GUID KSDATAFORMAT_SUBTYPE_WAVEFORMATEX = {0x00000000L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; +const GUID KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF = {0x00000092L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; + + +const GUID KSAUDFNAME_WAVE_VOLUME = {0x185FEDE5L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_WAVE_MUTE = {0x185FEDE6L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_MIC_VOLUME = {0x185FEDEDL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_MASTER_VOLUME = {0x185FEDE3L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_RECORDING_SOURCE = {0x185FEDEFL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_CD_VOLUME = {0x185FEDE9L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_CD_IN_VOLUME = {0x185FEDF3L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_MIC_IN_VOLUME = {0x185FEDF5L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_MICROPHONE_BOOST = {0x2bc31d6aL, 0x96e3, 0x11d2, {0xac, 0x4c, 0x0, 0xc0, 0x4f, 0x8e, 0xfb, 0x68}}; +const GUID KSAUDFNAME_CD_MUTE = {0x185FEDEAL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_LINE_MUTE = {0x185FEDECL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_MIC_MUTE = {0x185FEDEEL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_AUX_MUTE = {0x185FEDFDL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_MASTER_MUTE = {0x185FEDE4L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_RECORDING_CONTROL = {0x185FEDFAL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_VOLUME_CONTROL = {0x185FEDF7L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_LINE_IN_VOLUME = {0x185FEDF4L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSAUDFNAME_AUX_VOLUME = {0x185FEDFCL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; + +const GUID KSPROPSETID_CMI = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFF}}; + + +const GUID CMINAME_IEC_5V = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF0}}; +const GUID CMINAME_IEC_OUT = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF1}}; +const GUID CMINAME_IEC_INVERSE = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF2}}; +const GUID CMINAME_IEC_MONITOR = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF3}}; +const GUID CMINAME_IEC_SELECT = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF5}}; +const GUID CMINAME_XCHG_FB = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF6}}; +const GUID CMINAME_BASS2LINE = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF7}}; +const GUID CMINAME_CENTER2LINE = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF8}}; +const GUID CMINAME_IEC_COPYRIGHT = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF9}}; +const GUID CMINAME_IEC_POLVALID = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFA}}; +const GUID CMINAME_IEC_LOOP = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFB}}; +const GUID CMINAME_REAR2LINE = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFC}}; +const GUID CMINAME_CENTER2MIC = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFD}}; +const GUID CMINAME_DAC = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF4}}; +const GUID PRODUCT_CM8738 = {0x9db14e9a, 0x7be7, 0x480d, {0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9c}}; +const GUID COMPONENT_CM8738 = {0x9db14e9a, 0x7be7, 0x480d, {0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9d}}; +const GUID MANUFACTURER_CM8738 = {0x9db14e9a, 0x7be7, 0x480d, {0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9e}}; NTSTATUS InstallSubdevice( @@ -451,8 +529,24 @@ return ntStatus; } + +#ifdef _MSC_VER + #pragma code_seg() int __cdecl _purecall (void) { - return 0; -} + return 0; +} + +#else + +extern "C" { +void __cxa_pure_virtual() + { + // put error handling here + + DbgBreakPoint(); + + } +} +#endif Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/adapter.hpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/adapter.hpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/adapter.hpp [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -38,7 +38,7 @@ const ULONG MAX_MINIPORTS = 2; #endif -extern NTSTATUS CreateMiniportWaveCMI +extern HRESULT NTAPI CreateMiniportWaveCMI ( OUT PUNKNOWN * Unknown, IN REFCLSID, @@ -46,7 +46,7 @@ IN POOL_TYPE PoolType ); -extern NTSTATUS CreateMiniportTopologyCMI +extern HRESULT NTAPI CreateMiniportTopologyCMI ( OUT PUNKNOWN * Unknown, IN REFCLSID, Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/cmidriver.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/cmidriver.rbuild [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/cmidriver.rbuild [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -1,6 +1,16 @@ <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../../../tools/rbuild/project.dtd"> <module name="cmidriver" type="kernelmodedriver" installbase="system32/drivers" installname="cmipci.sys" allowwarnings="true"> + + <group compilerset="gcc"> + <compilerflag compiler="cxx">-fno-exceptions</compilerflag> + <compilerflag compiler="cxx">-fno-rtti</compilerflag> + </group> + + <group compilerset="msc"> + <compilerflag compiler="cxx">/GR-</compilerflag> + </group> + <include base="mpu401">.</include> <library>ntoskrnl</library> <library>portcls</library> Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/common.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/common.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/common.cpp [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -36,10 +36,10 @@ PUNKNOWN UnknownOuter, POOL_TYPE PoolType) { -#if 0 +#if 1 //PAGED_CODE(); DBGPRINT(("NewCMIAdapter()")); - //ASSERT (Unknown); + ASSERT (Unknown); #endif STD_CREATE_BODY_(CCMIAdapter, Unknown, UnknownOuter, PoolType, PCMIADAPTER); } @@ -129,7 +129,7 @@ } } -STDMETHODIMP_(NTSTATUS) CCMIAdapter::NonDelegatingQueryInterface(REFIID Interface, PVOID* Object) +STDMETHODIMP_(NTSTATUS) CCMIAdapter::QueryInterface(REFIID Interface, PVOID* Object) { //PAGED_CODE(); @@ -449,7 +449,7 @@ writeMixer(index, readMixer(index) & ~flag); } -NTSTATUS CCMIAdapter::InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID DynamicContext) +NTSTATUS NTAPI CCMIAdapter::InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID DynamicContext) { UInt32 status, mask = 0; Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/common.hpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/common.hpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/common.hpp [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -41,8 +41,7 @@ #include "cmireg.hpp" class CCMIAdapter : public ICMIAdapter, - public IAdapterPowerManagement, - public CUnknown + public IAdapterPowerManagement { private: PDEVICE_OBJECT DeviceObject; @@ -56,8 +55,25 @@ void resetController(); public: - DECLARE_STD_UNKNOWN(); - DEFINE_STD_CONSTRUCTOR(CCMIAdapter); + STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); + STDMETHODIMP_(ULONG) AddRef() + { + InterlockedIncrement(&m_Ref); + return m_Ref; + } + STDMETHODIMP_(ULONG) Release() + { + InterlockedDecrement(&m_Ref); + + if (!m_Ref) + { + delete this; + return 0; + } + return m_Ref; + } + + CCMIAdapter(IUnknown *OuterUnknown){} ~CCMIAdapter(); IMP_IAdapterPowerManagement; @@ -88,7 +104,7 @@ STDMETHODIMP_(void) resetMixer(); - static NTSTATUS InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID StaticContext); + static NTSTATUS NTAPI InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID StaticContext); STDMETHODIMP_(PCMI8738Info) getCMI8738Info(void) { @@ -105,6 +121,9 @@ }; friend NTSTATUS NewCCMIAdapter(PCMIADAPTER* OutCMIAdapter, PRESOURCELIST ResourceList); + + LONG m_Ref; + }; NTSTATUS NewCMIAdapter(PUNKNOWN* Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType); Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -33,14 +33,14 @@ #pragma code_seg("PAGE") -NTSTATUS CreateMiniportTopologyCMI(PUNKNOWN* Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType) +HRESULT NTAPI CreateMiniportTopologyCMI(PUNKNOWN* Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType) { //PAGED_CODE(); //ASSERT(Unknown); STD_CREATE_BODY_(CCMITopology,Unknown,UnknownOuter,PoolType,PMINIPORTTOPOLOGY); } -STDMETHODIMP CCMITopology::NonDelegatingQueryInterface(REFIID Interface, PVOID* Object) +STDMETHODIMP CCMITopology::QueryInterface(REFIID Interface, PVOID* Object) { //PAGED_CODE(); //ASSERT(Object); Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.hpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.hpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.hpp [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -31,8 +31,7 @@ #include "common.hpp" #include "property.h" -class CCMITopology : public ICMITopology, - public CUnknown +class CCMITopology : public ICMITopology { private: PCMIADAPTER CMIAdapter; // Adapter common object. @@ -45,8 +44,24 @@ NTSTATUS ProcessResources(PRESOURCELIST ResourceList); public: - DECLARE_STD_UNKNOWN(); - DEFINE_STD_CONSTRUCTOR(CCMITopology); + STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); + STDMETHODIMP_(ULONG) AddRef() + { + InterlockedIncrement(&m_Ref); + return m_Ref; + } + STDMETHODIMP_(ULONG) Release() + { + InterlockedDecrement(&m_Ref); + + if (!m_Ref) + { + delete this; + return 0; + } + return m_Ref; + } + CCMITopology(IUnknown * OuterUnknown){} ~CCMITopology(); STDMETHODIMP_(NTSTATUS) loadMixerSettingsFromRegistry(); STDMETHODIMP_(NTSTATUS) storeMixerSettingsToRegistry(); @@ -88,6 +103,8 @@ friend NTSTATUS NTAPI PropertyHandler_Mux(PPCPROPERTY_REQUEST PropertyRequest); static NTSTATUS NTAPI EventHandler(PPCEVENT_REQUEST EventRequest); + + LONG m_Ref; }; #endif //_MINTOPO_HPP_ Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopotables.hpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopotables.hpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopotables.hpp [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -30,11 +30,13 @@ #include "mintopo.hpp" +#if 0 #ifndef STATIC_KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF #define STATIC_KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF\ DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_DOLBY_AC3_SPDIF) DEFINE_GUIDSTRUCT("00000092-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF); #define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF) +#endif #endif NTSTATUS NTAPI PropertyHandler_Level(PPCPROPERTY_REQUEST PropertyRequest); @@ -352,13 +354,13 @@ (PCPFNPROPERTY_HANDLER)PropertyHandler_ComponentId }, { - &KSPROPSETID_CMI, + &GUID_NULL,//&KSPROPSETID_CMI, //HACK KSPROPERTY_CMI_GET, KSPROPERTY_TYPE_GET, (PCPFNPROPERTY_HANDLER)PropertyHandler_Private }, { - &KSPROPSETID_CMI, + &GUID_NULL,//&KSPROPSETID_CMI, //HACK KSPROPERTY_CMI_SET, KSPROPERTY_TYPE_SET, (PCPFNPROPERTY_HANDLER)PropertyHandler_Private Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.cpp [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -31,7 +31,7 @@ #pragma code_seg("PAGE") -NTSTATUS CreateMiniportWaveCMI(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType) +HRESULT NTAPI CreateMiniportWaveCMI(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType) { //PAGED_CODE(); //ASSERT(Unknown); @@ -77,7 +77,7 @@ #endif //generic crap -STDMETHODIMP CMiniportWaveCMI::NonDelegatingQueryInterface(REFIID Interface, PVOID *Object) +STDMETHODIMP CMiniportWaveCMI::QueryInterface(REFIID Interface, PVOID *Object) { //PAGED_CODE(); //ASSERT(Object); @@ -482,7 +482,7 @@ } - if (!IsEqualGUIDAligned(ClientDataRange->SubFormat, KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF) + if (!IsEqualGUIDAligned(ClientDataRange->SubFormat, GUID_NULL)//KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF) //HACK && !IsEqualGUIDAligned(ClientDataRange->SubFormat, KSDATAFORMAT_SUBTYPE_WILDCARD)) { // check for Vista isAC3Pin = false; @@ -1215,7 +1215,7 @@ } } -STDMETHODIMP CMiniportWaveStreamCMI::NonDelegatingQueryInterface(REFIID Interface, PVOID *Object) +STDMETHODIMP CMiniportWaveStreamCMI::QueryInterface(REFIID Interface, PVOID *Object) { //PAGED_CODE(); //ASSERT(Object); Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.hpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.hpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.hpp [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -41,8 +41,7 @@ #else public IMiniportWaveCyclic, #endif - public IMiniportWaveCMI, - public CUnknown + public IMiniportWaveCMI { private: PCMIADAPTER CMIAdapter; // Adapter common object. @@ -56,7 +55,7 @@ CMI8738Info *cm; UInt32 requestedChannelCount; UInt32 requestedChannelMask; - + LONG m_Ref; CMiniportWaveStreamCMI *stream[3]; bool isStreamRunning[3]; @@ -72,8 +71,24 @@ NTSTATUS loadChannelConfigFromRegistry(); NTSTATUS storeChannelConfigToRegistry(); public: - DECLARE_STD_UNKNOWN(); - DEFINE_STD_CONSTRUCTOR(CMiniportWaveCMI); + STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); + STDMETHODIMP_(ULONG) AddRef() + { + InterlockedIncrement(&m_Ref); + return m_Ref; + } + STDMETHODIMP_(ULONG) Release() + { + InterlockedDecrement(&m_Ref); + + if (!m_Ref) + { + delete this; + return 0; + } + return m_Ref; + } + CMiniportWaveCMI(IUnknown * OuterUnknown){} ~CMiniportWaveCMI(); #ifdef WAVERT IMP_IMiniportWaveRT; @@ -96,8 +111,7 @@ #else public IMiniportWaveCyclicStream, #endif - public IDrmAudioStream, - public CUnknown + public IDrmAudioStream { private: CMiniportWaveCMI *Miniport; @@ -119,6 +133,7 @@ UInt32 dmaSize; // size of the DMA buffer in frames, NOT in bytes UInt32 currentChannelCount, currentSampleRate, currentResolution; bool enableAC3Passthru, enableSPDIF; + LONG m_Ref; NTSTATUS prepareStream(); NTSTATUS setDACChannels(); @@ -126,8 +141,24 @@ NTSTATUS setupAC3Passthru(); public: - DECLARE_STD_UNKNOWN(); - DEFINE_STD_CONSTRUCTOR(CMiniportWaveStreamCMI); + STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); + STDMETHODIMP_(ULONG) AddRef() + { + InterlockedIncrement(&m_Ref); + return m_Ref; + } + STDMETHODIMP_(ULONG) Release() + { + InterlockedDecrement(&m_Ref); + + if (!m_Ref) + { + delete this; + return 0; + } + return m_Ref; + } + CMiniportWaveStreamCMI(IUnknown * OuterUnknown){} ~CMiniportWaveStreamCMI(); #ifdef WAVERT IMP_IMiniportWaveRTStream; Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwavetables.hpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwavetables.hpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwavetables.hpp [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -65,7 +65,7 @@ 0, 0, STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), - STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF), + STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),//STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF), //HACK STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }, MAX_CHANNELS_AC3, Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/property.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/property.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/property.h [iso-8859-1] Wed Nov 11 21:43:58 2009 @@ -30,10 +30,12 @@ //GUID for the private property // {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFF} + #define STATIC_KSPROPSETID_CMI \ 0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFF -DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFF", _STATIC_KSPROPSETID_CMI); -#define KSPROPSETID_CMI DEFINE_GUIDNAMED(_STATIC_KSPROPSETID_CMI) +DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFF", KSPROPSETID_CMI); +#define KSPROPSETID_CMI DEFINE_GUIDNAMED(KSPROPSETID_CMI) + //methods #define KSPROPERTY_CMI_GET 1
15 years, 1 month
1
0
0
0
[fireball] 44112: - Implement GetDC/ReleaseDC for window manager with clipping support. This addresses the invalid drawing order "bug", which is in fact a feature. Client window manager is responsible for compositing all windows in a given rectangle being redrawn. Arwinss implements a very simple client window manager (SWM) which just clips out all contents behind the window on top of a z order. - Notify SWM about a new (or an existing) desktop window. - Fix comment typos.
by fireball@svn.reactos.org
Author: fireball Date: Wed Nov 11 20:55:22 2009 New Revision: 44112 URL:
http://svn.reactos.org/svn/reactos?rev=44112&view=rev
Log: - Implement GetDC/ReleaseDC for window manager with clipping support. This addresses the invalid drawing order "bug", which is in fact a feature. Client window manager is responsible for compositing all windows in a given rectangle being redrawn. Arwinss implements a very simple client window manager (SWM) which just clips out all contents behind the window on top of a z order. - Notify SWM about a new (or an existing) desktop window. - Fix comment typos. Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c branches/arwinss/reactos/dll/win32/winent.drv/winent.h branches/arwinss/reactos/include/psdk/ntrosgdi.h branches/arwinss/reactos/include/reactos/win32k/rosuser.h branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Wed Nov 11 20:55:22 2009 @@ -228,6 +228,12 @@ { const struct ntdrv_escape_set_drawable *data = in_data; RosGdiSetDcRects(physDev->hKernelDC, (RECT*)&data->dc_rect, (RECT*)&data->drawable_rect); + + if (!data->release) + RosGdiGetDC(physDev->hKernelDC, data->hwnd, data->clip_children); + else + RosGdiReleaseDC(physDev->hKernelDC); + TRACE( "SET_DRAWABLE hdc %p dc_rect %s drawable_rect %s\n", physDev->hUserDC, wine_dbgstr_rect(&data->dc_rect), wine_dbgstr_rect(&data->drawable_rect) ); return TRUE; Modified: branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] Wed Nov 11 20:55:22 2009 @@ -458,6 +458,8 @@ TRACE("RosDrv_CreateDesktopWindow(%x), w %d h %d\n", hwnd, width, height); + SwmAddDesktopWindow(hwnd, width, height); + if (!width && !height) /* not initialized yet */ { SERVER_START_REQ( set_window_pos ) @@ -490,27 +492,25 @@ NTDRV_destroy_win_data( hwnd ); } -void CDECL RosDrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect, +void CDECL RosDrv_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect, const RECT *top_rect, DWORD flags ) { struct ntdrv_escape_set_drawable escape; - //struct ntdrv_win_data *data = X11DRV_get_win_data( hwnd ); + struct ntdrv_win_data *data = NTDRV_get_win_data( hwnd ); escape.code = NTDRV_SET_DRAWABLE; - //escape.mode = IncludeInferiors; - //escape.fbconfig_id = 0; - //escape.gl_drawable = 0; - //escape.pixmap = 0; + escape.clip_children = FALSE; escape.gl_copy = FALSE; - -#if 0 - if (top == hwnd && data && IsIconic( hwnd ) && data->icon_window) + escape.hwnd = hwnd; + escape.release = FALSE; + + if (top == hwnd && data && IsIconic( hwnd ) /*&& data->icon_window*/) { //escape.drawable = data->icon_window; } else if (top == hwnd) { - escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop ); + //escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop ); /* GL draws to the client area even for window DCs */ /*escape.gl_drawable = data ? data->client_window : X11DRV_get_client_window( hwnd ); if (flags & DCX_WINDOW) @@ -525,9 +525,9 @@ //escape.gl_drawable = data ? data->gl_drawable : (Drawable)GetPropA( hwnd, gl_drawable_prop ); //escape.pixmap = data ? data->pixmap : (Pixmap)GetPropA( hwnd, pixmap_prop ); //escape.gl_copy = (escape.gl_drawable != 0); - if (flags & DCX_CLIPCHILDREN) escape.mode = ClipByChildren; - } -#endif + + if (flags & DCX_CLIPCHILDREN) escape.clip_children = TRUE; + } escape.dc_rect.left = win_rect->left - top_rect->left; escape.dc_rect.top = win_rect->top - top_rect->top; @@ -544,7 +544,7 @@ DWORD CDECL RosDrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout, DWORD mask, DWORD flags ) { - TRACE("WaitForMultipleObjectsEx(%d %p %d %x %x %x\n", count, handles, timeout, mask, flags); + //TRACE("WaitForMultipleObjectsEx(%d %p %d %x %x %x\n", count, handles, timeout, mask, flags); if (!count && !timeout) return WAIT_TIMEOUT; return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL, @@ -557,6 +557,8 @@ escape.code = NTDRV_SET_DRAWABLE; escape.gl_copy = FALSE; + escape.hwnd = hwnd; + escape.release = TRUE; escape.dc_rect.left = 0; escape.dc_rect.top = 0; @@ -840,8 +842,8 @@ if (!data) return; - TRACE( "win %x pos changed. new vis rect %s, old whole rect %s\n", - hwnd, wine_dbgstr_rect(visible_rect), wine_dbgstr_rect(&data->whole_rect) ); + TRACE( "win %x pos changed. new vis rect %s, old whole rect %s, swp_flags %x\n", + hwnd, wine_dbgstr_rect(visible_rect), wine_dbgstr_rect(&data->whole_rect), swp_flags ); old_whole_rect = data->whole_rect; old_client_rect = data->client_rect; @@ -864,15 +866,17 @@ old_client_rect.bottom - data->client_rect.bottom == y_offset && !memcmp( &valid_rects[0], &data->client_rect, sizeof(RECT) )) { - //move_window_bits( data, &old_whole_rect, &data->whole_rect, &old_client_rect ); + //move_window_bits( data, &old_whole_rect, &data->whole_rect, &old_client_rect ); SwmPosChanged(hwnd, &data->whole_rect, &old_whole_rect); + FIXME("change1\n"); } else { - //move_window_bits( data, &valid_rects[1], &valid_rects[0], &old_client_rect ); + move_window_bits( data, &valid_rects[1], &valid_rects[0], &old_client_rect ); + FIXME("change2\n"); } } - +// visible: 0x1843, hide: 0x1883. 1843 = 1 + 2 + 64 + 2048 + 4096 //RosDrv_UpdateZOrder(hwnd, (RECT*)visible_rect); } Modified: branches/arwinss/reactos/dll/win32/winent.drv/winent.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/winent.h [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/winent.h [iso-8859-1] Wed Nov 11 20:55:22 2009 @@ -19,14 +19,12 @@ struct ntdrv_escape_set_drawable { enum ntdrv_escape_codes code; /* escape code (X11DRV_SET_DRAWABLE) */ - //Drawable drawable; /* X drawable */ - int mode; /* ClipByChildren or IncludeInferiors */ + BOOL clip_children;/* ClipByChildren or IncludeInferiors */ RECT dc_rect; /* DC rectangle relative to drawable */ RECT drawable_rect;/* Drawable rectangle relative to screen */ - //XID fbconfig_id; /* fbconfig id used by the GL drawable */ - //Drawable gl_drawable; /* GL drawable */ - //Pixmap pixmap; /* Pixmap for a GLXPixmap gl_drawable */ + HWND hwnd; /* hwnd of which the GetDC is performed */ int gl_copy; /* whether the GL contents need explicit copying */ + BOOL release; /* whether the DC is acquired or released */ }; /* ntdrv private window data */ Modified: branches/arwinss/reactos/include/psdk/ntrosgdi.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/psdk/nt…
============================================================================== --- branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] Wed Nov 11 20:55:22 2009 @@ -119,6 +119,8 @@ COLORREF APIENTRY RosGdiSetTextColor( HDC physDev, COLORREF color ); VOID APIENTRY RosGdiSetDcRects( HDC physDev, RECT *rcDcRect, RECT *rcVport ); VOID APIENTRY RosGdiGetDcRects( HDC physDev, RECT *rcDcRect, RECT *rcVport ); +VOID APIENTRY RosGdiGetDC( HDC physDev, HWND hwnd, BOOL clipChildren ); +VOID APIENTRY RosGdiReleaseDC( HDC physDev ); /* enum.c */ int APIENTRY RosGdiChoosePixelFormat(HDC physDev, Modified: branches/arwinss/reactos/include/reactos/win32k/rosuser.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/reactos…
============================================================================== --- branches/arwinss/reactos/include/reactos/win32k/rosuser.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/reactos/win32k/rosuser.h [iso-8859-1] Wed Nov 11 20:55:22 2009 @@ -140,6 +140,9 @@ SwmAddWindow(HWND hWnd, RECT *WindowRect); VOID NTAPI +SwmAddDesktopWindow(HWND hWnd, UINT Width, UINT Height); + +VOID NTAPI SwmRemoveWindow(HWND hWnd); VOID NTAPI Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] Wed Nov 11 20:55:22 2009 @@ -9,6 +9,11 @@ /* INCLUDES ******************************************************************/ #include <win32k.h> + +#include "object.h" +#include "handle.h" +#include "user.h" + #define NDEBUG #include <debug.h> @@ -143,6 +148,7 @@ /* Create an empty combined clipping region */ pNewDC->CombinedClip = EngCreateClip(); + pNewDC->Clipping = create_empty_region(); /* Set default palette */ pNewDC->hPalette = hSystemPal; @@ -447,6 +453,36 @@ return 0; } +VOID APIENTRY RosGdiUpdateClipping(PDC pDC) +{ + struct region *inter; + if (!pDC->pWindow) + { + /* Easy case, just copy the existing clipping region */ + if (pDC->CombinedClip) EngDeleteClip(pDC->CombinedClip); + pDC->CombinedClip = IntEngCreateClipRegionFromRegion(pDC->Clipping); + } + else + { + /* Intersect with window's visibility */ + inter = create_empty_region(); + copy_region(inter, pDC->Clipping); + + /* Acquire SWM lock */ + SwmAcquire(); + + /* Intersect current clipping region and window's visible region */ + intersect_region(inter, inter, pDC->pWindow->Visible); + + /* Release SWM lock */ + SwmRelease(); + + if (pDC->CombinedClip) EngDeleteClip(pDC->CombinedClip); + pDC->CombinedClip = IntEngCreateClipRegionFromRegion(inter); + free_region(inter); + } +} + void APIENTRY RosGdiSetDeviceClipping( HDC physDev, UINT count, PRECTL pRects, PRECTL rcBounds ) { PDC pDC; @@ -510,8 +546,8 @@ pDC->rcDcRect.top + pDC->rcVport.top); /* Delete old clipping region */ - if (pDC->CombinedClip) - IntEngDeleteClipRegion(pDC->CombinedClip); + if (pDC->Clipping) + free_region(pDC->Clipping); if (count == 0) { @@ -534,12 +570,12 @@ RECTL_bIntersectRect(&rcSafeBounds, &rcSafeBounds, &rcSurface); /* Set the clipping object */ - pDC->CombinedClip = IntEngCreateClipRegion(1, &rcSafeBounds, &rcSafeBounds); + pDC->Clipping = create_region_from_rects(&rcSafeBounds, 1); } else { /* Set the clipping object */ - pDC->CombinedClip = IntEngCreateClipRegion(count, pSafeRects, &rcSafeBounds); + pDC->Clipping = create_region_from_rects(pSafeRects, count); } DPRINT("RosGdiSetDeviceClipping() for DC %x, bounding rect (%d,%d)-(%d, %d)\n", @@ -550,6 +586,9 @@ { DPRINT("%d: (%d,%d)-(%d, %d)\n", i, pSafeRects[i].left, pSafeRects[i].top, pSafeRects[i].right, pSafeRects[i].bottom); } + + /* Update the combined clipping */ + RosGdiUpdateClipping(pDC); /* Release the object */ DC_Unlock(pDC); @@ -641,4 +680,38 @@ DC_Unlock(pDC); } +VOID APIENTRY RosGdiGetDC(HDC physDev, HWND hwnd, BOOL clipChildren) +{ + PDC pDC; + + /* Acquire SWM lock before locking the DC */ + SwmAcquire(); + + /* Get a pointer to the DC */ + pDC = DC_Lock(physDev); + + /* Get a pointer to this window */ + pDC->pWindow = SwmFindByHwnd(hwnd); + + /* Release the object */ + DC_Unlock(pDC); + + /* Release SWM lock */ + SwmRelease(); +} + +VOID APIENTRY RosGdiReleaseDC(HDC physDev) +{ + PDC pDC; + + /* Get a pointer to the DC */ + pDC = DC_Lock(physDev); + + /* No window clipping is to be performed */ + pDC->pWindow = NULL; + + /* Release the object */ + DC_Unlock(pDC); +} + /* EOF */ Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c [iso-8859-1] Wed Nov 11 20:55:22 2009 @@ -298,7 +298,7 @@ x += pDC->rcVport.left + pDC->rcDcRect.left; y += pDC->rcVport.top + pDC->rcDcRect.top; - /* If points is outside combined clipping region - return error */ + /* If point is outside the combined clipping region - return error */ if (!RECTL_bPointInRect(&pDC->CombinedClip->rclBounds, x, y)) return CLR_INVALID; Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Wed Nov 11 20:55:22 2009 @@ -20,7 +20,9 @@ POINT ptBrushOrg; /* Combined clipping region */ - CLIPOBJ *CombinedClip; + struct region *Clipping; + CLIPOBJ *CombinedClip; + PSWM_WINDOW pWindow; /* Transformations */ MATRIX mxWorldToDevice; Modified: branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Wed Nov 11 20:55:22 2009 @@ -39,6 +39,7 @@ RosGdiGetCharWidth 4 RosGdiGetDeviceCaps 2 RosGdiGetDeviceGammaRamp 2 +RosGdiGetDC 3 RosGdiGetICMProfile 3 RosGdiGetNearestColor 2 RosGdiGetPixelFormat 1 @@ -60,6 +61,7 @@ RosGdiRealizeDefaultPalette 1 RosGdiRealizePalette 3 RosGdiRectangle 2 +RosGdiReleaseDC 1 RosGdiRoundRect 7 RosGdiSwapBuffers 1 RosGdiUnrealizePalette 1 @@ -83,6 +85,7 @@ RosUserMapVirtualKeyEx 4 RosUserGetAsyncKeyState 1 SwmAddWindow 2 +SwmAddDesktopWindow 3 SwmRemoveWindow 1 SwmSetForeground 1 SwmPosChanging 2
15 years, 1 month
1
0
0
0
[fireball] 44111: [SWM] - Fix invalidating a region: properly convert coordinates, invoke update_window_zorder. - Implement SwmAddDesktop for adding a desktop window. - Fix SwmSetForeground which was incorrectly calculating a visible region (should be subtracting instead of intersecting). - Remove "struct region" hack from debug deumping routines.
by fireball@svn.reactos.org
Author: fireball Date: Wed Nov 11 20:40:48 2009 New Revision: 44111 URL:
http://svn.reactos.org/svn/reactos?rev=44111&view=rev
Log: [SWM] - Fix invalidating a region: properly convert coordinates, invoke update_window_zorder. - Implement SwmAddDesktop for adding a desktop window. - Fix SwmSetForeground which was incorrectly calculating a visible region (should be subtracting instead of intersecting). - Remove "struct region" hack from debug deumping routines. Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/swm.h branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/swm.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/swm.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/swm.h [iso-8859-1] Wed Nov 11 20:40:48 2009 @@ -1,6 +1,20 @@ #ifndef SWM__H #define SWM__H +typedef struct _SWM_WINDOW +{ + HWND hwnd; + rectangle_t Window; + struct region *Visible; + + LIST_ENTRY Entry; +} SWM_WINDOW, *PSWM_WINDOW; + + VOID NTAPI SwmInitialize(); +PSWM_WINDOW NTAPI SwmFindByHwnd(HWND hWnd); +VOID NTAPI SwmAcquire(VOID); +VOID NTAPI SwmRelease(VOID); + #endif Modified: branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/swm/winman.c [iso-8859-1] Wed Nov 11 20:40:48 2009 @@ -17,16 +17,6 @@ #define NDEBUG #include <debug.h> -typedef struct _SWM_WINDOW -{ - HWND hwnd; - rectangle_t Window; - struct region *Visible; - struct region *Invisible; - - LIST_ENTRY Entry; -} SWM_WINDOW, *PSWM_WINDOW; - /*static*/ inline struct window *get_window( user_handle_t handle ); void redraw_window( struct window *win, struct region *region, int frame, unsigned int flags ); void req_update_window_zorder( const struct update_window_zorder_request *req, struct update_window_zorder_reply *reply ); @@ -36,7 +26,6 @@ VOID NTAPI SwmDebugDrawWindows(); VOID NTAPI SwmTest(); - /* GLOBALS *******************************************************************/ LIST_ENTRY SwmWindows; @@ -66,10 +55,12 @@ NTAPI SwmInvalidateRegion(PSWM_WINDOW Window, struct region *Region, rectangle_t *Rect) { +#if 1 struct window *Win; struct update_window_zorder_request req; - //struct update_window_zorder_reply reply; + struct update_window_zorder_reply reply; struct region *ClientRegion; + UINT i; ClientRegion = create_empty_region(); copy_region(ClientRegion, Region); @@ -86,27 +77,32 @@ return; } + //DPRINT1("rect (%d,%d)-(%d,%d)\n", TmpRect.left, TmpRect.top, TmpRect.right, TmpRect.bottom); + + /* Bring every rect in a region to front */ + for (i=0; i<Region->num_rects; i++) + { + DbgPrint("(%d,%d)-(%d,%d), and redraw coords (%d,%d)-(%d,%d); ", Region->rects[i].left, Region->rects[i].top, + Region->rects[i].right, Region->rects[i].bottom, + Region->rects[i].left - Window->Window.left, Region->rects[i].top - Window->Window.top, + Region->rects[i].right - Window->Window.left, Region->rects[i].bottom - Window->Window.top); + + req.rect = Region->rects[i]; + req.window = (UINT_PTR)Window->hwnd; + req_update_window_zorder(&req, &reply); + } + DbgPrint("\n"); + /* Convert region to client coordinates */ offset_region(ClientRegion, -Window->Window.left, -Window->Window.top); - //DPRINT1("rect (%d,%d)-(%d,%d)\n", TmpRect.left, TmpRect.top, TmpRect.right, TmpRect.bottom); - - /* Update zorder */ - if (Rect) - { - req.rect = *Rect; - req.rect.left -= Window->Window.left; req.rect.top -= Window->Window.top; - req.rect.right -= Window->Window.left; req.rect.bottom -= Window->Window.left; - req.window = (UINT_PTR)Window->hwnd; - //req_update_window_zorder(&req, &reply); - } - /* Redraw window */ redraw_window(Win, ClientRegion, 1, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ); UserLeave(); free_region(ClientRegion); +#endif } VOID @@ -292,6 +288,52 @@ SwmRelease(); } +VOID +NTAPI +SwmAddDesktopWindow(HWND hWnd, UINT Width, UINT Height) +{ + PSWM_WINDOW Desktop; + + /* Acquire the lock */ + SwmAcquire(); + + /* Check if it's already there */ + Desktop = SwmFindByHwnd(hWnd); + + if (Desktop) + { + // TODO: Check if dimensions are the same! + + /* Release the lock */ + SwmRelease(); + + return; + } + + /* Add a desktop window */ + Desktop = ExAllocatePool(PagedPool, sizeof(SWM_WINDOW)); + RtlZeroMemory(Desktop, sizeof(SWM_WINDOW)); + Desktop->hwnd = hWnd; + Desktop->Window.left = 0; + Desktop->Window.top = 0; + Desktop->Window.right = Width; + Desktop->Window.bottom = Height; + + Desktop->Visible = create_empty_region(); + set_region_rect(Desktop->Visible, &Desktop->Window); + + /* Now go through the list and remove this rect from all underlying windows visible region */ + SwmMarkInvisible(Desktop->Visible); + + InsertTailList(&SwmWindows, &Desktop->Entry); + + /* Now ensure it is visible on screen */ + SwmInvalidateRegion(Desktop, Desktop->Visible, &Desktop->Window); + + /* Release the lock */ + SwmRelease(); +} + PSWM_WINDOW NTAPI SwmFindByHwnd(HWND hWnd) @@ -394,20 +436,23 @@ /* Add it to the head of the list */ InsertHeadList(&SwmWindows, &SwmWin->Entry); + /* Subtruct old visible from the new one to find region for updating */ + OldVisible = create_empty_region(); + set_region_rect(OldVisible, &SwmWin->Window); + + subtract_region(OldVisible, OldVisible, SwmWin->Visible); + /* Make it fully visible */ - OldVisible = create_empty_region(); - copy_region(OldVisible, SwmWin->Visible); - free_region(SwmWin->Visible); SwmWin->Visible = create_empty_region(); set_region_rect(SwmWin->Visible, &SwmWin->Window); - /* Intersect new visible and old visible to find region for updating */ - intersect_region(OldVisible, OldVisible, SwmWin->Visible); - - /* If it's not empty - draw missing parts */ + /* If update region is not empty - draw missing parts */ if (!is_region_empty(OldVisible)) + { + DPRINT1("Intersection isn't empty\n"); SwmInvalidateRegion(SwmWin, OldVisible, NULL); + } free_region(OldVisible); @@ -534,15 +579,6 @@ SwmTest(); } - -// haaaaaaaaaaaaaaaaaaack -struct region -{ - int size; - int num_rects; - rectangle_t *rects; - rectangle_t extents; -}; VOID NTAPI
15 years, 1 month
1
0
0
0
[fireball] 44110: - Move swm.h include higher in the list.
by fireball@svn.reactos.org
Author: fireball Date: Wed Nov 11 20:30:28 2009 New Revision: 44110 URL:
http://svn.reactos.org/svn/reactos?rev=44110&view=rev
Log: - Move swm.h include higher in the list. Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/win32kp.h Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/win32kp.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/win32kp.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/win32kp.h [iso-8859-1] Wed Nov 11 20:30:28 2009 @@ -45,6 +45,7 @@ #include <cursor.h> #include <devobj.h> #include <brushobj.h> +#include <swm.h> #include <dc.h> #include <palobj.h> #include <clipobj.h> @@ -53,7 +54,6 @@ #include <xlateobj.h> #include <gre.h> #include <monitor.h> -#include <swm.h> #include "winesup.h"
15 years, 1 month
1
0
0
0
[fireball] 44108: - Move region structure definition to user.h. - Implement creating a region from RECTL array.
by fireball@svn.reactos.org
Author: fireball Date: Wed Nov 11 20:23:49 2009 New Revision: 44108 URL:
http://svn.reactos.org/svn/reactos?rev=44108&view=rev
Log: - Move region structure definition to user.h. - Implement creating a region from RECTL array. Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/user.h branches/arwinss/reactos/subsystems/win32/win32k/wine/region.c Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/user.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/user.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/user.h [iso-8859-1] Wed Nov 11 20:23:49 2009 @@ -64,6 +64,14 @@ unsigned int users; /* processes and threads using this desktop */ }; +struct region +{ + int size; + int num_rects; + rectangle_t *rects; + rectangle_t extents; +}; + /* user handles functions */ extern user_handle_t alloc_user_handle( void *ptr, enum user_object type ); @@ -105,6 +113,7 @@ extern struct region *create_empty_region(void); extern struct region *create_region_from_req_data( const void *data, data_size_t size ); +extern struct region *create_region_from_rects( const void *data, unsigned long count ); extern void free_region( struct region *region ); extern void set_region_rect( struct region *region, const rectangle_t *rect ); extern rectangle_t *get_region_data( const struct region *region, data_size_t max_size, Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/region.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/wine/region.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/wine/region.c [iso-8859-1] Wed Nov 11 20:23:49 2009 @@ -84,14 +84,6 @@ #define NDEBUG #include <debug.h> -struct region -{ - int size; - int num_rects; - rectangle_t *rects; - rectangle_t extents; -}; - #define RGN_DEFAULT_RECTS 2 @@ -615,6 +607,39 @@ return region; } +/* create a region from request data */ +struct region *create_region_from_rects( const void *data, unsigned long nb_rects ) +{ + unsigned int alloc_rects; + struct region *region; + const RECTL *rects = data; + int i; + + /* special case: empty region can be specified by a single all-zero rectangle */ + if (nb_rects == 1 && rects->left == 0 && rects->top == 0 && + rects->right == 0 && rects->bottom == 0) nb_rects = 0; + + if (!(region = mem_alloc( sizeof(*region) ))) return NULL; + + alloc_rects = max( nb_rects, RGN_DEFAULT_RECTS ); + if (!(region->rects = mem_alloc( alloc_rects * sizeof(*region->rects) ))) + { + ExFreePool( region ); + return NULL; + } + region->size = alloc_rects; + region->num_rects = nb_rects; + for (i=0; i<region->num_rects; i++) + { + region->rects[i].left = rects[i].left; + region->rects[i].top = rects[i].top; + region->rects[i].right = rects[i].right; + region->rects[i].bottom = rects[i].bottom; + } + set_region_extents( region ); + return region; +} + /* free a region */ void free_region( struct region *region ) {
15 years, 1 month
1
0
0
0
[fireball] 44107: [rosapps] - Avoid old crt names usage, by Caemyr/kjk_hyperion.
by fireball@svn.reactos.org
Author: fireball Date: Wed Nov 11 19:19:42 2009 New Revision: 44107 URL:
http://svn.reactos.org/svn/reactos?rev=44107&view=rev
Log: [rosapps] - Avoid old crt names usage, by Caemyr/kjk_hyperion. Modified: trunk/rosapps/applications/cmdutils/touch/touch.c trunk/rosapps/applications/net/ncftp/libncftp/open.c trunk/rosapps/applications/net/ncftp/ncftp/bookmark.c trunk/rosapps/applications/net/ncftp/ncftp/cmds.c trunk/rosapps/applications/net/ncftp/ncftp/getline.c trunk/rosapps/applications/net/ncftp/ncftp/preffw.c trunk/rosapps/applications/net/ncftp/ncftp/readln.c trunk/rosapps/applications/net/ncftp/ncftp/spool.c trunk/rosapps/applications/net/ncftp/ncftp/trace.c trunk/rosapps/applications/sysutils/utils/binpatch/patch.c Modified: trunk/rosapps/applications/cmdutils/touch/touch.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/cmdutils/touc…
============================================================================== --- trunk/rosapps/applications/cmdutils/touch/touch.c [iso-8859-1] (original) +++ trunk/rosapps/applications/cmdutils/touch/touch.c [iso-8859-1] Wed Nov 11 19:19:42 2009 @@ -146,9 +146,9 @@ if (stat(*argv, &sb)) { if (!cflag) { /* Create the file. */ - fd = open(*argv, + fd = _open(*argv, O_WRONLY | O_CREAT, DEFFILEMODE); - if (fd == -1 || fstat(fd, &sb) || close(fd)) { + if (fd == -1 || fstat(fd, &sb) || _close(fd)) { rval = 1; warn("%s", *argv); continue; @@ -300,37 +300,37 @@ } needed_chmod = rval = 0; - if ((fd = open(fname, O_RDWR, 0)) == -1) { - if (!force || chmod(fname, DEFFILEMODE)) - goto err; - if ((fd = open(fname, O_RDWR, 0)) == -1) + if ((fd = _open(fname, O_RDWR, 0)) == -1) { + if (!force || _chmod(fname, DEFFILEMODE)) + goto err; + if ((fd = _open(fname, O_RDWR, 0)) == -1) goto err; needed_chmod = 1; } if (sbp->st_size != 0) { - if (read(fd, &byte, sizeof(byte)) != sizeof(byte)) - goto err; - if (lseek(fd, (off_t)0, SEEK_SET) == -1) - goto err; - if (write(fd, &byte, sizeof(byte)) != sizeof(byte)) + if (_read(fd, &byte, sizeof(byte)) != sizeof(byte)) + goto err; + if (_lseek(fd, (off_t)0, SEEK_SET) == -1) + goto err; + if (_write(fd, &byte, sizeof(byte)) != sizeof(byte)) goto err; } else { - if (write(fd, &byte, sizeof(byte)) != sizeof(byte)) { + if (_write(fd, &byte, sizeof(byte)) != sizeof(byte)) { err: rval = 1; warn("%s", fname); /* } else if (ftruncate(fd, (off_t)0)) {*/ - } else if (chsize(fd, (off_t)0)) { + } else if (_chsize(fd, (off_t)0)) { rval = 1; warn("%s: file modified", fname); } } - if (close(fd) && rval != 1) { + if (_close(fd) && rval != 1) { rval = 1; warn("%s", fname); } - if (needed_chmod && chmod(fname, sbp->st_mode) && rval != 1) { + if (needed_chmod && _chmod(fname, sbp->st_mode) && rval != 1) { rval = 1; warn("%s: permissions modified", fname); } Modified: trunk/rosapps/applications/net/ncftp/libncftp/open.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/net/ncftp/lib…
============================================================================== --- trunk/rosapps/applications/net/ncftp/libncftp/open.c [iso-8859-1] (original) +++ trunk/rosapps/applications/net/ncftp/libncftp/open.c [iso-8859-1] Wed Nov 11 19:19:42 2009 @@ -1075,14 +1075,14 @@ /* Reattach the FILE pointers for use with the Std I/O library * routines. */ - if ((cip->cin = fdopen(cip->ctrlSocketR, "r")) == NULL) { + if ((cip->cin = _fdopen(cip->ctrlSocketR, "r")) == NULL) { cip->errNo = kErrFdopenR; cip->ctrlSocketR = kClosedFileDescriptor; cip->ctrlSocketW = kClosedFileDescriptor; return (kErrFdopenR); } - if ((cip->cout = fdopen(cip->ctrlSocketW, "w")) == NULL) { + if ((cip->cout = _fdopen(cip->ctrlSocketW, "w")) == NULL) { CloseFile(&cip->cin); cip->errNo = kErrFdopenW; cip->ctrlSocketR = kClosedFileDescriptor; Modified: trunk/rosapps/applications/net/ncftp/ncftp/bookmark.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/net/ncftp/ncf…
============================================================================== --- trunk/rosapps/applications/net/ncftp/ncftp/bookmark.c [iso-8859-1] (original) +++ trunk/rosapps/applications/net/ncftp/ncftp/bookmark.c [iso-8859-1] Wed Nov 11 19:19:42 2009 @@ -297,7 +297,7 @@ return NULL; /* Okay to not have one yet. */ } - (void) chmod(pathName, 00600); + (void) _chmod(pathName, 00600); if (FGets(line, sizeof(line), fp) == NULL) { (void) fprintf(stderr, "%s: invalid format.\n", pathName); (void) fclose(fp); @@ -683,7 +683,7 @@ perror(pathName); return (NULL); } - (void) chmod(pathName, 00600); + (void) _chmod(pathName, 00600); if (nb > 0) { if (fprintf(outfp, "NcFTP bookmark-file version: %d\nNumber of bookmarks: %d\n", kBookmarkVersion, nb) < 0) { (void) fprintf(stderr, "Could not save bookmark.\n"); Modified: trunk/rosapps/applications/net/ncftp/ncftp/cmds.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/net/ncftp/ncf…
============================================================================== --- trunk/rosapps/applications/net/ncftp/ncftp/cmds.c [iso-8859-1] (original) +++ trunk/rosapps/applications/net/ncftp/ncftp/cmds.c [iso-8859-1] Wed Nov 11 19:19:42 2009 @@ -2540,7 +2540,7 @@ #endif for (i=1; i<argc; i++) { - result = FTPGetOneFile2(&gConn, argv[i], NULL, kTypeAscii, fileno(stream), kResumeNo, kAppendNo); + result = FTPGetOneFile2(&gConn, argv[i], NULL, kTypeAscii, _fileno(stream), kResumeNo, kAppendNo); if (result < 0) { if (errno != EPIPE) { ClosePager(stream); Modified: trunk/rosapps/applications/net/ncftp/ncftp/getline.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/net/ncftp/ncf…
============================================================================== --- trunk/rosapps/applications/net/ncftp/ncftp/getline.c [iso-8859-1] (original) +++ trunk/rosapps/applications/net/ncftp/ncftp/getline.c [iso-8859-1] Wed Nov 11 19:19:42 2009 @@ -506,7 +506,7 @@ } hist_init(); } - if (isatty(0) == 0 || isatty(1) == 0) + if (_isatty(0) == 0 || _isatty(1) == 0) gl_error("\n*** Error: getline(): not interactive, use stdio.\n"); gl_char_init(); gl_init_done = 1; @@ -2398,7 +2398,7 @@ if ((name[0] == '.') && ((name[1] == '\0') || ((name[1] == '.') && (name[2] == '\0')))) goto next; /* Skip . and .. */ - if ((filepfxlen == 0) || (strnicmp(name, filepfx, filepfxlen) == 0)) { + if ((filepfxlen == 0) || (_strnicmp(name, filepfx, filepfxlen) == 0)) { /* match */ len = strlen(name); cp = (char *) malloc(filepfxoffset + len + 4 /* spare */ + 1 /* NUL */); Modified: trunk/rosapps/applications/net/ncftp/ncftp/preffw.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/net/ncftp/ncf…
============================================================================== --- trunk/rosapps/applications/net/ncftp/ncftp/preffw.c [iso-8859-1] (original) +++ trunk/rosapps/applications/net/ncftp/ncftp/preffw.c [iso-8859-1] Wed Nov 11 19:19:42 2009 @@ -321,7 +321,7 @@ if (fp != NULL) { WriteDefaultFirewallPrefs(fp); (void) fclose(fp); - (void) chmod(pathName, 00600); + (void) _chmod(pathName, 00600); gNumProgramRuns = 1; } } Modified: trunk/rosapps/applications/net/ncftp/ncftp/readln.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/net/ncftp/ncf…
============================================================================== --- trunk/rosapps/applications/net/ncftp/ncftp/readln.c [iso-8859-1] (original) +++ trunk/rosapps/applications/net/ncftp/ncftp/readln.c [iso-8859-1] Wed Nov 11 19:19:42 2009 @@ -649,7 +649,7 @@ gl_strlen = Vt100VisibleStrlen; gl_histsavefile(pathName); - (void) chmod(pathName, 00600); + (void) _chmod(pathName, 00600); } /* SaveHistory */ Modified: trunk/rosapps/applications/net/ncftp/ncftp/spool.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/net/ncftp/ncf…
============================================================================== --- trunk/rosapps/applications/net/ncftp/ncftp/spool.c [iso-8859-1] (original) +++ trunk/rosapps/applications/net/ncftp/ncftp/spool.c [iso-8859-1] Wed Nov 11 19:19:42 2009 @@ -113,7 +113,7 @@ gHaveSpool = 0; if (gOurInstallationPath[0] != '\0') { OurInstallationPath(ncftpbatch, sizeof(ncftpbatch), "ncftpbatch.exe"); - gHaveSpool = (access(ncftpbatch, F_OK) == 0) ? 1 : 0; + gHaveSpool = (_access(ncftpbatch, F_OK) == 0) ? 1 : 0; } } #elif defined(BINDIR) Modified: trunk/rosapps/applications/net/ncftp/ncftp/trace.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/net/ncftp/ncf…
============================================================================== --- trunk/rosapps/applications/net/ncftp/ncftp/trace.c [iso-8859-1] (original) +++ trunk/rosapps/applications/net/ncftp/ncftp/trace.c [iso-8859-1] Wed Nov 11 19:19:42 2009 @@ -125,7 +125,7 @@ fp = fopen(pathName, FOPEN_WRITE_TEXT); if (fp != NULL) { - (void) chmod(pathName, 00600); + (void) _chmod(pathName, 00600); #ifdef HAVE_SETVBUF (void) setvbuf(fp, gTraceLBuf, _IOLBF, sizeof(gTraceLBuf)); #endif /* HAVE_SETVBUF */ Modified: trunk/rosapps/applications/sysutils/utils/binpatch/patch.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/util…
============================================================================== --- trunk/rosapps/applications/sysutils/utils/binpatch/patch.c [iso-8859-1] (original) +++ trunk/rosapps/applications/sysutils/utils/binpatch/patch.c [iso-8859-1] Wed Nov 11 19:19:42 2009 @@ -69,7 +69,7 @@ } /* Get file size */ - if (fstat(fileno(f), &sb) < 0) + if (fstat(_fileno(f), &sb) < 0) { fclose(f); printf("Couldn't get size of file %s!\n", fileName); @@ -506,7 +506,7 @@ _snprintf(buffer, MAX_PATH, "%s.bak", fileName); buffer[MAX_PATH-1] = '\0'; makeBackup = 1; - if (access(buffer, 0) >= 0) /* file exists */ + if (_access(buffer, 0) >= 0) /* file exists */ { printf("File %s already exists, overwrite? (Y)es, (N)o, (A)bort", buffer); do
15 years, 1 month
1
0
0
0
[arty] 44106: Wide page tables.
by arty@svn.reactos.org
Author: arty Date: Wed Nov 11 16:14:32 2009 New Revision: 44106 URL:
http://svn.reactos.org/svn/reactos?rev=44106&view=rev
Log: Wide page tables. Added: branches/arty-newcc/ntoskrnl/mm/section/sptab.c (with props) Modified: branches/arty-newcc/ntoskrnl/include/internal/newmm.h branches/arty-newcc/ntoskrnl/mm/section/data.c branches/arty-newcc/ntoskrnl/mm/section/image.c branches/arty-newcc/ntoskrnl/mm/section/pagefile.c branches/arty-newcc/ntoskrnl/ntoskrnl-generic.rbuild Modified: branches/arty-newcc/ntoskrnl/include/internal/newmm.h URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/include/int…
============================================================================== --- branches/arty-newcc/ntoskrnl/include/internal/newmm.h [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/include/internal/newmm.h [iso-8859-1] Wed Nov 11 16:14:32 2009 @@ -256,16 +256,6 @@ #define InterlockedExchangePte(PointerPte, Value) \ InterlockedExchange((PLONG)(PointerPte), Value) -typedef struct -{ - ULONG Entry[NR_SECTION_PAGE_ENTRIES]; -} SECTION_PAGE_TABLE, *PSECTION_PAGE_TABLE; - -typedef struct -{ - PSECTION_PAGE_TABLE PageTables[NR_SECTION_PAGE_TABLES]; -} SECTION_PAGE_DIRECTORY, *PSECTION_PAGE_DIRECTORY; - typedef struct _MM_SECTION_SEGMENT { FAST_MUTEX Lock; /* lock which protects the page directory */ @@ -276,7 +266,6 @@ ULONG Protection; ULONG Flags; BOOLEAN WriteCopy; - SECTION_PAGE_DIRECTORY PageDirectory; struct { @@ -284,6 +273,8 @@ ULONG_PTR VirtualAddress; /* dtart offset into the address range for image sections */ ULONG Characteristics; } Image; + + RTL_GENERIC_TABLE PageTable; } MM_SECTION_SEGMENT, *PMM_SECTION_SEGMENT; typedef struct _MM_IMAGE_SECTION_OBJECT @@ -517,7 +508,7 @@ { PROS_SECTION_OBJECT Section; PMM_SECTION_SEGMENT Segment; - ULONG Offset; + LARGE_INTEGER Offset; BOOLEAN WasDirty; BOOLEAN Private; } @@ -1054,7 +1045,30 @@ MmDeleteKernelStack(PVOID Stack, BOOLEAN GuiStack); -/* balace.c ******************************************************************/ +/* sptab.c *******************************************************************/ + +VOID +NTAPI +MiInitializeSectionPageTable(PMM_SECTION_SEGMENT Segment); + +NTSTATUS +NTAPI +MiSetPageEntrySectionSegment +(PMM_SECTION_SEGMENT Segment, + PLARGE_INTEGER Offset, + ULONG Entry); + +ULONG +NTAPI +MiGetPageEntrySectionSegment +(PMM_SECTION_SEGMENT Segment, + PLARGE_INTEGER Offset); + +VOID +NTAPI +MiFreePageTablesSectionSegment(PMM_SECTION_SEGMENT Segment); + +/* balance.c ******************************************************************/ VOID NTAPI @@ -1699,21 +1713,16 @@ VOID MmPageOutDeleteMapping(PVOID Context, PEPROCESS Process, PVOID Address); -ULONG -NTAPI -MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, - ULONG Offset); - VOID NTAPI MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, - ULONG Offset); + PLARGE_INTEGER Offset); BOOLEAN NTAPI MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section, PMM_SECTION_SEGMENT Segment, - ULONG Offset, + PLARGE_INTEGER Offset, BOOLEAN Dirty, BOOLEAN PageOut); Modified: branches/arty-newcc/ntoskrnl/mm/section/data.c URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/…
============================================================================== --- branches/arty-newcc/ntoskrnl/mm/section/data.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/mm/section/data.c [iso-8859-1] Wed Nov 11 16:14:32 2009 @@ -86,21 +86,6 @@ /* Note: Mmsp prefix denotes "Memory Manager Section Private". */ - -VOID -NTAPI -MiFreePageTablesSectionSegment(PMM_SECTION_SEGMENT Segment) -{ - ULONG i; - for (i = 0; i < NR_SECTION_PAGE_TABLES; i++) - { - if (Segment->PageDirectory.PageTables[i] != NULL) - { - ExFreePool(Segment->PageDirectory.PageTables[i]); - } - } -} - /* * FUNCTION: Waits in kernel mode up to ten seconds for an MM_PAGEOP event. * ARGUMENTS: PMM_PAGEOP which event we should wait for. @@ -153,69 +138,12 @@ VOID NTAPI -MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, - ULONG Offset, - ULONG Entry) -{ - PSECTION_PAGE_TABLE Table; - ULONG DirectoryOffset; - ULONG TableOffset; - - DirectoryOffset = PAGE_TO_SECTION_PAGE_DIRECTORY_OFFSET(Offset); - Table = Segment->PageDirectory.PageTables[DirectoryOffset]; - if (Table == NULL) - { - Table = - Segment->PageDirectory.PageTables[DirectoryOffset] = - ExAllocatePoolWithTag(NonPagedPool, sizeof(SECTION_PAGE_TABLE), - TAG_SECTION_PAGE_TABLE); - if (Table == NULL) - { - ASSERT(FALSE); - } - memset(Table, 0, sizeof(SECTION_PAGE_TABLE)); - DPRINT("Table %x\n", Table); - } - TableOffset = PAGE_TO_SECTION_PAGE_TABLE_OFFSET(Offset); - Table->Entry[TableOffset] = Entry; -} - - -ULONG -NTAPI -MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, - ULONG Offset) -{ - PSECTION_PAGE_TABLE Table; +MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, + PLARGE_INTEGER Offset) +{ ULONG Entry; - ULONG DirectoryOffset; - ULONG TableOffset; - - //DPRINT("MmGetPageEntrySection(Segment %x, Offset %x)\n", Segment, Offset); - - DirectoryOffset = PAGE_TO_SECTION_PAGE_DIRECTORY_OFFSET(Offset); - Table = Segment->PageDirectory.PageTables[DirectoryOffset]; - if (Table == NULL) - { - return(0); - } - - TableOffset = PAGE_TO_SECTION_PAGE_TABLE_OFFSET(Offset); - Entry = Table->Entry[TableOffset]; - - //DPRINT("MmGetPageEntrySection(%p,%x) -> %x\n", Segment, Offset, Entry); - - return(Entry); -} - -VOID -NTAPI -MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, - ULONG Offset) -{ - ULONG Entry; - - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + + Entry = MiGetPageEntrySectionSegment(Segment, Offset); if (Entry == 0) { DPRINT1("Entry == 0 for MmSharePageEntrySectionSegment\n"); @@ -231,14 +159,14 @@ ASSERT(FALSE); } Entry = MAKE_SSE(PAGE_FROM_SSE(Entry), SHARE_COUNT_FROM_SSE(Entry) + 1); - MmSetPageEntrySectionSegment(Segment, Offset, Entry); + MiSetPageEntrySectionSegment(Segment, Offset, Entry); } BOOLEAN NTAPI MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section, PMM_SECTION_SEGMENT Segment, - ULONG Offset, + PLARGE_INTEGER Offset, BOOLEAN Dirty, BOOLEAN PageOut) { @@ -246,7 +174,7 @@ DPRINT("MmUnsharePageEntrySectionSegment(%p,%x,Type %x)\n", Segment, Offset, Segment->Flags); - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + Entry = MiGetPageEntrySectionSegment(Segment, Offset); if (Entry == 0) { DPRINT1("Entry == 0 for MmUnsharePageEntrySectionSegment\n"); @@ -272,16 +200,13 @@ SWAPENTRY SavedSwapEntry; PFN_TYPE Page; NTSTATUS Status; - LARGE_INTEGER FileOffset; - - FileOffset.QuadPart = Offset; Page = PFN_FROM_SSE(Entry); FileObject = Section->FileObject; if (MmIsDirtyPageRmap(Page)) { - Status = MiWriteBackPage(FileObject, &FileOffset, PAGE_SIZE, Page); + Status = MiWriteBackPage(FileObject, Offset, PAGE_SIZE, Page); if (!NT_SUCCESS(Status)) { DPRINT1("CcRosUnmapCacheSegment failed, status = %x\n", Status); @@ -293,13 +218,13 @@ SavedSwapEntry = MmGetSavedSwapEntryPage(Page); if (SavedSwapEntry == 0) { - MmSetPageEntrySectionSegment(Segment, Offset, 0); + MiSetPageEntrySectionSegment(Segment, Offset, 0); MmReleasePageMemoryConsumer(MC_USER, Page); } } else { - MmSetPageEntrySectionSegment(Segment, Offset, Entry); + MiSetPageEntrySectionSegment(Segment, Offset, Entry); } DPRINT("MmUnsharePageEntrySectionSegment(%p,%x) -> Done\n", Segment, Offset); return(SHARE_COUNT_FROM_SSE(Entry) > 0); @@ -440,7 +365,7 @@ */ MmLockSectionSegment(Segment); - Entry = MmGetPageEntrySectionSegment(Segment, TotalOffset.QuadPart); + Entry = MiGetPageEntrySectionSegment(Segment, &TotalOffset); HasSwapEntry = MmIsPageSwapEntry(Process, (PVOID)PAddress); DPRINT("Entry %x HasSwapEntry %x Offset %x\n", Entry, HasSwapEntry, TotalOffset.QuadPart); @@ -461,7 +386,7 @@ } MmLockSectionSegment(Segment); - Entry = MmGetPageEntrySectionSegment(Segment, TotalOffset.QuadPart); + Entry = MiGetPageEntrySectionSegment(Segment, &TotalOffset); if (Entry != 0) // Handled elsewhere { @@ -568,7 +493,7 @@ * Check the entry. No one should change the status of a page * that has a pending page-in. */ - Entry1 = MmGetPageEntrySectionSegment(Segment, TotalOffset.QuadPart); + Entry1 = MiGetPageEntrySectionSegment(Segment, &TotalOffset); if (Entry != Entry1) { DPRINT1("Someone changed ppte entry while we slept\n"); @@ -580,7 +505,7 @@ * data */ Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); - MmSetPageEntrySectionSegment(Segment, TotalOffset.QuadPart, Entry); + MiSetPageEntrySectionSegment(Segment, &TotalOffset, Entry); MmInsertRmap(Page, Process, (PVOID)PAddress); MmSetCleanAllRmaps(Page); @@ -614,7 +539,7 @@ Page = PFN_FROM_SSE(Entry); - MmSharePageEntrySectionSegment(Segment, TotalOffset.QuadPart); + MmSharePageEntrySectionSegment(Segment, &TotalOffset); Status = MmCreateVirtualMapping(Process, Address, @@ -670,7 +595,7 @@ PFN_TYPE NewPage; NTSTATUS Status; PVOID PAddress; - ULONG Offset; + LARGE_INTEGER Offset; PMM_REGION Region; ULONG Entry; PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace); @@ -691,8 +616,8 @@ * Find the offset of the page */ PAddress = MM_ROUND_DOWN(Address, PAGE_SIZE); - Offset = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress - + MemoryArea->Data.SectionData.ViewOffset; + Offset.QuadPart = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress + + MemoryArea->Data.SectionData.ViewOffset; Segment = MemoryArea->Data.SectionData.Segment; Section = MemoryArea->Data.SectionData.Section; @@ -705,7 +630,7 @@ MmLockSectionSegment(Segment); OldPage = MmGetPfnForProcess(Process, Address); - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); /* * Check if we are doing COW @@ -779,7 +704,7 @@ */ MmDeleteRmap(OldPage, Process, PAddress); MmInsertRmap(NewPage, Process, PAddress); - MmUnsharePageEntrySectionSegment(Section, Segment, Offset, FALSE, FALSE); + MmUnsharePageEntrySectionSegment(Section, Segment, &Offset, FALSE, FALSE); MmUnlockSectionSegment(Segment); DPRINT("Address 0x%.8X\n", Address); @@ -795,19 +720,19 @@ PVOID Address, PPFN_TYPE Page) { - ULONG Offset; NTSTATUS Status; ULONG Entry, Entry1; SWAPENTRY SwapEntry; PMM_REGION Region; + LARGE_INTEGER Offset; PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace); Address = MM_ROUND_DOWN(Address, PAGE_SIZE); - Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress; + Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress; Region = MmFindRegion(MemoryArea->StartingAddress, &MemoryArea->Data.SectionData.RegionListHead, Address, NULL); - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); SwapEntry = SWAPENTRY_FROM_SSE(Entry); /* @@ -839,7 +764,7 @@ * Check the entry. No one should change the status of a page * that has a pending page-in. */ - Entry1 = MmGetPageEntrySectionSegment(Segment, Offset); + Entry1 = MiGetPageEntrySectionSegment(Segment, &Offset); if (Entry != Entry1) { DPRINT1("Someone changed ppte entry while we slept\n"); @@ -851,7 +776,7 @@ * data */ Entry = MAKE_SSE(*Page << PAGE_SHIFT, 1); - MmSetPageEntrySectionSegment(Segment, Offset, Entry); + MiSetPageEntrySectionSegment(Segment, &Offset, Entry); MmUnlockSectionSegment(Segment); /* @@ -905,7 +830,7 @@ while (FileOffset.QuadPart < End.QuadPart) { PVOID Address; - ULONG Entry = MmGetPageEntrySectionSegment(Segment, FileOffset.QuadPart); + ULONG Entry = MiGetPageEntrySectionSegment(Segment, &FileOffset); if (Entry == 0) { if (!NT_SUCCESS(MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page))) @@ -917,7 +842,7 @@ Address = ((PCHAR)MemoryArea->StartingAddress) + FileOffset.QuadPart - FirstMapped.QuadPart; MmCreateVirtualMapping(NULL, Address, PAGE_READWRITE, &Page, 1); MmInsertRmap(Page, NULL, Address); - MmSetPageEntrySectionSegment(Segment, FileOffset.QuadPart, MAKE_SSE(Page << PAGE_SHIFT, 1)); + MiSetPageEntrySectionSegment(Segment, &FileOffset, MAKE_SSE(Page << PAGE_SHIFT, 1)); } FileOffset.QuadPart += PAGE_SIZE; } @@ -963,7 +888,7 @@ MmLockSectionSegment(PageOutContext->Segment); MmUnsharePageEntrySectionSegment((PROS_SECTION_OBJECT)PageOutContext->Section, PageOutContext->Segment, - PageOutContext->Offset, + &PageOutContext->Offset, PageOutContext->WasDirty, TRUE); MmUnlockSectionSegment(PageOutContext->Segment); @@ -1005,15 +930,15 @@ Context.Segment = MemoryArea->Data.SectionData.Segment; Context.Section = MemoryArea->Data.SectionData.Section; - Context.Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress; - FileOffset.QuadPart = Context.Offset; + Context.Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress; + FileOffset = Context.Offset; FileObject = Context.Section->FileObject; /* * Get the section segment entry and the physical address. */ - Entry = MmGetPageEntrySectionSegment(Context.Segment, Context.Offset); + Entry = MiGetPageEntrySectionSegment(Context.Segment, &Context.Offset); if (!MmIsPagePresent(Process, Address)) { DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n", @@ -1132,7 +1057,7 @@ Process, Address); Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry); } MmUnlockAddressSpace(AddressSpace); PageOp->Status = STATUS_UNSUCCESSFUL; @@ -1178,7 +1103,7 @@ Process, Address); Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry); } MmUnlockAddressSpace(AddressSpace); PageOp->Status = STATUS_UNSUCCESSFUL; @@ -1208,7 +1133,7 @@ else { Entry = MAKE_SWAP_SSE(SwapEntry); - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry); } PageOp->Status = STATUS_SUCCESS; @@ -1250,7 +1175,7 @@ /* * Get the section segment entry and the physical address. */ - Entry = MmGetPageEntrySectionSegment(Segment, Offset.QuadPart); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); if (!MmIsPagePresent(Process, Address)) { DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n", @@ -1376,9 +1301,9 @@ ULONG Entry; FileOffset.QuadPart = PageAddress - BeginningAddress + ViewOffset.QuadPart; Entry = - MmGetPageEntrySectionSegment + MiGetPageEntrySectionSegment (MemoryArea->Data.SectionData.Segment, - FileOffset.QuadPart); + &FileOffset); Page = PFN_FROM_SSE(Entry); if (Entry != 0 && !IS_SWAP_FROM_SSE(Entry) && MmIsDirtyPageRmap(Page) && FileOffset.QuadPart < FileSize->QuadPart) @@ -1464,13 +1389,13 @@ Present = MmIsPagePresent(Process, Address); if (DoCOW && Present) { - ULONG Offset; + LARGE_INTEGER Offset; ULONG Entry; PFN_TYPE Page; - Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress + Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress + MemoryArea->Data.SectionData.ViewOffset; - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); Page = MmGetPfnForProcess(Process, Address); Protect = PAGE_READONLY; @@ -1797,7 +1722,7 @@ Segment->RawLength = MaximumSize; Segment->Length.QuadPart = PAGE_ROUND_UP(Segment->RawLength.QuadPart); } - RtlZeroMemory(&Segment->PageDirectory, sizeof(SECTION_PAGE_DIRECTORY)); + MiInitializeSectionPageTable(Segment); } else { @@ -2320,7 +2245,7 @@ PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset.QuadPart); } - Entry = MmGetPageEntrySectionSegment(Segment, Offset.QuadPart); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); /* * For a dirty, datafile, non-private page mark it as dirty in the @@ -2356,7 +2281,7 @@ else { MmDeleteRmap(Page, Process, Address); - MmUnsharePageEntrySectionSegment(Section, Segment, Offset.QuadPart, Dirty, FALSE); + MmUnsharePageEntrySectionSegment(Section, Segment, &Offset, Dirty, FALSE); } } } @@ -2703,7 +2628,6 @@ BOOLEAN ExtendFile) { PMM_SECTION_SEGMENT Segment = Section->Segment; - PSECTION_PAGE_TABLE PageTable = NULL; LARGE_INTEGER OldSize; DPRINT("Extend Segment %x\n", Segment); @@ -2719,11 +2643,7 @@ { NTSTATUS Status; Status = IoSetInformation(Segment->FileObject, FileEndOfFileInformation, sizeof(LARGE_INTEGER), NewSize); - if (!NT_SUCCESS(Status)) - { - if (PageTable) ExFreePool(PageTable); - return Status; - } + if (!NT_SUCCESS(Status)) return Status; } MmLockSectionSegment(Segment); Modified: branches/arty-newcc/ntoskrnl/mm/section/image.c URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/…
============================================================================== --- branches/arty-newcc/ntoskrnl/mm/section/image.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/mm/section/image.c [iso-8859-1] Wed Nov 11 16:14:32 2009 @@ -86,15 +86,15 @@ MmUnsharePageEntryImageSectionSegment (PROS_SECTION_OBJECT Section, PMM_SECTION_SEGMENT Segment, - ULONG Offset, + PLARGE_INTEGER Offset, BOOLEAN Dirty, BOOLEAN PageOut) { ULONG Entry; - DPRINT("MmUnsharePageEntrySectionSegment(%p,%x)\n", Segment, Offset); - - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + DPRINT("MmUnsharePageEntrySectionSegment(%p,%x)\n", Segment, Offset->u.LowPart); + + Entry = MiGetPageEntrySectionSegment(Segment, Offset); if (Entry == 0) { DPRINT1("Entry == 0 for MmUnsharePageEntrySectionSegment\n"); @@ -120,7 +120,7 @@ PFN_TYPE Page; LARGE_INTEGER FileOffset; - FileOffset.QuadPart = Offset + Segment->Image.FileOffset/*.QuadPart*/; + FileOffset.QuadPart = Offset->QuadPart + Segment->Image.FileOffset/*.QuadPart*/; Page = PFN_FROM_SSE(Entry); @@ -136,11 +136,11 @@ * for this page. The pager thread can't page out a * page without a rmap entry. */ - MmSetPageEntrySectionSegment(Segment, Offset, Entry); + MiSetPageEntrySectionSegment(Segment, Offset, Entry); } else { - MmSetPageEntrySectionSegment(Segment, Offset, 0); + MiSetPageEntrySectionSegment(Segment, Offset, 0); MmReleasePageMemoryConsumer(MC_USER, Page); } } @@ -165,7 +165,7 @@ ASSERT(FALSE); } } - MmSetPageEntrySectionSegment(Segment, Offset, MAKE_SWAP_SSE(SavedSwapEntry)); + MiSetPageEntrySectionSegment(Segment, Offset, MAKE_SWAP_SSE(SavedSwapEntry)); MmSetSavedSwapEntryPage(Page, 0); } MmReleasePageMemoryConsumer(MC_USER, Page); @@ -179,9 +179,9 @@ } else { - MmSetPageEntrySectionSegment(Segment, Offset, Entry); - } - DPRINT("MmUnsharePageEntrySectionSegment(%p,%x) -> Done\n", Segment, Offset); + MiSetPageEntrySectionSegment(Segment, Offset, Entry); + } + DPRINT("MmUnsharePageEntrySectionSegment(%p,%x) -> Done\n", Segment, Offset->u.LowPart); return(SHARE_COUNT_FROM_SSE(Entry) > 0); } @@ -193,7 +193,7 @@ PVOID Address, BOOLEAN Locked) { - ULONG Offset; + LARGE_INTEGER Offset; PFN_TYPE Page; NTSTATUS Status; PVOID PAddress; @@ -226,7 +226,7 @@ } PAddress = MM_ROUND_DOWN(Address, PAGE_SIZE); - Offset = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress; + Offset.QuadPart = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress; Segment = MemoryArea->Data.SectionData.Segment; Section = MemoryArea->Data.SectionData.Section; @@ -239,13 +239,13 @@ */ MmLockSectionSegment(Segment); - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); HasSwapEntry = MmIsPageSwapEntry(Process, (PVOID)PAddress); - DPRINT("Entry %x HasSwapEntry %x Offset %x\n", Entry, HasSwapEntry, Offset); - - if (Entry == 0 && !HasSwapEntry && Offset < PAGE_ROUND_UP(Segment->RawLength.QuadPart)) + DPRINT("Entry %x HasSwapEntry %x Offset %x\n", Entry, HasSwapEntry, Offset.u.LowPart); + + if (Entry == 0 && !HasSwapEntry && Offset.QuadPart < PAGE_ROUND_UP(Segment->RawLength.QuadPart)) { - TotalOffset.QuadPart = Offset + Segment->Image.FileOffset/*.QuadPart*/; + TotalOffset.QuadPart = Offset.QuadPart + Segment->Image.FileOffset/*.QuadPart*/; MmUnlockSectionSegment(Segment); MmUnlockAddressSpace(AddressSpace); @@ -258,7 +258,7 @@ } MmLockSectionSegment(Segment); - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); if (Entry != 0) // Handled elsewhere { MmUnlockSectionSegment(Segment); @@ -385,7 +385,7 @@ * Get the entry corresponding to the offset within the section */ DPRINT("MmNotPresentFaultSectionView -> MmGetPageEntrySectionSegment(%p, %x)\n", Segment, Offset); - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); DPRINT("Got entry %x\n", Entry); if (Entry == 0) @@ -400,7 +400,7 @@ */ MmUnlockAddressSpace(AddressSpace); - if (Offset >= PAGE_ROUND_UP(Segment->RawLength.QuadPart)) + if (Offset.QuadPart >= PAGE_ROUND_UP(Segment->RawLength.QuadPart)) { Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page); if (!NT_SUCCESS(Status)) @@ -453,7 +453,7 @@ * data */ Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); - MmSetPageEntrySectionSegment(Segment, Offset, Entry); + MiSetPageEntrySectionSegment(Segment, &Offset, Entry); MmInsertRmap(Page, Process, (PVOID)PAddress); @@ -485,7 +485,7 @@ Page = PFN_FROM_SSE(Entry); - MmSharePageEntrySectionSegment(Segment, Offset); + MmSharePageEntrySectionSegment(Segment, &Offset); Status = MmCreateVirtualMapping(Process, Address, @@ -534,8 +534,8 @@ Context.Segment = MemoryArea->Data.SectionData.Segment; Context.Section = MemoryArea->Data.SectionData.Section; - Context.Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress; - FileOffset.QuadPart = Context.Offset + Context.Segment->Image.FileOffset/*.QuadPart*/; + Context.Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress; + FileOffset.QuadPart = Context.Offset.QuadPart + Context.Segment->Image.FileOffset/*.QuadPart*/; IsImageSection = Context.Section->AllocationAttributes & SEC_IMAGE ? TRUE : FALSE; @@ -549,7 +549,7 @@ * then note this is a direct mapped page. */ if ((FileOffset.QuadPart % PAGE_SIZE) == 0 && - (Context.Offset + PAGE_SIZE <= Context.Segment->RawLength.QuadPart || !IsImageSection)) + (Context.Offset.QuadPart + PAGE_SIZE <= Context.Segment->RawLength.QuadPart || !IsImageSection)) { DirectMapped = TRUE; } @@ -559,7 +559,7 @@ * Get the section segment entry and the physical address. */ DPRINT("MmPageOutSectionView -> MmGetPageEntrySectionSegment(%p, %x)\n", Context.Segment, Context.Offset); - Entry = MmGetPageEntrySectionSegment(Context.Segment, Context.Offset); + Entry = MiGetPageEntrySectionSegment(Context.Segment, &Context.Offset); if (!MmIsPagePresent(Process, Address)) { DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n", @@ -608,7 +608,7 @@ MmSetSavedSwapEntryPage(Page, 0); if (SwapEntry != 0) { - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, MAKE_SWAP_SSE(SwapEntry)); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, MAKE_SWAP_SSE(SwapEntry)); } MmReleasePageMemoryConsumer(MC_USER, Page); PageOp->Status = STATUS_SUCCESS; @@ -715,7 +715,7 @@ Process, Address); Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry); } MmUnlockAddressSpace(AddressSpace); PageOp->Status = STATUS_UNSUCCESSFUL; @@ -761,7 +761,7 @@ Process, Address); Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry); } MmUnlockAddressSpace(AddressSpace); PageOp->Status = STATUS_UNSUCCESSFUL; @@ -776,7 +776,7 @@ MmSetSavedSwapEntryPage(Page, 0); if (Context.Segment->Image.Characteristics & IMAGE_SCN_MEM_SHARED) { - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, MAKE_SWAP_SSE(SwapEntry)); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, MAKE_SWAP_SSE(SwapEntry)); } else { @@ -798,7 +798,7 @@ else { Entry = MAKE_SWAP_SSE(SwapEntry); - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry); } PageOp->Status = STATUS_SUCCESS; @@ -1438,9 +1438,7 @@ ExInitializeFastMutex(&ImageSectionObject->Segments[i].Lock); ImageSectionObject->Segments[i].Flags = MM_IMAGE_SEGMENT; ImageSectionObject->Segments[i].ReferenceCount = 1; - - RtlZeroMemory(&ImageSectionObject->Segments[i].PageDirectory, - sizeof(ImageSectionObject->Segments[i].PageDirectory)); + MiInitializeSectionPageTable(&ImageSectionObject->Segments[i]); } ASSERT(NT_SUCCESS(Status)); @@ -1618,18 +1616,18 @@ MmpFreeSharedSegment(PMM_SECTION_SEGMENT Segment) { ULONG Length; - ULONG Offset; ULONG Entry; ULONG SavedSwapEntry; PFN_TYPE Page; + LARGE_INTEGER Offset; Page = 0; Length = PAGE_ROUND_UP(Segment->Length.QuadPart); - for (Offset = 0; Offset < Length; Offset += PAGE_SIZE) - { - DPRINT("MmAlterViewAttributes -> MmGetPageEntrySectionSegment(%p, %x)\n", Segment, Offset); - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + for (Offset.QuadPart = 0; Offset.QuadPart < Length; Offset.QuadPart += PAGE_SIZE) + { + DPRINT("MmAlterViewAttributes -> MmGetPageEntrySectionSegment(%p, %x)\n", Segment, Offset.u.LowPart); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); if (Entry) { if (IS_SWAP_FROM_SSE(Entry)) @@ -1647,7 +1645,7 @@ } MmReleasePageMemoryConsumer(MC_USER, Page); } - MmSetPageEntrySectionSegment(Segment, Offset, 0); + MiSetPageEntrySectionSegment(Segment,& Offset, 0); } } } @@ -1784,10 +1782,10 @@ { ULONG Entry; PFILE_OBJECT FileObject; - ULONG Offset; SWAPENTRY SavedSwapEntry; PMM_PAGEOP PageOp; NTSTATUS Status; + LARGE_INTEGER Offset; PROS_SECTION_OBJECT Section; PMM_SECTION_SEGMENT Segment; PMMSUPPORT AddressSpace; @@ -1798,13 +1796,13 @@ Address = (PVOID)PAGE_ROUND_DOWN(Address); - Offset = ((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress) + + Offset.QuadPart = ((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress) + MemoryArea->Data.SectionData.ViewOffset; Section = MemoryArea->Data.SectionData.Section; Segment = MemoryArea->Data.SectionData.Segment; - PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset); + PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset.QuadPart); while (PageOp) { @@ -1821,11 +1819,11 @@ MmLockAddressSpace(AddressSpace); MmLockSectionSegment(Segment); MmspCompleteAndReleasePageOp(PageOp); - PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset); - } - - DPRINT("MmFreeSectionPage -> MmGetPageEntrySectionSegment(%p, %x)\n", Segment, Offset); - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset.QuadPart); + } + + DPRINT("MmFreeSectionPage -> MmGetPageEntrySectionSegment(%p, %x)\n", Segment, Offset.u.LowPart); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); /* * For a dirty, datafile, non-private page mark it as dirty in the @@ -1872,7 +1870,7 @@ else { MmDeleteRmap(Page, Process, Address); - MmUnsharePageEntryImageSectionSegment(Section, Segment, Offset, Dirty, FALSE); + MmUnsharePageEntryImageSectionSegment(Section, Segment, &Offset, Dirty, FALSE); } } } Modified: branches/arty-newcc/ntoskrnl/mm/section/pagefile.c URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/…
============================================================================== --- branches/arty-newcc/ntoskrnl/mm/section/pagefile.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/mm/section/pagefile.c [iso-8859-1] Wed Nov 11 16:14:32 2009 @@ -62,10 +62,10 @@ PVOID Address, BOOLEAN Locked) { - ULONG Offset; PFN_TYPE Page; NTSTATUS Status; PVOID PAddress; + LARGE_INTEGER Offset; PROS_SECTION_OBJECT Section; PMM_SECTION_SEGMENT Segment; ULONG Entry; @@ -93,7 +93,7 @@ } PAddress = MM_ROUND_DOWN(Address, PAGE_SIZE); - Offset = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress; + Offset.QuadPart = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress; Segment = MemoryArea->Data.SectionData.Segment; Section = MemoryArea->Data.SectionData.Section; @@ -122,7 +122,7 @@ /* * Get or create a page operation descriptor */ - PageOp = MmGetPageOp(MemoryArea, NULL, 0, Segment, Offset, MM_PAGEOP_PAGEIN, FALSE); + PageOp = MmGetPageOp(MemoryArea, NULL, 0, Segment, Offset.QuadPart, MM_PAGEOP_PAGEIN, FALSE); if (PageOp == NULL) { DPRINT1("MmGetPageOp failed\n"); @@ -181,7 +181,7 @@ { DPRINT("!MmIsPagePresent(%p, %p)\n", Process, Address); - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); HasSwapEntry = MmIsPageSwapEntry(Process, (PVOID)PAddress); if (PAGE_FROM_SSE(Entry) == 0 || HasSwapEntry) @@ -196,7 +196,7 @@ Page = PFN_FROM_SSE(Entry); - MmSharePageEntrySectionSegment(Segment, Offset); + MmSharePageEntrySectionSegment(Segment, &Offset); /* FIXME: Should we call MmCreateVirtualMappingUnsafe if * (Section->AllocationAttributes & SEC_PHYSICALMEMORY) is true? @@ -227,7 +227,7 @@ /* * Get the entry corresponding to the offset within the section */ - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); if (Entry == 0) { @@ -268,7 +268,7 @@ * Check the entry. No one should change the status of a page * that has a pending page-in. */ - Entry1 = MmGetPageEntrySectionSegment(Segment, Offset); + Entry1 = MiGetPageEntrySectionSegment(Segment, &Offset); if (Entry != Entry1) { DPRINT1("Someone changed ppte entry while we slept\n"); @@ -280,7 +280,7 @@ * data */ Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); - MmSetPageEntrySectionSegment(Segment, Offset, Entry); + MiSetPageEntrySectionSegment(Segment, &Offset, Entry); MmUnlockSectionSegment(Segment); MmInsertRmap(Page, Process, (PVOID)PAddress); @@ -314,7 +314,7 @@ Page = PFN_FROM_SSE(Entry); - MmSharePageEntrySectionSegment(Segment, Offset); + MmSharePageEntrySectionSegment(Segment, &Offset); MmUnlockSectionSegment(Segment); Status = MmCreateVirtualMapping(Process, @@ -414,7 +414,7 @@ Segment->Length.QuadPart = PAGE_ROUND_UP(MaximumSize.QuadPart); Segment->Flags = MM_PAGEFILE_SEGMENT; Segment->WriteCopy = FALSE; - RtlZeroMemory(&Segment->PageDirectory, sizeof(SECTION_PAGE_DIRECTORY)); + MiInitializeSectionPageTable(Segment); *SectionObject = Section; return(STATUS_SUCCESS); } @@ -446,7 +446,7 @@ MmLockSectionSegment(PageOutContext->Segment); MmUnsharePageEntrySectionSegment((PROS_SECTION_OBJECT)PageOutContext->Section, PageOutContext->Segment, - PageOutContext->Offset, + &PageOutContext->Offset, PageOutContext->WasDirty, TRUE); MmUnlockSectionSegment(PageOutContext->Segment); @@ -490,8 +490,8 @@ Context.Segment = MemoryArea->Data.SectionData.Segment; Context.Section = MemoryArea->Data.SectionData.Section; - Context.Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress; - FileOffset.QuadPart = Context.Offset; + Context.Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress; + FileOffset = Context.Offset; IsImageSection = Context.Section->AllocationAttributes & SEC_IMAGE ? TRUE : FALSE; @@ -501,7 +501,7 @@ * Get the section segment entry and the physical address. */ DPRINT("MmPageOutSectionView -> MmGetPageEntrySectionSegment(%p, %x)\n", Context.Segment, Context.Offset); - Entry = MmGetPageEntrySectionSegment(Context.Segment, Context.Offset); + Entry = MiGetPageEntrySectionSegment(Context.Segment, &Context.Offset); if (!MmIsPagePresent(Process, Address)) { DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n", @@ -608,7 +608,7 @@ Process, Address); Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry); } MmUnlockAddressSpace(AddressSpace); PageOp->Status = STATUS_UNSUCCESSFUL; @@ -654,7 +654,7 @@ Process, Address); Entry = MAKE_SSE(Page << PAGE_SHIFT, 1); - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry); } MmUnlockAddressSpace(AddressSpace); PageOp->Status = STATUS_UNSUCCESSFUL; @@ -684,7 +684,7 @@ else { Entry = MAKE_SWAP_SSE(SwapEntry); - MmSetPageEntrySectionSegment(Context.Segment, Context.Offset, Entry); + MiSetPageEntrySectionSegment(Context.Segment, &Context.Offset, Entry); } PageOp->Status = STATUS_SUCCESS; @@ -698,9 +698,9 @@ PFN_TYPE Page, SWAPENTRY SwapEntry, BOOLEAN Dirty) { ULONG Entry; - ULONG Offset; PMM_PAGEOP PageOp; NTSTATUS Status; + LARGE_INTEGER Offset; PROS_SECTION_OBJECT Section; PMM_SECTION_SEGMENT Segment; PMMSUPPORT AddressSpace; @@ -711,13 +711,13 @@ Address = (PVOID)PAGE_ROUND_DOWN(Address); - Offset = ((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress) + + Offset.QuadPart = ((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress) + MemoryArea->Data.SectionData.ViewOffset; Section = MemoryArea->Data.SectionData.Section; Segment = MemoryArea->Data.SectionData.Segment; - PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset); + PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset.QuadPart); while (PageOp) { @@ -734,16 +734,16 @@ MmLockAddressSpace(AddressSpace); MmLockSectionSegment(Segment); MmspCompleteAndReleasePageOp(PageOp); - PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset); - } - - DPRINT("MmFreeSectionPage -> MmGetPageEntrySectionSegment(%p, %x)\n", Segment, Offset); - Entry = MmGetPageEntrySectionSegment(Segment, Offset); + PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL, Segment, Offset.QuadPart); + } + + DPRINT("MmFreeSectionPage -> MmGetPageEntrySectionSegment(%p, %x)\n", Segment, Offset.u.LowPart); + Entry = MiGetPageEntrySectionSegment(Segment, &Offset); if (Page != 0) { MmDeleteRmap(Page, Process, Address); - MmUnsharePageEntrySectionSegment(Section, Segment, Offset, Dirty, FALSE); + MmUnsharePageEntrySectionSegment(Section, Segment, &Offset, Dirty, FALSE); } } Added: branches/arty-newcc/ntoskrnl/mm/section/sptab.c URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/…
============================================================================== --- branches/arty-newcc/ntoskrnl/mm/section/sptab.c (added) +++ branches/arty-newcc/ntoskrnl/mm/section/sptab.c [iso-8859-1] Wed Nov 11 16:14:32 2009 @@ -1,0 +1,202 @@ +/* + * Copyright (C) 1998-2005 ReactOS Team (and the authors from the programmers section) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/mm/section.c + * PURPOSE: Section object page tables + * + * PROGRAMMERS: arty + */ + +/* INCLUDES *****************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <debug.h> + +/* TYPES *********************************************************************/ + +#define ENTRIES_PER_ELEMENT 244 + +PVOID NTAPI RtlGetElementGenericTable(PRTL_GENERIC_TABLE Table, PVOID Data); +ULONG NTAPI RtlNumberGenericTableElements(PRTL_GENERIC_TABLE Table); + +typedef struct _SECTION_PAGE_TABLE +{ + LARGE_INTEGER FileOffset; + ULONG Refcount; + ULONG PageEntries[ENTRIES_PER_ELEMENT]; +} SECTION_PAGE_TABLE, *PSECTION_PAGE_TABLE; + +SECTION_PAGE_TABLE MiSectionZeroPageTable = { }; + +static +PVOID +NTAPI +MiSectionPageTableAllocate(PRTL_GENERIC_TABLE Table, CLONG Bytes) +{ + PVOID Result; + Result = ExAllocatePoolWithTag(NonPagedPool, Bytes, 'MmPt'); + DPRINT("MiSectionPageTableAllocate(%d) => %p\n", Bytes, Result); + return Result; +} + +static +VOID +NTAPI +MiSectionPageTableFree(PRTL_GENERIC_TABLE Table, PVOID Data) +{ + DPRINT("MiSectionPageTableFree(%p)\n", Data); + ExFreePoolWithTag(Data, 'MmPt'); +} + +static +RTL_GENERIC_COMPARE_RESULTS +NTAPI +MiSectionPageTableCompare(PRTL_GENERIC_TABLE Table, PVOID PtrA, PVOID PtrB) +{ + PLARGE_INTEGER A = PtrA, B = PtrB; + BOOLEAN Result = (A->QuadPart < B->QuadPart) ? GenericLessThan : + (A->QuadPart == B->QuadPart) ? GenericEqual : GenericGreaterThan; + + DPRINT + ("Compare: %08x%08x vs %08x%08x => %s\n", + A->u.HighPart, A->u.LowPart, + B->u.HighPart, B->u.LowPart, + Result == GenericLessThan ? "GenericLessThan" : + Result == GenericGreaterThan ? "GenericGreaterThan" : + "GenericEqual"); + + return Result; +} + +static +PSECTION_PAGE_TABLE +NTAPI +MiSectionPageTableGet +(PRTL_GENERIC_TABLE Table, + PLARGE_INTEGER FileOffset) +{ + LARGE_INTEGER SearchFileOffset; + SearchFileOffset.QuadPart = ROUND_DOWN(FileOffset->QuadPart, ENTRIES_PER_ELEMENT * PAGE_SIZE); + return RtlLookupElementGenericTable(Table, &SearchFileOffset); +} + +static +PSECTION_PAGE_TABLE +NTAPI +MiSectionPageTableGetOrAllocate +(PRTL_GENERIC_TABLE Table, + PLARGE_INTEGER FileOffset) +{ + LARGE_INTEGER SearchFileOffset; + PSECTION_PAGE_TABLE PageTableSlice = + MiSectionPageTableGet(Table, FileOffset); + if (!PageTableSlice) + { + SearchFileOffset.QuadPart = ROUND_DOWN(FileOffset->QuadPart, ENTRIES_PER_ELEMENT * PAGE_SIZE); + MiSectionZeroPageTable.FileOffset = SearchFileOffset; + MiSectionZeroPageTable.Refcount = 1; + PageTableSlice = RtlInsertElementGenericTable + (Table, &MiSectionZeroPageTable, sizeof(MiSectionZeroPageTable), NULL); + DPRINT + ("Allocate page table %x (%08x%08x)\n", + PageTableSlice, + PageTableSlice->FileOffset.u.HighPart, + PageTableSlice->FileOffset.u.LowPart); + if (!PageTableSlice) return NULL; + } + return PageTableSlice; +} + +VOID +NTAPI +MiInitializeSectionPageTable(PMM_SECTION_SEGMENT Segment) +{ + RtlInitializeGenericTable + (&Segment->PageTable, + MiSectionPageTableCompare, + MiSectionPageTableAllocate, + MiSectionPageTableFree, + NULL); + DPRINT("MiInitializeSectionPageTable(%p)\n", &Segment->PageTable); +} + +NTSTATUS +NTAPI +MiSetPageEntrySectionSegment +(PMM_SECTION_SEGMENT Segment, + PLARGE_INTEGER Offset, + ULONG Entry) +{ + ULONG PageIndex; + PSECTION_PAGE_TABLE PageTable; + PageTable = + MiSectionPageTableGetOrAllocate(&Segment->PageTable, Offset); + if (!PageTable) return STATUS_NO_MEMORY; + PageIndex = + (Offset->QuadPart - PageTable->FileOffset.QuadPart) / PAGE_SIZE; + PageTable->PageEntries[PageIndex] = Entry; + DPRINT + ("MiSetPageEntrySectionSegment(%p,%08x%08x,%x)\n", + &Segment->PageTable, Offset->u.HighPart, Offset->u.LowPart, Entry); + return STATUS_SUCCESS; +} + +ULONG +NTAPI +MiGetPageEntrySectionSegment +(PMM_SECTION_SEGMENT Segment, + PLARGE_INTEGER Offset) +{ + LARGE_INTEGER FileOffset; + ULONG PageIndex, Result; + PSECTION_PAGE_TABLE PageTable; + + FileOffset.QuadPart = + ROUND_DOWN(Offset->QuadPart, ENTRIES_PER_ELEMENT * PAGE_SIZE); + PageTable = MiSectionPageTableGet(&Segment->PageTable, &FileOffset); + if (!PageTable) return 0; + PageIndex = + (Offset->QuadPart - PageTable->FileOffset.QuadPart) / PAGE_SIZE; + Result = PageTable->PageEntries[PageIndex]; + DPRINT + ("MiGetPageEntrySectionSegment(%p,%08x%08x) => %x\n", + &Segment->PageTable, + FileOffset.u.HighPart, + FileOffset.u.LowPart, + Result); + return Result; +} + +VOID +NTAPI +MiFreePageTablesSectionSegment(PMM_SECTION_SEGMENT Segment) +{ + PSECTION_PAGE_TABLE Element; + DPRINT("MiFreePageTablesSectionSegment(%p)\n", &Segment->PageTable); + while (RtlNumberGenericTableElements(&Segment->PageTable) && + (Element = RtlGetElementGenericTable(&Segment->PageTable, 0))) + { + DPRINT + ("Delete table for %08x%08x\n", + Element->FileOffset.u.HighPart, + Element->FileOffset.u.LowPart); + RtlDeleteElementGenericTable(&Segment->PageTable, Element); + } +} Propchange: branches/arty-newcc/ntoskrnl/mm/section/sptab.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/arty-newcc/ntoskrnl/ntoskrnl-generic.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/ntoskrnl-ge…
============================================================================== --- branches/arty-newcc/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Wed Nov 11 16:14:32 2009 @@ -457,6 +457,7 @@ <file>pagefile.c</file> <file>pe.c</file> <file>physical.c</file> + <file>sptab.c</file> </directory> </if> </directory>
15 years, 1 month
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
...
45
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
Results per page:
10
25
50
100
200