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

Re: Mac address

From: Bob Nash <BNash_at_smud.org>
Date: Tue, 17 Aug 2004 15:39:36 -0700

Update: Both versions work fine on my Windows 2000 (ver 5.0, build 2195, =
SP4). The second version leaves some items on the stack ...

-----Original Message-----
From: Roger Dube [mailto:rogerdube_at_dathq.com]
Sent: Tuesday, August 17, 2004 6:11 AM
To: sftalk_at_forth.com
Subject: [sftalk] Re: Mac address

FYI, updated info on Mac address routine -=20

Works perfectly on WinXP Home SP1

Catch 35 line 21 on Win 2000 and WinXP Pro.=20

- Roger

-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com] On Behalf =
Of
Federico de Ceballos
Sent: Tuesday, August 17, 2004 8:05 AM
To: sftalk_at_forth.com
Subject: [sftalk] Re: Mac address

Roger, Richard,

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

> I get the same WinXP SP1

It appears (Microsoft Knowledge Base - 118623) that you cannot assume =
that
the LANA number is 0.

Try this new version. (It assumes you have only one network adapter.)

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

64 BUFFER: NCB \ CVARIABLE command 0
                 \ CVARIABLE retcode 1
                 \ CVARIABLE lsn 2
                 \ CVARIABLE num 3
                 \ VARIABLE buffer 4
                 \ HVARIABLE length 8
                 \ 16 BUFFER: callname 10
                 \ 16 BUFFER: name 26
                 \ CVARIABLE rto 42
                 \ CVARIABLE sto 43
                 \ VARIABLE post 44
                 \ CVARIABLE lana_num 48
                 \ CVARIABLE cmd_cplt 49
                 \ 10 BUFFER: reserve 50
                 \ VARIABLE event 60

: CMD! ( command ) NCB 64 ERASE NCB C! ;
: BUF! ( addr len ) NCB 8 + H! NCB 4+ ! ;
: CNAME! S" * " NCB 10 + SWAP CMOVE ;
: LANA! ( n ) NCB 48 + C! ;
: BIOS NCB Netbios THROW ;

: @LANA ( -- n ) NCBENUM CMD! PAD 255 BUF! BIOS PAD 1+ C@ ;
: RESET ( n ) NCBRESET CMD! LANA! BIOS ;
: ADDRESS ( n -- mac ) NCBASTAT CMD! LANA! PAD 90 BUF! CNAME! BIOS
PAD ;

: @MAC ( -- mac ) @LANA DUP RESET ADDRESS ;
: .MAC ( mac ) 5 0 DO COUNT 1 .R ." -" LOOP C@ . ;

HEX @MAC .MAC DECIMAL

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=20
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=20
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=20
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 Tue Aug 17 2004 - 15:39:24 PDT

This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:13 PST