[1/3] server: Implement job limit flags (try 2)

Nikolay Sivov bunglehead at gmail.com
Thu Apr 2 04:13:50 CDT 2015


On 02.04.2015 10:38, Andrew Cook wrote:
> Changes in try 2:
> - Removed the goto in SetInformationJobObject, ExtendedLimit will need its own
>    wineserver call eventually anyway

I don't think you'll need a separate server call for extended info case. 
All fields should be enabled with flags, so you don't have to invent 
special values to ignore some limits.

> +    switch (class)
> +    {
> +
> +    case JobObjectExtendedLimitInformation:
> +        if (len != sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION))
> +            return STATUS_INVALID_PARAMETER;
> +
> +        basic_limit = &(((JOBOBJECT_EXTENDED_LIMIT_INFORMATION *)info)->BasicLimitInformation);
> +        if (basic_limit->LimitFlags & ~JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS)
> +            return STATUS_INVALID_PARAMETER;
> +
> +        SERVER_START_REQ( job_set_limits )
> +        {
> +            req->handle = wine_server_obj_handle( handle );
> +            req->limit_flags = basic_limit->LimitFlags;
> +            status = wine_server_call( req );
> +        }
> +        SERVER_END_REQ;
> +        break;

This still looks strange, if you need only flags you can use switch() to 
prepare this flags value depending on info class, and handle invalid 
arguments same way you do know, no need to duplicate server calling 
block. Actually since extended info contains basic info you only need a 
switch() to test for invalid arguments, and you can cast unconditionally 
to JOBOBJECT_BASIC_LIMIT_INFORMATION* to get flags.



More information about the wine-devel mailing list