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
April 2008
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
21 participants
395 discussions
Start a n
N
ew thread
[hyperion] 33117: modified include/psdk/ntdef.h C_ASSERT is equivalent to a typedef, NOT a variable declaration modified ntoskrnl/mm/pe.c Convert as many ASSERTs as possible to C_ASSERT
by hyperion@svn.reactos.org
Author: hyperion Date: Tue Apr 22 17:45:53 2008 New Revision: 33117 URL:
http://svn.reactos.org/svn/reactos?rev=33117&view=rev
Log: modified include/psdk/ntdef.h C_ASSERT is equivalent to a typedef, NOT a variable declaration modified ntoskrnl/mm/pe.c Convert as many ASSERTs as possible to C_ASSERT Modified: trunk/reactos/include/psdk/ntdef.h trunk/reactos/ntoskrnl/mm/pe.c Modified: trunk/reactos/include/psdk/ntdef.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntdef.h?rev=3…
============================================================================== --- trunk/reactos/include/psdk/ntdef.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ntdef.h [iso-8859-1] Tue Apr 22 17:45:53 2008 @@ -130,6 +130,6 @@ #define MAXUSHORT 0xffff #define MAXULONG 0xffffffff #define MAXLONGLONG (0x7fffffffffffffffLL) -#define C_ASSERT(e) extern char __C_ASSERT__[(e)?1:-1] +#define C_ASSERT(e) typedef __C_ASSERT__ char[(e)?1:-1] #endif /* _NTDEF_H */ Modified: trunk/reactos/ntoskrnl/mm/pe.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pe.c?rev=33117…
============================================================================== --- trunk/reactos/ntoskrnl/mm/pe.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/pe.c [iso-8859-1] Tue Apr 22 17:45:53 2008 @@ -178,7 +178,7 @@ ASSERT(Intsafe_CanOffsetPointer(FileHeader, FileHeaderSize)); - ASSERT(EXEFMT_LOAD_HEADER_SIZE >= sizeof(IMAGE_DOS_HEADER)); + C_ASSERT(EXEFMT_LOAD_HEADER_SIZE >= sizeof(IMAGE_DOS_HEADER)); ASSERT(((UINT_PTR)FileHeader % TYPE_ALIGNMENT(IMAGE_DOS_HEADER)) == 0); #define DIE(ARGS_) { DPRINT ARGS_; goto l_Return; } @@ -219,10 +219,10 @@ pinhNtHeader = (PVOID)((UINT_PTR)FileHeader + pidhDosHeader->e_lfanew); } - ASSERT(sizeof(IMAGE_NT_HEADERS32) <= sizeof(IMAGE_NT_HEADERS64)); - ASSERT(TYPE_ALIGNMENT(IMAGE_NT_HEADERS32) == TYPE_ALIGNMENT(IMAGE_NT_HEADERS64)); - ASSERT(RTL_SIZEOF_THROUGH_FIELD(IMAGE_NT_HEADERS32, FileHeader) == RTL_SIZEOF_THROUGH_FIELD(IMAGE_NT_HEADERS64, FileHeader)); - ASSERT(FIELD_OFFSET(IMAGE_NT_HEADERS32, OptionalHeader) == FIELD_OFFSET(IMAGE_NT_HEADERS64, OptionalHeader)); + C_ASSERT(sizeof(IMAGE_NT_HEADERS32) <= sizeof(IMAGE_NT_HEADERS64)); + C_ASSERT(TYPE_ALIGNMENT(IMAGE_NT_HEADERS32) == TYPE_ALIGNMENT(IMAGE_NT_HEADERS64)); + C_ASSERT(RTL_SIZEOF_THROUGH_FIELD(IMAGE_NT_HEADERS32, FileHeader) == RTL_SIZEOF_THROUGH_FIELD(IMAGE_NT_HEADERS64, FileHeader)); + C_ASSERT(FIELD_OFFSET(IMAGE_NT_HEADERS32, OptionalHeader) == FIELD_OFFSET(IMAGE_NT_HEADERS64, OptionalHeader)); /* * the buffer doesn't contain the NT file header, or the alignment is wrong: we @@ -307,7 +307,7 @@ nStatus = STATUS_INVALID_IMAGE_FORMAT; - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, Magic)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, Magic)); if(!RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, Magic)) DIE(("The optional header doesn't contain the Magic field, SizeOfOptionalHeader is %X\n", cbOptHeaderSize)); @@ -324,8 +324,8 @@ DIE(("Unrecognized optional header, Magic is %X\n", piohOptHeader->Magic)); } - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SectionAlignment)); - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, FileAlignment)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SectionAlignment)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, FileAlignment)); if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SectionAlignment) && RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, FileAlignment)) @@ -410,9 +410,9 @@ if((ULONG_PTR)ImageSectionObject->ImageBase % 0x10000) DIE(("ImageBase is not aligned on a 64KB boundary")); - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, Subsystem)); - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, MinorSubsystemVersion)); - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, MajorSubsystemVersion)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, Subsystem)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, MinorSubsystemVersion)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, MajorSubsystemVersion)); if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, Subsystem)) { @@ -426,7 +426,7 @@ } } - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, AddressOfEntryPoint)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, AddressOfEntryPoint)); if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, AddressOfEntryPoint)) { @@ -434,7 +434,7 @@ piohOptHeader->AddressOfEntryPoint; } - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SizeOfCode)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SizeOfCode)); if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SizeOfCode)) ImageSectionObject->Executable = piohOptHeader->SizeOfCode != 0; @@ -472,7 +472,7 @@ if(!Intsafe_AddULong32(&cbSectionHeadersOffsetSize, cbSectionHeadersOffset, cbSectionHeadersSize)) DIE(("Section headers too large\n")); - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SizeOfHeaders)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SizeOfHeaders)); /* size of the executable's headers */ if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SizeOfHeaders))
16 years, 8 months
1
0
0
0
[hyperion] 33116: Let's see if C_ASSERT is fixed
by hyperion@svn.reactos.org
Author: hyperion Date: Tue Apr 22 17:23:59 2008 New Revision: 33116 URL:
http://svn.reactos.org/svn/reactos?rev=33116&view=rev
Log: Let's see if C_ASSERT is fixed Modified: branches/hyperion/ntoskrnl/mm/pe.c Modified: branches/hyperion/ntoskrnl/mm/pe.c URL:
http://svn.reactos.org/svn/reactos/branches/hyperion/ntoskrnl/mm/pe.c?rev=3…
============================================================================== --- branches/hyperion/ntoskrnl/mm/pe.c [iso-8859-1] (original) +++ branches/hyperion/ntoskrnl/mm/pe.c [iso-8859-1] Tue Apr 22 17:23:59 2008 @@ -178,7 +178,7 @@ ASSERT(Intsafe_CanOffsetPointer(FileHeader, FileHeaderSize)); - ASSERT(EXEFMT_LOAD_HEADER_SIZE >= sizeof(IMAGE_DOS_HEADER)); + C_ASSERT(EXEFMT_LOAD_HEADER_SIZE >= sizeof(IMAGE_DOS_HEADER)); ASSERT(((UINT_PTR)FileHeader % TYPE_ALIGNMENT(IMAGE_DOS_HEADER)) == 0); #define DIE(ARGS_) { DPRINT ARGS_; goto l_Return; } @@ -219,10 +219,10 @@ pinhNtHeader = (PVOID)((UINT_PTR)FileHeader + pidhDosHeader->e_lfanew); } - ASSERT(sizeof(IMAGE_NT_HEADERS32) <= sizeof(IMAGE_NT_HEADERS64)); - ASSERT(TYPE_ALIGNMENT(IMAGE_NT_HEADERS32) == TYPE_ALIGNMENT(IMAGE_NT_HEADERS64)); - ASSERT(RTL_SIZEOF_THROUGH_FIELD(IMAGE_NT_HEADERS32, FileHeader) == RTL_SIZEOF_THROUGH_FIELD(IMAGE_NT_HEADERS64, FileHeader)); - ASSERT(FIELD_OFFSET(IMAGE_NT_HEADERS32, OptionalHeader) == FIELD_OFFSET(IMAGE_NT_HEADERS64, OptionalHeader)); + C_ASSERT(sizeof(IMAGE_NT_HEADERS32) <= sizeof(IMAGE_NT_HEADERS64)); + C_ASSERT(TYPE_ALIGNMENT(IMAGE_NT_HEADERS32) == TYPE_ALIGNMENT(IMAGE_NT_HEADERS64)); + C_ASSERT(RTL_SIZEOF_THROUGH_FIELD(IMAGE_NT_HEADERS32, FileHeader) == RTL_SIZEOF_THROUGH_FIELD(IMAGE_NT_HEADERS64, FileHeader)); + C_ASSERT(FIELD_OFFSET(IMAGE_NT_HEADERS32, OptionalHeader) == FIELD_OFFSET(IMAGE_NT_HEADERS64, OptionalHeader)); /* * the buffer doesn't contain the NT file header, or the alignment is wrong: we @@ -307,7 +307,7 @@ nStatus = STATUS_INVALID_IMAGE_FORMAT; - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, Magic)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, Magic)); if(!RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, Magic)) DIE(("The optional header doesn't contain the Magic field, SizeOfOptionalHeader is %X\n", cbOptHeaderSize)); @@ -324,8 +324,8 @@ DIE(("Unrecognized optional header, Magic is %X\n", piohOptHeader->Magic)); } - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SectionAlignment)); - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, FileAlignment)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SectionAlignment)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, FileAlignment)); if (RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SectionAlignment) && RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, FileAlignment)) @@ -410,9 +410,9 @@ if((ULONG_PTR)ImageSectionObject->ImageBase % 0x10000) DIE(("ImageBase is not aligned on a 64KB boundary")); - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, Subsystem)); - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, MinorSubsystemVersion)); - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, MajorSubsystemVersion)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, Subsystem)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, MinorSubsystemVersion)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, MajorSubsystemVersion)); if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, Subsystem)) { @@ -426,7 +426,7 @@ } } - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, AddressOfEntryPoint)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, AddressOfEntryPoint)); if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, AddressOfEntryPoint)) { @@ -434,7 +434,7 @@ piohOptHeader->AddressOfEntryPoint; } - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SizeOfCode)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SizeOfCode)); if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SizeOfCode)) ImageSectionObject->Executable = piohOptHeader->SizeOfCode != 0; @@ -472,7 +472,7 @@ if(!Intsafe_AddULong32(&cbSectionHeadersOffsetSize, cbSectionHeadersOffset, cbSectionHeadersSize)) DIE(("Section headers too large\n")); - ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SizeOfHeaders)); + C_ASSERT(PEFMT_FIELDS_EQUAL(IMAGE_OPTIONAL_HEADER32, IMAGE_OPTIONAL_HEADER64, SizeOfHeaders)); /* size of the executable's headers */ if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SizeOfHeaders))
16 years, 8 months
1
0
0
0
[gedmurphy] 33115: make the dialog fixed
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Tue Apr 22 17:17:37 2008 New Revision: 33115 URL:
http://svn.reactos.org/svn/reactos?rev=33115&view=rev
Log: make the dialog fixed Modified: trunk/tools/Message Translator/GUI/MainForm.Designer.cs Modified: trunk/tools/Message Translator/GUI/MainForm.Designer.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/GUI/Mai…
============================================================================== --- trunk/tools/Message Translator/GUI/MainForm.Designer.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/GUI/MainForm.Designer.cs [iso-8859-1] Tue Apr 22 17:17:37 2008 @@ -387,6 +387,7 @@ this.Controls.Add(this.mainErrLabel); this.Controls.Add(this.mainErrTxtBox); this.Controls.Add(this.mainLookupButton); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Name = "MainForm";
16 years, 8 months
1
0
0
0
[gedmurphy] 33114: protect missing keys
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Tue Apr 22 16:56:34 2008 New Revision: 33114 URL:
http://svn.reactos.org/svn/reactos?rev=33114&view=rev
Log: protect missing keys Modified: trunk/tools/Message Translator/GUI/Program.cs Modified: trunk/tools/Message Translator/GUI/Program.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/GUI/Pro…
============================================================================== --- trunk/tools/Message Translator/GUI/Program.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/GUI/Program.cs [iso-8859-1] Tue Apr 22 16:56:34 2008 @@ -44,10 +44,17 @@ string regPath = @"Software\ReactOS\MsgTrans"; string keyName = "HideOnMin"; - RegistryKey rk = Registry.CurrentUser.CreateSubKey(regPath); - string hideOnMin = rk.GetValue(keyName).ToString(); + try + { + RegistryKey rk = Registry.CurrentUser.CreateSubKey(regPath); + string hideOnMin = rk.GetValue(keyName).ToString(); - return Convert.ToBoolean(hideOnMin); + return Convert.ToBoolean(hideOnMin); + } + catch (Exception) + { + return false; + } } private void InitializeContext()
16 years, 8 months
1
0
0
0
[hyperion] 33113: Testing fix for C_ASSERT
by hyperion@svn.reactos.org
Author: hyperion Date: Tue Apr 22 16:02:37 2008 New Revision: 33113 URL:
http://svn.reactos.org/svn/reactos?rev=33113&view=rev
Log: Testing fix for C_ASSERT Added: branches/hyperion/ - copied from r33109, trunk/reactos/ Modified: branches/hyperion/include/psdk/ntdef.h Modified: branches/hyperion/include/psdk/ntdef.h URL:
http://svn.reactos.org/svn/reactos/branches/hyperion/include/psdk/ntdef.h?r…
============================================================================== --- branches/hyperion/include/psdk/ntdef.h [iso-8859-1] (original) +++ branches/hyperion/include/psdk/ntdef.h [iso-8859-1] Tue Apr 22 16:02:37 2008 @@ -130,6 +130,6 @@ #define MAXUSHORT 0xffff #define MAXULONG 0xffffffff #define MAXLONGLONG (0x7fffffffffffffffLL) -#define C_ASSERT(e) extern char __C_ASSERT__[(e)?1:-1] +#define C_ASSERT(e) typedef __C_ASSERT__ char[(e)?1:-1] #endif /* _NTDEF_H */
16 years, 8 months
1
0
0
0
[gedmurphy] 33112: correctly close and dispose the app when 'hide when minimized' isn't selected.
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Tue Apr 22 16:02:30 2008 New Revision: 33112 URL:
http://svn.reactos.org/svn/reactos?rev=33112&view=rev
Log: correctly close and dispose the app when 'hide when minimized' isn't selected. Modified: trunk/tools/Message Translator/GUI/Program.cs Modified: trunk/tools/Message Translator/GUI/Program.cs URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/GUI/Pro…
============================================================================== --- trunk/tools/Message Translator/GUI/Program.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/GUI/Program.cs [iso-8859-1] Tue Apr 22 16:02:30 2008 @@ -35,12 +35,19 @@ // create the notify icon and it's associated context menu InitializeContext(); + if (!HideOnMinimize()) + ShowForm(); + } + + private bool HideOnMinimize() + { string regPath = @"Software\ReactOS\MsgTrans"; string keyName = "HideOnMin"; + RegistryKey rk = Registry.CurrentUser.CreateSubKey(regPath); string hideOnMin = rk.GetValue(keyName).ToString(); - if (Convert.ToBoolean(hideOnMin) == false) - ShowForm(); + + return Convert.ToBoolean(hideOnMin); } private void InitializeContext() @@ -133,6 +140,9 @@ { // null out the main form so we know to create a new one. this.mainForm = null; + + if (!HideOnMinimize()) + ExitThread(); } protected override void ExitThreadCore()
16 years, 8 months
1
0
0
0
[fireball] 33111: Bug fixes from Alex: - CDFS should enter a critical region before acquiring a resource. - "Fix" resource assert during installation by adding some padding at the end of the VFAT FCB header -- corruption happens at pad 51. - Once we detect corruption at pad 51, skip the FCB instead of attempting to flush it. - Fix a serious bug in our detection of incorrect resource usage while APCs are not disabled. - Fix a serious bug which caused shared resources not to wake up waiters when i
by fireball@svn.reactos.org
Author: fireball Date: Tue Apr 22 15:44:34 2008 New Revision: 33111 URL:
http://svn.reactos.org/svn/reactos?rev=33111&view=rev
Log: Bug fixes from Alex: - CDFS should enter a critical region before acquiring a resource. - "Fix" resource assert during installation by adding some padding at the end of the VFAT FCB header -- corruption happens at pad 51. - Once we detect corruption at pad 51, skip the FCB instead of attempting to flush it. - Fix a serious bug in our detection of incorrect resource usage while APCs are not disabled. - Fix a serious bug which caused shared resources not to wake up waiters when it was released, and which cause it to wake up waiters when there were still active locks held. New ERESOURCE implementation by Aleksey (thanks to Alex for providing the information required) - Remove ERESOURCE_XP concept, and fix the three incorrect and different definitions of the ERESOURCE structure. - Fix the ERESOURCE implementation to use the new Vista ERESOURCE type. Two main changes: * The count is now a 32-bit count called ActiveEntries. ActiveCount is now simply a flip-flop bit (0/1) for backward compatibility (we set to 0 when active entries is 0, and 1 when active entries is > 0) * Instead of caching two owners, we only cache one owner, in the OwnerEntry field. - Optimize some search algorithms slightly (just better code). - Remove duplicated code for ExReleaseResourceLite and call ExReleaseResourceForThreadLite instead. Alex says this is ok. Modified: trunk/reactos/drivers/filesystems/cdfs/create.c trunk/reactos/drivers/filesystems/fastfat/flush.c trunk/reactos/drivers/filesystems/fastfat/vfat.h trunk/reactos/include/ddk/winddk.h trunk/reactos/include/ndk/extypes.h trunk/reactos/ntoskrnl/ex/resource.c Modified: trunk/reactos/drivers/filesystems/cdfs/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/c…
============================================================================== --- trunk/reactos/drivers/filesystems/cdfs/create.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/cdfs/create.c [iso-8859-1] Tue Apr 22 15:44:34 2008 @@ -277,11 +277,13 @@ DeviceExt = DeviceObject->DeviceExtension; + KeEnterCriticalRegion(); ExAcquireResourceExclusiveLite(&DeviceExt->DirResource, TRUE); Status = CdfsCreateFile(DeviceObject, Irp); ExReleaseResourceLite(&DeviceExt->DirResource); + KeLeaveCriticalRegion(); ByeBye: Irp->IoStatus.Status = Status; Modified: trunk/reactos/drivers/filesystems/fastfat/flush.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/flush.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/flush.c [iso-8859-1] Tue Apr 22 15:44:34 2008 @@ -52,6 +52,7 @@ ListEntry = ListEntry->Flink; if (!vfatFCBIsDirectory(Fcb)) { + if (Fcb->PadPad51) continue; // Corrupt FCB ExAcquireResourceExclusiveLite(&Fcb->MainResource, TRUE); Status = VfatFlushFile(DeviceExt, Fcb); ExReleaseResourceLite (&Fcb->MainResource); Modified: trunk/reactos/drivers/filesystems/fastfat/vfat.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/vfat.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/vfat.h [iso-8859-1] Tue Apr 22 15:44:34 2008 @@ -322,6 +322,21 @@ { /* FCB header required by ROS/NT */ FSRTL_COMMON_FCB_HEADER RFCB; + ULONG PadPad; + ULONG PadPad2; + ULONG PadPad3; + ULONG PadPad4; + ULONG PadPad5; + ULONG PadPad50; + ULONG PadPad51; + ULONG PadPad52; + ULONG PadPad53; + ULONG PadPad54; + ULONG PadPad55; + ULONG PadPad56; + ULONG PadPad6; + ULONG PadPad7; + ULONG PadPad8; SECTION_OBJECT_POINTERS SectionObjectPointers; ERESOURCE MainResource; ERESOURCE PagingIoResource; Modified: trunk/reactos/include/ddk/winddk.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=3…
============================================================================== --- trunk/reactos/include/ddk/winddk.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/winddk.h [iso-8859-1] Tue Apr 22 15:44:34 2008 @@ -3279,22 +3279,25 @@ #define RESOURCE_HASH_TABLE_SIZE 64 -typedef struct _ERESOURCE { - LIST_ENTRY SystemResourcesList; - POWNER_ENTRY OwnerTable; - SHORT ActiveCount; - USHORT Flag; - volatile PKSEMAPHORE SharedWaiters; - volatile PKEVENT ExclusiveWaiters; - OWNER_ENTRY OwnerThreads[2]; - ULONG ContentionCount; - USHORT NumberOfSharedWaiters; - USHORT NumberOfExclusiveWaiters; - _ANONYMOUS_UNION union { - PVOID Address; - ULONG_PTR CreatorBackTraceIndex; - } DUMMYUNIONNAME; - KSPIN_LOCK SpinLock; +typedef struct _ERESOURCE +{ + LIST_ENTRY SystemResourcesList; + POWNER_ENTRY OwnerTable; + SHORT ActiveCount; + USHORT Flag; + volatile PKSEMAPHORE SharedWaiters; + volatile PKEVENT ExclusiveWaiters; + OWNER_ENTRY OwnerEntry; + ULONG ActiveEntries; + ULONG ContentionCount; + ULONG NumberOfSharedWaiters; + ULONG NumberOfExclusiveWaiters; + union + { + PVOID Address; + ULONG_PTR CreatorBackTraceIndex; + }; + KSPIN_LOCK SpinLock; } ERESOURCE, *PERESOURCE; typedef struct _DEVOBJ_EXTENSION Modified: trunk/reactos/include/ndk/extypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/extypes.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/extypes.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/extypes.h [iso-8859-1] Tue Apr 22 15:44:34 2008 @@ -377,29 +377,6 @@ ); // -// Compatibility with Windows XP Drivers using ERESOURCE -// -typedef struct _ERESOURCE_XP -{ - LIST_ENTRY SystemResourcesList; - POWNER_ENTRY OwnerTable; - SHORT ActiveCount; - USHORT Flag; - PKSEMAPHORE SharedWaiters; - PKEVENT ExclusiveWaiters; - OWNER_ENTRY OwnerThreads[2]; - ULONG ContentionCount; - USHORT NumberOfSharedWaiters; - USHORT NumberOfExclusiveWaiters; - union - { - PVOID Address; - ULONG_PTR CreatorBackTraceIndex; - }; - KSPIN_LOCK SpinLock; -} ERESOURCE_XP, *PERESOURCE_XP; - -// // Executive Work Queue Structures // typedef struct _EX_QUEUE_WORKER_INFO Modified: trunk/reactos/ntoskrnl/ex/resource.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/resource.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ex/resource.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/resource.c [iso-8859-1] Tue Apr 22 15:44:34 2008 @@ -30,7 +30,7 @@ VOID FORCEINLINE -ExAcquireResourceLock(IN PERESOURCE_XP Resource, +ExAcquireResourceLock(IN PERESOURCE Resource, IN PKLOCK_QUEUE_HANDLE LockHandle) { UNREFERENCED_PARAMETER(Resource); @@ -42,7 +42,7 @@ VOID FORCEINLINE -ExReleaseResourceLock(IN PERESOURCE_XP Resource, +ExReleaseResourceLock(IN PERESOURCE Resource, IN PKLOCK_QUEUE_HANDLE LockHandle) { UNREFERENCED_PARAMETER(Resource); @@ -56,7 +56,7 @@ VOID FORCEINLINE -ExAcquireResourceLock(IN PERESOURCE_XP Resource, +ExAcquireResourceLock(IN PERESOURCE Resource, IN PKLOCK_QUEUE_HANDLE LockHandle) { /* Acquire the lock */ @@ -65,7 +65,7 @@ VOID FORCEINLINE -ExReleaseResourceLock(IN PERESOURCE_XP Resource, +ExReleaseResourceLock(IN PERESOURCE Resource, IN PKLOCK_QUEUE_HANDLE LockHandle) { UNREFERENCED_PARAMETER(Resource); @@ -102,7 +102,7 @@ *--*/ VOID NTAPI -ExpVerifyResource(IN PERESOURCE_XP Resource) +ExpVerifyResource(IN PERESOURCE Resource) { /* Verify the resource data */ ASSERT((((ULONG_PTR)Resource) & (sizeof(ULONG_PTR) - 1)) == 0); @@ -139,12 +139,12 @@ VOID NTAPI ExpCheckForApcsDisabled(IN KIRQL Irql, - IN PERESOURCE_XP Resource, + IN PERESOURCE Resource, IN PKTHREAD Thread) { /* Check if we should care and check if we should break */ if ((ExResourceStrict) && - (Irql >= APC_LEVEL) && + (Irql < APC_LEVEL) && !(((PETHREAD)Thread)->SystemThread) && !(Thread->CombinedApcDisable)) { @@ -201,7 +201,7 @@ *--*/ VOID NTAPI -ExpAllocateExclusiveWaiterEvent(IN PERESOURCE_XP Resource, +ExpAllocateExclusiveWaiterEvent(IN PERESOURCE Resource, IN PKLOCK_QUEUE_HANDLE LockHandle) { PKEVENT Event; @@ -261,7 +261,7 @@ *--*/ VOID NTAPI -ExpAllocateSharedWaiterSemaphore(IN PERESOURCE_XP Resource, +ExpAllocateSharedWaiterSemaphore(IN PERESOURCE Resource, IN PKLOCK_QUEUE_HANDLE LockHandle) { PKSEMAPHORE Semaphore; @@ -321,7 +321,7 @@ *--*/ VOID NTAPI -ExpExpandResourceOwnerTable(IN PERESOURCE_XP Resource, +ExpExpandResourceOwnerTable(IN PERESOURCE Resource, IN PKLOCK_QUEUE_HANDLE LockHandle) { POWNER_ENTRY Owner, Table; @@ -421,53 +421,44 @@ *--*/ POWNER_ENTRY FASTCALL -ExpFindFreeEntry(IN PERESOURCE_XP Resource, +ExpFindFreeEntry(IN PERESOURCE Resource, IN PKLOCK_QUEUE_HANDLE LockHandle) { POWNER_ENTRY Owner, Limit; - POWNER_ENTRY FreeEntry = NULL; /* Sanity check */ ASSERT(LockHandle != 0); - ASSERT(Resource->OwnerThreads[0].OwnerThread != 0); - - /* Check if the next built-in entry is free */ - if (!Resource->OwnerThreads[1].OwnerThread) - { - /* Return it */ - FreeEntry = &Resource->OwnerThreads[1]; + ASSERT(Resource->OwnerEntry.OwnerThread != 0); + + /* Get the current table pointer */ + Owner = Resource->OwnerTable; + if (Owner) + { + /* Set the limit, move to the next owner and loop owner entries */ + Limit = &Owner[Owner->TableSize]; + Owner++; + while (Owner->OwnerThread) + { + /* Move to the next one */ + Owner++; + + /* Check if the entry is free */ + if (Owner == Limit) goto Expand; + } + + /* Update the resource entry */ + KeGetCurrentThread()->ResourceIndex = (UCHAR)(Owner - Resource->OwnerTable); } else { - /* Get the current table pointer */ - Owner = Resource->OwnerTable; - if (Owner) - { - /* Set the limit, move to the next owner and loop owner entries */ - Limit = &Owner[Owner->TableSize]; - Owner++; - do - { - /* Check if the entry is free */ - if (!Owner->OwnerThread) - { - /* Update the resource entry and return it */ - KeGetCurrentThread()->ResourceIndex = - (UCHAR)(Owner - Resource->OwnerTable); - return Owner; - } - - /* Move to the next one */ - Owner++; - } while (Owner != Limit); - } - +Expand: /* No free entry, expand the table */ ExpExpandResourceOwnerTable(Resource, LockHandle); + Owner = NULL; } /* Return the entry found */ - return FreeEntry; + return Owner; } /*++ @@ -493,60 +484,78 @@ *--*/ POWNER_ENTRY FASTCALL -ExpFindEntryForThread(IN PERESOURCE_XP Resource, +ExpFindEntryForThread(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread, - IN PKLOCK_QUEUE_HANDLE LockHandle) + IN PKLOCK_QUEUE_HANDLE LockHandle, + IN BOOLEAN FirstEntryInelligible) { POWNER_ENTRY FreeEntry, Owner, Limit; /* Start by looking in the static array */ - Owner = &Resource->OwnerThreads[0]; + Owner = &Resource->OwnerEntry; if (Owner->OwnerThread == Thread) return Owner; - Owner++; - if (Owner->OwnerThread == Thread) return Owner; /* Check if this is a free entry */ - FreeEntry = !Owner->OwnerThread ? Owner : NULL; - - /* Loop the table */ + if ((FirstEntryInelligible) || (Owner->OwnerThread)) + { + /* No free entry */ + FreeEntry = NULL; + } + else + { + /* Use the first entry as our free entry */ + FreeEntry = Owner; + } + + /* Get the current table pointer */ Owner = Resource->OwnerTable; if (Owner) { - /* Calculate the limit, skip the first entry, and start looping */ + /* Set the limit, move to the next owner and loop owner entries */ Limit = &Owner[Owner->TableSize]; Owner++; - do - { - /* Check if we found a match */ - if (Owner->OwnerThread == Thread) + while (Owner->OwnerThread != Thread) + { + /* Check if we don't have a free entry */ + if (!FreeEntry) { - /* We did, update the index and return it */ - KeGetCurrentThread()->ResourceIndex = - (UCHAR)(Owner - Resource->OwnerTable); - return Owner; + /* Check if this entry is free */ + if (!Owner->OwnerThread) + { + /* Save it as our free entry */ + FreeEntry = Owner; + } } - /* If we don't yet have a free entry and this one is, choose it */ - if (!(FreeEntry) && !(Owner->OwnerThread)) FreeEntry = Owner; + /* Move to the next one */ Owner++; - } while (Owner != Limit); - } - - /* Check if it's OK to do an expansion */ - if (!LockHandle) return NULL; - - /* If we found a free entry by now, return it */ - if (FreeEntry) - { - /* Set the resource index */ - KeGetCurrentThread()->ResourceIndex = - (UCHAR)(FreeEntry - Resource->OwnerTable); - return FreeEntry; - } - - /* No free entry, expand the table */ - ExpExpandResourceOwnerTable(Resource, LockHandle); - return NULL; + + /* Check if the entry is free */ + if (Owner == Limit) goto Expand; + } + + /* Update the resource entry */ + KeGetCurrentThread()->ResourceIndex = (UCHAR)(Owner - Resource->OwnerTable); + return Owner; + } + else + { +Expand: + /* Check if it's OK to do an expansion */ + if (!LockHandle) return NULL; + + /* If we found a free entry by now, return it */ + if (FreeEntry) + { + /* Set the resource index */ + KeGetCurrentThread()->ResourceIndex = (UCHAR)(FreeEntry - Resource->OwnerTable); + return FreeEntry; + } + + /* No free entry, expand the table */ + ExpExpandResourceOwnerTable(Resource, LockHandle); + return NULL; + } } /*++ @@ -614,7 +623,7 @@ *--*/ VOID FASTCALL -ExpWaitForResource(IN PERESOURCE_XP Resource, +ExpWaitForResource(IN PERESOURCE Resource, IN PVOID Object) { ULONG i; @@ -656,19 +665,16 @@ /* Dump debug information */ DPRINT1("Resource @ %lx\n", Resource); - DPRINT1(" ActiveCount = %04lx Flags = %s%s%s\n", - Resource->ActiveCount, + DPRINT1(" ActiveEntries = %04lx Flags = %s%s%s\n", + Resource->ActiveEntries, IsOwnedExclusive(Resource) ? "IsOwnedExclusive " : "", IsSharedWaiting(Resource) ? "SharedWaiter " : "", IsExclusiveWaiting(Resource) ? "ExclusiveWaiter " : ""); DPRINT1(" NumberOfExclusiveWaiters = %04lx\n", Resource->NumberOfExclusiveWaiters); DPRINT1(" Thread = %08lx, Count = %02x\n", - Resource->OwnerThreads[0].OwnerThread, - Resource->OwnerThreads[0].OwnerCount); - DPRINT1(" Thread = %08lx, Count = %02x\n", - Resource->OwnerThreads[1].OwnerThread, - Resource->OwnerThreads[1].OwnerCount); + Resource->OwnerEntry.OwnerThread, + Resource->OwnerEntry.OwnerCount); /* Dump out the table too */ Owner = Resource->OwnerTable; @@ -702,16 +708,12 @@ Thread->WaitNext = TRUE; /* Get the owner thread and boost it */ - OwnerThread = (PKTHREAD)Resource->OwnerThreads[0].OwnerThread; + OwnerThread = (PKTHREAD)Resource->OwnerEntry.OwnerThread; if (OwnerThread) ExpBoostOwnerThread(Thread, OwnerThread); /* If it's a shared resource */ if (!IsOwnedExclusive(Resource)) { - /* Boost the other owner thread too */ - OwnerThread = (PKTHREAD)Resource->OwnerThreads[1].OwnerThread; - if (OwnerThread) ExpBoostOwnerThread(Thread, OwnerThread); - /* Get the table */ Owner = Resource->OwnerTable; if (Owner) @@ -773,13 +775,12 @@ *--*/ BOOLEAN NTAPI -ExAcquireResourceExclusiveLite(IN PERESOURCE resource, +ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait) { KLOCK_QUEUE_HANDLE LockHandle; ERESOURCE_THREAD Thread; BOOLEAN Success; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Sanity check */ ASSERT((Resource->Flag & ResourceNeverExclusive) == 0); @@ -797,14 +798,14 @@ /* Check if there is a shared owner or exclusive owner */ TryAcquire: - if (Resource->ActiveCount) - { - /* Check if it's exclusively owned, and we own it */ + if (Resource->ActiveEntries) + { + /* Check if it's exclusively owned, and we own it */ if ((IsOwnedExclusive(Resource)) && - (Resource->OwnerThreads[0].OwnerThread == Thread)) + (Resource->OwnerEntry.OwnerThread == Thread)) { /* Increase the owning count */ - Resource->OwnerThreads[0].OwnerCount++; + Resource->OwnerEntry.OwnerCount++; Success = TRUE; } else @@ -834,8 +835,7 @@ ExpWaitForResource(Resource, Resource->ExclusiveWaiters); /* Set owner and return success */ - Resource->OwnerThreads[0].OwnerThread = - ExGetCurrentResourceThread(); + Resource->OwnerEntry.OwnerThread = ExGetCurrentResourceThread(); return TRUE; } } @@ -843,10 +843,13 @@ else { /* Nobody owns it, so let's! */ + ASSERT(Resource->ActiveEntries == 0); + ASSERT(Resource->ActiveCount == 0); Resource->Flag |= ResourceOwnedExclusive; + Resource->ActiveEntries = 1; Resource->ActiveCount = 1; - Resource->OwnerThreads[0].OwnerThread = Thread; - Resource->OwnerThreads[0].OwnerCount = 1; + Resource->OwnerEntry.OwnerThread = Thread; + Resource->OwnerEntry.OwnerCount = 1; Success = TRUE; } @@ -887,13 +890,13 @@ *--*/ BOOLEAN NTAPI -ExAcquireResourceSharedLite(IN PERESOURCE resource, +ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait) { KLOCK_QUEUE_HANDLE LockHandle; ERESOURCE_THREAD Thread; POWNER_ENTRY Owner; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; + BOOLEAN FirstEntryBusy; /* Get the thread */ Thread = ExGetCurrentResourceThread(); @@ -906,85 +909,112 @@ ExAcquireResourceLock(Resource, &LockHandle); ExpCheckForApcsDisabled(LockHandle.OldIrql, Resource, (PKTHREAD)Thread); - /* See if nobody owns us */ -TryAcquire: - if (!Resource->ActiveCount) - { - /* Setup the owner entry */ - Owner = &Resource->OwnerThreads[1]; - Owner->OwnerThread = Thread; - Owner->OwnerCount = 1; + /* Check how many active entries we've got */ + while (Resource->ActiveEntries != 0) + { + /* Check if it's exclusively owned */ + if (IsOwnedExclusive(Resource)) + { + /* Check if we own it */ + if (Resource->OwnerEntry.OwnerThread == Thread) + { + /* Increase the owning count */ + Resource->OwnerEntry.OwnerCount++; + + /* Release the lock and return */ + ExReleaseResourceLock(Resource, &LockHandle); + return TRUE; + } + + /* Find a free entry */ + Owner = ExpFindFreeEntry(Resource, &LockHandle); + if (!Owner) continue; + } + else + { + /* Resource is shared, find who owns it */ + FirstEntryBusy = IsExclusiveWaiting(Resource); + Owner = ExpFindEntryForThread(Resource, + Thread, + &LockHandle, + FirstEntryBusy); + if (!Owner) continue; + + /* Is it us? */ + if (Owner->OwnerThread == Thread) + { + /* Increase acquire count and return */ + Owner->OwnerCount++; + ASSERT(Owner->OwnerCount != 0); + + /* Release the lock and return */ + ExReleaseResourceLock(Resource, &LockHandle); + return TRUE; + } + + /* Try to find if there are exclusive waiters */ + if (!FirstEntryBusy) + { + /* There are none, so acquire it */ + Owner->OwnerThread = Thread; + Owner->OwnerCount = 1; + + /* Check how many active entries we had */ + if (Resource->ActiveEntries == 0) + { + /* Set initial counts */ + ASSERT(Resource->ActiveCount == 0); + Resource->ActiveEntries = 1; + Resource->ActiveCount = 1; + } + else + { + /* Increase active entries */ + ASSERT(Resource->ActiveCount == 1); + Resource->ActiveEntries++; + } + + /* Release the lock and return */ + ExReleaseResourceLock(Resource, &LockHandle); + return TRUE; + } + } + + /* If we got here, then we need to wait. Are we allowed? */ + if (!Wait) + { + /* Release the lock and return */ + ExReleaseResourceLock(Resource, &LockHandle); + return FALSE; + } + + /* Check if we have a shared waiters semaphore */ + if (!Resource->SharedWaiters) + { + /* Allocate it and try another acquire */ + ExpAllocateSharedWaiterSemaphore(Resource, &LockHandle); + } + else + { + /* We have shared waiters, wait for it */ + break; + } + } + + /* Did we get here because we don't have active entries? */ + if (Resource->ActiveEntries == 0) + { + /* Acquire it */ + ASSERT(Resource->ActiveEntries == 0); + ASSERT(Resource->ActiveCount == 0); + Resource->ActiveEntries = 1; Resource->ActiveCount = 1; - + Resource->OwnerEntry.OwnerThread = Thread; + Resource->OwnerEntry.OwnerCount = 1; + /* Release the lock and return */ ExReleaseResourceLock(Resource, &LockHandle); return TRUE; - } - - /* Check if it's exclusively owned */ - if (IsOwnedExclusive(Resource)) - { - /* Check if we own it */ - if (Resource->OwnerThreads[0].OwnerThread == Thread) - { - /* Increase the owning count */ - Resource->OwnerThreads[0].OwnerCount++; - - /* Release the lock and return */ - ExReleaseResourceLock(Resource, &LockHandle); - return TRUE; - } - - /* Find a free entry */ - Owner = ExpFindFreeEntry(Resource, &LockHandle); - if (!Owner) goto TryAcquire; - } - else - { - /* Resource is shared, find who owns it */ - Owner = ExpFindEntryForThread(Resource, Thread, &LockHandle); - if (!Owner) goto TryAcquire; - - /* Is it us? */ - if (Owner->OwnerThread == Thread) - { - /* Increase acquire count and return */ - Owner->OwnerCount++; - ASSERT(Owner->OwnerCount != 0); - - /* Release the lock and return */ - ExReleaseResourceLock(Resource, &LockHandle); - return TRUE; - } - - /* Try to find if there are exclusive waiters */ - if (!IsExclusiveWaiting(Resource)) - { - /* There are none, so acquire it */ - Owner->OwnerThread = Thread; - Owner->OwnerCount = 1; - Resource->ActiveCount++; - - /* Release the lock and return */ - ExReleaseResourceLock(Resource, &LockHandle); - return TRUE; - } - } - - /* If we got here, then we need to wait. Are we allowed? */ - if (!Wait) - { - /* Release the lock and return */ - ExReleaseResourceLock(Resource, &LockHandle); - return FALSE; - } - - /* Check if we have a shared waiters semaphore */ - if (!Resource->SharedWaiters) - { - /* Allocate it and try another acquire */ - ExpAllocateSharedWaiterSemaphore(Resource, &LockHandle); - goto TryAcquire; } /* Now wait for the resource */ @@ -1038,13 +1068,12 @@ *--*/ BOOLEAN NTAPI -ExAcquireSharedStarveExclusive(IN PERESOURCE resource, +ExAcquireSharedStarveExclusive(IN PERESOURCE Resource, IN BOOLEAN Wait) { KLOCK_QUEUE_HANDLE LockHandle; ERESOURCE_THREAD Thread; POWNER_ENTRY Owner; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Get the thread */ Thread = ExGetCurrentResourceThread(); @@ -1056,15 +1085,18 @@ /* Acquire the lock */ ExAcquireResourceLock(Resource, &LockHandle); - /* See if nobody owns us */ + /* See if anyone owns it */ TryAcquire: - if (!Resource->ActiveCount) + if (Resource->ActiveEntries == 0) { /* Nobody owns it, so let's take control */ + ASSERT(Resource->ActiveEntries == 0); + ASSERT(Resource->ActiveCount == 0); Resource->ActiveCount = 1; - Resource->OwnerThreads[1].OwnerThread = Thread; - Resource->OwnerThreads[1].OwnerCount = 1; - + Resource->ActiveEntries = 1; + Resource->OwnerEntry.OwnerThread = Thread; + Resource->OwnerEntry.OwnerCount = 1; + /* Release the lock and return */ ExReleaseResourceLock(Resource, &LockHandle); return TRUE; @@ -1074,10 +1106,10 @@ if (IsOwnedExclusive(Resource)) { /* Check if we own it */ - if (Resource->OwnerThreads[0].OwnerThread == Thread) + if (Resource->OwnerEntry.OwnerThread == Thread) { /* Increase the owning count */ - Resource->OwnerThreads[0].OwnerCount++; + Resource->OwnerEntry.OwnerCount++; /* Release the lock and return */ ExReleaseResourceLock(Resource, &LockHandle); @@ -1091,7 +1123,7 @@ else { /* Resource is shared, find who owns it */ - Owner = ExpFindEntryForThread(Resource, Thread, &LockHandle); + Owner = ExpFindEntryForThread(Resource, Thread, &LockHandle, FALSE); if (!Owner) goto TryAcquire; /* Is it us? */ @@ -1109,7 +1141,21 @@ /* Acquire it */ Owner->OwnerThread = Thread; Owner->OwnerCount = 1; - Resource->ActiveCount++; + + /* Check how many active entries we had */ + if (Resource->ActiveEntries == 0) + { + /* Set initial counts */ + ASSERT(Resource->ActiveCount == 0); + Resource->ActiveEntries = 1; + Resource->ActiveCount = 1; + } + else + { + /* Increase active entries */ + ASSERT(Resource->ActiveCount == 1); + Resource->ActiveEntries++; + } /* Release the lock and return */ ExReleaseResourceLock(Resource, &LockHandle); @@ -1176,13 +1222,12 @@ *--*/ BOOLEAN NTAPI -ExAcquireSharedWaitForExclusive(IN PERESOURCE resource, +ExAcquireSharedWaitForExclusive(IN PERESOURCE Resource, IN BOOLEAN Wait) { KLOCK_QUEUE_HANDLE LockHandle; ERESOURCE_THREAD Thread; POWNER_ENTRY Owner; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Get the thread */ Thread = ExGetCurrentResourceThread(); @@ -1196,12 +1241,15 @@ /* See if nobody owns us */ TryAcquire: - if (!Resource->ActiveCount) + if (!Resource->ActiveEntries) { /* Nobody owns it, so let's take control */ + ASSERT(Resource->ActiveEntries == 0); + ASSERT(Resource->ActiveCount == 0); Resource->ActiveCount = 1; - Resource->OwnerThreads[1].OwnerThread = Thread; - Resource->OwnerThreads[1].OwnerCount = 1; + Resource->ActiveEntries = 1; + Resource->OwnerEntry.OwnerThread = Thread; + Resource->OwnerEntry.OwnerCount = 1; /* Release the lock and return */ ExReleaseResourceLock(Resource, &LockHandle); @@ -1212,10 +1260,10 @@ if (IsOwnedExclusive(Resource)) { /* Check if we own it */ - if (Resource->OwnerThreads[0].OwnerThread == Thread) + if (Resource->OwnerEntry.OwnerThread == Thread) { /* Increase the owning count */ - Resource->OwnerThreads[0].OwnerCount++; + Resource->OwnerEntry.OwnerCount++; /* Release the lock and return */ ExReleaseResourceLock(Resource, &LockHandle); @@ -1256,11 +1304,11 @@ ExAcquireResourceLock(Resource, &LockHandle); /* Find who owns it now */ - while (!(Owner = ExpFindEntryForThread(Resource, Thread, &LockHandle))); + while (!(Owner = ExpFindEntryForThread(Resource, Thread, &LockHandle, TRUE))); /* Sanity checks */ ASSERT(IsOwnedExclusive(Resource) == FALSE); - ASSERT(Resource->ActiveCount > 0); + ASSERT(Resource->ActiveEntries > 0); ASSERT(Owner->OwnerThread != Thread); /* Take control */ @@ -1274,7 +1322,7 @@ else { /* Resource is shared, find who owns it */ - Owner = ExpFindEntryForThread(Resource, Thread, &LockHandle); + Owner = ExpFindEntryForThread(Resource, Thread, &LockHandle, FALSE); if (!Owner) goto TryAcquire; /* Is it us? */ @@ -1292,8 +1340,22 @@ /* No exclusive waiters, so acquire it */ Owner->OwnerThread = Thread; Owner->OwnerCount = 1; - Resource->ActiveCount++; - + + /* Check how many active entries we had */ + if (Resource->ActiveEntries == 0) + { + /* Set initial counts */ + ASSERT(Resource->ActiveCount == 0); + Resource->ActiveEntries = 1; + Resource->ActiveCount = 1; + } + else + { + /* Increase active entries */ + ASSERT(Resource->ActiveCount == 1); + Resource->ActiveEntries++; + } + /* Release the lock and return */ ExReleaseResourceLock(Resource, &LockHandle); return TRUE; @@ -1345,18 +1407,17 @@ *--*/ VOID NTAPI -ExConvertExclusiveToSharedLite(IN PERESOURCE resource) +ExConvertExclusiveToSharedLite(IN PERESOURCE Resource) { ULONG OldWaiters; KLOCK_QUEUE_HANDLE LockHandle; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Sanity checks */ ASSERT(KeIsExecutingDpc() == FALSE); ExpVerifyResource(Resource); ASSERT(IsOwnedExclusive(Resource)); - ASSERT(Resource->OwnerThreads[0].OwnerThread == (ERESOURCE_THREAD)PsGetCurrentThread()); - + ASSERT(Resource->OwnerEntry.OwnerThread == (ERESOURCE_THREAD)PsGetCurrentThread()); + /* Lock the resource */ ExAcquireResourceLock(Resource, &LockHandle); @@ -1368,7 +1429,7 @@ { /* Make the waiters active owners */ OldWaiters = Resource->NumberOfSharedWaiters; - Resource->ActiveCount = Resource->ActiveCount + (USHORT)OldWaiters; + Resource->ActiveEntries += OldWaiters; Resource->NumberOfSharedWaiters = 0; /* Release lock and wake the waiters */ @@ -1400,10 +1461,9 @@ *--*/ NTSTATUS NTAPI -ExDeleteResourceLite(IN PERESOURCE resource) +ExDeleteResourceLite(IN PERESOURCE Resource) { KLOCK_QUEUE_HANDLE LockHandle; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Sanity checks */ ASSERT(IsSharedWaiting(Resource) == FALSE); @@ -1446,10 +1506,9 @@ *--*/ VOID NTAPI -ExDisableResourceBoostLite(IN PERESOURCE resource) +ExDisableResourceBoostLite(IN PERESOURCE Resource) { KLOCK_QUEUE_HANDLE LockHandle; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Sanity check */ ExpVerifyResource(Resource); @@ -1481,10 +1540,8 @@ *--*/ ULONG NTAPI -ExGetExclusiveWaiterCount(IN PERESOURCE resource) -{ - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; - +ExGetExclusiveWaiterCount(IN PERESOURCE Resource) +{ /* Return the count */ return Resource->NumberOfExclusiveWaiters; } @@ -1506,10 +1563,8 @@ *--*/ ULONG NTAPI -ExGetSharedWaiterCount(IN PERESOURCE resource) -{ - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; - +ExGetSharedWaiterCount(IN PERESOURCE Resource) +{ /* Return the count */ return Resource->NumberOfSharedWaiters; } @@ -1532,13 +1587,12 @@ *--*/ NTSTATUS NTAPI -ExInitializeResourceLite(IN PERESOURCE resource) -{ - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; +ExInitializeResourceLite(IN PERESOURCE Resource) +{ KLOCK_QUEUE_HANDLE LockHandle; /* Clear the structure */ - RtlZeroMemory(Resource, sizeof(ERESOURCE_XP)); + RtlZeroMemory(Resource, sizeof(ERESOURCE)); /* Initialize the lock */ KeInitializeSpinLock(&Resource->SpinLock); @@ -1570,18 +1624,16 @@ *--*/ BOOLEAN NTAPI -ExIsResourceAcquiredExclusiveLite(IN PERESOURCE resource) -{ - ERESOURCE_THREAD Thread = ExGetCurrentResourceThread(); +ExIsResourceAcquiredExclusiveLite(IN PERESOURCE Resource) +{ BOOLEAN IsAcquired = FALSE; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Sanity check */ ExpVerifyResource(Resource); /* Check if it's exclusively acquired */ if ((IsOwnedExclusive(Resource)) && - (Resource->OwnerThreads[0].OwnerThread == Thread)) + (Resource->OwnerEntry.OwnerThread == ExGetCurrentResourceThread())) { /* It is acquired */ IsAcquired = TRUE; @@ -1611,82 +1663,72 @@ *--*/ ULONG NTAPI -ExIsResourceAcquiredSharedLite(IN PERESOURCE resource) +ExIsResourceAcquiredSharedLite(IN PERESOURCE Resource) { ERESOURCE_THREAD Thread; ULONG i, Size; ULONG Count = 0; KLOCK_QUEUE_HANDLE LockHandle; POWNER_ENTRY Owner; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Sanity check */ ExpVerifyResource(Resource); /* Check if nobody owns us */ - if (!Resource->ActiveCount) return 0; + if (!Resource->ActiveEntries) return 0; /* Get the thread */ Thread = ExGetCurrentResourceThread(); /* Check if we are in the thread list */ - if (Resource->OwnerThreads[0].OwnerThread == Thread) + if (Resource->OwnerEntry.OwnerThread == Thread) { /* Found it, return count */ - Count = Resource->OwnerThreads[0].OwnerCount; + Count = Resource->OwnerEntry.OwnerCount; } else { /* We can't own an exclusive resource at this point */ if (IsOwnedExclusive(Resource)) return 0; - /* Check if we are in the other thread list */ - if (Resource->OwnerThreads[1].OwnerThread == Thread) - { - /* Found it on the second list, return count */ - Count = Resource->OwnerThreads[1].OwnerCount; - } - else - { - /* Lock the resource */ - ExAcquireResourceLock(Resource, &LockHandle); - - /* Not in the list, do a full table look up */ - Owner = Resource->OwnerTable; - if (Owner) + /* Lock the resource */ + ExAcquireResourceLock(Resource, &LockHandle); + + /* Not in the list, do a full table look up */ + Owner = Resource->OwnerTable; + if (Owner) + { + /* Get the resource index */ + i = ((PKTHREAD)Thread)->ResourceIndex; + Size = Owner->TableSize; + + /* Check if the index is valid and check if we don't match */ + if ((i >= Size) || (Owner[i].OwnerThread != Thread)) { - /* Get the resource index */ - i = ((PKTHREAD)Thread)->ResourceIndex; - Size = Owner->TableSize; - - /* Check if the index is valid and check if we don't match */ - if ((i >= Size) || (Owner[i].OwnerThread != Thread)) + /* Sh*t! We need to do a full search */ + for (i = 1; i < Size; i++) { - /* Sh*t! We need to do a full search */ - for (i = 1; i < Size; i++) + /* Move to next owner */ + Owner++; + + /* Try to find a match */ + if (Owner->OwnerThread == Thread) { - /* Move to next owner */ - Owner++; - - /* Try to find a match */ - if (Owner->OwnerThread == Thread) - { - /* Finally! */ - Count = Owner->OwnerCount; - break; - } + /* Finally! */ + Count = Owner->OwnerCount; + break; } } - else - { - /* We found the match directlry */ - Count = Owner[i].OwnerCount; - } } - - /* Release the lock */ - ExReleaseResourceLock(Resource, &LockHandle); - } + else + { + /* We found the match directlry */ + Count = Owner[i].OwnerCount; + } + } + + /* Release the lock */ + ExReleaseResourceLock(Resource, &LockHandle); } /* Return count */ @@ -1719,13 +1761,12 @@ *--*/ NTSTATUS NTAPI -ExReinitializeResourceLite(IN PERESOURCE resource) +ExReinitializeResourceLite(IN PERESOURCE Resource) { PKEVENT Event; PKSEMAPHORE Semaphore; ULONG i, Size; POWNER_ENTRY Owner; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Get the owner table */ Owner = Resource->OwnerTable; @@ -1744,6 +1785,7 @@ /* Zero the flags and count */ Resource->Flag = 0; Resource->ActiveCount = 0; + Resource->ActiveEntries = 0; /* Reset the semaphore */ Semaphore = Resource->SharedWaiters; @@ -1754,10 +1796,8 @@ if (Event) KeInitializeEvent(Event, SynchronizationEvent, FALSE); /* Clear the resource data */ - Resource->OwnerThreads[0].OwnerThread = 0; - Resource->OwnerThreads[1].OwnerThread = 0; - Resource->OwnerThreads[0].OwnerCount = 0; - Resource->OwnerThreads[1].OwnerCount = 0; + Resource->OwnerEntry.OwnerThread = 0; + Resource->OwnerEntry.OwnerCount = 0; Resource->ContentionCount = 0; Resource->NumberOfSharedWaiters = 0; Resource->NumberOfExclusiveWaiters = 0; @@ -1782,178 +1822,10 @@ *--*/ VOID FASTCALL -ExReleaseResourceLite(IN PERESOURCE resource) -{ - ERESOURCE_THREAD Thread; - ULONG Count, i; - KLOCK_QUEUE_HANDLE LockHandle; - POWNER_ENTRY Owner, Limit; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; - - /* Sanity check */ - ExpVerifyResource(Resource); - - /* Get the thread and lock the resource */ - Thread = ExGetCurrentResourceThread(); - ExAcquireResourceLock(Resource, &LockHandle); - ExpCheckForApcsDisabled(LockHandle.OldIrql, Resource, (PKTHREAD)Thread); - - /* Check if it's exclusively owned */ - if (IsOwnedExclusive(Resource)) - { - /* Decrement owner count and check if we're done */ - ASSERT(Resource->OwnerThreads[0].OwnerCount > 0); - if (--Resource->OwnerThreads[0].OwnerCount) - { - /* Done, release lock! */ - ExReleaseResourceLock(Resource, &LockHandle); - return; - } - - /* Clear the owner */ - Resource->OwnerThreads[0].OwnerThread = 0; - - /* Check the active count */ - ASSERT(Resource->ActiveCount > 0); - if (!(--Resource->ActiveCount)) - { - /* Check if there are shared waiters */ - if (IsSharedWaiting(Resource)) - { - /* Remove the exclusive flag */ - Resource->Flag &= ~ResourceOwnedExclusive; - - /* Give ownership to another thread */ - Count = Resource->NumberOfSharedWaiters; - Resource->ActiveCount = (SHORT)Count; - Resource->NumberOfSharedWaiters = 0; - - /* Release lock and let someone else have it */ - ExReleaseResourceLock(Resource, &LockHandle); - KeReleaseSemaphore(Resource->SharedWaiters, 0, Count, FALSE); - return; - } - else if (IsExclusiveWaiting(Resource)) - { - /* Give exclusive access */ - Resource->OwnerThreads[0].OwnerThread = 1; - Resource->OwnerThreads[0].OwnerCount = 1; - Resource->ActiveCount = 1; - Resource->NumberOfExclusiveWaiters--; - - /* Release the lock and give it away */ - ExReleaseResourceLock(Resource, &LockHandle); - KeSetEventBoostPriority(Resource->ExclusiveWaiters, - (PKTHREAD*) - &Resource->OwnerThreads[0].OwnerThread); - return; - } - } - - /* Remove the exclusive flag */ - Resource->Flag &= ~ResourceOwnedExclusive; - } - else - { - /* Check if we are in the thread list */ - if (Resource->OwnerThreads[1].OwnerThread == Thread) - { - /* Found it, get owner */ - Owner = &Resource->OwnerThreads[1]; - } - else if (Resource->OwnerThreads[0].OwnerThread == Thread) - { - /* Found it, get owner */ - Owner = &Resource->OwnerThreads[0]; - } - else - { - /* Not in the list, do a full table look up */ - i = ((PKTHREAD)Thread)->ResourceIndex; - Owner = Resource->OwnerTable; - if (!Owner) - { - /* Nobody owns us, bugcheck! */ - KEBUGCHECKEX(RESOURCE_NOT_OWNED, - (ULONG_PTR)Resource, - Thread, - (ULONG_PTR)Resource->OwnerTable, - (ULONG_PTR)2); - } - - /* Check if we're out of the size and don't match */ - if ((i >= Owner->TableSize) || (Owner[i].OwnerThread != Thread)) - { - /* Get the last entry */ - Limit = &Owner[Owner->TableSize]; - for (;;) - { - /* Move to the next entry */ - Owner++; - - /* Check if we don't match */ - if (Owner >= Limit) - { - /* Nobody owns us, bugcheck! */ - KEBUGCHECKEX(RESOURCE_NOT_OWNED, - (ULONG_PTR)Resource, - Thread, - (ULONG_PTR)Resource->OwnerTable, - 2); - } - - /* Check for a match */ - if (Owner->OwnerThread == Thread) break; - } - } - else - { - /* Get the entry directly */ - Owner = &Owner[i]; - } - } - - /* Sanity checks */ - ASSERT(Owner->OwnerThread == Thread); - ASSERT(Owner->OwnerCount > 0); - - /* Check if we are the last owner */ - if (--Owner->OwnerCount) - { - /* Release lock */ - ExReleaseResourceLock(Resource, &LockHandle); - return; - } - - /* Clear owner */ - Owner->OwnerThread = 0; - - /* See if the resource isn't being owned anymore */ - ASSERT(Resource->ActiveCount > 0); - if (!(--Resource->ActiveCount)) - { - /* Check if there's an exclusive waiter */ - if (IsExclusiveWaiting(Resource)) - { - /* Give exclusive access */ - Resource->Flag |= ResourceOwnedExclusive; - Resource->OwnerThreads[0].OwnerThread = 1; - Resource->OwnerThreads[0].OwnerCount = 1; - Resource->ActiveCount = 1; - Resource->NumberOfExclusiveWaiters--; - - /* Release the lock and give it away */ - ExReleaseResourceLock(Resource, &LockHandle); - KeSetEventBoostPriority(Resource->ExclusiveWaiters, - (PKTHREAD*) - &Resource->OwnerThreads[0].OwnerThread); - return; - } - } - } - - /* Release lock */ - ExReleaseResourceLock(Resource, &LockHandle); +ExReleaseResourceLite(IN PERESOURCE Resource) +{ + /* Just call the For-Thread function */ + ExReleaseResourceForThreadLite(Resource, (ERESOURCE_THREAD)PsGetCurrentThread()); } /*++ @@ -1977,14 +1849,13 @@ *--*/ VOID NTAPI -ExReleaseResourceForThreadLite(IN PERESOURCE resource, +ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread) { ULONG i; ULONG Count; KLOCK_QUEUE_HANDLE LockHandle; POWNER_ENTRY Owner, Limit; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; ASSERT(Thread != 0); /* Get the thread and lock the resource */ @@ -1998,8 +1869,8 @@ if (IsOwnedExclusive(Resource)) { /* Decrement owner count and check if we're done */ - ASSERT(Resource->OwnerThreads[0].OwnerThread == Thread); - if (--Resource->OwnerThreads[0].OwnerCount) + ASSERT(Resource->OwnerEntry.OwnerThread == Thread); + if (--Resource->OwnerEntry.OwnerCount) { /* Done, release lock! */ ExReleaseResourceLock(Resource, &LockHandle); @@ -2007,60 +1878,56 @@ } /* Clear the owner */ - Resource->OwnerThreads[0].OwnerThread = 0; - - /* See if the resource isn't being owned anymore */ - ASSERT(Resource->ActiveCount > 0); - if (!(--Resource->ActiveCount)) - { - /* Check if there are shared waiters */ - if (IsSharedWaiting(Resource)) - { - /* Remove the exclusive flag */ - Resource->Flag &= ~ResourceOwnedExclusive; - - /* Give ownage to another thread */ - Count = Resource->NumberOfSharedWaiters; - Resource->ActiveCount = (SHORT)Count; - Resource->NumberOfSharedWaiters = 0; - - /* Release lock and let someone else have it */ - ExReleaseResourceLock(Resource, &LockHandle); - KeReleaseSemaphore(Resource->SharedWaiters, 0, Count, FALSE); - return; - } - else if (IsExclusiveWaiting(Resource)) - { - /* Give exclusive access */ - Resource->OwnerThreads[0].OwnerThread = 1; - Resource->OwnerThreads[0].OwnerCount = 1; - Resource->ActiveCount = 1; - Resource->NumberOfExclusiveWaiters--; - - /* Release the lock and give it away */ - ExReleaseResourceLock(Resource, &LockHandle); - KeSetEventBoostPriority(Resource->ExclusiveWaiters, - (PKTHREAD*) - &Resource->OwnerThreads[0].OwnerThread); - return; - } - + Resource->OwnerEntry.OwnerThread = 0; + + /* Decrement the number of active entries */ + ASSERT(Resource->ActiveEntries == 1); + Resource->ActiveEntries--; + + /* Check if there are shared waiters */ + if (IsSharedWaiting(Resource)) + { /* Remove the exclusive flag */ Resource->Flag &= ~ResourceOwnedExclusive; - } + + /* Give ownage to another thread */ + Count = Resource->NumberOfSharedWaiters; + Resource->ActiveEntries = Count; + Resource->NumberOfSharedWaiters = 0; + + /* Release lock and let someone else have it */ + ASSERT(Resource->ActiveCount = 1); + ExReleaseResourceLock(Resource, &LockHandle); + KeReleaseSemaphore(Resource->SharedWaiters, 0, Count, FALSE); + return; + } + else if (IsExclusiveWaiting(Resource)) + { + /* Give exclusive access */ + Resource->OwnerEntry.OwnerThread = 1; + Resource->OwnerEntry.OwnerCount = 1; + Resource->ActiveEntries = 1; + Resource->NumberOfExclusiveWaiters--; + + /* Release the lock and give it away */ + ASSERT(Resource->ActiveCount = 1); + ExReleaseResourceLock(Resource, &LockHandle); + KeSetEventBoostPriority(Resource->ExclusiveWaiters, + (PKTHREAD*)&Resource->OwnerEntry.OwnerThread); + return; + } + + /* Remove the exclusive flag */ + Resource->Flag &= ~ResourceOwnedExclusive; + Resource->ActiveCount = 0; } else { /* Check if we are in the thread list */ - if (Resource->OwnerThreads[0].OwnerThread == Thread) + if (Resource->OwnerEntry.OwnerThread == Thread) { /* Found it, get owner */ - Owner = &Resource->OwnerThreads[0]; - } - else if (Resource->OwnerThreads[1].OwnerThread == Thread) - { - /* Found it on the second list, get owner */ - Owner = &Resource->OwnerThreads[1]; + Owner = &Resource->OwnerEntry; } else { @@ -2111,9 +1978,9 @@ ASSERT(Owner->OwnerCount > 0); /* Check if we are the last owner */ - if (!(--Owner->OwnerCount)) - { - /* Release lock */ + if (--Owner->OwnerCount) + { + /* There are other owners, release lock */ ExReleaseResourceLock(Resource, &LockHandle); return; } @@ -2122,26 +1989,29 @@ Owner->OwnerThread = 0; /* See if the resource isn't being owned anymore */ - ASSERT(Resource->ActiveCount > 0); - if (!(--Resource->ActiveCount)) + ASSERT(Resource->ActiveEntries > 0); + if (!(--Resource->ActiveEntries)) { /* Check if there's an exclusive waiter */ if (IsExclusiveWaiting(Resource)) { /* Give exclusive access */ Resource->Flag |= ResourceOwnedExclusive; - Resource->OwnerThreads[0].OwnerThread = 1; - Resource->OwnerThreads[0].OwnerCount = 1; - Resource->ActiveCount = 1; + Resource->OwnerEntry.OwnerThread = 1; + Resource->OwnerEntry.OwnerCount = 1; + Resource->ActiveEntries = 1; Resource->NumberOfExclusiveWaiters--; /* Release the lock and give it away */ + ASSERT(Resource->ActiveCount = 1); ExReleaseResourceLock(Resource, &LockHandle); KeSetEventBoostPriority(Resource->ExclusiveWaiters, - (PKTHREAD*) - &Resource->OwnerThreads[0].OwnerThread); + (PKTHREAD*)&Resource->OwnerEntry.OwnerThread); return; } + + /* Clear the active count */ + Resource->ActiveCount = 0; } } @@ -2180,13 +2050,12 @@ *--*/ VOID NTAPI -ExSetResourceOwnerPointer(IN PERESOURCE resource, +ExSetResourceOwnerPointer(IN PERESOURCE Resource, IN PVOID OwnerPointer) { ERESOURCE_THREAD Thread; KLOCK_QUEUE_HANDLE LockHandle; POWNER_ENTRY Owner, ThisOwner; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Sanity check */ ASSERT((OwnerPointer != 0) && (((ULONG_PTR)OwnerPointer & 3) == 3)); @@ -2204,21 +2073,22 @@ if (IsOwnedExclusive(Resource)) { /* If it's exclusive, set the first entry no matter what */ - ASSERT(Resource->OwnerThreads[0].OwnerThread == Thread); - ASSERT(Resource->OwnerThreads[0].OwnerCount > 0); - Resource->OwnerThreads[0].OwnerThread = (ULONG_PTR)OwnerPointer; + ASSERT(Resource->OwnerEntry.OwnerThread == Thread); + ASSERT(Resource->OwnerEntry.OwnerCount > 0); + Resource->OwnerEntry.OwnerThread = (ULONG_PTR)OwnerPointer; } else { /* Set the thread in both entries */ ThisOwner = ExpFindEntryForThread(Resource, (ERESOURCE_THREAD)OwnerPointer, - 0); - Owner = ExpFindEntryForThread(Resource, Thread, 0); + 0, + FALSE); + Owner = ExpFindEntryForThread(Resource, Thread, 0, FALSE); if (!Owner) { /* Nobody owns it, crash */ - KEBUGCHECKEX(RESOURCE_NOT_OWNED, + KeBugCheckEx(RESOURCE_NOT_OWNED, (ULONG_PTR)Resource, Thread, (ULONG_PTR)Resource->OwnerTable, @@ -2232,8 +2102,8 @@ ThisOwner->OwnerCount += Owner->OwnerCount; Owner->OwnerCount = 0; Owner->OwnerThread = 0; - ASSERT(Resource->ActiveCount >= 2); - Resource->ActiveCount--; + ASSERT(Resource->ActiveEntries >= 2); + Resource->ActiveEntries--; } else { @@ -2264,12 +2134,11 @@ *--*/ BOOLEAN NTAPI -ExTryToAcquireResourceExclusiveLite(IN PERESOURCE resource) +ExTryToAcquireResourceExclusiveLite(IN PERESOURCE Resource) { ERESOURCE_THREAD Thread; KLOCK_QUEUE_HANDLE LockHandle; BOOLEAN Acquired = FALSE; - PERESOURCE_XP Resource = (PERESOURCE_XP)resource; /* Sanity check */ ASSERT((Resource->Flag & ResourceNeverExclusive) == 0); @@ -2289,16 +2158,17 @@ { /* No owner, give exclusive access */ Resource->Flag |= ResourceOwnedExclusive; - Resource->OwnerThreads[0].OwnerThread = Thread; - Resource->OwnerThreads[0].OwnerCount = 1; + Resource->OwnerEntry.OwnerThread = Thread; + Resource->OwnerEntry.OwnerCount = 1; Resource->ActiveCount = 1; + Resource->ActiveEntries = 1; Acquired = TRUE; } else if ((IsOwnedExclusive(Resource)) && - (Resource->OwnerThreads[0].OwnerThread == Thread)) + (Resource->OwnerEntry.OwnerThread == Thread)) { /* Do a recursive acquire */ - Resource->OwnerThreads[0].OwnerCount++; + Resource->OwnerEntry.OwnerCount++; Acquired = TRUE; }
16 years, 8 months
1
0
0
0
[hyperion] 33110: goodbye branch
by hyperion@svn.reactos.org
Author: hyperion Date: Tue Apr 22 15:44:29 2008 New Revision: 33110 URL:
http://svn.reactos.org/svn/reactos?rev=33110&view=rev
Log: goodbye branch Removed: branches/hyperion/
16 years, 8 months
1
0
0
0
[dchapyshev] 33109: - Add "Preferences" button
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Tue Apr 22 15:01:08 2008 New Revision: 33109 URL:
http://svn.reactos.org/svn/reactos?rev=33109&view=rev
Log: - Add "Preferences" button Modified: trunk/reactos/base/applications/kbswitch/kbswitch.c trunk/reactos/base/applications/kbswitch/kbswitch.h trunk/reactos/base/applications/kbswitch/lang/de-DE.rc trunk/reactos/base/applications/kbswitch/lang/en-US.rc trunk/reactos/base/applications/kbswitch/lang/ru-RU.rc trunk/reactos/base/applications/kbswitch/resource.h Modified: trunk/reactos/base/applications/kbswitch/kbswitch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
============================================================================== --- trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] Tue Apr 22 15:01:08 2008 @@ -117,8 +117,8 @@ BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) { - SendMessage(hwnd, WM_INPUTLANGCHANGEREQUEST, 0, lParam); - return TRUE; + SendMessage(hwnd, WM_INPUTLANGCHANGEREQUEST, 0, lParam); + return TRUE; } static VOID @@ -142,7 +142,6 @@ HMENU hMenu; HKEY hKey; DWORD dwIndex, dwSize; - TCHAR szExit[MAX_PATH]; TCHAR szLayoutNum[CCH_ULONG_DEC + 1]; TCHAR szName[MAX_PATH]; @@ -165,11 +164,17 @@ RegCloseKey(hKey); } - LoadString(hInst, IDS_EXIT, szExit, MAX_PATH); - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); - AppendMenu(hMenu, MF_STRING, MENU_ID_EXIT, szExit); - return hMenu; +} + +static VOID +ShowRightPopupMenu(HWND hwnd, POINT pt) +{ + HMENU hMenu; + + hMenu = GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(IDR_POPUP)), 0); + TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwnd, NULL); + DestroyMenu(hMenu); } LRESULT CALLBACK @@ -189,7 +194,6 @@ { case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: { POINT pt; @@ -197,15 +201,45 @@ TrackPopupMenu(hPopupMenu, 0, pt.x, pt.y, 0, hwnd, NULL); } break; + case WM_RBUTTONDOWN: + { + POINT pt; + + GetCursorPos(&pt); + ShowRightPopupMenu(hwnd, pt); + } + break; } break; case WM_COMMAND: - if (LOWORD(wParam) == MENU_ID_EXIT) - SendMessage(hwnd, WM_CLOSE, 0, 0); - else - ActivateLayout(LOWORD(wParam)); - + switch (LOWORD(wParam)) + { + case ID_EXIT: + SendMessage(hwnd, WM_CLOSE, 0, 0); + break; + + case ID_PROFERENCES: + { + SHELLEXECUTEINFO shInputDll; + + memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFO)); + shInputDll.cbSize = sizeof(shInputDll); + shInputDll.hwnd = hwnd; + shInputDll.lpVerb = _T("open"); + shInputDll.lpFile = _T("RunDll32.exe"); + shInputDll.lpParameters = _T("shell32.dll,Control_RunDLL input.dll"); + if (ShellExecuteEx(&shInputDll) == 0) + { + MessageBox(hwnd, _T("Can't start input.dll"), NULL, MB_OK | MB_ICONERROR); + } + } + break; + + default: + ActivateLayout(LOWORD(wParam)); + break; + } break; case WM_DESTROY: Modified: trunk/reactos/base/applications/kbswitch/kbswitch.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
============================================================================== --- trunk/reactos/base/applications/kbswitch/kbswitch.h [iso-8859-1] (original) +++ trunk/reactos/base/applications/kbswitch/kbswitch.h [iso-8859-1] Tue Apr 22 15:01:08 2008 @@ -10,5 +10,3 @@ // Maximum Character Count of a ULONG in decimal #define CCH_ULONG_DEC 10 - -#define MENU_ID_EXIT 65535 Modified: trunk/reactos/base/applications/kbswitch/lang/de-DE.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
============================================================================== --- trunk/reactos/base/applications/kbswitch/lang/de-DE.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/kbswitch/lang/de-DE.rc [iso-8859-1] Tue Apr 22 15:01:08 2008 @@ -1,6 +1,11 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL -STRINGTABLE +IDR_POPUP MENU BEGIN - IDS_EXIT, "Beenden" + POPUP "popup" + BEGIN + MENUITEM "&Preferences...", ID_PROFERENCES + MENUITEM SEPARATOR + MENUITEM "&Beenden", ID_EXIT + END END Modified: trunk/reactos/base/applications/kbswitch/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
============================================================================== --- trunk/reactos/base/applications/kbswitch/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/kbswitch/lang/en-US.rc [iso-8859-1] Tue Apr 22 15:01:08 2008 @@ -1,6 +1,11 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -STRINGTABLE +IDR_POPUP MENU BEGIN - IDS_EXIT, "Exit" + POPUP "popup" + BEGIN + MENUITEM "&Preferences...", ID_PROFERENCES + MENUITEM SEPARATOR + MENUITEM "&Exit", ID_EXIT + END END Modified: trunk/reactos/base/applications/kbswitch/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
============================================================================== --- trunk/reactos/base/applications/kbswitch/lang/ru-RU.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/kbswitch/lang/ru-RU.rc [iso-8859-1] Tue Apr 22 15:01:08 2008 @@ -1,6 +1,11 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -STRINGTABLE +IDR_POPUP MENU BEGIN - IDS_EXIT, "Âûõîä" + POPUP "popup" + BEGIN + MENUITEM "&Ïàðàìåòðû...", ID_PROFERENCES + MENUITEM SEPARATOR + MENUITEM "&Âûõîä", ID_EXIT + END END Modified: trunk/reactos/base/applications/kbswitch/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
============================================================================== --- trunk/reactos/base/applications/kbswitch/resource.h [iso-8859-1] (original) +++ trunk/reactos/base/applications/kbswitch/resource.h [iso-8859-1] Tue Apr 22 15:01:08 2008 @@ -1,5 +1,9 @@ /* Icons */ -#define IDI_MAIN 100 +#define IDI_MAIN 100 -/* Strings */ -#define IDS_EXIT 1001 +/* Menus */ +#define IDR_POPUP 12000 + +/* Menu items */ +#define ID_EXIT 10001 +#define ID_PROFERENCES 10002
16 years, 8 months
1
0
0
0
[dchapyshev] 33108: - Add kbswitch to bootcd
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Tue Apr 22 14:09:13 2008 New Revision: 33108 URL:
http://svn.reactos.org/svn/reactos?rev=33108&view=rev
Log: - Add kbswitch to bootcd Modified: trunk/reactos/boot/bootdata/packages/reactos.dff Modified: trunk/reactos/boot/bootdata/packages/reactos.dff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/rea…
============================================================================== --- trunk/reactos/boot/bootdata/packages/reactos.dff [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/packages/reactos.dff [iso-8859-1] Tue Apr 22 14:09:13 2008 @@ -45,6 +45,7 @@ base\applications\games\solitaire\sol.exe 1 base\applications\games\winemine\winemine.exe 1 base\applications\hh\hh.exe 1 +base\applications\kbswitch\kbswitch.exe 1 base\applications\logoff\logoff.exe 1 base\applications\msconfig\msconfig.exe 1 base\applications\mstsc\mstsc.exe 1
16 years, 8 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
40
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
Results per page:
10
25
50
100
200