dasMulli/dotnet-win32-service

Pause/Continue

javelinco opened this issue · 8 comments

I've created a custom service state machine implementation that should handle pause and continue events, but unfortunately, the options are grayed out - the service doesn't allow pause and continue. I've taken a close look at the documentation regarding the installation of the service - it looks like, using the ServiceControlAccessRights, the current setting of "All" should allow pause/continue functionality, but it doesn't seem to work.

Has anyone else encountered this issue? Is there something else I need to do? I've been hunting around for a good answer to this question for awhile, without much luck. Any help would be appreciated.

Thanks!

It should more be about passing the right ServiceAcceptedControlCommandsFlags to the service status callback.. The PauseContinue value, which I now see is documented incorrectly, should match SERVICE_ACCEPT_PAUSE_CONTINUE for dwControlsAccepted in the SERVICE_STATUS struct https://msdn.microsoft.com/en-us/library/windows/desktop/ms685996(v=vs.85).aspx which is used for the SetServiceStatus call.
I can take a look if you want. The only reason for not having implemented this myself is just that there was no one asking..

That is definitely the answer. I am working on an implementation that allows pause/continue, and will be happy to submit what I come up with, if you like.

That would be awesome!

Okay, I've got a branch to push up - I'm calling it "feature/PauseContinue". It doesn't bump the version number - I figured that would be something you would want to decide on. And I had some trouble with the multiple framework targets in the projects, so I'm afraid I dropped those - you might want to revert those changes. However, I am having trouble when I am trying to push up the branch so I can do a pull request. I may be doing it wrong - I am not very experienced at contributing to projects like this. I have created the branch locally, staged and committed the changes, and then used the "git push -u origin feature/PauseContinue" command, but I get a "Permission to dasMulli/dotnet-win32-service.git is denied to javelinco".

Help?

sure. the standard process is that you fork this repository which creates your own personal copy of this repository. you can then create and push branches into your repository and then create a pull request back to the "upstream" repository.

There's a few guides like https://gist.github.com/Chaser324/ce0505fbed06b947d962

If you already have this repo cloned and ready, you can use the fork button on this site, then head to the console and use

git remote rename origin upstream
git remote add origin THE_URL_OF_YOUR_FORK

so you directly get the common practice of calling one's own working fork "origin" and the main repo "upstream".

Then you should be able to push the branch using

git push -u origin feature/PauseContinue

which should make GitHub offer you to create a pull request when you visit one of our repo's code page.

Perfect - thank you for the newbie patience!

Implemented in #65

Thanks @javelinco!

Thank you for your help and patience - and for this library!