드라이버 단 까지 안가고 랜카드를 disable 하는 방법이 있더라......
윈도우 상에는 disable 로 표시 되지 않으나..
disable 되는거 맞는거 같다....
재부팅 하니까 다시 올라오는걸로 확인 했고......
내가 사용한건.....
도메인에 join하려고 ip,dns 바꾸는데....
그때 다른 NIC는 disable 하는데 사용했지........
interface index 얻어서 사용하면 되네....
DWORD ZMainWnd::DealFixedConnection(DWORD dwIndex, bool bEnable)
{
PMIB_IFTABLE ifTable;
PMIB_IFROW pMibIfRow;
DWORD dwSize = 0;
DWORD dwRetVal = 0;
// Allocate memory for our pointers.
ifTable = (MIB_IFTABLE*) malloc(sizeof(MIB_IFTABLE));
pMibIfRow = (MIB_IFROW*) malloc(sizeof(MIB_IFROW));
// Before calling GetIfEntry, we call GetIfTable to make
// sure there are entries to get.
// Make an initial call to GetIfTable to get the
// necessary size into dwSize
if (GetIfTable(ifTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER)
{
free(ifTable);
ifTable = (MIB_IFTABLE *) malloc (dwSize);
}
// Make a second call to GetIfTable to get the actual
// data we want.
if (NO_ERROR == (dwRetVal = GetIfTable(ifTable, &dwSize, 0)))
{
if (ifTable->dwNumEntries > 0)
{
pMibIfRow->dwIndex = dwIndex;
if (NO_ERROR == (dwRetVal = GetIfEntry(pMibIfRow)))
{
//printf("Description: %s\n", pMibIfRow->bDescr);
if (bEnable)
pMibIfRow->dwAdminStatus = MIB_IF_ADMIN_STATUS_UP;
else
pMibIfRow->dwAdminStatus = MIB_IF_ADMIN_STATUS_DOWN;
// finally, set new state of the interface
if (NO_ERROR == (dwRetVal = SetIfEntry(pMibIfRow)))
{
//printf("Error in SetIfEntry: %d\n", dwRetVal);
}
}
else
{
//printf("Error in GetIfEntry: %d\n", dwRetVal);
}
return dwRetVal;
}
}
else
{
//printf("Error in GetIfTable:%d\n", dwRetVal);
}
free(ifTable);
return dwRetVal;
}
댓글