Commit f89722db authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

Fix 'undocumented' behaviour of GetPrivateProfileString.

parent a5f510f3
...@@ -1154,13 +1154,15 @@ UINT WINAPI GetProfileIntW( LPCWSTR section, LPCWSTR entry, INT def_val ) ...@@ -1154,13 +1154,15 @@ UINT WINAPI GetProfileIntW( LPCWSTR section, LPCWSTR entry, INT def_val )
} }
/* /*
* undoc_feature means: * if allow_section_name_copy is TRUE, allow the copying :
* return section names string list if both section and entry are NULL. * - of Section names if 'section' is NULL
* - of Keys in a Section if 'entry' is NULL
* (see MSDN doc for GetPrivateProfileString)
*/ */
static int PROFILE_GetPrivateProfileString( LPCSTR section, LPCSTR entry, static int PROFILE_GetPrivateProfileString( LPCSTR section, LPCSTR entry,
LPCSTR def_val, LPSTR buffer, LPCSTR def_val, LPSTR buffer,
UINT16 len, LPCSTR filename, UINT16 len, LPCSTR filename,
BOOL undoc_feature ) BOOL allow_section_name_copy )
{ {
int ret; int ret;
LPSTR pDefVal = NULL; LPSTR pDefVal = NULL;
...@@ -1193,10 +1195,10 @@ static int PROFILE_GetPrivateProfileString( LPCSTR section, LPCSTR entry, ...@@ -1193,10 +1195,10 @@ static int PROFILE_GetPrivateProfileString( LPCSTR section, LPCSTR entry,
EnterCriticalSection( &PROFILE_CritSect ); EnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename )) { if (PROFILE_Open( filename )) {
if ((undoc_feature) && (section == NULL) && (entry == NULL)) if ((allow_section_name_copy) && (section == NULL))
/* undocumented; both section and entry are NULL */
ret = PROFILE_GetSectionNames(buffer, len); ret = PROFILE_GetSectionNames(buffer, len);
else else
/* PROFILE_GetString already handles the 'entry == NULL' case */
ret = PROFILE_GetString( section, entry, pDefVal, buffer, len ); ret = PROFILE_GetString( section, entry, pDefVal, buffer, len );
} else { } else {
lstrcpynA( buffer, pDefVal, len ); lstrcpynA( buffer, pDefVal, len );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment