仍在安装我的 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();
}
}