[Bug 60360] New: WritePrivateProfileSectionW incompatibility: Deleting value-only entries instead of Key=Value pairs
http://bugs.winehq.org/show_bug.cgi?id=60360 Bug ID: 60360 Summary: WritePrivateProfileSectionW incompatibility: Deleting value-only entries instead of Key=Value pairs Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@list.winehq.org Reporter: kiso173@send4.uk Target Milestone: --- Distribution: --- Created attachment 82146 --> http://bugs.winehq.org/attachment.cgi?id=82146 reproduce About the bug: It's simple! `WritePrivateProfileSectionW` deletes lines that contain only a value. On Windows, however, such lines are preserved and are not deleted. ```ini [Section] Key=Value ValueOnly Key2=Value2 ``` https://gitlab.winehq.org/wine/wine/-/blob/wine-11.0/dlls/kernel32/profile.c... Could this be considered undefined behavior? However, this behavior is causing an actual issue: https://appdb.winehq.org/objectManager.php?sClass=application&iId=10261 This game writes the following to `eco.ini`: ```ini [CheckECO] OK ``` It then uses this entry to verify that everything is working correctly. Because the `OK` line gets removed, the check fails and the game's settings are reset every time. I would appreciate it if Wine's behavior could be made consistent with Windows. Reproduce: ``` #include <windows.h> #include <stdio.h> #include <string.h> int main(void) { static const WCHAR filename[] = L".\\profile-repro.ini"; static const WCHAR section[] = L"Section"; /* Double-NUL-terminated list required by WritePrivateProfileSectionW(). */ static const WCHAR data[] = L"Key=Value\0" L"ValueOnly\0" L"Key2=Value2\0"; HANDLE file; char buffer[1024]; DWORD bytes_read; DeleteFileW(filename); if (!WritePrivateProfileSectionW(section, data, filename)) { fprintf(stderr, "WritePrivateProfileSectionW failed: %lu\n", GetLastError()); return 1; } file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (file == INVALID_HANDLE_VALUE) { fprintf(stderr, "CreateFileW failed: %lu\n", GetLastError()); return 1; } if (!ReadFile(file, buffer, sizeof(buffer) - 1, &bytes_read, NULL)) { fprintf(stderr, "ReadFile failed: %lu\n", GetLastError()); CloseHandle(file); return 1; } CloseHandle(file); buffer[bytes_read] = '\0'; printf("ValueOnly preserved: %s\n", strstr(buffer, "ValueOnly") ? "yes" : "no"); printf("\nGenerated file:\n%s", buffer); return 0; } ``` -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60360 --- Comment #1 from kiso173 <kiso173@send4.uk> --- *** Bug 60361 has been marked as a duplicate of this bug. *** -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla