How to Disable Wireless Network Connection Notification Balloon? - c++

I want to programmatically disable the notification I get when I connect to a wireless network. I know there is a way to disable ALL notifications (see here) but is there a way to only disable the one issued by Windows wireless Manager (i.e. wlanapi.dll).
Many thanks!

I don't think this is possible, except in Windows 7 when it's available. (It apparently includes a much more configurable tray-program manager).

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
New \ DWORD
EnableBalloonTips
Hexadecimal
0

Related

How to re-enable a disabled network connection in Windows XP using C++?

I found this article at SO that tells how to enable/disable a network adpter using the SetupAPI. This works fine so far. The problem is that I could not find a way to get the device index for network connections (adapters) that have been disabled in Windows XP.
I have:
The list of GUIDs (from HKLM\SOFTWARE\Microsoft\Windows NT\Netcards)
Everything from Win32_NetworkAadapter that is supported in Windows XP
I tried without success:
GetIfTable() - disabled adapters are not present in the table
Win32_NetworkAdapter::InterfaceIndex is not supported in XP
Win32_NetworkAdapter::Enable()/Disable() is not supported in XP
What else can I do to obtain the device index or to get a disabled network adapter re-eabled again?
Based on my experience building my Network Connection Guard tool the easiest way to do this is with the netsh command, not APIs. My example is C# so I used System.Diagnostics.Process but in your case I believe you could use ShellExecute().
Also see this answer on SO Programmatically disable/enable network interface

Trigger an exe once My device is connected via USB

Once my embedded device is connected to USB port of my PC, it should trigger an exe as an event. How can I achieve this??
Should I create a service to keep monitoring the USB connector bus or is there any default API's available in Windows to achieve this??
thanks.
A simple exe which is started on connect is not possible. But you can write a service or user mode application which listens for device arrival events. WM_DEVICECHANGE is sent to all (registered) applications with a device interface guid which represents which device is plugged in. You can then use this id with the setupapi to see if its your device.
On receiving that event, you can then start your executable.
Depending on your version of Windows it might be possible with a workaround using a AutoRun.inf file in the root folder of a USB drive. For security reasons this is by default turned off, and in Windows 7 not allowed at all.
To achieve the same effect in a more robust way, you need to create a service that monitors whether your device is connected or not (e.g. iTunesHelper that monitors for connected Apple devices).
The easiest solution is probably a trivial UMDF driver. That's basically a small COM component called when your device is connected.

Special routing for application via WinSocks or any another API?

I want to route packets sended from my application to another gateway but i don't know what options i must change via setsockopt.
I can't just add entries to routing table for specific hosts because second application also must connect to these hosts but via default gateway. Gateways have different public IPs.
I found topic about set "source routing" options via IP_OPTIONS socket option (though without format), but as i understand this option only for routers not for my network adapter.
Also i cannot add second adapter and connect it to same LAN.
Any suggestions how i can send packets on per application basis? May be routing API
P.S.: Windows versions are 32-bit XP SP3, 32- and 64 bit Windows 7 and one 64-bit Windows Server 2008 R2.
Short answer : this is really hard, are you sure you want to do it ? It is not possible directly via set sock opt. Most probably there are easier choices by adding routes manually with the command line utility "route". That will the best choice if your final destination is a known IP or network and that normal traffic can be routed through the other gateway as well.
Longer answer : if you are a code ninja, you have the following two options, good luck, I have no idea whether that will work in practice:
use raw sockets and IP_HDRINCL to do source routing by hand (ie add an option in the IP header with the address of your proxy). See here for an intro.
you may be able to code a Winsock LSP (introduction here) that you can use to intercept some packets and re route them.

Disabling Bluetooth support in Windows XP-7

I'm trying to write a program to disable the Bluetooth service on computers (so, forbid users from connecting to Internet via Bluetooth)
I've tried following methods:
Disable the "bthserv" service (Bluetooth Support Service). It works on Windows Vista and 7, but there is no such service in Windows XP (I haven't tested, but I think it only works with Microsoft Bluetooth Stack)
Use Devcon.exe tool; it shows Bluetooth devices, but cannot disable them (I'm Administrator)
I can list the devices via WMI, but how can I disable them? (I wanted to disable with netsh.exe, but it errors with "An interface with this name is not registered with the router." although the connection exists.
Any ideas ?
The API you're looking for is called the "Setup API". I seriously doubt that it's what you want, BTW. What is so special about Bluetooth networking that sets it apart from Wifi networking? Why don't you just ban adding any new network adaptor ?

How do you block selected applications from accessing the internet (C++, Win32)

I want to have an application or service that is running that, on some schedule, can disable access to the internet for all applications except for specific ones.
I'm trying to create a filter that can be turned on or off under programmatic control. Not just IP addresses and ports, but I want to be able to block specific applications as well, much like Zone Alarm and other software firewalls let you block.
For example, iexplore.exe, skype.exe, firefox.exe, aim.exe. But still need to allow other applications to connect as needed.
It has to work on Vista as well as XP, but I kind of expect that the method will be different on each of those platforms.
Basically, the filter has to tie the network communication back to the executable that is making the request and then allow or deny it.
Update:
On Vista at least, it looks like I want to use filters in the ALE layers of the WFP.
On XP, I'm still looking for the best way to do it. Do I really need to be writing device drivers and dealing with kernel stuff? I'm just a lowly application developer. Kill me now.
Update 2:
Currently looking at the PfCreateInterface and related Pf* API's for pre-Vista systems.
You can change both Vista and XP's firewall policies dynamically using the INetFwAuthorizedApplications interface from the Windows Firewall API.
Also see this question.
You'll have to write a device driver that filters traffic based on the executable requesting the traffic.
by limiting its access to internet using firewall. go to firewall setting advanced tab (win 7)
and do that
I'm not sure, but I think you'd need to do it by getting the program to run as a user that has limited permissions, the question is, can you make a user account that stops such things?
You'll need to redirect all (or at least many) calls to the WinSock API functions of any running program to your own replacement functions. That means getting into the memory of each running program and hijacking those functions, which is an... interesting... exercise. :-)
That might be enough of a pointer to get you started, or at least to suggest some more specific questions to ask.
Could you move aside (ie rename) the system's winsock DLL and replace it with your own ?
Yours should provide the same API, but check the the process name of incoming requests... return an error code to blocked applications and forward the calls from allowed apps onto the real DLL.