https://bugs.winehq.org/show_bug.cgi?id=50412
Bug ID: 50412 Summary: Wrong check for needed access rights in QueryServiceConfig2 Product: Wine Version: 6.0-rc4 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: advapi32 Assignee: wine-bugs@winehq.org Reporter: dalai82@gmx.net Distribution: ---
Hi there.
While checking out Total Commander and one of my own TC plugins on Wine 4.0.2 on Debian 10.7 I saw that it failed to read the description of all services. After double-checking my code (and confirming its correctness) I saw Wine's output on the terminal:
006b:err:service:validate_context_handle Access denied - handle created with access 1, needed 4
Then I downloaded the source code of the current version dev version 6.0-rc4, searched all files (because I didn't know where to look) and found the culprit in programs/services/rpc.c, more precise in function svcctl_QueryServiceConfig2W where it makes the call to validate_service_handle() in line 984.
The bug and fix for it is simple: The needed access right must be SERVICE_QUERY_CONFIG instead of SERVICE_QUERY_STATUS, since it's the service config queried here, not its status.
Out of curiosity, I checked half a dozen older versions and found that this bug has been in the code since its implementation back in Wine 1.1.14. This more than a decade old wine didn't age well ;). But I guess this is a simple copy'n'paste error.
Maybe check for similar bugs/mistakes in the other functions when fixing this one.
Regards