Solved

Netbios programming problem

Posted on 1997-08-08
2
493 Views
Last Modified: 2013-12-19
I've made a litle program using netbios (3.0) which normally can read the network id adapter. I have the following problem when i try to get the id I have the error 0x5 from the netbios this is NB_COMMAND_TIME_OUT. I don't know how to resolv this one.
I give the source.
##########################################################
To use this change <IP_ADRESS> by the Ip adress of your machine.
##########################################################
   #include <windows.h>
   #include <nb30.h>
   #include <wincon.h>
   #include <stdlib.h>
   #include <stdio.h>
   #include <time.h>
   #include <string.h>

   typedef struct _ASTAT_
   {
      ADAPTER_STATUS adapt;
      NAME_BUFFER    NameBuff [30];
   }ASTAT, * PASTAT;
 
   ASTAT Adapter;  

   void main (void)
   {
      NCB Ncb;
      UCHAR uRetCode;
 
      memset( &Ncb, 0, sizeof(Ncb) );
      Ncb.ncb_command = NCBRESET;
     
 
      uRetCode = Netbios( &Ncb );
      if (uRetCode == 0){
        printf( "The NCBRESET Ok!!\n");
      }
 
      memset( &Ncb, 0, sizeof (Ncb) );
      Ncb.ncb_command = NCBASTAT;
      strcpy( (char*)Ncb.ncb_callname, <IP_ADRESS> );
      Ncb.ncb_buffer = (unsigned char *) &Adapter;
      Ncb.ncb_length = sizeof(Adapter);
      uRetCode = Netbios( &Ncb );
 
      printf( "The NCBASTAT return code is: 0x%x \n", uRetCode );
      if ( uRetCode == 0 )
      {
         printf( "The Ethernet Number is: %02x%02x%02x%02x%02x%02x\n",
                  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] );
      }
   }

If you have an idea to resolv my problem?
or If you can give me a source to read the ID network adapter I'm very happy.

Best regards,
0
Comment
Question by:es071097
  • 2
2 Comments
 
LVL 5

Expert Comment

by:y96andha
Comment Utility
Try changing
 strcpy( (char*)Ncb.ncb_callname, <IP_ADRESS> );
to
 strcpy( (char*)Ncb.ncb_callname,"*               "); // one asterisk and 15 blanks

0
 
LVL 5

Accepted Solution

by:
y96andha earned 50 total points
Comment Utility
You can also look at http://www.experts-exchange.com/topics/bin/ShowQ?qid=8630010494 which is a VB source for getting the MAC address.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Greetings, Experts! First let me state that this website is top notch. I thoroughly enjoy the community that is shared here; those seeking help and those willing to sacrifice their time to help. It is fantastic. I am writing this article at th…
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now