差異處
這裏顯示兩個版本的差異處。
cpp:sc:queryservicelockstatus [2016/04/19 11:35] tony [Introduction] |
cpp:sc:queryservicelockstatus [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{tag>cpp Windows}} | ||
- | ====== QueryServiceLockStatus ====== | ||
- | ===== Introduction ===== | ||
- | 某些third-party api會在runtime去新增service,以減少使用者在安裝上的負擔。然而在系統重新啟動時,SCM會lock service database,如果新增service將會造成block。此源自: [[https://msdn.microsoft.com/zh-tw/library/windows/desktop/ms686321(v=vs.85).aspx|link]] | ||
- | <code> | ||
- | A service cannot call StartService during initialization. The reason is that the SCM locks the' | ||
- | service control database during initialization, so a call to StartService will block. After the | ||
- | service reports to the SCM that it has successfully started, it can call StartService. | ||
- | </code> | ||
- | ===== How to? ===== | ||
- | ===== Reference ===== | ||
- | * [[https://msdn.microsoft.com/zh-tw/library/windows/desktop/ms684938(v=vs.85).aspx|MSDN - QueryServiceLockStatus]] | ||
- | * [[https://msdn.microsoft.com/zh-tw/library/windows/desktop/ms686321(v=vs.85).aspx|MSDN - StartService]] | ||
- | * [[https://msdn.microsoft.com/zh-tw/library/windows/desktop/ms685104(v=vs.85).aspx|MSDN - SCM Handles]] | ||
- | ===== ===== | ||
- | ---- | ||
- | \\ | ||
- | ~~DISQUS~~ |