ReactOS 0.4.16-dev-732-g2d1144a
uri.c File Reference
#include <wine/test.h>
#include <stdarg.h>
#include <stddef.h>
#include "windef.h"
#include "winbase.h"
#include "urlmon.h"
#include "shlwapi.h"
#include "wininet.h"
#include "strsafe.h"
#include "initguid.h"
#include <wine/heap.h>
Include dependency graph for uri.c:

Go to the source code of this file.

Classes

struct  _uri_create_flag_test
 
struct  _uri_str_property
 
struct  _uri_dword_property
 
struct  _uri_properties
 
struct  _invalid_uri
 
struct  _uri_equality
 
struct  _uri_with_fragment
 
struct  _uri_builder_property
 
struct  _uri_builder_port
 
struct  _uri_builder_str_property
 
struct  _uri_builder_dword_property
 
struct  _uri_builder_test
 
struct  _uri_builder_remove_test
 
struct  _uri_combine_str_property
 
struct  _uri_combine_test
 
struct  _uri_parse_test
 
struct  custom_uri
 
struct  create_urlmon_test_t
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define WIN32_LEAN_AND_MEAN
 
#define URI_STR_PROPERTY_COUNT   Uri_PROPERTY_STRING_LAST+1
 
#define URI_DWORD_PROPERTY_COUNT   (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
 
#define URI_BUILDER_STR_PROPERTY_COUNT   7
 
#define DEFINE_EXPECT(func)    static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
 
#define SET_EXPECT(func)    expect_ ## func = TRUE
 
#define CHECK_EXPECT(func)
 
#define CHECK_EXPECT2(func)
 
#define CHECK_CALLED(func)
 
#define test_urlmon_display_name(a, b)   _test_urlmon_display_name(__LINE__,a,b)
 
#define test_display_uri(a, b)   _test_display_uri(__LINE__,a,b)
 

Typedefs

typedef struct _uri_create_flag_test uri_create_flag_test
 
typedef struct _uri_str_property uri_str_property
 
typedef struct _uri_dword_property uri_dword_property
 
typedef struct _uri_properties uri_properties
 
typedef struct _invalid_uri invalid_uri
 
typedef struct _uri_equality uri_equality
 
typedef struct _uri_with_fragment uri_with_fragment
 
typedef struct _uri_builder_property uri_builder_property
 
typedef struct _uri_builder_port uri_builder_port
 
typedef struct _uri_builder_str_property uri_builder_str_property
 
typedef struct _uri_builder_dword_property uri_builder_dword_property
 
typedef struct _uri_builder_test uri_builder_test
 
typedef struct _uri_builder_remove_test uri_builder_remove_test
 
typedef struct _uri_combine_str_property uri_combine_str_property
 
typedef struct _uri_combine_test uri_combine_test
 
typedef struct _uri_parse_test uri_parse_test
 

Functions

 DEFINE_GUID (CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D, 0x4C, 0xCE, 0xCD, 0x47, 0xC2, 0x43, 0x0C)
 
 DEFINE_EXPECT (CombineUrl)
 
 DEFINE_EXPECT (ParseUrl)
 
