poweradminllc / PAExec

Remote execution, like PsExec
531 stars 177 forks source link

Bad order of stopping service #10

Closed bluebaroncanada closed 3 years ago

bluebaroncanada commented 9 years ago

You need to close the handle that you have open to the remote scm service that you called with OpenService() while deleting the service. If a failure occurs when you DeleteService, you should close the handle before waiting. If you hang onto that handle, nothing will be able to delete the service.

poweradminllc commented 8 years ago

Hi @bluebaroncanada

I'm not following. Both places where DeleteService is called will immediately call CloseServiceHandle(hService), whether DeleteService succeeds or not.

poweradminllc commented 3 years ago

Code appears to always close hService whether DeleteService succeeds or not.