How to avoid Network Location selection popup for Dial-up connection in Vista

H

hq4000

I have a 32-bit C++ application built with Visual Studio 2005 in XP.
The application creates a dial-up connection entry into rasphone.pbk
successfully in 32-bit and 64-bit Vista. And the dial-up connection
works as expected. However, at the first run of the dial-up
connection, after the connection has been made, Vista pop-ups a
Network Location selection window asking to choose:

1. Home
2. Business
3. Public Location (the default)

After the selection, the corresponding setting would show up in
Network Connections as Network Category: private network (Home or
Business) or public network (Public Location).

It seems like my goal is to programmatically set the 'Network
Category' to prevent the network location selection popup during first
run. I am trying to manipulate the RASENTRY passed into the method
RasSetEntryProperties() and using INI setting to change some entries,
but no sure which parameters to change. Any help is appreciated.
Below is the initial rasphone.pbk before the first run.

[My DialUp Test (COM1)]
Encoding=1
Type=0
AutoLogon=0
UseRasCredentials=1
LowDateTime=1308709520
HighDateTime=29893380
DialParamsUID=3226093
Guid=B8BB572945C94743BE4E66C8A5233792
BaseProtocol=1
VpnStrategy=0
ExcludedProtocols=10
LcpExtensions=0
DataEncryption=8
SwCompression=0
NegotiateMultilinkAlways=0
SkipNwcWarning=0
SkipDownLevelDialog=0
SkipDoubleDialDialog=0
DialMode=0
OverridePref=15
RedialAttempts=0
RedialSeconds=0
IdleDisconnectSeconds=0
RedialOnLinkFailure=0
CallbackMode=0
CustomDialDll=
CustomDialFunc=
CustomRasDialDll=
ForceSecureCompartment=0
DisableIKENameEkuCheck=0
AuthenticateServer=0
ShareMsFilePrint=0
BindMsNetClient=0
SharedPhoneNumbers=1
GlobalDeviceSettings=0
PrerequisiteEntry=
PrerequisitePbk=
PreferredPort=COM1
PreferredDevice=My Test Modem
PreferredBps=0
PreferredHwFlow=0
PreferredProtocol=0
PreferredCompression=0
PreferredSpeaker=0
PreferredMdmProtocol=0
PreviewUserPw=0
PreviewDomain=0
PreviewPhoneNumber=0
ShowDialingProgress=0
ShowMonitorIconInTaskBar=1
CustomAuthKey=-1
AuthRestrictions=808
TypicalAuth=1
IpPrioritizeRemote=0
IpInterfaceMetric=0
fCachedDnsSuffix=0
IpHeaderCompression=0
IpAddress=0.0.0.0
IpDnsAddress=0.0.0.0
IpDns2Address=0.0.0.0
IpWinsAddress=0.0.0.0
IpWins2Address=0.0.0.0
IpAssign=1
IpNameAssign=1
IpDnsFlags=0
IpNBTFlags=1
TcpWindowSize=0
UseFlags=0
IpSecFlags=0
IpDnsSuffix=
IpCachedDnsSuffix=
Ipv6PrioritizeRemote=0
Ipv6InterfaceMetric=0
Ipv6NameAssign=1
Ipv6DnsAddress=::
Ipv6Dns2Address=::
Ipv6InterfaceId=0000000000000000

NETCOMPONENTS=
ms_msclient=0
ms_server=0

MEDIA=serial
Port=COM1
Device=My Test Modem
ConnectBPS=115200

DEVICE=modem
PhoneNumber=123
AreaCode=
CountryCode=0
CountryID=0
UseDialingRules=0
Comment=
LastSelectedPhone=0
PromoteAlternates=0
TryNextAlternateOnFail=1
HwFlowControl=0
Protocol=0
Compression=0
Speaker=1
MdmProtocol=0
 
J

Jeffrey Randow

Have you looked at this?
http://scriptcode.co.uk/set_vista_network_location_category.htm

---
Jeffrey Randow
(e-mail address removed)
Windows Networking MVP 2001-2006
http://www.networkblog.net

