[PATCH 1/2] shlwapi: Implement SHGetIniStringW

Andrew Eikum aeikum at codeweavers.com
Fri Jul 23 09:19:02 CDT 2010

On 07/23/2010 08:57 AM, Vitaliy Margolen wrote:
> On 07/21/2010 10:23 AM, Andrew Eikum wrote:
> Please more-less follow the format of the file and don't add yet one more.
>>  +    if(outLen == 0)
>>  +        return 0;
> Need space between "if" and "(".
>>  +    if(!buf){
> Curly bracket goes on to separate line.

You're right I should've checked the entire file.  Because Wine's 
formatting is so inconsistent already, I usually just bother to follow 
the immediate function's standards, which in this case, there was none.

>>  +    buf = HeapAlloc(GetProcessHeap(), 0, outLen * sizeof(WCHAR));
>>  +    ret = GetPrivateProfileStringW(appName, keyName, NULL, buf, outLen, filename);
>>  +        strcpyW(out, buf);
>>  +    HeapFree(GetProcessHeap(), 0, buf);
> Why do you need extra buffer here? Use passed buffer instead.

GetPrivateProfileString with NULL keyName fills the buffer with all of 
the available keys, separated by nuls.  This shlwapi function only fills 
the buffer with the first available key, leaving the rest of the buffer 
unmodified.  I had tests for this, but must've forgotten them when I 
rewrote the tests before submitting.  Attached patch demonstrates.

Thanks for reviewing,
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_after_first_key.patch
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20100723/42c2ff0b/attachment.asc>

More information about the wine-devel mailing list