Hi All,
I like to read and dipslay the MAC Address of the device. I search
on help and it shows that
typedef uchar NDIS_802_11_MAC_ADDRESS[6] contains the MAC address but when
i read it always returns Zero.

Any help please.

Thanks

Re: Reading MAC Address by Paul

Paul
Tue Jun 03 11:22:51 PDT 2008

Interesting how this works. I just wrote code to do this five minutes ago,
again. Use GetAdaptersInfo() from the IP Helper API. The Address field
contains the hardware address (Ethernet address, in most cases).

Paul T.

"Raheem" <Raheem@discussions.microsoft.com> wrote in message
news:56E11092-9D84-46DC-A9EA-5F6131F92C33@microsoft.com...
> Hi All,
> I like to read and dipslay the MAC Address of the device. I
> search
> on help and it shows that
> typedef uchar NDIS_802_11_MAC_ADDRESS[6] contains the MAC address but
> when
> i read it always returns Zero.
>
> Any help please.
>
> Thanks
>
>



Re: Reading MAC Address by Raheem

Raheem
Wed Jun 04 05:01:01 PDT 2008

Hi Paul,
I added the code below to the .exe

IP_ADAPTER_INFO *pAdapterInfo;
IP_ADAPTER_INFO *pAdapter;
DWORD ulOutBufLen;

//Call GetAdaptersInfo to get the size of the buffer
ulOutBufLen = 0;
GetAdaptersInfo( NULL, &ulOutBufLen) ;

//Now that we know the necessary buffer size, allocate the memory
pAdapterInfo = (IP_ADAPTER_INFO *) malloc( ulOutBufLen );

dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
if (dwRetVal != ERROR_SUCCESS) {
RETAILMSG(TRUE, (TEXT("Call to GetAdaptersInfo failed, error %d.\n"),
dwRetVal));
free (pAdapterInfo);
return;
}

//Loop through the adapters and print info on each one.
pAdapter = pAdapterInfo;

