windows-nt/Source/XPSP1/NT/shell/ext/hnw/wizard/netapi.cpp

48 lines
955 B
C++
Raw Normal View History

2020-09-26 03:20:57 -05:00
//
// NetApi.cpp
//
// Wrapper / helper functions that interface between real net APIs and
// the Home Networking Wizard.
//
// Revision History:
//
// 9/27/1999 KenSh Created
//
#include "stdafx.h"
#include "NetConn.h"
#include "NetApi.h"
#include "theapp.h"
NETADAPTER* g_prgCachedAdapters;
int g_cCachedAdapters;
void FlushNetAdapterCache()
{
NetConnFree(g_prgCachedAdapters);
g_prgCachedAdapters = NULL;
g_cCachedAdapters = 0;
}
// Note: do NOT free the array that is returned!
int EnumCachedNetAdapters(const NETADAPTER** pprgAdapters)
{
if (!theApp.IsWindows9x())
{
// Shouldn't be called on NT
return 0;
}
if (g_prgCachedAdapters == NULL)
{
// Note: this will be leaked if FlushNetAdapterCache() is not called
g_cCachedAdapters = EnumNetAdapters(&g_prgCachedAdapters);
}
*pprgAdapters = g_prgCachedAdapters;
return g_cCachedAdapters;
}