カーネル ドライバー (.sys) を持っています。このドライバーのインストールと制御に使用できる適切なソースはどこにありますか?
2114 次
2 に答える
1
NDIS ドライバーをインストールするために何年も前に書いたコードを次に示します。XPでテストおよび使用されていますが、それより新しいものについてはわかりません。異なる種類のドライバーをインストールするには、ほとんどの場合、グループと依存関係を変更する必要があります。
#define Win32_LEAN_AND_MEAN
#include <windows.h>
void install_NDIS_driver(char const *path, char const *name ) {
// This uses the name as both the driver name and the display name.
SC_HANDLE manager = OpenSCManager(NULL, NULL, SC_MANAGER_CREATE_SERVICE);
SC_HANDLE service = CreateService(manager,
name, // driver name
name, // driver display name
GENERIC_EXECUTE, // allow ourselves to start the service.
SERVICE_KERNEL_DRIVER, // type of driver.
SERVICE_SYSTEM_START, // starts after boot drivers.
SERVICE_ERROR_NORMAL, // log any problems, but don't crash if it can't be loaded.
path, // path to binary file.
"NDIS", // group to which this driver belongs.
NULL,
"NDIS\0", // driver we depend upon.
NULL, // run from the default LocalSystem account.
NULL); // don't need a password for LocalSystem .
// The driver is now installed in the machine. We'll try to start it dynamically.
StartService(service, 0, NULL); // no arguments - drivers get their "stuff" from the registry.
CloseServiceHandle(service); // We're done with the service handle
CloseServiceHandle(manager); // and with the service manager.
}
于 2012-10-08T17:05:16.037 に答える
0
Windows サービス コントローラーを使用して、カーネル モード ドライバーを登録および制御できます。
- type=kernel および binPath で .sys ファイルを指す "sc create" を使用して、サービスを作成します。
- 「sc start」と「sc stop」を使用してドライバを制御します
于 2012-10-08T16:58:47.090 に答える