|
See if this article helps.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
In Oct. 2002 Microsoft wrote in part:
NetBIOS LANA Numbers
Windows XP Certain legacy networking protocols, including NetBEUI, will no longer be supported. For more information, see Network Protocol Support in Windows.
The NetBIOS LANA number identifies the transport driver, network interface card (NIC) driver, and adapter that will be used to send and receive NetBIOS packets. This is known as the network route. The following example shows the network route that will be used when you specify a LANA value of 1:
001 NetBT -> IEEPRO -> IEEPRO1
Specify the LANA number in the ncb_lana_num member of the NCB structure when you issue a NetBIOS command.
The IBM NetBIOS 3.0 specification supports only two LANA numbers, because NetBEUI was originally the only protocol that supported NetBIOS, and a computer could contain only two network adapters at that time. Specifying LANA 0 directed a command to the first adapter, and specifying LANA 1 directed a command to the second adapter. Because many computers had only one network adapter, many MS-DOS based applications sent all their requests to LANA 0. If a second network adapter was installed, some applications allowed the user to specify the use of LANA 1 instead. As a result, LANA 0 became the default setting, though it was never intended as such.
Windows NT/Windows 2000/Windows XP enables NetBIOS to use transport protocols other than NetBEUI. Therefore, Microsoft has extended the meaning of a LANA number to indicate a specific transport protocol on a specific adapter. For example, if you have two network adapters, and have three transport protocols installed, you have six LANA numbers. The LANA numbers are not necessarily sequential.
In addition to extending the meaning of a LANA number, Microsoft also added the NCBENUM command to enumerate the available LANA numbers. As an example, the LANA_ENUM structure filled by NCBENUM might hold an array with values 0, 3, 5, and 6. Zero might map to IPX/SPX on the first adapter, three might map to a different protocol on a second adapter, and so on.
Windows 2000/XP: You cannot configure LANA numbers on these platforms.
Windows NT: You can associate specific LANA numbers with specific network routes using the following steps.
To associate a LANA number with a network route
Start the Network Control Panel application.
Click the Services tab.
Double-click NetBIOS Interface.
Click the LANA number you want to change.
Enter the new LANA number to be associated with the network route.
Windows 95/98/Me: You cannot configure LANA numbers because of the way plug and play was designed. LANA numbers can change as users install plug and play devices. You may set only LANA 0, which is the default protocol. The next protocol is LANA 7, then LANA 6, and so on. If no protocol is set as the default, there may not be a LANA 0.
You can set the default protocol in the control panel using the following steps:
To set LANA 0 on Windows 95/98/Me
Start the Network Control Panel application.
Choose the protocol you want as the default.
Click Properties.
Click the Advanced tab.
Click Set this protocol to be the default protocol.
The best way to write a NetBIOS application is to support all LANA numbers, and establish connections over any LANA number. This allows your application to transparently support any transport protocol that supports NetBIOS, as well as dynamic LANA numbers associated with dial-up adapters or plug-and-play hardware. A good approach is outlined in the following steps.
To support connections over any LANA
Enumerate the LANA numbers by issuing an NCBENUM command.
Reset each LANA by issuing one NCBRESET command per LANA number.
Add your local NetBIOS name to each LANA. The name may be the same on each LANA.
Connect using any LANA number:
For servers, issue an NCBLISTEN command on each LANA. If necessary, cancel any outstanding listen operation after the first listen operation has been completed.
For clients, issue an NCBFINDNAME (Windows NT/Windows 2000/Windows XP only) or an NCBCALL (Windows NT/Windows 2000/Windows XP or Windows 95/98/Me) command on each LANA. The first successful NCBFINDNAME or NCBCALL operation will indicate which LANA to use. When using NCBCALL instead of NCBFINDNAME, you must cancel any pending NCBCALL commands and hang up any extra completed calls.
Though this is the best technique for writing a NetBIOS application, it generates several datagrams, making the NetBIOS interface less desirable than other networking interfaces.
End of Microsoft White paper.
OK if I want to grab a MAC number and I get the os type of say XP how do I enumerate the the LANA numbers.
Should I use 0?
Best Wishes,
ez_way
|
|
|
|
|
Hi..
I think i can help you in this regard,because iam working in this area for past 2 months...
But i dont understand your question properly...
Can u pls explain it little more clearly... What exact you want to do?
Is it, to find the MAC address of a XP machine??
Waiting for your reply...
With Best Regards,
A.Ilamparithi
|
|
|
|
|
Yes please do help, no just not XP but any machine, just wanted to understand how to use LANA numbers or just set them to zero and hope for just on nic.
|
|
|
|
|
Hi
first we must find the LANANUM.
LANA_ENUM lna;
NCB nb;
memset((void*)&nb,0,sizeof(NCB));
memset((void*)&lna,0,sizeof(LANA_ENUM));
nb.ncb_buffer = (UCHAR*)&lna;
nb.ncb_length = sizeof(LANA_ENUM);
nb.ncb_command = NCBENUM;
int hh = Netbios(&nb);
int iLanaNum=lna.lana[0]; // here we got the LANANUM
Then you must reset the NCB.
NCB ncb;
UCHAR uRetCode;
memset( &ncb, 0, sizeof(ncb) );
ncb.ncb_command = NCBRESET; // note NCBRESET to reset.
ncb.ncb_lana_num = iLanaNum;
uRetCode = Netbios( &ncb );
Then to find the status, here it is MAC Address, set the command as NCBSTAT.
TCHAR MacAddress[20];
_TCHAR host[16];
ncb.ncb_callname,"MODBUS " ); // here MODBUS is the host name.It must be exactly 15 characters long(Since Netbios names are always 15 characters long). Remaining pad it to spaces.
ncb.ncb_lana_num = iLanaNum;
ncb.ncb_buffer = (unsigned char *) &Adapter;
ncb.ncb_length = sizeof(Adapter);
ncb.ncb_command = NCBASTAT;
uRetCode = Netbios( &ncb ); // make netbios call
printf( "The NCBASTAT return code is: 0x%x \n", uRetCode );
if ( uRetCode == 0 )
{
printf( MacAddress,"%02x-%02x-%02x-%02x-%02x-%02x",
Adapter.adapt.adapter_address[0],
Adapter.adapt.adapter_address[1],
Adapter.adapt.adapter_address[2],
Adapter.adapt.adapter_address[3],
Adapter.adapt.adapter_address[4],
Adapter.adapt.adapter_address[5] );
It works well in all versions of Windows.
Regards,
A.Ilamparithi
|
|
|
|
|
My question,
I execute a ping to a device with the ShellExecuteEx, How can I know if the ping has been successfully??
thanks in advance
|
|
|
|
|
No don't do it that way, it is not a good practice. Look for article by Chris Maunder for MFC ping or just write a console app.
Best Wishes,
ez_way
Wait big error! It was not Chris it was P.J. Naughter in 1999. I made the mistake because they both look alike
|
|
|
|
|
I don't found the article by Chris Maunder, can you tell me the exact title??
thanks
|
|
|
|
|
hi
It is P.J. Naughter article...
Look at it!!!
With Best Regards,
A.Ilamparithi
|
|
|
|
|
No it was P.J. Naughter, and his url is http://www.naughter.com
he and chris worked together, well sort of at codeguru years ago.
|
|
|
|
|
How about a link?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
the application sends this error when compiling, I am not using MFC, I use the Win Api 32 with #include <windows.h>, but the ping classe is designed for MFC, somebody has another solution for monitor a ping to a device?
c:\archivos de programa\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
thanks
|
|
|
|
|
So you want a solution that does not use MFC. Is that correct? You could take what you already have and redirect it to a temporary file and then parse the contents of that file. Something like:
ShellExecute("ping a.b.c.d > ping.out", ...);
I don't know if this would actually work as I've not tried it, nor would I opt for this type of solution.
A more preferred solution would be to use the ICM protocol directly. Examples are plentiful.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
A numpty question I think
I declare a CList in my header (VC6)
public:
CList (less than)CString, CString&(greater than) wordList;
Compiles fine but when I go to use it in a helper function I get an error.
if (!AfxIsValidAddress(pOb, sizeof(CObject)))
{
TRACE0("ASSERT_VALID fails with illegal pointer.\n");
if (AfxAssertFailedLine(lpszFileName, nLine))
AfxDebugBreak();
return; // quick escape
}
If I then go and add the CList declaration into the helper function and comment
out the header declaration it all works fine.
Any Ideas?????
Confused!!!!
Dave
|
|
|
|
|
Why not just use the CStringList class?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Last time I just built my own linked lists using CStrings, I just thought this time I'd try one of the in built templates. The question is more why cant I use this when it is declared in my header but can if declared in the function it's being used in.
I'll have a look at CStringList though!!
Thanks, Dave.
Dave
|
|
|
|
|
Hi.
I need help for create in vc++.net/vc++6 .
When I create template class in vc++ it gives error.
My code is like this :
template <class t="">
class p : public q
....
(I already write it in c++5 , it worked right)
Thank you
|
|
|
|
|
What is the error?
- Mike
|
|
|
|
|
Is there any way of setting toolbar buttons text NOT TO ALL buttons? I mean, buttons which do have text, should have proper size, and buttons which DO NOT have text should be of standard size (something like 24x23 etc.) All my attempts to set button info via CToolbarCtrl::SetButtonInfo() were doomed to failure .
|
|
|
|
|
Sure, if you can group your large an small buttons. Just add another toolbar with the larger buttons. Also if you wish to do it programatically you must leave MFC and build a win32 app.
Best Wishes,
ez_way
|
|
|
|
|
Hi All...
Do any one of you know how to get the MAC address of a system... using SNMP...?
If so, Can u say me the OID that is to be used other than 1.3.6.1.2.1.2.2.1.6
can u pls help if u know...?
Regards,
A.Ilamparithi
|
|
|
|
|
Have you looked at this?
http://www.codeproject.com/internet/getmac.asp
Best Wishes,
ez_way
|
|
|
|
|
Hi Baldwin
Thanks for reply..
I had already seen the getting MAC address using Netbios.
But,i need to get MAC Address using SNMP.
Thanks.
Best Regards,
A.Ilamparithi
|
|
|
|
|
Look at P.J. Naughter class on sntp and see if that might work.
Best Wishes,
ez_way
|
|
|
|
|
Does GetAdaptersInfo() help?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|