iphlpapi 如何不重启电脑改网卡 ip address,netmask,gateway,dns ( 积分: 200 )

  • 主题发起人 主题发起人 黑猫白猫
  • 开始时间 开始时间

黑猫白猫

Unregistered / Unconfirmed
GUEST, unregistred user!
查了一些网上的资料:
发现windows的system32中有个名叫iphlpapi.dll的文件,它包含了所有的IP相关操作。它的输出有:

Ordinal Address Name
00000001 76D682E2 AddIPAddress
00000002 76D63867 AllocateAndGetArpEntTableFromStack
00000003 76D6442C AllocateAndGetIfTableFromStack
00000004 76D6A17F AllocateAndGetIpAddrTableFromStack
00000005 76D63F28 AllocateAndGetIpForwardTableFromStack
00000006 76D6A2DE AllocateAndGetIpNetTableFromStack
00000007 76D6A4D5 AllocateAndGetTcpExTableFromStack
00000008 76D6A1F5 AllocateAndGetTcpTableFromStack
00000009 76D6A61F AllocateAndGetUdpExTableFromStack
0000000A 76D6A26B AllocateAndGetUdpTableFromStack
0000000B 76D66B04 CreateIpForwardEntry
0000000C 76D66C62 CreateIpNetEntry
0000000D 76D66EF1 CreateProxyArpEntry
0000000E 76D683E5 DeleteIPAddress
0000000F 76D66BB2 DeleteIpForwardEntry
00000010 76D66D1A DeleteIpNetEntry
00000011 76D66FCA DeleteProxyArpEntry
00000012 76D687F2 DisableMediaSense
00000013 76D68705 EnableRouter
00000014 76D66D6C FlushIpNetTable
00000015 76D69D25 FlushIpNetTableFromStack
00000016 76D64308 GetAdapterIndex
00000017 76D6150E GetAdapterOrderMap
00000018 76D68930 GetAdaptersAddresses
00000019 76D6217C GetAdaptersInfo
0000001A 76D64182 GetBestInterface
0000001B 76D66E1A GetBestInterfaceEx
0000001C 76D641E4 GetBestInterfaceFromStack
0000001D 76D66EA7 GetBestRoute
0000001E 76D695E4 GetBestRouteFromStack
0000001F 76D66740 GetFriendlyIfIndex
00000020 76D64BD1 GetIcmpStatistics
00000021 76D66891 GetIcmpStatisticsEx
00000022 76D64C1D GetIcmpStatsFromStack
00000023 76D69AC5 GetIcmpStatsFromStackEx
00000024 76D64227 GetIfEntry
00000025 76D6426B GetIfEntryFromStack
00000026 76D61A70 GetIfTable
00000027 76D6192C GetIfTableFromStack
00000028 76D681A9 GetIgmpList
00000029 76D61486 GetInterfaceInfo
0000002A 76D64551 GetIpAddrTable
0000002B 76D644BE GetIpAddrTableFromStack
0000002C 76D6732A GetIpErrorString
0000002D 76D64003 GetIpForwardTable
0000002E 76D63DC9 GetIpForwardTableFromStack
0000002F 76D6674C GetIpNetTable
00000030 76D698FF GetIpNetTableFromStack
00000031 76D64BC3 GetIpStatistics
00000032 76D64671 GetIpStatisticsEx
00000033 76D61347 GetIpStatsFromStack
00000034 76D646E5 GetIpStatsFromStackEx
00000035 76D688DF GetNetworkParams
00000036 76D61B91 GetNumberOfInterfaces
00000037 76D62DBA GetPerAdapterInfo
00000038 76D684F1 GetRTTAndHopCount
00000039 76D64C89 GetTcpStatistics
0000003A 76D66930 GetTcpStatisticsEx
0000003B 76D69BE0 GetTcpStatsFromStack
0000003C 76D64CDE GetTcpStatsFromStackEx
0000003D 76D670A3 GetTcpTable
0000003E 76D69753 GetTcpTableFromStack
0000003F 76D64D64 GetUdpStatistics
00000040 76D669E9 GetUdpStatisticsEx
00000041 76D69B74 GetUdpStatsFromStack
00000042 76D64DB9 GetUdpStatsFromStackEx
00000043 76D671C8 GetUdpTable
00000044 76D69863 GetUdpTableFromStack
00000045 76D621CC GetUniDirectionalAdapterInfo
00000046 76D673F4 Icmp6CreateFile
00000047 76D676C3 Icmp6ParseReplies
00000048 76D67701 Icmp6SendEcho2
00000049 76D62FA4 IcmpCloseHandle
0000004A 76D62FC5 IcmpCreateFile
0000004B 76D62F50 IcmpParseReplies
0000004D 76D62E07 IcmpSendEcho
0000004C 76D674C3 IcmpSendEcho2
0000004E 76D67F68 InternalCreateIpForwardEntry
0000004F 76D6809D InternalCreateIpNetEntry
00000050 76D67FF6 InternalDeleteIpForwardEntry
00000051 76D68115 InternalDeleteIpNetEntry
00000052 76D67AE9 InternalGetIfTable
00000053 76D67BCF InternalGetIpAddrTable
00000054 76D67D25 InternalGetIpForwardTable
00000055 76D67C79 InternalGetIpNetTable
00000056 76D67DD8 InternalGetTcpTable
00000057 76D67E82 InternalGetUdpTable
00000058 76D67F29 InternalSetIfEntry
00000059 76D67FAF InternalSetIpForwardEntry
0000005A 76D680D9 InternalSetIpNetEntry
0000005B 76D68063 InternalSetIpStats
0000005C 76D6816F InternalSetTcpEntry
0000005D 76D68993 IpReleaseAddress
0000005E 76D68A07 IpRenewAddress
0000005F 76D68610 IsLocalAddress
00000060 76D6C2C1 NTPTimeToNTFileTime
00000061 76D6C20C NTTimeToNTPTime
00000062 76D6902A NhGetGuidFromInterfaceName
00000063 76D6907C NhGetInterfaceNameFromDeviceGuid
00000064 76D68FD5 NhGetInterfaceNameFromGuid
00000065 76D6A072 NhpAllocateAndGetInterfaceInfoFromStack
00000066 76D696AE NhpGetInterfaceIndexFromStack
00000067 76D6335A NotifyAddrChange
00000068 76D68AD9 NotifyRouteChange
00000069 76D68672 NotifyRouteChangeEx
0000007A 76D68879 RestoreMediaSense
0000007B 76D661FD RtlIpv4AddressToStringExA
0000007C 76D66342 RtlIpv4AddressToStringExW
0000007D 76D6A8EA RtlIpv4StringToAddressExA
0000007E 76D6ABFB RtlIpv4StringToAddressExW
0000007F 76D66141 RtlIpv6AddressToStringExA
00000080 76D66285 RtlIpv6AddressToStringExW
00000081 76D6A703 RtlIpv6StringToAddressExA
00000082 76D6AA2F RtlIpv6StringToAddressExW
00000083 76D68A7B SendARP
00000084 76D6E681 SetAdapterIpAddress
00000085 76D6821F SetBlockRoutes
00000086 76D66AA2 SetIfEntry
00000087 76D69FE3 SetIfEntryToStack
00000088 76D66B5B SetIpForwardEntry
00000089 76D6A38D SetIpForwardEntryToStack
0000008A 76D69F56 SetIpMultihopRouteEntryToStack
0000008B 76D66CC8 SetIpNetEntry
0000008C 76D69C4C SetIpNetEntryToStack
0000008D 76D69EE7 SetIpRouteEntryToStack
0000008E 76D66C10 SetIpStatistics
0000008F 76D69A56 SetIpStatsToStack
00000090 76D672EB SetIpTTL
00000091 76D69D6A SetProxyArpEntryToStack
00000092 76D68293 SetRouteWithRef
00000093 76D66DC9 SetTcpEntry
00000094 76D697F7 SetTcpEntryToStack
00000095 76D6878C UnenableRouter
0000006A 76D6AD50 _PfAddFiltersToInterface@24
0000006B 76D6AE18 _PfAddGlobalFilterToInterface@8
0000006C 76D6AF5E _PfBindInterfaceToIPAddress@12
0000006D 76D6AEC3 _PfBindInterfaceToIndex@16
0000006E 76D6AD38 _PfCreateInterface@24
0000006F 76D6AD46 _PfDeleteInterface@4
00000070 76D6B0A4 _PfDeleteLog@0
00000071 76D6B064 _PfGetInterfaceStatistics@16
00000072 76D6B04C _PfMakeLog@4
00000073 76D6AFE1 _PfRebindFilters@8
00000074 76D6ADDB _PfRemoveFilterHandles@12
00000075 76D6AD96 _PfRemoveFiltersFromInterface@20
00000076 76D6AE52 _PfRemoveGlobalFilterFromInterface@8
00000077 76D6B056 _PfSetLogBuffer@28
00000078 76D6B0AE _PfTestPacket@20
00000079 76D6AE8C _PfUnBindInterface@4
00000096 76D6796F do_echo_rep
00000097 76D678A6 do_echo_req
00000098 76D67890 register_icmp

