|
You can use either GetAdaptersInfo() or GetIfTable().
For GetAdaptersInfo() IP_ADAPTER_INFO try one of:
- check IP_ADAPTER_INFO.Type to see if MIB_IF_TYPE_ETHERNET, ...
- check if( AddressLength == 0 ), if true likely a virtual adapter
For GetIfTable() MIB_IFROW try one of:
- check MIB_IFROW.dwType to see if MIB_IF_TYPE_ETHERNET, ...
- check if( dwPhysAddrLen == 0 ), if true likely a virtual adapter
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Thanks for the reply.
Unfortunately, VMware is doing a really good job of making its adapters look like the real thing. Both GetAdaptersInfo() and GetIfTable() are saying that they are MIB_IF_TYPE_ETHERNET *and* have physical addresses!
Here's some output from my GetAdaptersInfo() test:
ADAPTER: {E26A33D4-6C3E-4EDA-A5EA-AFF0C8102238}
- Description: Broadcom 440x 10/100 Integrated Controller - Packet Scheduler Miniport
- Address: 0 d 56 b6 94 27
- Index: 5
- Type: 6
- DHCP Enabled: 1
- DHCP Server: 192.168.6.254
- DHCP Lease: obtained=4354e2af ; expires=435785af
- IP Addresses: 192.168.6.98
- Gateways: 192.168.6.254
- Have WINS: 0
ADAPTER: {B2B210F3-1513-42CA-AC6A-8B5A73EF0C4F}
- Description: Dell TrueMobile 1400 Dual Band WLAN Mini-PCI Card - Packet Scheduler Miniport
- Address: 0 90 4b 6d f5 bc
- Index: 4
- Type: 6
- DHCP Enabled: 1
- DHCP Server: 192.168.2.1
- DHCP Lease: obtained=43546f6a ; expires=7fffffff
- IP Addresses: 0.0.0.0
- Gateways:
- Have WINS: 0
ADAPTER: {EAC2B247-CC14-4EEE-854F-9437CBA9A50C}
- Description: VMware Virtual Ethernet Adapter for VMnet1
- Address: 0 50 56 c0 0 1
- Index: 3
- Type: 6
- DHCP Enabled: 0
- DHCP Server: 255.255.255.255
- DHCP Lease: obtained=0 ; expires=0
- IP Addresses: 192.168.213.1
- Gateways:
- Have WINS: 0
ADAPTER: {2AC6F23F-21B3-47C8-9ACE-C93DD40BBDB8}
- Description: VMware Virtual Ethernet Adapter for VMnet8
- Address: 0 50 56 c0 0 8
- Index: 2
- Type: 6
- DHCP Enabled: 0
- DHCP Server: 255.255.255.255
- DHCP Lease: obtained=0 ; expires=0
- IP Addresses: 192.168.182.1
- Gateways:
- Have WINS: 0
and GetIfTable():
Description: Broadcom 440x 10/100 Integrated Controller - Packet Scheduler Miniport
- Type: 6
- Phys.Address: 0 d 56 b6 94 27
Description: Dell TrueMobile 1400 Dual Band WLAN Mini-PCI Card - Packet Scheduler Miniport
- Type: 6
- Phys.Address: 0 90 4b 6d f5 bc
Description: VMware Virtual Ethernet Adapter for VMnet1
- Type: 6
- Phys.Address: 0 50 56 c0 0 1
Description: VMware Virtual Ethernet Adapter for VMnet8
- Type: 6
- Phys.Address: 0 50 56 c0 0 8
Description: MS TCP Loopback interface
- Type: 18
- Phys.Address:
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.1.3 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Good for me too know, bummer for you, sorry.
As another hack you could look at the physical address.
It looks like the VMWare MAC's are of the form: 00 50 56 c0 xx xx, where 00 50 56 is the vendor id (VMWare).
Although this will find all VMWare adapters, it doesn't address the more general problem of distinguishing real from virtual.
i.e.
http://standards.ieee.org/regauth/oui/index.shtml[^]
Enter VMWare in the OUI search box:
...
00-50-56 (hex) VMWare, Inc.
005056 (base 16) VMWare, Inc.
44 ENCINA AVENUE
PALO ALTO CA 94301
UNITED STATES
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Thanks.
I mentioned in the first post that the real adapters all seem to have "Packet Scheduler Miniport" in their descriptions. I'm guessing that Windows is inserting this itself so it must have some way of telling real from virtual. I tried Googling around to find out exactly what a miniport is but couldn't find anything API-related.
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.1.3 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Taka Muraoka wrote: I mentioned in the first post that the real adapters all seem to have "Packet Scheduler Miniport" in their descriptions.
Yes, but i wouldn't rely on that.
My Linksys wireless has a description of: "Linksys Wireless-B USB Network Adapter v2.8".
My ethernet card has: "3Com EtherLink 10/100 PCI TX NIC (3C905B-TX)".
To me this implies that not all descriptions will have "Packet Scheduler Miniport".
I suggested the physical address as all VMWare adapters will have the same prefix.
To me this would be a little more robust.
Without having a more concrete method of determining if an adapter is physical or virtual i would probably:
- code a list of know virtual adapter MAC prefixs (i.e. VMWare 00-50-56, ...)
- enum all adapters and discard those with no physical address, or that are in the list of know virtual adapters
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Here's what i get when i have:
- loopback driver enabled
- USB 802.11b Linksys adapter running and connected
- 3Com ethernet card enabled but not connected
GetAdaptersInfo:
AdapterName : {06843A50-0E17-4875-9A37-0B0FFFD46917}
Description : Linksys Wireless-B USB Network Adapter v2.8
Type : 6
Address : 6 00-0C-41 59-50-A2
AdapterName : {1FAF0AD2-E065-4CE1-8130-1F53A2094248}
Description : MS LoopBack Driver
Type : 6
Address : 6 02-00-4C 4F-4F-50
AdapterName : {25FB0619-5DCC-4154-B82A-659516BE0744}
Description : 3Com EtherLink PCI
Type : 6
Address : 6 00-50-04 AB-A7-DB
GetIfTable:
wszName :
bDescr : MS TCP Loopback interface
dwType : 24
dwAdminStatus : 1
dwOperStatus : 5
Address : 0 00-00-00 00-00-00
wszName :
bDescr : Linksys Wireless-B USB Network Adapter v2.8
dwType : 6
dwAdminStatus : 1
dwOperStatus : 5
Address : 6 00-0C-41 59-50-A2
wszName :
bDescr : 3Com EtherLink PCI
dwType : 6
dwAdminStatus : 1
dwOperStatus : 0
Address : 6 00-50-04 AB-A7-DB
wszName :
bDescr : MS LoopBack Driver
dwType : 6
dwAdminStatus : 1
dwOperStatus : 5
Address : 6 02-00-4C 4F-4F-50
Of interest to note, the MAC for the "MS LoopBack Driver" uses an invalid prefix (02-00-4C is not registered) ... way to go MS.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
cmk wrote: Of interest to note, the MAC for the "MS LoopBack Driver" uses an invalid prefix (02-00-4C is not registered) ... way to go MS.
Thanks for the help. I think I'll just have to check for VMware and Virtual PC's prefixes and hope that there aren't too many other things out there installing virtual adapters.
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.1.3 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
miscrosoft will release Visual C++.net 2005 in the late of this year. I find that C++/CLI of .net 2005 has more different from MFC than .net 2003 does. it have more syntax than standard C++. AS a MFC programmer, I dont have enough time to study Visual C++.net 2003, say nothing of .net 2005. Will MFC be out of date? I dont believe.
miscrosoft always releases a new edition of the C++ in nearly two years. How can we keep up with the trend as a programmer of the c++.
libo
|
|
|
|
|
|
Hi,
I am trying to write an Application talking to a DLL written by someone else.
I m finding it difficult to understand the DLL.
Can someone suggest me a tutorial / book or give me info on which area of VC++ the keywords like
LPARAM, WPARAM, LRESULT, CALLBACK etc come? Is it in Device driver programming area??
Please help!
- KK
|
|
|
|
|
they are not C++ keywords, they are windows macros...
search the msdn for any explanations...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
"That" was helpful. Thanks !
- KK
|
|
|
|
|
Nice reply
He is like a one-legged man in a bum kicking competition. -Novjot Sidhu
--[v]--
|
|
|
|
|
Hello!
This is a question about the IDE, i don't know where I should post it, so i'll place it here, sorry if it seems offtopic
does anybody know how to change the font under the line which was set a breakpoint ? here is what I want to do : When I set the break point in the line of code I want the background color of the text on that line to be red. I know that these can be done as I have done it before but I reinstalled my visual studio and forgot how it is done !
|
|
|
|
|
kreaThor wrote: does anybody know how to change the font under the line which was set a breakpoint ?
Tools --> Options --> Format tab
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
in Visual Studio .NET 2003 IDE:
GO to :
Tools Meue,
Select Options Item
Open Environment Folder
Click Font And Colors
Do Some Effort Before Question!
Be Luck.
|
|
|
|
|
Hi!
Has anyone ever made a simple client/server application using Windows (NT/2K/XP), Visual C++ and OpenSSL???
Or can anybody give me a link to an example?
Thank you so much!!
JaVinci.
|
|
|
|
|
<http://www.codeproject.com/internet/sslsocket.asp>
|
|
|
|
|
How to generate a GUID in MFC?
_____________________________
...and justice for all
APe
|
|
|
|
|
d00_ape wrote: How to generate a GUID in MFC?
Use this api :-
HRESULT CoCreateGuid(
GUID * pguid
);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Start -> Run
input the command "guidgen" and click ok
-------------------
I am trying to love c++
|
|
|
|
|
Hi there,
I've got the following problem:
I create a panel in an empty Form. then I set this panel to dock to the left.
Inside that panel i add some buttons, all docked to the top.
I set the autoscroll property on true.
When i start the app, i resize my form so the vertical-scrollbar automatically appears.
Now the problem:
When i start 'dragging' the scrollbar up and down, on SOME pc's the contents of the panel won't change position until i release the scrollbar. On my pc it will update directly, so i see the contents sliding smooth, but on a lot of other pc's it won't slide, until i stop scrolling.
I hope somebody has the answer for me! (the same question was posted in the c# section (no-replies), but i noticed the same problems in c++).
Greetz,
Pete
|
|
|
|
|
Instead of being something in your app, is this not a Windows Display Setting (I think you can disable some display effects, such as the update when scrolling scrollbars if your PC is a bit slow) ? Would explain why it depends on the PCs.
~RaGE();
|
|
|
|
|
Thx, i found the solution:
it was indeed a windows display setting.
This setting is found here:
1. Right click an empty area of your desktop.
2. Select Appearance
3. Select the Effects button
4. Place a checkmark in the "Show window contents while dragging" checkbox to enable this setting.
when you restart the application it works.
|
|
|
|