未绑定安装NDIS Filer驱动程序

问题描述 投票:0回答:1

我已经构建了“ NDIS 6.0筛选器驱动程序” WinDDK示例(ndislwf.sys),并构建了BindView示例来安装“ NDIS 6.0筛选器驱动程序”。它安装确定,但默认情况下始终绑定到所有网络接口。是否可以安装NDIS筛选器驱动程序并将其与所有网络接口解除绑定,因此我只能将其绑定到某些接口?

来自BindView的代码使用SetupCopyOEMInfW将驱动程序复制到OemInfs:

if ( !SetupCopyOEMInfW(lpszInfFullPath,
                               DirWithDrive,  // Other files are in the
                                              // same dir. as primary INF
                               SPOST_PATH,    // 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.
            dwError = GetLastError();

然后,使用INetCfgClassSetup :: Install():

INetCfgClassSetup   *pncClassSetup = NULL;
INetCfgComponent    *pncc = NULL;
OBO_TOKEN           OboToken;
HRESULT             hr = S_OK;

//
// OBO_TOKEN specifies on whose behalf this
// component is being installed.
// Set it to OBO_USER so that szComponentId will be installed
// on behalf of the user.
//

ZeroMemory( &OboToken,
            sizeof(OboToken) );
OboToken.Type = OBO_USER;

//
// Get component's setup class reference.
//

hr = pnc->QueryNetCfgClass ( pguidClass,
                             IID_INetCfgClassSetup,
                             (void**)&pncClassSetup );
if ( hr == S_OK ) {

    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.

        //
        // we don't need to use pncc (INetCfgComponent), release it
        //

        ReleaseRef( pncc );
    }

    ReleaseRef( pncClassSetup );
}
driver wdk ndis
1个回答
0
投票

Windows 10的最新版本具有此功能。将此行放入您的INF:

HKR, Ndi\Interfaces, DisableDefaultBindings, 0x00010001, 1

在具有FilterMediaTypes指令的同一部分中添加该行。

该指令将在禁用状态下为您的过滤器创建所有新的绑定。您可以采用与以前相同的方式手动重新启用它们:

  • 从命令行(Set-NetAdapterBinding);
  • GUI(运行ncpa.cpl,打开适配器属性,选中过滤器驱动程序旁边的框);或
  • 来自INetCfg代码(INetCfgBindingPath::Enable)。
© www.soinside.com 2019 - 2024. All rights reserved.