[PATCH 5/5] win32u: Move message spy implementation from user32.

Huw Davies huw at codeweavers.com
Mon Mar 21 09:56:22 CDT 2022


On Mon, Mar 21, 2022 at 02:14:55PM +0100, Jacek Caban wrote:
> @@ -2131,10 +2130,16 @@ static void SPY_GetMsgStuff( SPY_INSTANCE *sp_e )
>  
>          if (sp_e->msgnum >= 0xc000)
>          {
> -            if (GlobalGetAtomNameA( sp_e->msgnum, sp_e->msg_name+1, sizeof(sp_e->msg_name)-2 ))
> +            char buf[sizeof(ATOM_BASIC_INFORMATION) + MAX_ATOM_LEN * sizeof(WCHAR)];
> +            ATOM_BASIC_INFORMATION *abi = (ATOM_BASIC_INFORMATION *)buf;
> +            if (!NtQueryInformationAtom( sp_e->msgnum, AtomBasicInformation, abi, sizeof(buf), NULL ))
>              {
> -                sp_e->msg_name[0] = '\"';
> -                strcat( sp_e->msg_name, "\"" );
> +                unsigned int j = 0;
> +                sp_e->msg_name[j++] = '\"';
> +                j += ntdll_wcstoumbs( abi->Name, abi->NameLength,
> +                                      sp_e->msg_name + j,  sizeof(sp_e->msg_name) - 3, FALSE ) / sizeof(WCHAR);

Hi Jacek,

The divide by sizeof(WCHAR) bit doesn't look right here.

> +                sp_e->msg_name[j++] = '\"';
> +                sp_e->msg_name[j++] = 0;
>                  return;

Huw.



More information about the wine-devel mailing list