不过不知道每个函数的参数情况,而且网上好像很少有关于这个文件的资料。
问不用重启电脑(包括 win98,win2000,winxp,win2003)改网卡 ip address,netmask,gateway,dns DELPHI 编程如何写。
 
查了一些网上的资料:
发现windows的system32中有个名叫iphlpapi.dll的文件,它包含了所有的IP相关操作。它的输出有:

Ordinal Address Name
00000001 76D682E2 AddIPAddress
00000002 76D63867 AllocateAndGetArpEntTableFromStack
00000003 76D6442C AllocateAndGetIfTableFromStack
00000004 76D6A17F AllocateAndGetIpAddrTableFromStack
00000005 76D63F28 AllocateAndGetIpForwardTableFromStack
00000006 76D6A2DE AllocateAndGetIpNetTableFromStack
00000007 76D6A4D5 AllocateAndGetTcpExTableFromStack
00000008 76D6A1F5 AllocateAndGetTcpTableFromStack
00000009 76D6A61F AllocateAndGetUdpExTableFromStack
0000000A 76D6A26B AllocateAndGetUdpTableFromStack
0000000B 76D66B04 CreateIpForwardEntry
0000000C 76D66C62 CreateIpNetEntry
0000000D 76D66EF1 CreateProxyArpEntry
0000000E 76D683E5 DeleteIPAddress
0000000F 76D66BB2 DeleteIpForwardEntry
00000010 76D66D1A DeleteIpNetEntry
00000011 76D66FCA DeleteProxyArpEntry
00000012 76D687F2 DisableMediaSense
00000013 76D68705 EnableRouter
00000014 76D66D6C FlushIpNetTable
00000015 76D69D25 FlushIpNetTableFromStack
00000016 76D64308 GetAdapterIndex
00000017 76D6150E GetAdapterOrderMap
00000018 76D68930 GetAdaptersAddresses
00000019 76D6217C GetAdaptersInfo
0000001A 76D64182 GetBestInterface
0000001B 76D66E1A GetBestInterfaceEx
0000001C 76D641E4 GetBestInterfaceFromStack
0000001D 76D66EA7 GetBestRoute
0000001E 76D695E4 GetBestRouteFromStack
0000001F 76D66740 GetFriendlyIfIndex
00000020 76D64BD1 GetIcmpStatistics
00000021 76D66891 GetIcmpStatisticsEx
00000022 76D64C1D GetIcmpStatsFromStack
00000023 76D69AC5 GetIcmpStatsFromStackEx
00000024 76D64227 GetIfEntry
00000025 76D6426B GetIfEntryFromStack
00000026 76D61A70 GetIfTable
00000027 76D6192C GetIfTableFromStack
00000028 76D681A9 GetIgmpList
00000029 76D61486 GetInterfaceInfo
0000002A 76D64551 GetIpAddrTable
0000002B 76D644BE GetIpAddrTableFromStack
0000002C 76D6732A GetIpErrorString
0000002D 76D64003 GetIpForwardTable
0000002E 76D63DC9 GetIpForwardTableFromStack
0000002F 76D6674C GetIpNetTable
00000030 76D698FF GetIpNetTableFromStack
00000031 76D64BC3 GetIpStatistics
00000032 76D64671 GetIpStatisticsEx
00000033 76D61347 GetIpStatsFromStack
00000034 76D646E5 GetIpStatsFromStackEx
00000035 76D688DF GetNetworkParams
00000036 76D61B91 GetNumberOfInterfaces
00000037 76D62DBA GetPerAdapterInfo
00000038 76D684F1 GetRTTAndHopCount
00000039 76D64C89 GetTcpStatistics
0000003A 76D66930 GetTcpStatisticsEx
0000003B 76D69BE0 GetTcpStatsFromStack
0000003C 76D64CDE GetTcpStatsFromStackEx
0000003D 76D670A3 GetTcpTable
0000003E 76D69753 GetTcpTableFromStack
0000003F 76D64D64 GetUdpStatistics
00000040 76D669E9 GetUdpStatisticsEx
00000041 76D69B74 GetUdpStatsFromStack
00000042 76D64DB9 GetUdpStatsFromStackEx
00000043 76D671C8 GetUdpTable
00000044 76D69863 GetUdpTableFromStack
00000045 76D621CC GetUniDirectionalAdapterInfo
00000046 76D673F4 Icmp6CreateFile
00000047 76D676C3 Icmp6ParseReplies
00000048 76D67701 Icmp6SendEcho2
00000049 76D62FA4 IcmpCloseHandle
0000004A 76D62FC5 IcmpCreateFile
0000004B 76D62F50 IcmpParseReplies
0000004D 76D62E07 IcmpSendEcho
0000004C 76D674C3 IcmpSendEcho2
0000004E 76D67F68 InternalCreateIpForwardEntry
0000004F 76D6809D InternalCreateIpNetEntry
00000050 76D67FF6 InternalDeleteIpForwardEntry
00000051 76D68115 InternalDeleteIpNetEntry
00000052 76D67AE9 InternalGetIfTable
00000053 76D67BCF InternalGetIpAddrTable
00000054 76D67D25 InternalGetIpForwardTable
00000055 76D67C79 InternalGetIpNetTable
00000056 76D67DD8 InternalGetTcpTable
00000057 76D67E82 InternalGetUdpTable
00000058 76D67F29 InternalSetIfEntry
00000059 76D67FAF InternalSetIpForwardEntry
0000005A 76D680D9 InternalSetIpNetEntry
0000005B 76D68063 InternalSetIpStats
0000005C 76D6816F InternalSetTcpEntry
0000005D 76D68993 IpReleaseAddress
0000005E 76D68A07 IpRenewAddress
0000005F 76D68610 IsLocalAddress
00000060 76D6C2C1 NTPTimeToNTFileTime
00000061 76D6C20C NTTimeToNTPTime
00000062 76D6902A NhGetGuidFromInterfaceName
00000063 76D6907C NhGetInterfaceNameFromDeviceGuid
00000064 76D68FD5 NhGetInterfaceNameFromGuid
00000065 76D6A072 NhpAllocateAndGetInterfaceInfoFromStack
00000066 76D696AE NhpGetInterfaceIndexFromStack
00000067 76D6335A NotifyAddrChange
00000068 76D68AD9 NotifyRouteChange
00000069 76D68672 NotifyRouteChangeEx
0000007A 76D68879 RestoreMediaSense
0000007B 76D661FD RtlIpv4AddressToStringExA
0000007C 76D66342 RtlIpv4AddressToStringExW
0000007D 76D6A8EA RtlIpv4StringToAddressExA
0000007E 76D6ABFB RtlIpv4StringToAddressExW
0000007F 76D66141 RtlIpv6AddressToStringExA
00000080 76D66285 RtlIpv6AddressToStringExW
00000081 76D6A703 RtlIpv6StringToAddressExA
00000082 76D6AA2F RtlIpv6StringToAddressExW
00000083 76D68A7B SendARP
00000084 76D6E681 SetAdapterIpAddress
00000085 76D6821F SetBlockRoutes
00000086 76D66AA2 SetIfEntry
00000087 76D69FE3 SetIfEntryToStack
00000088 76D66B5B SetIpForwardEntry
00000089 76D6A38D SetIpForwardEntryToStack
0000008A 76D69F56 SetIpMultihopRouteEntryToStack
0000008B 76D66CC8 SetIpNetEntry
0000008C 76D69C4C SetIpNetEntryToStack
0000008D 76D69EE7 SetIpRouteEntryToStack
0000008E 76D66C10 SetIpStatistics
0000008F 76D69A56 SetIpStatsToStack
00000090 76D672EB SetIpTTL
00000091 76D69D6A SetProxyArpEntryToStack
00000092 76D68293 SetRouteWithRef
00000093 76D66DC9 SetTcpEntry
00000094 76D697F7 SetTcpEntryToStack
00000095 76D6878C UnenableRouter
0000006A 76D6AD50 _PfAddFiltersToInterface@24
0000006B 76D6AE18 _PfAddGlobalFilterToInterface@8
0000006C 76D6AF5E _PfBindInterfaceToIPAddress@12
0000006D 76D6AEC3 _PfBindInterfaceToIndex@16
0000006E 76D6AD38 _PfCreateInterface@24
0000006F 76D6AD46 _PfDeleteInterface@4
00000070 76D6B0A4 _PfDeleteLog@0
00000071 76D6B064 _PfGetInterfaceStatistics@16
00000072 76D6B04C _PfMakeLog@4
00000073 76D6AFE1 _PfRebindFilters@8
00000074 76D6ADDB _PfRemoveFilterHandles@12
00000075 76D6AD96 _PfRemoveFiltersFromInterface@20
00000076 76D6AE52 _PfRemoveGlobalFilterFromInterface@8
00000077 76D6B056 _PfSetLogBuffer@28
00000078 76D6B0AE _PfTestPacket@20
00000079 76D6AE8C _PfUnBindInterface@4
00000096 76D6796F do_echo_rep
00000097 76D678A6 do_echo_req
00000098 76D67890 register_icmp

