I did some additional testing, and it looks like we're not handling dot segment removal quite correctly. If dot segments are passed as `%2E`, Windows doesn't treat them as actual dots during segment removal, but we currently do. To replicate that behavior accurately, we should probably remove dot segments before unescaping. That might require using a temporary buffer. Once that's done, calculating the length should be more straightforward.
As you can see from the [test results](https://testbot.winehq.org/JobDetails.pl?Key=158742), this seems to be bugged on native. I don't know if we need to replicate native's behavior
It’s fine if you don’t replicate that behavior, but please don’t hide such differences in tests. Use `todo_wine` instead, don’t add Wine-specific return values as if they’re the expected outcome.
Also, testing with a one-character buffer raises the question of whether it's a special case. It would be more meaningful to test with a buffer that’s just slightly too small.