Recent

Author Topic: help converting this function below to Lazaru  (Read 2605 times)

elidorio

  • Sr. Member
  • ****
  • Posts: 295
help converting this function below to Lazaru
« on: August 30, 2014, 05:32:00 am »
Hello Guys,

I need help converting this function below to Lazarus, this showing errors:
 
In uses I'm using the NB30;


function TForm1.GetAdapterInfo(Lana: char): string;
var
  Adapter: TAdapterStatus;
  NCB: TNCB;
begin
  FillChar(NCB, SizeOf(NCB), 0);
  NCB.ncb_command := char(NCBRESET);
  NCB.ncb_lana_num := Lana;
  if Netbios(@NCB) <> char(NRC_GOODRET) then
  begin
    Result := 'mac not found';
    Exit;
  end;
  FillChar(NCB, SizeOf(NCB), 0);
  NCB.ncb_command := char(NCBASTAT);
  NCB.ncb_lana_num := Lana;
  NCB.ncb_callname := '*';
  FillChar(Adapter, SizeOf(Adapter), 0);
  NCB.ncb_buffer := @Adapter;
  NCB.ncb_length := SizeOf(Adapter);
  if Netbios(@NCB) <> char(NRC_GOODRET) then
  begin
    Result := 'mac not found';
    Exit;
  end;
  Result :=
    IntToHex(byte(Adapter.adapter_address[0]), 2) + '-' +
    IntToHex(byte(Adapter.adapter_address[1]), 2) + '-' +
    IntToHex(byte(Adapter.adapter_address[2]), 2) + '-' +
    IntToHex(byte(Adapter.adapter_address[3]), 2) + '-' +
    IntToHex(byte(Adapter.adapter_address[4]), 2) + '-' +
    IntToHex(byte(Adapter.adapter_address[5]), 2);
end;

function TForm1.GetMACAddress: string;
var
  AdapterList: TLanaEnum;
  NCB: TNCB;
begin
  FillChar(NCB, SizeOf(NCB), 0);
  NCB.ncb_command := char(NCBENUM);
  NCB.ncb_buffer := @AdapterList;
  NCB.ncb_length := SizeOf(AdapterList);
  Netbios(@NCB);
  if byte(AdapterList.length) > 0 then
    Result := GetAdapterInfo(AdapterList.lana[0])
  else
    Result := 'mac not found';
end;
         

unit1.pas(35,26) Error: Identifier not found "TAdapterStatus"
unit1.pas(35,26) Error: Error in type definition
unit1.pas(36,12) Error: Identifier not found "TNCB"
unit1.pas(36,12) Error: Error in type definition
unit1.pas(38,15) Hint: Local variable "NCB" does not seem to be initialized
unit1.pas(39,7) Error: Illegal qualifier
unit1.pas(40,7) Error: Illegal qualifier
unit1.pas(41,41) Error: Incompatible types: got "Char" expected "LongWord"
unit1.pas(47,7) Error: Illegal qualifier
unit1.pas(48,7) Error: Illegal qualifier
unit1.pas(49,7) Error: Illegal qualifier
unit1.pas(50,19) Hint: Local variable "Adapter" does not seem to be initialized
unit1.pas(51,7) Error: Illegal qualifier
unit1.pas(52,7) Error: Illegal qualifier
unit1.pas(53,41) Error: Incompatible types: got "Char" expected "LongWord"
unit1.pas(59,27) Error: Illegal qualifier
unit1.pas(60,27) Error: Illegal qualifier
unit1.pas(61,27) Error: Illegal qualifier
unit1.pas(62,27) Error: Illegal qualifier
unit1.pas(63,27) Error: Illegal qualifier
unit1.pas(64,27) Error: Illegal qualifier
unit1.pas(69,25) Error: Identifier not found "TLanaEnum"
unit1.pas(69,25) Error: Error in type definition
unit1.pas(70,12) Error: Identifier not found "TNCB"
unit1.pas(70,12) Error: Error in type definition
unit1.pas(72,15) Hint: Local variable "NCB" does not seem to be initialized
unit1.pas(73,7) Error: Illegal qualifier
unit1.pas(74,7) Error: Illegal qualifier
unit1.pas(75,7) Error: Illegal qualifier
unit1.pas(77,23) Error: Illegal qualifier
unit1.pas(78,42) Error: Illegal qualifier
unit1.pas(85) Fatal: There were 28 errors compiling module, stopping
Lazarus 1.4.4 | FPC 2.6.4 | Windows / Linux Debian

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: help converting this function below to Lazaru
« Reply #1 on: August 30, 2014, 05:42:30 am »
Use JwaNb30 instead.

 

TinyPortal © 2005-2018