"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.