RASDIALPARAMS

C

Catalin Lungu

Hi guys,

I'm use the following function to dial a RAS connection and always shows me
a autentication window "Enter network password" where username textbox and
password texbox are fills with the parameters of function. How can I prevent
that this windows not show?

unsafe public static uint myRasDial(string EntryName, string UserName,
string Password, out IntPtr RasConn)
{
uint r = 0;
RasConn = IntPtr.Zero;
byte[] bRASDIALPARAMS = new byte[1464];
fixed (byte* pAddr = bRASDIALPARAMS)
{
byte* pCurrent = pAddr;
Marshal.WriteInt32((IntPtr)pCurrent, bRASDIALPARAMS.Length);
pCurrent += 4;
foreach (byte b in Encoding.Unicode.GetBytes(EntryName))
{
Marshal.WriteByte((IntPtr)pCurrent, b);
pCurrent++;
}
pCurrent = pAddr + 0x192; //0x192 - offset for RASDIALPARAMS.UserName
foreach (byte b in Encoding.Unicode.GetBytes(UserName))
{
Marshal.WriteByte((IntPtr)pCurrent, b);
pCurrent++;
}
pCurrent = pAddr + 0x394; //0x394 - offset for RASDIALPARAMS.Password
foreach (byte b in Encoding.Unicode.GetBytes(Password))
{
Marshal.WriteByte((IntPtr)pCurrent, b);
pCurrent++;
}
r = RasDial(IntPtr.Zero, IntPtr.Zero, (IntPtr)pAddr, 0, IntPtr.Zero, ref
RasConn);
}
return r;
}

Thank you,
Catalin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top