获取原始MAC:#include <SetupApi.au3>
Const $GUID_NDIS_LAN_CLASS = "{AD498944-762F-11D0-8DCB-00C04FC3358C}"
Local $hDevs, $tDevIfInfo, $tDevInfo, $sDescr, $sName, $sText
Local $iMask, $iIFIndex, $sDevicePath, $hDevice, $tBuffer, $pBuffer
$iMask = bitOR($DIGCF_PRESENT, $DIGCF_DEVICEINTERFACE)
$hDevs = _SetupDiGetClassDevs($iMask, $GUID_NDIS_LAN_CLASS)
$iMask = bitOR($GENERIC_READ, $GENERIC_WRITE)
$tBuffer = DllStructCreate("dword OID;byte PhysAddr[8]")
$pBuffer = DllStructGetPtr($tBuffer)
DllStructSetData($tBuffer, "OID", 0x01010101)
While _SetupDiEnumDeviceInterfaces($hDevs, 0, $GUID_NDIS_LAN_CLASS, $iIfIndex, $tDevIfInfo)
$iIFIndex += 1
DllStructSetData($tBuffer, "PhysAddr", "0x0000000000000000")
$sDevicePath = _SetupDiGetDeviceInterfaceDetail($hDevs, $tDevIfInfo, $tDevInfo)
$sDescr = _SetupDiGetDeviceRegistryProperty($hDevs, $tDevInfo, 0)
$sName = _SetupDiGetDeviceRegistryProperty($hDevs, $tDevInfo, 0xC)
If $sName <> "" Then $sDescr = $sName
If $sDescr = "" Then $sDescr = "[Unknown device]"
$hDevice = _CM_Create_File($sDevicePath, $iMask, 3, 0, 3, 0)
If Number($hDevice) < 1 Then ContinueLoop
_CM_Device_IO_Control($hDevice, 0x170002, $pBuffer, 4, $pBuffer + 4, 8)
_CM_Close_Handle($hDevice)
$sText &= "Device: " & $sDescr & @CRLF & "Physical Address: "
$sText &= DllStructGetData($tBuffer, "PhysAddr") & @CRLF & @CRLF
WEnd
_SetupDiDestroyDeviceInfoList($hDevs)
Msgbox(0, "", $sText)
以上。 |