static HRESULT (WINAPI *pCreateUri)(LPCWSTR
 
static LPWSTR a2w (LPCSTR str)
 
static DWORD strcmp_aw (LPCSTR strA, LPCWSTR strB)
 
static ULONG get_refcnt (IUri *uri)
 
static void change_property (IUriBuilder *builder, const uri_builder_property *prop, DWORD test_index)
 
static void test_CreateUri_InvalidFlags (void)
 
static void test_CreateUri_InvalidArgs (void)
 
static void test_CreateUri_InvalidUri (void)
 
static void test_IUri_GetPropertyBSTR (void)
 
static void test_IUri_GetPropertyDWORD (void)
 
static void test_IUri_GetStrProperties (void)
 
static void test_IUri_GetDwordProperties (void)
 
static void test_IUri_GetPropertyLength (void)
 
static DWORD compute_expected_props (uri_properties *test, DWORD *mask)
 
static void test_IUri_GetProperties (void)
 
static void test_IUri_HasProperty (void)
 
static struct custom_uriimpl_from_IUri (IUri *iface)
 
static HRESULT WINAPI custom_uri_QueryInterface (IUri *iface, REFIID iid, void **out)
 
static ULONG WINAPI custom_uri_AddRef (IUri *iface)
 
static ULONG WINAPI custom_uri_Release (IUri *iface)
 
static HRESULT WINAPI custom_uri_GetPropertyBSTR (IUri *iface, Uri_PROPERTY property, BSTR *value, DWORD flags)
 
static HRESULT WINAPI custom_uri_GetPropertyLength (IUri *iface, Uri_PROPERTY property, DWORD *length, DWORD flags)
 
static HRESULT WINAPI custom_uri_GetPropertyDWORD (IUri *iface, Uri_PROPERTY property, DWORD *value, DWORD flags)
 
static HRESULT WINAPI custom_uri_HasProperty (IUri *iface, Uri_PROPERTY property, BOOL *has_property)
 
static HRESULT WINAPI custom_uri_GetAbsoluteUri (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetAuthority (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetDisplayUri (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetDomain (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetExtension (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetFragment (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetHost (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetPassword (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetPath (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetPathAndQuery (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetQuery (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetRawUri (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetSchemeName (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetUserInfo (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetUserName (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetHostType (IUri *iface, DWORD *value)
 
static HRESULT WINAPI custom_uri_GetPort (IUri *iface, DWORD *value)
 
static HRESULT WINAPI custom_uri_GetScheme (IUri *iface, DWORD *value)
 
static HRESULT WINAPI custom_uri_GetZone (IUri *iface, DWORD *value)
 
static HRESULT WINAPI custom_uri_GetProperties (IUri *iface, DWORD *flags)
 
static HRESULT WINAPI custom_uri_IsEqual (IUri *iface, IUri *pUri, BOOL *is_equal)
 
static void test_IUri_IsEqual (void)
 
static void test_CreateUriWithFragment_InvalidArgs (void)
 
static void test_CreateUriWithFragment_InvalidFlags (void)
 
static void test_CreateUriWithFragment (void)
 
static void test_CreateIUriBuilder (void)
 
static void test_IUriBuilder_CreateUri (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_CreateUriSimple (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_CreateUriWithFlags (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_CreateInvalidArgs (void)
 
static void test_IUriBuilder_GetInvalidArgs (void)
 
static void test_IUriBuilder_GetFragment (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetHost (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetPassword (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetPath (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetPort (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetQuery (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetSchemeName (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetUserName (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder (void)
 
static void test_IUriBuilder_HasBeenModified (void)
 
static void test_IUriBuilder_IUriProperty (void)
 
static void test_IUriBuilder_RemoveProperties (void)
 
static void test_IUriBuilder_Misc (void)
 
static void test_IUriBuilderFactory (void)
 
static void test_CoInternetCombineIUri (void)
 
static HRESULT WINAPI InternetProtocolInfo_QueryInterface (IInternetProtocolInfo *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI InternetProtocolInfo_AddRef (IInternetProtocolInfo *iface)
 
static ULONG WINAPI InternetProtocolInfo_Release (IInternetProtocolInfo *iface)
 
static HRESULT WINAPI InternetProtocolInfo_ParseUrl (IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
 
static HRESULT WINAPI InternetProtocolInfo_CombineUrl (IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
 
static HRESULT WINAPI InternetProtocolInfo_CompareUrl (IInternetProtocolInfo *iface, LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
 
static HRESULT WINAPI InternetProtocolInfo_QueryInfo (IInternetProtocolInfo *iface, LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
 
static HRESULT WINAPI ClassFactory_QueryInterface (IClassFactory *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ClassFactory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI ClassFactory_Release (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactory_CreateInstance (IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
 
static HRESULT WINAPI ClassFactory_LockServer (IClassFactory *iface, BOOL dolock)
 
static void register_protocols (void)
 
static void unregister_protocols (void)
 
static void test_CoInternetCombineIUri_Pluggable (void)
 
static void test_CoInternetCombineUrlEx (void)
 
static void test_CoInternetCombineUrlEx_Pluggable (void)
 
static void test_CoInternetParseIUri_InvalidArgs (void)
 
static void test_CoInternetParseIUri (void)
 
static void test_CoInternetParseIUri_Pluggable (void)
 
static void _test_urlmon_display_name (unsigned line, IMoniker *mon, const char *exurl)
 
static void _test_display_uri (unsigned line, IMoniker *mon, const char *exurl)
 
static void test_CreateURLMoniker (void)
 
static int add_default_flags (DWORD flags)
 
static void test_IPersistStream (void)
 
static void test_UninitializedUri (void)
 
 START_TEST (uri)
 

Variables

static DWORD
 
static DWORD_PTR
 
static IUri **static LPCWSTR
 
static PARSEACTION
 
static LPWSTR
 
static const WCHAR http_urlW []
 
static const WCHAR http_url_fragW []
 
static const WCHAR combine_baseW []
 
static const WCHAR combine_relativeW [] = {'?','t','e','s','t',0}
 
static const WCHAR combine_resultW [] = {'z','i','p',':','t','e','s','t',0}
 
static const WCHAR winetestW [] = {'w','i','n','e','t','e','s','t',0}
 
static const WCHAR parse_urlW [] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0}
 
static const WCHAR parse_resultW [] = {'z','i','p',':','t','e','s','t',0}
 
static PARSEACTION parse_action
 
static DWORD parse_flags
 
static const uri_create_flag_test invalid_flag_tests []
 
static const uri_properties uri_tests []
 
static const invalid_uri invalid_uri_tests []
 
static const uri_equality equality_tests []
 
static const uri_with_fragment uri_fragment_tests []
 
static const uri_builder_test uri_builder_tests []
 
static const uri_builder_remove_test uri_builder_remove_tests []
 
static const uri_combine_test uri_combine_tests []
 
static const uri_parse_test uri_parse_tests []
 
static const IUriVtbl custom_uri_vtbl
 
static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
 
static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl }
 
static const IClassFactoryVtbl ClassFactoryVtbl
 
static IClassFactory protocol_cf = { &ClassFactoryVtbl }
 
static const create_urlmon_test_t create_urlmon_tests []
 

Macro Definition Documentation

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define FALSE
Definition: types.h:117
GLenum func
Definition: glext.h:6028
#define expect_(expected, got, precision)
Definition: font.c:29

Definition at line 63 of file uri.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
expect_ ## func = FALSE; \
called_ ## func = TRUE; \
}while(0)
#define TRUE
Definition: types.h:120

Definition at line 50 of file uri.c.

◆ CHECK_EXPECT2

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)

Definition at line 57 of file uri.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file uri.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 26 of file uri.c.

◆ DEFINE_EXPECT

#define DEFINE_EXPECT (   func)     static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

Definition at line 44 of file uri.c.

◆ SET_EXPECT

#define SET_EXPECT (   func)     expect_ ## func = TRUE

Definition at line 47 of file uri.c.

◆ test_display_uri

#define test_display_uri (   a,
  b 
)    _test_display_uri(__LINE__,a,b)

Definition at line 11212 of file uri.c.

◆ test_urlmon_display_name

#define test_urlmon_display_name (   a,
  b 
)    _test_urlmon_display_name(__LINE__,a,b)

Definition at line 11198 of file uri.c.

◆ URI_BUILDER_STR_PROPERTY_COUNT

#define URI_BUILDER_STR_PROPERTY_COUNT   7

Definition at line 42 of file uri.c.

◆ URI_DWORD_PROPERTY_COUNT

#define URI_DWORD_PROPERTY_COUNT   (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1

Definition at line 41 of file uri.c.

◆ URI_STR_PROPERTY_COUNT

#define URI_STR_PROPERTY_COUNT   Uri_PROPERTY_STRING_LAST+1

Definition at line 40 of file uri.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 27 of file uri.c.

Typedef Documentation

◆ invalid_uri

◆ uri_builder_dword_property

◆ uri_builder_port

◆ uri_builder_property

◆ uri_builder_remove_test

◆ uri_builder_str_property

◆ uri_builder_test

◆ uri_combine_str_property

◆ uri_combine_test

◆ uri_create_flag_test

◆ uri_dword_property

◆ uri_equality

◆ uri_parse_test

◆ uri_properties

◆ uri_str_property

◆ uri_with_fragment

Function Documentation

◆ _test_display_uri()

static void _test_display_uri ( unsigned  line,
IMoniker mon,
const char exurl 
)
static

Definition at line 11213 of file uri.c.

11214{
11215 IUriContainer *uri_container;
11216 IUri *uri;
11217 BSTR display_uri;
11218 HRESULT hres;
11219
11220 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
11221 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
11222
11223 uri = NULL;
11224 hres = IUriContainer_GetIUri(uri_container, &uri);
11225 IUriContainer_Release(uri_container);
11226 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
11227 ok(uri != NULL, "uri == NULL\n");
11228
11229 hres = IUri_GetDisplayUri(uri, &display_uri);
11230 IUri_Release(uri);
11231 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
11232 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
11233 wine_dbgstr_w(display_uri), exurl);
11234 SysFreeString(display_uri);
11235}
#define ok(value,...)
Definition: atltest.h:57
#define ok_(x1, x2)
Definition: atltest.h:61
#define NULL
Definition: types.h:112
OLECHAR * BSTR
Definition: compat.h:2293
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
HRESULT hres
Definition: protocol.c:465
const char * uri
Definition: sec_mgr.c:1588
static DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB)
Definition: uri.c:7700
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
Definition: parser.c:49

◆ _test_urlmon_display_name()

static void _test_urlmon_display_name ( unsigned  line,
IMoniker mon,
const char exurl 
)
static

Definition at line 11199 of file uri.c.

11200{
11201 WCHAR *display_name;
11202 HRESULT hres;
11203
11204 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
11205 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
11206 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
11207 wine_dbgstr_w(display_name), exurl);
11208
11209 CoTaskMemFree(display_name);
11210}
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ a2w()

◆ add_default_flags()

static int add_default_flags ( DWORD  flags)
static

Definition at line 11315 of file uri.c.

11315 {
11316 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
11317 flags |= Uri_CREATE_CANONICALIZE;
11318 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
11319 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
11320 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
11321 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
11322 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
11323 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
11324 if(!(flags & Uri_CREATE_IE_SETTINGS))
11325 flags |= Uri_CREATE_NO_IE_SETTINGS;
11326
11327 return flags;
11328}
GLbitfield flags
Definition: glext.h:7161

Referenced by test_IPersistStream().

◆ change_property()

static void change_property ( IUriBuilder builder,
const uri_builder_property prop,
DWORD  test_index 
)
static

Definition at line 7712 of file uri.c.

7713 {
7714 HRESULT hr;
7715 LPWSTR valueW;
7716
7717 valueW = a2w(prop->value);
7718 switch(prop->property) {
7719 case Uri_PROPERTY_FRAGMENT:
7720 hr = IUriBuilder_SetFragment(builder, valueW);
7721 todo_wine_if(prop->todo) {
7722 ok(hr == prop->expected,
7723 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7724 hr, prop->expected, test_index);
7725 }
7726 break;
7727 case Uri_PROPERTY_HOST:
7728 hr = IUriBuilder_SetHost(builder, valueW);
7729 todo_wine_if(prop->todo) {
7730 ok(hr == prop->expected,
7731 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7732 hr, prop->expected, test_index);
7733 }
7734 break;
7735 case Uri_PROPERTY_PASSWORD:
7736 hr = IUriBuilder_SetPassword(builder, valueW);
7737 todo_wine_if(prop->todo) {
7738 ok(hr == prop->expected,
7739 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7740 hr, prop->expected, test_index);
7741 }
7742 break;
7743 case Uri_PROPERTY_PATH:
7744 hr = IUriBuilder_SetPath(builder, valueW);
7745 todo_wine_if(prop->todo) {
7746 ok(hr == prop->expected,
7747 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7748 hr, prop->expected, test_index);
7749 }
7750 break;
7751 case Uri_PROPERTY_QUERY:
7752 hr = IUriBuilder_SetQuery(builder, valueW);
7753 todo_wine_if(prop->todo) {
7754 ok(hr == prop->expected,
7755 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7756 hr, prop->expected, test_index);
7757 }
7758 break;
7759 case Uri_PROPERTY_SCHEME_NAME:
7760 hr = IUriBuilder_SetSchemeName(builder, valueW);
7761 todo_wine_if(prop->todo) {
7762 ok(hr == prop->expected,
7763 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7764 hr, prop->expected, test_index);
7765 }
7766 break;
7767 case Uri_PROPERTY_USER_NAME:
7768 hr = IUriBuilder_SetUserName(builder, valueW);
7769 todo_wine_if(prop->todo) {
7770 ok(hr == prop->expected,
7771 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7772 hr, prop->expected, test_index);
7773 }
7774 break;
7775 default:
7776 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
7777 }
7778
7780}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define trace
Definition: atltest.h:70
static const WCHAR valueW[]
Definition: object.c:48
#define todo_wine_if(is_todo)
Definition: custom.c:86
static LPWSTR a2w(LPCSTR str)
Definition: uri.c:7688
HRESULT hr
Definition: shlfolder.c:183
const char * value
Definition: uri.c:5307
Uri_PROPERTY property
Definition: uri.c:5309
HRESULT expected
Definition: uri.c:5310

Referenced by test_IUriBuilder().

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 10726 of file uri.c.

10727{
10728 return 2;
10729}

◆ ClassFactory_CreateInstance()

static HRESULT WINAPI ClassFactory_CreateInstance ( IClassFactory iface,
IUnknown pOuter,
REFIID  riid,
void **  ppv 
)
static

Definition at line 10736 of file uri.c.

10738{
10739 ok(0, "unexpected call\n");
10740 return E_NOTIMPL;
10741}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ClassFactory_LockServer()

static HRESULT WINAPI ClassFactory_LockServer ( IClassFactory iface,
BOOL  dolock 
)
static

Definition at line 10743 of file uri.c.

10744{
10745 ok(0, "unexpected call\n");
10746 return S_OK;
10747}

◆ ClassFactory_QueryInterface()

static HRESULT WINAPI ClassFactory_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 10715 of file uri.c.

10716{
10717 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10718 *ppv = &protocol_info;
10719 return S_OK;
10720 }
10721
10722 ok(0, "unexpected call\n");
10723 return E_NOINTERFACE;
10724}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static IInternetProtocolInfo protocol_info
Definition: uri.c:10713
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 10731 of file uri.c.

10732{
10733 return 1;
10734}

◆ compute_expected_props()

static DWORD compute_expected_props ( uri_properties test,
DWORD mask 
)
static

Definition at line 8393 of file uri.c.

8394{
8395 DWORD ret = 0, i;
8396
8397 *mask = 0;
8398
8399 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8400 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8401 ret |= 1<<i;
8402 if(test->str_props[i-Uri_PROPERTY_STRING_START].value2 == NULL ||
8403 test->str_props[i-Uri_PROPERTY_STRING_START].expected ==
8404 test->str_props[i-Uri_PROPERTY_STRING_START].expected2)
8405 *mask |= 1<<i;
8406 }
8407
8408 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8409 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8410 ret |= 1<<i;
8411 *mask |= 1<<i;
8412 }
8413
8414 return ret;
8415}
GLenum GLint GLuint mask
Definition: glext.h:6028
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 const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define test
Definition: rosglue.h:37

Referenced by test_IUri_GetProperties(), and test_IUri_HasProperty().

◆ custom_uri_AddRef()

static ULONG WINAPI custom_uri_AddRef ( IUri iface)
static

Definition at line 8542 of file uri.c.

8543{
8544 struct custom_uri *uri = impl_from_IUri(iface);
8545 return IUri_AddRef(uri->uri);
8546}
static Uri * impl_from_IUri(IUri *iface)
Definition: uri.c:4206

◆ custom_uri_GetAbsoluteUri()

static HRESULT WINAPI custom_uri_GetAbsoluteUri ( IUri iface,
BSTR value 
)
static

Definition at line 8578 of file uri.c.

8579{
8580 struct custom_uri *uri = impl_from_IUri(iface);
8581 return IUri_GetAbsoluteUri(uri->uri, value);
8582}
Definition: pdh_main.c:94

◆ custom_uri_GetAuthority()

static HRESULT WINAPI custom_uri_GetAuthority ( IUri iface,
BSTR value 
)
static

Definition at line 8584 of file uri.c.

8585{
8586 struct custom_uri *uri = impl_from_IUri(iface);
8587 return IUri_GetAbsoluteUri(uri->uri, value);
8588}

◆ custom_uri_GetDisplayUri()

static HRESULT WINAPI custom_uri_GetDisplayUri ( IUri iface,
BSTR value 
)
static

Definition at line 8590 of file uri.c.

8591{
8592 struct custom_uri *uri = impl_from_IUri(iface);
8593 return IUri_GetAbsoluteUri(uri->uri, value);
8594}

◆ custom_uri_GetDomain()

static HRESULT WINAPI custom_uri_GetDomain ( IUri iface,
BSTR value 
)
static

Definition at line 8596 of file uri.c.

8597{
8598 struct custom_uri *uri = impl_from_IUri(iface);
8599 return IUri_GetAbsoluteUri(uri->uri, value);
8600}

◆ custom_uri_GetExtension()

static HRESULT WINAPI custom_uri_GetExtension ( IUri iface,
BSTR value 
)
static

Definition at line 8602 of file uri.c.

8603{
8604 struct custom_uri *uri = impl_from_IUri(iface);
8605 return IUri_GetAbsoluteUri(uri->uri, value);
8606}

◆ custom_uri_GetFragment()

static HRESULT WINAPI custom_uri_GetFragment ( IUri iface,
BSTR value 
)
static

Definition at line 8608 of file uri.c.

8609{
8610 struct custom_uri *uri = impl_from_IUri(iface);
8611 return IUri_GetAbsoluteUri(uri->uri, value);
8612}

◆ custom_uri_GetHost()

static HRESULT WINAPI custom_uri_GetHost ( IUri iface,
BSTR value 
)
static

Definition at line 8614 of file uri.c.

8615{
8616 struct custom_uri *uri = impl_from_IUri(iface);
8617 return IUri_GetAbsoluteUri(uri->uri, value);
8618}

◆ custom_uri_GetHostType()

static HRESULT WINAPI custom_uri_GetHostType ( IUri iface,
DWORD value 
)
static

Definition at line 8668 of file uri.c.

8669{
8670 struct custom_uri *uri = impl_from_IUri(iface);
8671 return IUri_GetHostType(uri->uri, value);
8672}

◆ custom_uri_GetPassword()

static HRESULT WINAPI custom_uri_GetPassword ( IUri iface,
BSTR value 
)
static

Definition at line 8620 of file uri.c.

8621{
8622 struct custom_uri *uri = impl_from_IUri(iface);
8623 return IUri_GetAbsoluteUri(uri->uri, value);
8624}

◆ custom_uri_GetPath()

static HRESULT WINAPI custom_uri_GetPath ( IUri iface,
BSTR value 
)
static

Definition at line 8626 of file uri.c.

8627{
8628 struct custom_uri *uri = impl_from_IUri(iface);
8629 return IUri_GetAbsoluteUri(uri->uri, value);
8630}

◆ custom_uri_GetPathAndQuery()

static HRESULT WINAPI custom_uri_GetPathAndQuery ( IUri iface,
BSTR value 
)
static

Definition at line 8632 of file uri.c.

8633{
8634 struct custom_uri *uri = impl_from_IUri(iface);
8635 return IUri_GetAbsoluteUri(uri->uri, value);
8636}

◆ custom_uri_GetPort()

static HRESULT WINAPI custom_uri_GetPort ( IUri iface,
DWORD value 
)
static

Definition at line 8674 of file uri.c.

8675{
8676 struct custom_uri *uri = impl_from_IUri(iface);
8677 return IUri_GetPort(uri->uri, value);
8678}

◆ custom_uri_GetProperties()

static HRESULT WINAPI custom_uri_GetProperties ( IUri iface,
DWORD flags 
)
static

Definition at line 8692 of file uri.c.

8693{
8694 struct custom_uri *uri = impl_from_IUri(iface);
8695 return IUri_GetProperties(uri->uri, flags);
8696}

◆ custom_uri_GetPropertyBSTR()

static HRESULT WINAPI custom_uri_GetPropertyBSTR ( IUri iface,
Uri_PROPERTY  property,
BSTR value,
DWORD  flags 
)
static

Definition at line 8554 of file uri.c.

8555{
8556 struct custom_uri *uri = impl_from_IUri(iface);
8557 return IUri_GetPropertyBSTR(uri->uri, property, value, flags);
8558}

◆ custom_uri_GetPropertyDWORD()

static HRESULT WINAPI custom_uri_GetPropertyDWORD ( IUri iface,
Uri_PROPERTY  property,
DWORD value,
DWORD  flags 
)
static

Definition at line 8566 of file uri.c.

8567{
8568 struct custom_uri *uri = impl_from_IUri(iface);
8569 return IUri_GetPropertyDWORD(uri->uri, property, value, flags);
8570}

◆ custom_uri_GetPropertyLength()

static HRESULT WINAPI custom_uri_GetPropertyLength ( IUri iface,
Uri_PROPERTY  property,
DWORD length,
DWORD  flags 
)
static

Definition at line 8560 of file uri.c.

8561{
8562 struct custom_uri *uri = impl_from_IUri(iface);
8563 return IUri_GetPropertyLength(uri->uri, property, length, flags);
8564}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

◆ custom_uri_GetQuery()

static HRESULT WINAPI custom_uri_GetQuery ( IUri iface,
BSTR value 
)
static

Definition at line 8638 of file uri.c.

8639{
8640 struct custom_uri *uri = impl_from_IUri(iface);
8641 return IUri_GetAbsoluteUri(uri->uri, value);
8642}

◆ custom_uri_GetRawUri()

static HRESULT WINAPI custom_uri_GetRawUri ( IUri iface,
BSTR value 
)
static

Definition at line 8644 of file uri.c.

8645{
8646 struct custom_uri *uri = impl_from_IUri(iface);
8647 return IUri_GetAbsoluteUri(uri->uri, value);
8648}

◆ custom_uri_GetScheme()

static HRESULT WINAPI custom_uri_GetScheme ( IUri iface,
DWORD value 
)
static

Definition at line 8680 of file uri.c.

8681{
8682 struct custom_uri *uri = impl_from_IUri(iface);
8683 return IUri_GetScheme(uri->uri, value);
8684}

◆ custom_uri_GetSchemeName()

static HRESULT WINAPI custom_uri_GetSchemeName ( IUri iface,
BSTR value 
)
static

Definition at line 8650 of file uri.c.

8651{
8652 struct custom_uri *uri = impl_from_IUri(iface);
8653 return IUri_GetSchemeName(uri->uri, value);
8654}

◆ custom_uri_GetUserInfo()

static HRESULT WINAPI custom_uri_GetUserInfo ( IUri iface,
BSTR value 
)
static

Definition at line 8656 of file uri.c.

8657{
8658 struct custom_uri *uri = impl_from_IUri(iface);
8659 return IUri_GetUserInfo(uri->uri, value);
8660}

◆ custom_uri_GetUserName()

static HRESULT WINAPI custom_uri_GetUserName ( IUri iface,
BSTR value 
)
static

Definition at line 8662 of file uri.c.

8663{
8664 struct custom_uri *uri = impl_from_IUri(iface);
8665 return IUri_GetUserName(uri->uri, value);
8666}

◆ custom_uri_GetZone()

static HRESULT WINAPI custom_uri_GetZone ( IUri iface,
DWORD value 
)
static

Definition at line 8686 of file uri.c.

8687{
8688 struct custom_uri *uri = impl_from_IUri(iface);
8689 return IUri_GetZone(uri->uri, value);
8690}

◆ custom_uri_HasProperty()

static HRESULT WINAPI custom_uri_HasProperty ( IUri iface,
Uri_PROPERTY  property,
BOOL has_property 
)
static

Definition at line 8572 of file uri.c.

8573{
8574 struct custom_uri *uri = impl_from_IUri(iface);
8575 return IUri_HasProperty(uri->uri, property, has_property);
8576}

◆ custom_uri_IsEqual()

static HRESULT WINAPI custom_uri_IsEqual ( IUri iface,
IUri pUri,
BOOL is_equal 
)
static

Definition at line 8698 of file uri.c.

8699{
8700 struct custom_uri *uri = impl_from_IUri(iface);
8701 return IUri_IsEqual(uri->uri, pUri, is_equal);
8702}

◆ custom_uri_QueryInterface()

static HRESULT WINAPI custom_uri_QueryInterface ( IUri iface,
REFIID  iid,
void **  out 
)
static

Definition at line 8529 of file uri.c.

8530{
8531 if (IsEqualIID(iid, &IID_IUri) || IsEqualIID(iid, &IID_IUnknown))
8532 {
8533 *out = iface;
8534 IUri_AddRef(iface);
8535 return S_OK;
8536 }
8537
8538 *out = NULL;
8539 return E_NOINTERFACE;
8540}
const GUID IID_IUnknown
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ custom_uri_Release()

static ULONG WINAPI custom_uri_Release ( IUri iface)
static

Definition at line 8548 of file uri.c.

8549{
8550 struct custom_uri *uri = impl_from_IUri(iface);
8551 return IUri_Release(uri->uri);
8552}

◆ DEFINE_EXPECT() [1/2]

DEFINE_EXPECT ( CombineUrl  )

◆ DEFINE_EXPECT() [2/2]

DEFINE_EXPECT ( ParseUrl  )

◆ DEFINE_GUID()

DEFINE_GUID ( CLSID_CUri  ,
0xDF2FCE13  ,
0x25EC  ,
0x45BB  ,
0x9D  ,
0x4C  ,
0xCE  ,
0xCD  ,
0x47  ,
0xC2  ,
0x43  ,
0x0C   
)

◆ get_refcnt()

static ULONG get_refcnt ( IUri uri)
inlinestatic

Definition at line 7707 of file uri.c.

7707 {
7708 IUri_AddRef(uri);
7709 return IUri_Release(uri);
7710}

Referenced by test_CreateIUriBuilder(), and test_IUriBuilder_IUriProperty().

◆ HRESULT()

static HRESULT ( WINAPI pCreateUri)
static

◆ impl_from_IUri()

static struct custom_uri * impl_from_IUri ( IUri iface)
inlinestatic

Definition at line 8524 of file uri.c.

8525{
8526 return CONTAINING_RECORD(iface, struct custom_uri, IUri_iface);
8527}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ InternetProtocolInfo_AddRef()

static ULONG WINAPI InternetProtocolInfo_AddRef ( IInternetProtocolInfo iface)
static

Definition at line 10642 of file uri.c.

10643{
10644 return 2;
10645}

◆ InternetProtocolInfo_CombineUrl()

static HRESULT WINAPI InternetProtocolInfo_CombineUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzBaseUrl,
LPCWSTR  pwzRelativeUrl,
DWORD  dwCombineFlags,
LPWSTR  pwzResult,
DWORD  cchResult,
DWORD pcchResult,
DWORD  dwReserved 
)
static

Definition at line 10669 of file uri.c.

10672{
10673 CHECK_EXPECT(CombineUrl);
10674 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10676 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10679 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10680 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10681
10682 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10683 *pcchResult = lstrlenW(combine_resultW);
10684
10685 return S_OK;
10686}
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1418
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const WCHAR combine_relativeW[]
Definition: uri.c:89
#define CHECK_EXPECT(func)
Definition: uri.c:50
static const WCHAR combine_resultW[]
Definition: uri.c:90
static const WCHAR combine_baseW[]
Definition: uri.c:87
#define URL_DONT_SIMPLIFY
Definition: shlwapi.h:1240
#define URL_FILE_USE_PATHURL
Definition: shlwapi.h:1252
#define URL_DONT_UNESCAPE_EXTRA_INFO
Definition: shlwapi.h:1244

◆ InternetProtocolInfo_CompareUrl()

static HRESULT WINAPI InternetProtocolInfo_CompareUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl1,
LPCWSTR  pwzUrl2,
DWORD  dwCompareFlags 
)
static

Definition at line 10688 of file uri.c.

10690{
10691 ok(0, "unexpected call\n");
10692 return E_NOTIMPL;
10693}

◆ InternetProtocolInfo_ParseUrl()

static HRESULT WINAPI InternetProtocolInfo_ParseUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl,
PARSEACTION  ParseAction,
DWORD  dwParseFlags,
LPWSTR  pwzResult,
DWORD  cchResult,
DWORD pcchResult,
DWORD  dwReserved 
)
static

Definition at line 10652 of file uri.c.

10655{
10656 CHECK_EXPECT(ParseUrl);
10657 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10659 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10660 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10661 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10662
10663 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10664 *pcchResult = lstrlenW(parse_resultW);
10665
10666 return S_OK;
10667}
static const WCHAR parse_resultW[]
Definition: uri.c:95
static PARSEACTION parse_action
Definition: uri.c:97
static const WCHAR parse_urlW[]
Definition: uri.c:94
static DWORD parse_flags
Definition: uri.c:98

◆ InternetProtocolInfo_QueryInfo()

static HRESULT WINAPI InternetProtocolInfo_QueryInfo ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl,
QUERYOPTION  OueryOption,
DWORD  dwQueryFlags,
LPVOID  pBuffer,
DWORD  cbBuffer,
DWORD pcbBuf,
DWORD  dwReserved 
)
static

Definition at line 10695 of file uri.c.

10698{
10699 ok(0, "unexpected call\n");
10700 return E_NOTIMPL;
10701}

◆ InternetProtocolInfo_QueryInterface()

static HRESULT WINAPI InternetProtocolInfo_QueryInterface ( IInternetProtocolInfo iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 10635 of file uri.c.

10637{
10638 ok(0, "unexpected call\n");
10639 return E_NOINTERFACE;
10640}

◆ InternetProtocolInfo_Release()

static ULONG WINAPI InternetProtocolInfo_Release ( IInternetProtocolInfo iface)
static

Definition at line 10647 of file uri.c.

10648{
10649 return 1;
10650}

◆ register_protocols()

static void register_protocols ( void  )
static

Definition at line 10759 of file uri.c.

10760{
10762 HRESULT hres;
10763
10764 hres = pCoInternetGetSession(0, &session, 0);
10765 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10766 if(FAILED(hres))
10767 return;
10768
10769 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10770 winetestW, 0, NULL, 0);
10771 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10772
10773 IInternetSession_Release(session);
10774}
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR winetestW[]
Definition: uri.c:92
static IClassFactory protocol_cf
Definition: uri.c:10757
#define IID_NULL
Definition: guiddef.h:98

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( uri  )

Definition at line 11653 of file uri.c.

11653 {
11654 HMODULE hurlmon;
11655
11656 hurlmon = GetModuleHandleA("urlmon.dll");
11657 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11658 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11659 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11660 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11661 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11662 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11663 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11664 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11665 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11666
11667 if(!pCreateUri) {
11668 win_skip("CreateUri is not present, skipping tests.\n");
11669 return;
11670 }
11671
11672 trace("test CreateUri invalid flags...\n");
11674
11675 trace("test CreateUri invalid args...\n");
11677
11678 trace("test CreateUri invalid URIs...\n");
11680
11681 trace("test IUri_GetPropertyBSTR...\n");
11683
11684 trace("test IUri_GetPropertyDWORD...\n");
11686
11687 trace("test IUri_GetStrProperties...\n");
11689
11690 trace("test IUri_GetDwordProperties...\n");
11692
11693 trace("test IUri_GetPropertyLength...\n");
11695
11696 trace("test IUri_GetProperties...\n");
11698
11699 trace("test IUri_HasProperty...\n");
11701
11702 trace("test IUri_IsEqual...\n");
11704
11705 trace("test CreateUriWithFragment invalid args...\n");
11707
11708 trace("test CreateUriWithFragment invalid flags...\n");
11710
11711 trace("test CreateUriWithFragment...\n");
11713
11714 trace("test CreateIUriBuilder...\n");
11716
11717 trace("test IUriBuilder_CreateInvalidArgs...\n");
11719
11720 trace("test IUriBuilder...\n");
11722
11723 trace("test IUriBuilder_GetInvalidArgs...\n");
11725
11726 trace("test IUriBuilder_HasBeenModified...\n");
11728
11729 trace("test IUriBuilder_IUriProperty...\n");
11731
11732 trace("test IUriBuilder_RemoveProperties...\n");
11734
11735 trace("test IUriBuilder miscellaneous...\n");
11737
11738 trace("test IUriBuilderFactory...\n");
11740
11741 trace("test CoInternetCombineIUri...\n");
11743
11744 trace("test CoInternetCombineUrlEx...\n");
11746
11747 trace("test CoInternetParseIUri Invalid Args...\n");
11749
11750 trace("test CoInternetParseIUri...\n");
11752
11754
11755 trace("test CoInternetCombineIUri pluggable...\n");
11757
11758 trace("test CoInternetCombineUrlEx Pluggable...\n");
11760
11761 trace("test CoInternetParseIUri pluggable...\n");
11763
11764 trace("test CreateURLMoniker...\n");
11766
11768
11769 trace("test IPersistStream...\n");
11771
11772 trace("test uninitialized Uri...\n");
11774
11777}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static void test_IUriBuilder_CreateInvalidArgs(void)
Definition: uri.c:9072
static void test_CreateIUriBuilder(void)
Definition: uri.c:8885
static void test_CoInternetCombineUrlEx_Pluggable(void)
Definition: uri.c:10921
static void test_CreateUri_InvalidUri(void)
Definition: uri.c:7825
static void test_IUriBuilder_HasBeenModified(void)
Definition: uri.c:10099
static void test_IUri_HasProperty(void)
Definition: uri.c:8466
static void test_IUriBuilder_RemoveProperties(void)
Definition: uri.c:10342
static void test_CoInternetParseIUri_Pluggable(void)
Definition: uri.c:11084
static void unregister_protocols(void)
Definition: uri.c:10776
static void test_IUri_GetProperties(void)
Definition: uri.c:8417
static void test_CoInternetParseIUri(void)
Definition: uri.c:11044
static void test_CreateURLMoniker(void)
Definition: uri.c:11237
static void test_CreateUriWithFragment_InvalidArgs(void)
Definition: uri.c:8813
static void test_CoInternetCombineIUri_Pluggable(void)
Definition: uri.c:10791
static void test_IUriBuilder_Misc(void)
Definition: uri.c:10426
static void test_CoInternetCombineIUri(void)
Definition: uri.c:10541
static void test_CreateUri_InvalidFlags(void)
Definition: uri.c:7786
static void test_IUri_GetPropertyBSTR(void)
Definition: uri.c:7845
static void test_IUri_GetDwordProperties(void)
Definition: uri.c:8237
static void test_IUri_GetPropertyDWORD(void)
Definition: uri.c:7921
static void test_CoInternetParseIUri_InvalidArgs(void)
Definition: uri.c:10953
static void test_IUriBuilder_IUriProperty(void)
Definition: uri.c:10205
static void register_protocols(void)
Definition: uri.c:10759
static void test_UninitializedUri(void)
Definition: uri.c:11561
static void test_IUri_GetStrProperties(void)
Definition: uri.c:7976
static void test_IUriBuilder_GetInvalidArgs(void)
Definition: uri.c:9164
static void test_CreateUriWithFragment(void)
Definition: uri.c:8847
static void test_IUriBuilderFactory(void)
Definition: uri.c:10454
static void test_IPersistStream(void)
Definition: uri.c:11330
static void test_IUri_IsEqual(void)
Definition: uri.c:8736
static void test_IUri_GetPropertyLength(void)
Definition: uri.c:8326
static void test_IUriBuilder(void)
Definition: uri.c:10019
static void test_CreateUriWithFragment_InvalidFlags(void)
Definition: uri.c:8833
static void test_CreateUri_InvalidArgs(void)
Definition: uri.c:7800
static void test_CoInternetCombineUrlEx(void)
Definition: uri.c:10830
#define win_skip
Definition: test.h:163

◆ strcmp_aw()

◆ test_CoInternetCombineIUri()

static void test_CoInternetCombineIUri ( void  )
static

Definition at line 10541 of file uri.c.

10541 {
10542 HRESULT hr;
10543 IUri *base, *relative, *result;
10544 DWORD i;
10545
10546 base = NULL;
10547 hr = pCreateUri(http_urlW, 0, 0, &base);
10548 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10549 if(SUCCEEDED(hr)) {
10550 result = (void*) 0xdeadbeef;
10551 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10552 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10553 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10554 }
10555
10556 relative = NULL;
10557 hr = pCreateUri(http_urlW, 0, 0, &relative);
10558 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10559 if(SUCCEEDED(hr)) {
10560 result = (void*) 0xdeadbeef;
10561 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10562 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10563 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10564 }
10565
10566 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10567 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10568
10569 if(base) IUri_Release(base);
10570 if(relative) IUri_Release(relative);
10571
10572 for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) {
10573 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10574
10575 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10576 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10577 if(SUCCEEDED(hr)) {
10578 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10579
10580 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10581 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10582 if(SUCCEEDED(hr)) {
10583 result = NULL;
10584
10585 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10588 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10590 if(SUCCEEDED(hr)) {
10591 DWORD j;
10592
10593 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) {
10595 BSTR received;
10596
10597 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10598 todo_wine_if(prop.todo) {
10599 ok(hr == prop.expected,
10600 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10601 hr, prop.expected, i, j);
10602 ok(!strcmp_aw(prop.value, received) ||
10604 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10605 prop.value, wine_dbgstr_w(received), i, j);
10606 }
10608 }
10609
10610 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) {
10613
10614 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10615 todo_wine_if(prop.todo) {
10616 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10617 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10618 hr, prop.expected, i, j);
10619 if(!prop.broken_combine_hres || hr != S_FALSE)
10620 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10621 prop.value, received, i, j);
10622 }
10623 }
10624 }
10625 if(result) IUri_Release(result);
10626 }
10627 if(relative) IUri_Release(relative);
10628 heap_free(relativeW);
10629 }
10630 if(base) IUri_Release(base);
10632 }
10633}
static WCHAR baseW[MAX_PATH]
Definition: FindFiles.c:24
#define broken(x)
Definition: atltest.h:178
#define ARRAY_SIZE(A)
Definition: main.h:20
#define E_INVALIDARG
Definition: ddrawi.h:101
r received
Definition: btrfs.c:3005
GLuint64EXT * result
Definition: glext.h:11304
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 const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define SUCCEEDED(hr)
Definition: intsafe.h:50
BOOL todo
Definition: filedlg.c:313
BOOL expected
Definition: store.c:2063
static const uri_combine_test uri_combine_tests[]
Definition: uri.c:6441
static const WCHAR http_urlW[]
Definition: uri.c:82
const char * broken_value
Definition: uri.c:6424
const char * value
Definition: uri.c:6421
uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT]
Definition: uri.c:6437
uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT]
Definition: uri.c:6438
HRESULT expected
Definition: uri.c:125
BOOL broken_combine_hres
Definition: uri.c:127
#define S_FALSE
Definition: winerror.h:2357

Referenced by START_TEST().

◆ test_CoInternetCombineIUri_Pluggable()

static void test_CoInternetCombineIUri_Pluggable ( void  )
static

Definition at line 10791 of file uri.c.

10791 {
10792 HRESULT hr;
10793 IUri *base = NULL;
10794
10795 hr = pCreateUri(combine_baseW, 0, 0, &base);
10796 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10797 if(SUCCEEDED(hr)) {
10798 IUri *relative = NULL;
10799
10800 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10801 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10802 if(SUCCEEDED(hr)) {
10803 IUri *result = NULL;
10804
10805 SET_EXPECT(CombineUrl);
10806
10808 &result, 0);
10809 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10810
10811 CHECK_CALLED(CombineUrl);
10812
10813 if(SUCCEEDED(hr)) {
10814 BSTR received = NULL;
10815 hr = IUri_GetAbsoluteUri(result, &received);
10816 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10817 if(SUCCEEDED(hr)) {
10818 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10820 }
10822 }
10823 if(result) IUri_Release(result);
10824 }
10825 if(relative) IUri_Release(relative);
10826 }
10827 if(base) IUri_Release(base);
10828}
#define SET_EXPECT(func)
Definition: uri.c:47
#define CHECK_CALLED(func)
Definition: uri.c:63

Referenced by START_TEST().

◆ test_CoInternetCombineUrlEx()

static void test_CoInternetCombineUrlEx ( void  )
static

Definition at line 10830 of file uri.c.

10830 {
10831 HRESULT hr;
10832 IUri *base, *result;
10833 DWORD i;
10834
10835 base = NULL;
10836 hr = pCreateUri(http_urlW, 0, 0, &base);
10837 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10838 if(SUCCEEDED(hr)) {
10839 result = (void*) 0xdeadbeef;
10840 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10841 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10842 hr, E_UNEXPECTED);
10843 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10844 }
10845
10846 result = (void*) 0xdeadbeef;
10847 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10848 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10849 hr, E_INVALIDARG);
10850 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10851
10852 result = (void*) 0xdeadbeef;
10853 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10854 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10855 hr, E_UNEXPECTED);
10856 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10857
10858 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10859 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10860 hr, E_POINTER);
10861 if(base) IUri_Release(base);
10862
10863 for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) {
10864 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10865
10866 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10867 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10868 if(SUCCEEDED(hr)) {
10869 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10870
10871 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10872 &result, 0);
10875 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10877 if(SUCCEEDED(hr)) {
10878 DWORD j;
10879
10880 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) {
10882 BSTR received;
10883 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10884
10885 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10886 todo_wine_if(prop.todo) {
10887 ok(hr == prop.expected,
10888 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10889 hr, prop.expected, i, j);
10892 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10894 }
10896 }
10897
10898 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) {
10901
10902 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10903 todo_wine_if(prop.todo) {
10904 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10905 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10906 hr, prop.expected, i, j);
10907 if(!prop.broken_combine_hres || hr != S_FALSE)
10908 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10909 prop.value, received, i, j);
10910 }
10911 }
10912 }
10913 if(result) IUri_Release(result);
10914 heap_free(relativeW);
10915 }
10916 if(base) IUri_Release(base);
10918 }
10919}
const char * value_ex
Definition: uri.c:6425
#define E_UNEXPECTED
Definition: winerror.h:2456
#define E_POINTER
Definition: winerror.h:2365
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by START_TEST().

◆ test_CoInternetCombineUrlEx_Pluggable()

static void test_CoInternetCombineUrlEx_Pluggable ( void  )
static

Definition at line 10921 of file uri.c.

10921 {
10922 HRESULT hr;
10923 IUri *base = NULL;
10924
10925 hr = pCreateUri(combine_baseW, 0, 0, &base);
10926 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10927 if(SUCCEEDED(hr)) {
10928 IUri *result = NULL;
10929
10930 SET_EXPECT(CombineUrl);
10931
10933 &result, 0);
10934 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10935
10936 CHECK_CALLED(CombineUrl);
10937
10938 if(SUCCEEDED(hr)) {
10939 BSTR received = NULL;
10940 hr = IUri_GetAbsoluteUri(result, &received);
10941 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10942 if(SUCCEEDED(hr)) {
10943 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10945 }
10947 }
10948 if(result) IUri_Release(result);
10949 }
10950 if(base) IUri_Release(base);
10951}

