Doublons possibles:
Getting Machine’s MAC Address — Good Solution?
How do I get the MAC address of a network card using Delphi?Comment obtenir l'adresse MAC dans Windows7?
J'utilise l'adresse MAC comme identifiant matériel pour la protection (ofcourse je crypté ces données) J'utilise ci-dessous code pour obtenir MAC adresse sur l'ordinateur de l'utilisateur
function MacAddress: string;
var
Lib: Cardinal;
Func: function(GUID: PGUID): Longint; stdcall;
GUID1, GUID2: TGUID;
begin
Result := '';
Lib := LoadLibrary('rpcrt4.dll');
if Lib <> 0 then
begin
@Func := GetProcAddress(Lib, 'UuidCreateSequential');
if Assigned(Func) then
begin
if (Func(@GUID1) = 0) and
(Func(@GUID2) = 0) and
(GUID1.D4[2] = GUID2.D4[2]) and
(GUID1.D4[3] = GUID2.D4[3]) and
(GUID1.D4[4] = GUID2.D4[4]) and
(GUID1.D4[5] = GUID2.D4[5]) and
(GUID1.D4[6] = GUID2.D4[6]) and
(GUID1.D4[7] = GUID2.D4[7]) then
begin
Result :=
IntToHex(GUID1.D4[2], 2) + '-' +
IntToHex(GUID1.D4[3], 2) + '-' +
IntToHex(GUID1.D4[4], 2) + '-' +
IntToHex(GUID1.D4[5], 2) + '-' +
IntToHex(GUID1.D4[6], 2) + '-' +
IntToHex(GUID1.D4[7], 2);
end;
end;
end;
end;
code ci-dessus fonctionne parfaitement sur Windows XP mais son donnant des valeurs différentes dans windows7, la valeur changeant chaque fois après ordinateur resratred :( est-il une chance d'obtenir une adresse MAC thats constante (sauf si l'utilisateur a changé son adresse MAC) ou y at-il tout bon code qui retrace les données constantes sur tous les systèmes d'exploitation?
merci à l'avance
Qu'est-ce qui vous fait penser que [ce code] (http://msdn.microsoft.com/en-us/library/aa379322%28VS.85%29.aspx) récupère l'adresse MAC de votre ordinateur? –
Ack! Cette fonction ne renvoie pas d'adresse MAC. Il renvoie une valeur qui arrive parfois à contenir une adresse MAC. – Gabe