ReactOS 0.4.16-dev-197-g92996da
url.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winhttp.h"
#include "wine/test.h"
Include dependency graph for url.c:

Go to the source code of this file.

Functions

static void fill_url_components (URL_COMPONENTS *uc)
 
static void WinHttpCreateUrl_test (void)
 
static void reset_url_components (URL_COMPONENTS *uc)
 
static void WinHttpCrackUrl_test (void)
 
 START_TEST (url)
 

Variables

static WCHAR empty [] = {0}
 
static WCHAR ftp [] = {'f','t','p',0}
 
static WCHAR http [] = {'h','t','t','p',0}
 
static WCHAR winehq [] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}
 
static WCHAR username [] = {'u','s','e','r','n','a','m','e',0}
 
static WCHAR password [] = {'p','a','s','s','w','o','r','d',0}
 
static WCHAR about [] = {'/','s','i','t','e','/','a','b','o','u','t',0}
 
static WCHAR query [] = {'?','q','u','e','r','y',0}
 
static WCHAR escape [] = {' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',':',';','<','=','>','?','@','[','\\',']','^','_','`','{','|','}','~',0}
 
static WCHAR escape2 [] = {'\r',0x1f,' ','\n',0x7f,'\r','\n',0}
 
static WCHAR escape3 [] = {'?','t','e','x','t','=',0xfb00,0}
 
static WCHAR escape4 [] = {'/','t','e','x','t','=',0xfb00,0}
 
static const WCHAR url1 []
 
static const WCHAR url2 [] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':',0}
 
static const WCHAR url3 []
 
static const WCHAR url4 [] = {'h','t','t','p',':','/','/',0}
 
static const WCHAR url5 []
 
static const WCHAR url6 []
 
static const WCHAR url7 []
 
static const WCHAR url8 []
 
static const WCHAR url9 []
 
static const WCHAR url10 []
 
static const WCHAR url11 []
 
static const WCHAR url12 []
 
static const WCHAR url13 []
 
static const WCHAR url14 [] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t',0}
 
static const WCHAR url15 [] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':','6','5','5','3','6',0}
 
static const WCHAR url16 [] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':','0',0}
 
static const WCHAR url17 [] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':',0}
 
static const WCHAR url18 []
 
static const WCHAR url19 []
 
static const WCHAR url20 []
 
static const WCHAR url21 []
 
static const WCHAR url_k1 []
 
static const WCHAR url_k2 []
 
static const WCHAR url_k3 []
 
static const WCHAR url_k4 []
 
static const WCHAR url_k5 []
 
static const WCHAR url_k6 []
 
static const WCHAR url_k7 []
 
static const WCHAR url_k8 []
 
static const WCHAR url_k9 []
 
static const WCHAR url_k10 []
 

Function Documentation

◆ fill_url_components()

static void fill_url_components ( URL_COMPONENTS uc)
static

Definition at line 111 of file url.c.

112{
113 uc->dwStructSize = sizeof(URL_COMPONENTS);
114 uc->lpszScheme = http;
117 uc->lpszHostName = winehq;
119 uc->nPort = 80;
124 uc->lpszUrlPath = about;
126 uc->lpszExtraInfo = query;
128}
#define lstrlenW
Definition: compat.h:750
static WCHAR query[]
Definition: url.c:35
static WCHAR http[]
Definition: url.c:30
static WCHAR winehq[]
Definition: url.c:31
static WCHAR about[]
Definition: url.c:34
static WCHAR password[]
Definition: url.c:33
static WCHAR username[]
Definition: url.c:32
INTERNET_PORT nPort
Definition: winhttp.h:471
LPWSTR lpszScheme
Definition: winhttp.h:466
LPWSTR lpszUserName
Definition: winhttp.h:472
LPWSTR lpszExtraInfo
Definition: winhttp.h:478
DWORD dwPasswordLength
Definition: winhttp.h:475
LPWSTR lpszUrlPath
Definition: winhttp.h:476
DWORD dwHostNameLength
Definition: winhttp.h:470
DWORD dwExtraInfoLength
Definition: winhttp.h:479
DWORD dwUrlPathLength
Definition: winhttp.h:477
LPWSTR lpszHostName
Definition: winhttp.h:469
LPWSTR lpszPassword
Definition: winhttp.h:474
INTERNET_SCHEME nScheme
Definition: winhttp.h:468
DWORD dwStructSize
Definition: winhttp.h:465
DWORD dwUserNameLength
Definition: winhttp.h:473
DWORD dwSchemeLength
Definition: winhttp.h:467
#define INTERNET_SCHEME_HTTP
Definition: winhttp.h:42

Referenced by InternetCreateUrlA_test(), and WinHttpCreateUrl_test().

◆ reset_url_components()

static void reset_url_components ( URL_COMPONENTS uc)
static

Definition at line 415 of file url.c.

416{
417 memset( uc, 0, sizeof(URL_COMPONENTS) );
418 uc->dwStructSize = sizeof(URL_COMPONENTS);
419 uc->dwSchemeLength = ~0u;
420 uc->dwHostNameLength = 1;
421 uc->nPort = 0;
422 uc->dwUserNameLength = ~0u;
423 uc->dwPasswordLength = ~0u;
424 uc->dwUrlPathLength = ~0u;
425 uc->dwExtraInfoLength = ~0u;
426}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define memset(x, y, z)
Definition: compat.h:39

Referenced by WinHttpCrackUrl_test().

◆ START_TEST()

START_TEST ( url  )

Definition at line 865 of file url.c.

866{
869}
static void WinHttpCrackUrl_test(void)
Definition: url.c:428
static void WinHttpCreateUrl_test(void)
Definition: url.c:130

◆ WinHttpCrackUrl_test()

static void WinHttpCrackUrl_test ( void  )
static

Definition at line 428 of file url.c.

