Another systray patch

Alexandre Julliard julliard at winehq.org
Thu Dec 9 08:35:36 CST 2004


Mike Hearn <mike at navi.cx> writes:

> There was a crash in the previous patch, here is a fixed version.
> 
> - Add a new wineshell process, and put system tray handling in there
> - Rewrite the shell32 systray handling to be out of process
> - Support the freedesktop.org XEMBED protocol

It would be nice to do the XEMBED stuff as a separate patch. Also I
was hoping you would get rid of WS_EX_TRAYWINDOW instead of adding
even more uses of it...

> +    /* we can't intern this with the rest as it depends on the screen we are connecting to */
> +    systray_buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(char)*20);
> +    sprintf(systray_buffer, "_NET_SYSTEM_TRAY_S%d", DefaultScreen(display));

The screen will be 0 in 99.9% of the cases, you should preallocate
that one.

> +void *xmalloc(unsigned int size)
> +{
> +    void *p = HeapAlloc(GetProcessHeap(), 0, size);
> +    
> +    if (!p)
> +    {
> +        fprintf(stderr, "wineshell: virtual memory exhausted\n");
> +        exit(1);
> +    }
> +
> +    ZeroMemory(p, size);

exit(1) is not acceptable here, you should handle allocation failures
properly. Also malloc doesn't clear the buffer so xmalloc shouldn't
either, otherwise it's very confusing.

> +struct request {
> +    NOTIFYICONDATAA ansi;
> +    NOTIFYICONDATAW wide;
> +    BOOL            unicode;
> +    BYTE           *copydata;

Inter-process data should always be sent in Unicode.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list