Maps a pattern into the specified zone.
Syntax
HRESULT SetZoneMapping(
DWORD dwZone,
LPCWSTR lpszPattern,
DWORD dwFlags
);
Parameters
- dwZone
-
[in] An unsigned long integer value that specifies the zone index. Can be one of the following values.
URLZONE_LOCAL_MACHINE- Pattern is mapped into the local machine zone.
URLZONE_INTRANET- Pattern is mapped into the intranet zone.
URLZONE_TRUSTED- Pattern is mapped into the trusted zone.
URLZONE_INTERNET- Pattern is mapped into the Internet zone.
URLZONE_UNTRUSTED- Pattern is mapped into the untrusted zone.
- URLZONE_USER_MIN...URLZONE_USER_MAX
- Pattern is mapped into a user defined zone.
- lpszPattern
-
[in]
A string value that contains the URL pattern with a limited number of wildcards.
The following table displays valid and invalid pattern values.
| Example Pattern | Validity |
|---|
*://*.example.com | Valid |
http://*.contoso.co.uk | Valid |
*://server.contoso.com | Valid |
ftp://192.168.0.0/ | Valid |
https://example/ | Valid |
file:\example\share | Valid |
*://172.16-31.0.0.* | Valid |
http://*.server.example.com | Invalid |
ftp://* | Invalid |
- dwFlags
-
[in] An unsigned long integer value that indicates whether the mappings should be added or deleted. This can be one of the SZM_FLAGS values.
Return Value
Returns one of the following values.
| S_OK | Success. |
| E_ACCESSDENIED | Attempted to enter a non-SSL site into a zone that requires server verification. |
| E_FAIL | The mapping already exists. |
Remarks
The method can also return the HRESULT derived from the Microsoft Win32 error code ERROR_FILE_EXISTS, which indicates that the URL already exists in another zone.
In Microsoft Windows Server 2003 and later, dwZone can specify a bitwise OR between one of the given values and URLZONE_ESC_FLAG to indicate that the pattern is mapped into an enhanced security configuration zone.
In Windows Server 2003 and later, applications that map domains to user-defined security zones in the range URLZONE_USER_MIN to URLZONE_USER_MAX might not function properly under the enhanced security configuration.