Compartilhar via


PrivacySetZonePreferenceW

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function retrieves the privacy settings for a given URLZONE and PrivacyType.

Syntax

DWORD PrivacyGetZonePreferenceW(
  DWORD dwZone,
  DWORD dwType,
  DWORD dwTemplate,
  LPCWSTR pszPreference,
);

Parameters

  • dwZone
    [in] Value of type DWORD that specifies the URLZONE for which privacy settings are being retrieved.
  • dwType
    [in] Value of type DWORD that specifies the PrivacyType for which privacy settings are being retrieved. For more information about PrivacyTYpe flags to specify, see Privacy Flags.
  • dwTemplate
    [out] LPDWORD that returns a pointer to a DWORD containing which of the PrivacyTemplates is in use for this dwZone and dwType. For more information about PrivacyTemplates flags to specify, see Privacy Flags.
  • pszPreference
    [in] If dwTemplate is set to PRIVACY_TEMPLATE_CUSTOM, this parameter is the string representation of the custom preferences. Otherwise, it is ignored. A description of this string representation is included in the Remarks section.

Return Value

Returns zero if successful. Otherwise, one of the errors defined in winerr.h is returned.

Remarks

These privacy settings for the Internet zone are found on the Privacy tab of the Internet Options dialog box.

Setting the privacy options for the URLZONE_INTERNET involves setting the PrivacyTemplates for both PrivacyTypes. The slider on the Privacy Menu in Internet Options only moves if privacy is set for both PrivacyTypes.

Custom privacy preferences for a given URLZONE and PrivacyType can be set through the pszPreference parameter. This parameter can contain a series of rules, separated by white space, that describe the privacy preferences. It is important to note that the rules themselves cannot contain white space. pszPreference has the following structure where there can be multiple logical rules.

<signature> <logical-rule> <special-rule>

Currently, the signature must be set to IE6-P3PSettings/V1:.

Logical rules have the following format.

/<expression>=<decision>/

An expression is a Boolean statement composed of compact policy tokens that use the operators & (logical AND) and ! (logical NOT). The compact policy token is case-sensitive. For more information about Platform for Privacy Preferences (P3P) privacy policies and compact policy tokens, see the Platform for Privacy Preferences (P3P) Project specification at this official W3C Web site.

For more information, see Privacy Templates.

Logical rules are evaluated in the order they are listed. The first logical-rule to be matched, if any, determines the cookie action.

An empty expression is also allowed. If an expression is empty, the left-hand side evaluates to true. This form of a logical-rule can be used at the end of a set of rules to catch all situations that did not fall into the other categories.

The following example code shows the valid logical rules.

/DEM=d/
    Deny a cookie whose compact policy contains the DEM token
/CON&!TEL=a/   
    Accept a cookie whose compact policy contains the CON token 
    and does not contain the TEL token
/=a/      
    Accept all cookies

The following example shows a privacy preferences string that specifies accepting cookies for which the compact policy contains a FIN/CONi token pair, reject cookies with compact policies containing FIN/CON, FIN/CONo, FIN/CONa and GOV/PUB token pairs or a TEL token, and to prompt the user when a cookie's compact policy contains the UNR token. It also specifies to downgrade cookies without a compact policy to session cookies and to accept all cookies that do not match one of the given rules. Note that the first rule that evaluates to true determines the cookie action.

IE6-P3PSettings/V1: /FIN&CONi=a/ /FIN&CONo=r/ /FIN&CONa=r/ /FIN&CON=r/ 
/GOV&PUB=r/ /TEL=r/ /UNR=p/ nopolicy=d /=a/

Requirements

Header wininet.h
Library wininet.lib
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

WinInet Functions

Concepts

Platform for Privacy Preferences (P3P)