ADVAPI32: Implement GetServiceDisplayNameW

Rolf Kalbermatter r.kalbermatter at hccnet.nl
Mon Apr 23 16:18:52 CDT 2007


Alexandre Julliard [mailto:julliard at winehq.org] wrote:

>"Rolf Kalbermatter" <r.kalbermatter at hccnet.nl> writes:
>
>> +    size = *lpcchBuffer * sizeof(WCHAR);
>> +    ret = RegGetValueW(hscm->hkey, lpServiceName, szDisplayName,
RRF_RT_REG_SZ, &type, NULL, &size);
>> +    switch (ret)
>> +    {
>> +        case ERROR_SUCCESS:
>> +            ret = RegGetValueW(hscm->hkey, lpServiceName, szDisplayName,
RRF_RT_REG_SZ, &type, lpDisplayName, &size);
>> +            *lpcchBuffer = (size / sizeof(WCHAR)) - 1;
>> +            break;
>
>It would be better to put the data into the buffer right away, so that you
don't need two registry
>queries in the common case of the buffer being large enough.

The reason I didn't do that is that RegGetValue has undefined behaviour for
the buffer contents
when it is to small, while GetServiceDisplayName has explicitedly described
that the buffer will be not touched in that case.

Rolf Kalbermatter





More information about the wine-devel mailing list