programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: Mac address

From: Roger Dube <rogerdube_at_dathq.com>
Date: Fri, 13 Aug 2004 09:39:42 -0400

Frederico, I get a catch = 35 on the BIOS-RESET... Win XP, 2 different
machines.

Better than a Catch 22, though!

Will dig into this as my schedule allows - if you see something obvious, let
me (us) know.

- Roger

-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com] On Behalf Of
Federico de Ceballos
Sent: Friday, August 13, 2004 4:19 AM
To: sftalk_at_forth.com
Subject: [sftalk] Re: Mac address

Roger:

> Has anyone found a way to get the Mac address of the NIC card
> within Forth?

Try this (may not work on W-95, W-98 or W-Me):

LIBRARY NETAPI32.DLL
   FUNCTION: Netbios ( ncb -- res )

CLASS ADAPTER
   6 BUFFER: adapter_address
   CVARIABLE rev_major
   CVARIABLE reserved0
   CVARIABLE adapter_type
   CVARIABLE rev_minor
   HVARIABLE duration
   HVARIABLE frmr_recv
   HVARIABLE frmr_xmit
   HVARIABLE iframe_recv_err
   HVARIABLE xmit_aborts
   VARIABLE xmit_success
   VARIABLE recv_success
   HVARIABLE iframe_xmit_err
   HVARIABLE recv_buff_unavail
   HVARIABLE t1_timeouts
   HVARIABLE ti_timeouts
   VARIABLE reserved1
   HVARIABLE free_ncbs
   HVARIABLE max_cfg_ncbs
   HVARIABLE max_ncbs
   HVARIABLE xmit_buf_unavail
   HVARIABLE max_dgram_size
   HVARIABLE pending_sess
   HVARIABLE max_cfg_sess
   HVARIABLE max_sess
   HVARIABLE max_sess_pkt_size
   HVARIABLE name_count
   30 BUFFER: NameBuff
END-CLASS

CLASS NCB
   CVARIABLE command
   CVARIABLE retcode
   CVARIABLE lsn
   CVARIABLE num
   VARIABLE buffer
   HVARIABLE length
   16 BUFFER: callname
   16 BUFFER: name
   CVARIABLE rto
   CVARIABLE sto
   VARIABLE post
   CVARIABLE lana_num
   CVARIABLE cmd_cplt
   10 BUFFER: reserve
   VARIABLE event
END-CLASS

ADAPTER BUILDS MY-ADAPTER
NCB BUILDS MY-NCB

: NCB-ERASE MY-NCB ADDR NCB SIZEOF ERASE ;
: BIOS-RESET NCB-ERASE
                NCBRESET MY-NCB command C!
                MY-NCB ADDR Netbios THROW ;
: BIOS-STATUS NCB-ERASE
                NCBASTAT MY-NCB command C!
                MY-ADAPTER ADDR MY-NCB buffer !
                ADAPTER SIZEOF MY-NCB length H!
                S" * " MY-NCB callname SWAP MOVE
                MY-NCB ADDR Netbios THROW ;

: @MAC ( -- mac ) BIOS-RESET BIOS-STATUS MY-ADAPTER adapter_address ;
: .MAC ( mac -- ) 5 0 DO COUNT 1 .R ." -" LOOP C@ . ;

HEX @MAC .MAC

Regards,

Federico de Ceballos

****************************************************************************
**********************
The contents of this email and any attachments are confidential.
They are intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or
the
sender immediately and do not disclose the contents to anyone or make
copies.

** eSafe scanned this email for viruses, vandals and malicious content. **
****************************************************************************
**********************
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Fri Aug 13 2004 - 06:39:23 PDT

This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:34 PST