Small profile patch

Lionel Ulmer lionel.ulmer at free.fr
Thu Jul 19 17:27:45 CDT 2001


Hi all,

As told on wine-devel, the current 'GetPrivateProfileString' is not behaving
exactly as told in the MSDN (and I have an application showing the behaviour
and crashing with current Wine).

This patch fixes the problem (the other case, section == defined but key ==
NULL was already handled properly by Wine).

Changelog:
 Fix 'undocumented' behaviour of GetPrivateProfileString

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
Index: wine/files/profile.c
===================================================================
RCS file: /home/wine/wine/files/profile.c,v
retrieving revision 1.54
diff -u -r1.54 profile.c
--- wine/files/profile.c	2001/07/11 18:56:45	1.54
+++ wine/files/profile.c	2001/07/19 22:03:00
@@ -1154,13 +1154,15 @@
 }
 
 /*
- * undoc_feature means:
- * return section names string list if both section and entry are NULL.
+ * if allow_section_name_copy is TRUE, allow the copying :
+ *   - 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,
 					    LPCSTR def_val, LPSTR buffer,
 					    UINT16 len, LPCSTR filename,
-					    BOOL undoc_feature )
+					    BOOL allow_section_name_copy )
 {
     int		ret;
     LPSTR	pDefVal = NULL;
@@ -1193,10 +1195,10 @@
     EnterCriticalSection( &PROFILE_CritSect );
 
     if (PROFILE_Open( filename )) {
-	if ((undoc_feature) && (section == NULL) && (entry == NULL))
-            /* undocumented; both section and entry are NULL */
+	if ((allow_section_name_copy) && (section == NULL))
             ret = PROFILE_GetSectionNames(buffer, len);
 	else
+	    /* PROFILE_GetString already handles the 'entry == NULL' case */
             ret = PROFILE_GetString( section, entry, pDefVal, buffer, len );
     } else {
        lstrcpynA( buffer, pDefVal, len );


More information about the wine-patches mailing list