RasSetEntryProperties (rasapi32)
Last changed: colmde@hotmail.com-178.250.116.242

.
Summary
The RasSetEntryProperties function changes the connection information for an entry in the phone book or creates a new phone-book entry.

C# Signature:

/// <summary>
/// Changes the connection information for an entry in the phone book or creates a new phone-book entry.
/// </summary>
/// <param name="lpszPhonebook">Pointer to a null-terminated string that specifies the full path and file name of a phone-book (PBK) file.
/// If this parameter is NULL, the function uses the current default phone-book file.</param>
/// <param name="lpszEntry">Pointer to a null-terminated string that specifies an entry name.
/// If the entry name matches an existing entry, RasSetEntryProperties modifies the properties of that entry.
/// If the entry name does not match an existing entry, RasSetEntryProperties creates a new phone-book entry.</param>
/// <param name="lpRasEntry">Pointer to the RASENTRY structure that specifies the connection data to associate with the phone-book entry.</param>
/// <param name="dwEntryInfoSize">Specifies the size, in bytes, of the buffer identified by the lpRasEntry parameter.</param>
/// <param name="lpbDeviceInfo">This parameter is unused. The calling function should set this parameter to NULL.</param>
/// <param name="dwDeviceInfoSize">This parameter is unused. The calling function should set this parameter to zero.</param>
/// <returns></returns>
[DllImport("rasapi32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern Uint RasSetEntryProperties(
   string lpszPhonebook,
   string lpszEntry,
   ref RASENTRY lpRasEntry,
   int dwEntryInfoSize,
   IntPtr lpbDeviceInfo,
   int dwDeviceInfoSize);

VB Signature:

Declare Function RasSetEntryProperties Lib "rasapi32.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

http://www.codeplex.com/DotRas

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

/// <summary>
/// Create or modify network connection.
/// </summary>
/// <param name="connectionName">Name of the network connection to create or modify.</param>
/// <param name="rasEntryStructure">RASENTRY structure containing connection settings.</param>
/// <returns>Enumerated RASERROR</returns>
public static RasError SetEntryProperties(string connectionName, RASENTRY rasEntryStructure)
{
     return (RasError)RasSetEntryProperties(null, connectionName, ref rasEntryStructure, Marshal.SizeOf(rasEntryStructure), IntPtr.Zero, 0);
}

Documentation