"Andrew Ziem" ahziem1@mailbolt.com wrote:
- case SPI_GETDESKWALLPAPER: /* 115 */
- {
WCHAR buffer[MAX_PATH];
ret = SystemParametersInfoW( SPI_GETDESKWALLPAPER, uiParam, buffer, fuWinIni );
if (!WideCharToMultiByte(CP_ACP, 0, buffer, -1, pvParam, uiParam, NULL, NULL))
ret = FALSE;
break;
- }
You need to check first whether the SystemParametersInfoW call succeeded or not, otherwise it will end up translating garbage in WideCharToMultiByte.