while (pAdapter) {
RETAILMSG(TRUE, (TEXT("\tAdapter Name: \t%s\n"), pAdapter->AdapterName));
RETAILMSG(TRUE, (TEXT("\tAdapter Desc: \t%s\n"), pAdapter->Description));
RETAILMSG(TRUE, (TEXT("\tAdapter Addr: \t%ld\n"), pAdapter->Address));
RETAILMSG(TRUE, (TEXT("\tIP Address: \t%s\n"),
pAdapter->IpAddressList.IpAddress.String));
RETAILMSG(TRUE, (TEXT("\tIP Mask: \t%s\n"),
pAdapter->IpAddressList.IpMask.String));

It compiled scessfully and I downloaded to traget device which has PXA270.
When I double click to open the .exe file, I get message like "Cannot be
accessed, Make sure that the file is currently not open"

Any idea please ? I think i did it in the right with PB Help
"GetAdaptersInfo" but no sucess.

Regards


"Paul G. Tobey [eMVP]" wrote:

> Interesting how this works. I just wrote code to do this five minutes ago,
> again. Use GetAdaptersInfo() from the IP Helper API. The Address field
> contains the hardware address (Ethernet address, in most cases).
>
> Paul T.
>
> "Raheem" <Raheem@discussions.microsoft.com> wrote in message
> news:56E11092-9D84-46DC-A9EA-5F6131F92C33@microsoft.com...
> > Hi All,
> > I like to read and dipslay the MAC Address of the device. I
> > search
> > on help and it shows that
> > typedef uchar NDIS_802_11_MAC_ADDRESS[6] contains the MAC address but
> > when
> > i read it always returns Zero.
> >
> > Any help please.
> >
> > Thanks
> >
> >
>
>
>

Re: Reading MAC Address by Paul

Paul
Wed Jun 04 08:33:01 PDT 2008

"Cannot be accessed" doesn't indicate a problem with the code. Run the code
in the debugger, not by itself. You have no hope that the code will be 100%
right the first time (I see one printing problem at first glance); you're
going to need the debugger. You linked with iphlpapi.lib, yes? Does your
OS include the IP Helper API? That's the only systemic problem I can think
of that would prevent the code from running.

Paul T.

"Raheem" <Raheem@discussions.microsoft.com> wrote in message
news:79835086-2BB4-4229-B729-279DAA202DDA@microsoft.com...
> Hi Paul,
> I added the code below to the .exe
>
> IP_ADAPTER_INFO *pAdapterInfo;
> IP_ADAPTER_INFO *pAdapter;
> DWORD ulOutBufLen;
>
> //Call GetAdaptersInfo to get the size of the buffer
> ulOutBufLen = 0;
> GetAdaptersInfo( NULL, &ulOutBufLen) ;
>
> //Now that we know the necessary buffer size, allocate the memory
> pAdapterInfo = (IP_ADAPTER_INFO *) malloc( ulOutBufLen );
>
> dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
> if (dwRetVal != ERROR_SUCCESS) {
> RETAILMSG(TRUE, (TEXT("Call to GetAdaptersInfo failed, error %d.\n"),
> dwRetVal));
> free (pAdapterInfo);
> return;
> }
>
> //Loop through the adapters and print info on each one.
> pAdapter = pAdapterInfo;
>
> while (pAdapter) {
> RETAILMSG(TRUE, (TEXT("\tAdapter Name: \t%s\n"), pAdapter->AdapterName));
> RETAILMSG(TRUE, (TEXT("\tAdapter Desc: \t%s\n"), pAdapter->Description));
> RETAILMSG(TRUE, (TEXT("\tAdapter Addr: \t%ld\n"), pAdapter->Address));
> RETAILMSG(TRUE, (TEXT("\tIP Address: \t%s\n"),
> pAdapter->IpAddressList.IpAddress.String));
> RETAILMSG(TRUE, (TEXT("\tIP Mask: \t%s\n"),
> pAdapter->IpAddressList.IpMask.String));
>
> It compiled scessfully and I downloaded to traget device which has PXA270.
> When I double click to open the .exe file, I get message like "Cannot be
> accessed, Make sure that the file is currently not open"
>
> Any idea please ? I think i did it in the right with PB Help
> "GetAdaptersInfo" but no sucess.
>
> Regards
>
>
> "Paul G. Tobey [eMVP]" wrote:
>
>> Interesting how this works. I just wrote code to do this five minutes
>> ago,
>> again. Use GetAdaptersInfo() from the IP Helper API. The Address field
>> contains the hardware address (Ethernet address, in most cases).
>>
>> Paul T.
>>
>> "Raheem" <Raheem@discussions.microsoft.com> wrote in message
>> news:56E11092-9D84-46DC-A9EA-5F6131F92C33@microsoft.com...
>> > Hi All,
>> > I like to read and dipslay the MAC Address of the device. I
>> > search
>> > on help and it shows that
>> > typedef uchar NDIS_802_11_MAC_ADDRESS[6] contains the MAC address but
>> > when
>> > i read it always returns Zero.
>> >
>> > Any help please.
>> >
>> > Thanks
>> >
>> >
>>
>>
>>



Re: Reading MAC Address by Raheem

Raheem
Wed Jun 04 08:54:01 PDT 2008

Hi Paul,
Linker and IP header files are allright. I debug the code and
it is failing at line

dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);

dwRetVal value is 232 thats the error code I am getting. It should be
actaully zero.

GetAdaptersInfo function is failing. Target device has PXA270 and DM9000 as
MAC and PHY chip.

I do not have any idea why it is failing. Do you have any hint.

Thanks


"Paul G. Tobey [eMVP]" wrote:

> "Cannot be accessed" doesn't indicate a problem with the code. Run the code
> in the debugger, not by itself. You have no hope that the code will be 100%
> right the first time (I see one printing problem at first glance); you're
> going to need the debugger. You linked with iphlpapi.lib, yes? Does your
> OS include the IP Helper API? That's the only systemic problem I can think
> of that would prevent the code from running.
>
> Paul T.
>
> "Raheem" <Raheem@discussions.microsoft.com> wrote in message
> news:79835086-2BB4-4229-B729-279DAA202DDA@microsoft.com...
> > Hi Paul,
> > I added the code below to the .exe
> >
> > IP_ADAPTER_INFO *pAdapterInfo;
> > IP_ADAPTER_INFO *pAdapter;
> > DWORD ulOutBufLen;
> >
> > //Call GetAdaptersInfo to get the size of the buffer
> > ulOutBufLen = 0;
> > GetAdaptersInfo( NULL, &ulOutBufLen) ;
> >
> > //Now that we know the necessary buffer size, allocate the memory
> > pAdapterInfo = (IP_ADAPTER_INFO *) malloc( ulOutBufLen );
> >
> > dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
> > if (dwRetVal != ERROR_SUCCESS) {
> > RETAILMSG(TRUE, (TEXT("Call to GetAdaptersInfo failed, error %d.\n"),
> > dwRetVal));
> > free (pAdapterInfo);
> > return;
> > }
> >
> > //Loop through the adapters and print info on each one.
> > pAdapter = pAdapterInfo;
> >
> > while (pAdapter) {
> > RETAILMSG(TRUE, (TEXT("\tAdapter Name: \t%s\n"), pAdapter->AdapterName));
> > RETAILMSG(TRUE, (TEXT("\tAdapter Desc: \t%s\n"), pAdapter->Description));
> > RETAILMSG(TRUE, (TEXT("\tAdapter Addr: \t%ld\n"), pAdapter->Address));
> > RETAILMSG(TRUE, (TEXT("\tIP Address: \t%s\n"),
> > pAdapter->IpAddressList.IpAddress.String));
> > RETAILMSG(TRUE, (TEXT("\tIP Mask: \t%s\n"),
> > pAdapter->IpAddressList.IpMask.String));
> >
> > It compiled scessfully and I downloaded to traget device which has PXA270.
> > When I double click to open the .exe file, I get message like "Cannot be
> > accessed, Make sure that the file is currently not open"
> >
> > Any idea please ? I think i did it in the right with PB Help
> > "GetAdaptersInfo" but no sucess.
> >
> > Regards
> >
> >
> > "Paul G. Tobey [eMVP]" wrote:
> >
> >> Interesting how this works. I just wrote code to do this five minutes
> >> ago,
> >> again. Use GetAdaptersInfo() from the IP Helper API. The Address field
> >> contains the hardware address (Ethernet address, in most cases).
> >>
> >> Paul T.
> >>
> >> "Raheem" <Raheem@discussions.microsoft.com> wrote in message
> >> news:56E11092-9D84-46DC-A9EA-5F6131F92C33@microsoft.com...
> >> > Hi All,
> >> > I like to read and dipslay the MAC Address of the device. I
> >> > search
> >> > on help and it shows that
> >> > typedef uchar NDIS_802_11_MAC_ADDRESS[6] contains the MAC address but
> >> > when
> >> > i read it always returns Zero.
> >> >
> >> > Any help please.
> >> >
> >> > Thanks
> >> >
> >> >
> >>
> >>
> >>
>
>
>

Re: Reading MAC Address by Paul

Paul
Wed Jun 04 09:00:35 PDT 2008

Did you look up the error? 232 does not seem like a reasonable value. You
aren't using KITL over that Ethernet chip, are you? And you can ping the
device from your desktop using the IP address of the DM9000 adapter? I
can't recall the call ever failing for me, unless there's no network
adapters...

Paul T.

"Raheem" <Raheem@discussions.microsoft.com> wrote in message
news:E009E93B-20AB-4113-B117-1C74DED74521@microsoft.com...
> Hi Paul,
> Linker and IP header files are allright. I debug the code and
> it is failing at line
>
> dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
>
> dwRetVal value is 232 thats the error code I am getting. It should be
> actaully zero.
>
> GetAdaptersInfo function is failing. Target device has PXA270 and DM9000
> as
> MAC and PHY chip.
>
> I do not have any idea why it is failing. Do you have any hint.
>
> Thanks
>
>
> "Paul G. Tobey [eMVP]" wrote:
>
>> "Cannot be accessed" doesn't indicate a problem with the code. Run the
>> code
>> in the debugger, not by itself. You have no hope that the code will be
>> 100%
>> right the first time (I see one printing problem at first glance); you're
>> going to need the debugger. You linked with iphlpapi.lib, yes? Does
>> your
>> OS include the IP Helper API? That's the only systemic problem I can
>> think
>> of that would prevent the code from running.
>>
>> Paul T.
>>
>> "Raheem" <Raheem@discussions.microsoft.com> wrote in message
>> news:79835086-2BB4-4229-B729-279DAA202DDA@microsoft.com...
>> > Hi Paul,
>> > I added the code below to the .exe
>> >
>> > IP_ADAPTER_INFO *pAdapterInfo;
>> > IP_ADAPTER_INFO *pAdapter;
>> > DWORD ulOutBufLen;
>> >
>> > //Call GetAdaptersInfo to get the size of the buffer
>> > ulOutBufLen = 0;
>> > GetAdaptersInfo( NULL, &ulOutBufLen) ;
>> >
>> > //Now that we know the necessary buffer size, allocate the memory
>> > pAdapterInfo = (IP_ADAPTER_INFO *) malloc( ulOutBufLen );
>> >
>> > dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
>> > if (dwRetVal != ERROR_SUCCESS) {
>> > RETAILMSG(TRUE, (TEXT("Call to GetAdaptersInfo failed, error %d.\n"),
>> > dwRetVal));
>> > free (pAdapterInfo);
>> > return;
>> > }
>> >
>> > //Loop through the adapters and print info on each one.
>> > pAdapter = pAdapterInfo;
>> >
>> > while (pAdapter) {
>> > RETAILMSG(TRUE, (TEXT("\tAdapter Name: \t%s\n"),
>> > pAdapter->AdapterName));
>> > RETAILMSG(TRUE, (TEXT("\tAdapter Desc: \t%s\n"),
>> > pAdapter->Description));
>> > RETAILMSG(TRUE, (TEXT("\tAdapter Addr: \t%ld\n"), pAdapter->Address));
>> > RETAILMSG(TRUE, (TEXT("\tIP Address: \t%s\n"),
>> > pAdapter->IpAddressList.IpAddress.String));
>> > RETAILMSG(TRUE, (TEXT("\tIP Mask: \t%s\n"),
>> > pAdapter->IpAddressList.IpMask.String));
>> >
>> > It compiled scessfully and I downloaded to traget device which has
>> > PXA270.
>> > When I double click to open the .exe file, I get message like "Cannot
>> > be
>> > accessed, Make sure that the file is currently not open"
>> >
>> > Any idea please ? I think i did it in the right with PB Help
>> > "GetAdaptersInfo" but no sucess.
>> >
>> > Regards
>> >
>> >
>> > "Paul G. Tobey [eMVP]" wrote:
>> >
>> >> Interesting how this works. I just wrote code to do this five minutes
>> >> ago,
>> >> again. Use GetAdaptersInfo() from the IP Helper API. The Address
>> >> field
>> >> contains the hardware address (Ethernet address, in most cases).
>> >>
>> >> Paul T.
>> >>
>> >> "Raheem" <Raheem@discussions.microsoft.com> wrote in message
>> >> news:56E11092-9D84-46DC-A9EA-5F6131F92C33@microsoft.com...
>> >> > Hi All,
>> >> > I like to read and dipslay the MAC Address of the device. I
>> >> > search
>> >> > on help and it shows that
>> >> > typedef uchar NDIS_802_11_MAC_ADDRESS[6] contains the MAC address
>> >> > but
>> >> > when
>> >> > i read it always returns Zero.
>> >> >
>> >> > Any help please.
>> >> >
>> >> > Thanks
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>
>>
>>



Re: Reading MAC Address by Bruce

Bruce
Wed Jun 04 09:56:45 PDT 2008

When I saw Paul's reply yesterday, I decided to try it also. So I wrote some
code to output the results of GetAdapterInfo. Of course I cheated as I
always do and copied an example from MSDN.

I also was getting error code 232. I did some digging and debugging and
found that in your code (and similar in the MSDN code) that you are missing
something:

//Call GetAdaptersInfo to get the size of the buffer
ulOutBufLen = 0;
GetAdaptersInfo( NULL, &ulOutBufLen) ;

-- What happens here if ulOutBufLen is zero? I can tell you that, you get
error code 232.
-- So if you add an if condition:

if( ulOutBufLen != 0 )
{
//Now that we know the necessary buffer size, allocate the memory
pAdapterInfo = (IP_ADAPTER_INFO *) malloc( ulOutBufLen );

dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
// removed the rest of the code for brevity
}
else
// handle no adapters found

I got lucky, I had intentionally created a Data Abort in my Ethernet driver,
so I know why I didn't have any adapters. But that is another story
(http://geekswithblogs.net/BruceEitman/archive/2008/06/02/platform-builder-find-the-source-of-a-data-abort-an.aspx).

When I fixed my Ethernet driver, the error went away and I output the
information.

--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT EuroTech DOT com
My BLOG http://geekswithblogs.net/bruceeitman

EuroTech Inc.
www.EuroTech.com

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:e8m4awlxIHA.2068@TK2MSFTNGP05.phx.gbl...
> Did you look up the error? 232 does not seem like a reasonable value.
> You aren't using KITL over that Ethernet chip, are you? And you can ping
> the device from your desktop using the IP address of the DM9000 adapter?
> I can't recall the call ever failing for me, unless there's no network
> adapters...
>
> Paul T.
>
> "Raheem" <Raheem@discussions.microsoft.com> wrote in message
> news:E009E93B-20AB-4113-B117-1C74DED74521@microsoft.com...
>> Hi Paul,
>> Linker and IP header files are allright. I debug the code and
>> it is failing at line
>>
>> dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
>>
>> dwRetVal value is 232 thats the error code I am getting. It should be
>> actaully zero.
>>
>> GetAdaptersInfo function is failing. Target device has PXA270 and DM9000
>> as
>> MAC and PHY chip.
>>
>> I do not have any idea why it is failing. Do you have any hint.
>>
>> Thanks
>>
>>
>> "Paul G. Tobey [eMVP]" wrote:
>>
>>> "Cannot be accessed" doesn't indicate a problem with the code. Run the
>>> code
>>> in the debugger, not by itself. You have no hope that the code will be
>>> 100%
>>> right the first time (I see one printing problem at first glance);
>>> you're
>>> going to need the debugger. You linked with iphlpapi.lib, yes? Does
>>> your
>>> OS include the IP Helper API? That's the only systemic problem I can
>>> think
>>> of that would prevent the code from running.
>>>
>>> Paul T.
>>>
>>> "Raheem" <Raheem@discussions.microsoft.com> wrote in message
>>> news:79835086-2BB4-4229-B729-279DAA202DDA@microsoft.com...
>>> > Hi Paul,
>>> > I added the code below to the .exe
>>> >
>>> > IP_ADAPTER_INFO *pAdapterInfo;
>>> > IP_ADAPTER_INFO *pAdapter;
>>> > DWORD ulOutBufLen;
>>> >
>>> > //Call GetAdaptersInfo to get the size of the buffer
>>> > ulOutBufLen = 0;
>>> > GetAdaptersInfo( NULL, &ulOutBufLen) ;
>>> >
>>> > //Now that we know the necessary buffer size, allocate the memory
>>> > pAdapterInfo = (IP_ADAPTER_INFO *) malloc( ulOutBufLen );
>>> >
>>> > dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
>>> > if (dwRetVal != ERROR_SUCCESS) {
>>> > RETAILMSG(TRUE, (TEXT("Call to GetAdaptersInfo failed, error %d.\n"),
>>> > dwRetVal));
>>> > free (pAdapterInfo);
>>> > return;
>>> > }
>>> >
>>> > //Loop through the adapters and print info on each one.
>>> > pAdapter = pAdapterInfo;
>>> >
>>> > while (pAdapter) {
>>> > RETAILMSG(TRUE, (TEXT("\tAdapter Name: \t%s\n"),
>>> > pAdapter->AdapterName));
>>> > RETAILMSG(TRUE, (TEXT("\tAdapter Desc: \t%s\n"),
>>> > pAdapter->Description));
>>> > RETAILMSG(TRUE, (TEXT("\tAdapter Addr: \t%ld\n"),
>>> > pAdapter->Address));
>>> > RETAILMSG(TRUE, (TEXT("\tIP Address: \t%s\n"),
>>> > pAdapter->IpAddressList.IpAddress.String));
>>> > RETAILMSG(TRUE, (TEXT("\tIP Mask: \t%s\n"),
>>> > pAdapter->IpAddressList.IpMask.String));
>>> >
>>> > It compiled scessfully and I downloaded to traget device which has
>>> > PXA270.
>>> > When I double click to open the .exe file, I get message like "Cannot
>>> > be
>>> > accessed, Make sure that the file is currently not open"
>>> >
>>> > Any idea please ? I think i did it in the right with PB Help
>>> > "GetAdaptersInfo" but no sucess.
>>> >
>>> > Regards
>>> >
>>> >
>>> > "Paul G. Tobey [eMVP]" wrote:
>>> >
>>> >> Interesting how this works. I just wrote code to do this five
>>> >> minutes
>>> >> ago,
>>> >> again. Use GetAdaptersInfo() from the IP Helper API. The Address
>>> >> field
>>> >> contains the hardware address (Ethernet address, in most cases).
>>> >>
>>> >> Paul T.
>>> >>
>>> >> "Raheem" <Raheem@discussions.microsoft.com> wrote in message
>>> >> news:56E11092-9D84-46DC-A9EA-5F6131F92C33@microsoft.com...
>>> >> > Hi All,
>>> >> > I like to read and dipslay the MAC Address of the device.
>>> >> > I
>>> >> > search
>>> >> > on help and it shows that
>>> >> > typedef uchar NDIS_802_11_MAC_ADDRESS[6] contains the MAC address
>>> >> > but
>>> >> > when
>>> >> > i read it always returns Zero.
>>> >> >
>>> >> > Any help please.
>>> >> >
>>> >> > Thanks
>>> >> >
>>> >> >
>>> >>
>>> >>
>>> >>
>>>
>>>
>>>
>
>



Re: Reading MAC Address by Tom

Tom
Wed Jun 04 14:30:38 PDT 2008

Error 232 corresponds to ERROR_NO_DATA, which GetAdaptersInfo will
return if the TCP/IP stack indicates that thee are NO ADAPTERS bound
to the stack.

Tom


On Wed, 4 Jun 2008 09:00:35 -0700, "Paul G. Tobey [eMVP]" <p space
tobey no spam AT no instrument no spam DOT com> wrote:

>Did you look up the error? 232 does not seem like a reasonable value. You
>aren't using KITL over that Ethernet chip, are you? And you can ping the
>device from your desktop using the IP address of the DM9000 adapter? I
>can't recall the call ever failing for me, unless there's no network
>adapters...
>
>Paul T.
>


Re: Reading MAC Address by Tom

Tom
Wed Jun 04 14:34:10 PDT 2008

I would not expect this to be the case. GetAdaptersInfo returns
ERROR_BUFFER_OVERFLOW whenever the pAdapterInfo argument is NULL or
whenever the value in *pOutBufLen (i.e. ulOutBufLen) is less than the
size of the buffer needed to hold the data.

Instead, the error 232 (ERROR_NO_DATA) indicates no adapters were
found bound to the TCP/IP stack.

Tom

On Wed, 4 Jun 2008 12:56:45 -0400, "Bruce Eitman [eMVP]"
<bruce.eitman.nospam@EuroTech.com.nospam> wrote:

>When I saw Paul's reply yesterday, I decided to try it also. So I wrote some
>code to output the results of GetAdapterInfo. Of course I cheated as I
>always do and copied an example from MSDN.
>
>I also was getting error code 232. I did some digging and debugging and
>found that in your code (and similar in the MSDN code) that you are missing
>something:
>
> //Call GetAdaptersInfo to get the size of the buffer
> ulOutBufLen = 0;
> GetAdaptersInfo( NULL, &ulOutBufLen) ;
>
>-- What happens here if ulOutBufLen is zero? I can tell you that, you get
>error code 232.
>-- So if you add an if condition:
>
>if( ulOutBufLen != 0 )
>{
> //Now that we know the necessary buffer size, allocate the memory
> pAdapterInfo = (IP_ADAPTER_INFO *) malloc( ulOutBufLen );
>
> dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
> // removed the rest of the code for brevity
>}
>else
> // handle no adapters found
>
>I got lucky, I had intentionally created a Data Abort in my Ethernet driver,
>so I know why I didn't have any adapters. But that is another story
>(http://geekswithblogs.net/BruceEitman/archive/2008/06/02/platform-builder-find-the-source-of-a-data-abort-an.aspx).
>
>When I fixed my Ethernet driver, the error went away and I output the
>information.

Re: Reading MAC Address by Paul

Paul
Wed Jun 04 14:40:05 PDT 2008

Hmmm. The error code lookup utility has a somewhat different view of what
the error code means (I should have checked winerror.h myself). It says,
"The pipe is being closed."...

Thanks, Tom.
Paul T.

"Tom Gensel (eMVP)" <tgensel.at.ptgsystems.dot.com> wrote in message
news:142e4410ei1fdg9peg2aanvbncqhmn28af@4ax.com...
> Error 232 corresponds to ERROR_NO_DATA, which GetAdaptersInfo will
> return if the TCP/IP stack indicates that thee are NO ADAPTERS bound
> to the stack.
>
> Tom
>
>
> On Wed, 4 Jun 2008 09:00:35 -0700, "Paul G. Tobey [eMVP]" <p space
> tobey no spam AT no instrument no spam DOT com> wrote:
>
>>Did you look up the error? 232 does not seem like a reasonable value.
>>You
>>aren't using KITL over that Ethernet chip, are you? And you can ping the
>>device from your desktop using the IP address of the DM9000 adapter? I
>>can't recall the call ever failing for me, unless there's no network
>>adapters...
>>
>>Paul T.
>>
>



Re: Reading MAC Address by Bruce

Bruce
Wed Jun 04 15:28:52 PDT 2008

Looking at my code, which again I found on MSDN (I take no ownership), it
had some holes in it.

So, looks like this would be better, I tried it and the ERROR_NO_DATA is the
return from the first call:

//Call GetAdaptersInfo to get the size of the buffer
ulOutBufLen = 0;
dwRetVal = GetAdaptersInfo( NULL, &ulOutBufLen) ;
if (dwRetVal == ERROR_BUFFER_OVERFLOW)
{
//Now that we know the necessary buffer size, allocate the memory
pAdapterInfo = (IP_ADAPTER_INFO *) malloc( ulOutBufLen );
}
else if( dwRetVal == ERROR_NO_DATA )
{
// handle no adapters found
}

// Now we know that there are some adapters, get the info
dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);


--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT EuroTech DOT com
My BLOG http://geekswithblogs.net/bruceeitman

EuroTech Inc.
www.EuroTech.com

"Tom Gensel (eMVP)" <tgensel.at.ptgsystems.dot.com> wrote in message
news:lc2e4496csvkdf0a0gn13h8757ed2p4mgt@4ax.com...
>I would not expect this to be the case. GetAdaptersInfo returns
> ERROR_BUFFER_OVERFLOW whenever the pAdapterInfo argument is NULL or
> whenever the value in *pOutBufLen (i.e. ulOutBufLen) is less than the
> size of the buffer needed to hold the data.
>
> Instead, the error 232 (ERROR_NO_DATA) indicates no adapters were
> found bound to the TCP/IP stack.
>
> Tom
>
> On Wed, 4 Jun 2008 12:56:45 -0400, "Bruce Eitman [eMVP]"
> <bruce.eitman.nospam@EuroTech.com.nospam> wrote:
>
>>When I saw Paul's reply yesterday, I decided to try it also. So I wrote
>>some
>>code to output the results of GetAdapterInfo. Of course I cheated as I
>>always do and copied an example from MSDN.
>>
>>I also was getting error code 232. I did some digging and debugging and
>>found that in your code (and similar in the MSDN code) that you are
>>missing
>>something:
>>
>> //Call GetAdaptersInfo to get the size of the buffer
>> ulOutBufLen = 0;
>> GetAdaptersInfo( NULL, &ulOutBufLen) ;
>>
>>-- What happens here if ulOutBufLen is zero? I can tell you that, you
>>get
>>error code 232.
>>-- So if you add an if condition:
>>
>>if( ulOutBufLen != 0 )
>>{
>> //Now that we know the necessary buffer size, allocate the memory
>> pAdapterInfo = (IP_ADAPTER_INFO *) malloc( ulOutBufLen );
>>
>> dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen);
>> // removed the rest of the code for brevity
>>}
>>else
>> // handle no adapters found
>>
>>I got lucky, I had intentionally created a Data Abort in my Ethernet
>>driver,
>>so I know why I didn't have any adapters. But that is another story
>>(http://geekswithblogs.net/BruceEitman/archive/2008/06/02/platform-builder-find-the-source-of-a-data-abort-an.aspx).
>>
>>When I fixed my Ethernet driver, the error went away and I output the
>>information.



Re: Reading MAC Address by Bruce

Bruce
Wed Jun 04 15:29:59 PDT 2008

And I thought that it was just me, like I typed in the wrong number.

--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT EuroTech DOT com
My BLOG http://geekswithblogs.net/bruceeitman

EuroTech Inc.
www.EuroTech.com

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:OwuuHuoxIHA.5472@TK2MSFTNGP06.phx.gbl...
> Hmmm. The error code lookup utility has a somewhat different view of what
> the error code means (I should have checked winerror.h myself). It says,
> "The pipe is being closed."...
>
> Thanks, Tom.
> Paul T.
>
> "Tom Gensel (eMVP)" <tgensel.at.ptgsystems.dot.com> wrote in message
> news:142e4410ei1fdg9peg2aanvbncqhmn28af@4ax.com...
>> Error 232 corresponds to ERROR_NO_DATA, which GetAdaptersInfo will
>> return if the TCP/IP stack indicates that thee are NO ADAPTERS bound
>> to the stack.
>>
>> Tom
>>
>>
>> On Wed, 4 Jun 2008 09:00:35 -0700, "Paul G. Tobey [eMVP]" <p space
>> tobey no spam AT no instrument no spam DOT com> wrote:
>>
>>>Did you look up the error? 232 does not seem like a reasonable value.
>>>You
>>>aren't using KITL over that Ethernet chip, are you? And you can ping the
>>>device from your desktop using the IP address of the DM9000 adapter? I
>>>can't recall the call ever failing for me, unless there's no network
>>>adapters...
>>>
>>>Paul T.
>>>
>>
>
>