kernel32: GetPrivateProfileString should set buffer to "" if default value is not set (resend)

Dan Kegel dank at
Mon Jul 7 07:32:07 CDT 2008

[Resending on behalf of Chris Smith]

MSDN says GetPrivateProfileStrings should clear lpReturnedString
if lpDefault isn't set and a key cannot be found.
This patch adds a test to confirm this, and fixes the problem.
Tested on Vista.

Fixes valgrind warning

Use of uninitialised value of size 4
   at wcstombs_sbcs (wctomb.c:187)
   by wine_cp_wcstombs (wctomb.c:457)
   by WideCharToMultiByte (locale.c:1936)
   by GetPrivateProfileStringA (profile.c:1200)
   by test_profile_existing (profile.c:344)
 Uninitialised value was created by a client request
   at mark_block_uninitialized (heap.c:164)
   by RtlAllocateHeap (heap.c:1239)
   by HeapAlloc (heap.c:276)
   by GetPrivateProfileStringA (profile.c:1185)
   by test_profile_existing (profile.c:344)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kernel32-profile-null.patch
Type: text/x-diff
Size: 1644 bytes
Desc: not available
Url : 

More information about the wine-patches mailing list