static const WCHAR url1[] =
{'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};
-static const WCHAR url2[] =
- {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',
- '@','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};
-static const WCHAR url3[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':',0};
-static const WCHAR url4[] =
+static const WCHAR url2[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':',0};
+static const WCHAR url3[] =
{'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};
-static const WCHAR url5[] = {'h','t','t','p',':','/','/',0};
-static const WCHAR url6[] =
+static const WCHAR url4[] = {'h','t','t','p',':','/','/',0};
+static const WCHAR url5[] =
{'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};
-static const WCHAR url7[] =
+static const WCHAR url6[] =
{'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};
-static const WCHAR url8[] =
+static const WCHAR url7[] =
{'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};
-static const WCHAR url9[] =
+static const WCHAR url8[] =
{'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};
-static const WCHAR url10[] =
+static const WCHAR url9[] =
{'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};
-static const WCHAR url11[] =
+static const WCHAR url10[] =
{'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};
-static const WCHAR url12[] =
+static const WCHAR url11[] =
{'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};
-static const WCHAR url13[] =
+static const WCHAR url12[] =
{'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};
-static const WCHAR url14[] =
+static const WCHAR url13[] =
{'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};
+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 url_k1[] =
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
ok( len == 57, "expected len 57 got %u\n", len );
/* allocated url, NULL scheme */
+ SetLastError( 0xdeadbeef );
uc.lpszScheme = NULL;
url[0] = 0;
len = 256;
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
+ ok( GetLastError() == ERROR_SUCCESS || broken(GetLastError() == 0xdeadbeef) /* < win7 */,
+ "expected ERROR_SUCCESS got %u\n", GetLastError() );
ok( len == 56, "expected len 56 got %u\n", len );
ok( !lstrcmpW( url, url1 ), "url doesn't match\n" );
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
ok( len == 56, "expected len 56 got %u\n", len );
- ok( !lstrcmpW( url, url3 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url2 ), "url doesn't match\n" );
/* valid password, NULL username */
fill_url_components( &uc );
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
ok( len == 38, "expected len 38 got %u\n", len );
- ok( !lstrcmpW( url, url4 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url3 ), "url doesn't match\n" );
/* empty username, empty password */
fill_url_components( &uc );
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
ok( len == 56, "expected len 56 got %u\n", len );
- ok( !lstrcmpW( url, url5 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url4 ), "url doesn't match\n" );
/* nScheme has lower precedence than lpszScheme */
fill_url_components( &uc );
len = 256;
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
- ok( len == lstrlenW( url6 ), "expected len %d got %u\n", lstrlenW( url6 ) + 1, len );
- ok( !lstrcmpW( url, url6 ), "url doesn't match\n" );
+ ok( len == lstrlenW( url5 ), "expected len %d got %u\n", lstrlenW( url5 ) + 1, len );
+ ok( !lstrcmpW( url, url5 ), "url doesn't match\n" );
/* non-standard port */
uc.lpszScheme = http;
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
ok( len == 59, "expected len 59 got %u\n", len );
- ok( !lstrcmpW( url, url7 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url6 ), "url doesn't match\n" );
/* escape extra info */
fill_url_components( &uc );
ret = WinHttpCreateUrl( &uc, ICU_ESCAPE, url, &len );
ok( ret, "expected success\n" );
ok( len == 113, "expected len 113 got %u\n", len );
- ok( !lstrcmpW( url, url8 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url7 ), "url doesn't match\n" );
/* NULL lpszScheme, 0 nScheme and nPort */
fill_url_components( &uc );
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
ok( len == 58, "expected len 58 got %u\n", len );
- ok( !lstrcmpW( url, url9 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url8 ), "url doesn't match\n" );
HeapFree( GetProcessHeap(), 0, url );
}
memset( uc, 0, sizeof(URL_COMPONENTS) );
uc->dwStructSize = sizeof(URL_COMPONENTS);
uc->dwSchemeLength = ~0u;
- uc->dwHostNameLength = ~0u;
+ uc->dwHostNameLength = 1;
uc->nPort = 0;
uc->dwUserNameLength = ~0u;
uc->dwPasswordLength = ~0u;
BOOL ret;
/* buffers of sufficient length */
- scheme[0] = 0;
- user[0] = 0;
- pass[0] = 0;
- host[0] = 0;
- path[0] = 0;
- extra[0] = 0;
+ scheme[0] = user[0] = pass[0] = host[0] = path[0] = extra[0] = 0;
uc.dwStructSize = sizeof(URL_COMPONENTS);
uc.nScheme = 0;
ok( !memcmp( uc.lpszExtraInfo, query, sizeof(query) ), "unexpected extra info: %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
ok( uc.dwExtraInfoLength == 6, "unexpected extra info length: %u\n", uc.dwExtraInfoLength );
- /* buffer of insufficient length */
- scheme[0] = 0;
- uc.dwSchemeLength = 1;
-
+ /* buffers of insufficient length */
+ uc.dwSchemeLength = 1;
+ uc.dwHostNameLength = 1;
+ uc.dwUrlPathLength = 40; /* sufficient */
SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( url1, 0, 0, &uc );
error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
ok( error == ERROR_INSUFFICIENT_BUFFER, "got %u, expected ERROR_INSUFFICIENT_BUFFER\n", error );
ok( uc.dwSchemeLength == 5, "unexpected scheme length: %u\n", uc.dwSchemeLength );
+ ok( uc.dwHostNameLength == 15, "unexpected hostname length: %u\n", uc.dwHostNameLength );
+ ok( uc.dwUrlPathLength == 11, "unexpected path length: %u\n", uc.dwUrlPathLength );
/* no buffers */
reset_url_components( &uc );
- ret = WinHttpCrackUrl( url_k1, 0, 0,&uc);
-
- ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
+ SetLastError( 0xdeadbeef );
+ ret = WinHttpCrackUrl( url_k1, 0, 0, &uc);
+ error = GetLastError();
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", error );
+ ok( error == ERROR_SUCCESS || broken(error == ERROR_INVALID_PARAMETER) /* < win7 */,
+ "got %u, expected ERROR_SUCCESS\n", error );
ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
ok( uc.lpszScheme == url_k1,"unexpected scheme\n" );
ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
ok( uc.dwExtraInfoLength == 0, "unexpected extra info length\n" );
reset_url_components( &uc );
+ uc.dwSchemeLength = uc.dwHostNameLength = uc.dwUserNameLength = 1;
+ uc.dwPasswordLength = uc.dwUrlPathLength = uc.dwExtraInfoLength = 1;
ret = WinHttpCrackUrl( url_k2, 0, 0,&uc);
-
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
ok( uc.lpszScheme == url_k2, "unexpected scheme\n" );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k3, 0, 0, &uc );
-
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nScheme == INTERNET_SCHEME_HTTPS, "unexpected scheme\n" );
ok( uc.lpszScheme == url_k3, "unexpected scheme\n" );
/* bad parameters */
reset_url_components( &uc );
+ SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( url_k4, 0, 0, &uc );
ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ error = GetLastError();
+ ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
reset_url_components( &uc );
+ SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( url_k5, 0, 0, &uc );
ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ error = GetLastError();
+ ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
reset_url_components( &uc );
+ SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( url_k6, 0, 0, &uc );
ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ error = GetLastError();
+ ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u\n", error );
reset_url_components( &uc );
+ SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( url_k7, 0, 0, &uc );
ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ error = GetLastError();
+ ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u\n", error );
reset_url_components( &uc );
+ SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( url_k8, 0, 0, &uc );
+ error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u\n", error );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k9, 0, 0, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
- ok( uc.lpszUrlPath == url_k9 + 14, "unexpected path: %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
+ ok( uc.lpszUrlPath == url_k9 + 14 || broken(uc.lpszUrlPath == url_k9 + 13) /* win8 */,
+ "unexpected path: %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
ok( uc.dwUrlPathLength == 0, "unexpected path length: %u\n", uc.dwUrlPathLength );
- ok( uc.lpszExtraInfo == url_k9 + 14, "unexpected extra info: %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
- ok( uc.dwExtraInfoLength == 0, "unexpected extra info length: %u\n", uc.dwExtraInfoLength );
+ ok( uc.lpszExtraInfo == url_k9 + 14 || broken(uc.lpszExtraInfo == url_k9 + 13) /* win8 */,
+ "unexpected extra info: %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
+ ok( uc.dwExtraInfoLength == 0 || broken(uc.dwExtraInfoLength == 1) /* win8 */,
+ "unexpected extra info length: %u\n", uc.dwExtraInfoLength );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k10, 0, 0, &uc );
ok( uc.dwExtraInfoLength == 0, "unexpected extra info length: %u\n", uc.dwExtraInfoLength );
reset_url_components( &uc );
- ret = WinHttpCrackUrl( url5, 0, 0, &uc );
+ SetLastError( 0xdeadbeef );
+ ret = WinHttpCrackUrl( url4, 0, 0, &uc );
+ error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
reset_url_components( &uc );
+ SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( empty, 0, 0, &uc );
+ error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u\n", error );
+ SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( url1, 0, 0, NULL );
+ error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
+ SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( NULL, 0, 0, &uc );
+ error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
/* decoding without buffers */
reset_url_components( &uc );
SetLastError(0xdeadbeef);
- ret = WinHttpCrackUrl( url8, 0, ICU_DECODE, &uc );
+ ret = WinHttpCrackUrl( url7, 0, ICU_DECODE, &uc );
error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u, expected ERROR_INVALID_PARAMETER\n", error );
uc.dwExtraInfoLength = 40;
path[0] = 0;
- ret = WinHttpCrackUrl( url8, 0, ICU_DECODE, &uc );
+ ret = WinHttpCrackUrl( url7, 0, ICU_DECODE, &uc );
ok( ret, "WinHttpCrackUrl failed %u\n", GetLastError() );
ok( !memcmp( uc.lpszUrlPath + 11, escape, 21 * sizeof(WCHAR) ), "unexpected path\n" );
ok( uc.dwUrlPathLength == 32, "unexpected path length %u\n", uc.dwUrlPathLength );
uc.dwExtraInfoLength = 20;
path[0] = 0;
- ret = WinHttpCrackUrl( url7, 0, 0, &uc );
+ ret = WinHttpCrackUrl( url6, 0, 0, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected host name: %s\n", wine_dbgstr_w(uc.lpszHostName) );
ok( uc.dwHostNameLength == 14, "unexpected host name length: %d\n", uc.dwHostNameLength );
/* decoding without buffers */
reset_url_components( &uc );
- ret = WinHttpCrackUrl( url9, 0, 0, &uc );
+ ret = WinHttpCrackUrl( url8, 0, 0, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nPort == 0, "unexpected port: %u\n", uc.nPort );
reset_url_components( &uc );
- ret = WinHttpCrackUrl( url10, 0, 0, &uc );
+ ret = WinHttpCrackUrl( url9, 0, 0, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
reset_url_components( &uc );
- ret = WinHttpCrackUrl( url11, 0, 0, &uc );
+ ret = WinHttpCrackUrl( url10, 0, 0, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nPort == 443, "unexpected port: %u\n", uc.nPort );
ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u, expected ERROR_WINHTTP_UNRECOGNIZED_SCHEME\n", error );
reset_url_components( &uc );
- ret = WinHttpCrackUrl( url12, 0, 0, &uc);
+ ret = WinHttpCrackUrl( url11, 0, 0, &uc);
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
- ok( uc.lpszScheme == url12,"unexpected scheme\n" );
+ ok( uc.lpszScheme == url11,"unexpected scheme\n" );
ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
ok( uc.lpszUserName == NULL, "unexpected username\n" );
ok( uc.lpszPassword == NULL, "unexpected password\n" );
- ok( uc.lpszHostName == url12 + 7, "unexpected hostname\n" );
+ ok( uc.lpszHostName == url11 + 7, "unexpected hostname\n" );
ok( uc.dwHostNameLength == 11, "unexpected hostname length\n" );
ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
- ok( uc.lpszUrlPath == url12 + 18, "unexpected path\n" );
+ ok( uc.lpszUrlPath == url11 + 18, "unexpected path\n" );
ok( uc.dwUrlPathLength == 5, "unexpected path length\n" );
- ok( uc.lpszExtraInfo == url12 + 23, "unexpected extra info\n" );
+ ok( uc.lpszExtraInfo == url11 + 23, "unexpected extra info\n" );
ok( uc.dwExtraInfoLength == 39, "unexpected extra info length\n" );
uc.lpszScheme = scheme;
uc.lpszExtraInfo = NULL;
uc.dwExtraInfoLength = 0;
uc.nPort = 0;
- ret = WinHttpCrackUrl( url13, 0, ICU_DECODE, &uc );
+ ret = WinHttpCrackUrl( url12, 0, ICU_DECODE, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
uc.lpszScheme = scheme;
uc.lpszExtraInfo = NULL;
uc.dwExtraInfoLength = 0;
uc.nPort = 0;
- ret = WinHttpCrackUrl( url14, 0, ICU_ESCAPE|ICU_DECODE, &uc );
+ ret = WinHttpCrackUrl( url13, 0, ICU_ESCAPE|ICU_DECODE, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( !lstrcmpW( uc.lpszHostName, hostnameW ), "unexpected host name\n" );
ok( !lstrcmpW( uc.lpszUrlPath, pathW ), "unexpected path\n" );
+
+ uc.dwStructSize = sizeof(uc);
+ uc.lpszScheme = NULL;
+ uc.dwSchemeLength = 0;
+ uc.nScheme = 0;
+ uc.lpszHostName = NULL;
+ uc.dwHostNameLength = ~0u;
+ uc.nPort = 0;
+ uc.lpszUserName = NULL;
+ uc.dwUserNameLength = ~0u;
+ uc.lpszPassword = NULL;
+ uc.dwPasswordLength = ~0u;
+ uc.lpszUrlPath = NULL;
+ uc.dwUrlPathLength = ~0u;
+ uc.lpszExtraInfo = NULL;
+ uc.dwExtraInfoLength = ~0u;
+ ret = WinHttpCrackUrl( url14, 0, 0, &uc );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
+ ok( !uc.lpszScheme, "unexpected scheme %s\n", wine_dbgstr_w(uc.lpszScheme) );
+ ok( !uc.dwSchemeLength, "unexpected length %u\n", uc.dwSchemeLength );
+ ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme %u\n", uc.nScheme );
+ ok( !lstrcmpW( uc.lpszHostName, url14 + 7 ), "unexpected hostname %s\n", wine_dbgstr_w(uc.lpszHostName) );
+ ok( uc.dwHostNameLength == 14, "unexpected length %u\n", uc.dwHostNameLength );
+ ok( uc.nPort == 80, "unexpected port %u\n", uc.nPort );
+ ok( !uc.lpszUserName, "unexpected username\n" );
+ ok( !uc.dwUserNameLength, "unexpected length %u\n", uc.dwUserNameLength );
+ ok( !uc.lpszPassword, "unexpected password\n" );
+ ok( !uc.dwPasswordLength, "unexpected length %u\n", uc.dwPasswordLength );
+ ok( !lstrcmpW( uc.lpszUrlPath, url14 + 21 ), "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
+ ok( uc.dwUrlPathLength == 5, "unexpected length %u\n", uc.dwUrlPathLength );
+ ok( !uc.lpszExtraInfo[0], "unexpected extra info %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
+ ok( uc.dwExtraInfoLength == 0, "unexpected length %u\n", uc.dwExtraInfoLength );
+
+ uc.dwStructSize = sizeof(uc);
+ uc.lpszScheme = scheme;
+ uc.dwSchemeLength = 0;
+ uc.nScheme = 0;
+ uc.lpszHostName = NULL;
+ uc.dwHostNameLength = 0;
+ uc.nPort = 0;
+ uc.lpszUserName = NULL;
+ uc.dwUserNameLength = ~0u;
+ uc.lpszPassword = NULL;
+ uc.dwPasswordLength = ~0u;
+ uc.lpszUrlPath = NULL;
+ uc.dwUrlPathLength = 0;
+ uc.lpszExtraInfo = NULL;
+ uc.dwExtraInfoLength = 0;
+ SetLastError( 0xdeadbeef );
+ ret = WinHttpCrackUrl( url14, 0, 0, &uc );
+ error = GetLastError();
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
+ ok( !lstrcmpW( uc.lpszScheme, http ), "unexpected scheme %s\n", wine_dbgstr_w(uc.lpszScheme) );
+ ok( !uc.dwSchemeLength, "unexpected length %u\n", uc.dwSchemeLength );
+ ok( uc.nScheme == 0, "unexpected scheme %u\n", uc.nScheme );
+ ok( !uc.lpszHostName, "unexpected hostname %s\n", wine_dbgstr_w(uc.lpszHostName) );
+ ok( uc.dwHostNameLength == 0, "unexpected length %u\n", uc.dwHostNameLength );
+ ok( uc.nPort == 0, "unexpected port %u\n", uc.nPort );
+ ok( !uc.lpszUserName, "unexpected username\n" );
+ ok( uc.dwUserNameLength == ~0u, "unexpected length %u\n", uc.dwUserNameLength );
+ ok( !uc.lpszPassword, "unexpected password\n" );
+ ok( uc.dwPasswordLength == ~0u, "unexpected length %u\n", uc.dwPasswordLength );
+ ok( !uc.lpszUrlPath, "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
+ ok( uc.dwUrlPathLength == 0, "unexpected length %u\n", uc.dwUrlPathLength );
+ ok( !uc.lpszExtraInfo, "unexpected extra info %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
+ ok( uc.dwExtraInfoLength == 0, "unexpected length %u\n", uc.dwExtraInfoLength );
+
+ reset_url_components( &uc );
+ SetLastError( 0xdeadbeef );
+ ret = WinHttpCrackUrl( url15, 0, 0, &uc );
+ error = GetLastError();
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ ok( error == ERROR_WINHTTP_INVALID_URL, "got %u\n", error );
+
+ reset_url_components( &uc );
+ uc.nPort = 1;
+ ret = WinHttpCrackUrl( url16, 0, 0, &uc );
+ ok( ret, "got %u\n", GetLastError() );
+ ok( !uc.nPort, "got %u\n", uc.nPort );
+
+ reset_url_components( &uc );
+ uc.nPort = 1;
+ ret = WinHttpCrackUrl( url17, 0, 0, &uc );
+ ok( ret, "got %u\n", GetLastError() );
+ todo_wine ok( uc.nPort == 80, "got %u\n", uc.nPort );
}
START_TEST(url)