src/SeeDll/Packet32.c
/*!
  \brief Returns comprehensive information the addresses of an adapter.
  \param AdapterName String that contains the name of the adapter.
  \param buffer A user allocated array of npf_if_addr that will be filled by the function.
  \param NEntries Size of the array (in npf_if_addr).
  \return If the function succeeds, the return value is nonzero.

  This function grabs from the registry information like the IP addresses, the netmasks 
  and the broadcast addresses of an interface. The buffer passed by the user is filled with 
  npf_if_addr structures, each of which contains the data for a single address. If the buffer
  is full, the reaming addresses are dropped, therefore set its dimension to sizeof(npf_if_addr)
  if you want only the first address.
*/
\brief Returns comprehensive information the addresses of an adapter.
\param AdapterName String that contains the name of the adapter.
\param buffer A user allocated array of npf_if_addr that will be filled by the function.
\param NEntries Size of the array (in npf_if_addr).
\return If the function succeeds, the return value is nonzero.

This function grabs from the registry information like the IP addresses, the netmasks
and the broadcast addresses of an interface. The buffer passed by the user is filled with
npf_if_addr structures, each of which contains the data for a single address. If the buffer
is full, the reaming addresses are dropped, therefore set its dimension to sizeof(npf_if_addr)
if you want only the first address.
\ brief Returns comprehensive information the addresses of an adapter . \ param AdapterName String that contains the name of the adapter . \ param buffer A user allocated array of npf_if_addr that will be filled by the function . \ param NEntries Size of the array ( in npf_if_addr ) . \ return If the function succeeds the return value is nonzero . This function grabs from the registry information like the IP addresses the netmasks and the broadcast addresses of an interface . The buffer passed by the user is filled with npf_if_addr structures each of which contains the data for a single address . If the buffer is full the reaming addresses are dropped therefore set its dimension to sizeof ( npf_if_addr ) if you want only the first address .
BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries)
{
	PADAPTER_INFO TAdInfo;
	PCHAR Tname;
	BOOLEAN Res, FreeBuff;
	ODS("PacketGetNetInfo\n");
	if(AdapterName[1] != 0)
	{ 
		Tname = AdapterName;
		FreeBuff = FALSE;
	}
	else
	{
		Tname = WChar2SChar((PWCHAR)AdapterName);
		FreeBuff = TRUE;
	}
	if(!PacketUpdateAdInfo(Tname))
	{
		ODS("PacketGetNetInfo: Adapter not found\n");
		if(FreeBuff)GlobalFreePtr(Tname);
		return FALSE;
	}
	WaitForSingleObject(AdaptersInfoMutex, INFINITE);
	TAdInfo = PacketFindAdInfo(Tname);
	if(TAdInfo != NULL)
	{
		*NEntries = (TAdInfo->NNetworkAddresses < *NEntries)? TAdInfo->NNetworkAddresses: *NEntries;
		if (*NEntries > 0)
			memcpy(buffer, TAdInfo->NetworkAddresses, *NEntries * sizeof(npf_if_addr));
		Res = TRUE;
	}
	else
	{
		ODS("PacketGetNetInfo: Adapter not found\n");
		Res = FALSE;
	}
	ReleaseMutex(AdaptersInfoMutex);
	if(FreeBuff)GlobalFreePtr(Tname);
	return Res;
}
BOOLEAN PacketGetNetInfoEx ( PCHAR AdapterName , npf_if_addr * buffer , PLONG NEntries ) { PADAPTER_INFO TAdInfo ; PCHAR Tname ; BOOLEAN Res , FreeBuff ; ODS ( " \n " ) ; if ( AdapterName [ 1 ] != 0 ) { Tname = AdapterName ; FreeBuff = FALSE ; } else { Tname = WChar2SChar ( ( PWCHAR ) AdapterName ) ; FreeBuff = TRUE ; } if ( ! PacketUpdateAdInfo ( Tname ) ) { ODS ( " \n " ) ; if ( FreeBuff ) GlobalFreePtr ( Tname ) ; return FALSE ; } WaitForSingleObject ( AdaptersInfoMutex , INFINITE ) ; TAdInfo = PacketFindAdInfo ( Tname ) ; if ( TAdInfo != NULL ) { * NEntries = ( TAdInfo -> NNetworkAddresses < * NEntries ) ? TAdInfo -> NNetworkAddresses : * NEntries ; if ( * NEntries > 0 ) memcpy ( buffer , TAdInfo -> NetworkAddresses , * NEntries * sizeof ( npf_if_addr ) ) ; Res = TRUE ; } else { ODS ( " \n " ) ; Res = FALSE ; } ReleaseMutex ( AdaptersInfoMutex ) ; if ( FreeBuff ) GlobalFreePtr ( Tname ) ; return Res ; }
\brief Returns comprehensive information the addresses of an adapter.
\ brief Returns comprehensive information the addresses of an adapter .
// Provide conversion for backward compatibility
 //ASCII
 //
 // Update the information about this adapter
 //
 // Find the PADAPTER_INFO structure associated with this adapter 
 //TODO what if nentries = 0?
