Monday, June 13, 2011

Wifi Network Backup Manager Utility

After couple of years I was too lazy to do it, each time I format my computer or want to copy Wifi networks between my machine to another I faced a problem, there is easy way to copy network profiles so I’ve created a simple utility that allows you to Save and Load Wifi Network Profiles, using Native Wifi API through P/Invoke interop.

[DllImport("wlanapi.dll")]
public static extern int WlanGetProfile(
[In] IntPtr clientHandle,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
[In, MarshalAs(UnmanagedType.LPWStr)] string profileName,
[In] IntPtr pReserved,
[Out] out IntPtr profileXml,
[Out, Optional] out WlanProfileFlags flags,
[Out, Optional] out WlanAccess grantedAccess);
[DllImport("wlanapi.dll")]
public static extern int WlanGetProfileList(
[In] IntPtr clientHandle,
[In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
[In] IntPtr pReserved,
[Out] out IntPtr profileList
);

Read more: Shai Raiten