Referenced by START_TEST().

◆ test_CoInternetParseIUri()

static void test_CoInternetParseIUri ( void  )
static

Definition at line 11044 of file uri.c.

11044 {
11045 DWORD i;
11046
11047 for(i = 0; i < ARRAY_SIZE(uri_parse_tests); ++i) {
11048 HRESULT hr;
11049 IUri *uri;
11050 LPWSTR uriW;
11052
11053 uriW = a2w(test.uri);
11054 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
11055 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
11056 if(SUCCEEDED(hr)) {
11058 DWORD result_len = -1;
11059
11060 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
11061 todo_wine_if(test.todo)
11062 ok(hr == test.expected,
11063 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
11064 hr, test.expected, i);
11065 if(SUCCEEDED(hr)) {
11066 DWORD len = lstrlenA(test.property);
11067 ok(!strcmp_aw(test.property, result) || (test.property2 && !strcmp_aw(test.property2, result)),
11068 "Error: Expected %s but got %s instead on uri_parse_tests[%d] - %s.\n",
11069 test.property, wine_dbgstr_w(result), i, wine_dbgstr_w(uriW));
11070 ok(len == result_len || (test.property2 && lstrlenA(test.property2) == result_len),
11071 "Error: Expected %d, but got %d instead on uri_parse_tests[%d] - %s.\n",
11072 len, result_len, i, wine_dbgstr_w(uriW));
11073 } else {
11074 ok(!result_len,
11075 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
11076 result_len, i);
11077 }
11078 }
11079 if(uri) IUri_Release(uri);
11080 heap_free(uriW);
11081 }
11082}
BOOL Error
Definition: chkdsk.c:66
HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD dwFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD_PTR dwReserved)
Definition: uri.c:7247
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble n
Definition: glext.h:7729
#define d
Definition: ke_i.h:81
if(dx< 0)
Definition: linetemp.h:194
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static const uri_parse_test uri_parse_tests[]
Definition: uri.c:7612

