0

仍在安装我的 LWF 驱动程序。我想我已经接近了,但我遇到了这个错误:

“hr 0x800f0203 没有为设备信息集或元素选择驱动程序。”

我正在使用 SetupCopyOEMInfA 函数验证我正在复制 INF 和必要的组件。之前设备上有一个锁,之后有一个释放,我省略了发布的长度。在 pncClassSetup->Install 函数中引发错误。这可能是因为我的 componentId 是错误的,但在我发现的一个示例中我看到它与 MAX_PATH 进行了比较,所以我认为它是一个 INF 文件。我一直在研究的例子是:

http://www.boudrand.net/index.php?option=com_content&view=article&id=5 http://stackoverflow.com/questions/10308583/programmatically-installing-ndis-filt er-driver

如果有人有任何见解,我将不胜感激!

hr = pnc->QueryNetCfgClass( &GUID_DEVCLASS_NETSERVICE,                     
    IID_INetCfgClassSetup,                      
    (void**)&pncClassSetup);

if (SUCCEEDED(hr))   {

    bool isCopied;
    PCSTR pathToInf =  "C:\\Users\\user\\Desktop\\directory\\i386\\lwf.inf";
    PCSTR pathToBin =  "C:\\Users\\user\\Desktop\\directory\\i386\\";
    PSTR DestinationInfFileName = "lwf.inf";

    isCopied = SetupCopyOEMInfA(pathToInf,                                         
     // path to inf file
        pathToBin,                                                                    
              // dir containing driver binary
        SPOST_PATH,
        0,
        NULL,
        256,
        NULL,
        NULL);

    hr = CoCreateInstance( CLSID_CNetCfg,
        NULL, CLSCTX_INPROC_SERVER,
        IID_INetCfg,
        (void**)&pnc );

    LPCWSTR componentId;
    componentId = L"C:\\Users\\user\\Desktop\\directory\\i386\\lwf.inf";

    hr = pncClassSetup->Install( componentId,
        &OboToken,
        NSF_POSTSYSINSTALL,
        0,
        NULL,
        NULL,
        &pncc);


    if (S_OK == hr){        
        pncc->Release();
        pncClassSetup ->Release();

        if (SUCCEEDED(hr))   
            hr = pnc->Apply();
    }
}
4

2 回答 2

1

原来 componentId 应该是 INF 文件中的 id。在我的情况下 "ms_ndislwf" 。

于 2012-05-17T17:28:14.413 回答
0

为了澄清上述回复,INetCfgClassSetup::Install() 方法的第一个参数必须与 INF 文件的 DDInstall 部分中指示的硬件 ID 匹配。例如:

[Manufacturer]
"Company Name" = DDInstallSectionName, architecture

[DDInstallSectionName.architecture]
"Driver Display Name" = Name_Of_Install_Section, HardwareId

用一些数据填充它,我们有:

[Manufacturer]
"Taco Distributors Inc" = TacoDriver, NTamd64

[TacoDriver.NTamd64]
"Universal Taco Driver" = Taco_Install, 123TacosADay

[Taco_Install]
AddReg...
CopyFiles...
etc...

在上面的示例中,您需要将“123TacosADay”传递给 InetCfgClassSetup::Install() 方法的第一个参数。

于 2019-06-18T21:53:30.167 回答