Autor Beitrag
starsurfer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: Mi 25.10.06 17:44 
Hallo DF´ler,

es gibt ja genug Ansätze die MAC Addresse raus zu finden.

Allerdings finden machen nur die erste oder manche alle MAC Adressen herraus.

Was mir recht wenig nützt.

Gibt es eine Möglichkeit nur die MAC Adressen der LAN-Karten(nur die MIT Kabel, WLAN nicht!) herraus zu finden?
bzw
Zwischen WLAN und LAN unterscheiden zu können?

Beispiel:
Notebook mit LAN und WLAN.
Jetzt weis man ja nicht ob LAN oder WLAN die "erste" Karte ist(oder doch?).
Und ich brauch jetzt von den 2 MAC Adressen nur die von der LAN Karte.

mfg Star

_________________
GEIZ IST GEIL! - Ihr Sozialamt
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 25.10.06 18:11 
IMHO nur über die Beschreibung

_________________
Markus Kinzler.
starsurfer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: Mi 25.10.06 18:18 
und wo bekomm ich die Beschreibung her?

Oder wie meinst du das jetzt?!

Windows "weis" ja quasi ob es sich um ne LAN oder WLAN Karte handelt....kann ich das irgendwie anzapfen ?

_________________
GEIZ IST GEIL! - Ihr Sozialamt
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 25.10.06 18:26 
Wie liest du das den aus?

_________________
Markus Kinzler.
starsurfer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: Mi 25.10.06 18:33 
Zur Zeit würde ich das so machen:

->cmd->ipconfig/all-> in ne .txt speichern und dann nach ethernetadapter suchen und raus filtern was ich brauch....

was natürlich nicht alzu elegant is(und wahrscheinlich recht fehleranfällig)...
aber da steht was für eine Art eine Verbindung ist (ethernetadapter/Drahtlose Verbindung....) also muss es ja irgendwo im system stehen... (registry?)

_________________
GEIZ IST GEIL! - Ihr Sozialamt
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 25.10.06 18:39 
das bekommst du auch über die winapi raus oder verwendest vorgefertigte Funktionen (Z.B. jclsysinfo)

_________________
Markus Kinzler.
starsurfer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: Mi 25.10.06 19:32 
JEDI Code Library (JCL) lässt sich nich installieren weil die ganzen Dateien kaputt sind -_-

irgendwie werden alle Zeilenumbrüche nicht erkannt und da is dann nur son Viereck, und er meckert dann das die Zeilen zu lang sind -_-

in den Dateien steht irgendwie nur #13 als zeilumbruch und er will aber nur #13#10 erkennen...*hmpf*

bekomm ich rigendwo "ganze" Dateien her?
(habs von der offizielen Jedi WebSite)

_________________
GEIZ IST GEIL! - Ihr Sozialamt
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 25.10.06 19:39 

_________________
Markus Kinzler.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 25.10.06 22:39 
Moin!

user profile iconstarsurfer hat folgendes geschrieben:
Windows "weis" ja quasi ob es sich um ne LAN oder WLAN Karte handelt....kann ich das irgendwie anzapfen ?

Nein, Windows "weiß" das leider nicht (erst Vista wird das können), LAN und WLAN wird im IP-Stack nicht unterschieden. Der Kartentreiber liefert zwar eine Beschreibung ab, aber das kann halt "beliebiger" Text sein, daraus kannst du nicht wirklich sauber ableiten, um was für einen Hardwaretyp es sich bei der Schicht-1-Anbindung handelt. :|

Fazit: AFAIK gibt es keine Möglichkeit, zweifelsfrei zu bestimmen, ob es sich bei dem Netzwerkadapter um eine LAN oder WLAN-Anbindung handelt.

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
starsurfer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: Mi 25.10.06 23:26 
*hmpf* So ein Mist.

Das ist ja so ärgerlich...

Naja kann man nix machen,

Danke an alle.

mfg Star

ps.: mkinzler, auch die Files von deinem Link lassen sich nicht installieren:
"JcLSysUtils.pas(409) Fehler: undefinierter Bezeichner PBoolean"

_________________
GEIZ IST GEIL! - Ihr Sozialamt
starsurfer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: Do 26.10.06 22:54 
Kann mir einer zeigen wie ich die Bezeichnung der Netzwerkkarte raus bekomme?
(JCL Code Libary funktioniert ja leider nicht)

_________________
GEIZ IST GEIL! - Ihr Sozialamt
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 26.10.06 22:59 
Moin!

Suche im MSDN IPHLPAPI.DLL ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 26.10.06 23:26 
Aber wenn Windows nicht wüsste, dass es eine WLAN-Karte ist, wüsste Windows doch auch nicht, wann es den Befehl "Verfügbare drahtlose Netzwerke anzeigen" anzeigen muss. Und das Symbol ist ja auch entsprechend.

Deshalb: Irgendwoher muss Windows das wissen. Die Frage ist nur: Wie liest man das aus...
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 26.10.06 23:35 
Moin!