Referenced by START_TEST().

◆ test_CoInternetParseIUri_InvalidArgs()

static void test_CoInternetParseIUri_InvalidArgs ( void  )
static

Definition at line 10953 of file uri.c.

10953 {
10954 HRESULT hr;
10955 IUri *uri = NULL;
10956 WCHAR tmp[3];
10957 WCHAR *longurl, *copy;
10958 DWORD result = -1;
10959 DWORD i, len;
10960
10961 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10962 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10963 hr, E_INVALIDARG);
10964 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10965
10966 hr = pCreateUri(http_urlW, 0, 0, &uri);
10967 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10968 if(SUCCEEDED(hr)) {
10969 DWORD expected_len;
10970
10971 result = -1;
10972 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10973 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10974 hr, E_INVALIDARG);
10975 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10976
10977 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10978 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10979 hr, E_POINTER);
10980
10981 result = -1;
10982 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10983 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10984 hr, E_FAIL);
10985 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10986
10987 result = -1;
10988 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10989 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10990 hr, E_FAIL);
10991 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10992
10993 result = -1;
10994 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10995 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10996 hr, E_FAIL);
10997 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10998
10999 result = -1;
11000 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
11001 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11002 hr, E_FAIL);
11003 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11004
11005 expected_len = lstrlenW(http_urlW);
11006 result = -1;
11007 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
11009 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11011 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
11012 expected_len, result);
11013 }
11014 if(uri) IUri_Release(uri);
11015
11016 /* a long url that causes a crash on Wine */
11018 longurl = heap_alloc((len+1)*sizeof(WCHAR));
11019 memcpy(longurl, http_urlW, sizeof(http_urlW));
11020 for(i = ARRAY_SIZE(http_urlW)-1; i < len; i++)
11021 longurl[i] = 'x';
11022 longurl[len] = 0;
11023
11024 copy = heap_alloc((len+1)*sizeof(WCHAR));
11025 memcpy(copy, longurl, (len+1)*sizeof(WCHAR));
11026
11027 hr = pCreateUri(longurl, 0, 0, &uri);
11028 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
11029 if(SUCCEEDED(hr)) {
11030 result = -1;
11031 memset(longurl, 0xcc, len*sizeof(WCHAR));
11032 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, longurl, len+1, &result, 0);
11033 ok(SUCCEEDED(hr), "Error: CoInternetParseIUri returned 0x%08x.\n", hr);
11034 ok(!lstrcmpW(longurl, copy), "Error: expected long url '%s' but was '%s'.\n",
11035 wine_dbgstr_w(copy), wine_dbgstr_w(longurl));
11036 ok(result == len, "Error: Expected 'result' to be %d, but was %d instead.\n",
11037 len, result);
11038 }
11039 heap_free(longurl);
11040 heap_free(copy);
11041 if(uri) IUri_Release(uri);
11042}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define E_FAIL
Definition: ddrawi.h:102
#define memset(x, y, z)
Definition: compat.h:39
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103

