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
February 2007
----- 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
16 participants
265 discussions
Start a n
N
ew thread
[tretiakov] 25922: Make ntuser locks use eresource instead of mutex. Fix corresponding FIXME in class.c
by tretiakov@svn.reactos.org
Author: tretiakov Date: Wed Feb 28 16:21:48 2007 New Revision: 25922 URL:
http://svn.reactos.org/svn/reactos?rev=25922&view=rev
Log: Make ntuser locks use eresource instead of mutex. Fix corresponding FIXME in class.c Modified: trunk/reactos/subsystems/win32/win32k/include/ntuser.h trunk/reactos/subsystems/win32/win32k/ntuser/class.c trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c Modified: trunk/reactos/subsystems/win32/win32k/include/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/ntuser.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/ntuser.h Wed Feb 28 16:21:48 2007 @@ -1,12 +1,5 @@ #ifndef _WIN32K_NTUSER_H #define _WIN32K_NTUSER_H - - -extern char* _file; -extern DWORD _line; -extern DWORD _locked; - -extern FAST_MUTEX UserLock; #define DECLARE_RETURN(type) type _ret_ #define RETURN(value) { _ret_ = value; goto _cleanup_; } @@ -14,45 +7,17 @@ #define END_CLEANUP return _ret_; -#define UserEnterCo() UserEnterExclusive() -#define UserLeaveCo() UserLeave() - -#define UserEnterShared() UserEnterExclusive() - -#define UserEnterExclusive() \ -{ \ - /* DPRINT1("try xlock, %s, %i (%i)\n",__FILE__,__LINE__, _locked);*/ \ - if (UserLock.Owner == KeGetCurrentThread()){ \ - DPRINT1("file %s, line %i\n",_file, _line); \ - ASSERT(FALSE); \ - } \ - UUserEnterExclusive(); \ - ASSERT(InterlockedIncrement((PLONG)(&_locked)) == 1 /*> 0*/); \ - _file = __FILE__; _line = __LINE__; \ - /* DPRINT("got lock, %s, %i (%i)\n",__FILE__,__LINE__, _locked);*/ \ -} - -#define UserLeave() \ -{ \ - ASSERT(InterlockedDecrement((PLONG)(&_locked)) == 0/*>= 0*/); \ - /*DPRINT("unlock, %s, %i (%i)\n",__FILE__,__LINE__, _locked);*/ \ - if (UserLock.Owner != KeGetCurrentThread()) { \ - DPRINT1("file %s, line %i\n",_file, _line); \ - ASSERT(FALSE); \ - } \ - _file = __FILE__; _line = __LINE__; \ - UUserLeave(); \ -} - +#define UserEnterCo UserEnterExclusive +#define UserLeaveCo UserLeave NTSTATUS FASTCALL InitUserImpl(VOID); -VOID FASTCALL UninitUser(VOID); -VOID FASTCALL UUserEnterShared(VOID); -VOID FASTCALL UUserEnterExclusive(VOID); -VOID FASTCALL UUserLeave(VOID); +VOID FASTCALL CleanupUserImpl(VOID); +VOID FASTCALL UserEnterShared(VOID); +VOID FASTCALL UserEnterExclusive(VOID); +VOID FASTCALL UserLeave(VOID); BOOL FASTCALL UserIsEntered(); - +BOOL FASTCALL UserIsEnteredExclusive(); #endif /* _WIN32K_NTUSER_H */ Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c Wed Feb 28 16:21:48 2007 @@ -220,8 +220,8 @@ IN BOOL Ansi, IN BOOL UseCallProc2) { - /* FIXME - assert for exclusive lock! */ - + ASSERT(UserIsEnteredExclusive() == TRUE); + if (Class->System) { return (Ansi ? Class->WndProcExtra : Class->WndProc); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c Wed Feb 28 16:21:48 2007 @@ -33,25 +33,16 @@ #define NDEBUG #include <debug.h> - -FAST_MUTEX UserLock; - -char* _file; -DWORD _line; -DWORD _locked=0; +ERESOURCE UserLock; /* FUNCTIONS **********************************************************/ NTSTATUS FASTCALL InitUserImpl(VOID) { - //PVOID mem; NTSTATUS Status; - // DPRINT("Enter InitUserImpl\n"); - // ExInitializeResourceLite(&UserLock); - - ExInitializeFastMutex(&UserLock); + ExInitializeResourceLite(&UserLock); if (!ObmCreateHandleTable()) { @@ -75,41 +66,31 @@ */ BOOL FASTCALL UserIsEntered() { - return (UserLock.Owner == KeGetCurrentThread()); + return ExIsResourceAcquiredExclusiveLite(&UserLock) + || ExIsResourceAcquiredSharedLite(&UserLock); } - -VOID FASTCALL CleanupUser(VOID) +BOOL FASTCALL UserIsEnteredExclusive() { - // ExDeleteResourceLite(&UserLock); + return ExIsResourceAcquiredExclusiveLite(&UserLock); } -VOID FASTCALL UUserEnterShared(VOID) +VOID FASTCALL CleanupUserImpl(VOID) { - // DPRINT("Enter IntLockUserShared\n"); - // KeDumpStackFrames((PULONG)__builtin_frame_address(0)); - //DPRINT("%x\n",__builtin_return_address(0)); - // KeEnterCriticalRegion(); - // ExAcquireResourceSharedLite(&UserLock, TRUE); - ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&UserLock); + ExDeleteResourceLite(&UserLock); } -VOID FASTCALL UUserEnterExclusive(VOID) +VOID FASTCALL UserEnterShared(VOID) { - // DPRINT("Enter UserEnterExclusive\n"); - // KeDumpStackFrames((PULONG)__builtin_frame_address(0)); - //DPRINT("%x\n",__builtin_return_address(0)); - // KeEnterCriticalRegion(); - // ExAcquireResourceExclusiveLite(&UserLock, TRUE); - ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&UserLock); + ExAcquireResourceSharedLite(&UserLock, TRUE); } -VOID FASTCALL UUserLeave(VOID) +VOID FASTCALL UserEnterExclusive(VOID) { - // DPRINT("Enter UserLeave\n"); - // KeDumpStackFrames((PULONG)__builtin_frame_address(0)); - //DPRINT("%x\n",__builtin_return_address(0)); - // ExReleaseResourceLite(&UserLock); - // KeLeaveCriticalRegion(); - ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&UserLock); + ExAcquireResourceExclusiveLite(&UserLock, TRUE); } + +VOID FASTCALL UserLeave(VOID) +{ + ExReleaseResourceLite(&UserLock); +}
17 years, 9 months
1
0
0
0
[tkreuzer] 25921: EnumChildWindows: - if hWndParent == NULL: call EnumWindows - else use bChildren = TRUE
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Feb 28 16:21:09 2007 New Revision: 25921 URL:
http://svn.reactos.org/svn/reactos?rev=25921&view=rev
Log: EnumChildWindows: - if hWndParent == NULL: call EnumWindows - else use bChildren = TRUE Modified: trunk/reactos/dll/win32/user32/windows/window.c Modified: trunk/reactos/dll/win32/user32/windows/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c (original) +++ trunk/reactos/dll/win32/user32/windows/window.c Wed Feb 28 16:21:09 2007 @@ -551,8 +551,10 @@ LPARAM lParam) { if ( !hWndParent ) - hWndParent = GetDesktopWindow(); - return User32EnumWindows ( NULL, hWndParent, lpEnumFunc, lParam, 0, FALSE ); + { + return EnumWindows(lpEnumFunc, lParam); + } + return User32EnumWindows ( NULL, hWndParent, lpEnumFunc, lParam, 0, TRUE ); }
17 years, 9 months
1
0
0
0
[tkreuzer] 25920: NtUserBuildHwndList: - handle bChildren - remove some code duplication
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Feb 28 16:19:00 2007 New Revision: 25920 URL:
http://svn.reactos.org/svn/reactos?rev=25920&view=rev
Log: NtUserBuildHwndList: - handle bChildren - remove some code duplication Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c Wed Feb 28 16:19:00 2007 @@ -1126,6 +1126,42 @@ return(0); } +STATIC +ULONG +STDCALL +IntBuildHwndList( + PWINDOW_OBJECT Window, + BOOLEAN bChildren, + HWND* pWnd, + ULONG nBufSize) +{ + NTSTATUS Status; + PWINDOW_OBJECT Child; + ULONG dwInc, dwCount = 0; + + for(Child = Window->FirstChild; Child != NULL; Child = Child->NextSibling) + { + if(dwCount++ < nBufSize && pWnd) + { + Status = MmCopyToCaller(pWnd++, &Child->hSelf, sizeof(HWND)); + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + break; + } + } + if (bChildren) + { + dwInc = IntBuildHwndList(Child, + bChildren, + pWnd, + nBufSize > dwCount ? nBufSize - dwCount : 0); + dwCount += dwInc; + pWnd += dwInc; + } + } + return dwCount; +} /* * As best as I can figure, this function is used by EnumWindows, @@ -1152,30 +1188,55 @@ NTSTATUS Status; ULONG dwCount = 0; - /* FIXME handle bChildren */ - - if(hwndParent) - { - PWINDOW_OBJECT Window, Child; - if(!(Window = UserGetWindowObject(hwndParent))) - { - return 0; - } - - for(Child = Window->FirstChild; Child != NULL; Child = Child->NextSibling) - { - if(dwCount++ < nBufSize && pWnd) + if (hwndParent || !dwThreadId) + { + PDESKTOP_OBJECT Desktop; + PWINDOW_OBJECT Window; + + if(!hwndParent) + { + if(hDesktop == NULL && !(Desktop = IntGetActiveDesktop())) { - Status = MmCopyToCaller(pWnd++, &Child->hSelf, sizeof(HWND)); + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + if(hDesktop) + { + Status = IntValidateDesktopHandle(hDesktop, + UserMode, + 0, + &Desktop); if(!NT_SUCCESS(Status)) { - SetLastNtError(Status); - break; + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; } } - } - } - else if(dwThreadId) + hwndParent = Desktop->DesktopWindow; + } + else + { + hDesktop = 0; + } + + if(!(Window = UserGetWindowObject(hwndParent))) + { + if(hDesktop) + { + ObDereferenceObject(Desktop); + } + return 0; + } + + dwCount = IntBuildHwndList(Window, bChildren, pWnd, nBufSize); + + if(hDesktop) + { + ObDereferenceObject(Desktop); + } + } + else { PETHREAD Thread; PW32THREAD W32Thread; @@ -1216,50 +1277,6 @@ } ObDereferenceObject(Thread); - } - else - { - PDESKTOP_OBJECT Desktop; - PWINDOW_OBJECT Window, Child; - - if(hDesktop == NULL && !(Desktop = IntGetActiveDesktop())) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - - if(hDesktop) - { - Status = IntValidateDesktopHandle(hDesktop, - UserMode, - 0, - &Desktop); - if(!NT_SUCCESS(Status)) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - } - if(!(Window = UserGetWindowObject(Desktop->DesktopWindow))) - { - if(hDesktop) ObDereferenceObject(Desktop); - return 0; - } - - for(Child = Window->FirstChild; Child != NULL; Child = Child->NextSibling) - { - if(dwCount++ < nBufSize && pWnd) - { - Status = MmCopyToCaller(pWnd++, &Child->hSelf, sizeof(HWND)); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - break; - } - } - } - - if(hDesktop) ObDereferenceObject(Desktop); } return dwCount;
17 years, 9 months
1
0
0
0
[tretiakov] 25919: Andrey Janzen (virus126): echo %date% on windows >=XP return '24.02.2007', not 'Sut 24.02.2007' fix & implement dynamic buffer
by tretiakov@svn.reactos.org
Author: tretiakov Date: Wed Feb 28 16:17:34 2007 New Revision: 25919 URL:
http://svn.reactos.org/svn/reactos?rev=25919&view=rev
Log: Andrey Janzen (virus126): echo %date% on windows >=XP return '24.02.2007', not 'Sut 24.02.2007' fix & implement dynamic buffer Modified: trunk/reactos/base/shell/cmd/cmd.c Modified: trunk/reactos/base/shell/cmd/cmd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=2…
============================================================================== --- trunk/reactos/base/shell/cmd/cmd.c (original) +++ trunk/reactos/base/shell/cmd/cmd.c Wed Feb 28 16:17:34 2007 @@ -1178,18 +1178,12 @@ /* %DATE% */ else if (_tcsicmp(varName,_T("date")) ==0) { - LPTSTR tmp; - - if ( !GrowIfNecessary ( MAX_PATH, &ret, &retlen ) ) + + if ( !GrowIfNecessary ( GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0), &ret, &retlen ) ) return NULL; - size = GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("ddd"), ret, retlen ); - /* TODO FIXME - test whether GetDateFormat() can return a value indicating the buffer wasn't big enough */ - if ( !size ) - return NULL; - tmp = ret + _tcslen(ret); - *tmp++ = _T(' '); - size = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, tmp, retlen-(tmp-ret)); - /* TODO FIXME - test whether GetDateFormat() can return a value indicating the buffer wasn't big enough */ + + size = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, ret, retlen); + if ( !size ) return NULL; return ret;
17 years, 9 months
1
0
0
0
[dcote] 25918: Added test functions for fsrtl lib
by dcote@svn.reactos.org
Author: dcote Date: Wed Feb 28 07:09:16 2007 New Revision: 25918 URL:
http://svn.reactos.org/svn/reactos?rev=25918&view=rev
Log: Added test functions for fsrtl lib Modified: trunk/reactos/ntoskrnl/tests/fsrtl.c Modified: trunk/reactos/ntoskrnl/tests/fsrtl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/tests/fsrtl.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/tests/fsrtl.c (original) +++ trunk/reactos/ntoskrnl/tests/fsrtl.c Wed Feb 28 07:09:16 2007 @@ -42,6 +42,8 @@ PLARGE_INTEGER ValidDataLength; PLARGE_INTEGER FileSize; + PDEVICE_OBJECT pRelatedDo = NULL; + /* Allocate a 100KB buffer to do IOs */ Buffer = ExAllocatePool(PagedPool,100*_1KB); @@ -275,6 +277,188 @@ Fh = NULL; } + /* ------------------------------------------------------------------------ + TESTING: + BOOLEAN + NTAPI + FsRtlPrepareMdlWriteDev(IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN ULONG LockKey, + OUT PMDL *MdlChain, + OUT PIO_STATUS_BLOCK IoStatus, + IN PDEVICE_OBJECT DeviceObject) + + ------------------------------------------------------------------------ */ + + /* We are going to repeat the same bunch of tests but with Wait = FALSE. So we exercise the second part of the function. */ + FsRtlTest_OpenTestFile(&Fh, &Pfo); + + /* Extract the test variable from the FCB struct */ + FcbHeader = (PFSRTL_COMMON_FCB_HEADER)Pfo->FsContext; + AllocationSize = &FcbHeader->AllocationSize; + ValidDataLength = &FcbHeader->ValidDataLength; + FileSize = &FcbHeader->FileSize; + + /* Try to cache without caching having been initialized. This should fail.*/ + Length = 10*_1KB; + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - No cache map test. Wait = FALSE", + !FsRtlPrepareMdlWriteDev(Pfo,AllocationSize,Length,0,MdlChain,&IoStatus,NULL)); + + /* We are going to build a 100k file */ + /* This will inititate caching and build some size */ + Offset.QuadPart = 0; + Length = 100*_1KB; + Return = FsRltTest_WritefileZw(Fh,&Offset,Length, Buffer, &IoStatus); + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - Building 100k filesize. Wait = FALSE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + Return = TRUE; + + /* Extending the file by 1/2 sector, 256 bytes. */ + Offset.QuadPart = 0x7fffffffffff; + Length = 0x100; + Return = FsRltTest_WritefileZw(Fh,NULL,Length, Buffer, &IoStatus); + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - Extending by 1/2 sector. Wait = FALSE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + Return = TRUE; + + + pRelatedDo = IoGetRelatedDeviceObject(Pfo); + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - Did we get related DO ?",pRelatedDo); + + + /* Append to the file past the allocation size*/ + Offset.QuadPart = FileSize->QuadPart; + OldSize.QuadPart = FileSize->QuadPart; + Length = (ULONG) (AllocationSize->QuadPart -ValidDataLength->QuadPart); + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - Testing extending past allocation size.", + !FsRtlPrepareMdlWriteDev(Pfo,&Offset,Length+1,0,&MdlChain,&IoStatus,pRelatedDo)); + + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - Testing extending not past allocation size.", + FsRtlPrepareMdlWriteDev(Pfo,&Offset,Length,0,&MdlChain,&IoStatus,pRelatedDo)); + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - Check filesize",(FileSize->QuadPart = (OldSize.QuadPart+Length))); + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - Release the MDL.",FsRtlMdlWriteCompleteDev(Pfo,&Offset,MdlChain,pRelatedDo)); + + + /* Try do write a 65kb IO and check that if fails. Maximum IO size for thus function is 64KB */ + Offset.QuadPart = 0; + MdlChain = NULL; + Length = 65*_1KB; + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - 65KB IO Test.", + FsRtlPrepareMdlWriteDev(Pfo,&Offset,Length,0,&MdlChain,&IoStatus,pRelatedDo)); + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - Release the MDL.",FsRtlMdlWriteCompleteDev(Pfo,&Offset,MdlChain,pRelatedDo)); + + /* Try do write a 64kb IO. Maximum IO size for thus function is 64KB */ + Length = 64*_1KB; + MdlChain = NULL; + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - 64KB IO Test.", + FsRtlPrepareMdlWriteDev(Pfo,&Offset,Length,0,&MdlChain,&IoStatus,NULL)) + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - Release the MDL.",FsRtlMdlWriteCompleteDev(Pfo,&Offset,MdlChain,NULL)); + + /* Test the fast Io not possible flag */ + FcbHeader->IsFastIoPossible = FastIoIsNotPossible; + FSRTL_TEST("FsRtlPrepareMdlWriteDev() - FastIo is not possible flag.", + !FsRtlPrepareMdlWriteDev(Pfo,&Offset,Length,0,&MdlChain,&IoStatus,NULL)) + + if (Pfo) + { + ObDereferenceObject(Pfo); + Pfo = NULL; + } + + if (Fh) + { + ZwClose(Fh); + Fh = NULL; + } + + /* ------------------------------------------------------------------------ + TESTING: + BOOLEAN + NTAPI + FsRtlPrepareMdlWrite( IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN ULONG LockKey, + OUT PMDL *MdlChain, + OUT PIO_STATUS_BLOCK IoStatus, + IN PDEVICE_OBJECT DeviceObject) + + ------------------------------------------------------------------------ */ + + /* We are going to repeat the same bunch of tests but with Wait = FALSE. So we exercise the second part of the function. */ + FsRtlTest_OpenTestFile(&Fh, &Pfo); + + /* Extract the test variable from the FCB struct */ + FcbHeader = (PFSRTL_COMMON_FCB_HEADER)Pfo->FsContext; + AllocationSize = &FcbHeader->AllocationSize; + ValidDataLength = &FcbHeader->ValidDataLength; + FileSize = &FcbHeader->FileSize; + + /* Try to cache without caching having been initialized. This should fail.*/ + Length = 10*_1KB; + FSRTL_TEST("FsRtlPrepareMdlWrite() - No cache map test. Wait = FALSE", + !FsRtlPrepareMdlWrite(Pfo,AllocationSize,Length,0,MdlChain,&IoStatus)); + + /* We are going to build a 100k file */ + /* This will inititate caching and build some size */ + Offset.QuadPart = 0; + Length = 100*_1KB; + Return = FsRltTest_WritefileZw(Fh,&Offset,Length, Buffer, &IoStatus); + FSRTL_TEST("FsRtlPrepareMdlWrite() - Building 100k filesize. Wait = FALSE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + Return = TRUE; + + /* Extending the file by 1/2 sector, 256 bytes. */ + Offset.QuadPart = 0x7fffffffffff; + Length = 0x100; + Return = FsRltTest_WritefileZw(Fh,NULL,Length, Buffer, &IoStatus); + FSRTL_TEST("FsRtlPrepareMdlWrite() - Extending by 1/2 sector. Wait = FALSE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + Return = TRUE; + + + /* Append to the file past the allocation size*/ + MdlChain = NULL; + Offset.QuadPart = FileSize->QuadPart; + OldSize.QuadPart = FileSize->QuadPart; + Length = (ULONG) (AllocationSize->QuadPart -ValidDataLength->QuadPart); + FSRTL_TEST("FsRtlPrepareMdlWrite() - Testing extending past allocation size.", + !FsRtlPrepareMdlWrite(Pfo,&Offset,Length+1,0,&MdlChain,&IoStatus)); + + FSRTL_TEST("FsRtlPrepareMdlWrite() - Testing extending not past allocation size.", + FsRtlPrepareMdlWrite(Pfo,&Offset,Length,0,&MdlChain,&IoStatus)); + FSRTL_TEST("FsRtlPrepareMdlWrite() - Check filesize",(FileSize->QuadPart = (OldSize.QuadPart+Length))); + FSRTL_TEST("FsRtlPrepareMdlWrite() - Release the MDL.",FsRtlMdlWriteComplete(Pfo,&Offset,MdlChain)); + + + /* Try do write a 65kb IO and check that if fails. Maximum IO size for thus function is 64KB */ + Offset.QuadPart = 0; + MdlChain = NULL; + Length = 65*_1KB; + FSRTL_TEST("FsRtlPrepareMdlWrite() - 65KB IO Test.", + !FsRtlPrepareMdlWrite(Pfo,&Offset,Length,0,&MdlChain,&IoStatus)); + //FSRTL_TEST("FsRtlPrepareMdlWrite() - Release the MDL.",FsRtlMdlWriteComplete(Pfo,&Offset,MdlChain)); + + /* Try do write a 64kb IO. Maximum IO size for thus function is 64KB */ + Length = 64*_1KB; + MdlChain = NULL; + FSRTL_TEST("FsRtlPrepareMdlWrite() - 64KB IO Test.", + FsRtlPrepareMdlWrite(Pfo,&Offset,Length,0,&MdlChain,&IoStatus)) + FSRTL_TEST("FsRtlPrepareMdlWrite() - Release the MDL.",FsRtlMdlWriteComplete(Pfo,&Offset,MdlChain)); + + /* Test the fast Io not possible flag */ + FcbHeader->IsFastIoPossible = FastIoIsNotPossible; + FSRTL_TEST("FsRtlPrepareMdlWrite() - FastIo is not possible flag.", + !FsRtlPrepareMdlWrite(Pfo,&Offset,Length,0,&MdlChain,&IoStatus)) + + if (Pfo) + { + ObDereferenceObject(Pfo); + Pfo = NULL; + } + + if (Fh) + { + ZwClose(Fh); + Fh = NULL; + } /* ------------------------------------------------------------------------------------------ TESTING:
17 years, 9 months
1
0
0
0
[hyperion] 25917: modified include/reactos/libs/pseh/framebased.h modified lib/pseh/framebased.c - _SEH_ENABLE_TRACE now obsolete; _SEH_ENABLE_TRACE_LIB renamed to _SEH_ENABLE_TRACE now that the name is available again. Yay open source development model and yay me
by hyperion@svn.reactos.org
Author: hyperion Date: Wed Feb 28 03:22:08 2007 New Revision: 25917 URL:
http://svn.reactos.org/svn/reactos?rev=25917&view=rev
Log: modified include/reactos/libs/pseh/framebased.h modified lib/pseh/framebased.c - _SEH_ENABLE_TRACE now obsolete; _SEH_ENABLE_TRACE_LIB renamed to _SEH_ENABLE_TRACE now that the name is available again. Yay open source development model and yay me Modified: trunk/reactos/include/reactos/libs/pseh/framebased.h trunk/reactos/lib/pseh/framebased.c Modified: trunk/reactos/include/reactos/libs/pseh/framebased.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/pseh/…
============================================================================== --- trunk/reactos/include/reactos/libs/pseh/framebased.h (original) +++ trunk/reactos/include/reactos/libs/pseh/framebased.h Wed Feb 28 03:22:08 2007 @@ -285,7 +285,7 @@ if(&_SEHLocals != _SEHDummyLocals) \ _SEHFrame.SEH_Locals = &_SEHLocals; \ \ - _SEH_InitializeTracing(); \ + _SEH_EnableTracing(_SEH_DO_DEFAULT_TRACING); \ _SEHFrame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \ _SEHEnterFrame(&_SEHFrame.SEH_Header, &_SEHTryLevel.ST_Header); \ } \ @@ -331,7 +331,7 @@ if(&_SEHLocals != _SEHDummyLocals) \ _SEHFrame.SEH_Locals = &_SEHLocals; \ \ - _SEH_InitializeTracing(); \ + _SEH_EnableTracing(_SEH_DO_DEFAULT_TRACING); \ _SEHFrame.SEH_Header.SPF_Handler = 0; \ _SEHEnterFrame(&_SEHFrame.SEH_Header, &_SEHTryLevel.ST_Header); \ } \ @@ -364,12 +364,6 @@ #define _SEH_EnableTracing(LEVEL_) ((void)(_SEHPortableFrame->SPF_Tracing = (LEVEL_))) #define _SEH_DisableTracing() ((void)(_SEHPortableFrame->SPF_Tracing = _SEH_DO_TRACE_NONE)) -#ifdef _SEH_ENABLE_TRACE -#define _SEH_InitializeTracing() (_SEH_EnableTracing(_SEH_DO_DEFAULT_TRACING)) -#else -#define _SEH_InitializeTracing() (_SEH_DisableTracing()) -#endif - #endif /* EOF */ Modified: trunk/reactos/lib/pseh/framebased.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/framebased.c?rev=…
============================================================================== --- trunk/reactos/lib/pseh/framebased.c (original) +++ trunk/reactos/lib/pseh/framebased.c Wed Feb 28 03:22:08 2007 @@ -32,7 +32,7 @@ #include <excpt.h> /* Tracing */ -#ifdef _SEH_ENABLE_TRACE_LIB +#ifdef _SEH_ENABLE_TRACE extern unsigned long __cdecl DbgPrint(const char * format, ...); #define _SEH_TRACE_HEADER_(FRAME_) \
17 years, 9 months
1
0
0
0
[hyperion] 25916: modified framebased.h - don't enable a random tracing level when the library is built for tracing but an application is not. Fastest bugfix ever
by hyperion@svn.reactos.org
Author: hyperion Date: Wed Feb 28 03:16:38 2007 New Revision: 25916 URL:
http://svn.reactos.org/svn/reactos?rev=25916&view=rev
Log: modified framebased.h - don't enable a random tracing level when the library is built for tracing but an application is not. Fastest bugfix ever Modified: trunk/reactos/include/reactos/libs/pseh/framebased.h Modified: trunk/reactos/include/reactos/libs/pseh/framebased.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/pseh/…
============================================================================== --- trunk/reactos/include/reactos/libs/pseh/framebased.h (original) +++ trunk/reactos/include/reactos/libs/pseh/framebased.h Wed Feb 28 03:16:38 2007 @@ -367,7 +367,7 @@ #ifdef _SEH_ENABLE_TRACE #define _SEH_InitializeTracing() (_SEH_EnableTracing(_SEH_DO_DEFAULT_TRACING)) #else -#define _SEH_InitializeTracing() ((void)0) +#define _SEH_InitializeTracing() (_SEH_DisableTracing()) #endif #endif
17 years, 9 months
1
0
0
0
[hyperion] 25915: modified include/reactos/libs/pseh/framebased.h - final reformatting/cleanup fixes - fixed regression introduced in 25908 modified include/reactos/libs/pseh/framebased.h modified include/reactos/libs/pseh/framebased/internal.h modified lib/pseh/framebased.c - per-frame tracing support for PSEH. Prints detailed debugging traces with DbgPrint when enabled. New defines _SEH_ENABLE_TRACE, _SEH_ENABLE_TRACE_LIB and _SEH_DO_DEFAULT_TRACING, new macros _SEH_EnableTracing() and _SEH_Di
by hyperion@svn.reactos.org
Author: hyperion Date: Wed Feb 28 03:04:36 2007 New Revision: 25915 URL:
http://svn.reactos.org/svn/reactos?rev=25915&view=rev
Log: modified include/reactos/libs/pseh/framebased.h - final reformatting/cleanup fixes - fixed regression introduced in 25908 modified include/reactos/libs/pseh/framebased.h modified include/reactos/libs/pseh/framebased/internal.h modified lib/pseh/framebased.c - per-frame tracing support for PSEH. Prints detailed debugging traces with DbgPrint when enabled. New defines _SEH_ENABLE_TRACE, _SEH_ENABLE_TRACE_LIB and _SEH_DO_DEFAULT_TRACING, new macros _SEH_EnableTracing() and _SEH_DisableTracing(), new constants _SEH_DO_TRACE_XXX. Please test it See issue #2069 for more details. Modified: trunk/reactos/include/reactos/libs/pseh/framebased.h trunk/reactos/include/reactos/libs/pseh/framebased/internal.h trunk/reactos/lib/pseh/framebased.c Modified: trunk/reactos/include/reactos/libs/pseh/framebased.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/pseh/…
============================================================================== --- trunk/reactos/include/reactos/libs/pseh/framebased.h (original) +++ trunk/reactos/include/reactos/libs/pseh/framebased.h Wed Feb 28 03:04:36 2007 @@ -46,6 +46,12 @@ # define _SEHJmpBuf_t jmp_buf #endif +#ifdef __cplusplus +# define _SEH_INIT_CONST static const +#else +# define _SEH_INIT_CONST register const +#endif + typedef struct __SEHFrame { _SEHPortableFrame_t SEH_Header; @@ -193,7 +199,7 @@ _SEHEnterTry(&_SEHTryLevel.ST_Header); \ \ { \ - static const int _SEHScopeKind = 0; \ + _SEH_INIT_CONST int _SEHScopeKind = 0; \ (void)_SEHScopeKind; \ \ if(_SEHSetJmp(_SEHTryLevel.ST_JmpBuf) == 0) \ @@ -232,35 +238,29 @@ /* New syntax */ -#ifdef __cplusplus -# define _SEH2_INIT_CONST static const -#else -# define _SEH2_INIT_CONST register const -#endif - #define _SEH_LEAVE break #define _SEH_TRY \ { \ - _SEH2_INIT_CONST int _SEH2TopTryLevel = (_SEHScopeKind != 0); \ - _SEHPortableFrame_t * const _SEH2CurPortableFrame = _SEHPortableFrame; \ + _SEH_INIT_CONST int _SEHTopTryLevel = (_SEHScopeKind != 0); \ + _SEHPortableFrame_t * const _SEHCurPortableFrame = _SEHPortableFrame; \ \ { \ - static const int _SEHScopeKind = 0; \ - register int _SEH2State = 0; \ - register int _SEH2Handle = 0; \ - _SEHFrame_t _SEH2Frame; \ - _SEHTryLevel_t _SEH2TryLevel; \ + _SEH_INIT_CONST int _SEHScopeKind = 0; \ + register int _SEHState = 0; \ + register int _SEHHandle = 0; \ + _SEHFrame_t _SEHFrame; \ + _SEHTryLevel_t _SEHTryLevel; \ _SEHPortableFrame_t * const _SEHPortableFrame = \ - _SEH2TopTryLevel ? &_SEH2Frame.SEH_Header : _SEH2CurPortableFrame; \ + _SEHTopTryLevel ? &_SEHFrame.SEH_Header : _SEHCurPortableFrame; \ \ (void)_SEHScopeKind; \ (void)_SEHPortableFrame; \ - (void)_SEH2Handle; \ + (void)_SEHHandle; \ \ for(;;) \ { \ - if(_SEH2State) \ + if(_SEHState) \ { \ for(;;) \ { \ @@ -278,21 +278,23 @@ { \ _SEH_DECLARE_HANDLERS((FILTER_), 0); \ \ - _SEH2TryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ - \ - if(_SEH2TopTryLevel) \ + _SEHTryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ + \ + if(_SEHTopTryLevel) \ { \ if(&_SEHLocals != _SEHDummyLocals) \ - _SEH2Frame.SEH_Locals = &_SEHLocals; \ - \ - _SEH2Frame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \ - _SEHEnterFrame(&_SEH2Frame.SEH_Header, &_SEH2TryLevel.ST_Header); \ + _SEHFrame.SEH_Locals = &_SEHLocals; \ + \ + _SEH_InitializeTracing(); \ + _SEHFrame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \ + _SEHEnterFrame(&_SEHFrame.SEH_Header, &_SEHTryLevel.ST_Header); \ } \ else \ - _SEHEnterTry(&_SEH2TryLevel.ST_Header); \ - \ - if((_SEH2Handle = _SEHSetJmp(_SEH2TryLevel.ST_JmpBuf)) == 0) \ - { \ + _SEHEnterTry(&_SEHTryLevel.ST_Header); \ + \ + if((_SEHHandle = _SEHSetJmp(_SEHTryLevel.ST_JmpBuf)) == 0) \ + { \ + ++ _SEHState; \ continue; \ } \ else \ @@ -306,7 +308,7 @@ \ _SEHLeave(); \ \ - if(_SEH2Handle) \ + if(_SEHHandle) \ { #define _SEH_FINALLY(FINALLY_) \ @@ -322,27 +324,29 @@ { \ _SEH_DECLARE_HANDLERS(0, (FINALLY_)); \ \ - _SEH2TryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ - \ - if(_SEH2TopTryLevel) \ + _SEHTryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ + \ + if(_SEHTopTryLevel) \ { \ if(&_SEHLocals != _SEHDummyLocals) \ - _SEH2Frame.SEH_Locals = &_SEHLocals; \ - \ - _SEH2Frame.SEH_Header.SPF_Handler = 0; \ - _SEHEnterFrame(&_SEH2Frame.SEH_Header, &_SEH2TryLevel.ST_Header); \ + _SEHFrame.SEH_Locals = &_SEHLocals; \ + \ + _SEH_InitializeTracing(); \ + _SEHFrame.SEH_Header.SPF_Handler = 0; \ + _SEHEnterFrame(&_SEHFrame.SEH_Header, &_SEHTryLevel.ST_Header); \ } \ else \ - _SEHEnterTry(&_SEH2TryLevel.ST_Header); \ - \ - ++ _SEH2State; \ + _SEHEnterTry(&_SEHTryLevel.ST_Header); \ + \ + ++ _SEHState; \ continue; \ } \ \ break; \ } \ \ - (FINALLY_)(&_SEH2Frame.SEH_Header); \ + (FINALLY_)(&_SEHFrame.SEH_Header); \ + \ if(0) \ { @@ -357,6 +361,15 @@ #define _SEH_GetExceptionPointers _SEHX_GetExceptionPointers #define _SEH_AbnormalTermination _SEHX_AbnormalTermination +#define _SEH_EnableTracing(LEVEL_) ((void)(_SEHPortableFrame->SPF_Tracing = (LEVEL_))) +#define _SEH_DisableTracing() ((void)(_SEHPortableFrame->SPF_Tracing = _SEH_DO_TRACE_NONE)) + +#ifdef _SEH_ENABLE_TRACE +#define _SEH_InitializeTracing() (_SEH_EnableTracing(_SEH_DO_DEFAULT_TRACING)) +#else +#define _SEH_InitializeTracing() ((void)0) +#endif + #endif /* EOF */ Modified: trunk/reactos/include/reactos/libs/pseh/framebased/internal.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/pseh/…
============================================================================== --- trunk/reactos/include/reactos/libs/pseh/framebased/internal.h (original) +++ trunk/reactos/include/reactos/libs/pseh/framebased/internal.h Wed Feb 28 03:04:36 2007 @@ -22,6 +22,23 @@ #ifndef KJK_PSEH_FRAMEBASED_INTERNAL_H_ #define KJK_PSEH_FRAMEBASED_INTERNAL_H_ + +#define _SEH_DO_TRACE_ENTER_LEAVE (1 << 0) +#define _SEH_DO_TRACE_EXCEPTION_RECORD (1 << 1) +#define _SEH_DO_TRACE_CONTEXT (1 << 2) +#define _SEH_DO_TRACE_UNWIND (1 << 3) +#define _SEH_DO_TRACE_TRYLEVEL (1 << 4) +#define _SEH_DO_TRACE_CALL_FILTER (1 << 5) +#define _SEH_DO_TRACE_FILTER (1 << 6) +#define _SEH_DO_TRACE_CALL_HANDLER (1 << 7) +#define _SEH_DO_TRACE_CALL_FINALLY (1 << 8) + +#define _SEH_DO_TRACE_NONE (0) +#define _SEH_DO_TRACE_ALL (-1) + +#ifndef _SEH_DO_DEFAULT_TRACING +#define _SEH_DO_DEFAULT_TRACING _SEH_DO_TRACE_NONE +#endif struct _EXCEPTION_RECORD; struct _EXCEPTION_POINTERS; @@ -81,6 +98,7 @@ unsigned long SPF_Code; _SEHHandler_t SPF_Handler; _SEHPortableTryLevel_t * SPF_TopTryLevel; + int SPF_Tracing; } _SEHPortableFrame_t; Modified: trunk/reactos/lib/pseh/framebased.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/framebased.c?rev=…
============================================================================== --- trunk/reactos/lib/pseh/framebased.c (original) +++ trunk/reactos/lib/pseh/framebased.c Wed Feb 28 03:04:36 2007 @@ -31,6 +31,248 @@ #include <excpt.h> +/* Tracing */ +#ifdef _SEH_ENABLE_TRACE_LIB +extern unsigned long __cdecl DbgPrint(const char * format, ...); + +#define _SEH_TRACE_HEADER_(FRAME_) \ + DbgPrint("[PSEH:%p]%s:%d:", FRAME_, __FILE__, __LINE__); + +#define _SEH_TRACE_TRAILER_ \ + DbgPrint("\n"); + +#define _SEH_FILTER_RET_STRING_(RET_) \ + (((int)(RET_) < 0) ? "_SEH_CONTINUE_EXECUTION" : (((int)(RET_) > 0) ? "_SEH_EXECUTE_HANDLER" : "_SEH_CONTINUE_SEARCH")) + +#define _SEH_TRACE_LINE_(FRAME_, ARGS_) \ +{ \ + _SEH_TRACE_HEADER_(FRAME_); \ + DbgPrint ARGS_; \ + _SEH_TRACE_TRAILER_; \ +} + +#define _SEH_TRACE_ENTER(FRAME_, FUNCNAME_, ARGS_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_ENTER_LEAVE) \ + { \ + _SEH_TRACE_HEADER_(FRAME_); \ + DbgPrint(">>> %s(", (FUNCNAME_)); \ + DbgPrint ARGS_; \ + DbgPrint(")"); \ + _SEH_TRACE_TRAILER_; \ + } \ +} + +#define _SEH_TRACE_LEAVE(FRAME_, FUNCNAME_, ARGS_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_ENTER_LEAVE) \ + { \ + _SEH_TRACE_HEADER_(FRAME_); \ + DbgPrint("<<< %s => ", (FUNCNAME_)); \ + DbgPrint ARGS_; \ + _SEH_TRACE_TRAILER_; \ + } \ +} + +#define _SEH_TRACE_EXCEPTION_RECORD(FRAME_, ER_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_EXCEPTION_RECORD) \ + { \ + _SEH_TRACE_LINE_ \ + ( \ + (FRAME_), \ + ( \ + "ExceptionRecord %p = { ExceptionCode : %08X, ExceptionFlags : %08X, ExceptionRecord : %p, ExceptionAddress : %p }", \ + (ER_), \ + (ER_)->ExceptionCode, \ + (ER_)->ExceptionFlags, \ + (ER_)->ExceptionRecord, \ + (ER_)->ExceptionAddress \ + ) \ + ); \ + } \ +} + +#ifdef _X86_ +#define _SEH_TRACE_CONTEXT(FRAME_, CONTEXT_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CONTEXT) \ + { \ + if(((CONTEXT_)->ContextFlags & CONTEXT_INTEGER) == CONTEXT_INTEGER) \ + { \ + _SEH_TRACE_LINE_ \ + ( \ + (FRAME_), \ + ( \ + "eax=%08X ebx=%08X ecx=%08X edx=%08X esi=%08X edi=%08X", \ + (CONTEXT_)->Eax, \ + (CONTEXT_)->Ebx, \ + (CONTEXT_)->Ecx, \ + (CONTEXT_)->Edx, \ + (CONTEXT_)->Esi, \ + (CONTEXT_)->Edi \ + ) \ + ); \ + } \ + \ + if(((CONTEXT_)->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL) \ + { \ + _SEH_TRACE_LINE_ \ + ( \ + (FRAME_), \ + ( \ + "eip=%08X esp=%08X ebp=%08X efl=%08X cs=%08X ss=%08X", \ + (CONTEXT_)->Eip, \ + (CONTEXT_)->Esp, \ + (CONTEXT_)->Ebp, \ + (CONTEXT_)->EFlags, \ + (CONTEXT_)->SegCs, \ + (CONTEXT_)->SegSs \ + ) \ + ); \ + } \ + \ + if(((CONTEXT_)->ContextFlags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS) \ + { \ + _SEH_TRACE_LINE_ \ + ( \ + (FRAME_), \ + ( \ + "ds=%08X es=%08X fs=%08X gs=%08X", \ + (CONTEXT_)->SegDs, \ + (CONTEXT_)->SegEs, \ + (CONTEXT_)->SegFs, \ + (CONTEXT_)->SegGs \ + ) \ + ); \ + } \ + } \ +} +#else +#error Unsupported platform. +#endif + +#define _SEH_TRACE_UNWIND(FRAME_, ARGS_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_UNWIND) \ + { \ + _SEH_TRACE_LINE_((FRAME_), ARGS_); \ + } \ +} + +#define _SEH_TRACE_TRYLEVEL(FRAME_, TRYLEVEL_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_TRYLEVEL) \ + { \ + _SEH_TRACE_LINE_((FRAME_), ("trylevel %p, filter %p", (TRYLEVEL_), (TRYLEVEL_)->SPT_Handlers->SH_Filter)); \ + } \ +} + +#define _SEH_TRACE_ENTER_CALL_FILTER(FRAME_, TRYLEVEL_, ER_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CALL_FILTER) \ + { \ + _SEH_TRACE_LINE_ \ + ( \ + (FRAME_), \ + ( \ + "trylevel %p, calling filter %p, ExceptionCode %08X", \ + (TRYLEVEL_), \ + (TRYLEVEL_)->SPT_Handlers->SH_Filter, \ + (ER_)->ExceptionCode \ + ) \ + ); \ + } \ +} + +#define _SEH_TRACE_LEAVE_CALL_FILTER(FRAME_, TRYLEVEL_, RET_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CALL_FILTER) \ + { \ + _SEH_TRACE_LINE_ \ + ( \ + (FRAME_), \ + ( \ + "trylevel %p, filter %p => %s", \ + (TRYLEVEL_), \ + (TRYLEVEL_)->SPT_Handlers->SH_Filter, \ + _SEH_FILTER_RET_STRING_(RET_) \ + ) \ + ); \ + } \ +} + +#define _SEH_TRACE_FILTER(FRAME_, TRYLEVEL_, RET_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_FILTER) \ + { \ + _SEH_TRACE_LINE_ \ + ( \ + (FRAME_), \ + ( \ + "trylevel %p => %s", \ + (TRYLEVEL_), \ + _SEH_FILTER_RET_STRING_(RET_) \ + ) \ + ); \ + } \ +} + +#define _SEH_TRACE_ENTER_CALL_HANDLER(FRAME_, TRYLEVEL_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CALL_HANDLER) \ + { \ + _SEH_TRACE_LINE_((FRAME_), ("trylevel %p, handling", (TRYLEVEL_))); \ + } \ +} + +#define _SEH_TRACE_ENTER_CALL_FINALLY(FRAME_, TRYLEVEL_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CALL_FINALLY) \ + { \ + _SEH_TRACE_LINE_ \ + ( \ + (FRAME_), \ + ( \ + "trylevel %p, calling exit routine %p", \ + (TRYLEVEL_), \ + (TRYLEVEL_)->SPT_Handlers->SH_Finally \ + ) \ + ); \ + } \ +} + +#define _SEH_TRACE_LEAVE_CALL_FINALLY(FRAME_, TRYLEVEL_) \ +{ \ + if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CALL_FINALLY) \ + { \ + _SEH_TRACE_LINE_ \ + ( \ + (FRAME_), \ + ( \ + "trylevel %p, exit routine %p returned", \ + (TRYLEVEL_), \ + (TRYLEVEL_)->SPT_Handlers->SH_Finally \ + ) \ + ); \ + } \ +} + +#else +#define _SEH_TRACE_ENTER(FRAME_, FUNCNAME_, ARGS_) +#define _SEH_TRACE_LEAVE(FRAME_, FUNCNAME_, ARGS_) +#define _SEH_TRACE_EXCEPTION_RECORD(FRAME_, ER_) +#define _SEH_TRACE_CONTEXT(FRAME_, CONTEXT_) +#define _SEH_TRACE_UNWIND(FRAME_, ARGS_) +#define _SEH_TRACE_TRYLEVEL(FRAME_, TRYLEVEL_) +#define _SEH_TRACE_ENTER_CALL_FILTER(FRAME_, TRYLEVEL_, ER_) +#define _SEH_TRACE_LEAVE_CALL_FILTER(FRAME_, TRYLEVEL_, RET_) +#define _SEH_TRACE_FILTER(FRAME_, TRYLEVEL_, RET_) +#define _SEH_TRACE_ENTER_CALL_HANDLER(FRAME_, TRYLEVEL_) +#define _SEH_TRACE_ENTER_CALL_FINALLY(FRAME_, TRYLEVEL_) +#define _SEH_TRACE_LEAVE_CALL_FINALLY(FRAME_, TRYLEVEL_) +#endif + /* Assembly helpers, see i386/framebased.asm */ extern void __cdecl _SEHCleanHandlerEnvironment(void); extern struct __SEHRegistration * __cdecl _SEHRegisterFrame(_SEHRegistration_t *); @@ -49,6 +291,8 @@ ) { _SEHPortableTryLevel_t * trylevel; + + _SEH_TRACE_UNWIND(frame, ("enter local unwind from %p to %p", frame->SPF_TopTryLevel, dsttrylevel)); for ( @@ -64,8 +308,14 @@ pfnFinally = trylevel->SPT_Handlers->SH_Finally; if(pfnFinally) + { + _SEH_TRACE_ENTER_CALL_FINALLY(frame, trylevel); pfnFinally(frame); + _SEH_TRACE_LEAVE_CALL_FINALLY(frame, trylevel); + } } + + _SEH_TRACE_UNWIND(frame, ("leave local unwind from %p to %p", frame->SPF_TopTryLevel, dsttrylevel)); } static void __cdecl _SEHCallHandler @@ -76,7 +326,9 @@ { _SEHGlobalUnwind(frame); _SEHLocalUnwind(frame, trylevel); + _SEH_TRACE_ENTER_CALL_HANDLER(frame, trylevel); frame->SPF_Handler(trylevel); + /* ASSERT(0); */ } static int __cdecl _SEHFrameHandler @@ -93,9 +345,29 @@ frame = EstablisherFrame; + _SEH_TRACE_ENTER + ( + frame, + "_SEHFrameHandler", + ( + "%p, %p, %p, %p", + ExceptionRecord, + EstablisherFrame, + ContextRecord, + DispatcherContext + ) + ); + + _SEH_TRACE_EXCEPTION_RECORD(frame, ExceptionRecord); + _SEH_TRACE_CONTEXT(frame, ContextRecord); + /* Unwinding */ if(ExceptionRecord->ExceptionFlags & (4 | 2)) + { + _SEH_TRACE_UNWIND(frame, ("enter forced unwind")); _SEHLocalUnwind(frame, NULL); + _SEH_TRACE_UNWIND(frame, ("leave forced unwind")); + } /* Handling */ else { @@ -115,6 +387,8 @@ ) { _SEHFilter_t pfnFilter = trylevel->SPT_Handlers->SH_Filter; + + _SEH_TRACE_TRYLEVEL(frame, trylevel); switch((UINT_PTR)pfnFilter) { @@ -135,7 +409,9 @@ ep.ExceptionRecord = ExceptionRecord; ep.ContextRecord = ContextRecord; + _SEH_TRACE_ENTER_CALL_FILTER(frame, trylevel, ExceptionRecord); ret = pfnFilter(&ep, frame); + _SEH_TRACE_LEAVE_CALL_FILTER(frame, trylevel, ret); } else ret = _SEH_CONTINUE_SEARCH; @@ -144,9 +420,14 @@ } } + _SEH_TRACE_FILTER(frame, trylevel, ret); + /* _SEH_CONTINUE_EXECUTION */ if(ret < 0) + { + _SEH_TRACE_LEAVE(frame, "_SEHFrameHandler", ("ExceptionContinueExecution")); return ExceptionContinueExecution; + } /* _SEH_EXECUTE_HANDLER */ else if(ret > 0) _SEHCallHandler(frame, trylevel); @@ -158,6 +439,7 @@ /* FALLTHROUGH */ } + _SEH_TRACE_LEAVE(frame, "_SEHFrameHandler", ("ExceptionContinueSearch")); return ExceptionContinueSearch; }
17 years, 9 months
1
0
0
0
[greatlrd] 25914: merge pseh changes from 25908 and 25909 add hto patch from bugzila 2069, this need be review by kjk, but I add it to 0.3.1, it solv the loop problem I got with pseh.
by greatlrd@svn.reactos.org
Author: greatlrd Date: Wed Feb 28 01:18:28 2007 New Revision: 25914 URL:
http://svn.reactos.org/svn/reactos?rev=25914&view=rev
Log: merge pseh changes from 25908 and 25909 add hto patch from bugzila 2069, this need be review by kjk, but I add it to 0.3.1, it solv the loop problem I got with pseh. Removed: branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/native.h branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/prettybased.h Modified: branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/excpt.h branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/framebased.h branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/framebased/internal.h branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/pseh.h branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/setjmp.h branches/ros-branch-0_3_1/reactos/lib/pseh/framebased.c branches/ros-branch-0_3_1/reactos/lib/pseh/i386/framebased.asm branches/ros-branch-0_3_1/reactos/lib/pseh/i386/setjmp.asm Modified: branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/excpt.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/includ…
============================================================================== --- branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/excpt.h (original) +++ branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/excpt.h Wed Feb 28 01:18:28 2007 @@ -1,23 +1,23 @@ /* - Copyright (c) 2004/2005 KJK::Hyperion - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. + Copyright (c) 2004/2005 KJK::Hyperion + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. */ #ifndef KJK_PSEH_EXCPT_H_ Modified: branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/framebased.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/includ…
============================================================================== --- branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/framebased.h (original) +++ branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/framebased.h Wed Feb 28 01:18:28 2007 @@ -1,23 +1,23 @@ /* - Copyright (c) 2004/2005 KJK::Hyperion - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. + Copyright (c) 2004/2005 KJK::Hyperion + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. */ #ifndef KJK_PSEH_FRAMEBASED_H_ @@ -27,47 +27,47 @@ #include <pseh/excpt.h> #ifndef offsetof -# include <stddef.h> +# include <stddef.h> #endif /* - Fall back to non-optimal, non-native NLG implementation for environments - without their own (e.g., currently, kernel-mode ReactOS/Windows). THIS IS NOT - RECOMMENDED AND IT WILL BE DROPPED IN A FUTURE VERSION BECAUSE IT MAY CAUSE - SEVERE STACK CORRUPTION. REIMPLEMENT OR PORT YOUR COMPILER'S NATIVE NLG - IMPLEMENTATION INSTEAD. + Fall back to non-optimal, non-native NLG implementation for environments + without their own (e.g., currently, kernel-mode ReactOS/Windows). THIS IS NOT + RECOMMENDED AND IT WILL BE DROPPED IN A FUTURE VERSION BECAUSE IT MAY CAUSE + SEVERE STACK CORRUPTION. REIMPLEMENT OR PORT YOUR COMPILER'S NATIVE NLG + IMPLEMENTATION INSTEAD. */ #ifdef _SEH_NO_NATIVE_NLG -# include <pseh/setjmp.h> +# include <pseh/setjmp.h> #else -# include <setjmp.h> -# define _SEHLongJmp longjmp -# define _SEHSetJmp setjmp -# define _SEHJmpBuf_t jmp_buf -#endif -unsigned long DbgPrint(const char * Format,...); +# include <setjmp.h> +# define _SEHLongJmp longjmp +# define _SEHSetJmp setjmp +# define _SEHJmpBuf_t jmp_buf +#endif + typedef struct __SEHFrame { - _SEHPortableFrame_t SEH_Header; - void * SEH_Locals; + _SEHPortableFrame_t SEH_Header; + void * SEH_Locals; } _SEHFrame_t; typedef struct __SEHTryLevel { - _SEHPortableTryLevel_t ST_Header; - _SEHJmpBuf_t ST_JmpBuf; + _SEHPortableTryLevel_t ST_Header; + _SEHJmpBuf_t ST_JmpBuf; } _SEHTryLevel_t; static __declspec(noreturn) __inline void __stdcall _SEHCompilerSpecificHandler ( - _SEHPortableTryLevel_t * trylevel + _SEHPortableTryLevel_t * trylevel ) { - _SEHTryLevel_t * mytrylevel; - mytrylevel = _SEH_CONTAINING_RECORD(trylevel, _SEHTryLevel_t, ST_Header); - _SEHLongJmp(mytrylevel->ST_JmpBuf, 1); + _SEHTryLevel_t * mytrylevel; + mytrylevel = _SEH_CONTAINING_RECORD(trylevel, _SEHTryLevel_t, ST_Header); + _SEHLongJmp(mytrylevel->ST_JmpBuf, 1); } static const int _SEHScopeKind = 1; @@ -76,14 +76,14 @@ /* SHARED LOCALS */ /* Access the locals for the current frame */ #define _SEH_ACCESS_LOCALS(LOCALS_) \ - _SEH_LOCALS_TYPENAME(LOCALS_) * _SEHPLocals; \ - _SEHPLocals = \ - _SEH_PVOID_CAST \ - ( \ - _SEH_LOCALS_TYPENAME(LOCALS_) *, \ - _SEH_CONTAINING_RECORD(_SEHPortableFrame, _SEHFrame_t, SEH_Header) \ - ->SEH_Locals \ - ); + _SEH_LOCALS_TYPENAME(LOCALS_) * _SEHPLocals; \ + _SEHPLocals = \ + _SEH_PVOID_CAST \ + ( \ + _SEH_LOCALS_TYPENAME(LOCALS_) *, \ + _SEH_CONTAINING_RECORD(_SEHPortableFrame, _SEHFrame_t, SEH_Header) \ + ->SEH_Locals \ + ); /* Access local variable VAR_ */ #define _SEH_VAR(VAR_) _SEHPLocals->VAR_ @@ -91,292 +91,266 @@ /* FILTER FUNCTIONS */ /* Declares a filter function's prototype */ #define _SEH_FILTER(NAME_) \ - long __stdcall NAME_ \ - ( \ - struct _EXCEPTION_POINTERS * _SEHExceptionPointers, \ - struct __SEHPortableFrame * _SEHPortableFrame \ - ) + long __stdcall NAME_ \ + ( \ + struct _EXCEPTION_POINTERS * _SEHExceptionPointers, \ + struct __SEHPortableFrame * _SEHPortableFrame \ + ) /* Declares a static filter */ #define _SEH_STATIC_FILTER(ACTION_) ((_SEHFilter_t)((ACTION_) + 2)) /* Declares a PSEH filter wrapping a regular filter function */ #define _SEH_WRAP_FILTER(WRAPPER_, NAME_) \ - static __inline _SEH_FILTER(WRAPPER_) \ - { \ - return (NAME_)(_SEHExceptionPointers); \ - } + static __inline _SEH_FILTER(WRAPPER_) \ + { \ + return (NAME_)(_SEHExceptionPointers); \ + } /* FINALLY FUNCTIONS */ /* Declares a finally function's prototype */ #define _SEH_FINALLYFUNC(NAME_) \ - void __stdcall NAME_ \ - ( \ - struct __SEHPortableFrame * _SEHPortableFrame \ - ) + void __stdcall NAME_ \ + ( \ + struct __SEHPortableFrame * _SEHPortableFrame \ + ) /* Declares a PSEH finally function wrapping a regular function */ #define _SEH_WRAP_FINALLY(WRAPPER_, NAME_) \ - _SEH_WRAP_FINALLY_ARGS(WRAPPER_, NAME_, ()) + _SEH_WRAP_FINALLY_ARGS(WRAPPER_, NAME_, ()) #define _SEH_WRAP_FINALLY_ARGS(WRAPPER_, NAME_, ARGS_) \ - static __inline _SEH_FINALLYFUNC(WRAPPER_) \ - { \ - NAME_ ARGS_; \ - } + static __inline _SEH_FINALLYFUNC(WRAPPER_) \ + { \ + NAME_ ARGS_; \ + } #define _SEH_WRAP_FINALLY_LOCALS_ARGS(WRAPPER_, LOCALS_, NAME_, ARGS_) \ - static __inline _SEH_FINALLYFUNC(WRAPPER_) \ - { \ - _SEH_ACCESS_LOCALS(LOCALS_); \ - NAME_ ARGS_; \ - } + static __inline _SEH_FINALLYFUNC(WRAPPER_) \ + { \ + _SEH_ACCESS_LOCALS(LOCALS_); \ + NAME_ ARGS_; \ + } /* SAFE BLOCKS */ #define _SEHX_TRY_FINALLY(FINALLY_) \ - _SEH_TRY_FILTER_FINALLY \ - ( \ - _SEH_STATIC_FILTER(_SEH_CONTINUE_SEARCH), \ - (FINALLY_) \ - ) + _SEH_TRY_FILTER_FINALLY \ + ( \ + _SEH_STATIC_FILTER(_SEH_CONTINUE_SEARCH), \ + (FINALLY_) \ + ) #define _SEHX_END_FINALLY _SEH_HANDLE _SEH_END #define _SEHX_TRY_FILTER(FILTER_) \ - _SEH_TRY_FILTER_FINALLY((FILTER_), 0) + _SEH_TRY_FILTER_FINALLY((FILTER_), 0) #define _SEHX_TRY_HANDLE_FINALLY(FINALLY_) \ - _SEH_TRY_FILTER_FINALLY \ - ( \ - _SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER), \ - (FINALLY_) \ - ) + _SEH_TRY_FILTER_FINALLY \ + ( \ + _SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER), \ + (FINALLY_) \ + ) #define _SEHX_TRY \ - _SEH_TRY_HANDLE_FINALLY(0) + _SEH_TRY_HANDLE_FINALLY(0) #ifdef __cplusplus -# define _SEH_DECLARE_HANDLERS(FILTER_, FINALLY_) \ - static const _SEHHandlers_t _SEHHandlers = { (FILTER_), (FINALLY_) }; +# define _SEH_DECLARE_HANDLERS(FILTER_, FINALLY_) \ + static const _SEHHandlers_t _SEHHandlers = { (FILTER_), (FINALLY_) }; #else -# define _SEH_DECLARE_HANDLERS(FILTER_, FINALLY_) \ - _SEHHandlers_t _SEHHandlers = { (0), (0) }; \ - _SEHHandlers.SH_Filter = (FILTER_); \ - _SEHHandlers.SH_Finally = (FINALLY_); +# define _SEH_DECLARE_HANDLERS(FILTER_, FINALLY_) \ + _SEHHandlers_t _SEHHandlers = { (0), (0) }; \ + _SEHHandlers.SH_Filter = (FILTER_); \ + _SEHHandlers.SH_Finally = (FINALLY_); #endif #define _SEHX_TRY_FILTER_FINALLY(FILTER_, FINALLY_) \ - { \ - _SEHPortableFrame_t * const _SEHCurPortableFrame = _SEHPortableFrame; \ - \ - { \ - _SEHFrame_t _SEHFrame; \ - _SEHTryLevel_t _SEHTryLevel; \ - _SEHPortableFrame_t * const _SEHPortableFrame = \ - _SEHScopeKind ? &_SEHFrame.SEH_Header : _SEHCurPortableFrame; \ - \ - (void)_SEHPortableFrame; \ - \ - _SEH_DECLARE_HANDLERS((FILTER_), (FINALLY_)); \ - \ - _SEHTryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ - \ - if(_SEHScopeKind) \ - { \ - if(&_SEHLocals != _SEHDummyLocals) \ - _SEHFrame.SEH_Locals = &_SEHLocals; \ - \ - _SEHFrame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \ - _SEHEnterFrame(&_SEHFrame.SEH_Header, &_SEHTryLevel.ST_Header); \ - } \ - else \ - _SEHEnterTry(&_SEHTryLevel.ST_Header); \ - \ - { \ - static const int _SEHScopeKind = 0; \ - (void)_SEHScopeKind; \ - \ - if(_SEHSetJmp(_SEHTryLevel.ST_JmpBuf) == 0) \ - { \ - for(;;) \ - { + { \ + _SEHPortableFrame_t * const _SEHCurPortableFrame = _SEHPortableFrame; \ + \ + { \ + _SEHFrame_t _SEHFrame; \ + _SEHTryLevel_t _SEHTryLevel; \ + _SEHPortableFrame_t * const _SEHPortableFrame = \ + _SEHScopeKind ? &_SEHFrame.SEH_Header : _SEHCurPortableFrame; \ + \ + (void)_SEHPortableFrame; \ + \ + _SEH_DECLARE_HANDLERS((FILTER_), (FINALLY_)); \ + \ + _SEHTryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ + \ + if(_SEHScopeKind) \ + { \ + if(&_SEHLocals != _SEHDummyLocals) \ + _SEHFrame.SEH_Locals = &_SEHLocals; \ + \ + _SEHFrame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \ + _SEHEnterFrame(&_SEHFrame.SEH_Header, &_SEHTryLevel.ST_Header); \ + } \ + else \ + _SEHEnterTry(&_SEHTryLevel.ST_Header); \ + \ + { \ + static const int _SEHScopeKind = 0; \ + (void)_SEHScopeKind; \ + \ + if(_SEHSetJmp(_SEHTryLevel.ST_JmpBuf) == 0) \ + { \ + for(;;) \ + { #define _SEHX_HANDLE \ - \ - break; \ - } \ - \ - _SEHLeave(); \ - } \ - else \ - { \ - _SEHLeave(); + \ + break; \ + } \ + \ + _SEHLeave(); \ + } \ + else \ + { \ + _SEHLeave(); #define _SEHX_END \ - } \ - \ - if(_SEHHandlers.SH_Finally) \ - _SEHHandlers.SH_Finally(_SEHPortableFrame); \ - } \ - } \ - } + } \ + \ + if(_SEHHandlers.SH_Finally) \ + _SEHHandlers.SH_Finally(_SEHPortableFrame); \ + } \ + } \ + } #define _SEHX_LEAVE break #define _SEHX_GetExceptionCode() (unsigned long)(_SEHPortableFrame->SPF_Code) #define _SEHX_GetExceptionPointers() \ - ((struct _EXCEPTION_POINTERS *)_SEHExceptionPointers) + ((struct _EXCEPTION_POINTERS *)_SEHExceptionPointers) #define _SEHX_AbnormalTermination() (_SEHPortableFrame->SPF_Code != 0) /* New syntax */ -/* - NOTE: do not move, remove or modify any instance of _SEH2_ASSUME and - _SEH2_ASSUMING without doing extensive tests for correctness. Compilers can - generate the wrong code in presence of __assume in unpredictable ways. BE SURE - IT DOESN'T HAPPEN -*/ -#if defined(_MSC_VER) && (_MSC_VER > 1200) -# define _SEH2_ASSUME(X_) __assume(X_) -# if !defined(_SEH_NO_NATIVE_NLG) - /* - If we use the native setjmp, the compiler stops keeping track of variables, so - their actual values don't matter anymore. Optimize out some assignments - */ -# define _SEH2_ASSUMING(X_) -# else - /* No native setjmp, no magic, no assumptions. Actually set the values */ -# define _SEH2_ASSUMING(X_) X_ -# endif +#ifdef __cplusplus +# define _SEH2_INIT_CONST static const #else -# define _SEH2_ASSUME(X_) -# define _SEH2_ASSUMING(X_) X_ -#endif - -#ifdef __cplusplus -# define _SEH2_INIT_CONST static const -#else -# define _SEH2_INIT_CONST register const +# define _SEH2_INIT_CONST register const #endif #define _SEH_LEAVE break #define _SEH_TRY \ - { \ - _SEH2_INIT_CONST int _SEH2TopTryLevel = (_SEHScopeKind != 0); \ - _SEHPortableFrame_t * const _SEH2CurPortableFrame = _SEHPortableFrame; \ - \ - { \ - static const int _SEHScopeKind = 0; \ - register int _SEH2State = 0; \ - register int _SEH2Handle = 0; \ - _SEHFrame_t _SEH2Frame; \ - _SEHTryLevel_t _SEH2TryLevel; \ - _SEHPortableFrame_t * const _SEHPortableFrame = \ - _SEH2TopTryLevel ? &_SEH2Frame.SEH_Header : _SEH2CurPortableFrame; \ - \ - (void)_SEHScopeKind; \ - (void)_SEHPortableFrame; \ - (void)_SEH2Handle; \ - \ - for(;;) \ - { \ - if(_SEH2State) \ - { \ - for(;;) \ - { \ - { + { \ + _SEH2_INIT_CONST int _SEH2TopTryLevel = (_SEHScopeKind != 0); \ + _SEHPortableFrame_t * const _SEH2CurPortableFrame = _SEHPortableFrame; \ + \ + { \ + static const int _SEHScopeKind = 0; \ + register int _SEH2State = 0; \ + register int _SEH2Handle = 0; \ + _SEHFrame_t _SEH2Frame; \ + _SEHTryLevel_t _SEH2TryLevel; \ + _SEHPortableFrame_t * const _SEHPortableFrame = \ + _SEH2TopTryLevel ? &_SEH2Frame.SEH_Header : _SEH2CurPortableFrame; \ + \ + (void)_SEHScopeKind; \ + (void)_SEHPortableFrame; \ + (void)_SEH2Handle; \ + \ + for(;;) \ + { \ + if(_SEH2State) \ + { \ + for(;;) \ + { \ + { #define _SEH_EXCEPT(FILTER_) \ - } \ - \ - break; \ - } \ - \ - _SEH2_ASSUME(_SEH2Handle == 0); \ - break; \ - } \ - else \ - { \ - _SEH_DECLARE_HANDLERS((FILTER_), 0); \ - \ - _SEH2TryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ - \ - if(_SEH2TopTryLevel) \ - { \ - if(&_SEHLocals != _SEHDummyLocals) \ - _SEH2Frame.SEH_Locals = &_SEHLocals; \ - \ - _SEH2Frame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \ - _SEHEnterFrame(&_SEH2Frame.SEH_Header, &_SEH2TryLevel.ST_Header); \ - } \ - else \ - _SEHEnterTry(&_SEH2TryLevel.ST_Header); \ - \ - if((_SEH2Handle = _SEHSetJmp(_SEH2TryLevel.ST_JmpBuf)) == 0) \ - { \ - _SEH2_ASSUMING(++ _SEH2State); \ - _SEH2_ASSUME(_SEH2State != 0); \ - continue; \ - } \ - else \ - { \ - break; \ - } \ - } \ - \ - break; \ - } \ - \ - _SEHLeave(); \ - \ - if(_SEH2Handle) \ - { + } \ + \ + break; \ + } \ + \ + break; \ + } \ + else \ + { \ + _SEH_DECLARE_HANDLERS((FILTER_), 0); \ + \ + _SEH2TryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ + \ + if(_SEH2TopTryLevel) \ + { \ + if(&_SEHLocals != _SEHDummyLocals) \ + _SEH2Frame.SEH_Locals = &_SEHLocals; \ + \ + _SEH2Frame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \ + _SEHEnterFrame(&_SEH2Frame.SEH_Header, &_SEH2TryLevel.ST_Header); \ + } \ + else \ + _SEHEnterTry(&_SEH2TryLevel.ST_Header); \ + \ + if((_SEH2Handle = _SEHSetJmp(_SEH2TryLevel.ST_JmpBuf)) == 0) \ + { \ + _SEH2State++; \ + continue; \ + } \ + else \ + { \ + break; \ + } \ + } \ + \ + break; \ + } \ + \ + _SEHLeave(); \ + \ + if(_SEH2Handle) \ + { #define _SEH_FINALLY(FINALLY_) \ - } \ - \ - break; \ - } \ - \ - _SEHLeave(); \ - break; \ - } \ - else \ - { \ - _SEH_DECLARE_HANDLERS(0, (FINALLY_)); \ - \ - _SEH2TryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ - \ - if(_SEH2TopTryLevel) \ - { \ - if(&_SEHLocals != _SEHDummyLocals) \ - _SEH2Frame.SEH_Locals = &_SEHLocals; \ - \ - _SEH2Frame.SEH_Header.SPF_Handler = 0; \ - _SEHEnterFrame(&_SEH2Frame.SEH_Header, &_SEH2TryLevel.ST_Header); \ - } \ - else \ - _SEHEnterTry(&_SEH2TryLevel.ST_Header); \ - \ - ++ _SEH2State; \ - _SEH2_ASSUME(_SEH2State != 0); \ - continue; \ - } \ - \ - break; \ - } \ - \ - (FINALLY_)(&_SEH2Frame.SEH_Header); \ - if(0) \ - { + } \ + \ + break; \ + } \ + \ + _SEHLeave(); \ + break; \ + } \ + else \ + { \ + _SEH_DECLARE_HANDLERS(0, (FINALLY_)); \ + \ + _SEH2TryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ + \ + if(_SEH2TopTryLevel) \ + { \ + if(&_SEHLocals != _SEHDummyLocals) \ + _SEH2Frame.SEH_Locals = &_SEHLocals; \ + \ + _SEH2Frame.SEH_Header.SPF_Handler = 0; \ + _SEHEnterFrame(&_SEH2Frame.SEH_Header, &_SEH2TryLevel.ST_Header); \ + } \ + else \ + _SEHEnterTry(&_SEH2TryLevel.ST_Header); \ + \ + ++ _SEH2State; \ + continue; \ + } \ + \ + break; \ + } \ + \ + (FINALLY_)(&_SEH2Frame.SEH_Header); \ + if(0) \ + { #define _SEH_END \ - } \ - } \ - } + } \ + } \ + } #define _SEH_HANDLE _SEH_EXCEPT(_SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER)) Modified: branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/framebased/internal.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/includ…
============================================================================== --- branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/framebased/internal.h (original) +++ branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/framebased/internal.h Wed Feb 28 01:18:28 2007 @@ -1,23 +1,23 @@ /* - Copyright (c) 2004/2005 KJK::Hyperion - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. + Copyright (c) 2004/2005 KJK::Hyperion + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. */ #ifndef KJK_PSEH_FRAMEBASED_INTERNAL_H_ @@ -26,19 +26,19 @@ struct _EXCEPTION_RECORD; struct _EXCEPTION_POINTERS; struct _CONTEXT; - + typedef int (__cdecl * _SEHFrameHandler_t) ( - struct _EXCEPTION_RECORD *, - void *, - struct _CONTEXT *, - void * + struct _EXCEPTION_RECORD *, + void *, + struct _CONTEXT *, + void * ); typedef struct __SEHRegistration { - struct __SEHRegistration * SER_Prev; - _SEHFrameHandler_t SER_Handler; + struct __SEHRegistration * SER_Prev; + _SEHFrameHandler_t SER_Handler; } _SEHRegistration_t; @@ -47,40 +47,40 @@ typedef long (__stdcall * _SEHFilter_t) ( - struct _EXCEPTION_POINTERS *, - struct __SEHPortableFrame * + struct _EXCEPTION_POINTERS *, + struct __SEHPortableFrame * ); typedef void (__stdcall * _SEHHandler_t) ( - struct __SEHPortableTryLevel * + struct __SEHPortableTryLevel * ); typedef void (__stdcall * _SEHFinally_t) ( - struct __SEHPortableFrame * + struct __SEHPortableFrame * ); typedef struct __SEHHandlers { - _SEHFilter_t SH_Filter; - _SEHFinally_t SH_Finally; + _SEHFilter_t SH_Filter; + _SEHFinally_t SH_Finally; } _SEHHandlers_t; typedef struct __SEHPortableTryLevel { - struct __SEHPortableTryLevel * SPT_Next; - const _SEHHandlers_t * SPT_Handlers; + struct __SEHPortableTryLevel * SPT_Next; + const _SEHHandlers_t * SPT_Handlers; } _SEHPortableTryLevel_t; typedef struct __SEHPortableFrame { - _SEHRegistration_t SPF_Registration; - unsigned long SPF_Code; - _SEHHandler_t SPF_Handler; - _SEHPortableTryLevel_t * SPF_TopTryLevel; + _SEHRegistration_t SPF_Registration; + unsigned long SPF_Code; + _SEHHandler_t SPF_Handler; + _SEHPortableTryLevel_t * SPF_TopTryLevel; } _SEHPortableFrame_t; @@ -91,8 +91,8 @@ extern void __stdcall _SEHEnterFrame_s ( - _SEHPortableFrame_t *, - _SEHPortableTryLevel_t * + _SEHPortableFrame_t *, + _SEHPortableTryLevel_t * ); extern void __stdcall _SEHEnterTry_s(_SEHPortableTryLevel_t *); @@ -107,8 +107,8 @@ extern void _SEH_FASTCALL _SEHEnterFrame_f ( - _SEHPortableFrame_t *, - _SEHPortableTryLevel_t * + _SEHPortableFrame_t *, + _SEHPortableTryLevel_t * ); extern void _SEH_FASTCALL _SEHEnterTry_f(_SEHPortableTryLevel_t *); Removed: branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/native.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/includ…
============================================================================== --- branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/native.h (original) +++ branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/native.h (removed) @@ -1,242 +1,0 @@ -/* - Copyright (c) 2004/2005 KJK::Hyperion - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -#ifndef KJK_PSEH_NATIVE_H_ -#define KJK_PSEH_NATIVE_H_ - -#include <excpt.h> -#include <pseh/excpt.h> - -/* - Note: just define __inline to an empty symbol if your C compiler doesn't - support it -*/ -#ifdef __cplusplus -# ifndef __inline -# define __inline inline -# endif -#endif - -typedef long (__stdcall * _SEHFilter_t) -( - long, - struct _EXCEPTION_POINTERS *, - void * -); - -typedef void (__stdcall * _SEHFinally_t) -( - int, - void * -); - -static __inline long _SEHCallFilter -( - _SEHFilter_t _SEHFilter, - long _SEHExceptionCode, - struct _EXCEPTION_POINTERS * _SEHExceptionPointers, - void * _SEHPVLocals -) -{ - if(_SEHFilter == _SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER)) - return _SEH_EXECUTE_HANDLER; - else if(_SEHFilter == _SEH_STATIC_FILTER(_SEH_CONTINUE_SEARCH)) - return _SEH_CONTINUE_SEARCH; - else if(_SEHFilter == _SEH_STATIC_FILTER(_SEH_CONTINUE_EXECUTION)) - return _SEH_CONTINUE_EXECUTION; - else if(_SEHFilter) - return _SEHFilter(_SEHExceptionCode, _SEHExceptionPointers, _SEHPVLocals); - else - return _SEH_CONTINUE_SEARCH; -} - -static __inline void _SEHCallFinally -( - _SEHFinally_t _SEHFinally, - int _SEHAbnormalTermination, - void * _SEHPVLocals -) -{ - if(_SEHFinally) - (_SEHFinally)(_SEHAbnormalTermination, _SEHPVLocals); -} - -/* SHARED LOCALS */ -/* Access the locals for the current frame */ -#define _SEH_ACCESS_LOCALS(LOCALS_) \ - _SEH_LOCALS_TYPENAME(LOCALS_) * _SEHPLocals; \ - _SEHPLocals = _SEH_PVOID_CAST(_SEH_LOCALS_TYPENAME(LOCALS_) *, _SEHPVLocals); - -/* Access local variable VAR_ */ -#define _SEH_VAR(VAR_) _SEHPLocals->VAR_ - -/* FILTER FUNCTIONS */ -/* Declares a filter function's prototype */ -#define _SEH_FILTER(NAME_) \ - long __stdcall NAME_ \ - ( \ - long _SEHExceptionCode, \ - struct _EXCEPTION_POINTERS * _SEHExceptionPointers, \ - void * _SEHPVLocals \ - ) - -/* Declares a static filter */ -#define _SEH_STATIC_FILTER(ACTION_) ((_SEHFilter_t)((ACTION_) + 2)) - -/* Declares a PSEH filter wrapping a regular filter function */ -#define _SEH_WRAP_FILTER(WRAPPER_, NAME_) \ - static __inline _SEH_FILTER(WRAPPER_) \ - { \ - return (NAME_)(_SEHExceptionPointers); \ - } - -/* FINALLY FUNCTIONS */ -/* Declares a finally function's prototype */ -#define _SEH_FINALLYFUNC(NAME_) \ - void __stdcall NAME_ \ - ( \ - int _SEHAbnormalTermination, \ - void * _SEHPVLocals \ - ) - -/* Declares a PSEH finally function wrapping a regular function */ -#define _SEH_WRAP_FINALLY(WRAPPER_, NAME_) \ - _SEH_WRAP_FINALLY_ARGS(WRAPPER_, NAME_, ()) - -#define _SEH_WRAP_FINALLY_ARGS(WRAPPER_, NAME_, ARGS_) \ - static __inline _SEH_FINALLYFUNC(WRAPPER_) \ - { \ - NAME_ ARGS_; \ - } - -#define _SEH_WRAP_FINALLY_LOCALS_ARGS(WRAPPER_, LOCALS_, NAME_, ARGS_) \ - static __inline _SEH_FINALLYFUNC(WRAPPER_) \ - { \ - _SEH_ACCESS_LOCALS(LOCALS_); \ - NAME_ ARGS_; \ - } - -/* SAFE BLOCKS */ -#define _SEH_TRY_FINALLY(FINALLY_) \ - _SEH_TRY_FILTER_FINALLY \ - ( \ - _SEH_STATIC_FILTER(_SEH_CONTINUE_SEARCH), \ - (FINALLY_) \ - ) - -#define _SEH_END_FINALLY _SEH_HANDLE _SEH_END - -#define _SEH_TRY_FILTER(FILTER_) \ - _SEH_TRY_FILTER_FINALLY((FILTER_), NULL) - -#define _SEH_TRY_HANDLE_FINALLY(FINALLY_) \ - _SEH_TRY_FILTER_FINALLY \ - ( \ - _SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER), \ - (FINALLY_) \ - ) - -#define _SEH_TRY \ - _SEH_TRY_HANDLE_FINALLY(NULL) - -#define _SEH_CALL_FILTER(FILTER_) \ - _SEHCallFilter \ - ( \ - (FILTER_), \ - GetExceptionCode(), \ - GetExceptionPointers(), \ - _SEHPVLocals \ - ) - -#define _SEH_CALL_FINALLY(FINALLY_) \ - _SEHCallFinally((FINALLY_), (AbnormalTermination() != 0), _SEHPVLocals) - -#define _SEH_TRY_FILTER_FINALLY(FILTER_, FINALLY_) \ - __try \ - { \ - _SEHFinally_t _SEHFinally = (FINALLY_); \ - _SEHFilter_t _SEHFilter = (FILTER_); \ - void * _SEHPVLocals = &_SEHLocals; \ - (void)_SEHPVLocals; \ - \ - __try \ - { - -#define _SEH_HANDLE \ - } \ - __except(_SEH_CALL_FILTER(_SEHFilter)) \ - { \ - struct _EXCEPTION_POINTERS * _SEHExceptionPointers = GetExceptionPointers();\ - long _SEHExceptionCode = GetExceptionCode(); \ - -#define _SEH_END \ - } \ - } \ - __finally \ - { \ - _SEH_CALL_FINALLY(_SEHFinally); \ - } - -#define _SEH_LEAVE __leave - -#define _SEH_GetExceptionCode() (_SEHExceptionCode) -#define _SEH_GetExceptionPointers() (_SEHExceptionPointers) -#define _SEH_AbnormalTermination() (_SEHAbnormalTermination) - -/* New syntax */ - -#define _SEH2_TRY \ - { \ - void * _SEHPVLocals = &_SEHLocals; \ - (void)_SEHPVLocals; \ - \ - __try \ - { - -#define _SEH2_EXCEPT(FILTER_) \ - } \ - __except(_SEH_CALL_FILTER(FILTER_)) \ - { \ - struct _EXCEPTION_POINTERS * _SEHExceptionPointers = GetExceptionPointers();\ - long _SEHExceptionCode = GetExceptionCode(); \ - -#define _SEH2_FINALLY(FINALLY_) \ - } \ - __finally \ - { \ - _SEH_CALL_FINALLY(FINALLY_) - -#define _SEH2_END \ - } \ - } - -#define _SEH2_HANDLE _SEH2_EXCEPT(_SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER)) - -#define _SEH2_LEAVE _SEH_LEAVE - -#define _SEH2_GetExceptionCode _SEH_GetExceptionCode -#define _SEH2_GetExceptionPointers _SEH_GetExceptionPointers -#define _SEH2_AbnormalTermination _SEH_AbnormalTermination - -#endif - -/* EOF */ Removed: branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/prettybased.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/includ…
============================================================================== --- branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/prettybased.h (original) +++ branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/prettybased.h (removed) @@ -1,299 +1,0 @@ -/* - Copyright (c) 2004 KJK::Hyperion - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ -/* -Pretty PSEH - -Made to be macro compatible with ms seh syntax and to be pretty, having the -finally block inline etc. Being pretty is not cheap. PPSEH has more -overhead than PSEH, thou mostly during exception/unwinding. Normal execution -only add the overhead of one setjmp, and only in the try/finally case. -PPSEH is probably much less portable than PSEH also..... - -ALERT!ALERT!ALERT!ALERT!ALERT!ALERT!ALERT!ALERT!ALERT!ALERT!ALERT!ALERT!ALERT! --must always use non-native NLG cause a special version of longjmp (which doesn't -restore esp) is needed - --compiler must use ebp as stack frame pointer, cause the finally block rely -on this to access external variables - --all external variables that are used in the except/finally block MUST be volatile -to prevent variables from being optimized into registers. -See:
http://alphalinux.org/archives/axp-list/1998/February1998/0330.html
- --you can't use return within a try/except/finally block - --you can't use __LEAVE within a (for/do/while) loop. it will only leave the loop -and not the try-block itself - - -USAGE: - -__TRY{ - __LEAVE; -} -__EXCEPT(_SEH_STATIC_FILTER(EXCEPTION_EXECUTE_HANDLER)){ -} -__ENDTRY; - - -__TRY{ -} -__FINALLY{ -} -__ENDTRY; - - -_SEH_FILTER(filter){ - return EXCEPTION_EXECUTE_HANDLER; -} -__TRY2{ -} -__EXCEPT2(filter){ -} -__FINALLY2{ -} -__ENDTRY2; - - - --Gunnar - -*/ - - -#ifndef KJK_PPSEH_FRAMEBASED_H_ -#define KJK_PPSEH_FRAMEBASED_H_ - -#include <pseh/framebased/internal.h> -#include <pseh/excpt.h> -#include <malloc.h> - -#ifndef offsetof -# include <stddef.h> -#endif - -/* -Must always use non-native NLG since we need a special version of longjmp which does -not restore esp -*/ -#include <pseh/setjmp.h> - - -typedef struct __SEHFrame -{ - _SEHPortableFrame_t SEH_Header; - _SEHJmpBuf_t SEH_JmpBuf; - _SEHJmpBuf_t* SEH_JmpRetPtr; -} -_SEHFrame_t; - -/* - Note: just define __inline to an empty symbol if your C compiler doesn't - support it -*/ -#ifdef __cplusplus -# ifndef __inline -# define __inline inline -# endif -#endif - - -/* FILTER FUNCTIONS */ -/* Declares a filter function's prototype */ -#define _SEH_FILTER(NAME_) \ - long __stdcall NAME_ \ - ( \ - struct _EXCEPTION_POINTERS * _SEHExceptionPointers, \ - struct __SEHPortableFrame * _SEHPortableFrame \ - ) - - -/* Declares a static filter */ -#define _SEH_STATIC_FILTER(ACTION_) ((_SEHFilter_t)((ACTION_) + 2)) - - -static __declspec(noreturn) __inline void __stdcall _SEHCompilerSpecificHandler -( - _SEHPortableFrame_t * frame -) -{ - _SEHFrame_t * myframe; - myframe = (_SEHFrame_t *)(((char *)frame) - offsetof(_SEHFrame_t, SEH_Header)); - _SEHLongJmp(myframe->SEH_JmpBuf, 1); -} - - - -void __stdcall _FinallyPretty -( - struct __SEHPortableFrame * frame -) -{ - _SEHFrame_t * myframe; - _SEHJmpBuf_t jmpRetBuf; - - myframe = (_SEHFrame_t *)(((char *)frame) - offsetof(_SEHFrame_t, SEH_Header)); - - if(_SEHSetJmp(jmpRetBuf) == 0) - { - myframe->SEH_JmpRetPtr = &jmpRetBuf; - _SEHLongJmp_KeepEsp(myframe->SEH_JmpBuf, 2); - } -} - - - -#define ___EXCEPT_DUAL(filter) \ - } while(0); \ - \ - _SEHLeave(&_SEHFrame->SEH_Header); \ - } \ - else \ - { \ - _SEHHandlers.SH_Filter = (filter); \ - _SEHHandlers.SH_Finally = _FinallyPretty; \ - \ - if(_loop == 2 || (_ret = _SEHSetJmp(_SEHFrame->SEH_JmpBuf))) \ - { \ - if (_ret == 1) \ - { \ - _SEHLeave(&_SEHFrame->SEH_Header); \ - do \ - { - - - -#define ___FINALLY_DUAL \ - } while (0); \ - } \ - \ - do \ - { - - - -#define ___EXCEPT_SINGLE(filter) \ - } while(0); \ - \ - _SEHLeave(&_SEHFrame->SEH_Header); \ - break; \ - } \ - else \ - { \ - _SEHHandlers.SH_Filter = (filter); \ - _SEHHandlers.SH_Finally = (NULL); \ - \ - if(_SEHSetJmp(_SEHFrame->SEH_JmpBuf)) \ - { \ - _SEHLeave(&_SEHFrame->SEH_Header); \ - do \ - { - - - -#define ___TRY \ - do \ - { \ - int _loop =0; int _ret = 0; \ - static _SEHHandlers_t _SEHHandlers = \ - { \ - (NULL), \ - _SEHCompilerSpecificHandler, \ - (NULL) \ - }; \ - \ - _SEHFrame_t * _SEHFrame; \ - volatile _SEHPortableFrame_t * _SEHPortableFrame; \ - \ - _SEHFrame = _alloca(sizeof(_SEHFrame_t)); \ - _SEHFrame->SEH_Header.SPF_Handlers = &_SEHHandlers; \ - \ - _SEHPortableFrame = &_SEHFrame->SEH_Header; \ - (void)_SEHPortableFrame; \ - \ - for(;;_loop++) \ - if (_loop == 1) \ - { \ - _SEHEnter(&_SEHFrame->SEH_Header); \ - \ - do \ - { - - -#define ___FINALLY_SINGLE \ - } while(0); \ - \ - _SEHLeave(&_SEHFrame->SEH_Header); \ - } \ - else \ - { \ - _SEHHandlers.SH_Filter = _SEH_STATIC_FILTER(_SEH_CONTINUE_SEARCH); \ - _SEHHandlers.SH_Finally = _FinallyPretty; \ - \ - if(_loop == 2 || (_ret = _SEHSetJmp(_SEHFrame->SEH_JmpBuf))) \ - { \ - do \ - { - - - -#define ___ENDTRY \ - } while (0); \ - \ - if (_ret == 2) \ - { \ - _SEHLongJmp(*_SEHFrame->SEH_JmpRetPtr, 1); \ - } \ - break; \ - } \ - } \ - } while (0); - - - -#ifdef _MSC_VER - #define __TRY2 __try{__try - #define __EXCEPT2 __except - #define __FINALLY2 }__finally - #define __ENDTRY2 - #define __TRY __try - #define __EXCEPT __except - #define __FINALLY __finally - #define __ENDTRY - #define _SEH_STATIC_FILTER(ACTION_) (ACTION_) - #define __LEAVE __leave - #define __LEAVE2 __leave -#else - #define __TRY2 ___TRY - #define __EXCEPT2 ___EXCEPT_DUAL - #define __FINALLY2 ___FINALLY_DUAL - #define __ENDTRY2 __ENDTRY - #define __TRY ___TRY - #define __EXCEPT ___EXCEPT_SINGLE - #define __FINALLY ___FINALLY_SINGLE - #define __ENDTRY ___ENDTRY - #define __LEAVE break - #define __LEAVE2 break -#endif - - -#endif Modified: branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/pseh.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/includ…
============================================================================== --- branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/pseh.h (original) +++ branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/pseh.h Wed Feb 28 01:18:28 2007 @@ -1,23 +1,23 @@ /* - Copyright (c) 2004/2005 KJK::Hyperion - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. + Copyright (c) 2004/2005 KJK::Hyperion + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. */ #ifndef KJK_PSEH_H_ @@ -25,53 +25,53 @@ /* Some useful macros */ #if defined(__cplusplus) -# define _SEH_PVOID_CAST(TYPE_, P_) ((TYPE_)(P_)) +# define _SEH_PVOID_CAST(TYPE_, P_) ((TYPE_)(P_)) #else -# define _SEH_PVOID_CAST(TYPE_, P_) (P_) +# define _SEH_PVOID_CAST(TYPE_, P_) (P_) #endif #if defined(FIELD_OFFSET) -# define _SEH_FIELD_OFFSET FIELD_OFFSET +# define _SEH_FIELD_OFFSET FIELD_OFFSET #else -# include <stddef.h> -# define _SEH_FIELD_OFFSET offsetof +# include <stddef.h> +# define _SEH_FIELD_OFFSET offsetof #endif #if defined(CONTAINING_RECORD) -# define _SEH_CONTAINING_RECORD CONTAINING_RECORD +# define _SEH_CONTAINING_RECORD CONTAINING_RECORD #else -# define _SEH_CONTAINING_RECORD(ADDR_, TYPE_, FIELD_) \ - ((TYPE_ *)(((char *)(ADDR_)) - _SEH_FIELD_OFFSET(TYPE_, FIELD_))) +# define _SEH_CONTAINING_RECORD(ADDR_, TYPE_, FIELD_) \ + ((TYPE_ *)(((char *)(ADDR_)) - _SEH_FIELD_OFFSET(TYPE_, FIELD_))) #endif #if defined(__CONCAT) -# define _SEH_CONCAT __CONCAT +# define _SEH_CONCAT __CONCAT #else -# define _SEH_CONCAT1(X_, Y_) X_ ## Y_ -# define _SEH_CONCAT(X_, Y_) _SEH_CONCAT1(X_, Y_) +# define _SEH_CONCAT1(X_, Y_) X_ ## Y_ +# define _SEH_CONCAT(X_, Y_) _SEH_CONCAT1(X_, Y_) #endif /* - Note: just define __inline to an empty symbol if your C compiler doesn't - support it + Note: just define __inline to an empty symbol if your C compiler doesn't + support it */ #ifdef __cplusplus -# ifndef __inline -# define __inline inline -# endif +# ifndef __inline +# define __inline inline +# endif #endif /* Locals sharing support */ #define _SEH_LOCALS_TYPENAME(BASENAME_) \ - struct _SEH_CONCAT(_SEHLocalsTag, BASENAME_) + struct _SEH_CONCAT(_SEHLocalsTag, BASENAME_) #define _SEH_DEFINE_LOCALS(BASENAME_) \ - _SEH_LOCALS_TYPENAME(BASENAME_) + _SEH_LOCALS_TYPENAME(BASENAME_) #define _SEH_DECLARE_LOCALS(BASENAME_) \ - _SEH_LOCALS_TYPENAME(BASENAME_) _SEHLocals; \ - _SEH_LOCALS_TYPENAME(BASENAME_) * _SEHPLocals; \ - _SEHPLocals = &_SEHLocals; + _SEH_LOCALS_TYPENAME(BASENAME_) _SEHLocals; \ + _SEH_LOCALS_TYPENAME(BASENAME_) * _SEHPLocals; \ + _SEHPLocals = &_SEHLocals; /* Dummy locals */ static int _SEHLocals; Modified: branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/setjmp.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/includ…
============================================================================== --- branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/setjmp.h (original) +++ branches/ros-branch-0_3_1/reactos/include/reactos/libs/pseh/setjmp.h Wed Feb 28 01:18:28 2007 @@ -1,23 +1,23 @@ /* - Copyright (c) 2004/2005 KJK::Hyperion - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. + Copyright (c) 2004/2005 KJK::Hyperion + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. */ #ifndef KJK_PSEH_SETJMP_H_ @@ -26,12 +26,12 @@ #ifdef _M_IX86 typedef struct __SEHJmpBuf { - unsigned long JB_Ebp; - unsigned long JB_Esp; - unsigned long JB_Eip; - unsigned long JB_Ebx; - unsigned long JB_Esi; - unsigned long JB_Edi; + unsigned long JB_Ebp; + unsigned long JB_Esp; + unsigned long JB_Eip; + unsigned long JB_Ebx; + unsigned long JB_Esi; + unsigned long JB_Edi; } _SEHJmpBuf_t[1]; #endif Modified: branches/ros-branch-0_3_1/reactos/lib/pseh/framebased.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/lib/ps…
============================================================================== --- branches/ros-branch-0_3_1/reactos/lib/pseh/framebased.c (original) +++ branches/ros-branch-0_3_1/reactos/lib/pseh/framebased.c Wed Feb 28 01:18:28 2007 @@ -1,23 +1,23 @@ /* - Copyright (c) 2004 KJK::Hyperion - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. + Copyright (c) 2004/2005 KJK::Hyperion + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. */ #define STRICT @@ -44,194 +44,194 @@ static void __stdcall _SEHLocalUnwind ( - _SEHPortableFrame_t * frame, - _SEHPortableTryLevel_t * dsttrylevel -) -{ - _SEHPortableTryLevel_t * trylevel; - - for - ( - trylevel = frame->SPF_TopTryLevel; - trylevel != dsttrylevel; - trylevel = trylevel->SPT_Next - ) - { - _SEHFinally_t pfnFinally; - - /* ASSERT(trylevel); */ - - pfnFinally = trylevel->SPT_Handlers->SH_Finally; - - if(pfnFinally) - pfnFinally(frame); - } + _SEHPortableFrame_t * frame, + _SEHPortableTryLevel_t * dsttrylevel +) +{ + _SEHPortableTryLevel_t * trylevel; + + for + ( + trylevel = frame->SPF_TopTryLevel; + trylevel != dsttrylevel; + trylevel = trylevel->SPT_Next + ) + { + _SEHFinally_t pfnFinally; + + /* ASSERT(trylevel); */ + + pfnFinally = trylevel->SPT_Handlers->SH_Finally; + + if(pfnFinally) + pfnFinally(frame); + } } static void __cdecl _SEHCallHandler ( - _SEHPortableFrame_t * frame, - _SEHPortableTryLevel_t * trylevel -) -{ - _SEHGlobalUnwind(frame); - _SEHLocalUnwind(frame, trylevel); - frame->SPF_Handler(trylevel); + _SEHPortableFrame_t * frame, + _SEHPortableTryLevel_t * trylevel +) +{ + _SEHGlobalUnwind(frame); + _SEHLocalUnwind(frame, trylevel); + frame->SPF_Handler(trylevel); } static int __cdecl _SEHFrameHandler ( - struct _EXCEPTION_RECORD * ExceptionRecord, - void * EstablisherFrame, - struct _CONTEXT * ContextRecord, - void * DispatcherContext -) -{ - _SEHPortableFrame_t * frame; - - _SEHCleanHandlerEnvironment(); - - frame = EstablisherFrame; - - /* Unwinding */ - if(ExceptionRecord->ExceptionFlags & (4 | 2)) - _SEHLocalUnwind(frame, NULL); - /* Handling */ - else - { - int ret; - _SEHPortableTryLevel_t * trylevel; - - if(ExceptionRecord->ExceptionCode) - frame->SPF_Code = ExceptionRecord->ExceptionCode; - else - frame->SPF_Code = 0xC0000001; - - for - ( - trylevel = frame->SPF_TopTryLevel; - trylevel != NULL; - trylevel = trylevel->SPT_Next - ) - { - _SEHFilter_t pfnFilter = trylevel->SPT_Handlers->SH_Filter; - - switch((UINT_PTR)pfnFilter) - { - case (UINT_PTR)_SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER): - case (UINT_PTR)_SEH_STATIC_FILTER(_SEH_CONTINUE_SEARCH): - case (UINT_PTR)_SEH_STATIC_FILTER(_SEH_CONTINUE_EXECUTION): - { - ret = (int)((UINT_PTR)pfnFilter) - 2; - break; - } - - default: - { - if(trylevel->SPT_Handlers->SH_Filter) - { - EXCEPTION_POINTERS ep; - - ep.ExceptionRecord = ExceptionRecord; - ep.ContextRecord = ContextRecord; - - ret = pfnFilter(&ep, frame); - } - else - ret = _SEH_CONTINUE_SEARCH; - - break; - } - } - - /* _SEH_CONTINUE_EXECUTION */ - if(ret < 0) - return ExceptionContinueExecution; - /* _SEH_EXECUTE_HANDLER */ - else if(ret > 0) - _SEHCallHandler(frame, trylevel); - /* _SEH_CONTINUE_SEARCH */ - else - continue; - } - - /* FALLTHROUGH */ - } - - return ExceptionContinueSearch; + struct _EXCEPTION_RECORD * ExceptionRecord, + void * EstablisherFrame, + struct _CONTEXT * ContextRecord, + void * DispatcherContext +) +{ + _SEHPortableFrame_t * frame; + + _SEHCleanHandlerEnvironment(); + + frame = EstablisherFrame; + + /* Unwinding */ + if(ExceptionRecord->ExceptionFlags & (4 | 2)) + _SEHLocalUnwind(frame, NULL); + /* Handling */ + else + { + int ret; + _SEHPortableTryLevel_t * trylevel; + + if(ExceptionRecord->ExceptionCode) + frame->SPF_Code = ExceptionRecord->ExceptionCode; + else + frame->SPF_Code = 0xC0000001; + + for + ( + trylevel = frame->SPF_TopTryLevel; + trylevel != NULL; + trylevel = trylevel->SPT_Next + ) + { + _SEHFilter_t pfnFilter = trylevel->SPT_Handlers->SH_Filter; + + switch((UINT_PTR)pfnFilter) + { + case (UINT_PTR)_SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER): + case (UINT_PTR)_SEH_STATIC_FILTER(_SEH_CONTINUE_SEARCH): + case (UINT_PTR)_SEH_STATIC_FILTER(_SEH_CONTINUE_EXECUTION): + { + ret = (int)((UINT_PTR)pfnFilter) - 2; + break; + } + + default: + { + if(trylevel->SPT_Handlers->SH_Filter) + { + EXCEPTION_POINTERS ep; + + ep.ExceptionRecord = ExceptionRecord; + ep.ContextRecord = ContextRecord; + + ret = pfnFilter(&ep, frame); + } + else + ret = _SEH_CONTINUE_SEARCH; + + break; + } + } + + /* _SEH_CONTINUE_EXECUTION */ + if(ret < 0) + return ExceptionContinueExecution; + /* _SEH_EXECUTE_HANDLER */ + else if(ret > 0) + _SEHCallHandler(frame, trylevel); + /* _SEH_CONTINUE_SEARCH */ + else + continue; + } + + /* FALLTHROUGH */ + } + + return ExceptionContinueSearch; } void __stdcall _SEHEnterFrame_s ( - _SEHPortableFrame_t * frame, - _SEHPortableTryLevel_t * trylevel -) -{ - _SEHEnterFrame_f(frame, trylevel); + _SEHPortableFrame_t * frame, + _SEHPortableTryLevel_t * trylevel +) +{ + _SEHEnterFrame_f(frame, trylevel); } void __stdcall _SEHEnterTry_s(_SEHPortableTryLevel_t * trylevel) { - _SEHEnterTry_f(trylevel); + _SEHEnterTry_f(trylevel); } void __stdcall _SEHLeave_s(void) { - _SEHLeave_f(); + _SEHLeave_f(); } void _SEH_FASTCALL _SEHEnterFrame_f ( - _SEHPortableFrame_t * frame, - _SEHPortableTryLevel_t * trylevel -) -{ - /* ASSERT(frame); */ - /* ASSERT(trylevel); */ - frame->SPF_Registration.SER_Handler = _SEHFrameHandler; - frame->SPF_Code = 0; - frame->SPF_TopTryLevel = trylevel; - trylevel->SPT_Next = NULL; - _SEHRegisterFrame(&frame->SPF_Registration); + _SEHPortableFrame_t * frame, + _SEHPortableTryLevel_t * trylevel +) +{ + /* ASSERT(frame); */ + /* ASSERT(trylevel); */ + frame->SPF_Registration.SER_Handler = _SEHFrameHandler; + frame->SPF_Code = 0; + frame->SPF_TopTryLevel = trylevel; + trylevel->SPT_Next = NULL; + _SEHRegisterFrame(&frame->SPF_Registration); } void _SEH_FASTCALL _SEHEnterTry_f(_SEHPortableTryLevel_t * trylevel) { - _SEHPortableFrame_t * frame; - - frame = _SEH_CONTAINING_RECORD - ( - _SEHCurrentRegistration(), - _SEHPortableFrame_t, - SPF_Registration - ); - - trylevel->SPT_Next = frame->SPF_TopTryLevel; - frame->SPF_TopTryLevel = trylevel; + _SEHPortableFrame_t * frame; + + frame = _SEH_CONTAINING_RECORD + ( + _SEHCurrentRegistration(), + _SEHPortableFrame_t, + SPF_Registration + ); + + trylevel->SPT_Next = frame->SPF_TopTryLevel; + frame->SPF_TopTryLevel = trylevel; } void _SEH_FASTCALL _SEHLeave_f(void) { - _SEHPortableFrame_t * frame; - _SEHPortableTryLevel_t * trylevel; - - frame = _SEH_CONTAINING_RECORD - ( - _SEHCurrentRegistration(), - _SEHPortableFrame_t, - SPF_Registration - ); - - /* ASSERT(frame); */ - - trylevel = frame->SPF_TopTryLevel; - - /* ASSERT(trylevel); */ - - if(trylevel->SPT_Next) - frame->SPF_TopTryLevel = trylevel->SPT_Next; - else - _SEHUnregisterFrame(); + _SEHPortableFrame_t * frame; + _SEHPortableTryLevel_t * trylevel; + + frame = _SEH_CONTAINING_RECORD + ( + _SEHCurrentRegistration(), + _SEHPortableFrame_t, + SPF_Registration + ); + + /* ASSERT(frame); */ + + trylevel = frame->SPF_TopTryLevel; + + /* ASSERT(trylevel); */ + + if(trylevel->SPT_Next) + frame->SPF_TopTryLevel = trylevel->SPT_Next; + else + _SEHUnregisterFrame(); } /* EOF */ Modified: branches/ros-branch-0_3_1/reactos/lib/pseh/i386/framebased.asm URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/lib/ps…
============================================================================== --- branches/ros-branch-0_3_1/reactos/lib/pseh/i386/framebased.asm (original) +++ branches/ros-branch-0_3_1/reactos/lib/pseh/i386/framebased.asm Wed Feb 28 01:18:28 2007 @@ -22,51 +22,51 @@ global __SEHCleanHandlerEnvironment __SEHCleanHandlerEnvironment: - cld - ret + cld + ret global __SEHCurrentRegistration __SEHCurrentRegistration: - mov eax, [fs:0] - ret + mov eax, [fs:0] + ret global __SEHRegisterFrame __SEHRegisterFrame: - mov ecx, [esp+4] - mov eax, [fs:0] - mov [ecx+0], eax - mov [fs:0], ecx - ret + mov ecx, [esp+4] + mov eax, [fs:0] + mov [ecx+0], eax + mov [fs:0], ecx + ret global __SEHUnregisterFrame __SEHUnregisterFrame: - mov ecx, [fs:0] - mov ecx, [ecx+0] - mov [fs:0], ecx - ret + mov ecx, [fs:0] + mov ecx, [ecx+0] + mov [fs:0], ecx + ret global __SEHGlobalUnwind __SEHGlobalUnwind: - extern __SEHRtlUnwind + extern __SEHRtlUnwind ; RtlUnwind clobbers all the "don't clobber" registers, so we save them - push ebx - mov ebx, [esp+8] - push esi - push edi + push ebx + mov ebx, [esp+8] + push esi + push edi - push dword 0x0 ; ReturnValue - push dword 0x0 ; ExceptionRecord - push dword .RestoreRegisters ; TargetIp - push ebx ; TargetFrame - call [__SEHRtlUnwind] + push dword 0x0 ; ReturnValue + push dword 0x0 ; ExceptionRecord + push dword .RestoreRegisters ; TargetIp + push ebx ; TargetFrame + call [__SEHRtlUnwind] .RestoreRegisters: - pop edi - pop esi - pop ebx + pop edi + pop esi + pop ebx - ret + ret ; EOF Modified: branches/ros-branch-0_3_1/reactos/lib/pseh/i386/setjmp.asm URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/lib/ps…
============================================================================== --- branches/ros-branch-0_3_1/reactos/lib/pseh/i386/setjmp.asm (original) +++ branches/ros-branch-0_3_1/reactos/lib/pseh/i386/setjmp.asm Wed Feb 28 01:18:28 2007 @@ -26,63 +26,63 @@ global __SEHSetJmp@4 _SEHSetJmp: __SEHSetJmp@4: - ; jump buffer - mov eax, [esp+4] + ; jump buffer + mov eax, [esp+4] - ; program counter - mov ecx, [esp+0] + ; program counter + mov ecx, [esp+0] - ; stack pointer - lea edx, [esp+8] + ; stack pointer + lea edx, [esp+8] - ; fill the jump buffer - mov [eax+0], ebp - mov [eax+4], edx - mov [eax+8], ecx - mov [eax+12], ebx - mov [eax+16], esi - mov [eax+20], edi + ; fill the jump buffer + mov [eax+0], ebp + mov [eax+4], edx + mov [eax+8], ecx + mov [eax+12], ebx + mov [eax+16], esi + mov [eax+20], edi - xor eax, eax - ret 4 + xor eax, eax + ret 4 global _SEHLongJmp global __SEHLongJmp@8 _SEHLongJmp: __SEHLongJmp@8: - ; return value - mov eax, [esp+8] + ; return value + mov eax, [esp+8] - ; jump buffer - mov ecx, [esp+4] + ; jump buffer + mov ecx, [esp+4] - ; restore the saved context - mov ebp, [ecx+0] - mov esp, [ecx+4] - mov edx, [ecx+8] - mov ebx, [ecx+12] - mov esi, [ecx+16] - mov edi, [ecx+20] - jmp edx + ; restore the saved context + mov ebp, [ecx+0] + mov esp, [ecx+4] + mov edx, [ecx+8] + mov ebx, [ecx+12] + mov esi, [ecx+16] + mov edi, [ecx+20] + jmp edx global _SEHLongJmp_KeepEsp global __SEHLongJmp_KeepEsp@8 _SEHLongJmp_KeepEsp: __SEHLongJmp_KeepEsp@8: - ; return value - mov eax, [esp+8] + ; return value + mov eax, [esp+8] - ; jump buffer - mov ecx, [esp+4] + ; jump buffer + mov ecx, [esp+4] - ; restore the saved context - mov ebp, [ecx+0] -; don't restore esp + ; restore the saved context + mov ebp, [ecx+0] +; don't restore esp ; mov esp, [ecx+4] - mov edx, [ecx+8] - mov ebx, [ecx+12] - mov esi, [ecx+16] - mov edi, [ecx+20] - jmp edx + mov edx, [ecx+8] + mov ebx, [ecx+12] + mov esi, [ecx+16] + mov edi, [ecx+20] + jmp edx ; EOF
17 years, 9 months
1
0
0
0
[dgorbachev] 25913: Undo 25911
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Tue Feb 27 21:17:26 2007 New Revision: 25913 URL:
http://svn.reactos.org/svn/reactos?rev=25913&view=rev
Log: Undo 25911 Modified: trunk/reactos/ntoskrnl/mm/npool.c Modified: trunk/reactos/ntoskrnl/mm/npool.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/npool.c?rev=25…
============================================================================== --- trunk/reactos/ntoskrnl/mm/npool.c (original) +++ trunk/reactos/ntoskrnl/mm/npool.c Tue Feb 27 21:17:26 2007 @@ -1564,8 +1564,7 @@ DbgPrint("ExFreePool of non-allocated address %x (magic %x)\n", block, blk->hdr.Magic); } - // KEBUGCHECK(0); - KeReleaseSpinLock(&MmNpoolLock, oldIrql); + KEBUGCHECK(0); return; }
17 years, 10 months
1
0
0
0
← Newer
1
2
3
4
5
...
27
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
Results per page:
10
25
50
100
200