http://bugs.winehq.org/show_bug.cgi?id=2127
------- Additional Comments From julliard@winehq.com 2005-03-10 05:52 ------- The error 5 is because you didn't request GENERIC_WRITE access. This is still a bug in Wine, but a different one.
Also note that the mutex in your sample code is useless since you create a new one for every invocation of the function. Still, it shouldn't fail even without a mutex.