Referenced by START_TEST().

◆ test_CoInternetParseIUri_Pluggable()

static void test_CoInternetParseIUri_Pluggable ( void  )
static

Definition at line 11084 of file uri.c.

11084 {
11085 HRESULT hr;
11086 IUri *uri = NULL;
11087
11088 hr = pCreateUri(parse_urlW, 0, 0, &uri);
11089 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
11090 if(SUCCEEDED(hr)) {
11091 WCHAR result[200];
11092 DWORD result_len;
11093
11094 SET_EXPECT(ParseUrl);
11095
11096 parse_action = PARSE_CANONICALIZE;
11098
11099 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
11100 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
11101
11102 CHECK_CALLED(ParseUrl);
11103
11104 if(SUCCEEDED(hr)) {
11105 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
11106 lstrlenW(parse_resultW), result_len);
11107 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
11109 }
11110 }
11111 if(uri) IUri_Release(uri);
11112}
#define URL_ESCAPE_UNSAFE
Definition: shlwapi.h:1237
#define URL_UNESCAPE
Definition: shlwapi.h:1238

Referenced by START_TEST().

◆ test_CreateIUriBuilder()

static void test_CreateIUriBuilder ( void  )
static

Definition at line 8885 of file uri.c.

8885 {
8886 HRESULT hr;
8887 IUriBuilder *builder = NULL;
8888 IUri *uri;
8889
8890 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8891 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8892 hr, E_POINTER);
8893
8894 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8895 hr = pCreateUri(http_urlW, 0, 0, &uri);
8896 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8897 if(SUCCEEDED(hr)) {
8898 ULONG cur_count, orig_count;
8899
8900 orig_count = get_refcnt(uri);
8901 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8902 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8903 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8904
8905 cur_count = get_refcnt(uri);
8906 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8907
8908 if(builder) IUriBuilder_Release(builder);
8909 cur_count = get_refcnt(uri);
8910 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8911 }
8912 if(uri) IUri_Release(uri);
8913}
static ULONG get_refcnt(IUri *uri)
Definition: uri.c:7707
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_CreateUri_InvalidArgs()

static void test_CreateUri_InvalidArgs ( void  )
static

Definition at line 7800 of file uri.c.

