winocam
Messages postés12Date d'inscriptionmercredi 29 mai 2002StatutMembreDernière intervention 6 juillet 2006
-
4 juil. 2006 à 18:10
yvessimon
Messages postés637Date d'inscriptionmardi 22 avril 2003StatutMembreDernière intervention 9 janvier 2017
-
6 juil. 2006 à 15:14
Bonjour,
Est-il possible de récupérer l'adrese MAC si le PC n'est pas connecté ?
J'ai trouvé plusieurs sources qui permettent de récuper l'adresse, mais uniquement si le PC est connecté au réseau.
La commande ipconfig /all le permet, je pense donc que cela doit être possible !
cs_jfs59
Messages postés178Date d'inscriptionmardi 29 avril 2003StatutMembreDernière intervention 2 février 2010 5 juil. 2006 à 11:35
si c'était possible on pourrait récupérer l'adresse mac d'un portable situé dans la sacoche posée sur la table du bureau de la secretaire du patron ... chouette
Cordialement jfs.
<hr size="2" width="100%" />
Tout est en tout et réciproquement ...
yvessimon
Messages postés637Date d'inscriptionmardi 22 avril 2003StatutMembreDernière intervention 9 janvier 2017 6 juil. 2006 à 13:29
Bonjour,
Voici 2 fonctions
GetMACAddress donne l'adrese MAC , sans connexion au réseau
//
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(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;
yvessimon
Messages postés637Date d'inscriptionmardi 22 avril 2003StatutMembreDernière intervention 9 janvier 2017 6 juil. 2006 à 15:14
GetMACAddress appel GetAdapterInfo .
Avec certaines versions de windows cela fonctionne bien. J'ai windows 2000.
Il est vrai que j'ai testé en débranchant seulement le câble réseau ,
le PC été déja sous tension et connecté au réseau, le système à dû
gardé en mémoire des informations.