How to get TRUE hardware MAC address [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I know, that this question was created many times, but it is stil open
The problem is following:
My application need to generate some UID for computer, it working on.
I need it to implement the genuine protection.
MAC address is a good candidate, because it is unique for each ethernet card.
Many articles uses either GetAdaptersInfo, WMI, NetBIOS or Sockets.
Here is one of them: Three ways to get your MAC address.
They, shore, return a MAC address, but this address can be set by hands from adapter properties
Control Panel > Network and Internet > Network and Sharing Center > Change Adatper Settings > right click on adapter > Properties > click "configure" button > go to "Advanced" tab > chose "Network Address" and change it
The all mentioned methods are not match my needs, because a MAC address, being set with driver has greater priority, than true hardware MAC address. This "fake" address will be returned by all Win API functions, that i know, and therefore, the genuine protection can easy be broken.
Any help from you, guys, will be greatly appreciated.
Thanks.

The only means that Windows has to access the MAC address is asking the driver.
That's what the driver is for - to talk to the hardware so that Windows doesn't have to include code for every single device anyone might come up with ever.
If the driver is telling Windows that the MAC address is something, then that's what the MAC address is.

MAC address is a good candidate,
because it is unique for each ethernet
card.
I'm afraid not. Firstly, I've read reports of customers receiving entire batches of machines with identical MAC addresses (apparently this causes pain when building clusters).
I have also seen with my own eyes a machine that changes its MAC address on reboot. Every time. It was an old IBM Thinkpad running Windows XP.
My advice: stay well away from MAC addresses if you're generating unique IDs.

I don't think "Network Address" you mention refers to the MAC address. Some devices allow you to "spoof" the MAC address for ISP purposes, but you should be able to get the real MAC using the methods you found.

Related

Is it possible to definitively tell if a user is using laptop? [duplicate]

This question already has answers here:
Closed 12 years ago.
The community reviewed whether to reopen this question 12 months ago and left it closed:
Original close reason(s) were not resolved
Possible Duplicate:
How can I tell if a user is using a laptop
I'm trying to find out if the application is running on a laptop or on a desktop, any ideas on how to achieve this?
Note: I'm interested only in API's written in Delphi and/or C++.
EDIT: my target platform is Windows XP+, even Windows 7 only is OK.
Use this struct : SYSTEM_POWER_STATUS, and check the value of ACLineStatus field.
ACLineStatus = 0 => The system is not using AC power > Laptop + battery
ACLineStatus = 1 => The system is using AC power => Laptop + AC
ACLineStatus = 255 => AC power status is unknown => Desktop
Disclaimer : Try experimenting with these. I'm not claiming if they're reliable. But they're almost correct.
--
EDIT:
Use GetSystemPowerStatus to get the value of the above mentioned structure.
By the way, you can also experiment with the other fields of the structure; maybe you can find some useful pattern, giving you some combination of values of different fields to help you reliably detect if application is running on laptop or not.
I don't think there's a standard way to check whether the application runs on a laptop, but I think there's also no standard rationale for needing to know this.
The point is also that a laptop is no so much different from a desktop: there are laptops that get never moved, and I guess it would be possible to build a desktop with an embedded UPS (seen as a battery?)
I think you should find out if it's a laptop using the features you need to check in a laptop:
Do you want to know if it's a laptop because your application needs to behave differently if the computer may be moved around? Then check if it has got a battery plugged in.
Do you want to know if it's a laptop in order to see whether hardware can be modified? In this case check the motherboard model or ask with a dialog box.
Do you need to check it in order to know if it will burn to death if used too intensively for too long? Just monitor the temperature...
I don't believe there is a reliable way to detect this.
Apparently, the hidden problem is that the company laptops typically have not enough memory, but the company desktops do. To address this specific problem, compare memory used against memory installed: EnumProcesses() and GetProcessMemoryInfo tells you the first; GetPhysicallyInstalledSystemMemory() tells you the second.
If they're too close, you can inform the user that there are 73 running processes using 2.5 GB, but only 2GB RAM is present. This is a valid reason for your program not to start.
The MSDN discusses API for Power and Device Aware applications here
You could also check other things like:
Is battery connected
Is track pad connected
Is PC Card installed Is
Has a certain type of CPU (low power, Atom, etc)
Has a screen unique to laptop.
laptop hardrive is 3.5"
If a certain number of the above is true then you can assume laptop.
You could also just ask the user at installation....
Here's a bunch of other answers and links you might find useful for this question:
How to detect when the laptop is running on batteries?
How can I tell if a user is using a laptop
The latter also discusses WMI, while the answer is centred around .NET you can use WMI from Delphi.

Detect other iPhones in a range [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm looking to create a mobile app on IOS devices before I started I just needed to check up on one thing. How can I detect other IOS mobile devices within local rage e.g same room, same train, etc..
I want to be able to do it while the phone is locked, so bluetooth wouldn't be a great example as most people have it turned off.
Thanks!
The application has to send its location to the server.
Then the server knows where every devices that shared its location are.
Then your application can ask "who is around?" to your server... and your server calculates (let's suppose within a radius of 2 miles) who is around... and sends back to you.
It doesn't have anything to do with bluetooth. It's done via regular internet.
For other users of your app who want to be discovered you could use Bluetooth LE and the new iBeacon support added in iOS 7. Each user would have to launch your app and give it permission to start "advertising" their presence. However, the range of Bluetooth LE is like 10-20 meters (I forget the exact figure) and that will go down in "RF hostile" environments.
If everybody's connected to the same WiFi network you could use Bonjour.
Another option, as suggested by Wagner, above, is to have the devices send their locations to a central server.

How to access VirtualBox running on OSX over RDP [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
So, I read the manual three times, installed the Oracle service pack two times, tried to access five different virtual machines dozens of times with all kinds of authentications, followed every thread on this forum, all to no avail. I really did everything there is to do to my knowledge. But accessing Virtualbox regardless of the OS does not work in version 4.1.23. Two things seem just really bad:
The manual tells at no point WHERE on OSX the VBoxManager commandline tool is installed. But the manual references it dozens of times. It's on no search path in none of the shells I am using. Doing a find / -name "VBoxManager" as root reveals there is no such tool anywhere. Please, can someone let me know what to do to actually be able to do what the manual says with regard to the command line? Where does one get that tool?
I still would like to learn how one accesses a virtualbox installation with a remote screen. Here is what I tried;
as clients:
Apple Remote Desktop
Fails to find server
Apple VNC protocol from Finder
Fails to find server
VNCViewer (even though that is as unlikely to work for RDP as option 2)
Fails to find server
Microsoft Remotedesktop (that should work).
Fails to authenticate, after hitting the connect button one gets instantly the response that authentication failed, regardless of
means of authentication, such as NULL, External
Network interface (bridged, NAT)
IP address (the one the virtual machine obtains, localhost, my own host's ip address)
Port (tried different ports none of which were occupied)
Virtual OS (Windows 7, Windows XP, CentOS 6.3, ClearOS, backtrack 5)
Please, can someone help?

How to get hardware MAC address on Windows

I'm playing around with retrieving the MAC address from the NIC - there are a variety of ways to get it, this article covers the most common:
http://www.codeguru.com/Cpp/I-N/network/networkinformation/article.php/c5451
I'm currently using the GetAdaptersInfo method, which seems the most bulletproof, but if the MAC address has been set via the registry:
http://www.mydigitallife.info/2008/06/30/how-to-change-or-spoof-mac-address-in-windows-xp-vista-server-20032008-mac-os-x-unix-and-linux/
Then it reports the MAC address that it has been changed to. The only way I've found to actually get the true MAC is to remove the registry entry, restart the NIC, get the MAC via GetAdaptersInfo, then replace the registry entry, and restart the NIC. While it gets the job done, it's hardly transparent to the user.
Is there any other methods that anyone is familiar with, that will return the hardware MAC regardless of what the registry is set to? Ideally I'd like a solution that works on XP on up.
Thanks in advance!
My guess is that in the linked CodeGuru article, the Miniport solution is likely to overcome the problem you describe, albeit painful to implement. The reason I think this is that I have used the GetAdaptersInfo solution myself in the past, and noticed that the MAC address will change without reboot when an adapter is added, e.g. a Bluetooth adapter providing PAN services.
Perhaps rather than rebooting after changing the registry setting, you could try stopping and restarting the relevent network services. You could easily check this manually prior to looking for a programmatic solution.
(n.b. the above is all guess work. If you try it and it works, perhaps add a post for those trying to do the same in future).
Parse the output of ipconfig /all
You can use WMI to enumerate the Win32_NetworkAdapter instances and look at the MACAddress property. The main issue with this technique is finding the appropriate adapter instance if you have multiple active adapters installed, e.g. on a laptop which also has a wireless connection.

What is your favorite free Netstat GUI / Connection Monitor app for Windows? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I need something a little more feature rich than Sysinternals TCPView (which I regularly use) ... but it also must be freeware. :)
Well, the question is a bit old and I realize that probably you already found the software you were looking for... just in case, an interesting connection monitor utility is CurrPorts, by Nir Sofer.
Freely adapted from the program's home page:
displays the list of all currently opened TCP/IP and UDP ports on your local computer;
for each port in the list, information about the process that opened the port is also displayed, including the process name, full path of the process, version information of the process (product name, file description, and so on), the time that the process was created, and the user that created it;
allows you to close unwanted TCP connections, and kill the process that opened the ports;
allows custom filters for inclusion/exclusion of connections.
Maybe a full blown traffic sniffer like Wireshark will complement your tool set?
Amongst wiresharks features are:
packet analysis
traffic statistics
capture
coloring
data export
I recommend TCPView for Windows v2.53.
image http://i.technet.microsoft.com/bb897437.TcpView(en-us,MSDN.10).gif
TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints on your system, including the local and remote addresses and state of TCP connections. On Windows Server 2008, Vista, NT, 2000 and XP TCPView also reports the name of the process that owns the endpoint. TCPView provides a more informative and conveniently presented subset of the Netstat program that ships with Windows. The TCPView download includes Tcpvcon, a command-line version with the same functionality.
Not sure what features you are looking for so this is my suggestion.
Without having used it, I have seen TCPStat advertised a few times.
It looks like it was a discontinued project somewhere around 2003 and it's an awful blue color.
There's the MS Network Monitor.
Process Hacker shows also send/receive bytes, speed, country flag etc.