7800 {
7801 HRESULT hr;
7802 IUri *uri = (void*) 0xdeadbeef;
7803
7804 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7805 static const WCHAR emptyW[] = {0};
7806
7807 hr = pCreateUri(http_urlW, 0, 0, NULL);
7808 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7809
7810 hr = pCreateUri(NULL, 0, 0, &uri);
7811 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7812 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7813
7814 uri = (void*) 0xdeadbeef;
7815 hr = pCreateUri(invalidW, 0, 0, &uri);
7816 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7817 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7818
7819 uri = (void*) 0xdeadbeef;
7820 hr = pCreateUri(emptyW, 0, 0, &uri);
7821 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7822 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7823}
static const WCHAR emptyW[]
Definition: navigate.c:40
static const WCHAR invalidW[]
Definition: locale.c:46

Referenced by START_TEST().

◆ test_CreateUri_InvalidFlags()

static void test_CreateUri_InvalidFlags ( void  )
static

Definition at line 7786 of file uri.c.

7786 {
7787 DWORD i;
7788
7789 for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) {
7790 HRESULT hr;
7791 IUri *uri = (void*) 0xdeadbeef;
7792
7793 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7794 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7796 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7797 }
7798}
static const uri_create_flag_test invalid_flag_tests[]
Definition: uri.c:105

Referenced by START_TEST().

◆ test_CreateUri_InvalidUri()

static void test_CreateUri_InvalidUri ( void  )
static

Definition at line 7825 of file uri.c.

7825 {
7826 DWORD i;
7827
7828 for(i = 0; i < ARRAY_SIZE(invalid_uri_tests); ++i) {
7830 IUri *uri = NULL;
7831 LPWSTR uriW;
7832 HRESULT hr;
7833
7834 uriW = a2w(test.uri);
7835 hr = pCreateUri(uriW, test.flags, 0, &uri);
7836 todo_wine_if(test.todo)
7837 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7838 hr, E_INVALIDARG, i);
7839 if(uri) IUri_Release(uri);
7840
7841 heap_free(uriW);
7842 }
7843}
HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
Definition: uri.c:5700
static const invalid_uri invalid_uri_tests[]
Definition: uri.c:5071

Referenced by START_TEST().

◆ test_CreateUriWithFragment()

static void test_CreateUriWithFragment ( void  )
static

Definition at line 8847 of file uri.c.

8847 {
8848 DWORD i;
8849
8850 for(i = 0; i < ARRAY_SIZE(uri_fragment_tests); ++i) {
8851 HRESULT hr;
8852 IUri *uri = NULL;
8853 LPWSTR uriW, fragW;
8855
8856 uriW = a2w(test.uri);
8857 fragW = a2w(test.fragment);
8858
8859 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8860 todo_wine_if(test.expected_todo)
8861 ok(hr == test.create_expected,
8862 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8863 hr, test.create_expected, i);
8864
8865 if(SUCCEEDED(hr)) {
8866 BSTR received = NULL;
8867
8868 hr = IUri_GetAbsoluteUri(uri, &received);
8869 todo_wine_if(test.expected_todo) {
8870 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8871 hr, S_OK, i);
8872 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8873 test.expected_uri, wine_dbgstr_w(received), i);
8874 }
8875
8877 }
8878
8879 if(uri) IUri_Release(uri);
8880 heap_free(uriW);
8881 heap_free(fragW);
8882 }
8883}
HRESULT WINAPI CreateUriWithFragment(LPCWSTR pwzURI, LPCWSTR pwzFragment, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
Definition: uri.c:5795
static const uri_with_fragment uri_fragment_tests[]
Definition: uri.c:5285

Referenced by START_TEST().

◆ test_CreateUriWithFragment_InvalidArgs()

static void test_CreateUriWithFragment_InvalidArgs ( void  )
static

Definition at line 8813 of file uri.c.

8813 {
8814 HRESULT hr;
8815 IUri *uri = (void*) 0xdeadbeef;
8816 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8817
8818 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8819 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8820 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8821
8822 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8823 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8824
8825 /* Original URI can't already contain a fragment component. */
8826 uri = (void*) 0xdeadbeef;
8827 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8828 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8829 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8830}
static const WCHAR http_url_fragW[]
Definition: uri.c:84

Referenced by START_TEST().

◆ test_CreateUriWithFragment_InvalidFlags()

static void test_CreateUriWithFragment_InvalidFlags ( void  )
static

Definition at line 8833 of file uri.c.

8833 {
8834 DWORD i;
8835
8836 for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) {
8837 HRESULT hr;
8838 IUri *uri = (void*) 0xdeadbeef;
8839
8840 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8841 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8843 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8844 }
8845}

Referenced by START_TEST().

◆ test_CreateURLMoniker()

static void test_CreateURLMoniker ( void  )
static

Definition at line 11237 of file uri.c.

11238{
11240 IMoniker *mon, *base_mon;
11241 WCHAR *url, *base_url;
11242 IUri *uri, *base_uri;
11243 HRESULT hres;
11244
11246 url = a2w(test->url);
11247 base_url = a2w(test->base_url);
11248
11249 if(base_url) {
11250 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
11251 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11252
11253 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
11254 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11255 }else {
11256 base_uri = NULL;
11257 base_mon = NULL;
11258 }
11259
11260 hres = CreateURLMoniker(base_mon, url, &mon);
11261 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11262 test_urlmon_display_name(mon, test->legacy_url);
11263 test_display_uri(mon, test->legacy_url);
11264 IMoniker_Release(mon);
11265
11266 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
11267 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11268 test_urlmon_display_name(mon, test->legacy_url);
11269 test_display_uri(mon, test->legacy_url);
11270 IMoniker_Release(mon);
11271
11272 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
11273 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11274 test_urlmon_display_name(mon, test->uniform_url);
11275 test_display_uri(mon, test->uniform_url);
11276 IMoniker_Release(mon);
11277
11278 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
11279 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11280 test_urlmon_display_name(mon, test->no_canon_url);
11281 test_display_uri(mon, test->no_canon_url);
11282 IMoniker_Release(mon);
11283
11284 hres = pCreateUri(url, test->uri_flags, 0, &uri);
11285 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11286
11287 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
11288 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11289 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
11290 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
11291 IMoniker_Release(mon);
11292
11293 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
11294 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11295 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
11296 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
11297 IMoniker_Release(mon);
11298
11299 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
11300 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11301 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
11302 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
11303 IMoniker_Release(mon);
11304
11305 IUri_Release(uri);
11306 heap_free(url);
11308 if(base_uri)
11309 IUri_Release(base_uri);
11310 if(base_mon)
11311 IMoniker_Release(base_mon);
11312 }
11313}
static const WCHAR url[]
Definition: encode.c:1432
const char * base_url
Definition: mimeole.c:1466
#define test_urlmon_display_name(a, b)
Definition: uri.c:11198
#define test_display_uri(a, b)
Definition: uri.c:11212
static const create_urlmon_test_t create_urlmon_tests[]
Definition: uri.c:11125
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732

Referenced by START_TEST(), and test_create().

◆ test_IPersistStream()

static void test_IPersistStream ( void  )
static

Definition at line 11330 of file uri.c.

11331{
11332 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
11333
11334 props_order[Uri_PROPERTY_RAW_URI] = 1;
11335 props_order[Uri_PROPERTY_FRAGMENT] = 2;
11336 props_order[Uri_PROPERTY_HOST] = 3;
11337 props_order[Uri_PROPERTY_PASSWORD] = 4;
11338 props_order[Uri_PROPERTY_PATH] = 5;
11339 props_order[Uri_PROPERTY_PORT] = 6;
11340 props_order[Uri_PROPERTY_QUERY] = 7;
11341 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
11342 props_order[Uri_PROPERTY_USER_NAME] = 9;
11343
11344 for(i = 0; i < ARRAY_SIZE(uri_tests); i++) {
11345 const uri_properties *test = uri_tests+i;
11346 LPWSTR uriW;
11347 IUri *uri;
11348 IPersistStream *persist_stream;
11349 IStream *stream;
11350 IMarshal *marshal;
11351 DWORD props, props_no, dw_data[6];
11352 WCHAR str_data[1024];
11354 LARGE_INTEGER no_off;
11355 CLSID curi;
11356 BSTR raw_uri;
11357 HRESULT hr;
11358
11359 if(test->create_todo || test->create_expected!=S_OK)
11360 continue;
11361
11362 uriW = a2w(test->uri);
11363 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
11364 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
11365
11366 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11367 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11368
11370 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
11371 hr = IPersistStream_IsDirty(persist_stream);
11372 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11373 hr = IPersistStream_Save(persist_stream, stream, FALSE);
11374 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
11375 hr = IPersistStream_IsDirty(persist_stream);
11376 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11377 no_off.QuadPart = 0;
11378 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11379 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11380 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11381 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11382 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
11383 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
11384 ok(U(size).LowPart+2 == U(max_size).LowPart,
11385 "%d) Written data size is %d, max_size %d.\n",
11386 i, U(size).LowPart, U(max_size).LowPart);
11387
11388 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
11389 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11390 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11391 i, dw_data[0]-2, U(size).LowPart);
11392 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
11393 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11394 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
11395 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
11396 ok(dw_data[2] == add_default_flags(test->create_flags),
11397 "%d) Incorrect value %x, expected %x (creation flags).\n",
11398 i, dw_data[2], add_default_flags(test->create_flags));
11399 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
11400 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
11401 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
11402
11403 props_no = 0;
11404 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
11405 if(!props_order[props])
11406 continue;
11407
11408 if(props <= Uri_PROPERTY_STRING_LAST) {
11409 if(test->str_props[props].expected == S_OK)
11410 props_no++;
11411 } else {
11412 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
11413 props_no++;
11414 }
11415 }
11416 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
11417 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
11418 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
11419 props_no = 1;
11420
11421 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
11422 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11423 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
11424
11425 dw_data[2] = 0;
11426 dw_data[3] = -1;
11427 while(props) {
11428 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
11429 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11430 props--;
11431 ok(dw_data[2]<props_order[dw_data[0]],
11432 "%d) Incorrect properties order (%d, %d)\n",
11433 i, dw_data[0], dw_data[3]);
11434 dw_data[2] = props_order[dw_data[0]];
11435 dw_data[3] = dw_data[0];
11436
11437 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
11438 const uri_str_property *prop = test->str_props+dw_data[0];
11439 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
11440 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11441 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
11442 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
11443 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
11444 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
11445 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
11446 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
11447 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11448 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
11449 } else {
11450 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
11451 break;
11452 }
11453 }
11454 ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
11455 i, props, dw_data[0]);
11456
11457 IUri_Release(uri);
11458
11459 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11460 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11461 hr = IPersistStream_GetClassID(persist_stream, &curi);
11462 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
11463 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
11464 IPersistStream_Release(persist_stream);
11465
11466 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11467 &IID_IUri, (void**)&uri);
11468 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11469 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11470 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11471 hr = IPersistStream_Load(persist_stream, stream);
11472 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
11473 hr = IUri_GetRawUri(uri, &raw_uri);
11474 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11475 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11476 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11477 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11478 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11479 wine_dbgstr_w(raw_uri));
11480 SysFreeString(raw_uri);
11481 IPersistStream_Release(persist_stream);
11482
11483 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11484 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
11485 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11486 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11487 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11488 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
11489 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11490 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11491 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11492 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11493 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11494 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11495 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11496 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11497 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11498 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11499 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11500 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11501 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11502 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11503 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11504 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11505 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11506 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11507 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11508 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11509 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11510 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
11511 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11512
11513 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11514 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11515 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11516 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11517 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11518 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11519 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11520 i, dw_data[0]-2, U(size).LowPart);
11521 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11522 i, dw_data[1]);
11523 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11524 i, dw_data[2], dw_data[0]-8);
11525 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11526 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11527 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11528 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11529 U(max_size).LowPart += 3*sizeof(DWORD);
11530 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11531 i, dw_data[2], U(max_size).LowPart);
11532 IMarshal_Release(marshal);
11533 IUri_Release(uri);
11534
11535 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11536 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11537 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11538 &IID_IUri, (void**)&uri);
11539 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11540 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11541 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11542 IUri_Release(uri);
11543 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11544 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11545 hr = IUri_GetRawUri(uri, &raw_uri);
11546 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11547 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11548 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11549 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11550 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11551 wine_dbgstr_w(raw_uri));
11552 SysFreeString(raw_uri);
11553
11554 IMarshal_Release(marshal);
11555 IStream_Release(stream);
11556 IUri_Release(uri);
11557 heap_free(uriW);
11558 }
11559}
#define U(x)
Definition: wordpad.c:45
static INT max_size
Definition: history.c:51
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
GLsizeiptr size
Definition: glext.h:5919
static const uri_properties uri_tests[]
Definition: uri.c:140
static int add_default_flags(DWORD flags)
Definition: uri.c:11315
#define DWORD
Definition: nt_native.h:44
const GUID IID_IPersistStream
Definition: proxy.cpp:13
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
@ URL_SCHEME_HTTPS
Definition: shlwapi.h:1183
@ URL_SCHEME_FTP
Definition: shlwapi.h:1173
@ URL_SCHEME_HTTP
Definition: shlwapi.h:1174
const char * value
Definition: uri.c:115
const char * broken_value
Definition: uri.c:118
char * value
Definition: compiler.c:67
Definition: parse.h:23
LONGLONG QuadPart
Definition: typedefs.h:114
static const WCHAR props[]
Definition: wbemdisp.c:288