I have a 32-bit C++ application built with Visual Studio 2005 in XP.
The application creates a dial-up connection entry into rasphone.pbk
successfully in 32-bit and 64-bit Vista. And the dial-up connection
works as expected. However, at the first run of the dial-up
connection, after the connection has been made, Vista pop-ups a
Network Location selection window asking to choose:

1. Home
2. Business
3. Public Location (the default)

After the selection, the corresponding setting would show up in
Network Connections as Network Category: private network (Home or
Business) or public network (Public Location).

It seems like my goal is to programmatically set the 'Network
Category' to prevent the network location selection popup during first
run. I am trying to manipulate the RASENTRY passed into the method
RasSetEntryProperties() and using INI setting to change some entries,
but no sure which parameters to change. Any help is appreciated.
Below is the initial rasphone.pbk before the first run.

[My DialUp Test (COM1)]
Encoding=1
Type=0
AutoLogon=0
UseRasCredentials=1
LowDateTime=1308709520
HighDateTime=29893380
DialParamsUID=3226093
Guid=B8BB572945C94743BE4E66C8A5233792
BaseProtocol=1
VpnStrategy=0
ExcludedProtocols=10
LcpExtensions=0
DataEncryption=8
SwCompression=0
NegotiateMultilinkAlways=0
SkipNwcWarning=0
SkipDownLevelDialog=0
SkipDoubleDialDialog=0
DialMode=0
OverridePref=15
RedialAttempts=0
RedialSeconds=0
IdleDisconnectSeconds=0
RedialOnLinkFailure=0
CallbackMode=0
CustomDialDll=
CustomDialFunc=
CustomRasDialDll=
ForceSecureCompartment=0
DisableIKENameEkuCheck=0
AuthenticateServer=0
ShareMsFilePrint=0
BindMsNetClient=0
SharedPhoneNumbers=1
GlobalDeviceSettings=0
PrerequisiteEntry=
PrerequisitePbk=
PreferredPort=COM1
PreferredDevice=My Test Modem
PreferredBps=0
PreferredHwFlow=0
PreferredProtocol=0
PreferredCompression=0
PreferredSpeaker=0
PreferredMdmProtocol=0
PreviewUserPw=0
PreviewDomain=0
PreviewPhoneNumber=0
ShowDialingProgress=0
ShowMonitorIconInTaskBar=1
CustomAuthKey=-1
AuthRestrictions=808
TypicalAuth=1
IpPrioritizeRemote=0
IpInterfaceMetric=0
fCachedDnsSuffix=0
IpHeaderCompression=0
IpAddress=0.0.0.0
IpDnsAddress=0.0.0.0
IpDns2Address=0.0.0.0
IpWinsAddress=0.0.0.0
IpWins2Address=0.0.0.0
IpAssign=1
IpNameAssign=1
IpDnsFlags=0
IpNBTFlags=1
TcpWindowSize=0
UseFlags=0
IpSecFlags=0
IpDnsSuffix=
IpCachedDnsSuffix=
Ipv6PrioritizeRemote=0
Ipv6InterfaceMetric=0
Ipv6NameAssign=1
Ipv6DnsAddress=::
Ipv6Dns2Address=::
Ipv6InterfaceId=0000000000000000

NETCOMPONENTS=
ms_msclient=0
ms_server=0

MEDIA=serial
Port=COM1
Device=My Test Modem
ConnectBPS=115200

DEVICE=modem
PhoneNumber=123
AreaCode=
CountryCode=0
CountryID=0
UseDialingRules=0
Comment=
LastSelectedPhone=0
PromoteAlternates=0
TryNextAlternateOnFail=1
HwFlowControl=0
Protocol=0
Compression=0
Speaker=1
MdmProtocol=0
 
J

Jeffrey Randow

Hit send too fast there..

It should be fairly trivial to add the functionality of that script to
your application...

---
Jeffrey Randow
(e-mail address removed)
Windows Networking MVP 2001-2006
http://www.networkblog.net

