SC_HANDLE WINAPI CreateService(
_In_ SC_HANDLE hSCManager,
_In_ LPCTSTR lpServiceName,
_In_opt_ LPCTSTR lpDisplayName,
_In_ DWORD dwDesiredAccess,
_In_ DWORD dwServiceType,
_In_ DWORD dwStartType,
_In_ DWORD dwErrorControl,
_In_opt_ LPCTSTR lpBinaryPathName,
_In_opt_ LPCTSTR lpLoadOrderGroup,
_Out_opt_ LPDWORD lpdwTagId,
_In_opt_ LPCTSTR lpDependencies,
_In_opt_ LPCTSTR lpServiceStartName,
_In_opt_ LPCTSTR lpPassword
);
Value | Meaning |
---|---|
|
Reserved. |
|
File system driver service. |
|
Driver service. |
|
Reserved. |
|
Service that runs in its own process. |
|
Service that shares a process with one or more other services. For more information, see Service Programs. |
Value | Meaning |
---|---|
|
The service can interact with the desktop. For more information, see Interactive Services. |
Value | Meaning |
---|---|
|
A service started automatically by the service control manager during system startup. For more information, see Automatically Starting Services. (在系統啟動的時候,由SCM自動運行服務) |
|
A device driver started by the system loader. This value is valid only for driver services. (系統引導程序自動運行服務,只對driver services有效) |
|
A service started by the service control manager when a process calls the StartService function. For more information, see Starting Services on Demand. (當一個程序調用StartService函數時,SCM啟動服務) |
|
A service that cannot be started. Attempts to start the service result in the error code ERROR_SERVICE_DISABLED. (一個不能啟動的服務,嘗試啟動它時,會產生ERROR_SERVICE_DISABLED) |
|
A device driver started by the IoInitSystem function. This value is valid only for driver services. (一個由 IoInitSystem函數啟動的服務) |
返回值
|
描述
|
ERROR_ACCESS_DENIED
|
提供的hSCManager參數沒有SC_MANAGER_CREATE_SERVICE權限。
|
ERROR_CIRCULAR_DEPENDENCY
|
存在循環嵌套的服務依賴關系。
|
ERROR_DUPLICATE_SERVICE_NAME
|
顯示名稱已在SCM中被其他服務注冊為服務名稱或顯示名稱。
|
ERROR_INVALID_HANDLE
|
提供的hSCManager參數無效。
|
ERROR_INVALID_NAME
|
提供的服務名稱無效。
|
ERROR_INVALID_PARAMETER
|
其他參數無效。
|
ERROR_INVALID_SERVICE_ACCOUNT
|
由
lpServiceStartName參數指定的用戶名不存在。
|
ERROR_SERVICE_EXISTS
|
已存在完全相同的服務。
|
值
|
描述
|
DependOnGroup
|
由
lpDependencies參數指定的依賴性服務群組,包含加載順序。
|
DependOnService
|
由
lpDependencies參數指定的依賴性服務。
|
Description
|
由
ChangeServiceConfig2函數寫入的描述信息。
|
DisplayName
|
由l
pDisplayName參數指定的服務顯示名稱。
|
ErrorControl
|
由
dwErrorControl參數指定的糾錯方案。
|
FailureActions
|
由
ChangeServiceConfig2函數寫入的異常信息。
|
Group
|
由
lpLoadOrderGroup參數指定的服務群組,包含加載順序。
|
ImagePath
|
由
lpBinaryPathName參數指定的服務程序文件位置。
|
ObjectName
|
由
lpServiceStartName參數指定的名稱。
|
Start
|
由
dwStartType參數指定的服務啟動時間。
|
Tag
|
由
lpdwTagId參數指定的識別信息。
|
Type
|
由
dwServiceType參數指定的服務類型。
|