Microsoft Windows CE 3.0  

Creating and Cracking URLs

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The InternetCreateUrlfunction uses the data in the URL_COMPONENTSstructure to create a URL.

The components that make up the URL_COMPONENTSstructure are the scheme, host name, port number, user name, password, URL path, and additional data, such as search parameters. Each component, except the port number, has a string member that holds the data, and a member that holds the length of the string member.

For each required component, the pointer member should contain the address of the buffer holding the data. The length member should be set to zero if the pointer member contains the address of a zero-terminated string; the length member should be set to the string length if the pointer member contains the address of a string that is not zero-terminated. The pointer member of any components that are not required must be set to NULL.

The InternetCrackUrlfunction separates a URL into its component parts and returns the components indicated by the URL_COMPONENTSstructure passed to the function. The scheme and port numbers have only a member that stores the corresponding value; they are both returned on all successful calls to InternetCrackUrl.

To get the value of a particular component in URL_COMPONENTS, the member that stores the string length of that component must be set to a nonzero value. The string member can be either the address of a buffer or NULL.

If the pointer member contains the address of a buffer, the string length member must contain the size of that buffer. InternetCrackUrlreturns the component data as a string in the buffer and stores the string length in the string length member.

If the pointer member is set to NULL, the string length member can be set to any nonzero value. InternetCrackUrlstores the address of the first character of the URL string that contains the component data and sets the string length to the number of characters in the remaining part of the URL string that pertains to the component.

All pointer members set to NULL with a nonzero length member point to the appropriate starting point in the URL string. The length stored in the length member must be used to determine the end of the individual component's data.

To finish initializing URL_COMPONENTSproperly, the dwStructSizemember must be set to the size of the URL_COMPONENTSstructure.



 Last updated on Friday, April 02, 2004

© 2004 Microsoft Corporation. All rights reserved.