Thanks. I now have a snetcfgex that does what I need
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@microsoft.com
Sent: Friday, February 09, 2001 2:48 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Disabling “File and Printer Sharing for Microsoft
Networks” for an adapter in Win2k
Danilo, try the following snippet :
First ::
Refer to netcfg sample in Windows 2000 DDK for the definition of missing
functions etc… (DDKROOT\src\network\config\netcfg)
use ms_server for szComponentId for “F&P Sharing for MS Networks”
/*-----------------------------------------*/
HRESULT EnableDisableBindings(IN PCWSTR szComponentId)
{
HRESULT hr=S_OK;
INetCfg* pnc=NULL;
INetCfgComponent* pncc=NULL;
INetCfgBindingPath* pncbp=NULL;
ULONG ulStatus = 0;
BOOL fEnable = FALSE;
hr = HrGetINetCfg( TRUE, &pnc);
if (SUCCEEDED(hr))
{
// get INetCfgComponent for szComponentId
hr = pnc->FindComponent(szComponentId, &pncc);
if (S_OK == hr)
{
_tprintf(L"Binding paths starting with ‘%s’\n",
szComponentId);
while (S_OK == (hr = HrGetNextBindingPath(pncc, EBP_BELOW,
&pncbp)))
{
// display the binding path
if ( pncbp )
{
if ( S_OK == pncbp->IsEnabled() )
{
_tprintf(L" - Enabled (Disabling) : “);
fEnable = FALSE;
}
else
{
_tprintf(L” - Disabled (Enabling) : ");
fEnable = TRUE;
}
hr = HrShowBindingPath(pncbp);
hr = pncbp->Enable( fEnable );
if ( hr == S_OK ) {
hr = pnc->Apply();
} else
_tprintf(L"\nCan not apply changes - 1\n\n");
}
else
_tprintf(L"\nCan not Enable/Disable the path - 1\n\n");
ReleaseObj(pncbp);
}
}
hr = HrReleaseINetCfg(FALSE, pnc);
}
return hr;
}
You are currently subscribed to ntdev as: xxxxx@mit.edu
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com