odbccp32: Implement SQLGetPrivateProfileString (try 6 - resend)
hugh.mcmaster at outlook.com
Wed Jul 1 07:03:35 CDT 2015
>+ LONG ret = 0;
>+ HKEY hkey;
>+ DWORD size = 0;
>+ BOOL usedefault = TRUE;
/* snip */
>+ return 0;
>+ RetBuffer = 0;
>+ if(!lpszSection || !lpszEntry || !lpszDefault || !RetBuffer || !cbRetBuffer)
>+ return ret;
You are checking "if (!cbRetBuffer)" twice. Same in the next function.
You don't need to clear RetBuffer. RegGetValue adds a null terminating character if it doesn't already exist.
You also "return 0" and "return ret". They are the same at the moment, so be consistent.
>+size = cbRetBuffer;
>+if(RegGetValueW(hkeysect, NULL, lpszEntry, RRF_RT_REG_SZ, &type, RetBuffer, &size) == ERROR_SUCCESS)
cbRetBuffer is the size in characters of the buffer pointed to by RetBuffer.
size needs to be in bytes, so unless RetBuffer uses char, this is wrong.
>+ ret = SQLGetPrivateProfileStringW(sect, entry, string, retval, cbRetBuffer, file);
>+ WideCharToMultiByte(CP_ACP, 0, retval, -1, RetBuffer, ret+1, NULL, NULL);
This doesn't look right to me. "ret+1" should be the size, in bytes, of RetBuffer. 
More information about the wine-devel