Author: hyperion Date: Sun Apr 1 04:07:25 2007 New Revision: 26224
URL: http://svn.reactos.org/svn/reactos?rev=26224&view=rev Log: !!! ATTENTION EVERYONE - do a make clean after getting this revision !!! !!! ATTENTION PSEH USERS - new features & a change in rules !!!
modified include/reactos/libs/pseh/framebased.h modified include/reactos/libs/pseh/framebased/internal.h deleted include/reactos/libs/pseh/setjmp.h modified lib/pseh/framebased.c deleted lib/pseh/i386/setjmp.asm modified lib/pseh/pseh.rbuild Big PSEH revamp. If God is kind and merciful, this might be the last revision to PSEH ever !!! RULE CHANGE !!! Obsoleted _SEH_NO_NATIVE_NLG, do NOT use it anymore, it will now cause fatal compile-time errors !!! RULE CHANGE !!! As a side effect to the fix for a bug where a _SEH_TRY nested in a _SEH_HANDLE would lead to stack corruption, using "return" or "goto" from anywhere inside a PSEH block is now FORBIDDEN; all code that already did has been fixed in this revision !!! NEW FEATURE !!! To leave a PSEH block from anywhere inside it, use the new _SEH_YIELD(<statement>) macro; examples: _SEH_YIELD(return value), _SEH_YIELD(goto label), _SEH_YIELD(returnvalue = value; goto label); ALWAYS ensure a _SEH_YIELD() leads outside the top-level _SEH_TRY block - do NOT goto into an ancestor _SEH_TRY block!!! Also note that _SEH_YIELD() disables SEH protection for the enclosed statement, so do NOT perform operations that might throw exceptions inside a _SEH_YIELD(); finally, ensure the enclosed statement does NOT allow execution to continue, or _SEH_YIELD() will get in an infinite loop; bear with me, for I have done the impossible, so don't expect miracles Don't use a fake setjmp/longjmp *ever*, too dangerous; removed _SEHLongJmp & _SEHSetJmp, obsoleted _SEH_NO_NATIVE_NLG On GCC, use __builtin_setjmp/__builtin_longjmp instead of setjmp/longjmp; they produce efficient code that plays well with optimizations, require no external library and are designed specifically for exception handling; should result in faster code and no hidden bugs Use inline code to enter/leave trylevels; yields much better binary code Inline handlers inside _SEH_PortableFrame_t instead of pointing to them; yields better code for the most common usages Turn all top-level statements generated by macros from bare scopes into for loops, to ensure they are used correctly as stand-alone statements Removed bitrotten old syntax, because it wasn't being used nor maintained
modified dll/3rdparty/freetype/freetype.rbuild modified dll/win32/kernel32/kernel32.rbuild modified drivers/network/tcpip/tcpip.rbuild modified lib/drivers/ip/ip.rbuild modified lib/rtl/rtl.rbuild modified ntoskrnl/ntoskrnl.rbuild modified subsystems/win32/win32k/win32k.rbuild Removed obsolete _SEH_NO_NATIVE_NLG define
modified drivers/network/afd/afd/lock.c modified drivers/network/afd/afd/tdi.c modified subsystems/csr/csrsrv/api.c modified subsystems/win32/win32k/ntuser/clipboard.c modified subsystems/win32/win32k/ntuser/window.c Use the new _SEH_YIELD macro to return/goto from SEH blocks
modified tools/rbuild/backend/mingw/modulehandler.cpp modified tools/rbuild/backend/mingw/modulehandler.h modified tools/rbuild/module.cpp modified tools/rbuild/project.dtd modified tools/rbuild/rbuild.h Don't use the obsolete _SEH_NO_NATIVE_NLG flag anymore Only add underscores to imported symbols when module is marked underscoresymbols="true"; fixes debugsup and, indirectly, PSEH tracing
modified lib/3rdparty/mingw/mingw.rbuild Build with underscoresymbols="true"
Removed: trunk/reactos/include/reactos/libs/pseh/setjmp.h trunk/reactos/lib/pseh/i386/setjmp.asm Modified: trunk/reactos/dll/3rdparty/freetype/freetype.rbuild trunk/reactos/dll/win32/kernel32/kernel32.rbuild trunk/reactos/drivers/network/afd/afd/lock.c trunk/reactos/drivers/network/afd/afd/tdi.c trunk/reactos/drivers/network/tcpip/tcpip.rbuild trunk/reactos/include/reactos/libs/pseh/framebased.h trunk/reactos/include/reactos/libs/pseh/framebased/internal.h trunk/reactos/lib/3rdparty/mingw/mingw.rbuild trunk/reactos/lib/drivers/ip/ip.rbuild trunk/reactos/lib/pseh/framebased.c trunk/reactos/lib/pseh/pseh.rbuild trunk/reactos/lib/rtl/rtl.rbuild trunk/reactos/ntoskrnl/ntoskrnl.rbuild trunk/reactos/subsystems/csr/csrsrv/api.c trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c trunk/reactos/subsystems/win32/win32k/win32k.rbuild trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h trunk/reactos/tools/rbuild/module.cpp trunk/reactos/tools/rbuild/project.dtd trunk/reactos/tools/rbuild/rbuild.h
Modified: trunk/reactos/dll/3rdparty/freetype/freetype.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/freetype/freet... ============================================================================== --- trunk/reactos/dll/3rdparty/freetype/freetype.rbuild (original) +++ trunk/reactos/dll/3rdparty/freetype/freetype.rbuild Sun Apr 1 04:07:25 2007 @@ -2,7 +2,6 @@ <importlibrary definition="freetype.def" /> <include base="freetype">include</include> <define name="_DISABLE_TIDENTS" /> - <define name="_SEH_NO_NATIVE_NLG" /> <define name="__NTDRIVER__" /> <define name="__NO_CTYPE_INLINES" /> <define name="__USE_W32API" />
Modified: trunk/reactos/dll/win32/kernel32/kernel32.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel32... ============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.rbuild (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.rbuild Sun Apr 1 04:07:25 2007 @@ -3,7 +3,6 @@ <include base="kernel32_base">include</include> <include base="ReactOS">include/reactos/subsys</include> <define name="_DISABLE_TIDENTS" /> - <define name="_SEH_NO_NATIVE_NLG" /> <define name="__USE_W32API" /> <define name="_WIN32_WINNT">0x0600</define> <define name="__NO_CTYPE_INLINES" /> @@ -120,7 +119,6 @@ <include base="kernel32">.</include> <include base="kernel32">include</include> <define name="_DISABLE_TIDENTS" /> - <define name="_SEH_NO_NATIVE_NLG" /> <define name="__USE_W32API" /> <define name="WINVER">0x0500</define> <library>kernel32_base</library> @@ -130,4 +128,4 @@ <linkerflag>-nostartfiles</linkerflag> <linkerflag>-nostdlib</linkerflag> <file>kernel32.rc</file> -</module> +</module>
Modified: trunk/reactos/drivers/network/afd/afd/lock.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/loc... ============================================================================== --- trunk/reactos/drivers/network/afd/afd/lock.c (original) +++ trunk/reactos/drivers/network/afd/afd/lock.c Sun Apr 1 04:07:25 2007 @@ -71,7 +71,7 @@ "from userland (%x %x)\n", Buf, AddressLen)); ExFreePool( NewBuf ); - return NULL; + _SEH_YIELD(return NULL); } _SEH_END;
for( i = 0; i < Count; i++ ) {
Modified: trunk/reactos/drivers/network/afd/afd/tdi.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/tdi... ============================================================================== --- trunk/reactos/drivers/network/afd/afd/tdi.c (original) +++ trunk/reactos/drivers/network/afd/afd/tdi.c Sun Apr 1 04:07:25 2007 @@ -977,7 +977,7 @@ } _SEH_HANDLE { AFD_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n")); IoFreeIrp(*Irp); - return STATUS_INSUFFICIENT_RESOURCES; + _SEH_YIELD(return STATUS_INSUFFICIENT_RESOURCES); } _SEH_END;
AFD_DbgPrint(MID_TRACE,("AFD>>> Got an MDL: %x\n", Mdl)); @@ -1066,7 +1066,7 @@ } _SEH_HANDLE { AFD_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n")); IoFreeIrp(*Irp); - return STATUS_INSUFFICIENT_RESOURCES; + _SEH_YIELD(return STATUS_INSUFFICIENT_RESOURCES); } _SEH_END;
AFD_DbgPrint(MID_TRACE,("AFD>>> Got an MDL: %x\n", Mdl));
Modified: trunk/reactos/drivers/network/tcpip/tcpip.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpip... ============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip.rbuild (original) +++ trunk/reactos/drivers/network/tcpip/tcpip.rbuild Sun Apr 1 04:07:25 2007 @@ -2,7 +2,6 @@ <importlibrary definition="tcpip.def"></importlibrary> <include base="tcpip">include</include> <include base="oskittcp">include</include> - <define name="_SEH_NO_NATIVE_NLG" /> <define name="NDIS40" /> <define name="__USE_W32API" /> <define name="_NTDRIVER_" />
Modified: trunk/reactos/include/reactos/libs/pseh/framebased.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/pseh/f... ============================================================================== --- trunk/reactos/include/reactos/libs/pseh/framebased.h (original) +++ trunk/reactos/include/reactos/libs/pseh/framebased.h Sun Apr 1 04:07:25 2007 @@ -30,15 +30,14 @@ # 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. -*/ -#ifdef _SEH_NO_NATIVE_NLG -# include <pseh/setjmp.h> +#if defined(_SEH_NO_NATIVE_NLG) +# error PSEH setjmp/longjmp fallback is no longer supported +#endif + +#if defined(__GNUC__) +# define _SEHLongJmp __builtin_longjmp +# define _SEHSetJmp __builtin_setjmp + typedef void * _SEHJmpBuf_t[5]; #else # include <setjmp.h> # define _SEHLongJmp longjmp @@ -55,7 +54,7 @@ typedef struct __SEHFrame { _SEHPortableFrame_t SEH_Header; - void * SEH_Locals; + void * volatile SEH_Locals; } _SEHFrame_t;
@@ -78,6 +77,7 @@
static const int _SEHScopeKind = 1; static _SEHPortableFrame_t * const _SEHPortableFrame = 0; +static _SEHPortableTryLevel_t * const _SEHPortableTryLevel = 0;
/* SHARED LOCALS */ /* Access the locals for the current frame */ @@ -139,28 +139,6 @@ }
/* SAFE BLOCKS */ -#define _SEHX_TRY_FINALLY(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) - -#define _SEHX_TRY_HANDLE_FINALLY(FINALLY_) \ - _SEH_TRY_FILTER_FINALLY \ - ( \ - _SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER), \ - (FINALLY_) \ - ) - -#define _SEHX_TRY \ - _SEH_TRY_HANDLE_FINALLY(0) - #ifdef __cplusplus # define _SEH_DECLARE_HANDLERS(FILTER_, FINALLY_) \ static const _SEHHandlers_t _SEHHandlers = { (FILTER_), (FINALLY_) }; @@ -171,79 +149,30 @@ _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); \ - \ - { \ - _SEH_INIT_CONST int _SEHScopeKind = 0; \ - (void)_SEHScopeKind; \ - \ - if(_SEHSetJmp(_SEHTryLevel.ST_JmpBuf) == 0) \ - { \ - for(;;) \ - { - -#define _SEHX_HANDLE \ - \ - break; \ - } \ - \ - _SEHLeave(); \ - } \ - else \ - { \ - _SEHLeave(); - -#define _SEHX_END \ - } \ - \ - if(_SEHHandlers.SH_Finally) \ - _SEHHandlers.SH_Finally(_SEHPortableFrame); \ - } \ - } \ - } - -#define _SEHX_LEAVE break - -#define _SEHX_GetExceptionCode() (unsigned long)(_SEHPortableFrame->SPF_Code) - -#define _SEHX_GetExceptionPointers() \ +#define _SEH_GetExceptionCode() (unsigned long)(_SEHPortableFrame->SPF_Code) + +#define _SEH_GetExceptionPointers() \ ((struct _EXCEPTION_POINTERS *)_SEHExceptionPointers)
-#define _SEHX_AbnormalTermination() (_SEHPortableFrame->SPF_Code != 0) - -/* New syntax */ +#define _SEH_AbnormalTermination() (_SEHPortableFrame->SPF_Code != 0)
#define _SEH_LEAVE break
+#define _SEH_YIELD(STMT_) \ + for(;;) \ + { \ + if(!_SEHScopeKind) \ + _SEHReturn(); \ + \ + STMT_; \ + } + #define _SEH_TRY \ + for(;;) \ { \ _SEH_INIT_CONST int _SEHTopTryLevel = (_SEHScopeKind != 0); \ _SEHPortableFrame_t * const _SEHCurPortableFrame = _SEHPortableFrame; \ + _SEHPortableTryLevel_t * const _SEHPrevPortableTryLevel = _SEHPortableTryLevel; \ \ { \ _SEH_INIT_CONST int _SEHScopeKind = 0; \ @@ -253,9 +182,11 @@ _SEHTryLevel_t _SEHTryLevel; \ _SEHPortableFrame_t * const _SEHPortableFrame = \ _SEHTopTryLevel ? &_SEHFrame.SEH_Header : _SEHCurPortableFrame; \ + _SEHPortableTryLevel_t * const _SEHPortableTryLevel = &_SEHTryLevel.ST_Header; \ \ (void)_SEHScopeKind; \ (void)_SEHPortableFrame; \ + (void)_SEHPortableTryLevel; \ (void)_SEHHandle; \ \ for(;;) \ @@ -276,9 +207,57 @@ } \ else \ { \ - _SEH_DECLARE_HANDLERS((FILTER_), 0); \ - \ - _SEHTryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ + if((_SEHHandle = _SEHSetJmp(_SEHTryLevel.ST_JmpBuf)) == 0) \ + { \ + _SEHTryLevel.ST_Header.SPT_Handlers.SH_Filter = (FILTER_); \ + _SEHTryLevel.ST_Header.SPT_Handlers.SH_Finally = 0; \ + \ + _SEHTryLevel.ST_Header.SPT_Next = _SEHPrevPortableTryLevel; \ + _SEHFrame.SEH_Header.SPF_TopTryLevel = &_SEHTryLevel.ST_Header; \ + \ + if(_SEHTopTryLevel) \ + { \ + if(&_SEHLocals != _SEHDummyLocals) \ + _SEHFrame.SEH_Locals = &_SEHLocals; \ + \ + _SEH_EnableTracing(_SEH_DO_DEFAULT_TRACING); \ + _SEHFrame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \ + _SEHEnterFrame(&_SEHFrame.SEH_Header); \ + } \ + \ + ++ _SEHState; \ + continue; \ + } \ + else \ + { \ + break; \ + } \ + } \ + \ + break; \ + } \ + \ + _SEHPortableFrame->SPF_TopTryLevel = _SEHPrevPortableTryLevel; \ + \ + if(_SEHHandle) \ + { + +#define _SEH_FINALLY(FINALLY_) \ + } \ + \ + break; \ + } \ + \ + _SEHPortableFrame->SPF_TopTryLevel = _SEHPrevPortableTryLevel; \ + break; \ + } \ + else \ + { \ + _SEHTryLevel.ST_Header.SPT_Handlers.SH_Filter = 0; \ + _SEHTryLevel.ST_Header.SPT_Handlers.SH_Finally = (FINALLY_); \ + \ + _SEHTryLevel.ST_Header.SPT_Next = _SEHPrevPortableTryLevel; \ + _SEHFrame.SEH_Header.SPF_TopTryLevel = &_SEHTryLevel.ST_Header; \ \ if(_SEHTopTryLevel) \ { \ @@ -287,56 +266,8 @@ \ _SEH_EnableTracing(_SEH_DO_DEFAULT_TRACING); \ _SEHFrame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \ - _SEHEnterFrame(&_SEHFrame.SEH_Header, &_SEHTryLevel.ST_Header); \ - } \ - else \ - _SEHEnterTry(&_SEHTryLevel.ST_Header); \ - \ - if((_SEHHandle = _SEHSetJmp(_SEHTryLevel.ST_JmpBuf)) == 0) \ - { \ - ++ _SEHState; \ - continue; \ - } \ - else \ - { \ - break; \ - } \ - } \ - \ - break; \ - } \ - \ - _SEHLeave(); \ - \ - if(_SEHHandle) \ - { - -#define _SEH_FINALLY(FINALLY_) \ - } \ - \ - break; \ - } \ - \ - _SEHLeave(); \ - break; \ - } \ - else \ - { \ - _SEH_DECLARE_HANDLERS(0, (FINALLY_)); \ - \ - _SEHTryLevel.ST_Header.SPT_Handlers = &_SEHHandlers; \ - \ - if(_SEHTopTryLevel) \ - { \ - if(&_SEHLocals != _SEHDummyLocals) \ - _SEHFrame.SEH_Locals = &_SEHLocals; \ - \ - _SEH_EnableTracing(_SEH_DO_DEFAULT_TRACING); \ - _SEHFrame.SEH_Header.SPF_Handler = 0; \ - _SEHEnterFrame(&_SEHFrame.SEH_Header, &_SEHTryLevel.ST_Header); \ - } \ - else \ - _SEHEnterTry(&_SEHTryLevel.ST_Header); \ + _SEHEnterFrame(&_SEHFrame.SEH_Header); \ + } \ \ ++ _SEHState; \ continue; \ @@ -353,13 +284,14 @@ #define _SEH_END \ } \ } \ + \ + if(_SEHTopTryLevel) \ + _SEHLeaveFrame(); \ + \ + break; \ }
#define _SEH_HANDLE _SEH_EXCEPT(_SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER)) - -#define _SEH_GetExceptionCode _SEHX_GetExceptionCode -#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))
Modified: trunk/reactos/include/reactos/libs/pseh/framebased/internal.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/pseh/f... ============================================================================== --- trunk/reactos/include/reactos/libs/pseh/framebased/internal.h (original) +++ trunk/reactos/include/reactos/libs/pseh/framebased/internal.h Sun Apr 1 04:07:25 2007 @@ -87,8 +87,8 @@
typedef struct __SEHPortableTryLevel { - struct __SEHPortableTryLevel * SPT_Next; - const _SEHHandlers_t * SPT_Handlers; + struct __SEHPortableTryLevel * volatile SPT_Next; + volatile _SEHHandlers_t SPT_Handlers; } _SEHPortableTryLevel_t;
@@ -96,9 +96,9 @@ { _SEHRegistration_t SPF_Registration; unsigned long SPF_Code; - _SEHHandler_t SPF_Handler; - _SEHPortableTryLevel_t * SPF_TopTryLevel; - int SPF_Tracing; + volatile _SEHHandler_t SPF_Handler; + _SEHPortableTryLevel_t * volatile SPF_TopTryLevel; + volatile int SPF_Tracing; } _SEHPortableFrame_t;
@@ -107,14 +107,9 @@ { #endif
-extern void __stdcall _SEHEnterFrame_s -( - _SEHPortableFrame_t *, - _SEHPortableTryLevel_t * -); - -extern void __stdcall _SEHEnterTry_s(_SEHPortableTryLevel_t *); -extern void __stdcall _SEHLeave_s(void); +extern void __stdcall _SEHEnterFrame_s(_SEHPortableFrame_t *); +extern void __stdcall _SEHLeaveFrame_s(void); +extern void __stdcall _SEHReturn_s(void);
#if !defined(_SEH_NO_FASTCALL) # ifdef _M_IX86 @@ -123,22 +118,17 @@ # define _SEH_FASTCALL __stdcall # endif
-extern void _SEH_FASTCALL _SEHEnterFrame_f -( - _SEHPortableFrame_t *, - _SEHPortableTryLevel_t * -); - -extern void _SEH_FASTCALL _SEHEnterTry_f(_SEHPortableTryLevel_t *); -extern void _SEH_FASTCALL _SEHLeave_f(void); +extern void _SEH_FASTCALL _SEHEnterFrame_f(_SEHPortableFrame_t *); +extern void _SEH_FASTCALL _SEHLeaveFrame_f(void); +extern void _SEH_FASTCALL _SEHReturn_f(void);
# define _SEHEnterFrame _SEHEnterFrame_f -# define _SEHEnterTry _SEHEnterTry_f -# define _SEHLeave _SEHLeave_f +# define _SEHLeaveFrame _SEHLeaveFrame_f +# define _SEHReturn _SEHReturn_f #else # define _SEHEnterFrame _SEHEnterFrame_s -# define _SEHEnterTry _SEHEnterTry_s -# define _SEHLeave _SEHLeave_s +# define _SEHLeaveFrame _SEHLeaveFrame_s +# define _SEHReturn _SEHReturn_s #endif
#ifdef __cplusplus
Removed: trunk/reactos/include/reactos/libs/pseh/setjmp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/pseh/s... ============================================================================== --- trunk/reactos/include/reactos/libs/pseh/setjmp.h (original) +++ trunk/reactos/include/reactos/libs/pseh/setjmp.h (removed) @@ -1,54 +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_SETJMP_H_ -#define KJK_PSEH_SETJMP_H_ - -#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; -} -_SEHJmpBuf_t[1]; -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif - -extern __declspec(noreturn) void __stdcall _SEHLongJmp(_SEHJmpBuf_t, int); -extern __declspec(noreturn) void __stdcall _SEHLongJmp_KeepEsp(_SEHJmpBuf_t, int); -extern int __stdcall _SEHSetJmp(_SEHJmpBuf_t); - -#ifdef __cplusplus -} -#endif - -#endif - -/* EOF */
Modified: trunk/reactos/lib/3rdparty/mingw/mingw.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/mingw.rb... ============================================================================== --- trunk/reactos/lib/3rdparty/mingw/mingw.rbuild (original) +++ trunk/reactos/lib/3rdparty/mingw/mingw.rbuild Sun Apr 1 04:07:25 2007 @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE project SYSTEM "tools/rbuild/project.dtd"> <group> -<module name="mingw_common" type="staticlibrary" isstartuplib="true"> +<module name="mingw_common" type="staticlibrary" isstartuplib="true" underscoresymbols="true"> <importlibrary definition="moldname-msvcrt.def" dllname="msvcrt.dll" /> <include base="ReactOS">include/crt</include> <include base="ReactOS">include/psdk</include>
Modified: trunk/reactos/lib/drivers/ip/ip.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/ip.rbuild?re... ============================================================================== --- trunk/reactos/lib/drivers/ip/ip.rbuild (original) +++ trunk/reactos/lib/drivers/ip/ip.rbuild Sun Apr 1 04:07:25 2007 @@ -1,6 +1,5 @@ <module name="ip" type="staticlibrary" allowwarnings="true"> <define name="__NTDRIVER__"/> - <define name="_SEH_NO_NATIVE_NLG"/> <define name="__USE_W32API"/> <include base="tcpip">include</include> <include base="oskittcp">include</include>
Modified: trunk/reactos/lib/pseh/framebased.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/framebased.c?rev=2... ============================================================================== --- trunk/reactos/lib/pseh/framebased.c (original) +++ trunk/reactos/lib/pseh/framebased.c Sun Apr 1 04:07:25 2007 @@ -164,7 +164,7 @@ { \ if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_TRYLEVEL) \ { \ - _SEH_TRACE_LINE_((FRAME_), ("trylevel %p, filter %p", (TRYLEVEL_), (TRYLEVEL_)->SPT_Handlers->SH_Filter)); \ + _SEH_TRACE_LINE_((FRAME_), ("trylevel %p, filter %p", (TRYLEVEL_), (TRYLEVEL_)->SPT_Handlers.SH_Filter)); \ } \ }
@@ -178,7 +178,7 @@ ( \ "trylevel %p, calling filter %p, ExceptionCode %08X", \ (TRYLEVEL_), \ - (TRYLEVEL_)->SPT_Handlers->SH_Filter, \ + (TRYLEVEL_)->SPT_Handlers.SH_Filter, \ (ER_)->ExceptionCode \ ) \ ); \ @@ -195,7 +195,7 @@ ( \ "trylevel %p, filter %p => %s", \ (TRYLEVEL_), \ - (TRYLEVEL_)->SPT_Handlers->SH_Filter, \ + (TRYLEVEL_)->SPT_Handlers.SH_Filter, \ _SEH_FILTER_RET_STRING_(RET_) \ ) \ ); \ @@ -236,7 +236,7 @@ ( \ "trylevel %p, calling exit routine %p", \ (TRYLEVEL_), \ - (TRYLEVEL_)->SPT_Handlers->SH_Finally \ + (TRYLEVEL_)->SPT_Handlers.SH_Finally \ ) \ ); \ } \ @@ -252,7 +252,7 @@ ( \ "trylevel %p, exit routine %p returned", \ (TRYLEVEL_), \ - (TRYLEVEL_)->SPT_Handlers->SH_Finally \ + (TRYLEVEL_)->SPT_Handlers.SH_Finally \ ) \ ); \ } \ @@ -305,7 +305,7 @@
/* ASSERT(trylevel); */
- pfnFinally = trylevel->SPT_Handlers->SH_Finally; + pfnFinally = trylevel->SPT_Handlers.SH_Finally;
if(pfnFinally) { @@ -386,7 +386,7 @@ trylevel = trylevel->SPT_Next ) { - _SEHFilter_t pfnFilter = trylevel->SPT_Handlers->SH_Filter; + _SEHFilter_t pfnFilter = trylevel->SPT_Handlers.SH_Filter;
_SEH_TRACE_TRYLEVEL(frame, trylevel);
@@ -402,7 +402,7 @@
default: { - if(trylevel->SPT_Handlers->SH_Filter) + if(trylevel->SPT_Handlers.SH_Filter) { EXCEPTION_POINTERS ep;
@@ -443,41 +443,31 @@ return ExceptionContinueSearch; }
-void __stdcall _SEHEnterFrame_s -( - _SEHPortableFrame_t * frame, - _SEHPortableTryLevel_t * trylevel -) -{ - _SEHEnterFrame_f(frame, trylevel); -} - -void __stdcall _SEHEnterTry_s(_SEHPortableTryLevel_t * trylevel) -{ - _SEHEnterTry_f(trylevel); -} - -void __stdcall _SEHLeave_s(void) -{ - _SEHLeave_f(); -} - -void _SEH_FASTCALL _SEHEnterFrame_f -( - _SEHPortableFrame_t * frame, - _SEHPortableTryLevel_t * trylevel -) +void __stdcall _SEHEnterFrame_s(_SEHPortableFrame_t * frame) +{ + _SEHEnterFrame_f(frame); +} + +void __stdcall _SEHLeaveFrame_s(void) +{ + _SEHLeaveFrame_f(); +} + +void __stdcall _SEHReturn_s(void) +{ + _SEHReturn_f(); +} + +void _SEH_FASTCALL _SEHEnterFrame_f(_SEHPortableFrame_t * frame) { /* 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) +void _SEH_FASTCALL _SEHLeaveFrame_f(void) { _SEHPortableFrame_t * frame;
@@ -488,14 +478,15 @@ SPF_Registration );
- trylevel->SPT_Next = frame->SPF_TopTryLevel; - frame->SPF_TopTryLevel = trylevel; -} - -void _SEH_FASTCALL _SEHLeave_f(void) + /* ASSERT(frame); */ + /* ASSERT(frame->SPF_TopTryLevel == NULL) */ + + _SEHUnregisterFrame(); +} + +void _SEH_FASTCALL _SEHReturn_f(void) { _SEHPortableFrame_t * frame; - _SEHPortableTryLevel_t * trylevel;
frame = _SEH_CONTAINING_RECORD ( @@ -504,16 +495,8 @@ SPF_Registration );
- /* ASSERT(frame); */ - - trylevel = frame->SPF_TopTryLevel; - - /* ASSERT(trylevel); */ - - if(trylevel->SPT_Next) - frame->SPF_TopTryLevel = trylevel->SPT_Next; - else - _SEHUnregisterFrame(); + _SEHLocalUnwind(frame, NULL); + _SEHUnregisterFrame(); }
/* EOF */
Removed: trunk/reactos/lib/pseh/i386/setjmp.asm URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/i386/setjmp.asm?re... ============================================================================== --- trunk/reactos/lib/pseh/i386/setjmp.asm (original) +++ trunk/reactos/lib/pseh/i386/setjmp.asm (removed) @@ -1,88 +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 dos 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. - -segment .text use32 - -; Note: the undecorated names are for Borland C++ (and possibly other compilers -; using the OMF format) -global _SEHSetJmp -global __SEHSetJmp@4 -_SEHSetJmp: -__SEHSetJmp@4: - ; jump buffer - mov eax, [esp+4] - - ; program counter - mov ecx, [esp+0] - - ; 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 - - xor eax, eax - ret 4 - -global _SEHLongJmp -global __SEHLongJmp@8 -_SEHLongJmp: -__SEHLongJmp@8: - ; return value - mov eax, [esp+8] - - ; 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 - -global _SEHLongJmp_KeepEsp -global __SEHLongJmp_KeepEsp@8 -_SEHLongJmp_KeepEsp: -__SEHLongJmp_KeepEsp@8: - ; return value - mov eax, [esp+8] - - ; jump buffer - mov ecx, [esp+4] - - ; 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 - -; EOF
Modified: trunk/reactos/lib/pseh/pseh.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/pseh.rbuild?rev=26... ============================================================================== --- trunk/reactos/lib/pseh/pseh.rbuild (original) +++ trunk/reactos/lib/pseh/pseh.rbuild Sun Apr 1 04:07:25 2007 @@ -3,7 +3,6 @@ <if property="ARCH" value="i386"> <directory name="i386"> <file>framebased.asm</file> - <file>setjmp.asm</file> </directory> </if> <file>framebased.c</file>
Modified: trunk/reactos/lib/rtl/rtl.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/rtl.rbuild?rev=2622... ============================================================================== --- trunk/reactos/lib/rtl/rtl.rbuild (original) +++ trunk/reactos/lib/rtl/rtl.rbuild Sun Apr 1 04:07:25 2007 @@ -5,7 +5,6 @@ <define name="NO_RTL_INLINES" /> <define name="_NTSYSTEM_" /> <define name="_NTDLLBUILD_" /> - <define name="_SEH_NO_NATIVE_NLG" /> <include base="rtl">.</include> <if property="ARCH" value="i386"> <directory name="i386">
Modified: trunk/reactos/ntoskrnl/ntoskrnl.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.rbuild?re... ============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl.rbuild (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.rbuild Sun Apr 1 04:07:25 2007 @@ -1,7 +1,6 @@ <module name="ntoskrnl" type="kernel" installbase="system32" installname="ntoskrnl.exe"> <bootstrap base="$(CDOUTPUT)" /> <importlibrary definition="ntoskrnl.def" /> - <define name="_SEH_NO_NATIVE_NLG" /> <define name="_DISABLE_TIDENTS" /> <define name="__NTOSKRNL__" /> <define name="_NTOSKRNL_" />
Modified: trunk/reactos/subsystems/csr/csrsrv/api.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/csr/csrsrv/api.c... ============================================================================== --- trunk/reactos/subsystems/csr/csrsrv/api.c (original) +++ trunk/reactos/subsystems/csr/csrsrv/api.c Sun Apr 1 04:07:25 2007 @@ -109,7 +109,7 @@ * communications with the Session Manager (SM) and initializes the static * thread that will handle connection requests and APIs. * - * @param None + * @param None * * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL * othwerwise. @@ -192,7 +192,7 @@ * communications with the Client/Server Runtime (CSR) and initializes the * static thread that will handle connection requests and APIs. * - * @param None + * @param None * * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL * othwerwise. @@ -311,7 +311,7 @@ * requests on the CSR API LPC Port. * * @param Parameter - * System-default user-defined parameter. Unused. + * System-default user-defined parameter. Unused. * * @return The thread exit code, if the thread is terminated. * @@ -462,7 +462,7 @@ } } } - + /* Increase the thread count */ InterlockedIncrement(&CsrpStaticThreadCount);
@@ -625,7 +625,7 @@ } } } - + /* Increase the thread count */ InterlockedIncrement(&CsrpStaticThreadCount);
@@ -791,7 +791,7 @@ * requests on the SM API LPC Port. * * @param Parameter - * System-default user-defined parameter. Unused. + * System-default user-defined parameter. Unused. * * @return The thread exit code, if the thread is terminated. * @@ -848,7 +848,7 @@ { /* Close the handle if we have one */ if (PortContext) NtClose((HANDLE)PortContext); - + /* Client died, start over */ ReplyMsg = NULL; continue; @@ -1026,7 +1026,7 @@ * * The CsrConnectToUser connects to the User subsystem. * - * @param None + * @param None * * @return A pointer to the CSR Thread * @@ -1145,7 +1145,7 @@ { /* Return failure */ ApiMessage->Status = STATUS_INVALID_PARAMETER; - return FALSE; + _SEH_YIELD(return FALSE); }
/* Check if the Length is valid */ @@ -1154,14 +1154,14 @@ { /* Return failure */ ApiMessage->Status = STATUS_INVALID_PARAMETER; - return FALSE; + _SEH_YIELD(return FALSE); } } _SEH_HANDLE { /* Return failure */ ApiMessage->Status = STATUS_INVALID_PARAMETER; - return FALSE; + _SEH_YIELD(return FALSE); } _SEH_END;
/* We validated the incoming buffer, now allocate the remote one */ @@ -1226,7 +1226,7 @@ RemoteCaptureBuffer->PreviousCaptureBuffer = LocalCaptureBuffer; ApiMessage->CsrCaptureData = RemoteCaptureBuffer; } - + /* Success */ return TRUE; } @@ -1267,7 +1267,7 @@
/* Find out the difference between the two buffers */ BufferDistance = (ULONG_PTR)LocalCaptureBuffer - (ULONG_PTR)RemoteCaptureBuffer; - + /* Save the pointer count and offset pointer */ PointerCount = RemoteCaptureBuffer->PointerCount; PointerOffsets = (ULONG_PTR**)(RemoteCaptureBuffer + 1); @@ -1284,7 +1284,7 @@ /* Modify the pointer to take into account its new position */ *CurrentPointer += BufferDistance; } - + /* Move to the next Pointer */ PointerCount--; }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c Sun Apr 1 04:07:25 2007 @@ -17,7 +17,7 @@
#define USE_WINSTA \ PWINSTATION_OBJECT WinStaObj; \ - WinStaObj = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation; + WinStaObj = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
#define WINSTA_ClipboardThread WinStaObj->Clipboard->ClipboardThread #define WINSTA_ClipboardOwnerThread WinStaObj->Clipboard->ClipboardOwnerThread @@ -54,13 +54,13 @@
/*==============================================================*/
-/* return the pointer to the prev window of the finded window, +/* return the pointer to the prev window of the finded window, if NULL does not exists in the chain */ PCLIPBOARDCHAINELEMENT FASTCALL IntIsWindowInChain(PWINDOW_OBJECT window) { PCLIPBOARDCHAINELEMENT wce = WindowsChain; - + while (wce) { if (wce->window == window) @@ -68,8 +68,8 @@ break; } wce = wce->next; - } - + } + return wce; }
@@ -81,7 +81,7 @@ { DPRINT1("chain: %p\n", wce2->window->hSelf); wce2 = wce2->next; - } + } }
/* the new window always have to be the first in the chain */ @@ -89,27 +89,27 @@ IntAddWindowToChain(PWINDOW_OBJECT window) { PCLIPBOARDCHAINELEMENT wce = NULL; - + if (!IntIsWindowInChain(window)) { wce = WindowsChain; - + wce = ExAllocatePool(PagedPool, sizeof(CLIPBOARDCHAINELEMENT)); if (wce == NULL) { SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); goto exit_addChain; - } - + } + wce->window = window; wce->next = WindowsChain; - + WindowsChain = wce;
//printChain(); } -exit_addChain: - +exit_addChain: + /* return the next window to beremoved later */ return wce; } @@ -133,17 +133,17 @@ link = &wce->next; wce = wce->next; } - - //printChain(); - + + //printChain(); + return wce; - } + } else { return NULL; } } - +
/*==============================================================*/ /* if format exists, returns a non zero value (pointing to format object) */ @@ -152,7 +152,7 @@ { PCLIPBOARDELEMENT ret = NULL; PCLIPBOARDELEMENT ce = ClipboardData; - + while(ce) { if (ce->format == format) @@ -171,7 +171,7 @@ { DWORD ret = 0; PCLIPBOARDELEMENT ce = ClipboardData; - + while(ce) { ret++; @@ -190,19 +190,19 @@ if (ce == NULL) { SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - } + } else - { + { ce->format = format; ce->size = size; ce->hData = hData; ce->next = ClipboardData; - + ClipboardData = ce; - + IntIncrementSequenceNumber(); } - + return ce; }
@@ -211,9 +211,9 @@ intRemoveFormatedData(UINT format) { BOOL ret = FALSE; - PCLIPBOARDELEMENT ce = ClipboardData; + PCLIPBOARDELEMENT ce = ClipboardData; PCLIPBOARDELEMENT *link = &ClipboardData; - + if (intIsFormatAvailable(format)) { while (ce != NULL) @@ -223,19 +223,19 @@ *link = ce->next; break; } - + link = &ce->next; ce = ce->next; } - + if (ce->hData) { ExFreePool(ce->hData); } - ExFreePool(ce); + ExFreePool(ce); ret = TRUE; } - + return ret; }
@@ -244,7 +244,7 @@ { PCLIPBOARDELEMENT ce = ClipboardData; PCLIPBOARDELEMENT tmp; - + while(ce) { tmp = ce->next; @@ -252,13 +252,13 @@ ExFreePool(ce); ce = tmp; } - + ClipboardData = NULL; }
/*==============================================================*/
-HANDLE FASTCALL +HANDLE FASTCALL renderBITMAPfromDIB(LPBYTE hDIB) { HDC hdc; @@ -268,7 +268,7 @@
//hdc = UserGetDCEx(NULL, NULL, DCX_USESTYLE); hdc = UserGetDCEx(ClipboardWindow, NULL, DCX_USESTYLE); - + ih = (BITMAPINFOHEADER *)hDIB;
offset = sizeof(BITMAPINFOHEADER) + ((ih->biBitCount <= 8) ? (sizeof(RGBQUAD) * (1 << ih->biBitCount)) : 0); @@ -279,56 +279,56 @@ UserReleaseDC(ClipboardWindow, hdc, FALSE);
return hbitmap; -} +}
BOOL FASTCALL canSinthesize(UINT format) { BOOL ret = FALSE; - + switch(format) { case CF_BITMAP: case CF_METAFILEPICT: ret = TRUE; } - + return ret; }
/* returns the size of the sinthesized data */ -DWORD FASTCALL +DWORD FASTCALL synthesizeData(UINT format) { DWORD ret = 0; - + synthesizedData = NULL; synthesizedDataSize = 0; - + if (!canSinthesize(format)) { return 0; } - + switch (format) { case CF_BITMAP: { - break; - } - + break; + } + case CF_METAFILEPICT: { - break; - } - } - + break; + } + } + ret = 1; - - return ret; -} - -VOID FASTCALL + + return ret; +} + +VOID FASTCALL freeSynthesizedData() { ExFreePool(synthesizedData); @@ -336,7 +336,7 @@
/*==============================================================*/
-BOOL FASTCALL +BOOL FASTCALL intIsClipboardOpenByMe() { /* check if we open the clipboard */ @@ -347,11 +347,11 @@
} /* will fail if not thread (closed) or not open by me*/ - return FALSE; -} + return FALSE; +}
/* IntClipboardFreeWindow it's called when a window was destroyed */ -VOID FASTCALL +VOID FASTCALL IntClipboardFreeWindow(PWINDOW_OBJECT window) { /* called from co_UserFreeWindow in window.c */ @@ -375,8 +375,8 @@ PCLIPBOARDCHAINELEMENT w = IntRemoveWindowFromChain(window); if (w) { - ExFreePool(w); - } + ExFreePool(w); + } } }
@@ -388,10 +388,10 @@ BOOL ret = FALSE;
UserEnterExclusive(); - + sendDrawClipboardMsg = FALSE; recentlySetClipboard = FALSE; - + if (ClipboardThread) { /* clipboard is already open */ @@ -415,17 +415,17 @@ } else { - + if (hWnd != NULL) { Window = UserGetWindowObject(hWnd); - + if (Window != NULL) { ClipboardWindow = Window; ClipboardThread = PsGetCurrentThreadWin32Thread(); - ret = TRUE; - } + ret = TRUE; + } else { ClipboardWindow = NULL; @@ -438,12 +438,12 @@ { ClipboardWindow = NULL; ClipboardThread = PsGetCurrentThreadWin32Thread(); - ret = TRUE; - } - } - - UserLeave(); - + ret = TRUE; + } + } + + UserLeave(); + return ret; }
@@ -451,50 +451,50 @@ NtUserCloseClipboard(VOID) { BOOL ret = FALSE; - + UserEnterExclusive(); - + if (intIsClipboardOpenByMe()) { ClipboardWindow = NULL; ClipboardThread = NULL; - ret = TRUE; + ret = TRUE; } else { SetLastWin32Error(ERROR_CLIPBOARD_NOT_OPEN); } - + recentlySetClipboard = FALSE; - - UserLeave(); - + + UserLeave(); + if (sendDrawClipboardMsg && WindowsChain) { /* only send message to the first window in the chain, then they'll do the chain */ - /* commented because it makes a crash in co_MsqSendMessage + /* commented because it makes a crash in co_MsqSendMessage ASSERT(WindowsChain->window); ASSERT(WindowsChain->window->hSelf); DPRINT1("Clipboard: sending WM_DRAWCLIPBOARD to %p\n", WindowsChain->window->hSelf); co_IntSendMessage(WindowsChain->window->hSelf, WM_DRAWCLIPBOARD, 0, 0); */ } - + return ret; }
HWND STDCALL NtUserGetOpenClipboardWindow(VOID) { - HWND ret = NULL; + HWND ret = NULL;
UserEnterShared(); - + if (ClipboardWindow) { ret = ClipboardWindow->hSelf; } - + UserLeave();
return ret; @@ -505,11 +505,11 @@ { BOOL ret = FALSE; PCLIPBOARDCHAINELEMENT w = NULL; - + UserEnterExclusive(); - - PWINDOW_OBJECT removeWindow = UserGetWindowObject(hWndRemove); - + + PWINDOW_OBJECT removeWindow = UserGetWindowObject(hWndRemove); + if (removeWindow) { if ((ret = !!IntIsWindowInChain(removeWindow))) @@ -517,21 +517,21 @@ w = IntRemoveWindowFromChain(removeWindow); if (w) { - ExFreePool(w); + ExFreePool(w); } } } - + if (ret && WindowsChain) { - // only send message to the first window in the chain, - // then they do the chain + // only send message to the first window in the chain, + // then they do the chain DPRINT1("Message: WM_CHANGECBCHAIN to %p", WindowsChain->window->hSelf); /* WindowsChain->window may be NULL */ LPARAM lparam = WindowsChain->window == NULL ? 0 : (LPARAM)WindowsChain->window->hSelf; co_IntSendMessage(WindowsChain->window->hSelf, WM_CHANGECBCHAIN, (WPARAM)hWndRemove, lparam); - } - + } + UserLeave();
return ret; @@ -540,8 +540,8 @@ DWORD STDCALL NtUserCountClipboardFormats(VOID) { - DWORD ret = 0; - + DWORD ret = 0; + if (ClipboardData) { ret = IntCountClipboardFormats(); @@ -554,36 +554,36 @@ NtUserEmptyClipboard(VOID) { BOOL ret = FALSE; - + UserEnterExclusive(); - + if (intIsClipboardOpenByMe()) { if (ClipboardData) { IntEmptyClipboardData(); } - + ClipboardOwnerWindow = ClipboardWindow; ClipboardOwnerThread = ClipboardThread; - + IntIncrementSequenceNumber(); - + ret = TRUE; } else { SetLastWin32Error(ERROR_CLIPBOARD_NOT_OPEN); - } - + } + if (ret && ClipboardOwnerWindow) { DPRINT1("Clipboard: WM_DESTROYCLIPBOARD to %p", ClipboardOwnerWindow->hSelf); - co_IntSendMessage( ClipboardOwnerWindow->hSelf, WM_DESTROYCLIPBOARD, 0, 0); - } - - UserLeave(); - + co_IntSendMessage( ClipboardOwnerWindow->hSelf, WM_DESTROYCLIPBOARD, 0, 0); + } + + UserLeave(); + return ret; }
@@ -592,16 +592,16 @@ { HANDLE ret = NULL; PCHAR buffer; - + UserEnterShared(); - + if (intIsClipboardOpenByMe()) { /* when Unknown1 is zero, we returns to user32 the data size */ if (Unknown1 == 0) { PCLIPBOARDELEMENT data = intIsFormatAvailable(uFormat); - + if (data) { /* format exists in clipboard */ @@ -611,19 +611,19 @@ if (ClipboardOwnerWindow) { ASSERT(ClipboardOwnerWindow->hSelf); - co_IntSendMessage(ClipboardOwnerWindow->hSelf, WM_RENDERFORMAT, (WPARAM)uFormat, 0); + co_IntSendMessage(ClipboardOwnerWindow->hSelf, WM_RENDERFORMAT, (WPARAM)uFormat, 0); data = intIsFormatAvailable(uFormat); ASSERT(data->size); ret = (HANDLE)data->size; } } else - { + { if (data->size == DATA_SYNTHESIZED_RENDER) { data->size = synthesizeData(uFormat); } - + } ret = (HANDLE)data->size; } @@ -636,7 +636,7 @@ else { PCLIPBOARDELEMENT data = intIsFormatAvailable(uFormat); - + if (data) { if (data->size == DATA_DELAYED_RENDER) @@ -659,18 +659,18 @@ else { buffer = (PCHAR)Unknown1; - memcpy(buffer, (PCHAR)synthesizedData, synthesizedDataSize); - + memcpy(buffer, (PCHAR)synthesizedData, synthesizedDataSize); + freeSynthesizedData(); - + ret = (HANDLE)Unknown1; } } else { buffer = (PCHAR)Unknown1; - memcpy(buffer, (PCHAR)data->hData, data->size); - + memcpy(buffer, (PCHAR)data->hData, data->size); + ret = (HANDLE)Unknown1; } } @@ -682,10 +682,10 @@ else { SetLastWin32Error(ERROR_CLIPBOARD_NOT_OPEN); - } - - UserLeave(); - + } + + UserLeave(); + return ret; }
@@ -695,28 +695,28 @@ { UNICODE_STRING sFormatName; INT ret = 0; - + /* if the format is built-in we fail */ if (format < 0xc000) { /* registetrated formats are >= 0xc000 */ return 0; } - + if((cchMaxCount < 1) || !FormatName) { SetLastWin32Error(ERROR_INVALID_PARAMETER); return 0; } - + _SEH_TRY { ProbeForWriteUnicodeString(FormatName); sFormatName = *(volatile UNICODE_STRING *)FormatName; ProbeForWrite(sFormatName.Buffer, sFormatName.MaximumLength, 1); - + ret = IntGetAtomName((RTL_ATOM)format, sFormatName.Buffer, cchMaxCount * sizeof(WCHAR)); - + if (ret >= 0) { ret = ret / sizeof(WCHAR); @@ -732,7 +732,7 @@ SetLastNtError(_SEH_GetExceptionCode()); } _SEH_END; - + return ret; }
@@ -741,20 +741,20 @@ { UINT ret = 0; UNICODE_STRING cFormatName = {0}; - + if (FormatName == NULL) { SetLastWin32Error(ERROR_INVALID_PARAMETER); return ret; } - + UserEnterExclusive(); - + _SEH_TRY { - cFormatName = ProbeForReadUnicodeString(FormatName); - - if (cFormatName.Length > 0) + cFormatName = ProbeForReadUnicodeString(FormatName); + + if (cFormatName.Length > 0) { ret = (UINT)IntAddAtom(cFormatName.Buffer); //RtlFreeUnicodeString(&cFormatName); @@ -762,9 +762,9 @@ else { SetLastWin32Error(ERROR_INVALID_NAME); - _SEH_LEAVE; - } - + _SEH_LEAVE; + } + } _SEH_HANDLE { @@ -773,42 +773,42 @@ _SEH_END;
UserLeave(); - - return ret; -} - + + return ret; +} +
HWND STDCALL NtUserGetClipboardOwner(VOID) { - HWND ret = NULL; - + HWND ret = NULL; + UserEnterShared(); - + if (ClipboardOwnerWindow) { ret = ClipboardOwnerWindow->hSelf; } - - UserLeave(); - + + UserLeave(); + return ret; }
HWND STDCALL NtUserGetClipboardViewer(VOID) { - HWND ret = NULL; - + HWND ret = NULL; + UserEnterShared(); - + if (WindowsChain) { ret = WindowsChain->window->hSelf; } - - UserLeave(); - + + UserLeave(); + return ret; }
@@ -823,18 +823,18 @@
_SEH_TRY { - if (IntCountClipboardFormats() == 0) + if (IntCountClipboardFormats() == 0) { ret = 0; } else { ProbeForRead(paFormatPriorityList, cFormats, sizeof(UINT)); - + priorityList = paFormatPriorityList; - + ret = -1; - + for (i = 0; i < cFormats; i++) { if (intIsFormatAvailable(priorityList[i])) @@ -843,7 +843,7 @@ break; } } - + } } _SEH_HANDLE @@ -855,20 +855,20 @@ UserLeave();
return ret; - + }
BOOL STDCALL NtUserIsClipboardFormatAvailable(UINT format) { BOOL ret = FALSE; - + UserEnterShared(); - + ret = (intIsFormatAvailable(format) != NULL); - - UserLeave(); - + + UserLeave(); + return ret; }
@@ -881,16 +881,16 @@ UNICODE_STRING unicodeString; OEM_STRING oemString; ANSI_STRING ansiString; - + UserEnterExclusive(); - + /* to place data here the we need to be the owner */ if (ClipboardOwnerThread == PsGetCurrentThreadWin32Thread()) { PCLIPBOARDELEMENT data = intIsFormatAvailable(uFormat); if (data) { - + if (data->size == DATA_DELAYED_RENDER) { intRemoveFormatedData(uFormat); @@ -901,7 +901,7 @@ goto exit_setCB; } } - + if (hMem) { _SEH_TRY @@ -911,19 +911,19 @@ _SEH_HANDLE { SetLastNtError(_SEH_GetExceptionCode()); - goto exit_setCB; + _SEH_YIELD(goto exit_setCB); } _SEH_END; - + if (intIsClipboardOpenByMe()) { - delayedRender = FALSE; + delayedRender = FALSE; }
if (!canSinthesize(uFormat)) { hCBData = ExAllocatePool(PagedPool, size); - memcpy(hCBData, hMem, size); + memcpy(hCBData, hMem, size); intAddFormatedData(uFormat, hCBData, size); DPRINT1("Data stored\n"); } @@ -931,13 +931,13 @@ sendDrawClipboardMsg = TRUE; recentlySetClipboard = TRUE; lastEnumClipboardFormats = uFormat; - + /* conversions */ switch (uFormat) { - case CF_TEXT: + case CF_TEXT: { - //TODO : sinthesize CF_UNICODETEXT & CF_OEMTEXT + //TODO : sinthesize CF_UNICODETEXT & CF_OEMTEXT // CF_TEXT -> CF_UNICODETEXT RtlAnsiStringToUnicodeString(&unicodeString, hCBData, TRUE); intAddFormatedData(CF_UNICODETEXT, unicodeString.Buffer, unicodeString.Length * sizeof(WCHAR)); @@ -976,16 +976,16 @@ } case CF_BITMAP: { - // we need to render the DIB or DIBV5 format as soon as possible + // we need to render the DIB or DIBV5 format as soon as possible // because pallette information may change - + HDC hdc; INT ret; BITMAP bm; BITMAPINFO bi; - + hdc = UserGetDCEx(NULL, NULL, DCX_USESTYLE); - + BITMAPOBJ *BitmapObj; BitmapObj = BITMAPOBJ_LockBitmap(hMem); BITMAP_GetObject(BitmapObj, sizeof(BITMAP), (LPSTR)&bm); @@ -993,7 +993,7 @@ { BITMAPOBJ_UnlockBitmap(BitmapObj); } - + bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bi.bmiHeader.biWidth = bm.bmWidth; bi.bmiHeader.biHeight = bm.bmHeight; @@ -1003,24 +1003,24 @@ bi.bmiHeader.biSizeImage = 0; bi.bmiHeader.biXPelsPerMeter = 0; bi.bmiHeader.biYPelsPerMeter = 0; - bi.bmiHeader.biClrUsed = 0; - + bi.bmiHeader.biClrUsed = 0; + ret = NtGdiGetDIBits(hdc, hMem, 0, bm.bmHeight, NULL, &bi, DIB_RGB_COLORS); - + size = bi.bmiHeader.biSizeImage + sizeof(BITMAPINFOHEADER); - + hCBData = ExAllocatePool(PagedPool, size); - memcpy(hCBData, &bi, sizeof(BITMAPINFOHEADER)); - + memcpy(hCBData, &bi, sizeof(BITMAPINFOHEADER)); + ret = NtGdiGetDIBits(hdc, hMem, 0, bm.bmHeight, (LPBYTE)hCBData + sizeof(BITMAPINFOHEADER), &bi, DIB_RGB_COLORS); - + UserReleaseDC(NULL, hdc, FALSE); - + intAddFormatedData(CF_DIB, hCBData, size); intAddFormatedData(CF_BITMAP, 0, DATA_SYNTHESIZED_RENDER); // intAddFormatedData(CF_DIBV5, hCBData, size); - - break; + + break; } case CF_DIB: { @@ -1028,21 +1028,21 @@ // intAddFormatedData(CF_DIBV5, hCBData, size); /* investigate */ // intAddFormatedData(CF_PALETTE, hCBData, size); - break; + break; } case CF_DIBV5: // intAddFormatedData(CF_BITMAP, hCBData, size); // intAddFormatedData(CF_PALETTE, hCBData, size); // intAddFormatedData(CF_DIB, hCBData, size); - break; + break; case CF_ENHMETAFILE: // intAddFormatedData(CF_METAFILEPICT, hCBData, size); - break; + break; case CF_METAFILEPICT: // intAddFormatedData(CF_ENHMETAFILE, hCBData, size); - break; - } - + break; + } + } else { @@ -1052,14 +1052,14 @@ intAddFormatedData(uFormat, NULL, 0); DPRINT1("SetClipboardData delayed format: %d\n", uFormat); } - - - } - -exit_setCB: - - UserLeave(); - + + + } + +exit_setCB: + + UserLeave(); + return hMem; }
@@ -1068,21 +1068,21 @@ { HWND ret = NULL; PCLIPBOARDCHAINELEMENT newWC = NULL; - + UserEnterExclusive();
- PWINDOW_OBJECT window = UserGetWindowObject(hWndNewViewer); - + PWINDOW_OBJECT window = UserGetWindowObject(hWndNewViewer); + if (window) { if ((newWC = IntAddWindowToChain(window))) { if (newWC) { - // newWC->next may be NULL if we are the first window in the chain + // newWC->next may be NULL if we are the first window in the chain if (newWC->next) { - // return the next HWND available window in the chain + // return the next HWND available window in the chain ret = newWC->next->window->hSelf; } } @@ -1098,9 +1098,9 @@ NtUserEnumClipboardFormats(UINT uFormat) { UINT ret = 0; - + UserEnterShared(); - + if (intIsClipboardOpenByMe()) { if (uFormat == 0) @@ -1131,7 +1131,7 @@
if (data) { - if (data->next) + if (data->next) { ret = data->next->format; } @@ -1142,29 +1142,29 @@ } } } - + } } else { - SetLastWin32Error(ERROR_CLIPBOARD_NOT_OPEN); - } - - UserLeave(); - - return ret; -} - -// This number is incremented whenever the contents of the clipboard change + SetLastWin32Error(ERROR_CLIPBOARD_NOT_OPEN); + } + + UserLeave(); + + return ret; +} + +// This number is incremented whenever the contents of the clipboard change // or the clipboard is emptied. -// If clipboard rendering is delayed, +// If clipboard rendering is delayed, // the sequence number is not incremented until the changes are rendered. VOID FASTCALL IntIncrementSequenceNumber(VOID) {
USE_WINSTA - + WINSTA_ClipboardSequenceNumber++;
} @@ -1173,16 +1173,16 @@ NtUserGetClipboardSequenceNumber(VOID) { //windowstation sequence number - //if no WINSTA_ACCESSCLIPBOARD access to the window station, + //if no WINSTA_ACCESSCLIPBOARD access to the window station, //the function returns zero. - DWORD sn; - + DWORD sn; + HWINSTA WinSta; PWINSTATION_OBJECT WinStaObj; NTSTATUS Status; - + WinSta = UserGetProcessWindowStation(); - + Status = IntValidateWindowStationHandle(WinSta, UserMode, WINSTA_ACCESSCLIPBOARD, &WinStaObj);
if (!NT_SUCCESS(Status)) @@ -1191,14 +1191,14 @@ SetLastNtError(Status); return 0; } - + sn = WinStaObj->ClipboardSequenceNumber; - + ObDereferenceObject(WinStaObj); - + //local copy //sn = ClipboardSequenceNumber; - + return sn; }
@@ -1213,7 +1213,7 @@ return FALSE; }
-BOOL STDCALL NtUserRemoveClipboardFormatListener( +BOOL STDCALL NtUserRemoveClipboardFormatListener( HWND hwnd ) { @@ -1221,7 +1221,7 @@ return FALSE; }
-BOOL STDCALL NtUserGetUpdatedClipboardFormats( +BOOL STDCALL NtUserGetUpdatedClipboardFormats( PUINT lpuiFormats, UINT cFormats, PUINT pcFormatsOut
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c Sun Apr 1 04:07:25 2007 @@ -70,7 +70,7 @@ PWINDOW_OBJECT FASTCALL IntGetWindowObject(HWND hWnd) { PWINDOW_OBJECT Window; - + if (!hWnd) return NULL;
Window = UserGetWindowObject(hWnd); @@ -100,11 +100,11 @@ }
if (!hWnd) - { + { SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); return NULL; } - + Window = (PWINDOW_OBJECT)UserGetObject(gHandleTable, hWnd, otWindow); if (!Window || 0 != (Window->Status & WINDOWSTATUS_DESTROYED)) { @@ -146,7 +146,7 @@
-/* +/* Caller must NOT dereference retval! But if caller want the returned value to persist spanning a co_ call, it must reference the value (because the owner is not garanteed to @@ -168,7 +168,7 @@ }
-/* +/* Caller must NOT dereference retval! But if caller want the returned value to persist spanning a co_ call, it must reference the value (because the owner is not garanteed to @@ -243,7 +243,7 @@ { // USER_REFERENCE_ENTRY Ref; // UserRefObjectCo(Window, &Ref); - + if (!IntGetOwner(Window) && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM) hWnd); @@ -299,7 +299,7 @@ * * This is the "functional" DestroyWindows function ei. all stuff * done in CreateWindow is undone here and not in DestroyWindow:-P - + */ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window, PW32PROCESS ProcessData, @@ -351,7 +351,7 @@ } else co_UserFreeWindow(Child, ProcessData, ThreadData, SendMessages); - + UserDerefObject(Child); } } @@ -461,7 +461,7 @@
UserDerefObject(Window);
- IntClipboardFreeWindow(Window); + IntClipboardFreeWindow(Window);
return 0; } @@ -641,7 +641,7 @@ PWINDOW_OBJECT Wnd; USER_REFERENCE_ENTRY Ref; WThread = (PW32THREAD)Thread->Tcb.Win32Thread; - + while (!IsListEmpty(&WThread->WindowListHead)) { Current = WThread->WindowListHead.Flink; @@ -650,14 +650,14 @@ DPRINT("thread cleanup: while destroy wnds, wnd=0x%x\n",Wnd);
/* window removes itself from the list */ - + /* fixme: it is critical that the window removes itself! if now, we will loop here forever... */ - + //ASSERT(co_UserDestroyWindow(Wnd)); - + UserRefObjectCo(Wnd, &Ref);//faxme: temp hack?? if (!co_UserDestroyWindow(Wnd)) { @@ -973,9 +973,9 @@ return NULL;
WndOldParent = Wnd->Parent; - + if (WndOldParent) UserRefObject(WndOldParent); /* caller must deref */ - + if (WndNewParent != WndOldParent) { IntUnlinkWindow(Wnd); @@ -1032,7 +1032,7 @@ of IntSetParent() */ // return WndOldParent; // } - + return WndOldParent;//NULL; }
@@ -1583,7 +1583,7 @@ Window->MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue; IntReferenceMessageQueue(Window->MessageQueue); Window->Parent = ParentWindow; - + if((OwnerWindow = UserGetWindowObject(OwnerWindowHandle))) { Window->hOwner = OwnerWindowHandle; @@ -1594,7 +1594,7 @@ Window->hOwner = NULL; HasOwner = FALSE; } - + Window->UserData = 0;
Window->IsSystem = Window->Class->System; @@ -1755,11 +1755,11 @@ Pos.y = rc.top; }
-/* +/* According to wine, the ShowMode is set to y if x == CW_USEDEFAULT(16) and y is something else. and Quote! */ - + /* Never believe Microsoft's documentation... CreateWindowEx doc says * that if an overlapped window is created with WS_VISIBLE style bit * set and the x parameter is set to CW_USEDEFAULT, the system ignores @@ -1891,7 +1891,7 @@ MaxPos.x = Window->WindowRect.left; MaxPos.y = Window->WindowRect.top;
- + DPRINT("IntCreateWindowEx(): About to get non-client size.\n"); /* WinPosGetNonClientSize SENDS THE WM_NCCALCSIZE message */ Result = co_WinPosGetNonClientSize(Window, @@ -1909,9 +1909,9 @@ if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) { PWINDOW_OBJECT PrevSibling; - + PrevSibling = ParentWindow->LastChild; - + /* link window as bottom sibling */ IntLinkWindow(Window, ParentWindow, PrevSibling /*prev sibling*/); } @@ -1933,7 +1933,7 @@ { InsertAfter = NULL; } - + IntLinkWindow(Window, ParentWindow, InsertAfter /* prev sibling */);
} @@ -1943,7 +1943,7 @@ DPRINT("IntCreateWindowEx(): about to send CREATE message.\n"); Result = co_IntSendMessage(Window->hSelf, WM_CREATE, 0, (LPARAM) &Cs);
- + if (Result == (LRESULT)-1) { /* FIXME: Cleanup. */ @@ -1987,14 +1987,14 @@ Window->ClientRect.top); }
- + co_IntSendMessage(Window->hSelf, WM_MOVE, 0, lParam);
/* Call WNDOBJ change procs */ IntEngWindowChanged(Window, WOC_RGN_CLIENT);
- + }
/* Show or maybe minimize or maximize the window. */ @@ -2329,7 +2329,7 @@ UserDerefObjectCo(Window);//faxme: dunno if win should be reffed during destroy..
RETURN(ret); - + CLEANUP: DPRINT("Leave NtUserDestroyWindow, ret=%i\n",_ret_); UserLeave(); @@ -2513,7 +2513,7 @@ _SEH_HANDLE { SetLastNtError(_SEH_GetExceptionCode()); - RETURN(NULL); + _SEH_YIELD(RETURN(NULL)); } _SEH_END;
@@ -2710,7 +2710,7 @@ for (;;) { PWINDOW_OBJECT Parent, Old; - + Old = WndAncestor; Parent = IntGetParent(WndAncestor);
@@ -2718,10 +2718,10 @@ { break; } - + //temp hack // UserDerefObject(Parent); - + WndAncestor = Parent; } break; @@ -2749,7 +2749,7 @@
DPRINT("Enter NtUserGetAncestor\n"); UserEnterExclusive(); - + if (!(Window = UserGetWindowObject(hWnd))) { RETURN(NULL); @@ -2757,7 +2757,7 @@
Ancestor = UserGetAncestor(Window, Type); /* faxme: can UserGetAncestor ever return NULL for a valid window? */ - + RETURN(Ancestor ? Ancestor->hSelf : NULL);
CLEANUP: @@ -2956,9 +2956,9 @@
UserRefObjectCo(Wnd, &Ref); UserRefObjectCo(WndParent, &ParentRef); - + WndOldParent = co_IntSetParent(Wnd, WndParent); - + UserDerefObjectCo(WndParent); UserDerefObjectCo(Wnd);
@@ -3931,12 +3931,12 @@
/* QueryWindow based on KJK::Hyperion and James Tabor. - + 0 = QWUniqueProcessId 1 = QWUniqueThreadId 4 = QWIsHung Implements IsHungAppWindow found by KJK::Hyperion. - + 9 = QWKillWindow When I called this with hWnd == DesktopWindow, it shutdown the system and rebooted. @@ -4475,13 +4475,13 @@ //hmm... threads live on desktops thus we have a reference on the desktop and indirectly the desktop window //its possible this referencing is useless, thou it shouldnt hurt... UserRefObjectCo(DesktopWindow, &Ref); - + Hit = co_WinPosWindowFromPoint(DesktopWindow, PsGetCurrentThreadWin32Thread()->MessageQueue, &pt, &Window); - + if(Window) { Ret = Window->hSelf; - + RETURN( Ret); } }
Modified: trunk/reactos/subsystems/win32/win32k/win32k.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/win... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/win32k.rbuild (original) +++ trunk/reactos/subsystems/win32/win32k/win32k.rbuild Sun Apr 1 04:07:25 2007 @@ -1,7 +1,7 @@ <module name="win32k_base" type="objectlibrary"> <include base="win32k">.</include> <include base="win32k">include</include> - <include base="ntoskrnl">include</include> + <include base="ntoskrnl">include</include> <include base="freetype">include</include> <include base="ReactOS">include/reactos/subsys</include> <include base="ReactOS">include/reactos/drivers</include> @@ -9,7 +9,6 @@ <define name="__USE_W32API" /> <define name="_WIN32_WINNT">0x0501</define> <define name="WINVER">0x600</define> - <define name="_SEH_NO_NATIVE_NLG" /> <define name="_WIN32K_" /> <pch>w32k.h</pch>
@@ -33,14 +32,14 @@ </directory> </if>
- <ifnot property="ARCH" value="i386"> + <ifnot property="ARCH" value="i386"> <file>dib24bppc.c</file> <file>dib32bppc.c</file> - </ifnot> + </ifnot>
</directory>
- +
<directory name="eng"> @@ -93,7 +92,7 @@ <file>floor_asm.s</file> <file>ceil_asm.s</file> </directory> - </if> + </if> </directory> <directory name="ntddraw"> <compilationunit name="ntddraw.c"> @@ -127,7 +126,7 @@ <file>misc.c</file> <file>monitor.c</file> <file>msgqueue.c</file> - <file>ntuser.c</file> + <file>ntuser.c</file> <file>painting.c</file> <file>prop.c</file> <file>scrollbar.c</file>
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/... ============================================================================== --- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original) +++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Sun Apr 1 04:07:25 2007 @@ -1556,19 +1556,18 @@ fprintf ( fMakefile, "\t$(ECHO_LD)\n" ); string targetName ( module.GetTargetName () );
- string killAt = module.mangledSymbols ? "" : "--kill-at"; - if ( module.IsDLL () ) { string temp_exp = ros_temp + module.name + ".temp.exp"; CLEAN_FILE ( temp_exp );
fprintf ( fMakefile, - "\t${dlltool} --dllname %s --def %s --output-exp %s %s\n", + "\t${dlltool} --dllname %s --def %s --output-exp %s %s %s\n", targetName.c_str (), definitionFilename.c_str (), temp_exp.c_str (), - killAt.c_str () ); + module.mangledSymbols ? "" : "--kill-at", + module.underscoreSymbols ? "--add-underscore" : "" );
fprintf ( fMakefile, "\t%s %s %s %s -o %s %s %s %s\n", @@ -1741,10 +1740,11 @@ string definitionFilename ( GetDefinitionFilename () );
fprintf ( fMakefile, - "\t${dlltool} --dllname %s --def %s --output-lib $@ %s -U\n", + "\t${dlltool} --dllname %s --def %s --output-lib $@ %s %s\n", module.importLibrary->dllname.c_str (), definitionFilename.c_str (), - module.mangledSymbols ? "" : "--kill-at" ); + module.mangledSymbols ? "" : "--kill-at", + module.underscoreSymbols ? "--add-underscore" : "" ); }
fprintf ( fMakefile, "\t$(ECHO_AR)\n" ); @@ -2199,13 +2199,13 @@
fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" );
- string killAt = module.mangledSymbols ? "" : "--kill-at"; fprintf ( fMakefile, - "\t${dlltool} --dllname %s --def %s --output-lib %s %s\n\n", + "\t${dlltool} --dllname %s --def %s --output-lib %s %s %s\n\n", module.GetTargetName ().c_str (), defFilename.c_str (), library_target.c_str (), - killAt.c_str () ); + module.mangledSymbols ? "" : "--kill-at", + module.underscoreSymbols ? "--add-underscore" : "" ); } }
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/... ============================================================================== --- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h (original) +++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h Sun Apr 1 04:07:25 2007 @@ -244,7 +244,6 @@ MingwKernelModuleHandler ( const Module& module ); virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); - std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; } private: void GenerateKernelModuleTarget (); }; @@ -278,7 +277,6 @@ MingwKernelModeDLLModuleHandler ( const Module& module ); virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); - std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; } std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } void AddImplicitLibraries ( Module& module ); private: @@ -292,7 +290,7 @@ MingwKernelModeDriverModuleHandler ( const Module& module ); virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); - std::string TypeSpecificCFlags() { return "-D__NTDRIVER__ -D_SEH_NO_NATIVE_NLG"; } + std::string TypeSpecificCFlags() { return "-D__NTDRIVER__"; } std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } void AddImplicitLibraries ( Module& module ); private: @@ -306,7 +304,6 @@ MingwNativeDLLModuleHandler ( const Module& module ); virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); - std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; } std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } void AddImplicitLibraries ( Module& module ); private: @@ -320,7 +317,7 @@ MingwNativeCUIModuleHandler ( const Module& module ); virtual HostType DefaultHost() { return HostFalse; } virtual void Process (); - std::string TypeSpecificCFlags() { return "-D__NTAPP__ -D_SEH_NO_NATIVE_NLG"; } + std::string TypeSpecificCFlags() { return "-D__NTAPP__"; } std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } void AddImplicitLibraries ( Module& module ); private:
Modified: trunk/reactos/tools/rbuild/module.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/module.cpp?rev... ============================================================================== --- trunk/reactos/tools/rbuild/module.cpp (original) +++ trunk/reactos/tools/rbuild/module.cpp Sun Apr 1 04:07:25 2007 @@ -142,7 +142,7 @@ if (index == string::npos) index = 0; string tmp = filename.substr( index, filename.size() - index ); size_t ext_index = tmp.find_last_of( '.' ); - if (ext_index != string::npos) + if (ext_index != string::npos) return filename.substr ( index + ext_index, filename.size() ); return ""; } @@ -373,6 +373,12 @@ else mangledSymbols = false;
+ att = moduleNode.GetAttribute ( "underscoresymbols", false ); + if ( att != NULL ) + underscoreSymbols = att->value == "true"; + else + underscoreSymbols = false; + att = moduleNode.GetAttribute ( "host", false ); if ( att != NULL ) { @@ -424,7 +430,7 @@ installName = att->value; else installName = ""; - + att = moduleNode.GetAttribute ( "usewrc", false ); if ( att != NULL ) useWRC = att->value == "true"; @@ -1451,7 +1457,7 @@ void If::ProcessXML() { - + }
Modified: trunk/reactos/tools/rbuild/project.dtd URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/project.dtd?re... ============================================================================== --- trunk/reactos/tools/rbuild/project.dtd (original) +++ trunk/reactos/tools/rbuild/project.dtd Sun Apr 1 04:07:25 2007 @@ -82,6 +82,7 @@ entrypoint %CIdentifier; #IMPLIED baseaddress %CIdentifier; #IMPLIED mangledsymbols %Text; #IMPLIED + underscoresymbols (true|false) "false" installbase %Text; #IMPLIED installname %Text; #IMPLIED usewrc %Text; #IMPLIED
Modified: trunk/reactos/tools/rbuild/rbuild.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=2... ============================================================================== --- trunk/reactos/tools/rbuild/rbuild.h (original) +++ trunk/reactos/tools/rbuild/rbuild.h Sun Apr 1 04:07:25 2007 @@ -296,6 +296,7 @@ ModuleType type; ImportLibrary* importLibrary; bool mangledSymbols; + bool underscoreSymbols; bool isUnicode; bool isDefaultEntryPoint; Bootstrap* bootstrap;