以编程方式安装筛选器驱动程序? [英] Installing the filter driver programmatically?

查看:76
本文介绍了以编程方式安装筛选器驱动程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写C ++代码,以编程方式安装NDIS 6.0轻量级筛选器驱动程序.在回顾了WinDDK,在线示例和MSDN文档之后,我得到了下面的代码示例.

I am trying to write C++ code programmatically installing NDIS 6.0 lightweight filter driver. After reviewing WinDDK, online examples and MSDN documentation I ended up with the code sample below.

**************
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的路径不起作用.

The path using INetCfgClassSetup::Install does not work.

它采用从磁盘安装"选项中的默认路径

It is taking the default path in the Have Disk Browse Options

例如:我的inf文件路径为C:\ Users \ Mani \ Desktop \ sagar \ objchk_win7_x86 \ i386 \ netlwf.inf

eg: my inf file path is C:\Users\Mani\Desktop\sagar\objchk_win7_x86\i386\netlwf.inf

但是它在具有磁盘菜单中要求默认路径(第一个条目)

but it is asking for the default path(1st entry) in have disk menu

d:\ softwares \ filter_driver

d:\softwares\filter_driver

类似于图片==> http://i.stack.imgur.com/tmyMX.png

它总是要求相同的sys文件.

It is always asking for the same sys file.

是否缺少任何东西?

推荐答案

您的问题已有一年多了,希望您找到了解决方案.为了开发人员遇到相同的问题,我发布了这个答案.

Your question is over a year old, and I hope that you have found the solution. For the sake of developers facing same problem, I posting this answer.

从ndis.com开始ProtInstall项目

Start with ProtInstall project at ndis.com

http://www.ndis.com/ndis-general/ndisinstall/programinstall.htm

您可能需要进行一些更改:包括头文件,库;和一些调试.

you might need to make some changes : include the header files, libraries; and some debugging.

除此之外,该项目可以正常运行,并且我已经通过该项目成功安装和卸载了ndislwf 6.0示例项目.

Other than that, this project works and I have successfully installed and uninstalled ndislwf 6.0 sample project via this.

这篇关于以编程方式安装筛选器驱动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