ADVAPI32: service tests

James Hawkins truiken at
Sun May 20 02:10:47 CDT 2007

On 5/18/07, Rolf Kalbermatter <r.kalbermatter at> wrote:
> While working on some advapi32.service functions I found that having some
> tests for those APIs could be very useful. However nbot having added
> completely new tests so far there are a few issues I feel intimidated about.
> The actual task of adding a new test file service.c does seem fairly
> straightforward to me, considering I can just take some other test file and
> copy the framework from it, adding the new service.c to the
> However there are a few issues I see. First almost any test won't make much
> sense without at least one service installed and activated. As it is now
> there seem to be no services installed by default in a clean Wine install.

Have you looked?  regedit HKLM\System\CurrentControlSet\Services.  I'm
not familiar with spooler, but I assume it's installed by default on
win9x, whereas msi is not.  Whichever service you test, though, you
can just skip if the service doesn't exist.

> So I guess I would also need an extra executable somehow that implements a
> basic service that could for instance communicate through a pipe with the
> service test. It could be as simple as an executable that implements all the
> necessary communication with the service manager and offers some sort of
> pipe loopback as main service activity. But how am I going to add such an
> extra executable to the make logic of the advapi32 test?

You won't need any of this.

> Also under real Windows installing a service will in many cases fail since
> that requires administrative privileges for the current process and I'm not
> sure we can and want to enforce something like that especially for the
> unattended wine test service if that is still working.

Just check the return value of OpenSCManager; skip the test if they
aren't admin.  msdn implies that OpenSCManager will return
ERROR_ACCESS_DENIED if they don't have the correct privileges.  It's a
trivial issue that most tests currently don't bother with.

James Hawkins

More information about the wine-devel mailing list