https://bugs.winehq.org/show_bug.cgi?id=39678
--- Comment #19 from Piotr Caban piotr.caban@gmail.com --- (In reply to Piotr Caban from comment #18)
(In reply to Nikolay Sivov from comment #17)
Created attachment 53135 [details] patch
The patch looks good for me.
Sorry, I've missed something. There should be cast to (unsigned _CHAR_) instead of (unsigned char). Your patch will not work for wchar_t case (I was not testing it, it's just from reading the code).