获取MAC地址
来源:互联网 发布:软件研发部助理 编辑:程序博客网 时间:2024/05/01 22:13
function MacAddress: string;
var
Lib: Cardinal;
Func: function(GUID: PGUID): Longint; stdcall;
GUID1, GUID2: TGUID;
begin
Result := '';
Lib := LoadLibrary('rpcrt4.dll');
if Lib <> 0 then
begin
if Win32Platform <> VER_PLATFORM_WIN32_NT then
@Func := GetProcAddress(Lib, 'UuidCreate')
else @Func := GetProcAddress(Lib, 'UuidCreateSequential');
if Assigned(Func) then
begin
if (Func(@GUID1) = 0) and
(Func(@GUID2) = 0) and
(GUID1.D4[2] = GUID2.D4[2]) and
(GUID1.D4[3] = GUID2.D4[3]) and
(GUID1.D4[4] = GUID2.D4[4]) and
(GUID1.D4[5] = GUID2.D4[5]) and
(GUID1.D4[6] = GUID2.D4[6]) and
(GUID1.D4[7] = GUID2.D4[7]) then
begin
Result :=
IntToHex(GUID1.D4[2], 2) + '-' +
IntToHex(GUID1.D4[3], 2) + '-' +
IntToHex(GUID1.D4[4], 2) + '-' +
IntToHex(GUID1.D4[5], 2) + '-' +
IntToHex(GUID1.D4[6], 2) + '-' +
IntToHex(GUID1.D4[7], 2);
end;
end;
FreeLibrary(Lib);
end;
end;
var
Lib: Cardinal;
Func: function(GUID: PGUID): Longint; stdcall;
GUID1, GUID2: TGUID;
begin
Result := '';
Lib := LoadLibrary('rpcrt4.dll');
if Lib <> 0 then
begin
if Win32Platform <> VER_PLATFORM_WIN32_NT then
@Func := GetProcAddress(Lib, 'UuidCreate')
else @Func := GetProcAddress(Lib, 'UuidCreateSequential');
if Assigned(Func) then
begin
if (Func(@GUID1) = 0) and
(Func(@GUID2) = 0) and
(GUID1.D4[2] = GUID2.D4[2]) and
(GUID1.D4[3] = GUID2.D4[3]) and
(GUID1.D4[4] = GUID2.D4[4]) and
(GUID1.D4[5] = GUID2.D4[5]) and
(GUID1.D4[6] = GUID2.D4[6]) and
(GUID1.D4[7] = GUID2.D4[7]) then
begin
Result :=
IntToHex(GUID1.D4[2], 2) + '-' +
IntToHex(GUID1.D4[3], 2) + '-' +
IntToHex(GUID1.D4[4], 2) + '-' +
IntToHex(GUID1.D4[5], 2) + '-' +
IntToHex(GUID1.D4[6], 2) + '-' +
IntToHex(GUID1.D4[7], 2);
end;
end;
FreeLibrary(Lib);
end;
end;
0 0
- 获取MAC地址
- 获取Mac地址
- 获取Mac地址
- 获取MAC地址
- 获取MAC地址(Err)
- 获取网卡MAC地址
- 获取客户端MAC地址
- 获取mac地址
- 获取客户端mac地址
- 获取mac地址
- 获取网卡MAC地址
- 获取MAC地址。。。。。。。。。
- 获取MAC地址
- 获取计算机mac地址
- 获取网卡Mac地址
- 如何获取MAC地址
- 获取客户端MAC地址
- 获取网卡MAC地址
- 一个值得Geek收藏的网站
- pku1001
- 内存_命令行编译_运行_多个类day02
- UIView 圆角
- 冷伤风,热感冒!同是感冒药,治的感冒仍有不同。
- 获取MAC地址
- 推荐C++博客专栏
- python 临时文件夹 的 tempfile模块学习
- 从Zygote的启动开始看代码
- android NDK介绍
- linux设备驱动之我是led灯-基于OK6410开发板 .
- 动态节点的生成注意事项及仿百度搜索事件代码
- UITextView 实现placeholder的方法
- Python用subprocess的Popen来调用系统命令