函式原型
NTSTATUSZwLoadDriver(
IN PUNICODE_STRING DriverServiceName
);
函式說明
參數說明DriverServiceName:一個指向驅動程式註冊表鍵Unicode字串的指針,該註冊表鍵位於"\Registry\Machine\System\CurrentControlSet\Services\DriverName"(一般位於HKEY_LOCAL_MACHINE主鍵下),DriverName是該驅動的註冊名
返回值
該函式返回一個 STATUS_SUCCESS 或一個適當的NTSTATUS類型的錯誤值注意
ZwLoadDriver 動態地載入一個設備或一個檔案系統驅動到當前正在運行的系統.但如果當前的系統正在運行於安全模式,驅動程式會因為不是一個在安全模式驅動載入清單內的程式而失敗,函式會返回STATUS_SUCCESS .使用 ZwLoadDriver的設備必須已在當前系統環境中正確註冊,或在"\Registry\Machine\System\CurrentControlSet\Services\DriverName"(一般位於HKEY_LOCAL_MACHINE主鍵下,DriverName是該驅動的註冊名)下正確寫入鍵值,否則函式無法被使用.
需求
該函式需運行在Windows XP或更新的版本中需要包含 ntifs.h頭檔案
DDK幫助文檔原文
ZwLoadDriverThe ZwLoadDriver routine loads a driver into the system.
NTSTATUS
ZwLoadDriver(
IN PUNICODE_STRING DriverServiceName
);
Parameters
DriverServiceName Pointer to a counted Unicode string that specifies a path to the driver's registry key, \Registry\Machine\System\CurrentControlSet\Services\DriverName, where DriverName is the name of the driver.
Return Value
ZwLoadDriver returns STATUS_SUCCESS or an appropriate error NTSTATUS value.
Comments
ZwLoadDriver dynamically loads a device or file system driver into the currently running system.
Note If the system is running in safe mode, and the driver fails to load because it is not on the safe mode list, ZwLoadDriver returns STATUS_SUCCESS.
A minifilter should use FltLoadFilter instead of ZwLoadDriver to load a supporting minifilter.
Note If the call to the ZwLoadDriver function occurs in user mode, you should use the name " NtLoadDriver " instead of " ZwLoadDriver".
Requirements
Versions: This routine is available on Microsoft Windows XP and later.
IRQL: PASSIVE_LEVEL
Headers: Declared in ntifs.h. Include ntifs.h.
See Also
FltLoadFilter, RtlInitUnicodeString , UNICODE_STRING , ZwUnloadDriver