不过不知道每个函数的参数情况,而且网上好像很少有关于这个文件的资料。
问不用重启电脑(包括 win98,win2000,winxp,win2003)改网卡 ip address,netmask,gateway,dns DELPHI 编程如何写。
 
程序没做过,操作可以把网卡禁用再起用,就可以。自己找一下微软的接口。
 
改注册表,然后用SetupApi重启网卡。2000以上有效。
 
IP Help API做不了的。是只读的。
 
哪位帮忙把这一段翻译成 DELPHI 语言
BOOL NotifyIPChange(LPCTSTR lpszAdapterName, int nIndex, LPCTSTR pIPAddress, LPCTSTR pNetMask)
{
BOOL bResult = FALSE;
HINSTANCE hDhcpDll;
DHCPNOTIFYPROC pDhcpNotifyProc;
WCHAR wcAdapterName[256];

MultiByteToWideChar(CP_ACP, 0, lpszAdapterName, -1, wcAdapterName,256);

if((hDhcpDll = LoadLibrary("dhcpcsvc")) == NULL)
return FALSE;

if((pDhcpNotifyProc = (DHCPNOTIFYPROC)GetProcAddress(hDhcpDll, "DhcpNotifyConfigChange")) != NULL)
if((pDhcpNotifyProc)(NULL, wcAdapterName, TRUE, nIndex, inet_addr(pIPAddress), inet_addr(pNetMask), 0) == ERROR_SUCCESS)
bResult = TRUE;

FreeLibrary(hDhcpDll);
return bResult;
}

马上给分。谢谢!
 
http://www.vckbase.com/document/viewdoc/?id=851
 
后退
顶部