次の方法で共有


CreateUriFromMultiByteString function

Converts an ANSI URL with components in various multibyte character set (MBCS) encodings to an IUri object.

Syntax

HRESULT CreateUriFromMultiByteString(
  _In_       LPCSTR    pszANSIInputUri,
  _In_       DWORD     dwEncodingFlags = Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8,
  _In_       DWORD     dwCodePage,
  _In_       DWORD     dwCreateFlags,
  _Reserved_ DWORD_PTR dwReserved,
  _Out_      IUri      **ppURI
);

Parameters

pszANSIInputUri [in]

A constant pointer to an ANSI character string that specifies the URI.

dwEncodingFlags [in]

A valid combination of the following flags, which allows the caller to specify the encoding of all applicable components, except the scheme and the port.

Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8 (0x00000001)

Default. The user info component and path component use percent encoded UTF-8.

Uri_ENCODING_USER_INFO_AND_PATH_IS_CP (0x00000002)

The user info component and path component use the codepage specified in dwCodePage.

Uri_ENCODING_HOST_IS_IDN (0x00000004)

Default. The host component uses IDN (Punycode) format.

Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 (0x00000008)

The host component uses percent encoded UTF-8.

Uri_ENCODING_HOST_IS_PERCENT_ENCODED_CP (0x00000010)

The host component uses the codepage specified in dwCodePage.

Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8 (0x00000020)

Default. The query and fragment components use percent encoded UTF-8.

Uri_ENCODING_QUERY_AND_FRAGMENT_IS_CP (0x00000040)

The query and fragment components use the codepage specified in dwCodePage.

Uri_ENCODING_RFC (0x00000025)

The URI meets the requirements of RFC 3490. This flag combines the preceding default flags: Uri_ENCODING_HOST_IS_IDN, Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8, and Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8.

dwCodePage [in]

An unsigned long integer value that contains the codepage identifier value for the multibyte URI.

dwCreateFlags [in]

A valid combination of flags. Refer to CreateUri for a complete list of flags and values.

dwReserved [in]

Reserved. Must be set to 0.

ppURI [out]

An IUri interface pointer that will receive the new instance.

Return value

Returns one of the following values.

Return code Description
S_OK

Success.

E_INVALIDARG

Flags conflict, or ppURI is NULL.

E_OUTOFMEMORY

There is insufficient memory to create the IUri.

INET_E_INVALID_URL

The string does not contain a recognized URI format.

INET_E_SECURITY_PROBLEM

The URI contains syntax that attempts to bypass security.

 

Remarks

This function fails with E_INVALIDARG, if the flags specified in dwEncodingFlags conflict. For example, if both Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 and Uri_ENCODING_HOST_IS_PERCENT_ENCODED_CP are set, this function will fail.

The dwEncodingFlags for host are ignored if Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES is specified in dwCreateFlags. Use the encoding flags for userinfo and path instead.

Requirements

Minimum supported client

Windows XP with SP2

Minimum supported server

Windows Server 2003 with SP1

Product

Internet Explorer 7

Header

Urlmon.h

Library

Urlmon.lib

DLL

Urlmon.dll

See also

Reference

CreateUri

CreateUriWithFragment