Nikolay Sivov (@nsivov) commented about dlls/kernel32/tests/environ.c:
+ wcscpy(buf, L"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef"); + ExpandEnvironmentStringsW(value, buf, 15); + ok(GetLastError() == 0xdeadbeef, "got last error %ld\n", GetLastError()); + ok(!wcscmp(buf, L"Long long valucdefabcdefabcdefabcdefabcdefabcdef"), "got %s\n", debugstr_w(buf)); + + SetLastError(0xdeadbeef); + wcscpy(buf, L"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef"); + ExpandEnvironmentStringsW(value, buf, 16); + ok(GetLastError() == 0xdeadbeef, "got last error %ld\n", GetLastError()); + ok(!wcscmp(buf, value), "got %s\n", debugstr_w(buf)); + + SetLastError(0xdeadbeef); + wcscpy(buf, L"abcdef"); + ExpandEnvironmentStringsW(value, NULL, 0); + ok(GetLastError() == 0xdeadbeef, "got last error %ld\n", GetLastError()); + ok(!wcscmp(buf, L"abcdef"), "got %s\n", debugstr_w(buf)); A few unnecessary lines here.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4045#note_53765