odbccp32: Implement SQLGetPrivateProfileString (try 7)

Nikolay Sivov bunglehead at gmail.com
Tue Jul 7 09:08:05 CDT 2015


On 07.07.2015 16:51, Hugh McMaster wrote:
> On Tuesday, 7 July 2015, 10:31 pm UTC+10, Nikolay Sivov wrote:
>> On 07.07.2015 11:15, Alistair Leslie-Hughes wrote:
>>
>>> +    retval = heap_alloc(cbRetBuffer*sizeof(WCHAR));
>>> +
>>> +    ret = SQLGetPrivateProfileStringW(sect, entry, string, retval, cbRetBuffer, file);
>>
>> cbRetBuffer is A-buffer length, you're still using it as W-buffer length.
>
> Unless I'm reading MSDN [1] incorrectly, this should work.
>
> cbRetBuffer is the size, in characters, of RetBuffer (i.e. the A-buffer).
>
> retval is the W-buffer. Its allocated byte size is double that of RetBuffer,
> but its size, in characters, is still the same.
>
> [1] https://msdn.microsoft.com/en-us/library/ms714560%28v=vs.85%29.aspx
>

It is the same in most cases, but doesn't have to be, because W<->A can 
produce strings of different character lengths. That's what I've been 
trying to say from first time I commented on this patch.




More information about the wine-devel mailing list