[ros-dev] [ros-diffs] [gadamopoulos] 66457: [USER32] - button.c: Use NtUserAlterWindowStyle where wine uses WIN_SetStyle (usage and parameters were confirmed with windbg) [NTUSER] - Implement NtUserAlterWindowStyle. Fix...

Timo Kreuzer timo.kreuzer at web.de
Thu Feb 26 21:38:15 UTC 2015


Why don't we use a macro or wrapper function, unstead of hacking shared 
code everywhere?

Am 25.02.2015 um 21:02 schrieb gadamopoulos at svn.reactos.org:
> Author: gadamopoulos
> Date: Wed Feb 25 20:02:10 2015
> New Revision: 66457
>
> URL: http://svn.reactos.org/svn/reactos?rev=66457&view=rev
> Log:
> [USER32]
> - button.c: Use NtUserAlterWindowStyle where wine uses WIN_SetStyle (usage and parameters were confirmed with windbg)
>
> [NTUSER]
> - Implement NtUserAlterWindowStyle.
>
> Fixes remaining failures in user32:msg_controls test.
>
> Modified:
>      trunk/reactos/win32ss/user/ntuser/ntstubs.c
>      trunk/reactos/win32ss/user/ntuser/window.c
>      trunk/reactos/win32ss/user/user32/controls/button.c
>
> Modified: trunk/reactos/win32ss/user/ntuser/ntstubs.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/ntstubs.c?rev=66457&r1=66456&r2=66457&view=diff
> ==============================================================================
> --- trunk/reactos/win32ss/user/ntuser/ntstubs.c	[iso-8859-1] (original)
> +++ trunk/reactos/win32ss/user/ntuser/ntstubs.c	[iso-8859-1] Wed Feb 25 20:02:10 2015
> @@ -1157,19 +1157,6 @@
>       return 0;
>   }
>   
> -/*
> - * @unimplemented
> - */
> -DWORD APIENTRY
> -NtUserAlterWindowStyle(DWORD Unknown0,
> -                       DWORD Unknown1,
> -                       DWORD Unknown2)
> -{
> -   STUB
> -
> -   return(0);
> -}
> -
>   BOOL APIENTRY NtUserAddClipboardFormatListener(
>       HWND hwnd
>   )
>
> Modified: trunk/reactos/win32ss/user/ntuser/window.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window.c?rev=66457&r1=66456&r2=66457&view=diff
> ==============================================================================
> --- trunk/reactos/win32ss/user/ntuser/window.c	[iso-8859-1] (original)
> +++ trunk/reactos/win32ss/user/ntuser/window.c	[iso-8859-1] Wed Feb 25 20:02:10 2015
> @@ -3537,8 +3537,8 @@
>         return FALSE;
>   }
>   
> -LONG FASTCALL
> -co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
> +static LONG
> +co_IntSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi, BOOL bAlter)
>   {
>      PWND Window, Parent;
>      PWINSTATION_OBJECT WindowStation;
> @@ -3597,6 +3597,7 @@
>                  Style.styleNew &= ~WS_EX_WINDOWEDGE;
>   
>               Window->ExStyle = (DWORD)Style.styleNew;
> +
>               co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_EXSTYLE, (LPARAM) &Style);
>               break;
>   
> @@ -3604,7 +3605,9 @@
>               OldValue = (LONG) Window->style;
>               Style.styleOld = OldValue;
>               Style.styleNew = NewValue;
> -            co_IntSendMessage(hWnd, WM_STYLECHANGING, GWL_STYLE, (LPARAM) &Style);
> +
> +            if (!bAlter)
> +                co_IntSendMessage(hWnd, WM_STYLECHANGING, GWL_STYLE, (LPARAM) &Style);
>   
>              /* WS_CLIPSIBLINGS can't be reset on top-level windows */
>               if (Window->spwndParent == UserGetDesktopWindow()) Style.styleNew |= WS_CLIPSIBLINGS;
> @@ -3621,7 +3624,9 @@
>                  DceResetActiveDCEs( Window );
>               }
>               Window->style = (DWORD)Style.styleNew;
> -            co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_STYLE, (LPARAM) &Style);
> +
> +            if (!bAlter)
> +                co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_STYLE, (LPARAM) &Style);
>               break;
>   
>            case GWL_WNDPROC:
> @@ -3672,6 +3677,13 @@
>      return( OldValue);
>   }
>   
> +
> +LONG FASTCALL
> +co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
> +{
> +    return co_IntSetWindowLong(hWnd, Index, NewValue, Ansi, FALSE);
> +}
> +
>   /*
>    * NtUserSetWindowLong
>    *
> @@ -3686,24 +3698,45 @@
>   LONG APIENTRY
>   NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
>   {
> -   DECLARE_RETURN(LONG);
> -
> -   TRACE("Enter NtUserSetWindowLong\n");
> +   LONG ret;
> +
>      UserEnterExclusive();
>   
>      if (hWnd == IntGetDesktopWindow())
>      {
>         EngSetLastError(STATUS_ACCESS_DENIED);
> -      RETURN( 0);
> -   }
> -
> -   RETURN( co_UserSetWindowLong(hWnd, Index, NewValue, Ansi));
> -
> -CLEANUP:
> -   TRACE("Leave NtUserSetWindowLong, ret=%i\n",_ret_);
> +      UserLeave();
> +      return 0;
> +   }
> +
> +   ret = co_IntSetWindowLong(hWnd, Index, NewValue, Ansi, FALSE);
> +
>      UserLeave();
> -   END_CLEANUP;
> -}
> +
> +   return ret;
> +}
> +
> +DWORD APIENTRY
> +NtUserAlterWindowStyle(HWND hWnd, DWORD Index, LONG NewValue)
> +{
> +   LONG ret;
> +
> +   UserEnterExclusive();
> +
> +   if (hWnd == IntGetDesktopWindow())
> +   {
> +      EngSetLastError(STATUS_ACCESS_DENIED);
> +      UserLeave();
> +      return 0;
> +   }
> +
> +   ret = co_IntSetWindowLong(hWnd, Index, NewValue, FALSE, TRUE);
> +
> +   UserLeave();
> +
> +   return ret;
> +}
> +
>   
>   /*
>    * NtUserSetWindowWord
>
> Modified: trunk/reactos/win32ss/user/user32/controls/button.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/controls/button.c?rev=66457&r1=66456&r2=66457&view=diff
> ==============================================================================
> --- trunk/reactos/win32ss/user/user32/controls/button.c	[iso-8859-1] (original)
> +++ trunk/reactos/win32ss/user/user32/controls/button.c	[iso-8859-1] Wed Feb 25 20:02:10 2015
> @@ -298,11 +298,10 @@
>           /* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
>           if (btn_type == BS_USERBUTTON )
>           {
> +            style = (style & ~BS_TYPEMASK) | BS_PUSHBUTTON;
>   #ifdef __REACTOS__
> -            style = (style & ~BS_TYPEMASK) | BS_PUSHBUTTON;
> -            SetWindowLongPtrW( hWnd, GWL_STYLE, style );
> +            NtUserAlterWindowStyle(hWnd, GWL_STYLE, style );
>   #else
> -            style = (style & ~BS_TYPEMASK) | BS_PUSHBUTTON;
>               WIN_SetStyle( hWnd, style, BS_TYPEMASK & ~style );
>   #endif
>           }
> @@ -508,8 +507,11 @@
>           if ((wParam & BS_TYPEMASK) >= MAX_BTN_TYPE) break;
>           btn_type = wParam & BS_TYPEMASK;
>           style = (style & ~BS_TYPEMASK) | btn_type;
> -        SetWindowLongPtrW( hWnd, GWL_STYLE, style );
> -        //WIN_SetStyle( hWnd, style, BS_TYPEMASK & ~style );
> +#ifdef __REACTOS__
> +            NtUserAlterWindowStyle(hWnd, GWL_STYLE, style );
> +#else
> +            WIN_SetStyle( hWnd, style, BS_TYPEMASK & ~style );
> +#endif
>   
>           /* Only redraw if lParam flag is set.*/
>           if (lParam)
> @@ -565,7 +567,7 @@
>   #ifdef __REACTOS__
>               if (wParam) style |= WS_TABSTOP;
>               else style &= ~WS_TABSTOP;
> -            SetWindowLongPtrW( hWnd, GWL_STYLE, style );
> +            NtUserAlterWindowStyle(hWnd, GWL_STYLE, style );
>   #else
>               if (wParam) WIN_SetStyle( hWnd, WS_TABSTOP, 0 );
>               else WIN_SetStyle( hWnd, 0, WS_TABSTOP );
>
>
>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3683 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.reactos.org/pipermail/ros-dev/attachments/20150226/1123d1eb/attachment-0001.bin>


More information about the Ros-dev mailing list