Get the disabled status of a Windows Service

后端 未结 3 1255
灰色年华
灰色年华 2021-01-22 12:45

I have written a windows service and has set its startup type to be \'Automatic\'. But after installing the service a user can change its type to \'disabled\'.

Is there

3条回答
  •  再見小時候
    2021-01-22 13:37

    There is no API for doing this, but you can check the service start mode in the registry, at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName\Start. That value will be either 2 (automatic), 3 (manual), or 4 (disabled).

提交回复
热议问题