AllSystemGo Posted May 10, 2007 Posted May 10, 2007 I recently found that script to be able to get a MAC address of a specified computer Local $MAC,$MACSize Local $i,$s,$r,$iIP ;Create the struct ;{ ; char data[6]; ;}MAC $MAC = DllStructCreate("byte[6]") ;Create a pointer to an int ; int *MACSize; $MACSize = DllStructCreate("int") ;*MACSize = 6; DllStructSetData($MACSize, 1, 6) ;call inet_addr($sIP) $r = DllCall ("Ws2_32.dll", "int", "inet_addr", "str", $sIP) $iIP = $r[0] ;Make the DllCall $r = DllCall ("iphlpapi.dll", "int", "SendARP", "int", $iIP, "int", 0, "ptr", DllStructGetPtr($MAC), "ptr", DllStructGetPtr($MACSize)) ;Format the MAC address into user readble format: 00:00:00:00:00:00 $s = "" For $i = 0 To 5 $s = $s & Hex(DllStructGetData($MAC, 1, $i+1), 2) Next ;Must free the memory after it is used ;DllStructDelete($MAC) ;DllStructDelete($MACSize) ;Return the user readble MAC address Return $s The DLLStructDelete doesn't seem to exist anymore. Is there anything else that replace that ?? Thank you. Cheers!!!
Zedna Posted May 10, 2007 Posted May 10, 2007 DllStructDelete($MAC) DllStructDelete($MACSize)oÝ÷ Ú·©§o&®¶sbb33c´Ô2Ò¢b33c´Ô56¦RÒ Resources UDF ResourcesEx UDF AutoIt Forum Search
eltorro Posted May 10, 2007 Posted May 10, 2007 From the help file.To release allocated memory just reset the returned variable to 0. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code
AllSystemGo Posted May 10, 2007 Author Posted May 10, 2007 Thank you Zedna and I'm sorry for that eltorro I didn't see it. I'll look more closely next time.
drlava Posted July 17, 2007 Posted July 17, 2007 If a function makes a dll call and returns the result with Return DllStructGetData($thedata,1) will the DllStruct memory be deallocated on exit? or should it return like this: $return = DllStructGetData($thedata,1) $thedata=0 Return $return ?
Siao Posted July 17, 2007 Posted July 17, 2007 If a function makes a dll call and returns the result with Return DllStructGetData($thedata,1) will the DllStruct memory be deallocated on exit? or should it return like this: $return = DllStructGetData($thedata,1) $thedata=0 Return $return ? If $thedata is Local, it will be freed upon exiting the function, like all other local variables. "be smart, drink your wine"
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now