Archive: GetAdaptersInfo problem


GetAdaptersInfo problem
Hi Guys,
I have an issue arising out of the solution in the following link:
http://forums.winamp.com/showthread....ght=mathscript

If i use the math::script lines, the installer crashes.
If i do not use, i fear i am getting an incorrect decimal representation of the address.
For e.g. if the output by ipconfig /all is AB-CD. Its decimal representation is 43981. Lets assume the output from the code above gives a decimal value 'X', the reciprocal HEX of 'X' comes out to be CDAB (CD-AB).

In Plain words, the hexadecimal value of the mac address upon usage of the code above, is the reverse output of ipconfig/all.

Could any one shed any light on this please?

thanks.


Have you tried the exact example? If not, can you attach a test script?


Hi Kichik,
The script:


!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

cont:
strcmp $4 0 finish ; no more adapters
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 desc $6 addr len $7 macaddr $8"
goto cont

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 ""

Its exactly the same as in the example. My guess is that problem lies in the second "Math::script" line. Its too cryptic to know whats going on...

Appreciate your help again!


Hi Kichik,

Interesting...works now!
I was missing the following line...
"SetPluginUnload alwaysoff"
and hence the crash.

thanks for your attention.


how can the above script be adapted to work in 98 ?


GetAdaptersInfo is available on Windows 98. It should work.


no.... :( checked it again
does work in 2000 though....
anyone know what it could be ?


Both scripts (the one here and the one in the other thread) work on my Win98SE system. The name string ($5) is empty but the other information is OK.


ok
must be an improper install on the Win 98 computer I am using for testing...
no big surprise as the computer is a wreck ;)
thanks for checking for me :)


May require adapter to be installed.


Please! =)

I would like to know if anyone out there has taken this solution just a little farther and use something like the wsock32::inet_ntoa to convert the adapters address into human readable format?

please any help and examples would be much apreciated.

thanks.