source: trunk/src/shlwapi/url.cpp@ 3539

Last change on this file since 3539 was 3539, checked in by phaller, 25 years ago

Further SHLWAPI development

File size: 35.1 KB
Line 
1/* $Id: url.cpp,v 1.2 2000-05-15 02:42:35 phaller Exp $ */
2
3/*
4 * Win32 Lightweight SHELL32 API for OS/2
5 *
6 * 2000/04/20 Patrick Haller (haller@zebra.fh-weingarten.de)
7 *
8 * @(#) url.cpp 1.0.0 2000/04/20 PH Start from scratch
9 */
10
11
12/*****************************************************************************
13 * Remark *
14 *****************************************************************************
15
16 */
17
18
19/*****************************************************************************
20 * Includes *
21 *****************************************************************************/
22
23#include <odin.h>
24#include <odinwrap.h>
25#include <os2sel.h>
26
27#include <string.h>
28#include <ctype.h>
29#include <wctype.h>
30#include <wcstr.h>
31#define HAVE_WCTYPE_H
32
33#include <winreg.h>
34
35#include <heapstring.h>
36#include <misc.h>
37#include <win\shell.h>
38#include <win\winerror.h>
39
40#include "shlwapi.h"
41
42ODINDEBUGCHANNEL(SHLWAPI-URL)
43
44
45/*****************************************************************************
46 * Defines *
47 *****************************************************************************/
48
49
50typedef struct tagURLSCHEME
51{
52 LPSTR pszName; /* such as http:// */
53 BOOL flagOpaque; /* has a double-slash '// */
54 BOOL flagNoHistory; /* usually not in history of browsers */
55 DWORD dwType; /* URL type */
56
57} URLSCHEME, *PURLSCHEME;
58
59
60typedef enum tagURLIS
61{
62 URLIS_APPLIABLE, /* Attempt to determine a valid scheme for the URL. */
63 URLIS_DIRECTORY, /* Does the URL string end with a directory? */
64 URLIS_FILEURL, /* Is the URL a file URL? */
65 URLIS_HASQUERY, /* Does the URL have an appended query string? */
66 URLIS_NOHISTORY, /* Is the URL a "No History" URL? */
67 URLIS_OPAQUE, /* Is the URL opaque? */
68 URLIS_URL /* Is the URL valid? */
69} URLIS;
70
71
72static URLSCHEME arrUrlSchemes[] =
73{ /* scheme opaque hist type */
74 {"http://", FALSE, FALSE, 0},
75 {"file://", FALSE, FALSE, 0},
76 {"ftp://", FALSE, FALSE, 0},
77 {"telnet://", FALSE, TRUE, 0},
78 {"news://", FALSE, TRUE, 0},
79 {"mailto:", TRUE, TRUE, 0},
80 {"gopher://", FALSE, FALSE, 0},
81};
82
83
84
85
86/*****************************************************************************
87 * Name : UrlApplyScheme
88 * Purpose : Takes a URL string, determines a scheme for it, and returns a
89 * string with an appropriate prefix.
90 * Parameters: pszIn [in] A NULL-terminated URL string.
91 * pszOut [out] A buffer to receive a NULL-terminated string,
92 * set to the URL specified by pszIn, converted
93 * to the standard scheme://URL_string format.
94 * pcchOut [in/out] Address of a value set to the number of
95 * characters in the pszOut buffer. When the
96 * function returns, the value depends on whether
97 * the function is successful or returns
98 * E_POINTER. For other return values, the value
99 * of this parameter is meaningless.
100 * dwFlags [in] Flags that specify how to determine the
101 * scheme. The following flags can be combined.
102 * URL_APPLY_DEFAULT
103 * Apply the default scheme if UrlApplyScheme
104 * can't determine one. The default prefix is
105 * stored in the registry but is typically "http".
106 * URL_APPLY_GUESSSCHEME
107 * Attempt to determine the scheme by examining
108 * pszIn.
109 * URL_APPLY_GUESSFILE
110 * Attempt to determine a file URL from pszIn.
111 * URL_APPLY_FORCEAPPLY
112 * Force UrlApplyScheme to determine a scheme
113 * for pszIn.
114 * Variables :
115 * Result : S_OK A scheme was determined. pszOut points to a string
116 * containing the URL with the scheme's prefix. The value
117 * of pcchOut is set to the number of characters in the
118 * string, not counting the terminating NULL character.
119 * S_FALSE There were no errors, but no prefix was prepended.
120 * E_POINTER The buffer was too small. The value of pcchOut is
121 * set to the minimum number of characters that the
122 * buffer must be able to contain, including the
123 * terminating NULL character.
124 * Other errors - A standard OLE error value is returned.
125 * Remark : If the URL has a valid scheme, the string will not be modified.
126 * However, almost any combination of two or more characters
127 * followed by a colon will be parsed as a scheme. Valid
128 * characters include some common punctuation marks, such as ".".
129 * If your input string fits this description, UrlApplyScheme may
130 * treat it as valid and not apply a scheme. To force the function
131 * to apply a scheme to a URL, set the URL_APPLY_FORCEAPPLY and
132 * URL_APPLY_DEFAULT flags in dwFlags. This combination of flags
133 * forces the function to apply a scheme to the URL. Typically,
134 * the function will not be able to determine a valid scheme. The
135 * second flag guarantees that, if no valid scheme can be
136 * determined, the function will apply the default scheme to the URL.
137 * Status : UNTESTED
138 *
139 * Autor : Patrick Haller [Thu, 2000/04/20 19:46]
140 *****************************************************************************/
141
142ODINFUNCTION4(HRESULT, UrlApplySchemeA,
143 LPCSTR, pszIn,
144 LPSTR, pszOut,
145 LPDWORD, pcchOut,
146 DWORD, dwFlags)
147{
148 dprintf(("not implemented."));
149
150 strncpy(pszOut,
151 pszIn,
152 *pcchOut);
153 *pcchOut = 0;
154
155 return S_OK;
156}
157
158
159ODINFUNCTION4(HRESULT, UrlApplySchemeW,
160 LPCWSTR, pszIn,
161 LPWSTR, pszOut,
162 LPDWORD, pcchOut,
163 DWORD, dwFlags)
164{
165 dprintf(("not implemented."));
166
167 wcsncpy((wchar_t*)pszOut,
168 (wchar_t*)pszIn,
169 *pcchOut);
170 *pcchOut = 0;
171
172 return S_OK;
173}
174
175
176/*****************************************************************************
177 * Name : UrlCanonicalize
178 * Purpose : Takes a URL string and converts it into canonical form.
179 * Parameters: pszUrl [in] Pointer to a URL string. If it does not refer
180 * to a file, it must include a valid scheme such
181 * as "http://".
182 * pszCanonicalized [out] A pointer to a NULL-terminated string
183 * used to return the converted URL.
184 * pcchCanonicalized [out] The number of characters in
185 * pszCanonicalized.
186 * dwFlags [in] Flags that specify how the URL will be
187 * converted to canonical form. The
188 * following flags can be combined.
189 * URL_DONT_SIMPLIFY
190 * Treat '/./' and '/../' in a URL
191 * string as literal characters, not as
192 * shorthand for navigation. See Remarks
193 * for further discussion.
194 * URL_ESCAPE_PERCENT
195 * Convert any occurrence of '%' to
196 * its escape sequence.
197 * URL_ESCAPE_SPACES_ONLY
198 * Replace only spaces with escape
199 * sequences. This flag takes precedence
200 * over URL_ESCAPE_UNSAFE, but does not
201 * apply to opaque URLs.
202 * URL_ESCAPE_UNSAFE
203 * Replace unsafe values with their escape
204 * sequences. This flag applies to all URLs,
205 * including opaque URLs.
206 * URL_PLUGGABLE_PROTOCOL
207 * Combine URLs with client-defined
208 * pluggable protocols, according to the W3C
209 * specification. This flag does not apply
210 * to standard protocols such as ftp, http,
211 * gopher, and so on. If this flag is set,
212 * UrlCombine will not simplify URLs, so
213 * there is no need to also set
214 * URL_DONT_SIMPLIFY.
215 * URL_UNESCAPE
216 * Unescape any escape sequences that the
217 * URLs contain, with two exceptions. The
218 * escape sequences for '?' and '#' will
219 * not be unescaped. If one of the
220 * URL_ESCAPE_XXX flags is also set, the two
221 * URLs will unescaped, then combined, then
222 * escaped.
223 * Variables :
224 * Result : Returns S_OK if successful, or a standard OLE error
225 * value otherwise.
226 * Remark : This function will do such tasks as replacing unsafe characters
227 * with their escape sequences and collapsing sequences like "..\...".
228 * If a URL string contains '/../' or '/./', UrlCanonicalize
229 * will normally treat the characters as indicating navigation in
230 * the URL hierarchy. The function will simplify the URLs before
231 * combining them. For instance "/hello/cruel/../world" will be
232 * simplified to "/hello/world". If the URL_DONT_SIMPLIFY flag is
233 * set in dwFlags, the function will not simplify URLs. In this
234 * case, "/hello/cruel/../world" will be left as is.
235 * Status :
236 *
237 * Author : Patrick Haller [Thu, 2000/04/20 19:49]
238 *****************************************************************************/
239
240ODINFUNCTION4(HRESULT, UrlCanonicalizeA,
241 LPCSTR, pszUrl,
242 LPSTR, pszCanonicalized,
243 LPDWORD, pcchCanonicalized,
244 DWORD, dwFlags)
245{
246 dprintf(("not implemented."));
247
248 return S_OK;
249}
250
251
252ODINFUNCTION4(HRESULT, UrlCanonicalizeW,
253 LPCWSTR, pszUrl,
254 LPWSTR, pszCanonicalized,
255 LPDWORD, pcchCanonicalized,
256 DWORD, dwFlags)
257{
258 dprintf(("not implemented."));
259
260 return S_OK;
261}
262
263
264
265/*****************************************************************************
266 * Name : UrlCombine
267 * Purpose : Takes a relative URL and its base and returns a URL in canonical form.
268 * Parameters: pszBase [in] Pointer to a string with the base URL.
269 * pszRelative [in] Pointer to a string with the relative URL.
270 * pszCombined [out] Pointer to a buffer to receive a
271 * NULL-terminated string containing the combined URL.
272 * pcchCombined [in/out] Pointer to a value set to the number of
273 * characters in the pszCombined buffer. When the
274 * function returns, the value depends on whether
275 * the function is successful or returns E_POINTER.
276 * For other return values, the value of this
277 * parameter is meaningless.
278 * dwFlags [in] Flags that specify how the URL will be converted
279 * to canonical form. The following flags can be combined.
280 * URL_DONT_SIMPLIFY
281 * Treat '/./' and '/../' in a URL string as literal
282 * characters, not as shorthand for
283 * navigation. See Remarks for further discussion.
284 * URL_ESCAPE_PERCENT
285 * Convert any occurrence of '%' to its escape sequence.
286 * URL_ESCAPE_SPACES_ONLY
287 * Replace only spaces with escape sequences. This flag
288 * takes precedence over
289 * URL_ESCAPE_UNSAFE, but does not apply to opaque URLs.
290 * URL_ESCAPE_UNSAFE
291 * Replace unsafe values with their escape sequences.
292 * This flag applies to all URLs,
293 * including opaque URLs.
294 * URL_PLUGGABLE_PROTOCOL
295 * Combine URLs with client-defined pluggable protocols,
296 * according to the W3C specification. This flag does not
297 * apply to standard protocols such as ftp, http,
298 * gopher, and so on. If this flag is set,
299 * UrlCombine will not simplify URLs, so there is
300 * no need to also set URL_DONT_SIMPLIFY.
301 * URL_UNESCAPE
302 * Unescape any escape sequences that the URLs contain,
303 * with two exceptions. The escape sequences
304 * for '?' and '#' will not be unescaped.
305 * If one of the URL_ESCAPE_XXX flags is also
306 * set, the two URLs will unescaped, then
307 * combined, then escaped.
308 * Variables :
309 * Result : S_OK pszCombined points to a string containing the
310 * combined URLs. The value of pcchCombined is set to
311 * the number of characters in the string, not counting
312 * the terminating NULL character.
313 * E_POINTER The buffer was too small. The value of pcchCombined
314 * is set to the minimum number of characters that the
315 * buffer must be able to contain, including the
316 * terminating NULL character.
317 * Other errors A standard OLE error value is returned.
318 * Remark : SHLWAPI.
319 * Status : UNTESTED
320 *
321 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
322 *****************************************************************************/
323
324ODINFUNCTION5(HRESULT,UrlCombineA,
325 LPCSTR, pszBase,
326 LPCSTR, pszRelative,
327 LPSTR, pszCombined,
328 LPDWORD,pcchCombined,
329 DWORD, dwFlags)
330{
331 dprintf(("not implemented."));
332
333 return S_OK;
334}
335
336
337ODINFUNCTION5(HRESULT, UrlCombineW,
338 LPCWSTR, pszBase,
339 LPCWSTR, pszRelative,
340 LPWSTR, pszCombined,
341 LPDWORD, pcchCombined,
342 DWORD, dwFlags)
343{
344 dprintf(("not implemented."));
345
346 return S_OK;
347}
348
349
350/*****************************************************************************
351 * Name : UrlCompare
352 * Purpose : Does a case-sensitive comparison of two URL strings.
353 * Parameters: pszURL1 [in] NULL-terminated string with the first URL.
354 * pszURL2 [in] NULL-terminated string with the second URL.
355 * fIgnoreSlash [in] Value that is set to TRUE to have UrlCompare
356 * ignore a trailing '/' character on either or
357 * both URLs.
358 * Variables :
359 * Result : Returns zero if the two strings are equal, apart from a
360 * trailing '\' character if fIgnoreSlash is set to TRUE.
361 * Returns a negative integer if the string pointed to by pszURL1
362 * is less than the string pointed to by pszURL2. Otherwise, it
363 * returns a positive integer.
364 * Remark : SHLWAPI.
365 * For the best results, you should first canonicalize the URLs
366 * with UrlCanonicalize. Then, compare the canonicalized URLs with
367 * UrlCompare.
368 * Status : UNTESTED
369 *
370 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
371 *****************************************************************************/
372
373ODINFUNCTION3(int, UrlCompareA,
374 LPCSTR, pszURL1,
375 LPCSTR, pszURL2,
376 BOOL, fIgnoreSlash)
377{
378 dprintf(("not correctly implemented."));
379
380 return strcmp(pszURL1,
381 pszURL2);
382}
383
384ODINFUNCTION3(int, UrlCompareW,
385 LPCWSTR, pszURL1,
386 LPCWSTR, pszURL2,
387 BOOL, fIgnoreSlash)
388{
389 dprintf(("not correctly implemented."));
390
391 return wcscmp((const wchar_t *)pszURL1,
392 (const wchar_t *)pszURL2);
393}
394
395
396/*****************************************************************************
397 * Name : UrlCreateFromPath
398 * Purpose : Takes a DOS path and converts it to a canonicalized URL.
399 * Parameters: pszPath Pointer to the string with the DOS path.
400 * pszUrl Value used to return the URL.
401 * pcchPath Length of pszUrl.
402 * dwReserved Reserved. Set this parameter to NULL.
403 * Variables :
404 * Result : Returns S_FALSE if pszPath is already in URL format. In this
405 * case, pszPath will simply be copied to pszUrl. Otherwise, it
406 * returns S_OK if successful or a standard OLE error value if not.
407 * Remark : SHLWAPI.
408 * Status : UNTESTED
409 *
410 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
411 *****************************************************************************/
412
413ODINFUNCTION4(HRESULT,UrlCreateFromPathA,
414 LPCSTR, pszPath,
415 LPSTR, pszUrl,
416 LPDWORD,pcchUrl,
417 DWORD, dwReserved)
418{
419 dprintf(("not implemented."));
420
421 return S_FALSE;
422}
423
424
425ODINFUNCTION4(HRESULT,UrlCreateFromPathW,
426 LPCWSTR,pszPath,
427 LPWSTR, pszUrl,
428 LPDWORD,pcchUrl,
429 DWORD, dwReserved)
430{
431 dprintf(("not implemented."));
432
433 return S_FALSE;
434}
435
436
437/*****************************************************************************
438 * Name : UrlEscape
439 * Purpose : Converts unsafe characters, such as spaces, into their
440 * corresponding escape sequences.
441 * Parameters: pszURL [in] Pointer to a NULL-terminated string with the URL.
442 * pszEscaped [out] Pointer to a NULL-terminated string containing
443 * the string pointed to by pszURL, with unsafe
444 * characters converted to their escape sequences.
445 * pcchEscaped [in/out] Number of characters in the buffer pointed
446 * to by pszEscaped. On entry, the value pcchEscaped
447 * points to is set to the size of the buffer.
448 * When the function returns, the value pcchEscaped
449 * points to is set to the number of characters
450 * written to that buffer, not counting the terminating
451 * NULL character. If an E_POINTER error code is
452 * returned, the buffer was too small, and the
453 * value pcchEscaped points to is set to the
454 * required number of characters in the buffer. If
455 * any other errors are returned, the value that
456 * pcchEscaped points to is undefined.
457 * dwFlags [in] Flags that control which characters are escaped.
458 * It can be a combination of the following flags.
459 * Flag Description
460 * URL_DONT_ESCAPE_EXTRA_INFO
461 * Don't convert the # or ? character, or
462 * any characters following them in the
463 * string.
464 * URL_ESCAPE_SPACES_ONLY
465 * Only escape space characters. This
466 * flag cannot be combined with
467 * URL_ESCAPE_PERCENT or
468 * URL_ESCAPE_SEGMENT_ONLY.
469 * URL_ESCAPE_PERCENT
470 * Escape the % character. By default,
471 * this character is not escaped.
472 * URL_ESCAPE_SEGMENT_ONLY
473 * Escape the sections following the
474 * server component, but not the extra
475 * information sections following a # or
476 * ? character.
477 * Variables :
478 * Result : Returns an OLE success code if successful. The value pointed to
479 * by pcchEscaped will be set to the number of characters written
480 * to the output buffer, excluding the terminating NULL. If the
481 * buffer was too small, E_POINTER is returned, and the value
482 * pointed to by pcchEscaped will be set to the required buffer
483 * size. Otherwise, an OLE error value is returned.
484 * Remark : SHLWAPI.
485 * Unsafe characters are those characters that may be altered
486 * during transport across the internet. This functions converts
487 * unsafe characters into their equivalent "%xy" escape sequences.
488 * Status : UNTESTED
489 *
490 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
491 *****************************************************************************/
492
493ODINFUNCTION4(HRESULT, UrlEscapeA,
494 LPCSTR, pszURL,
495 LPSTR, pszEscaped,
496 LPDWORD, pcchEscaped,
497 DWORD, dwFlags)
498{
499 dprintf(("not implemented."));
500
501 return S_FALSE;
502}
503
504
505ODINFUNCTION4(HRESULT, UrlEscapeW,
506 LPCWSTR, pszURL,
507 LPWSTR, pszEscaped,
508 LPDWORD, pcchEscaped,
509 DWORD, dwFlags)
510{
511 dprintf(("not implemented."));
512
513 return S_FALSE;
514}
515
516
517/*****************************************************************************
518 * Name : UrlGetLocation
519 * Purpose : Retrieves the location from a URL.
520 * Parameters: pszURL [in] Pointer to a NULL-terminated string that contains
521 * the location.
522 * Variables :
523 * Result : Returns a pointer to a NULL-terminated string with the
524 * location, or NULL otherwise.
525 * Remark : SHLWAPI.
526 * The location is the segment of the URL starting with a ? or #
527 * character. If a file URL has a query string, the returned
528 * string includes the query string.
529 * Status : UNTESTED
530 *
531 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
532 *****************************************************************************/
533
534ODINFUNCTION1(LPCSTR, UrlGetLocationA,
535 LPCSTR, pszURL)
536{
537 dprintf(("not implemented."));
538
539 return pszURL;
540}
541
542
543ODINFUNCTION1(LPCWSTR, UrlGetLocationW,
544 LPCWSTR, pszURL)
545{
546 dprintf(("not implemented."));
547
548 return pszURL;
549}
550
551
552/*****************************************************************************
553 * Name : UrlGetPart
554 * Purpose : Takes a URL string and returns a specified part.
555 * Parameters: pszIn [in] NULL-terminated string that contains the URL.
556 * pszOut [out] A buffer that will receive a NULL-terminated
557 * string with the specified part.
558 * pcchOut [in/out] Address of a value set to the number of
559 * characters in the pszOut buffer. When the
560 * function returns, the value depends on whether
561 * the function is successful or returns E_POINTER.
562 * For other return values, the value of this
563 * parameter is meaningless.
564 * dwPart [in] Flags that specify which part of the URL to retrieve.
565 * It can have one of the following values.
566 * Flag Description
567 * URL_PART_HOSTNAME The host name.
568 * URL_PART_PASSWORD The password.
569 * URL_PART_PORT The port number.
570 * URL_PART_QUERY The query portion of the URL.
571 * URL_PART_SCHEME The URL scheme.
572 * URL_PART_USERNAME The username.
573 *
574 * dwFlags [in] Flag that can be set to keep the URL scheme,
575 * in addition to the part that is specified by dwPart.
576 * Flag Description
577 * URL_PARTFLAG_KEEPSCHEME Keep the URL scheme.
578 * Variables :
579 * Result :
580 * Remark : SHLWAPI.
581 * Returns an OLE success code if successful. The value pointed to
582 * by pcchOut will be set to the number of characters written to
583 * the output buffer, excluding the terminating NULL. If the buffer
584 * was too small, E_POINTER is returned, and the value pointed to
585 * by pcchOut will be set to the minimum number of characters that
586 * the buffer must be able to contain, including the terminating
587 * NULL character. Otherwise, an OLE error value is returned.
588 * Status : UNTESTED
589 *
590 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
591 *****************************************************************************/
592
593ODINFUNCTION5(HRESULT, UrlGetPartA,
594 LPCSTR, pszIn,
595 LPSTR, pszOut,
596 LPDWORD, pcchOut,
597 DWORD, dwPart,
598 DWORD, dwFlags)
599{
600 dprintf(("not implemented."));
601
602 return S_OK;
603}
604
605
606ODINFUNCTION5(HRESULT, UrlGetPartW,
607 LPCWSTR, pszIn,
608 LPWSTR, pszOut,
609 LPDWORD, pcchOut,
610 DWORD, dwPart,
611 DWORD, dwFlags)
612{
613 dprintf(("not implemented."));
614
615 return S_OK;
616}
617
618
619/*****************************************************************************
620 * Name : UrlHash
621 * Purpose : Hashes a URL string.
622 * Parameters: pszURL [in] Pointer to a NULL-terminated string with the URL.
623 * pbHash [out] Buffer to receive the hashed array.
624 * cbHash [in] Number of elements in pbHash. It should be no larger
625 * than 256.
626 * Variables :
627 * Result : Returns S_OK if successful, or a standard OLE error value otherwise.
628 * Remark : SHLWAPI.
629 * For example, to hash a URL into a single byte, set
630 * cbHash = sizeof(BYTE) and
631 * pbHash = (LPBYTE)&bHashedValue, where bHashedValue is a
632 * one-byte buffer. To hash a URL into a DWORD, set
633 * cbHash = sizeof(DWORD) and
634 * pbHash = (LPBYTE)&dwHashedValue, where dwHashedValue is a
635 * DWORD buffer.
636 * Status : UNTESTED
637 *
638 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
639 *****************************************************************************/
640
641ODINFUNCTION3(HRESULT,UrlHashA,
642 LPCSTR, pszURL,
643 LPBYTE, pbHash,
644 DWORD, cbHash)
645{
646 dprintf(("not implemented."));
647
648 return S_OK;
649}
650
651
652ODINFUNCTION3(HRESULT,UrlHashW,
653 LPCWSTR,pszURL,
654 LPBYTE, pbHash,
655 DWORD, cbHash)
656{
657 dprintf(("not implemented."));
658
659 return S_OK;
660}
661
662
663/*****************************************************************************
664 * Name : UrlIs
665 * Purpose : Tests whether or not a URL is a specified type.
666 * Parameters: pszUrl [in] Pointer to a string containing the URL.
667 * UrlIs [in] Type of URL to be tested for.
668 * UrlIs can take one of the following values:
669 * URLIS_APPLIABLE Attempt to determine a valid scheme for the URL.
670 * URLIS_DIRECTORY Does the URL string end with a directory?
671 * URLIS_FILEURL Is the URL a file URL?
672 * URLIS_HASQUERY Does the URL have an appended query string?
673 * URLIS_NOHISTORY Is the URL a "No History" URL?
674 * URLIS_OPAQUE Is the URL opaque?
675 * URLIS_URL Is the URL valid?
676 * Variables :
677 * Result : For all but one of the URL types, UrlIs returns TRUE if the URL
678 * is the specified type, or FALSE if not. If UrlIs is set to
679 * URLIS_APPLIABLE, UrlIs will attempt to determine the URL scheme.
680 * If the function is able to determine a scheme, it returns TRUE,
681 * or FALSE otherwise.
682 * Remark : SHLWAPI.
683 * Status : UNTESTED
684 *
685 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
686 *****************************************************************************/
687
688ODINFUNCTION2(BOOL, UrlIsA,
689 LPCSTR, pszUrl,
690 URLIS, UrlIs)
691{
692 dprintf(("not implemented."));
693
694 return TRUE;
695}
696
697
698ODINFUNCTION2(BOOL, UrlIsW,
699 LPCWSTR, pszUrl,
700 URLIS, UrlIs)
701{
702 dprintf(("not implemented."));
703
704 return TRUE;
705}
706
707/*****************************************************************************
708 * Name : UrlIsNoHistory
709 * Purpose : Returns whether or not a URL is a No History URL.
710 * Parameters: pszURL [in] NULL-terminated string with the URL.
711 * Variables :
712 * Result : Returns a non-zero value if the URL is a No History URL, or zero otherwise.
713 * Remark : SHLWAPI.
714 * A No History URL is a URL that browsers typically do not
715 * include in their navigation history.
716 * Status : UNTESTED
717 *
718 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
719 *****************************************************************************/
720
721ODINFUNCTION1(BOOL, UrlIsNoHistoryA,
722 LPCSTR,pszURL)
723{
724 return UrlIsA(pszURL, URLIS_NOHISTORY);
725}
726
727
728ODINFUNCTION1(BOOL, UrlIsNoHistoryW,
729 LPCWSTR,pszURL)
730{
731 return UrlIsW(pszURL, URLIS_NOHISTORY);
732}
733
734
735/*****************************************************************************
736 * Name : UrlIsOpaque
737 * Purpose : Returns whether a URL is opaque.
738 * Parameters: pszURL [in] NULL-terminated string with the URL.
739 * Variables :
740 * Result : Returns a non-zero value if the URL is opaque, or zero
741 * otherwise.
742 * Remark : SHLWAPI.
743 * A URL that has a scheme that is not followed by two slashes (//)
744 * is opaque. For example, mailto:xyz@somecompany.com is an opaque
745 * URL. Opaque URLs cannot be separated into the standard
746 * URL heirarchy.
747 * Status : UNTESTED
748 *
749 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
750 *****************************************************************************/
751
752ODINFUNCTION1(BOOL, UrlIsOpaqueA,
753 LPCSTR, pszURL)
754{
755 return UrlIsA(pszURL, URLIS_OPAQUE);
756}
757
758
759ODINFUNCTION1(BOOL, UrlIsOpaqueW,
760 LPCWSTR,pszURL)
761{
762 return UrlIsW(pszURL, URLIS_OPAQUE);
763}
764
765
766/*****************************************************************************
767 * Name : UrlUnEscape
768 * Purpose : Converts escape sequences back into ordinary characters.
769 * Parameters: pszURL [in/out] Pointer to a NULL-terminated string with the
770 * URL. If dwFlags is set to URL_UNESCAPE_INPLACE,
771 * the converted string is returned through this
772 * parameter.
773 * pszUnEscaped [out] Pointer to a buffer that will receive a
774 * NULL-terminated string containing the
775 * unescaped version of pszURL. If
776 * URL_UNESCAPE_INPLACE is set in dwFlags, this
777 * parameter is ignored.
778 * pcchUnEscaped [in/out] Number of characters in the buffer
779 * pointed to by pcchUnEscaped. On entry, the
780 * value pcchUnEscaped points to is set to the
781 * size of the buffer. If the function returns
782 * a success code, the value that pcchUnEscaped
783 * points to is set to the number of characters
784 * written to that buffer, not counting the
785 * terminating NULL character. If an E_POINTER
786 * error code is returned, the buffer was too
787 * small, and the value pcchUnEscaped points to
788 * is set to the required number of characters
789 * that the buffer must be able to contain. If
790 * any other errors are returned, the value
791 * that pcchUnEscaped points to is undefined.
792 * dwFlags [in] Flags that control which characters are
793 * unescaped. It can be a combination of the
794 * following flags.
795 * Flag Description
796 * URL_DONT_UNESCAPE_EXTRA_INFO
797 * Don't convert the # or ? character,
798 * or any characters following them
799 * in the string.
800 * URL_UNESCAPE_INPLACE Use pszURL to return the converted
801 * string instead of pszUnEscaped.
802 * Variables :
803 * Result : Returns an OLE success code if successful. If the
804 * URL_UNESCAPE_INPLACE flag is not set, the value pointed to by
805 * pcchUnEscaped will be set to the number of characters in the
806 * output buffer pointed to by pszUnEscaped. Returns E_POINTER if
807 * the URL_UNESCAPE_INPLACE flag is not set and the output buffer
808 * is too small. The pcchUnEscaped parameter will be set to the
809 * required buffer size. Otherwise, returns an OLE error value.
810 * Remark : SHLWAPI.UrlUnEscape
811 * An escape sequence has the form "%xy".
812 * Status : UNTESTED
813 *
814 * Author : Patrick Haller [Tue, 2000/04/25 02:02]
815 *****************************************************************************/
816
817ODINFUNCTION4(HRESULT,UrlUnescapeA,
818 LPSTR, pszURL,
819 LPSTR, pszUnEscaped,
820 LPDWORD,pcchUnEscaped,
821 DWORD, dwFlags)
822{
823 dprintf(("not implemented."));
824
825 return S_OK;
826}
827
828
829ODINFUNCTION4(HRESULT,UrlUnescapeW,
830 LPWSTR, pszURL,
831 LPWSTR, pszUnEscaped,
832 LPDWORD,pcchUnEscaped,
833 DWORD, dwFlags)
834{
835 dprintf(("not implemented."));
836
837 return S_OK;
838}
Note: See TracBrowser for help on using the repository browser.