F
fengyvn
Unregistered / Unconfirmed
GUEST, unregistred user!
RESET LANA时遇到一个十分奇怪的问题
function Enumlana(enumlana: PLANAENUM): Char;//得到LANA
var
N:TNCB;
begin
FillChar(N,Sizeof(TNCB),#0);
with N do
begin
ncb_command:=Chr(NCBENUM);
ncb_buffer:=PChar(enumlana);
ncb_length:=Sizeof(enumlana^);
end;
if Netbios(@N)<>Char(NRC_GOODRET) then
begin
ShowMessage('enum lana failed');
result:=N.ncb_retcode;
end else
Result:=Char(NRC_GOODRET);
end;
function ResetLana(enumlanaLANAENUM;Maxslss:CHAR;Maxnetbios:CHAR): Char;//重设LANA
var
N:TNCB;
i:smallint;
begin
FillChar(N,Sizeof(TNCB),#0);
with N do
begin
ncb_command:=Chr(NCBRESET);
ncb_callname[0]:=Maxslss;//错误在这里 如果使用参数传递进来的值重设LANA会失败,如果硬编码一个值,如CHAR(10)可以成功执行.
ncb_callname[1]:=#0;
ncb_callname[2]:=Maxnetbios;
ncb_callname[3]:=Char(True);
ncb_callname[3]:=#0;
for i := 0 to Byte(enumlana^.length)-1 do
begin
ncb_lana_num:=enumlana^.lana;
if Netbios(@N)<>Chr(NRC_GOODRET) then
begin
ShowMessage('reset lana failed '+IntToStr(Byte(N.ncb_retcode))+'--'+IntToStr(i));
result:=N.ncb_retcode;
Exit;
end;
end;
end;
ShowMessage('Susseed');
Result:=Char(NRC_GOODRET);
end;
procedure Execute;
var
enum:TLanaEnum;
begin
Enumlana(@enum);
ResetLana(@enum,Char(10),Char(10));//传递参数
end;
请哪位解释一下原因,多谢~~~~
function Enumlana(enumlana: PLANAENUM): Char;//得到LANA
var
N:TNCB;
begin
FillChar(N,Sizeof(TNCB),#0);
with N do
begin
ncb_command:=Chr(NCBENUM);
ncb_buffer:=PChar(enumlana);
ncb_length:=Sizeof(enumlana^);
end;
if Netbios(@N)<>Char(NRC_GOODRET) then
begin
ShowMessage('enum lana failed');
result:=N.ncb_retcode;
end else
Result:=Char(NRC_GOODRET);
end;
function ResetLana(enumlanaLANAENUM;Maxslss:CHAR;Maxnetbios:CHAR): Char;//重设LANA
var
N:TNCB;
i:smallint;
begin
FillChar(N,Sizeof(TNCB),#0);
with N do
begin
ncb_command:=Chr(NCBRESET);
ncb_callname[0]:=Maxslss;//错误在这里 如果使用参数传递进来的值重设LANA会失败,如果硬编码一个值,如CHAR(10)可以成功执行.
ncb_callname[1]:=#0;
ncb_callname[2]:=Maxnetbios;
ncb_callname[3]:=Char(True);
ncb_callname[3]:=#0;
for i := 0 to Byte(enumlana^.length)-1 do
begin
ncb_lana_num:=enumlana^.lana;
if Netbios(@N)<>Chr(NRC_GOODRET) then
begin
ShowMessage('reset lana failed '+IntToStr(Byte(N.ncb_retcode))+'--'+IntToStr(i));
result:=N.ncb_retcode;
Exit;
end;
end;
end;
ShowMessage('Susseed');
Result:=Char(NRC_GOODRET);
end;
procedure Execute;
var
enum:TLanaEnum;
begin
Enumlana(@enum);
ResetLana(@enum,Char(10),Char(10));//传递参数
end;
请哪位解释一下原因,多谢~~~~