- sect = heap_strdupAtoW(lpszSection);
- entry = heap_strdupAtoW(lpszEntry);
- string = heap_strdupAtoW(lpszDefault);
- file = heap_strdupAtoW(lpszFilename);
- retval = heap_alloc(cbRetBuffer*sizeof(WCHAR));
- ret = SQLGetPrivateProfileStringW(sect, entry, string, retval, cbRetBuffer, file);
- if(ret)
- {
WideCharToMultiByte(CP_ACP, 0, retval, -1, RetBuffer, cbRetBuffer, NULL, NULL);
RetBuffer[ret] = 0;
- }
- heap_free(sect);
- heap_free(entry);
- heap_free(string);
- heap_free(file);
- heap_free(retval);
Structurally it's fine, but you're using WCHAR count as CP_ACP char count, and it's wrong assumption in general.