I posted this in microsoft.public.windows.networking.wireless, but
didn't get any responses. There are a lot more people here, so I'll
try again.
I'm trying to write a small C# app that will take an XML WPS schema
and adds it to any/all wireless interfaces on the system. I'm doing
this by looping through NetworkInterface.GetAllNetworkInterfaces(),
and plugging each guid in turn into a CreateProfile() call. Using the
example WPA schema, I'm getting a status code 33 along with a 'could
not be found . (Exception from HRESULT: 0x80030002
(STG_E_FILENOTFOUND))' exception, and I don't really have any idea
what's causing it.
Any input would be appreciated it. The relevent portion of code is
below.
public uint ImportProfile( string fileName ) {
StreamReader xmlFile = File.OpenText( fileName );
string xml;
uint status = 0;
xml = xmlFile.ReadToEnd( );
IProvisioningProfileWireless ippw = new
NetProvisioningClass( );
foreach ( NetworkInterface netInt in
NetworkInterface.GetAllNetworkInterfaces( ) ) {
System.Guid guid = new Guid( netInt.Id );
try {
ippw.CreateProfile( xml.ToString( ), null, ref
guid, out status );
} catch ( Exception x ) {
throw (new Exception( "Error Code " +
status.ToString( ) + "\n" + x.Message, x ));
}
}
return status;
}