FIXED_INFO

tain char char

結構體介紹

The FIXED_INFO structure contains information that is the same across all the interfaces on a computer.
FIXED_INFO結構體包含

頭檔案

#include Iphlpapi.h.

定義

typedef struct {
char HostName[MAX_HOSTNAME_LEN + 4];//本地計算機的主機名稱
char DomainName[MAX_DOMAIN_NAME_LEN + 4];//本地計算機已註冊的域名
PIP_ADDR_STRING CurrentDnsServer;//使用DnsServerList為本地計算機獲取DNS服務
IP_ADDR_STRING DnsServerList;//一個本地計算機可用的DNS伺服器的IP_ADDR_STRING結構體鍊表
UINT NodeType;//本地計算機節點類型
char ScopeId[MAX_SCOPE_ID_LEN + 4];//DHCP範圍內的名字
UINT EnableRouting;//指定本地計算機路由功能是否開啟
UINT EnableProxy;//指定本地計算機是否作為ARP代理
UINT EnableDns;//指定本地計算機DNS是否開啟
} FIXED_INFO, *PFIXED_INFO;

使用

The FIXED_INFO structure is retrieved by the GetNetworkParams function.

示例代碼

//// Link with IPHlpAPI.lib//
#include <winsock2.h>
#include <iphlpapi.h>
#include <stdio.h>
int __cdecl main()
{
FIXED_INFO * FixedInfo;
ULONG ulOutBufLen;
DWORD dwRetVal;
IP_ADDR_STRING * pIPAddr;
FixedInfo = (FIXED_INFO *)
GlobalAlloc( GPTR, sizeof( FIXED_INFO ) );
ulOutBufLen = sizeof( FIXED_INFO );
if( ERROR_BUFFER_OVERFLOW == GetNetworkParams( FixedInfo, &ulOutBufLen ) )
{
GlobalFree( FixedInfo );
FixedInfo = (FIXED_INFO *) GlobalAlloc( GPTR, ulOutBufLen );
}
if ( dwRetVal = GetNetworkParams( FixedInfo, &ulOutBufLen ) )
{
PRINTF( "Call to GetNetworkParams failed. Return Value: %08x\n", dwRetVal );
exit(1);
}
else
{
printf( "Host Name: %s\n", FixedInfo -> HostName );
printf( "Domain Name: %s\n", FixedInfo -> DomainName );
printf( "DNS Servers:\n" );
printf( "\t%s\n", FixedInfo -> DnsServerList.IpAddress.String );
pIPAddr = FixedInfo -> DnsServerList.Next;
while ( pIPAddr )
{
printf( "\t%s\n", pIPAddr ->IpAddress.String );
pIPAddr = pIPAddr ->Next;
}
}
exit( 0 );
}

相關詞條

熱門詞條

聯絡我們