Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone,

I'm trying to code an application that could desactivate and re-activate the TCP_IP interface in my network adapter's config. So I've found the INetCOmponent Control here : INetCfgComponentControl (Windows Driver Kit)[^] , and I guess I can do it with this class by calling the remove function.

Unfortunately, no clear implementations using this interface, and I get the error 80040154 in hr when trying to create an instance by this line:

C++
hr=CoCreateInstance(CLSID_NULL, NULL, CLSCTX_SERVER, IID_INetCfgComponentControl, (LPVOID*)&m_CfgCmpCtrl);


I'v also tried to get an instance by calling QueryInterface on a INetCfg object like this :

C++
hr = pnetcfg->QueryInterface(IID_INetCfgComponentControl, (LPVOID*)&m_CfgCmpCtrl);


without more success... error 80004002 or 80004003... So I'm looking for anyone who already have used this interface, and could tell me the way to get an instance...

thanks

Guillaume
Posted
Updated 26-Jul-10 3:13am
v2

INetCfgComponentControl looks like it's an interface. You either need to have a dig and find out what the CLSID_ for objects that implement that interface or find another way of getting a pointer to one (say using a COM moniker for the adapter you're interested in).

Having a quick scan of the docs for the interface makes me wonder if you're attacking this from the right direction. It looks to me as if objects implementing INetCfgComponentControl are created by drivers and given to the OS so the OS can call back the drivers while they're being configured.

I could be wrong though!

Cheers,

Ash

PS: Had a dig a bit further - you probably want to start with something that implements INetCfg (implemented by a class with CLSID CLSID_NetCfg). That looks like it's the root of all evil - you might be able to pull out the various components of your network stack through that.
 
Share this answer
 
v2
How do we know what is CLSID for INetCfg?

EDITED: got it. This page gives information of where to find the CLSID of a COM class from registry. And looking for netcfgx string, gives me several promising result, such as this : {5B035261-40F9-11D1-AAEC-00805FC1270E} : 'Network Configuration Component Object'

I am going to try with that value
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900