Referenced by START_TEST().

◆ test_IUri_GetDwordProperties()

static void test_IUri_GetDwordProperties ( void  )
static

Definition at line 8237 of file uri.c.

8237 {
8238 IUri *uri = NULL;
8239 HRESULT hr;
8240 DWORD i;
8241
8242 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
8243 hr = pCreateUri(http_urlW, 0, 0, &uri);
8244 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8245 if(SUCCEEDED(hr)) {
8246 hr = IUri_GetHostType(uri, NULL);
8247 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8248
8249 hr = IUri_GetPort(uri, NULL);
8250 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8251
8252 hr = IUri_GetScheme(uri, NULL);
8253 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8254
8255 hr = IUri_GetZone(uri, NULL);
8256 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8257 }
8258 if(uri) IUri_Release(uri);
8259
8260 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8262 LPWSTR uriW;
8263 uri = NULL;
8264
8265 uriW = a2w(test.uri);
8266 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8267 todo_wine_if(test.create_todo)
8268 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8269 hr, test.create_expected, i);
8270
8271 if(SUCCEEDED(hr)) {
8272 uri_dword_property prop;
8274
8275 /* Assign an insane value so tests don't accidentally pass when
8276 * they shouldn't!
8277 */
8278 received = -9999999;
8279
8280 /* GetHostType() tests. */
8281 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
8282 hr = IUri_GetHostType(uri, &received);
8283 todo_wine_if(prop.todo) {
8284 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8285 hr, prop.expected, i);
8286 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8287 }
8288 received = -9999999;
8289
8290 /* GetPort() tests. */
8291 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8292 hr = IUri_GetPort(uri, &received);
8293 todo_wine_if(prop.todo) {
8294 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8295 hr, prop.expected, i);
8296 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8297 }
8298 received = -9999999;
8299
8300 /* GetScheme() tests. */
8301 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8302 hr = IUri_GetScheme(uri, &received);
8303 todo_wine_if(prop.todo) {
8304 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8305 hr, prop.expected, i);
8306 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8307 }
8308 received = -9999999;
8309
8310 /* GetZone() tests. */
8311 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8312 hr = IUri_GetZone(uri, &received);
8313 todo_wine_if(prop.todo) {
8314 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8315 hr, prop.expected, i);
8316 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8317 }
8318 }
8319
8320 if(uri) IUri_Release(uri);
8321
8322 heap_free(uriW);
8323 }
8324}

Referenced by START_TEST().

◆ test_IUri_GetProperties()

static void test_IUri_GetProperties ( void  )
static

Definition at line 8417 of file uri.c.

8417 {
8418 IUri *uri = NULL;
8419 HRESULT hr;
8420 DWORD i;
8421
8422 hr = pCreateUri(http_urlW, 0, 0, &uri);
8423 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8424 if(SUCCEEDED(hr)) {
8425 hr = IUri_GetProperties(uri, NULL);
8426 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8427 }
8428 if(uri) IUri_Release(uri);
8429
8430 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8432 LPWSTR uriW;
8433 uri = NULL;
8434
8435 uriW = a2w(test.uri);
8436 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8437 todo_wine_if(test.create_todo)
8438 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8439
8440 if(SUCCEEDED(hr)) {
8441 DWORD received = 0, expected_props, mask;
8442 DWORD j;
8443
8444 hr = IUri_GetProperties(uri, &received);
8445 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8446
8447 expected_props = compute_expected_props(&test, &mask);
8448
8449 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8450 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8451 if(mask & (1 << j)) {
8452 if(expected_props & (1 << j))
8453 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
8454 else
8455 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
8456 }
8457 }
8458 }
8459
8460 if(uri) IUri_Release(uri);
8461
8462 heap_free(uriW);
8463 }
8464}
static DWORD compute_expected_props(uri_properties *test, DWORD *mask)
Definition: uri.c:8393

Referenced by START_TEST().

◆ test_IUri_GetPropertyBSTR()

static void test_IUri_GetPropertyBSTR ( void  )
static

Definition at line 7845 of file uri.c.

7845 {
7846 IUri *uri = NULL;
7847 HRESULT hr;
7848 DWORD i;
7849
7850 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7851 hr = pCreateUri(http_urlW, 0, 0, &uri);
7852 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7853 if(SUCCEEDED(hr)) {
7854 BSTR received = NULL;
7855
7856 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7857 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7858
7859 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7860 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7861 ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr);
7862 if(SUCCEEDED(hr)) {
7863 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7864 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7866 }else {
7867 ok(!received, "received = %s\n", wine_dbgstr_w(received));
7868 }
7869
7870 /* Make sure it handles the ZONE property correctly. */
7871 received = NULL;
7872 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7873 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7874 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7875 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7877 }
7878 if(uri) IUri_Release(uri);
7879
7880 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
7882 LPWSTR uriW;
7883 uri = NULL;
7884
7885 uriW = a2w(test.uri);
7886 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7887 todo_wine_if(test.create_todo)
7888 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7889 hr, test.create_expected, i);
7890
7891 if(SUCCEEDED(hr)) {
7892 DWORD j;
7893
7894 /* Checks all the string properties of the uri. */
7895 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7896 BSTR received = NULL;
7897 uri_str_property prop = test.str_props[j];
7898
7899 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7900 todo_wine_if(prop.todo) {
7901 ok(hr == prop.expected ||
7902 (prop.value2 && hr == prop.expected2),
7903 "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7904 hr, prop.expected, i, j);
7905 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)) ||
7907 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7908 prop.value, wine_dbgstr_w(received), i, j);
7909 }
7910
7912 }
7913 }
7914
7915 if(uri) IUri_Release(uri);
7916
7917 heap_free(uriW);
7918 }
7919}
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
@ Failed
Definition: arc.h:79
HRESULT expected2
Definition: uri.c:120
const char * value2
Definition: uri.c:119
HRESULT expected
Definition: uri.c:116

Referenced by START_TEST().

◆ test_IUri_GetPropertyDWORD()

static void test_IUri_GetPropertyDWORD ( void  )
static

Definition at line 7921 of file uri.c.

7921 {
7922 IUri *uri = NULL;
7923 HRESULT hr;
7924 DWORD i;
7925
7926 hr = pCreateUri(http_urlW, 0, 0, &uri);
7927 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7928 if(SUCCEEDED(hr)) {
7929 DWORD received = 0xdeadbeef;
7930
7931 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7932 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7933
7934 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7935 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7936 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7937 }
7938 if(uri) IUri_Release(uri);
7939
7940 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
7942 LPWSTR uriW;
7943 uri = NULL;
7944
7945 uriW = a2w(test.uri);
7946 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7947 todo_wine_if(test.create_todo)
7948 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7949 hr, test.create_expected, i);
7950
7951 if(SUCCEEDED(hr)) {
7952 DWORD j;
7953
7954 /* Checks all the DWORD properties of the uri. */
7955 for(j = 0; j < ARRAY_SIZE(test.dword_props); ++j) {
7957 uri_dword_property prop = test.dword_props[j];
7958
7959 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
7960 todo_wine_if(prop.todo) {
7961 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7962 hr, prop.expected, i, j);
7963 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7964 prop.value, received, i, j);
7965 }
7966 }
7967 }
7968
7969 if(uri) IUri_Release(uri);
7970
7971 heap_free(uriW);
7972 }
7973}

Referenced by START_TEST().

◆ test_IUri_GetPropertyLength()

static void test_IUri_GetPropertyLength ( void  )
static

Definition at line 8326 of file uri.c.

8326 {
8327 IUri *uri = NULL;
8328 HRESULT hr;
8329 DWORD i;
8330
8331 /* Make sure it handles invalid args correctly. */
8332 hr = pCreateUri(http_urlW, 0, 0, &uri);
8333 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8334 if(SUCCEEDED(hr)) {
8335 DWORD received = 0xdeadbeef;
8336
8337 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8338 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8339
8340 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8341 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8342 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
8343 }
8344 if(uri) IUri_Release(uri);
8345
8346 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8348 LPWSTR uriW;
8349 uri = NULL;
8350
8351 uriW = a2w(test.uri);
8352 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8353 todo_wine_if(test.create_todo)
8354 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8355 hr, test.create_expected, i);
8356
8357 if(SUCCEEDED(hr)) {
8358 DWORD j;
8359
8360 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8361 DWORD expectedLen, receivedLen;
8362 uri_str_property prop = test.str_props[j];
8363 LPWSTR expectedValueW;
8364
8365 expectedLen = lstrlenA(prop.value);
8366 /* Value may be unicode encoded */
8367 expectedValueW = a2w(prop.value);
8368 expectedLen = lstrlenW(expectedValueW);
8369 heap_free(expectedValueW);
8370
8371 /* This won't be necessary once GetPropertyLength is implemented. */
8372 receivedLen = -1;
8373
8374 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
8375 todo_wine_if(prop.todo) {
8376 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8377 "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8378 hr, prop.expected, i, j);
8379 ok(receivedLen == expectedLen || (prop.value2 && receivedLen == lstrlenA(prop.value2)) ||
8380 broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8381 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8382 expectedLen, receivedLen, i, j);
8383 }
8384 }
8385 }
8386
8387 if(uri) IUri_Release(uri);
8388
8389 heap_free(uriW);
8390 }
8391}

