[PATCH] advapi32: succeed for null pointer in ChangeServiceConfig2

Nikolay Sivov bunglehead at gmail.com
Thu Mar 19 08:35:46 CDT 2015

On 19.03.2015 16:07, Bernhard Übelacker wrote:
> Hello Nikolay,
> thanks for your review.
> Am 19.03.2015 um 13:34 schrieb Nikolay Sivov:
>> In this case it's better to return earlier, no need to step into
>> try..expect block if you know you won't call anything.
> So would it be safe to move the assignments out of the try..except
> block (please see attached patch)?

> +    if (dwInfoLevel == SERVICE_CONFIG_DESCRIPTION &&
> +        info.u.descr->lpDescription == NULL)
>      {
> -        SC_RPC_CONFIG_INFOW info;
> +        err = ERROR_SUCCESS;
> +        return TRUE;
> +    }

Yes, something like that, expect you don't need to set 'err' at all in 
this case. But now that I'm thinking more about it, server side should 
probably be fixed.

> Or should we just do the call to the RPC server and decide there?

That's a good question. There's two ways to test it - connect to a 
server directly from test program and see what happens on NULL 
description (to make it work in wine you'll need to use W-call to a 
server as we do A->W conversion at client), indirectly - if you call 
ChangeServiceConfig2() with invalid handle and NULL description for info 
level 1.

In latter case I expect it to fail on invalid handle, and because handle 
validation is supposed to be done on server side only you will get your 

Another thing to test is to try and set description to NULL and then 
query it back with QueryServiceConfig2W() - it's possible that it's 
actually allowed to set it to NULL and 0 error value indicates just that.

> Kind regards,
> Bernhard

More information about the wine-devel mailing list