반응형

출처 : http://www.howto.pe.kr

// Call CoCreateGuid. The last six bytes are equal to the mac address of
// the Ethernet card. (Note that if you have more than one NIC in your
// computer, you'll get the mac address of one of them, but you can't
// easily control which one.)

// Sneeky... I like it! This will work quite neatly on systems without an
// ethernet card as well. AFAIK this part of the GUID is constant even if you
// only have PPP or even no-networking installed. A useful source of machine
// unique IDs...makes you wonder what the fuss about the PIII ID was about(not
// that I think it's a good idea ;)

// Tip: 델파이 IDE에서 Ctrl-Shift-G 를 눌러보세요...
// GUID가 생성 되는데 뒤에 6바이트(2자리씩 12글자) 는 네트워크 환경이
// 있다면 mac-address 와 같습니다
// PPP or even no-networking

function GetNicAddr: AnsiString;
const
  GUID_MAX = 72;
var
  guid: TGuid;
  buf: array[0..GUID_MAX] of WideChar;
begin
  CoCreateGuid(guid); <= @guid 수정
  StringFromGUID2(guid, buf, GUID_MAX);
  Result := Copy(WideCharToString(buf),26,12);
end;


--> 맥어드레스가 인터넷이 연결될때마다 바뀜

     즉 랜카드 물리적 주소가 아님

    

반응형

+ Recent posts