Getting the MAC-address in C
  • Moderator
    Kronos
    Posts: 2259 from 2003/2/24
    For some tiny project I want to be able to lock a file against a certain MAC-address (thereby making it only accessable on that computer), preferably the one that was used for registering MorphOS.

    All sources I found sofar use "if (0 == ioctl(fd, SIOCGIFHWADDR, &s))" but SIOCGIFHWADDR doesn't seem to be defined anywhere.
  • »15.05.15 - 17:24
    Profile
  • MorphOS Developer
    itix
    Posts: 1520 from 2003/2/24
    From: Finland
    Try to find AmiTCP ifconfig source code.
    1 + 1 = 3 with very large values of 1
  • »15.05.15 - 19:44
    Profile
  • Moderator
    Kronos
    Posts: 2259 from 2003/2/24
    Found an old archive on Aminet, but nothing in that source suggest how to get the MAC (not even sure if that old ifconfig was even able to return such info).

    Geit pointed out in IRC that I could just obtain the username on registered machines (allways thought that was hidden in some super secret handshale API) which will work in similar way and has the added benefit of users being able to easily transfer that file inbetween computers. MAC based might still be a nice option.

    Guess you'll all find out on Sunday what I'm rambling about.

    [ Edited by Kronos 15.05.2015 - 20:46 ]
  • »15.05.15 - 20:44
    Profile
  • MorphOS Developer
    itix
    Posts: 1520 from 2003/2/24
    From: Finland
    Maybe it does not but try to look for getlinkaddr(). If it does not exist then there is no way to get it with the public SDK.

    Perhaps execute ifconfig from your program and parse output ;-)
    1 + 1 = 3 with very large values of 1
  • »15.05.15 - 21:07
    Profile