我正在尝试编写以编程方式安装NDIS 6.0轻量级筛选器驱动程序的C++代码。在回顾了WinDDK,在线示例和MSDN文档后,我最终得到了下面的代码示例。以编程方式安装筛选器驱动程序?
**************
hr = InstallSpecifiedComponent(
ModuleFileName,
L"MS_NdisLwf",
&GUID_DEVCLASS_NETSERVICE
);
**************
hr = HrInstallNetComponent(
pnc,
lpszPnpID,
pguidClass,
lpszInfFile
);
**************
if (!SetupCopyOEMInfW(lpszInfFullPath,
DirWithDrive, // Other files are in the same dir.as primary INF
SPOST_PATH, // SPOST_NONE, //First param is path to INF
0, // Default copy style
NULL,// Name of the INF after it's copied to %windir%\inf
0, // Max buf. size for the above
NULL, // Required size if non-null
NULL) // Optionally get the filename part of Inf name
after it is copied.
)
{
----
}
***************
hr = HrInstallComponent(pnc,
lpszComponentId,
pguidClass);
***************
hr = pnc->QueryNetCfgClass (pguidClass,
IID_INetCfgClassSetup,
(void**)&pncClassSetup);
if (hr == S_OK) {
wprintf(L"\n No Test\n");
hr = pncClassSetup->Install(szComponentId,
&OboToken,
0,
0, // Upgrade from build number.
NULL, // Answerfile name
NULL, // Answerfile section name
&pncc); // Reference after the component
if (S_OK == hr) { ... } // is installed.
使用INetCfgClassSetup :: Install的路径不起作用。
它走在从磁盘安装浏览选项中的默认路径
例如:我的INF文件路径为C:\用户\玛尼\桌面\萨加尔\ objchk_win7_x86 \ I386 \ netlwf.inf
但它要求在有盘菜单
d默认路径(第1项):\ \软件filter_driver
类似于图像==>http://i.stack.imgur.com/tmyMX.png
它总是要求相同的sys文件。
有什么遗漏了吗?
你也可以分享INF吗? –
请查看链接 我的inf文件在性质上几乎相似 [INF_FILE](http://weppinhole.googlecode.com/svn/trunk/WifiCaptureService/netlwf.inf) – arya2arya