anitarazafi
anitarazafi

Reputation: 35

How to prevent a service executable from being suspended? (C++, win32)

I created a windows service which does not accept PAUSE nor STOP. Thus my service itself does not react on STOP or PAUSE SERVICE CONTROLS.
However the service executable can be suspended from taskmanager or resource monitor.
How to avoid that too?

I tried manipulate the ServiceCtrlHandler method of CServiceBase, on SERVICE_CONTROL_PAUSE call it should just ignore it. But it does not work.
I found out that the suspend in resource monitor calls NtSuspendProcess routine but I am just not sure if I should hook that function to be able to meet my requirements or is ther another way?
I also tried to write a driver using ObRegisterCallbacks to protect the process but it seems to not do anything. (I took the code from windows-driver-samples code)

Upvotes: 0

Views: 208

Answers (0)

Related Questions