Still working on installing my LWF driver. I think I'm close but I'm running into this error:
"hr 0x800f0203 There is no driver selected for the device information set or element."
I'm verifying that I'm copying the INF and the necessary components over with the SetupCopyOEMInfA function. There's a lock on the device before and a release after that i'm omitting posting for length. The error is being thrown at the pncClassSetup->Install function. It's probably because I my componentId is wrong but I saw it was being compared to MAX_PATH in an example I found so I thought it was an INF file. The examples I've been working off of are:
http://www.boudrand.net/index.php?option=com_content&view=article&id=5 http://stackoverflow.com/questions/10308583/programmatically-installing-ndis-filt er-driver
If anyone has any insight I would greatly appreciate it!
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();
}
}
Turns out that componentId is supposed to be the id in the INF file. In my case "ms_ndislwf" .