429{
430 static const WCHAR hostnameW[] =
431 {'w','i','n','e','h','q','.','o',' ','g',0};
432 static const WCHAR pathW[] =
433 {'/','p','a','t','h','%','2','0','w','i','t','h','%','2','0','s','p','a','c','e','s',0};
435 WCHAR scheme[20], user[20], pass[20], host[40], path[80], extra[40];
436 DWORD error;
437 BOOL ret;
438
439 /* buffers of sufficient length */
440 scheme[0] = user[0] = pass[0] = host[0] = path[0] = extra[0] = 0;
441
442 uc.dwStructSize = sizeof(URL_COMPONENTS);
443 uc.nScheme = 0;
444 uc.lpszScheme = scheme;
445 uc.dwSchemeLength = 20;
446 uc.lpszUserName = user;
447 uc.dwUserNameLength = 20;
448 uc.lpszPassword = pass;
449 uc.dwPasswordLength = 20;
450 uc.lpszHostName = host;
451 uc.dwHostNameLength = 20;
452 uc.nPort = 0;
453 uc.lpszUrlPath = path;
454 uc.dwUrlPathLength = 40;
455 uc.lpszExtraInfo = extra;
456 uc.dwExtraInfoLength = 20;
457
458 ret = WinHttpCrackUrl( url1, 0, 0, &uc );
459 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
460 ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme: %u\n", uc.nScheme );
461 ok( !memcmp( uc.lpszScheme, http, sizeof(http) ), "unexpected scheme: %s\n", wine_dbgstr_w(uc.lpszScheme) );
462 ok( uc.dwSchemeLength == 4, "unexpected scheme length: %u\n", uc.dwSchemeLength );
463 ok( !memcmp( uc.lpszUserName, username, sizeof(username) ), "unexpected username: %s\n", wine_dbgstr_w(uc.lpszUserName) );
464 ok( uc.dwUserNameLength == 8, "unexpected username length: %u\n", uc.dwUserNameLength );
465 ok( !memcmp( uc.lpszPassword, password, sizeof(password) ), "unexpected password: %s\n", wine_dbgstr_w(uc.lpszPassword) );
466 ok( uc.dwPasswordLength == 8, "unexpected password length: %u\n", uc.dwPasswordLength );
467 ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected hostname: %s\n", wine_dbgstr_w(uc.lpszHostName) );
468 ok( uc.dwHostNameLength == 14, "unexpected hostname length: %u\n", uc.dwHostNameLength );
469 ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
470 ok( !memcmp( uc.lpszUrlPath, about, sizeof(about) ), "unexpected path: %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
471 ok( uc.dwUrlPathLength == 11, "unexpected path length: %u\n", uc.dwUrlPathLength );
472 ok( !memcmp( uc.lpszExtraInfo, query, sizeof(query) ), "unexpected extra info: %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
473 ok( uc.dwExtraInfoLength == 6, "unexpected extra info length: %u\n", uc.dwExtraInfoLength );
474
475 /* buffers of insufficient length */
476 uc.dwSchemeLength = 1;
477 uc.dwHostNameLength = 1;
478 uc.dwUrlPathLength = 40; /* sufficient */
479 SetLastError( 0xdeadbeef );
480 ret = WinHttpCrackUrl( url1, 0, 0, &uc );
482 ok( !ret, "WinHttpCrackUrl succeeded\n" );
483 ok( error == ERROR_INSUFFICIENT_BUFFER, "got %u, expected ERROR_INSUFFICIENT_BUFFER\n", error );
484 ok( uc.dwSchemeLength == 5, "unexpected scheme length: %u\n", uc.dwSchemeLength );
485 ok( uc.dwHostNameLength == 15, "unexpected hostname length: %u\n", uc.dwHostNameLength );
486 ok( uc.dwUrlPathLength == 11, "unexpected path length: %u\n", uc.dwUrlPathLength );
487
488 /* no buffers */
490 SetLastError( 0xdeadbeef );
491 ret = WinHttpCrackUrl( url_k1, 0, 0, &uc);
493 ok( ret, "WinHttpCrackUrl failed le=%u\n", error );
495 "got %u, expected ERROR_SUCCESS\n", error );
496 ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
497 ok( uc.lpszScheme == url_k1,"unexpected scheme\n" );
498 ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
499 ok( uc.lpszUserName == url_k1 + 7, "unexpected username\n" );
500 ok( uc.dwUserNameLength == 8, "unexpected username length\n" );
501 ok( uc.lpszPassword == url_k1 + 16, "unexpected password\n" );
502 ok( uc.dwPasswordLength == 8, "unexpected password length\n" );
503 ok( uc.lpszHostName == url_k1 + 25, "unexpected hostname\n" );
504 ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
505 ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
506 ok( uc.lpszUrlPath == url_k1 + 39, "unexpected path\n" );
507 ok( uc.dwUrlPathLength == 11, "unexpected path length\n" );
508 ok( uc.lpszExtraInfo == url_k1 + 50, "unexpected extra info\n" );
509 ok( uc.dwExtraInfoLength == 0, "unexpected extra info length\n" );
510
514 ret = WinHttpCrackUrl( url_k2, 0, 0,&uc);
515 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
516 ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
517 ok( uc.lpszScheme == url_k2, "unexpected scheme\n" );
518 ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
519 ok( uc.lpszUserName == NULL ,"unexpected username\n" );
520 ok( uc.dwUserNameLength == 0, "unexpected username length\n" );
521 ok( uc.lpszPassword == NULL, "unexpected password\n" );
522 ok( uc.dwPasswordLength == 0, "unexpected password length\n" );
523 ok( uc.lpszHostName == url_k2 + 7, "unexpected hostname\n" );
524 ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
525 ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
526 ok( uc.lpszUrlPath == url_k2 + 21, "unexpected path\n" );
527 ok( uc.dwUrlPathLength == 0, "unexpected path length\n" );
528 ok( uc.lpszExtraInfo == url_k2 + 21, "unexpected extra info\n" );
529 ok( uc.dwExtraInfoLength == 0, "unexpected extra info length\n" );
530
532 ret = WinHttpCrackUrl( url_k3, 0, 0, &uc );
533 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
534 ok( uc.nScheme == INTERNET_SCHEME_HTTPS, "unexpected scheme\n" );
535 ok( uc.lpszScheme == url_k3, "unexpected scheme\n" );
536 ok( uc.dwSchemeLength == 5, "unexpected scheme length\n" );
537 ok( uc.lpszUserName == NULL, "unexpected username\n" );
538 ok( uc.dwUserNameLength == 0, "unexpected username length\n" );
539 ok( uc.lpszPassword == NULL, "unexpected password\n" );
540 ok( uc.dwPasswordLength == 0, "unexpected password length\n" );
541 ok( uc.lpszHostName == url_k3 + 8, "unexpected hostname\n" );
542 ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
543 ok( uc.nPort == 443, "unexpected port: %u\n", uc.nPort );
544 ok( uc.lpszUrlPath == url_k3 + 22, "unexpected path\n" );
545 ok( uc.dwUrlPathLength == 5, "unexpected path length\n" );
546 ok( uc.lpszExtraInfo == url_k3 + 27, "unexpected extra info\n" );
547 ok( uc.dwExtraInfoLength == 1, "unexpected extra info length\n" );
548
549 /* bad parameters */
551 SetLastError( 0xdeadbeef );
552 ret = WinHttpCrackUrl( url_k4, 0, 0, &uc );
553 ok( !ret, "WinHttpCrackUrl succeeded\n" );
555 ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
556
558 SetLastError( 0xdeadbeef );
559 ret = WinHttpCrackUrl( url_k5, 0, 0, &uc );
560 ok( !ret, "WinHttpCrackUrl succeeded\n" );
562 ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
563
565 SetLastError( 0xdeadbeef );
566 ret = WinHttpCrackUrl( url_k6, 0, 0, &uc );
567 ok( !ret, "WinHttpCrackUrl succeeded\n" );
570
572 SetLastError( 0xdeadbeef );
573 ret = WinHttpCrackUrl( url_k7, 0, 0, &uc );
574 ok( !ret, "WinHttpCrackUrl succeeded\n" );
577
579 SetLastError( 0xdeadbeef );
580 ret = WinHttpCrackUrl( url_k8, 0, 0, &uc );
582 ok( !ret, "WinHttpCrackUrl succeeded\n" );
584
586 ret = WinHttpCrackUrl( url_k9, 0, 0, &uc );
587 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
588 ok( uc.lpszUrlPath == url_k9 + 14 || broken(uc.lpszUrlPath == url_k9 + 13) /* win8 */,
589 "unexpected path: %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
590 ok( uc.dwUrlPathLength == 0, "unexpected path length: %u\n", uc.dwUrlPathLength );
591 ok( uc.lpszExtraInfo == url_k9 + 14 || broken(uc.lpszExtraInfo == url_k9 + 13) /* win8 */,
592 "unexpected extra info: %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
593 ok( uc.dwExtraInfoLength == 0 || broken(uc.dwExtraInfoLength == 1) /* win8 */,
594 "unexpected extra info length: %u\n", uc.dwExtraInfoLength );
595
597 ret = WinHttpCrackUrl( url_k10, 0, 0, &uc );
598 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
599 ok( uc.lpszUrlPath == url_k10 + 13, "unexpected path: %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
600 ok( uc.dwUrlPathLength == 7, "unexpected path length: %u\n", uc.dwUrlPathLength );
601 ok( uc.lpszExtraInfo == url_k10 + 20, "unexpected extra info: %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
602 ok( uc.dwExtraInfoLength == 0, "unexpected extra info length: %u\n", uc.dwExtraInfoLength );
603
605 SetLastError( 0xdeadbeef );
606 ret = WinHttpCrackUrl( url4, 0, 0, &uc );
608 ok( !ret, "WinHttpCrackUrl succeeded\n" );
609 ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
610
612 SetLastError( 0xdeadbeef );
613 ret = WinHttpCrackUrl( empty, 0, 0, &uc );
615 ok( !ret, "WinHttpCrackUrl succeeded\n" );
617
618 SetLastError( 0xdeadbeef );
619 ret = WinHttpCrackUrl( url1, 0, 0, NULL );
621 ok( !ret, "WinHttpCrackUrl succeeded\n" );
622 ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
623
624 SetLastError( 0xdeadbeef );
625 ret = WinHttpCrackUrl( NULL, 0, 0, &uc );
627 ok( !ret, "WinHttpCrackUrl succeeded\n" );
628 ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
629
630 /* decoding without buffers */
632 SetLastError(0xdeadbeef);
633 ret = WinHttpCrackUrl( url7, 0, ICU_DECODE, &uc );
635 ok( !ret, "WinHttpCrackUrl succeeded\n" );
636 ok( error == ERROR_INVALID_PARAMETER, "got %u, expected ERROR_INVALID_PARAMETER\n", error );
637
638 /* decoding with buffers */
639 uc.lpszScheme = scheme;
640 uc.dwSchemeLength = 20;
641 uc.lpszUserName = user;
642 uc.dwUserNameLength = 20;
643 uc.lpszPassword = pass;
644 uc.dwPasswordLength = 20;
645 uc.lpszHostName = host;
646 uc.dwHostNameLength = 20;
647 uc.nPort = 0;
648 uc.lpszUrlPath = path;
649 uc.dwUrlPathLength = 80;
650 uc.lpszExtraInfo = extra;
651 uc.dwExtraInfoLength = 40;
652 path[0] = 0;
653
654 ret = WinHttpCrackUrl( url7, 0, ICU_DECODE, &uc );
655 ok( ret, "WinHttpCrackUrl failed %u\n", GetLastError() );
656 ok( !memcmp( uc.lpszUrlPath + 11, escape, 21 * sizeof(WCHAR) ), "unexpected path\n" );
657 ok( uc.dwUrlPathLength == 32, "unexpected path length %u\n", uc.dwUrlPathLength );
658 ok( !memcmp( uc.lpszExtraInfo, escape + 21, 12 * sizeof(WCHAR) ), "unexpected extra info\n" );
659 ok( uc.dwExtraInfoLength == 12, "unexpected extra info length %u\n", uc.dwExtraInfoLength );
660
661 /* Urls with specified port numbers */
662 /* decoding with buffers */
663 uc.lpszScheme = scheme;
664 uc.dwSchemeLength = 20;
665 uc.lpszUserName = user;
666 uc.dwUserNameLength = 20;
667 uc.lpszPassword = pass;
668 uc.dwPasswordLength = 20;
669 uc.lpszHostName = host;
670 uc.dwHostNameLength = 20;
671 uc.nPort = 0;
672 uc.lpszUrlPath = path;
673 uc.dwUrlPathLength = 40;
674 uc.lpszExtraInfo = extra;
675 uc.dwExtraInfoLength = 20;
676 path[0] = 0;
677
678 ret = WinHttpCrackUrl( url6, 0, 0, &uc );
679 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
680 ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected host name: %s\n", wine_dbgstr_w(uc.lpszHostName) );
681 ok( uc.dwHostNameLength == 14, "unexpected host name length: %d\n", uc.dwHostNameLength );
682 ok( uc.nPort == 42, "unexpected port: %u\n", uc.nPort );
683
684 /* decoding without buffers */
686 ret = WinHttpCrackUrl( url8, 0, 0, &uc );
687 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
688 ok( uc.nPort == 0, "unexpected port: %u\n", uc.nPort );
689
691 ret = WinHttpCrackUrl( url9, 0, 0, &uc );
692 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
693 ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
694
696 ret = WinHttpCrackUrl( url10, 0, 0, &uc );
697 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
698 ok( uc.nPort == 443, "unexpected port: %u\n", uc.nPort );
699
701 SetLastError( 0xdeadbeef );
702 ret = WinHttpCrackUrl( empty, 0, 0, &uc );
704 ok( !ret, "WinHttpCrackUrl succeeded\n" );
705 ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u, expected ERROR_WINHTTP_UNRECOGNIZED_SCHEME\n", error );
706
708 SetLastError( 0xdeadbeef );
709 ret = WinHttpCrackUrl( http, 0, 0, &uc );
711 ok( !ret, "WinHttpCrackUrl succeeded\n" );
712 ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u, expected ERROR_WINHTTP_UNRECOGNIZED_SCHEME\n", error );
713
715 ret = WinHttpCrackUrl( url11, 0, 0, &uc);
716 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
717 ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
718 ok( uc.lpszScheme == url11,"unexpected scheme\n" );
719 ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
720 ok( uc.lpszUserName == NULL, "unexpected username\n" );
721 ok( uc.lpszPassword == NULL, "unexpected password\n" );
722 ok( uc.lpszHostName == url11 + 7, "unexpected hostname\n" );
723 ok( uc.dwHostNameLength == 11, "unexpected hostname length\n" );
724 ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
725 ok( uc.lpszUrlPath == url11 + 18, "unexpected path\n" );
726 ok( uc.dwUrlPathLength == 5, "unexpected path length\n" );
727 ok( uc.lpszExtraInfo == url11 + 23, "unexpected extra info\n" );
728 ok( uc.dwExtraInfoLength == 39, "unexpected extra info length\n" );
729
730 uc.lpszScheme = scheme;
731 uc.dwSchemeLength = 20;
732 uc.lpszHostName = host;
733 uc.dwHostNameLength = 20;
734 uc.lpszUserName = NULL;
735 uc.dwUserNameLength = 0;
736 uc.lpszPassword = NULL;
737 uc.dwPasswordLength = 0;
738 uc.lpszUrlPath = path;
739 uc.dwUrlPathLength = 40;
740 uc.lpszExtraInfo = NULL;
741 uc.dwExtraInfoLength = 0;
742 uc.nPort = 0;
743 ret = WinHttpCrackUrl( url12, 0, ICU_DECODE, &uc );
744 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
745
746 uc.lpszScheme = scheme;
747 uc.dwSchemeLength = 20;
748 uc.lpszHostName = host;
749 uc.dwHostNameLength = 20;
750 uc.lpszUserName = NULL;
751 uc.dwUserNameLength = 0;
752 uc.lpszPassword = NULL;
753 uc.dwPasswordLength = 0;
754 uc.lpszUrlPath = path;
755 uc.dwUrlPathLength = 40;
756 uc.lpszExtraInfo = NULL;
757 uc.dwExtraInfoLength = 0;
758 uc.nPort = 0;
760 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
761 ok( !lstrcmpW( uc.lpszHostName, hostnameW ), "unexpected host name\n" );
762 ok( !lstrcmpW( uc.lpszUrlPath, pathW ), "unexpected path\n" );
763 ok( uc.dwUrlPathLength == lstrlenW(pathW), "got %u\n", uc.dwUrlPathLength );
764
765 uc.dwStructSize = sizeof(uc);
766 uc.lpszScheme = NULL;
767 uc.dwSchemeLength = 0;
768 uc.nScheme = 0;
769 uc.lpszHostName = NULL;
770 uc.dwHostNameLength = ~0u;
771 uc.nPort = 0;
772 uc.lpszUserName = NULL;
773 uc.dwUserNameLength = ~0u;
774 uc.lpszPassword = NULL;
775 uc.dwPasswordLength = ~0u;
776 uc.lpszUrlPath = NULL;
777 uc.dwUrlPathLength = ~0u;
778 uc.lpszExtraInfo = NULL;
779 uc.dwExtraInfoLength = ~0u;
780 ret = WinHttpCrackUrl( url14, 0, 0, &uc );
781 ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
782 ok( !uc.lpszScheme, "unexpected scheme %s\n", wine_dbgstr_w(uc.lpszScheme) );
783 ok( !uc.dwSchemeLength, "unexpected length %u\n", uc.dwSchemeLength );
784 ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme %u\n", uc.nScheme );
785 ok( !lstrcmpW( uc.lpszHostName, url14 + 7 ), "unexpected hostname %s\n", wine_dbgstr_w(uc.lpszHostName) );
786 ok( uc.dwHostNameLength == 14, "unexpected length %u\n", uc.dwHostNameLength );
787 ok( uc.nPort == 80, "unexpected port %u\n", uc.nPort );
788 ok( !uc.lpszUserName, "unexpected username\n" );
789 ok( !uc.dwUserNameLength, "unexpected length %u\n", uc.dwUserNameLength );
790 ok( !uc.lpszPassword, "unexpected password\n" );
791 ok( !uc.dwPasswordLength, "unexpected length %u\n", uc.dwPasswordLength );
792 ok( !lstrcmpW( uc.lpszUrlPath, url14 + 21 ), "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
793 ok( uc.dwUrlPathLength == 5, "unexpected length %u\n", uc.dwUrlPathLength );
794 ok( !uc.lpszExtraInfo[0], "unexpected extra info %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
795 ok( uc.dwExtraInfoLength == 0, "unexpected length %u\n", uc.dwExtraInfoLength );
796
797 uc.dwStructSize = sizeof(uc);
798 uc.lpszScheme = scheme;
799 uc.dwSchemeLength = 0;
800 uc.nScheme = 0;
801 uc.lpszHostName = NULL;
802 uc.dwHostNameLength = 0;
803 uc.nPort = 0;
804 uc.lpszUserName = NULL;
805 uc.dwUserNameLength = ~0u;
806 uc.lpszPassword = NULL;
807 uc.dwPasswordLength = ~0u;
808 uc.lpszUrlPath = NULL;
809 uc.dwUrlPathLength = 0;
810 uc.lpszExtraInfo = NULL;
811 uc.dwExtraInfoLength = 0;
812 SetLastError( 0xdeadbeef );
813 ret = WinHttpCrackUrl( url14, 0, 0, &uc );
815 ok( !ret, "WinHttpCrackUrl succeeded\n" );
816 ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
817 ok( !lstrcmpW( uc.lpszScheme, http ), "unexpected scheme %s\n", wine_dbgstr_w(uc.lpszScheme) );
818 ok( !uc.dwSchemeLength, "unexpected length %u\n", uc.dwSchemeLength );
819 ok( uc.nScheme == 0, "unexpected scheme %u\n", uc.nScheme );
820 ok( !uc.lpszHostName, "unexpected hostname %s\n", wine_dbgstr_w(uc.lpszHostName) );
821 ok( uc.dwHostNameLength == 0, "unexpected length %u\n", uc.dwHostNameLength );
822 ok( uc.nPort == 0, "unexpected port %u\n", uc.nPort );
823 ok( !uc.lpszUserName, "unexpected username\n" );
824 ok( uc.dwUserNameLength == ~0u, "unexpected length %u\n", uc.dwUserNameLength );
825 ok( !uc.lpszPassword, "unexpected password\n" );
826 ok( uc.dwPasswordLength == ~0u, "unexpected length %u\n", uc.dwPasswordLength );
827 ok( !uc.lpszUrlPath, "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
828 ok( uc.dwUrlPathLength == 0, "unexpected length %u\n", uc.dwUrlPathLength );
829 ok( !uc.lpszExtraInfo, "unexpected extra info %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
830 ok( uc.dwExtraInfoLength == 0, "unexpected length %u\n", uc.dwExtraInfoLength );
831
833 SetLastError( 0xdeadbeef );
834 ret = WinHttpCrackUrl( url15, 0, 0, &uc );
836 ok( !ret, "WinHttpCrackUrl succeeded\n" );
837 ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
838
840 uc.nPort = 1;
841 ret = WinHttpCrackUrl( url16, 0, 0, &uc );
842 ok( ret, "got %u\n", GetLastError() );
843 ok( !uc.nPort, "got %u\n", uc.nPort );
844
846 uc.nPort = 1;
847 ret = WinHttpCrackUrl( url17, 0, 0, &uc );
848 ok( ret, "got %u\n", GetLastError() );
849 todo_wine ok( uc.nPort == 80, "got %u\n", uc.nPort );
850
851 memset( &uc, 0, sizeof(uc) );
852 uc.dwStructSize = sizeof(uc);
853 uc.lpszScheme = scheme;
855 uc.lpszHostName = host;
857 uc.lpszUrlPath = path;
859 ret = WinHttpCrackUrl( url21, 0, 0, &uc );
860 ok( ret, "got %u\n", GetLastError() );
861 ok( !lstrcmpW( uc.lpszUrlPath, url21 + 37 ), "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
862 ok( uc.dwUrlPathLength == 50, "unexpected length %u\n", uc.dwUrlPathLength );
863}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
void user(int argc, const char *argv[])
Definition: cmds.c:1350
#define ARRAY_SIZE(A)
Definition: main.h:20
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
BOOL WINAPI WinHttpCrackUrl(LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONENTSW uc)
Definition: url.c:179
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
@ extra
Definition: id3.c:95
#define wine_dbgstr_w
Definition: kernel32.h:34
#define error(str)
Definition: mkdosfs.c:1605
#define todo_wine
Definition: custom.c:89
static const WCHAR url1[]
Definition: misc.c:300
static const WCHAR url6[]
Definition: url.c:51
static const WCHAR url15[]
Definition: url.c:75
static WCHAR empty[]
Definition: url.c:28
static const WCHAR url_k6[]
Definition: url.c:100
static const WCHAR url_k2[]
Definition: url.c:92
static const WCHAR url4[]
Definition: url.c:47
static void reset_url_components(URL_COMPONENTS *uc)
Definition: url.c:415
static const WCHAR url_k10[]
Definition: url.c:108
static const WCHAR url8[]
Definition: url.c:59
static const WCHAR url14[]
Definition: url.c:74
static const WCHAR url_k4[]
Definition: url.c:96
static const WCHAR url_k8[]
Definition: url.c:104
static WCHAR escape[]
Definition: url.c:36
static const WCHAR url11[]
Definition: url.c:68
static const WCHAR url21[]
Definition: url.c:84
static const WCHAR url16[]
Definition: url.c:76
static const WCHAR url_k5[]
Definition: url.c:98
static const WCHAR url_k3[]
Definition: url.c:94
static const WCHAR url13[]
Definition: url.c:72
static const WCHAR url9[]
Definition: url.c:62
static const WCHAR url_k7[]
Definition: url.c:102
static const WCHAR url_k1[]
Definition: url.c:89
static const WCHAR url17[]
Definition: url.c:77
static const WCHAR url_k9[]
Definition: url.c:106
static const WCHAR url10[]
Definition: url.c:65
static const WCHAR url12[]
Definition: url.c:70
static const WCHAR url7[]
Definition: url.c:54
DWORD scheme
DWORD dwStructSize
Definition: wininet.h:211
DWORD dwUrlPathLength
Definition: wininet.h:223
DWORD dwExtraInfoLength
Definition: wininet.h:225
LPWSTR lpszPassword
Definition: wininet.h:220
LPWSTR lpszHostName
Definition: wininet.h:215
DWORD dwUserNameLength
Definition: wininet.h:219
DWORD dwHostNameLength
Definition: wininet.h:216
INTERNET_SCHEME nScheme
Definition: wininet.h:214
LPWSTR lpszScheme
Definition: wininet.h:212
LPWSTR lpszUserName
Definition: wininet.h:218
LPWSTR lpszUrlPath
Definition: wininet.h:222
LPWSTR lpszExtraInfo
Definition: wininet.h:224
DWORD dwPasswordLength
Definition: wininet.h:221
INTERNET_PORT nPort
Definition: wininet.h:217
DWORD dwSchemeLength
Definition: wininet.h:213
pass
Definition: typegen.h:25
int ret
char * host
Definition: whois.c:55
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_WINHTTP_INVALID_URL
Definition: winhttp.h:191
#define ICU_DECODE
Definition: winhttp.h:291
#define ERROR_WINHTTP_UNRECOGNIZED_SCHEME
Definition: winhttp.h:192
#define INTERNET_SCHEME_HTTPS
Definition: winhttp.h:43
#define ICU_ESCAPE
Definition: winhttp.h:48
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ WinHttpCreateUrl_test()

static void WinHttpCreateUrl_test ( void  )
static

Definition at line 130 of file url.c.

131{
133 WCHAR *url;
134 DWORD len, err;
135 BOOL ret;
136
137 /* NULL components */
138 len = ~0u;
139 SetLastError( 0xdeadbeef );
140 ret = WinHttpCreateUrl( NULL, 0, NULL, &len );
141 ok( !ret, "expected failure\n" );
142 ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
143 ok( len == ~0u, "expected len ~0u got %u\n", len );
144
145 /* zero'ed components */
146 memset( &uc, 0, sizeof(URL_COMPONENTS) );
147 SetLastError( 0xdeadbeef );
148 ret = WinHttpCreateUrl( &uc, 0, NULL, &len );
149 ok( !ret, "expected failure\n" );
150 ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
151 ok( len == ~0u, "expected len ~0u got %u\n", len );
152
153 /* valid components, NULL url, NULL length */
154 fill_url_components( &uc );
155 SetLastError( 0xdeadbeef );
156 ret = WinHttpCreateUrl( &uc, 0, NULL, NULL );
157 ok( !ret, "expected failure\n" );
158 ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
159
160 /* valid components, NULL url, insufficient length */
161 len = 0;
162 SetLastError( 0xdeadbeef );
163 ret = WinHttpCreateUrl( &uc, 0, NULL, &len );
164 ok( !ret, "expected failure\n" );
165 ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER got %u\n", GetLastError() );
166 ok( len == 57, "expected len 57 got %u\n", len );
167
168 /* valid components, NULL url, sufficient length */
169 SetLastError( 0xdeadbeef );
170 len = 256;
171 ret = WinHttpCreateUrl( &uc, 0, NULL, &len );
172 err = GetLastError();
173 ok( !ret, "expected failure\n" );
175 "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
176 ok( len == 256 || broken(len == 57) /* < win7 */, "expected len 256 got %u\n", len );
177
178 /* correct size, NULL url */
179 fill_url_components( &uc );
180 SetLastError( 0xdeadbeef );
181 ret = WinHttpCreateUrl( &uc, 0, NULL, &len );
182 err = GetLastError();
183 ok( !ret, "expected failure\n" );
185 "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
186 ok( len == 256 || broken(len == 57) /* < win7 */, "expected len 256 got %u\n", len );
187
188 /* valid components, allocated url, short length */
189 SetLastError( 0xdeadbeef );
190 url = HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(WCHAR) );
191 url[0] = 0;
192 len = 2;
193 ret = WinHttpCreateUrl( &uc, 0, url, &len );
194 ok( !ret, "expected failure\n" );
195 ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER got %u\n", GetLastError() );
196 ok( len == 57, "expected len 57 got %u\n", len );
197
198 /* allocated url, NULL scheme */
199 SetLastError( 0xdeadbeef );
200 uc.lpszScheme = NULL;
201 url[0] = 0;
202 len = 256;
203 ret = WinHttpCreateUrl( &uc, 0, url, &len );
204 ok( ret, "expected success\n" );
205 ok( GetLastError() == ERROR_SUCCESS || broken(GetLastError() == 0xdeadbeef) /* < win7 */,
206 "expected ERROR_SUCCESS got %u\n", GetLastError() );
207 ok( len == 56, "expected len 56 got %u\n", len );
208 ok( !lstrcmpW( url, url1 ), "url doesn't match\n" );
209
210 /* allocated url, 0 scheme */
211 fill_url_components( &uc );
212 uc.nScheme = 0;
213 url[0] = 0;
214 len = 256;
215 ret = WinHttpCreateUrl( &uc, 0, url, &len );
216 ok( ret, "expected success\n" );
217 ok( len == 56, "expected len 56 got %u\n", len );
218
219 /* valid components, allocated url */
220 fill_url_components( &uc );
221 url[0] = 0;
222 len = 256;
223 ret = WinHttpCreateUrl( &uc, 0, url, &len );
224 ok( ret, "expected success\n" );
225 ok( len == 56, "expected len 56 got %d\n", len );
226 ok( !lstrcmpW( url, url1 ), "url doesn't match\n" );
227
228 /* valid username, NULL password */
229 fill_url_components( &uc );
230 uc.lpszPassword = NULL;
231 url[0] = 0;
232 len = 256;
233 ret = WinHttpCreateUrl( &uc, 0, url, &len );
234 ok( ret, "expected success\n" );
235
236 /* valid username, empty password */
237 fill_url_components( &uc );
238 uc.lpszPassword = empty;
239 url[0] = 0;
240 len = 256;
241 ret = WinHttpCreateUrl( &uc, 0, url, &len );
242 ok( ret, "expected success\n" );
243 ok( len == 56, "expected len 56 got %u\n", len );
244 ok( !lstrcmpW( url, url2 ), "url doesn't match\n" );
245
246 /* valid password, NULL username */
247 fill_url_components( &uc );
248 SetLastError( 0xdeadbeef );
249 uc.lpszUserName = NULL;
250 url[0] = 0;
251 len = 256;
252 ret = WinHttpCreateUrl( &uc, 0, url, &len );
253 ok( !ret, "expected failure\n" );
254 ok( GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
255
256 /* valid password, empty username */
257 fill_url_components( &uc );
258 uc.lpszUserName = empty;
259 url[0] = 0;
260 len = 256;
261 ret = WinHttpCreateUrl( &uc, 0, url, &len );
262 ok( ret, "expected success\n");
263
264 /* NULL username, NULL password */
265 fill_url_components( &uc );
266 uc.lpszUserName = NULL;
267 uc.lpszPassword = NULL;
268 url[0] = 0;
269 len = 256;
270 ret = WinHttpCreateUrl( &uc, 0, url, &len );
271 ok( ret, "expected success\n" );
272 ok( len == 38, "expected len 38 got %u\n", len );
273 ok( !lstrcmpW( url, url3 ), "url doesn't match\n" );
274
275 /* empty username, empty password */
276 fill_url_components( &uc );
277 uc.lpszUserName = empty;
278 uc.lpszPassword = empty;
279 url[0] = 0;
280 len = 256;
281 ret = WinHttpCreateUrl( &uc, 0, url, &len );
282 ok( ret, "expected success\n" );
283 ok( len == 56, "expected len 56 got %u\n", len );
284 ok( !lstrcmpW( url, url4 ), "url doesn't match\n" );
285
286 /* nScheme has lower precedence than lpszScheme */
287 fill_url_components( &uc );
288 uc.lpszScheme = ftp;
290 url[0] = 0;
291 len = 256;
292 ret = WinHttpCreateUrl( &uc, 0, url, &len );
293 ok( ret, "expected success\n" );
294 ok( len == lstrlenW( url5 ), "expected len %d got %u\n", lstrlenW( url5 ) + 1, len );
295 ok( !lstrcmpW( url, url5 ), "url doesn't match\n" );
296
297 /* non-standard port */
298 uc.lpszScheme = http;
300 uc.nPort = 42;
301 url[0] = 0;
302 len = 256;
303 ret = WinHttpCreateUrl( &uc, 0, url, &len );
304 ok( ret, "expected success\n" );
305 ok( len == 59, "expected len 59 got %u\n", len );
306 ok( !lstrcmpW( url, url6 ), "url doesn't match\n" );
307
308 /* escape extra info */
309 fill_url_components( &uc );
312 url[0] = 0;
313 len = 256;
315 ok( ret, "expected success\n" );
316 ok( len == 113, "expected len 113 got %u\n", len );
317 ok( !lstrcmpW( url, url7 ), "url doesn't match %s\n", wine_dbgstr_w(url) );
318
319 /* escape extra info */
320 memset( &uc, 0, sizeof(uc) );
321 uc.dwStructSize = sizeof(uc);
324 url[0] = 0;
325 len = 256;
327 ok( ret, "expected success\n" );
328 ok( len == lstrlenW(url18), "expected len %u got %u\n", lstrlenW(url18), len );
329 ok( !lstrcmpW( url, url18 ), "url doesn't match\n" );
330
331 /* extra info with Unicode characters */
332 memset( &uc, 0, sizeof(uc) );
333 uc.dwStructSize = sizeof(uc);
336 url[0] = 0;
337 len = 256;
338 SetLastError( 0xdeadbeef );
340 err = GetLastError();
341 ok( !ret, "expected failure\n" );
342 ok( err == ERROR_INVALID_PARAMETER, "got %u\n", err );
343
344 /* extra info with Unicode characters, no ICU_ESCAPE */
345 memset( &uc, 0, sizeof(uc) );
346 uc.dwStructSize = sizeof(uc);
349 url[0] = 0;
350 len = 256;
351 ret = WinHttpCreateUrl( &uc, 0, url, &len );
352 ok( ret || broken(!ret) /* < win7 */, "expected success\n" );
353 if (ret)
354 {
355 ok( len == lstrlenW(url19), "expected len %u got %u\n", lstrlenW(url19), len );
356 ok( !lstrcmpW( url, url19 ), "url doesn't match %s\n", wine_dbgstr_w(url) );
357 }
358
359 /* escape path */
360 memset( &uc, 0, sizeof(uc) );
361 uc.dwStructSize = sizeof(uc);
362 uc.lpszUrlPath = escape2;
364 url[0] = 0;
365 len = 256;
367 ok( ret, "expected success\n" );
368 ok( len == lstrlenW(url18), "expected len %u got %u\n", lstrlenW(url18), len );
369 ok( !lstrcmpW( url, url18 ), "url doesn't match\n" );
370
371 /* path with Unicode characters */
372 memset( &uc, 0, sizeof(uc) );
373 uc.dwStructSize = sizeof(uc);
374 uc.lpszUrlPath = escape4;
376 url[0] = 0;
377 len = 256;
378 SetLastError( 0xdeadbeef );
380 err = GetLastError();
381 ok( !ret, "expected failure\n" );
382 ok( err == ERROR_INVALID_PARAMETER, "got %u\n", err );
383
384 /* path with Unicode characters, no ICU_ESCAPE */
385 memset( &uc, 0, sizeof(uc) );
386 uc.dwStructSize = sizeof(uc);
387 uc.lpszUrlPath = escape4;
389 url[0] = 0;
390 len = 256;
391 ret = WinHttpCreateUrl( &uc, 0, url, &len );
392 ok( ret || broken(!ret) /* < win7 */, "expected success\n" );
393 if (ret)
394 {
395 ok( len == lstrlenW(url20), "expected len %u got %u\n", lstrlenW(url20), len );
396 ok( !lstrcmpW( url, url20 ), "url doesn't match %s\n", wine_dbgstr_w(url) );
397 }
398
399 /* NULL lpszScheme, 0 nScheme and nPort */
400 fill_url_components( &uc );
401 uc.lpszScheme = NULL;
402 uc.dwSchemeLength = 0;
403 uc.nScheme = 0;
404 uc.nPort = 0;
405 url[0] = 0;
406 len = 256;
407 ret = WinHttpCreateUrl( &uc, 0, url, &len );
408 ok( ret, "expected success\n" );
409 ok( len == 58, "expected len 58 got %u\n", len );
410 ok( !lstrcmpW( url, url8 ), "url doesn't match\n" );
411
412 HeapFree( GetProcessHeap(), 0, url );
413}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL WINAPI WinHttpCreateUrl(LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDWORD required)
Definition: url.c:437
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR url[]
Definition: encode.c:1432
static const WCHAR url2[]
Definition: misc.c:302
static WCHAR escape4[]
Definition: url.c:39
static const WCHAR url5[]
Definition: url.c:48
static WCHAR ftp[]
Definition: url.c:29
static WCHAR escape3[]
Definition: url.c:38
static const WCHAR url20[]
Definition: url.c:82
static void fill_url_components(URL_COMPONENTS *uc)
Definition: url.c:111
static const WCHAR url19[]
Definition: url.c:80
static WCHAR escape2[]
Definition: url.c:37
static const WCHAR url3[]
Definition: url.c:45
static const WCHAR url18[]
Definition: url.c:78
#define err(...)

Referenced by START_TEST().

Variable Documentation

◆ about

WCHAR about[] = {'/','s','i','t','e','/','a','b','o','u','t',0}
static

Definition at line 34 of file url.c.

Referenced by fill_url_components(), InternetCreateUrlA_test(), and WinHttpCrackUrl_test().

◆ empty

WCHAR empty[] = {0}
static

◆ escape

WCHAR escape[] = {' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',':',';','<','=','>','?','@','[','\\',']','^','_','`','{','|','}','~',0}
static

◆ escape2

WCHAR escape2[] = {'\r',0x1f,' ','\n',0x7f,'\r','\n',0}
static

Definition at line 37 of file url.c.

Referenced by WinHttpCreateUrl_test().

◆ escape3

WCHAR escape3[] = {'?','t','e','x','t','=',0xfb00,0}
static

Definition at line 38 of file url.c.

Referenced by WinHttpCreateUrl_test().

◆ escape4

WCHAR escape4[] = {'/','t','e','x','t','=',0xfb00,0}
static

Definition at line 39 of file url.c.

Referenced by WinHttpCreateUrl_test().

◆ ftp

WCHAR ftp[] = {'f','t','p',0}
static

Definition at line 29 of file url.c.

Referenced by FTPInitLibrary(), and WinHttpCreateUrl_test().

◆ http

WCHAR http[] = {'h','t','t','p',0}
static

◆ password

WCHAR password[] = {'p','a','s','s','w','o','r','d',0}
static

Definition at line 33 of file url.c.

Referenced by _CZipAskPassword(), canonicalize_password(), CredPackAuthenticationBufferW(), CredUnPackAuthenticationBufferW(), do_authorization(), event_redirect(), export_password_dlg_proc(), fill_url_components(), find_existing_credential(), HTMLXMLHttpRequest_open(), HTTP_DoAuthorization(), InternetCrackUrl_test(), InternetCreateUrlA_test(), iso_connect(), CZipCreatorImpl::JustDoIt(), main(), MAPILogon(), MAPILogonEx(), mcs_connect_start(), ntlm_AcquireCredentialsHandleW(), ntlm_InitializeSecurityContextW(), SEALED_::OnRedirect(), POP3Transport_CommandPASS(), process_redirect_pdu(), rdp2vnc_connect(), rdp_connect(), rdp_reconnect(), rdp_send_logon_info(), read_password(), rpcrt4_http_internet_connect(), sec_connect(), SECUR32_CreateNTLM1SessionKey(), set_credentials(), set_request_credentials(), SspiPromptForCredentialsW(), SystemFunction006(), test_create_delete_svc(), test_CredUIPromptForCredentials(), test_espassword(), test_HlinkCreateExtensionServices(), test_IWinHttpRequest(), test_proxy_direct(), test_queryconfig2(), test_sequence(), test_SspiEncodeStringsAsAuthIdentity(), unzOpenCurrentFile3(), unzOpenCurrentFilePassword(), UserLoginThread(), winhttp_request_SetCredentials(), WinHttpCrackUrl(), WinHttpCrackUrl_test(), WinHttpSetCredentials(), WININET_PasswordDialog(), WININET_ProxyPasswordDialog(), WININET_SetAuthorization(), WNetUseConnectionA(), WNetUseConnectionW(), zipOpenNewFileInZip3(), zipOpenNewFileInZip3_64(), zipOpenNewFileInZip4(), and zipOpenNewFileInZip4_64().

◆ query

WCHAR query[] = {'?','q','u','e','r','y',0}
static

Definition at line 35 of file url.c.

Referenced by fill_url_components().

◆ url1

const WCHAR url1[]
static
Initial value:
=
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
'@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}

Definition at line 41 of file url.c.

◆ url10

const WCHAR url10[]
static
Initial value:
=
{'h','t','t','p','s',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
'@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','4','4','3','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}

Definition at line 65 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url11

const WCHAR url11[]
static
Initial value:
=
{'h','t','t','p',':','/','/','e','x','a','m','p','l','e','.','n','e','t','/','p','a','t','h','?','v','a','r','1','=','e','x','a','m','p','l','e','@','e','x','a','m','p','l','e','.','c','o','m','&','v','a','r','2','=','x','&','v','a','r','3','=','y', 0}

Definition at line 68 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url12

const WCHAR url12[]
static
Initial value:
=
{'h','t','t','p','s',':','/','/','t','o','o','l','s','.','g','o','o','g','l','e','.','c','o','m','/','s','e','r','v','i','c','e','/','u','p','d','a','t','e','2','?','w','=','3',':','B','x','D','H','o','W','y','8','e','z','M',0}

Definition at line 70 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url13

const WCHAR url13[]
static
Initial value:
=
{'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o',' ','g','/','p','a','t','h',' ','w','i','t','h',' ','s','p','a','c','e','s',0}

Definition at line 72 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url14

const WCHAR url14[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t',0}
static

Definition at line 74 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url15

const WCHAR url15[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':','6','5','5','3','6',0}
static

Definition at line 75 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url16

const WCHAR url16[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':','0',0}
static

Definition at line 76 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url17

const WCHAR url17[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':',0}
static

Definition at line 77 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url18

const WCHAR url18[]
static
Initial value:
=
{'h','t','t','p',':','/','/','%','0','D','%','1','F','%','2','0','%','0','A','%','7','F','%','0','D','%','0','A',0}

Definition at line 78 of file url.c.

Referenced by WinHttpCreateUrl_test().

◆ url19

const WCHAR url19[]
static
Initial value:
=
{'h','t','t','p',':','/','/','?','t','e','x','t','=',0xfb00,0}

Definition at line 80 of file url.c.

Referenced by WinHttpCreateUrl_test().

◆ url2

const WCHAR url2[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':',0}
static

Definition at line 44 of file url.c.

◆ url20

const WCHAR url20[]
static
Initial value:
=
{'h','t','t','p',':','/','/','/','t','e','x','t','=',0xfb00,0}

Definition at line 82 of file url.c.

Referenced by WinHttpCreateUrl_test().

◆ url21

const WCHAR url21[]
static
Initial value:
=
{'h','t','t','p','s',':','/','/','n','b','a','2','k','1','9','-','w','s','.','2','k','s','p','o','r','t','s','.','c','o','m',':','1','9','1','3','3',
'/','n','b','a','/','v','4','/','A','c','c','o','u','n','t','s','/','g','e','t','_','a','c','c','o','u','n','t','?','x','=','3','7','8','9','5','2',
'6','7','7','5','2','6','5','6','6','3','8','7','6',0}

Definition at line 84 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url3

const WCHAR url3[]
static
Initial value:
=
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}

Definition at line 45 of file url.c.

Referenced by InternetCrackUrlW_test(), and WinHttpCreateUrl_test().

◆ url4

const WCHAR url4[] = {'h','t','t','p',':','/','/',0}
static

Definition at line 47 of file url.c.

Referenced by WinHttpCrackUrl_test(), and WinHttpCreateUrl_test().

◆ url5

const WCHAR url5[]
static
Initial value:
=
{'f','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
'@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','8','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}

Definition at line 48 of file url.c.

Referenced by WinHttpCreateUrl_test().

◆ url6

const WCHAR url6[]
static
Initial value:
=
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
'@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','4','2','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}

Definition at line 51 of file url.c.

Referenced by WinHttpCrackUrl_test(), and WinHttpCreateUrl_test().

◆ url7

const WCHAR url7[]
static
Initial value:
=
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
'@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t',
'%','2','0','!','%','2','2','%','2','3','$','%','2','5','&','\'','(',')','*','+',',','-','.','/',':',';','%','3','C','=','%','3','E','?','@','%',
'5','B','%','5','C','%','5','D','%','5','E','_','%','6','0','%','7','B','%','7','C','%','7','D','%','7','E',0}

Definition at line 54 of file url.c.

Referenced by WinHttpCrackUrl_test(), and WinHttpCreateUrl_test().

◆ url8

const WCHAR url8[]
static
Initial value:
=
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
'@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}

Definition at line 59 of file url.c.

Referenced by WinHttpCrackUrl_test(), and WinHttpCreateUrl_test().

◆ url9

const WCHAR url9[]
static
Initial value:
=
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
'@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','8','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}

Definition at line 62 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url_k1

const WCHAR url_k1[]
static
Initial value:
=
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
'@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t',0}

Definition at line 89 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url_k10

const WCHAR url_k10[]
static
Initial value:
=
{'h','t','t','p',':','/','/','w','i','n','e','h','q','/','p','o','s','t',';','a',0}

Definition at line 108 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url_k2

const WCHAR url_k2[]
static
Initial value:
=
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}

Definition at line 92 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url_k3

const WCHAR url_k3[]
static
Initial value:
=
{'h','t','t','p','s',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','p','o','s','t','?',0}

Definition at line 94 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url_k4

const WCHAR url_k4[]
static
Initial value:
=
{'H','T','T','P',':','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}

Definition at line 96 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url_k5

const WCHAR url_k5[]
static
Initial value:
=
{'h','t','t','p',':','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}

Definition at line 98 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url_k6

const WCHAR url_k6[]
static
Initial value:
=
{'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}

Definition at line 100 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url_k7

const WCHAR url_k7[]
static
Initial value:
=
{'w','w','w',0}

Definition at line 102 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url_k8

const WCHAR url_k8[]
static
Initial value:
=
{'h','t','t','p',0}

Definition at line 104 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ url_k9

const WCHAR url_k9[]
static
Initial value:
=
{'h','t','t','p',':','/','/','w','i','n','e','h','q','?',0}

Definition at line 106 of file url.c.

Referenced by WinHttpCrackUrl_test().

◆ username

WCHAR username[] = {'u','s','e','r','n','a','m','e',0}
static

Definition at line 32 of file url.c.

Referenced by _build_action_map(), _configure_devices(), _set_action_map(), canonicalize_username(), CredPackAuthenticationBufferW(), CredUnPackAuthenticationBufferW(), del_mapping_key(), do_authorization(), event_redirect(), fill_url_components(), find_existing_credential(), get_mapping_key(), InternetCreateUrlA_test(), iso_connect(), iso_send_connection_request(), JoystickWGenericImpl_BuildActionMap(), load_mapping_settings(), map_user_to_ids(), mcs_connect_start(), NetFileEnum(), NetGroupAddUser(), NetGroupDelUser(), NetSessionDel(), NetSessionEnum(), NetSessionGetInfo(), NetUserChangePassword(), NetUserDel(), NetUserGetGroups(), NetUserGetInfo(), NetUserGetLocalGroups(), NetUserSetGroups(), NetUserSetInfo(), nfs41_client_owner(), nfs41_idmap_name_to_ids(), ntlm_InitializeSecurityContextW(), SEALED_::OnRedirect(), POP3Transport_CommandUSER(), process_redirect_pdu(), rdp_connect(), rdp_reconnect(), sec_connect(), set_credentials(), set_installer_properties(), set_request_credentials(), should_enumerate_device(), SspiPromptForCredentialsW(), test_create_delete_svc(), test_CredMarshalCredentialA(), test_CredUIPromptForCredentials(), test_CredUnmarshalCredentialA(), test_HlinkCreateExtensionServices(), test_IWinHttpRequest(), test_MsiSourceListAddSource(), test_proxy_direct(), test_RpcServerInqDefaultPrincName(), test_SspiEncodeStringsAsAuthIdentity(), test_SspiPrepareForCredWrite(), test_SspiPromptForCredentials(), test_Win32_ComputerSystem(), username_cmp(), winhttp_request_SetCredentials(), WinHttpCrackUrl(), WinHttpCrackUrl_test(), WinHttpSetCredentials(), WININET_PasswordDialog(), WININET_ProxyPasswordDialog(), WININET_SetAuthorization(), and WTSQuerySessionInformationW().

◆ winehq

WCHAR winehq[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}
static