| 发表于:2007-02-05 20:26:566楼 得分:0 |
option explicit private const ncbastat = &h33 private const ncbnamsz = 16 private const heap_zero_memory = &h8 private const heap_generate_exceptions = &h4 private const ncbreset = &h32 private type ncb ncb_command as byte 'integer ncb_retcode as byte 'integer ncb_lsn as byte 'integer ncb_num as byte ' integer ncb_buffer as long 'string ncb_length as integer ncb_callname as string * ncbnamsz ncb_name as string * ncbnamsz ncb_rto as byte 'integer ncb_sto as byte ' integer ncb_post as long ncb_lana_num as byte 'integer ncb_cmd_cplt as byte 'integer ncb_reserve(9) as byte ' reserved, must be 0 ncb_event as long end type private type adapter_status adapter_address(5) as byte 'as string * 6 rev_major as byte 'integer reserved0 as byte 'integer adapter_type as byte 'integer rev_minor as byte 'integer duration as integer frmr_recv as integer frmr_xmit as integer iframe_recv_err as integer xmit_aborts as integer xmit_success as long recv_success as long iframe_xmit_err as integer recv_buff_unavail as integer t1_timeouts as integer ti_timeouts as integer reserved1 as long free_ncbs as integer max_cfg_ncbs as integer max_ncbs as integer xmit_buf_unavail as integer max_dgram_size as integer pending_sess as integer max_cfg_sess as integer max_sess as integer max_sess_pkt_size as integer name_count as integer end type private type name_buffer name as string * ncbnamsz name_num as integer name_flags as integer end type private type astat adapt as adapter_status namebuff(30) as name_buffer end type private declare function netbios lib "netapi32.dll " (pncb as ncb) as byte private declare sub copymemory lib "kernel32 " alias "rtlmovememory " (hpvdest as any, byval hpvsource as long, byval cbcopy as long) private declare function getprocessheap lib "kernel32 " () as long private declare function heapalloc lib "kernel32 " (byval hheap as long, byval dwflags as long, byval dwbytes as long) as long private declare function heapfree lib "kernel32 " (byval hheap as long, byval dwflags as long, lpmem as any) as long private sub command1_click() dim myncb as ncb dim bret as byte dim myastat as astat, tempastat as astat dim pastat as long myncb.ncb_command = ncbreset bret = netbios(myncb) myncb.ncb_command = ncbastat myncb.ncb_lana_num = 0 myncb.ncb_callname = "* " myncb.ncb_length = len(myastat) pastat = heapalloc(getprocessheap(), heap_generate_exceptions or heap_zero_memory, myncb.ncb_length) if pastat = 0 then exit sub myncb.ncb_buffer = pastat bret = netbios(myncb) copymemory myastat, myncb.ncb_buffer, len(myastat) debug.print hex(myastat.adapt.adapter_address(0)) & " " & hex(myastat.adapt.adapter_address(1)) & " " & hex(myastat.adapt.adapter_address(2)) & " " & hex(myastat.adapt.adapter_address(3)) & " " & hex(myastat.adapt.adapter_address(4)) & " " & hex(myastat.adapt.adapter_address(5)) heapfree getprocessheap(), 0, pastat end sub | | |
|