Y
yzdiyu
Unregistered / Unconfirmed
GUEST, unregistred user!
按照文档上说的,如果找不到就到那个键值下面去找,我找到了,但是PacketOpenAdapter的都是nil为什么呢?
procedure TForm1.Button1Click(Sender: TObject);
var
i,j:integer;
name : pchar;
Reg : TRegistry;
aadapter adapter;
begin
i:=512;
j:=PacketGetAdapterNames(@FAdapterDescs[0],@i);
if j=0 then
begin
Reg := TRegistry.Create; //建立一个Registry实例
with Reg do
begin
RootKey:=HKEY_LOCAL_MACHINE;//设置根键值为HKEY_LOCAL_MACHINE
OpenKey('SYSTEM/CurrentControlSet/Services/Tcpip/Linkage',True);
ReadBinaryData('Bind',FAdapterDescs[0],512);
CloseKey;
Free;
end;
end;
name := pchar(@FAdapterDescs);
showmessage(name);
aadapter := PacketOpenAdapter(name);
if aadapter=nil then showmessage('nil')
else showmessage('find');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i,j:integer;
name : pchar;
Reg : TRegistry;
aadapter adapter;
begin
i:=512;
j:=PacketGetAdapterNames(@FAdapterDescs[0],@i);
if j=0 then
begin
Reg := TRegistry.Create; //建立一个Registry实例
with Reg do
begin
RootKey:=HKEY_LOCAL_MACHINE;//设置根键值为HKEY_LOCAL_MACHINE
OpenKey('SYSTEM/CurrentControlSet/Services/Tcpip/Linkage',True);
ReadBinaryData('Bind',FAdapterDescs[0],512);
CloseKey;
Free;
end;
end;
name := pchar(@FAdapterDescs);
showmessage(name);
aadapter := PacketOpenAdapter(name);
if aadapter=nil then showmessage('nil')
else showmessage('find');
end;