The HKLM\SYSTEM\CurrentControlSet\Services registry tree stores information about each service on the system. Each driver has a key of the form HKLM\SYSTEM\CurrentControlSet\Services\DriverName.
The PnP manager passes this path of a driver in the RegistryPath parameter when it calls the driver's DriverEntry routine. A driver can store global driver-defined data under the Parameters subkey of its key in the Services tree using an AddReg directive in the driver's INF file. To access that key at runtime, a WDM driver should use IoOpenDriverRegistryKey with a DRIVER_REGKEY_TYPE of DriverRegKeyParameters and a WDF driver should use WdfDriverOpenParametersRegistryKey. 儲存在此金鑰下的資訊可供驅動程式在初始化期間使用。
如需驅動程式通常使用的登錄機碼的詳細資訊,請參閱 驅動程式的登錄機碼簡介。
HKLM\SYSTEM\CurrentControlSet\Services 中的其他索引鍵
Parameters
用來儲存驅動程式特定資料的金鑰。 針對某些類型的驅動程式,系統預期會尋找特定的值專案。 You can add value entries to this subkey using AddReg directives in the driver's INF file.
Performance
指定選用效能監控資訊的金鑰。 此機碼下的值會指定驅動程式效能 DLL 的名稱,以及該 DLL 中某些匯出函式的名稱。 You can add value entries to this subkey using AddReg directives in the driver's INF file.
HKLM\SYSTEM\CurrentControlSet\Services<DriverName 中的常見登錄機碼和值>
Start
此 Start 值會指定何時應該啟動服務。 它可以有下列其中一個值:
-
0x0(開機):由開機載入器載入。 -
0x1(系統):由 I/O 子系統載入。 -
0x2(自動):在系統啟動期間由 Service Control Manager 自動載入。 -
0x3(需求):如果設備需要,則由 PnP 自動載入。 -
0x4(已停用):服務已停用,不會載入。
類型
此 Type 值會指定服務類型。 它可以是下列值的組合:
-
0x1(核心驅動程式):裝置驅動程式。 -
0x2(檔案系統驅動程式):檔案系統驅動程式。 -
0x10(Win32 自己的進程):在自己的進程中運行的 Win32 程式。 -
0x20(Win32 共用程式):與其他服務共用進程的 Win32 計劃。
ErrorControl
此 ErrorControl 值會指定服務無法啟動時錯誤的嚴重性。 它可以有下列其中一個值:
-
0x0(忽略):忽略錯誤,並繼續啟動。 -
0x1(正常):記錄錯誤,可能會顯示訊息框,但啟動會繼續。 -
0x2(嚴重):會記錄錯誤,並使用上次已知良好的組態重新啟動系統。 -
0x3(嚴重):會記錄錯誤,系統會嘗試使用上次已知良好的組態重新啟動。 如果失敗,啟動會失敗,系統會停止。
其他通用值
-
ImagePath:指定服務二進位檔的路徑。 Windows creates this value by using the required ServiceBinary entry in the driver's INF file. This entry is in the service-install-section referenced by the driver's INF AddService directive. -
DisplayName:服務的易記名稱。 -
Description:服務的說明。
Example
以下是服務的登錄專案範例:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ExampleService]
"Start"=dword:00000002
"Type"=dword:00000010
"ErrorControl"=dword:00000001
"ImagePath"="C:\\Program Files\\ExampleService\\example.exe"
"DisplayName"="Example Service"
"Description"="This is an example service."