deblasis / winsvc-query-poc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

winsvc-query-poc

Simple windows executable used to query for the status of a Windows Service, in this case Dhcp (pretty ubiquitous).

The implementation is inspired from https://cs.opensource.google/go/x/sys/+/master:windows/svc/example/

There are two branches:

This one uses the basic methods provided by the x/sys library that, by default, require the highest permission level: SC_MANAGER_ALL_ACCESS (source)

Trying to query the Service Manager here fails when connecting when the user running the executable doesn't have Administrator privileges:

image

😢

This branch contains calls at a lower level with lower permissions that result in a successful call

image

😃

Usage

Switch to one of the above branches and then

make run

About

License:Apache License 2.0