edit: no not use LOCAL_*() functions

Alexandre Julliard julliard at winehq.org
Mon May 16 12:03:08 CDT 2005


"Dimitrie O. Paun" <dpaun at rogers.com> writes:

> @@ -426,19 +425,21 @@ static LRESULT WINAPI EditWndProc_common
>  {
>  	EDITSTATE *es = (EDITSTATE *)GetWindowLongW( hwnd, 0 );
>  	LRESULT result = 0;
> +	STACK16FRAME *stack16;
> +	HANDLE16 oldDS;
>  
>          TRACE("hwnd=%p msg=%x (%s) wparam=%x lparam=%lx\n", hwnd, msg, SPY_GetMsgName(msg, hwnd), wParam, lParam);
>  	
>  	if (!es && msg != WM_NCCREATE)
>  		return DefWindowProcT(hwnd, msg, wParam, lParam, unicode);
> -	else if (msg == WM_NCCREATE)
> -		return EDIT_WM_NCCreate(hwnd, (LPCREATESTRUCTW)lParam, unicode);
> -	else if (msg == WM_DESTROY)
> -		return EDIT_WM_Destroy(es);
>  
> +	if (es && (msg != WM_DESTROY)) EDIT_LockBuffer(es);
> +
> +	/* Make sure DS points to hInstance for 16-bit apps */	
> +	stack16 = (STACK16FRAME*)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved);
> +	oldDS = stack16->ds;
> +	stack16->ds = GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );

It seems dangerous to set DS for the whole window procedure, it will
be calling a lot of other functions that may end up depending on
DS. It's especially dangerous here since the window instance won't be
a valid DS for 32-bit windows. I think you really want to set it only
around the Local* calls and restore it as soon as possible.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list