• 0

[C++] GetIfTable()


Question

I'm programming in ASM and I have to translate structure definitions from C++ to ASM, so far I've succeed except for MIB_IFROW.

This requires no knowledge in ASM.

(I read Platform SDK/MSDN)

The wszName member in MIB_IFROW is defined as WCHAR and the size is 512.

When they explain what the member is/does then they say that it's a pointer to a unicode string.

So... is it a pointer or WCHAR, or what?

Is it 512 bytes or 512 WCHAR's(1024 bytes)?

Check here:

http://msdn.microsoft.com/library/default....s/mib_ifrow.asp

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

From what I see, it is an array 256 wchars long, or 512 bytes. As you know, an array's name is a pointer to its first element, hence the "pointer to a unicode string." A single unicode character is 2 bytes.

Link to comment
Share on other sites

  • 0

Thanks...

It seems that I've got it all wrong...

It says that I got 10Mbit when I've got 100Mbit... Windows reports 100Mbit but not when I call that function.

It seems that wszName is empty.

It says that interface type is Loopback... (I have pure ethernet)

(I clear the buffer before I call the function and function returns ERROR_SUCCESS)

I've seen examples in VB and they seem to work except for the interface type thing.

Link to comment
Share on other sites

  • 0

You're calling GetIfTable, right? That should return an MIB_IFTABLE. It holds an array of MIB_IFROWs. Iterate through that based on its member dwNumEntries, ignoring the loopback. Granted, I've never done any of what you're doing, so if I'm totally offbase with this feel free to smack me. ;)

Link to comment
Share on other sites

  • 0

heh :)

I've used functions like this one before.

A Structure with an array of structures in it...

I think that I've figured out some of it... there's some wierd entries in the structure array, must be the disabled internal modem that I have that makes it spooky.

(it returns ethernet and 100Mbps)

Anyway... wszName still seems to be empty... I wrote my own Unicode -> ANSI string function.

I couldn't find any API to do this.

(bDescr isn't empty)

Link to comment
Share on other sites

  • 0

It all seems to work good... almost.

There's only two things that keeps bothering me.

The loopback interface index is 1 and my NIC's index is 16777219... which seems wierd, why such index?

And bDescr doesn't show the same name as Windows device manager nor network properties.

Anyone have any idea? :unsure:

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.