Skip to content
⌘ NSIS Forum Archive

Retreive and Set Network MACID??

4 posts

ICONICS2000#

Retreive and Set Network MACID??

Hello

Does any body know how to retreive or set a MACID for a specfic Network Card.

cheers
Afrow UK#
I don't think you can set a mac address?
This code will get it (you'll have to put it into a plugin)


-Stu
flizebogen#
I found this following either in this forum or in the wiki.


Section "Get MAC Adress"
        SetPluginUnload  alwaysoff
        ClearErrors
        SetOutPath $TEMP
        !define maxsize 4096
        System::Alloc ${maxsize}
        Pop $3
        System::Call 'iphlpapi::GetAdaptersInfo(i r3r4, *l ${maxsize} r2)i.r1'
        StrCmp $1 0 0 finish ;in case of errors
        System::Call '*$4(i.r4,i,&t260.r5, &t132.r6, i.r7, l.r8)'
        Math::Script "hex={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};"
        Math::Script "s=''; a=r8; b=r7; #{b-->0,s=s+hex[a/16%16]+hex[a%16]+#[b>0,'-','']; a=a/256;}; r9=s;"
        MessageBox MB_OK "Adapter name is $5$\ndesc $6$\naddr len $7$\naddr $8$\nMacAddr: $9"
    finish:
        System::Free $3
        ; last plugin call must not have /NOUNLOAD so NSIS will be able to delete the temporary DLL
        SetPluginUnload manual
        ; do nothing
        System::Free 0
        Math::Script ""
    MAC_ENDE:
        ClearErrors
    SectionEnd 
Setting the mac adress should be impossible as the nic vendor has to support this and even if so you can only set it within the properties of the nic in device manager

regards flizebogen
ICONICS2000#
Thanks for the feeback, in a adanced tab in window's networking there is an option to change your Mac ID, We are using VM Ware. I am using NSIS to configure each specific vm ware image.