[PATCH] user32: Support activation context class redirection in CreateWindow.

Nikolay Sivov nsivov at codeweavers.com
Sun Mar 29 08:15:00 CDT 2015


On 03/29/2015 01:54 AM, Mark Harmstone wrote:
> This patch implements the class redirection feature of activation contexts, as
> used by version 6 of comctl32. Among other things, this is a necessary step in
> fixing the behaviour seen in bug 38124.
>
> ---
>   dlls/user32/win.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 62 insertions(+)
>

In principle it looks almost okay, except that I don't think we need it 
right now, as long as comctl32 doesn't register versioned classes at 
all. It will just wait time for every window creation requested looking 
for something that can't be created. Comments on code itself to follow.

> +    classatom = get_int_atom_value(className);
> +    if (classatom)
> +        GlobalGetAtomNameW(classatom, classNameStr, sizeof(classNameStr) / sizeof(*classNameStr));
> +    else
> +        strcpyW(classNameStr, className);

You don't need to copy in case of a string.

> +        if (wcrd->name_len == 0)
> +            return FALSE;

I don't think it can be 0, ever. Name comes from class name from module 
manifest and assembly version string.

> +        memcpy(redirClassName, (unsigned char*)askd.lpData + wcrd->name_offset, wcrd->name_len);
> +        redirClassName[wcrd->name_len / sizeof(WCHAR)] = 0;

All strings in context data are null-terminated, so you don't need this 
complexity. In fact you don't need to copy anything at all, you can just 
use a (WCHAR*)((BYTE*)askd.lpData + wcrd->name_offset) as a ready-to-use 
pointer, I think it's a preferred way, given that overhead of this 
redirection lookup should be minimal.

So your helper only needs to return a pointer - original one or computed 
from redirection data. And atoms should be resolved outside of it.

> +    WCHAR redirClassName[256];

Is it defined somewhere to be limited to that?

> +
> +        wndPtr = create_window_handle( parent, owner, redirClassName, module, unicode );
> +
> +        if (GetLastError() == ERROR_INVALID_HANDLE && GetClassInfoW( 0, redirClassName, &wc ))
> +            wndPtr = create_window_handle( parent, owner, redirClassName, module, unicode );
> +

I don't quite get what you're trying to do here? How does same call help 
if called second time? Also last error check is strange.





More information about the wine-devel mailing list