Liste des Groupes | Revenir à cl misc |
Muttley@dastardlyhq.com writes:
>On Sat, 30 Mar 2024 18:46:50 -0000 (UTC)>
Kaz Kylheku <643-408-1753@kylheku.com> wrote:(defun get-network-interface-list ()
(open-shared-library "iphlpapi.dll")
(let ((blk-size 65536) ;; crude!
(get-adapters-info (foreign-symbol-address "GetAdaptersInfo")))
(if get-adapters-info
(%stack-block ((blk blk-size))
(rlet ((len-inout #>ULONG blk-size))
(if (zerop (ff-call get-adapters-info :address blk
:address len-inout
#>DWORD))
(loop for ptr = blk then (pref ptr #>IP_ADAPTER_INFO.Next)
until (%null-ptr-p ptr)
collecting
(let ((alen (pref ptr #>IP_ADAPTER_INFO.AddressLength))#>IP_ADAPTER_INFO.IpAddressList))(addr (pref ptr #>IP_ADAPTER_INFO.Address))
(aname (pref ptr #>IP_ADAPTER_INFO.AdapterName))
(descr (pref ptr #>IP_ADAPTER_INFO.Description))
(iplist (pref ptrmac-bytes)))>
(type (pref ptr #>IP_ADAPTER_INFO.Type)))
(list type
(loop for i below alen
collecting (%get-unsigned-byte addr i)
into mac-bytes
finally
(return (mac-bytes-to-string>>>
(get-ip-address-list iplist)
(%get-cstring aname)
(%get-cstring descr))))))))))
Ugh. No wonder the language fell out of fashion. Looks like some kind of
hacked up Basic.
Fashion and intelligence have never been very good friends.
Les messages affichés proviennent d'usenet.