FIXED_INFO

結構體介紹,FIXED_INFO structure,頭檔案,定義,使用,示例代碼,

結構體介紹

FIXED_INFO structure

TheFIXED_INFOstructure contains information that is the same across all the interfaces on a computer.

頭檔案

#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;

使用

TheFIXED_INFOstructure is retrieved by theGetNetworkParamsfunction.

示例代碼

//// 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 toGetNetworkParamsfailed. Return Value: %08x\n", dwRetVal );
exit(1);
}

相關詞條

熱門詞條

聯絡我們