我现在要取得网卡的某一信息(不要告诉我找注册表啊),这个信息的要求:1、最好是网卡硬件信息,
2、最好是生产商写在硬件里的标识号,如序列号。
3、能保证唯一性,最好是这个信息能保证这块网卡在全球的唯一性。好像MAC不行,Mac地址能改。
2、最好是生产商写在硬件里的标识号,如序列号。
3、能保证唯一性,最好是这个信息能保证这块网卡在全球的唯一性。好像MAC不行,Mac地址能改。
解决方案 »
- 请问初学delphi用D7好还是XE2好?听讲XE2已经不是用object pascal了!.
- ADOCommand:Missing CommandText property
- 关于DELPHI SQL删除语句的条件?请高手帮忙
- 哪位高人能给我一个PDF转图片的程序包或者dll啊?感激不尽
- 老生常谈的题目:如何操纵其它类的PROTECTED域方法和属性。
- 多线程的停滞如何解决???
- 远程数据库
- 唉,这个兄弟(huanzhugege (还猪哥哥) )有点冤,肥了我了。不好意思,你再找我要点分吧。
- 谁知道?西城和海淀的影院、溜冰场和其他体育场馆
- 请问:在OleContainer中,如何显示autocad的dwg文件而不同时打开autocad开发环境!
- 关于数据库程序
- 请问哪里有关于windows消息机制的资料?
PIP_ADAPTER_INFO pAdapterInfo, // buffer to receive data
PULONG pOutBufLen // size of data returned
);
------------------------------------
在iphlpapi.dll里面有一个函数:GetAdaptersInfo()
好像是干这个用的。说明如下:
GetAdaptersInfo
The GetAdaptersInfo function retrieves adapter information for the local computer. DWORD GetAdaptersInfo(
PIP_ADAPTER_INFO pAdapterInfo, // buffer to receive data
PULONG pOutBufLen // size of data returned
);
Parameters
pAdapterInfo
[out] Pointer to a buffer that, , receives a linked list of IP_ADAPTER_INFO structures.
pOutBufLen
[in] Pointer to a ULONG variable that specifies the size of the buffer pointed to by the pAdapterInfo parameter. If this size is insufficient to hold the adapter information, GetAdaptersInfo fills in this variable with the required size, and returns an error code of ERROR_BUFFER_OVERFLOW.
Return Values
If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is one of the following error codes. Value Meaning
ERROR_BUFFER_OVERFLOW The buffer size indicated by the pOutBufLen parameter is too small to hold the adapter information. The pOutBufLen parameter points to the required size.
ERROR_INVALID_PARAMETER The pOutBufLen parameter is NULL, or the calling process does not have read/write access to the memory pointed to by pOutBufLen, or the calling process does not have write access to the memory pointed to by the pAdapterInfo parameter.
ERROR_NO_DATA No adapter information exists for the local computer.
ERROR_NOT_SUPPORTED GetAdaptersInfo is not supported by the operating system running on the local computer.
Other If the function fails, use FormatMessage to obtain the message string for the returned error.
Requirements
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 98.
Header: Declared in Iphlpapi.h.//没有
Library: Use Iphlpapi.lib.//没有 IP_ADAPTER_INFO
The IP_ADAPTER_INFO structure contains information about a particular network adapter on the local computer. typedef struct _IP_ADAPTER_INFO {
struct _IP_ADAPTER_INFO* Next;
DWORD ComboIndex;
char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
UINT AddressLength;
BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
DWORD Index;
UINT Type;
UINT DhcpEnabled;
PIP_ADDR_STRING CurrentIpAddress;
IP_ADDR_STRING IpAddressList;
IP_ADDR_STRING GatewayList;
IP_ADDR_STRING DhcpServer;
BOOL HaveWins;
IP_ADDR_STRING PrimaryWinsServer;
IP_ADDR_STRING SecondaryWinsServer;
time_t LeaseObtained;
time_t LeaseExpires;
} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
Members
Next
Pointer to the next adapter in the linked list of adapters.
ComboIndex
This member is unused.
AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]
Specifies the name of the adapter.
Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]
Specifies a description for the adapter.
AddressLength
Specifies the length of the hardware address for the adapter.
Address[MAX_ADAPTER_ADDRESS_LENGTH]
Specifies the hardware address for the adapter. //这个是不是你想要的?
Index
Specifies the adapter index.
Type
Specifies the adapter type.
DhcpEnabled
Specifies whether dynamic host configuration protocol (DHCP) is enabled for this adapter.
CurrentIpAddress
Specifies the current IP address for this adapter.
IpAddressList
Specifies the list of IP addresses associated with this adapter.
GatewayList
Specifies the IP address of the default gateway for this adapter.
DhcpServer
Specifies the IP address of the DHCP server for this adapter.
HaveWins
Specifies whether this adapter uses Windows Internet Name Service (WINS).
PrimaryWinsServer
Specifies the IP address of the primary WINS server.
SecondaryWinsServer
Specifies the IP address of the secondary WINS server.
LeaseObtained
Specifies the time when the current DHCP lease was obtained.
LeaseExpires
Specifies the time when the current DHCP lease will expire.
Requirements
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 98.
Header: Declared in Iptypes.h.
--------------------------------------------
,%%%%%%%,
,%%/\%%%%/\%,
,%%%\c "" J/%%,
%. %%%%/ D L \%%%
`%%. __ %%%% _ |%%%
`%% .-' `"~--"`%%%%(=_Y_=)%%' ~~~
// .' `. `%%%%`\7/%%%'____
(( / ; `%%%%%%%'____)))
`.`--' ,' _,`-._____`-, 热爱生活 不爱美女 关注大众 无视权贵 一奋青
uses SysUtils, Windows, NB30;
function GetNetBIOSAddress : string;
var ncb : TNCB;
status : TAdapterStatus;
lanenum : TLanaEnum; procedure ResetAdapter (num : char);
begin
fillchar(ncb,sizeof(ncb),0);
ncb.ncb_command:=char(NCBRESET);
ncb.ncb_lana_num:=num;
Netbios(@ncb);
end;var
lanNum : char;
address : record
part1 : Longint;
part2 : Word;//Smallint;
end absolute status;
begin
Result:=''; fillchar(ncb,sizeof(ncb),0);
ncb.ncb_command:=char(NCBENUM);
ncb.ncb_buffer:=@lanenum;
ncb.ncb_length:=sizeof(lanenum);
Netbios(@ncb); if lanenum.length=#0 then exit;
lanNum:=lanenum.lana[0]; ResetAdapter(lanNum); fillchar(ncb,sizeof(ncb),0);
ncb.ncb_command:=char(NCBASTAT);
ncb.ncb_lana_num:=lanNum;
ncb.ncb_callname[0]:='*';
ncb.ncb_buffer:=@status;
ncb.ncb_length:=sizeof(status);
Netbios(@ncb);
ResetAdapter(lanNum); Result:=Format('%x%x',[address.part1,address.part2]);
end;
//取得网络适配器物理地址[列表](全球唯一)**************************************
//==============================================================================
procedure GetNetMacIDs(var MacIDs: string);
var Lana_Enum: TLana_Enum;
RetCode: Word;
i: Integer;
begin
Lana_Enum := NetBiosLanaEnum;
{enumerate lanas for WINNT }
if Lana_Enum.Length=0 then Exit;
for i:=0 to Lana_Enum.Length-1 do
begin
{ for every lana found }
RetCode := NetBiosReset(Lana_Enum.Lana[i]);
{ Reset lana for WINNT }
if RetCode<>NRC_GOODRET then Exit;
{ Get MAC Address }
MacIDs := MacIDs + Format('MacID %x = %s;', [Lana_Enum.Lana[i], GetMacAddress(i)]) + #13;
end;
end;//==============================================================================
//取得客户端‘主机名’‘IP地址’************************************************
//==============================================================================
procedure GetClientInfo(var ClientName, IPAddress: string);
var WSAData: TWSAData;
HostEnt: PHostEnt;
begin
{no error checking...}
WSAStartup(2, WSAData);
SetLength(ClientName, 255);
Gethostname(PChar(ClientName), 255);
SetLength(ClientName, StrLen(PChar(ClientName)));
HostEnt := GetHostByName(PChar(ClientName));
with HostEnt^ do IPAddress := Format('%d.%d.%d.%d',[Byte(h_addr^[0]), Byte(h_addr^[1]), Byte(h_addr^[2]), Byte(h_addr^[3])]);
WSACleanup;
end;
================================================================CSDN 论坛助手 Ver 1.0 B0402提供下载。 改进了很多,功能完备!★ 浏览帖子速度极快![建议系统使用ie5.5以上]。 ★ 多种帖子实现界面。
★ 保存帖子到本地[html格式]★ 监视您关注帖子的回复更新。
★ 可以直接发贴、回复帖子★ 采用XML接口,可以一次性显示4页帖子,同时支持自定义每次显示帖子数量。可以浏览历史记录!
★ 支持在线检测程序升级情况,可及时获得程序更新的信息。★★ 签名 ●
可以在您的每个帖子的后面自动加上一个自己设计的签名哟。Http://www.ChinaOK.net/csdn/csdn.zip
Http://www.ChinaOK.net/csdn/csdn.rar
Http://www.ChinaOK.net/csdn/csdn.exe [自解压]
如何定义枚举类型TLanaEnum,啊?