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

Last change on this file since 3849 was 3849, checked in by bird, 25 years ago

Corrected typo.

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