How to get my own IP address using WinINet functions - winapi

How can I get my own IP address using WinINet APIs?
If it's not possible using WinINet APIs, counld you please suggest which Win32 library I have to use for this purpose?
I need the library which I can use in my C++ code. I don't need a C# or .NET library.
Actually I have to use it in my Qt application.

You shoud use QList<QHostAddress> QNetworkInterface::allAddresses () [static]

Do you mean the public IP address or your interfaces' IP address? The public IP address can be extracted from the page whatismyip.com. The other answer gives you the local IP addresses.

Related

ESP32: When to use nvs_flash_init?

When I use esp-idf. All the examples that use the WiFi library call the nvs_flash_init function. Why? Is this necessary because the WiFi library uses encrypted data?
Thanks for your help!
The Wifi library uses NVS flash to store access point name and password

How to identify proxy protocol from IP and Port?

Say I have a list of proxies - I pull out of one of these proxies. It's nothing but ip and port. From a programming level, you need to know the protocol to use such as socks5, socks5h, http, https... etc etc. Is there a way to retrieve what kind of protocol a proxy uses from the information given?
If you are using Node.js you can try check-proxy library, though it does much more than just checking protocol.
Your proxy server identify the port number for example 6080,9180,etc so you can easily identify the proxy server.
Your id address also private or public you can use 'proxy server ip address' that automatically create a virtual proxy network.
Example: Your private ip address is 172.16.10.158 you can use proxy server, your ip address will be 136.56.89.210. You can use public ip ex 125.124.85.69 change in to 179.68.36.49.

Proxifying an app without hooking connect() or changing hardoded IP

I've been just wondering if there's any method to proxify an app without hooking the connect() function after injecting my dll or changing the hardcoded ip address to which it connects itself.
I need it to connect to changed IP address, and since it doesn't use hostname but an IP address I can't use hosts file to do so.
I need it for a bit more than just sniffing, so using anything like WinPcap isn't an option.
If anybody could point me to something useful, I'd be very grateful. The programming language doesn't really matter to me, but as a note - I'm mostly coding in Delphi.
Thanks in advance, and cheers! :)
Edit:
I'm not looking for any third-party apps, just a method that I could implement in my own app.

Is there another way to match the MAC and IP Addresses in VB.NET 2008 besides using WMI?

I would like to match multiple network card MAC's with the corresponding IP Addresses to be displayed. Is there a better (or just another) way to enumerate them besides using System.Management or out-and-out WMI?
You could P/Invoke GetAdaptersAddresses in the IP Helper API. This returns you a list of IP_ADAPTER_ADDRESSES structures that include the IP Addresses and MAC info (in PhysicalAddress) for each adapter.
Non-trivial marshalling - fortunately PInvoke.Net has it down.

Determine whether or not a TCP/IP port is already in use under Windows?

The cross platform dev environment I use has a built in function that is supposed to indicate whether or not a tcp port is available. However, the function malfunctions under Vista and always returns "available".
Is there an easy way, such as a dll function, I can use to correctly determine this information without needing .Net?
You can attempt to bind to and listen on the port using the usual Winsock functions. If something else is already listening on the same port, you will get an error (WSAEADDRINUSE from bind()).
To avoid bringing in added dependencies or windows-specific code you could simply try to use the port and catch any problems (such as interception by firewall software).
Simply use Win32 Nw apis to enumerate TCP ports.

Resources