Das kommt über den Kartentreiber, aber "hängt" nicht an der Karte. :| Wenn also diese Option verfügbar ist, dann weißt du nur, dass ein Kartentreiber für WLAN geladen ist, aber nicht, an welchem Interface als Schicht-1-Hardware eine Funke hängt... :(

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
starsurfer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: So 29.10.06 14:01 
Moin,

ich hab jetzt JCL zu laufen gebracht, die nützen mir aber nicht viel weil die mir nur de MAC Adressen liefern...

der vorschlag von Nares sieht gut aus.

Ich hab mir also die DLL besorgt und die benötigte Funktion raus gesucht:

-GetAdaptersAddresses-

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
ULONG WINAPI GetAdaptersAddresses(
  ULONG Family,
  ULONG Flags,
  PVOID Reserved,
  PIP_ADAPTER_ADDRESSES AdapterAddresses,
  PULONG SizePointer
);


nur hab ich keine Erfahrung mit c/c++ also hab ich keine Ahnung wie ich die Funktion nutzen soll....

mein Ansatz:
ausblenden Delphi-Quelltext
1:
2:
function GetAdaptersaddresses(?):?; stdcall;
external 'IPHLPAPI.DLL';


was natürlich nich allzu viel ist :)

wie bekomm ich die Funktion zum laufen ?

_________________
GEIZ IST GEIL! - Ihr Sozialamt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 29.10.06 14:17 
Wie wärs, wenn du die vorliegenden Übersetzungen der IP Helper API nutzt... :lol:
www.delphi-jedi.org/APILIBRARY:947996
Die Funkton wird da ziemlich sicher auch dabei sein.
starsurfer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: So 29.10.06 14:23 
nein,

-GetAdaptersAddresses- ist nicht in der "Übersetzung" enthalten,

nur GetAdaptersInfo ist enthalten...
na mal guggn ob ich damit das bekomme was ich brauch...

thx für den Tipp

//EDIT: wenn ich mit den TYP PIP_ADAPTER_INFO so angugg wird das was, jetzt muss ichs nur noch hin bekommen ^^

_________________
GEIZ IST GEIL! - Ihr Sozialamt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 29.10.06 14:32 
Nun, ich habe mal in die JwaIpHlpApi.pas aus der Win32 API gekuckt, da ist de Funktion drin. Hmm, vielleicht nicht in der extra IP Helper API Übersetzung...
ausblenden Delphi-Quelltext
1:
2:
function GetAdaptersAddresses(Family: ULONG; Flags: DWORD; Reserved: PVOID;
  pAdapterAddresses: PIP_ADAPTER_ADDRESSES; pOutBufLen: PULONG): DWORD; stdcall;
starsurfer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: So 29.10.06 14:45 
naja ich hatte nur die IpHlpApi.zip gesehen und die angeguggt...

gleich mal schauen :)

_________________
GEIZ IST GEIL! - Ihr Sozialamt
starsurfer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: So 29.10.06 19:37 
ok habs jetzt mit der Unit versucht:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, jwaiphlpapi,jwaiptypes,jwawinsock2,Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var adapter:IP_ADAPTER_ADDRESSES;
    i:integer;
    adresse:string;
    a:pointer;
begin
GetAdaptersAddresses(AF_UNSPEC,GAA_FLAG_INCLUDE_PREFIX,Nil,@adapter,@a);
for i:=0 to 7 do
adresse:=adresse+'-'+inttohex(ord(adapter.PhysicalAddress[i]),2);
memo1.lines.add(adresse);
end;

end.


aber das liefert mir nur Mist!
Die Adresse die ich zurückgeliefert bekomme ist erstens falsch und zweitens ändert die sich immer mal.

was mach ich falsch ?

//EDIT:

Info zur Funktion GetAdaotersAddresses
msdn.microsoft.com/l...daptersaddresses.asp

und der Typ IP_ADAPTER_ADDRESSES sieht so aus:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
PIP_ADAPTER_ADDRESSES = ^_IP_ADAPTER_ADDRESSES;
  {$EXTERNALSYM PIP_ADAPTER_ADDRESSES}
  _IP_ADAPTER_ADDRESSES = record
    Union: record
      case Integer of
        0: (
          Alignment: ULONGLONG);
        1: (
          Length: ULONG;
          IfIndex: DWORD);
    end;
    Next: PIP_ADAPTER_ADDRESSES;
    AdapterName: PCHAR;
    FirstUnicastAddress: PIP_ADAPTER_UNICAST_ADDRESS;
    FirstAnycastAddress: PIP_ADAPTER_ANYCAST_ADDRESS;
    FirstMulticastAddress: PIP_ADAPTER_MULTICAST_ADDRESS;
    FirstDnsServerAddress: PIP_ADAPTER_DNS_SERVER_ADDRESS;
    DnsSuffix: PWCHAR;
    Description: PWCHAR;
    FriendlyName: PWCHAR;
    PhysicalAddress: array [0..MAX_ADAPTER_ADDRESS_LENGTH - 1of BYTE;
    PhysicalAddressLength: DWORD;
    Flags: DWORD;
    Mtu: DWORD;
    IfType: DWORD;
    OperStatus: IF_OPER_STATUS;
    Ipv6IfIndex: DWORD;
    ZoneIndices: array [0..15of DWORD;
    FirstPrefix: PIP_ADAPTER_PREFIX;
  end;
  {$EXTERNALSYM _IP_ADAPTER_ADDRESSES}
  IP_ADAPTER_ADDRESSES = _IP_ADAPTER_ADDRESSES;
  {$EXTERNALSYM IP_ADAPTER_ADDRESSES}
  TIpAdapterAddresses = IP_ADAPTER_ADDRESSES;
  PIpAdapterAddresses = PIP_ADAPTER_ADDRESSES;

_________________
GEIZ IST GEIL! - Ihr Sozialamt