user32: RegisterClassEx should check for invalid cbSize field.

Dmitry Timoshkov dmitry at codeweavers.com
Sat Jul 17 22:32:05 CDT 2010


Dylan Smith <dylan.ah.smith at gmail.com> wrote:

> +    wcexA.cbSize        = 0;
> +    wcexA.style         = cls.style;
> +    wcexA.lpfnWndProc   = cls.lpfnWndProc;
> +    wcexA.cbClsExtra    = cls.cbClsExtra;
> +    wcexA.cbWndExtra    = cls.cbWndExtra;
> +    wcexA.hInstance     = cls.hInstance;
> +    wcexA.hIcon         = cls.hIcon;
> +    wcexA.hCursor       = cls.hCursor;
> +    wcexA.hbrBackground = cls.hbrBackground;
> +    wcexA.lpszMenuName  = cls.lpszMenuName;
> +    wcexA.lpszClassName = cls.lpszClassName;
> +    wcexA.hIconSm       = 0;
> +    ok( ((RegisterClassExA( &wcexA ) == 0) && (GetLastError() == ERROR_INVALID_PARAMETER)),
> +          "Failed with invalid number of cbSize bytes\n");

Testing other values besides 0 would be helpful, in particular values like
sizeof(class) - 1 and sizeof(class) + 1. Did you inspect all the places
in Wine which call RegisterClassEx()? Also, GetClassInfoEx() in Wine is an
obvious offender, and this needs a test (and a fix) too.

-- 
Dmitry.



More information about the wine-devel mailing list