;made by correy
;Homepage:http://correy.webs.com
;QQ:112426112
;rc me.rc
;ml /coff test.asm /link /subsystem:windows me.res
;心得:不要高谈阔论,唯行之之难矣!
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
include iphlpapi.inc
includelib user32.lib
includelib kernel32.lib
includelib iphlpapi.lib
.data?
buffer db 9*280h dup (?);最多显示9个,如想得到恰当的大小请先一错误运行一下GetAdaptersInfo。
buffer2 db 256 dup (?)
.data
correy db "made by correy",0
x dd 9*280h
formatmac db "%02X-%02X-%02X-%02X-%02X-%02X",13,10,0
x1 dd ?
x2 dd ?
x3 dd ?
x4 dd ?
x5 dd ?
x6 dd ?
.code
start:
invoke GetAdaptersInfo,addr buffer,addr x
;198h=408
lea esi,buffer;buffer的值不可以改变。
again:
mov eax,0
mov al,byte ptr [esi+404]
mov x1,eax
mov eax,0
mov al,byte ptr [esi+405]
mov x2,eax
mov eax,0
mov al,byte ptr [esi+406]
mov x3,eax
mov eax,0
mov al,byte ptr [esi+407]
mov x4,eax
mov eax,0
mov al,byte ptr [esi+408]
mov x5,eax
mov eax,0
mov al,byte ptr [esi+409]
mov x6,eax
mov eax,dword ptr [esi+8];mac的描述。
.if eax!=0;必须用寄存器等,不能用变量名或内存。也可以辨别x1==0 && x2==0 && x3==0 && x4==0 && x5==0 && x6==0等。
;要显示别的也可以呀!如名字,ip,网关等。
invoke wsprintf,addr buffer2,addr formatmac,x1,x2,x3,x4,x5,x6
invoke MessageBox,0,addr buffer2,addr correy,0;我显示的好像少一个。
add esi,280h
jmp again
.endif
invoke ExitProcess,NULL
end start
;made at 2011.01.31
;附上数据结构。汇编的头文件里面我没有查到。总大小280h.
;typedef struct _IP_ADAPTER_INFO {
; struct _IP_ADAPTER_INFO *Next;
; DWORD ComboIndex;
; char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];//MAX_ADAPTER_NAME_LENGTH==256
; char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];//MAX_ADAPTER_DESCRIPTION_LENGTH==128
; UINT AddressLength;
; BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];//MAX_ADAPTER_ADDRESS_LENGTH==8
; DWORD Index;
; UINT Type;
; UINT DhcpEnabled;
; PIP_ADDR_STRING CurrentIpAddress;
; IP_ADDR_STRING IpAddressList;
; IP_ADDR_STRING GatewayList;
; IP_ADDR_STRING DhcpServer;
; BOOL HaveWins;
; IP_ADDR_STRING PrimaryWinsServer;
; IP_ADDR_STRING SecondaryWinsServer;
; time_t LeaseObtained;
; time_t LeaseExpires;
;} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
;还有一个函数GetAdaptersAddresses,请参考。
没有评论:
发表评论