前不久,xp下的软件移植到win7下出现了一些问题。在网络上找了好久找到微软的几个命令。在win7下微软提供了netsh wlan命令。在该命令下,我们可以inport profile,也可以编辑,修改,增加profile。当然,我的项目里用的就是给网卡SetProfile。然而在xp下的Profile貌似在win7下出现了问题,于是,我就决定用netsh wlan export profile来尝试着输出profile。结果把自己写的profile与系统提供的profile相对比,发现在profile的KeyMaterial字段出现了问题。理所当然,我想利用API获得该Keymaterial 字段,可惜查了好久都没有找到这样的API,最后终于在微软的网站上发现了答案:
You can call WlanSetProfile on a profile that contains a plaintext key (that is, a profile with the protected element present and set to FALSE). Before the profile is saved in the profile store, the key material is automatically encrypted.
译文大意是:我们可以使用SetProfile设置一个包含Key字段的Profile。(该字段使用的protected字段是false属性)。在该Profile保存在系统的Profile存储区内之前,该keyMaterial将自动进行加密。
说到这,我就可以得到该KeyMaterial啦。再次使用WlanGetProfile啦。
谢谢查看本文的观众。
2011-04-17---23:32:05