[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Netbios programming problem

Posted on 1997-08-08
2
Medium Priority
?
534 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
ID: 1563055
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 100 total points
ID: 1563056
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A common practice in small networks is making file sharing easy which works extremely well when intra-network security is not an issue. In essence, everyone, that is "Everyone", is given access to all of the shared files - often the entire C: drive …
I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

865 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