"Rolf Kalbermatter" r.kalbermatter@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.
Alexandre Julliard [mailto:julliard@winehq.org] wrote:
"Rolf Kalbermatter" r.kalbermatter@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