Now my team working in a network project using windows application c#. I didn’t know how to programmatically detect Cipher type and Encryption level from a wireless network device from windows 2003 server.
After searching i got WMI (Windows Management Instrumentation) for solving the problem.+
Please suggest example/reference for finding Cipher type and Encryption level from a wireless network device from windows 2003 server
just found you question. The information which you search for originate from NDIS driver. WMI only gives you a subset of such information. Every NDIS driver support some standard requests which can be send with respect of
DeviceIoControlfunction (see http://msdn.microsoft.com/en-us/library/aa363216%28v=VS.85%29.aspx). As an input (lpInBuffer parameter) you should give a DWORD with an OID code, a control code which identify the request, As an output you receive a structure with information filed, or in your case a DWORD (enum value). For example, if you asked NDIS driver for(as DWORD value of lpInBuffer parameter) it returns back also DWORD with information like
request for
returns
request for
returns
and so on. You can find all different constants which you needs in
ntddndis.hafter installing of Windows DDK.To open a device handle you should use
CreateFilefunction. Instead of file name you should give a string with the prefix"\\.\"and adapter name (adapter guids). Adapter names you can enumerate with different way. One of the easiest is the subkey names of the registry keyHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Adapters.All what I explained above work exactly like http://msdn.microsoft.com/en-us/library/aa964902%28v=VS.85%29.aspx or other examples of usage
DeviceIoControl. The full list of IoControl requests which must support some device class is described in DDK. I repeat one more time, that for usage of that one need only useDeviceIoControland not write a device driver.More as 10 years ago I play a little with such requests which I described here. I tested my old program works without any problems now. One need only use OIDs which you need and not much more.
UPDATED: I found a good link http://pages.infinit.net/codeguru/WiFiArticle.htm which explains in other words the same what I just written. It seems to me that one use here wrong parameters in
CreateFile. One have to useFILE_SHARE_READ | FILE_SHARE_WRITEto makes all working. Example http://code.google.com/p/haggle/source/browse/winmobile/Haggle/WindowsWiFiUtils.cpp (seebool WindowsWiFiUtils:init(),bool WindowsWiFiUtils::setEncryptionMode(unsigned long adapterIndex, const unsigned int mode)etc) looks like much better and contain a lot of methods which can be also interesting for you. It is a C++ example, but it’s very easy to rewrite this in C#.UPDATED 2: One more way is usage of “Native Wifi API” http://msdn.microsoft.com/en-us/library/ms706556%28VS.85%29.aspx like WlanQueryInterface (for example with wlan_intf_opcode_supported_infrastructure_auth_cipher_pairs) or WZCQueryInterface, but it seems not supported on Windows Server 2003, what you need. Generally “Native Wifi API” is probably more reliable way to give maximum information (or modify it), but WMI can be also a good pragmatical alternative.