Hi all,
I have an installer crashing in 'GetPrivateProfileString' because of an NULL section pointer :
3 0x40076161 (GetPrivateProfileStringA+0x31(section=0x0, entry=0x40391efc, def_val=0x4039a394, buffer=0x403b0410, len=0x3e7, filename=0x4039a4e8) [profile.c:1232] in libntdll.so) (ebp=40586748)
When looking at the code, there is the following comment (and code) :
/* * undoc_feature means: * return section names string list if both section and entry are NULL. */ (...) if ((undoc_feature) && (section == NULL) && (entry == NULL)) /* undocumented; both section and entry are NULL */
But if I look at the entry for 'GetPrivateProfileString' in the MSDN, I get this :
pAppName [in] Pointer to a null-terminated string that specifies the name of the section containing the key name. If this parameter is NULL, the GetPrivateProfileString function copies all section names in the file to the supplied buffer.
lpKeyName [in] Pointer to the null-terminated string specifying the name of the key whose associated string is to be retrieved. If this parameter is NULL, all key names in the section specified by the lpAppName parameter are copied to the buffer specified by the lpReturnedString parameter.
This is not in sync. with what Wine does.... It seems that only pAppName needs to be NULL to return a section name list.
And there is another behaviour not done by Wine yet : copy all the keys of a section to the output buffer.
So who is the author of this 'undocumented' feature in the Wine code ? Do you all agree that I should code it according to the (now) documented feature ?
Lionel
At 01:07 AM 7/19/01 +0200, Lionel Ulmer wrote
pAppName [in] Pointer to a null-terminated string that specifies the name of the section containing the key name. If this parameter is NULL, the GetPrivateProfileString function copies all section names in the file to the supplied buffer.
lpKeyName [in] Pointer to the null-terminated string specifying the name of the key whose associated string is to be retrieved. If this parameter is NULL, all key names in the section specified by the lpAppName parameter are copied to the buffer specified by the lpReturnedString parameter.
so if lpAppName is NULL, it's supposed to copy all section names, and if lpKeyName is NULL, it copesi all key names in lpAppName section...maybe someone wasn't sure what to do if they were both NULL? It seems like as long as lpAppName is NULL, it doesn't really matter what lpKeyName is, right? If that is so, IMHO the code should reflect these rules by ordering the code so that you check AppName for NULL, and if it isn't, THEN you check KeyName for NULL.
- Brandon