windows - 以编程方式安装过滤器驱动程序?

标签 windows networking driver device-driver ndis

我正在尝试以编程方式编写 C++ 代码来安装 NDIS 6.0 轻量级筛选器驱动程序。在查看了 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:\Users\Mani\Desktop\sagar\objchk_win7_x86\i386\netlwf.inf

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

d:\softwares\filter_driver

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

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

有没有什么东西不见了?

最佳答案

您的问题已经存在一年多了,我希望您已经找到了解决方案。为了开发人员面临同样的问题,我发布了这个答案。

从 ndis.com 上的 ProtInstall 项目开始

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

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

除此之外,这个项目有效,我已经通过它成功安装和卸载了 ndislwf 6.0 示例项目。

关于windows - 以编程方式安装过滤器驱动程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22173170/

相关文章:

linux - 正在运行的进程是否会损坏其目录中的可执行文件和文件(当前正在使用)

c++ - 通过调整视频适配器反转显示颜色

c - 使用 pcap 记录 tcp 对话

linux - 如何在启用调试日志的情况下编译内核模块

windows-10 - 无法加载 Windows 驱动程序

linux - 当线路规程 receive_buf2() 未处理所有提供的数据时发生

windows - 分析 .exe/.dll (Windows PE) 文件中的代码膨胀

windows - 命名空间扩展中用于删除操作的入口点是什么?

ios - 如何为iOS中的网络连接测试计算有效负载大小和超时长度?

networking - IP-Aliases 如何在 Google 云计算实例上工作?