Solved

Netbios programming problem

Posted on 1997-08-08
2
506 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 50 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a cheap RFID setup 10 111
windows explorer default details view 10 98
Skype password reset 1 32
SMB Packet - File Data 4 47
We recently endured a series of broadcast storms that caused our ISP to shut us down for brief periods of time. After going through a multitude of tests, we determined that the issue was related to Intel NIC drivers on some new HP desktop computers …
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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