I'm using Windows Native Wifi. Basically after knowing what type of authentication and encryption the Wifi hotspot have, I ask the user for the passphrase, then call WlanSetProfile()
to create/save a profile (with the passphrase included), and then call WlanConnect()
to connect using this profile.
This procedure works in connecting to the internet as long as the passphrase is correct. If the passphrase is very short (and obviously not the correct one), I can detect it since the WlanSetProfile()
will return an appropriate error code. However, when the passphrase is just wrong (meaning it is a valid string), the profile is still created, but the Wifi connection is just limited access since I can no longer connect to the internet using this profile.
The problem is, I have no idea how to determine if the passphrase is wrong in the first place. Is there an API or a procedure that I can use to validate if the passphrase is correct or not?