Referenced by START_TEST().

◆ test_IUri_GetStrProperties()

static void test_IUri_GetStrProperties ( void  )
static

Definition at line 7976 of file uri.c.

7976 {
7977 IUri *uri = NULL;
7978 HRESULT hr;
7979 DWORD i;
7980
7981 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7982 hr = pCreateUri(http_urlW, 0, 0, &uri);
7983 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7984 if(SUCCEEDED(hr)) {
7985 hr = IUri_GetAbsoluteUri(uri, NULL);
7986 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7987
7988 hr = IUri_GetAuthority(uri, NULL);
7989 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7990
7991 hr = IUri_GetDisplayUri(uri, NULL);
7992 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7993
7994 hr = IUri_GetDomain(uri, NULL);
7995 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7996
7997 hr = IUri_GetExtension(uri, NULL);
7998 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7999
8000 hr = IUri_GetFragment(uri, NULL);
8001 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8002
8003 hr = IUri_GetHost(uri, NULL);
8004 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8005
8006 hr = IUri_GetPassword(uri, NULL);
8007 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8008
8009 hr = IUri_GetPath(uri, NULL);
8010 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8011
8012 hr = IUri_GetPathAndQuery(uri, NULL);
8013 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8014
8015 hr = IUri_GetQuery(uri, NULL);
8016 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8017
8018 hr = IUri_GetRawUri(uri, NULL);
8019 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8020
8021 hr = IUri_GetSchemeName(uri, NULL);
8022 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8023
8024 hr = IUri_GetUserInfo(uri, NULL);
8025 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8026
8027 hr = IUri_GetUserName(uri, NULL);
8028 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8029 }
8030 if(uri) IUri_Release(uri);
8031
8032 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8034 LPWSTR uriW;
8035 uri = NULL;
8036
8037 uriW = a2w(test.uri);
8038 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8039 todo_wine_if(test.create_todo)
8040 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8041 hr, test.create_expected, i);
8042
8043 if(SUCCEEDED(hr)) {
8044 uri_str_property prop;
8045 BSTR received = NULL;
8046
8047 /* GetAbsoluteUri() tests. */
8048 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
8049 hr = IUri_GetAbsoluteUri(uri, &received);
8050 todo_wine_if(prop.todo) {
8051 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8052 hr, prop.expected, i);
8054 "Error: Expected %s but got %s on uri_tests[%d].\n",
8055 prop.value, wine_dbgstr_w(received), i);
8056 }
8058 received = NULL;
8059
8060 /* GetAuthority() tests. */
8061 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
8062 hr = IUri_GetAuthority(uri, &received);
8063 todo_wine_if(prop.todo) {
8064 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8065 hr, prop.expected, i);
8066 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8067 prop.value, wine_dbgstr_w(received), i);
8068 }
8070 received = NULL;
8071
8072 /* GetDisplayUri() tests. */
8073 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
8074 hr = IUri_GetDisplayUri(uri, &received);
8075 todo_wine_if(prop.todo) {
8076 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8077 hr, prop.expected, i);
8079 "Error: Expected %s but got %s on uri_tests[%d].\n",
8080 prop.value, wine_dbgstr_w(received), i);
8081 }
8083 received = NULL;
8084
8085 /* GetDomain() tests. */
8086 prop = test.str_props[Uri_PROPERTY_DOMAIN];
8087 hr = IUri_GetDomain(uri, &received);
8088 todo_wine_if(prop.todo) {
8089 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8090 "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8091 hr, prop.expected, i);
8092 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)),
8093 "Error: Expected %s but got %s on uri_tests[%d].\n",
8094 prop.value, wine_dbgstr_w(received), i);
8095 }
8097 received = NULL;
8098
8099 /* GetExtension() tests. */
8100 prop = test.str_props[Uri_PROPERTY_EXTENSION];
8101 hr = IUri_GetExtension(uri, &received);
8102 todo_wine_if(prop.todo) {
8103 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8104 hr, prop.expected, i);
8105 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8106 prop.value, wine_dbgstr_w(received), i);
8107 }
8109 received = NULL;
8110
8111 /* GetFragment() tests. */
8112 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
8113 hr = IUri_GetFragment(uri, &received);
8114 todo_wine_if(prop.todo) {
8115 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8116 hr, prop.expected, i);
8117 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8118 prop.value, wine_dbgstr_w(received), i);
8119 }
8121 received = NULL;
8122
8123 /* GetHost() tests. */
8124 prop = test.str_props[Uri_PROPERTY_HOST];
8125 hr = IUri_GetHost(uri, &received);
8126 todo_wine_if(prop.todo) {
8127 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8128 hr, prop.expected, i);
8129 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8130 prop.value, wine_dbgstr_w(received), i);
8131 }
8133 received = NULL;
8134
8135 /* GetPassword() tests. */
8136 prop = test.str_props[Uri_PROPERTY_PASSWORD];
8137 hr = IUri_GetPassword(uri, &received);
8138 todo_wine_if(prop.todo) {
8139 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8140 hr, prop.expected, i);
8141 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8142 prop.value, wine_dbgstr_w(received), i);
8143 }
8145 received = NULL;
8146
8147 /* GetPath() tests. */
8148 prop = test.str_props[Uri_PROPERTY_PATH];
8149 hr = IUri_GetPath(uri, &received);
8150 todo_wine_if(prop.todo) {
8151 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8152 hr, prop.expected, i);
8153 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8154 prop.value, wine_dbgstr_w(received), i);
8155 }
8157 received = NULL;
8158
8159 /* GetPathAndQuery() tests. */
8160 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
8161 hr = IUri_GetPathAndQuery(uri, &received);
8162 todo_wine_if(prop.todo) {
8163 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8164 hr, prop.expected, i);
8165 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8166 prop.value, wine_dbgstr_w(received), i);
8167 }
8169 received = NULL;
8170
8171 /* GetQuery() tests. */
8172 prop = test.str_props[Uri_PROPERTY_QUERY];
8173 hr = IUri_GetQuery(uri, &received);
8174 todo_wine_if(prop.todo) {
8175 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8176 hr, prop.expected, i);
8177 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8178 prop.value, wine_dbgstr_w(received), i);
8179 }
8181 received = NULL;
8182
8183 /* GetRawUri() tests. */
8184 prop = test.str_props[Uri_PROPERTY_RAW_URI];
8185 hr = IUri_GetRawUri(uri, &received);
8186 todo_wine_if(prop.todo) {
8187 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8188 hr, prop.expected, i);
8189 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8190 prop.value, wine_dbgstr_w(received), i);
8191 }
8193 received = NULL;
8194
8195 /* GetSchemeName() tests. */
8196 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
8197 hr = IUri_GetSchemeName(uri, &received);
8198 todo_wine_if(prop.todo) {
8199 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8200 hr, prop.expected, i);
8201 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8202 prop.value, wine_dbgstr_w(received), i);
8203 }
8205 received = NULL;
8206
8207 /* GetUserInfo() tests. */
8208 prop = test.str_props[Uri_PROPERTY_USER_INFO];
8209 hr = IUri_GetUserInfo(uri, &received);
8210 todo_wine_if(prop.todo) {
8211 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8212 hr, prop.expected, i);
8213 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8214 prop.value, wine_dbgstr_w(received), i);
8215 }
8217 received = NULL;
8218
8219 /* GetUserName() tests. */
8220 prop = test.str_props[Uri_PROPERTY_USER_NAME];
8221 hr = IUri_GetUserName(uri, &received);
8222 todo_wine_if(prop.todo) {
8223 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8224 hr, prop.expected, i);
8225 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8226 prop.value, wine_dbgstr_w(received), i);
8227 }
8229 }
8230
8231 if(uri) IUri_Release(uri);
8232
8233 heap_free(uriW);
8234 }
8235}

Referenced by START_TEST().

◆ test_IUri_HasProperty()

static void test_IUri_HasProperty ( void  )
static

Definition at line 8466 of file uri.c.

8466 {
8467 IUri *uri = NULL;
8468 HRESULT hr;
8469 DWORD i;
8470
8471 hr = pCreateUri(http_urlW, 0, 0, &uri);
8472 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8473 if(SUCCEEDED(hr)) {
8474 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8475 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8476 }
8477 if(uri) IUri_Release(uri);
8478
8479 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8481 LPWSTR uriW;
8482 uri = NULL;
8483
8484 uriW = a2w(test.uri);
8485
8486 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8487 todo_wine_if(test.create_todo)
8488 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8489
8490 if(SUCCEEDED(hr)) {
8491 DWORD expected_props, j, mask;
8492
8493 expected_props = compute_expected_props(&test, &mask);
8494
8495 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8496 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8497 BOOL received = -1;
8498
8499 hr = IUri_HasProperty(uri, j, &received);
8500 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8501 hr, S_OK, j, i);
8502
8503 if(mask & (1 << j)) {
8504 if(expected_props & (1 << j)) {
8505 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
8506 } else {
8507 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
8508 }
8509 }
8510 }
8511 }
8512
8513 if(uri) IUri_Release(uri);
8514
8515 heap_free(uriW);
8516 }
8517}
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by START_TEST().

◆ test_IUri_IsEqual()

static void test_IUri_IsEqual ( void  )
static

Definition at line 8736 of file uri.c.

8736 {
8737 struct custom_uri custom_uri;
8738 IUri *uriA, *uriB;
8739 BOOL equal;
8740 HRESULT hres;
8741 DWORD i;
8742
8743 uriA = uriB = NULL;
8744
8745 /* Make sure IsEqual handles invalid args correctly. */
8746 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8747 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8748 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8749 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8750
8751 equal = -1;
8752 hres = IUri_IsEqual(uriA, NULL, &equal);
8753 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8754 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8755
8756 hres = IUri_IsEqual(uriA, uriB, NULL);
8757 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
8758
8759 equal = FALSE;
8760 hres = IUri_IsEqual(uriA, uriA, &equal);
8761 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8762 ok(equal, "Error: Expected equal URIs.\n");
8763
8764 equal = FALSE;
8765 hres = IUri_IsEqual(uriA, uriB, &equal);
8766 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8767 ok(equal, "Error: Expected equal URIs.\n");
8768
8769 IUri_Release(uriA);
8770 IUri_Release(uriB);
8771
8773
8774 for(i = 0; i < ARRAY_SIZE(equality_tests); ++i) {
8776 LPWSTR uriA_W, uriB_W;
8777
8778 uriA = uriB = NULL;
8779
8780 uriA_W = a2w(test.a);
8781 uriB_W = a2w(test.b);
8782
8783 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8784 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
8785
8786 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8787<