I have a 32-bit C++ application built with Visual Studio 2005 in XP.
The application creates a dial-up connection entry into rasphone.pbk
successfully in 32-bit and 64-bit Vista. And the dial-up connection
works as expected. However, at the first run of the dial-up
connection, after the connection has been made, Vista pop-ups a
Network Location selection window asking to choose:

1. Home
2. Business
3. Public Location (the default)

After the selection, the corresponding setting would show up in
Network Connections as Network Category: private network (Home or
Business) or public network (Public Location).

It seems like my goal is to programmatically set the 'Network
Category' to prevent the network location selection popup during first
run. I am trying to manipulate the RASENTRY passed into the method
RasSetEntryProperties() and using INI setting to change some entries,
but no sure which parameters to change. Any help is appreciated.
Below is the initial rasphone.pbk before the first run.

[My DialUp Test (COM1)]
Encoding=1
Type=0
AutoLogon=0
UseRasCredentials=1
LowDateTime=1308709520
HighDateTime=29893380
DialParamsUID=3226093
Guid=B8BB572945C94743BE4E66C8A5233792
BaseProtocol=1
VpnStrategy=0
ExcludedProtocols=10
LcpExtensions=0
DataEncryption=8
SwCompression=0
NegotiateMultilinkAlways=0
SkipNwcWarning=0
SkipDownLevelDialog=0
SkipDoubleDialDialog=0
DialMode=0
OverridePref=15
RedialAttempts=0
RedialSeconds=0
IdleDisconnectSeconds=0
RedialOnLinkFailure=0
CallbackMode=0
CustomDialDll=
CustomDialFunc=
CustomRasDialDll=
ForceSecureCompartment=0
DisableIKENameEkuCheck=0
AuthenticateServer=0
ShareMsFilePrint=0
BindMsNetClient=0
SharedPhoneNumbers=1
GlobalDeviceSettings=0
PrerequisiteEntry=
PrerequisitePbk=
PreferredPort=COM1
PreferredDevice=My Test Modem
PreferredBps=0
PreferredHwFlow=0
PreferredProtocol=0
PreferredCompression=0
PreferredSpeaker=0
PreferredMdmProtocol=0
PreviewUserPw=0
PreviewDomain=0
PreviewPhoneNumber=0
ShowDialingProgress=0
ShowMonitorIconInTaskBar=1
CustomAuthKey=-1
AuthRestrictions=808
TypicalAuth=1
IpPrioritizeRemote=0
IpInterfaceMetric=0
fCachedDnsSuffix=0
IpHeaderCompression=0
IpAddress=0.0.0.0
IpDnsAddress=0.0.0.0
IpDns2Address=0.0.0.0
IpWinsAddress=0.0.0.0
IpWins2Address=0.0.0.0
IpAssign=1
IpNameAssign=1
IpDnsFlags=0
IpNBTFlags=1
TcpWindowSize=0
UseFlags=0
IpSecFlags=0
IpDnsSuffix=
IpCachedDnsSuffix=
Ipv6PrioritizeRemote=0
Ipv6InterfaceMetric=0
Ipv6NameAssign=1
Ipv6DnsAddress=::
Ipv6Dns2Address=::
Ipv6InterfaceId=0000000000000000

NETCOMPONENTS=
ms_msclient=0
ms_server=0

MEDIA=serial
Port=COM1
Device=My Test Modem
ConnectBPS=115200

DEVICE=modem
PhoneNumber=123
AreaCode=
CountryCode=0
CountryID=0
UseDialingRules=0
Comment=
LastSelectedPhone=0
PromoteAlternates=0
TryNextAlternateOnFail=1
HwFlowControl=0
Protocol=0
Compression=0
Speaker=1
MdmProtocol=0
 
H

hq4000

I verified from registry key. After initial installation by my
application, the registry entry doesn't have profile for my dial-up
connection yet. The registry entry is created during first run. In
order to set the network category using the script above, I need to
have the registry entry for the dial connection during initial
installation. What to follow?
 
J

Jeffrey Randow

Why not run the dial-up connection and then cancel it? This should
set the profile for it...
 

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