Do we really need to reimplement the function in shlwapi? All the tests you have added are passing after changing the test to use msvcrt _swprintf_c instead of wnsprintfW (on Windows, there's a crash on Wine). There's also ntdll implementation that can be used but I haven't tested if it supports all the features.