gpt4 book ai didi

inno-setup - 在 Inno Setup 中获取 MAC 地址

转载 作者:行者123 更新时间:2023-12-02 08:57:20 29 4
gpt4 key购买 nike

我尝试使用下面的代码在 Inno Setup 中获取 mac 地址,但出现错误

Internal error: ExtractTemporaryFile: The file "ISID.dll" was not found.

我已将 ISID.dll 复制到应用程序文件夹中,但仍然出现上述错误。

如果我遗漏了什么,请告诉我......:

function GetMacAddress(output:string): Integer;
external 'GetMACAddress@files:ISID.dll stdcall';

function GetMacAdd(Output: string): string;
var
ClassName: String;
Ret: Integer;
begin
SetLength(ClassName, 256);
Ret := GetMacAddress(PChar(ClassName));
Result := Copy(ClassName, 1, Ret);
end;

最佳答案

这是一个在 Windows 上使用 WMI 来获取所有 MAC 地址的脚本。

[Code]
type
TMacAddressEntry = record
MacAddress: string;
end;

TMacAddressesList = array of TMacAddressEntry;

function GetMacAddressesList(out List: TMacAddressesList): Integer;
var
I: Integer;
WQLQuery: string;
WbemLocator: Variant;
WbemServices: Variant;
WbemObject: Variant;
WbemObjectSet: Variant;
begin
Result := 0;

WbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
WbemServices := WbemLocator.ConnectServer('localhost', 'root\cimv2');

WQLQuery := 'Select * from Win32_NetworkAdapterConfiguration where IPEnabled=true';

WbemObjectSet := WbemServices.ExecQuery(WQLQuery);
if not VarIsNull(WbemObjectSet) and (WbemObjectSet.Count > 0) then
begin
Result := WbemObjectSet.Count;
SetArrayLength(List, WbemObjectSet.Count);
for I := 0 to WbemObjectSet.Count - 1 do
begin
WbemObject := WbemObjectSet.ItemIndex(I);
if not VarIsNull(WbemObject) then
begin
List[I].MacAddress := WbemObject.MACAddress;
end;
end;
end;
end;

关于inno-setup - 在 Inno Setup 中获取 MAC 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27873853/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com