Default VPN entry settings in Vista

Jun 3, 2009 at 12:34 AM

Hi there,

When I use the CreateVpnEntry helper function in XP, the Typical security option setting is selected for the entry created. But it doesn't seem to be the case when I run this in Vista. Is there a reason for the discrepancy, or am I missing something?

I tried setting options manually to this setting after the entry is created, but it seems that UseypicalSettings is not available. 




Jun 3, 2009 at 5:29 AM

The UseTypicalSettings flag is on the ExtendedOptions property of RasEntry, and only accessible with the WIN2K8 or later build. More than likely that particular setting was stored differently in previous versions of Windows and isn't automatically set anymore since there is now a flag specific to turning it on, versus assuming it should be turned on. I've changed the helper method to ensure this option is passed to the operating system if you want to get latest.

Keep in mind the WIN2K8 build will not function correctly on the Windows XP operating system.

It wasn't being set because when I looked at the values, it wasn't being returned. Apparently once that flag is passed into the API, it's removed from use.

Just grab latest and you should be fine.

Jun 3, 2009 at 3:37 PM

Thanks for the quick reply! I will grab the latest and test again today.

Jun 3, 2009 at 7:22 PM

I grabbed the latest and didn't quite do the trick. When I check under security tab of the created vpn entry, the Advanced (custom settings) is still selected, as opposed to Typical(recommended settings).  However, I do see that the Dialing options under the Options tab are now checked, which before weren't and were fine by me =) Sorry if I wasn't clear on what "Typical" settings I was talking about. 

Thanks again!


Jun 3, 2009 at 9:26 PM

Did you remember to compile the project with the WIN2K8 symbol?

Jun 4, 2009 at 4:26 PM

Oops. I didn't. I tried compiling with that symbol and I get an error. CA1400 Microsoft.Interoperability: Correct the declaration of 'SafenativeMethods.RasGetNapStatus(RasHandle, Intptr) so that it correctly points to an existing entry point in 'rasapi32.dll'. The unmanaged entry point name currently linked is RasGetNapStatus.  Line 196 of SafeNativeMethods.cs.

I'm using Visual Studio 2008 and I am not the most savvy when it comes to .NET/C# so I might be missing something here.

Jun 4, 2009 at 5:41 PM

Were you compiling it on a Windows Vista machine?

If you're building for WIN2K8 it needs to be compiled on a Vista machine or you'll see that since the entry point doesn't exist on a Windows XP machine. You can disable code analysis in the project from the project properties under the code analysis tab to bypass that security check. There's nothing wrong with the project though, it's just making sure all the entry points exist for you, which it will once you're on a Vista machine.

Jun 4, 2009 at 6:44 PM

Thanks for the help. I did get it to compile and it now works on Vista.

I guess my question is, is there anyway to have a build that works cross-platform? I was hoping for a solution that will work in both XP and Vista. Right now, I am merely referencing the dotras.dll in my project and using functions that way. But that does not work if I have to reference a diff .dll build depending on the test system. I am so new to the this whole C# development arena, so I appreaciate your patience in guiding me through all this. =)


Jun 4, 2009 at 8:47 PM

The assembly is cross platform compatible, the problem is that with different versions of Windows you have different features available. You're trying to use features that are Vista only and have the application backwards compatible to work on XP. If you need your software to support features on multiple operating systems the only thing I can suggest is you release a Windows XP version and a Windows Vista version of your software. Add the DotRas project to your solution and reference it from your project. You will need to provide the compiler with the proper symbols for the operating systems you want when compiling. Those symbols are defined on the home page of this site, WIN2K (or no symbol at all), WINXP, WINXPSP2, and WIN2K8.