【问题标题】:Installing the filter driver programmatically?以编程方式安装过滤器驱动程序?
【发布时间】:2014-04-06 01:26:15
【问题描述】:

我正在尝试编写 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 文件。

有什么遗漏吗?

【问题讨论】:

  • 你也可以分享一下INF吗?
  • 请查看链接我的 inf 文件本质上几乎相似 INF_FILE

标签: windows networking driver device-driver ndis


【解决方案1】:

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

从 ndis.com 上的 ProtInstall 项目开始

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

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

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

【讨论】:

    猜你喜欢
    • 2012-05-05
    • 2013-11-15
    • 1970-01-01
    • 2020-03-19
    • 2011-01-18
    • 2023-03-16
    • 1970-01-01
    • 2011-04-16
    • 2010-10-04
    相关资源
    最近更新 更多