Přidat otázku mezi oblíbenéZasílat nové odpovědi e-mailemVyřešeno Zjištění MAC adresy v Pascal/assembler/DOS programu pod XP

Uses Winsock;

Function SendARP (DestIp: DWORD; srcIP: DWORD; pMacAddr: pointer; PhyAddrLen: Pointer): DWORD;stdcall; external 'iphlpapi.dll';

Function getRemoteMacAdress (var address: String): Boolean;
var
  dwRemoteIP: DWORD;
  PhyAddrLen: Longword;
  pMacAddr : array [0..1] of Longword;
  temp: array [0..5] of byte;
  I: Byte;
begin
  Result := false;
  dwremoteIP := inet_addr (@address[1]);
  if dwremoteIP <> 0 then begin
    PhyAddrLen := 6;
    if SendARP (dwremoteIP, 0, @pMacAddr, @PhyAddrLen) = NO_ERROR then begin
      if (PhyAddrLen <> 0) and (pMacAddr[0] <> 0) then begin
         Move (pMacAddr, temp, 6);
         address := '';
         For I := 0 to 5 do address := address + inttohex (temp[i], 2)+'-';
         Delete (address, Length (address), 1);
         Result := true;
      end;
    end;
  end;
end;

Funguje pod Vista, preložené v Delphi2007 ;-)

Reakce na odpověď

1 Zadajte svou přezdívku:
2 Napište svou odpověď:
3 Pokud chcete dostat ban, zadejte libovolný text:

Zpět do poradny