http://bugs.winehq.org/show_bug.cgi?id=32327
--- Comment #7 from Nikolay Sivov bunglehead@gmail.com 2012-11-30 01:26:31 CST --- Patch seems to work. (In reply to comment #6)
(In reply to comment #5)
The public service API doesn't return the status code, it sets the last error and just returns success or failure. Alexandre didn't seem a fan of hard coding errors like that with CreateFile vs NtCreateFile, though NtCreateFile is "more" public - so that might be different.
True, I missed that. Yes, messing with GetLastError() is not nice if you don't have to. Better way as I see it would be to add couple of helpers like open_scmanager() and open_service() that fully return status and use them to implement OpenSCManagerW() etc., and then you can use them for this security stuff.
Also patch needs cleanup like:
- moving RtlDosPathNameToNtPathName_U() closer to NtCreateFile as it's no needed otherwise; - you can't use CloseHandle() on SC_HANDLE, and 'hFile' name is just a 'handle' now;
Probably it needs splitting too, to separate *Named* part from handle part.