ReactOS 0.4.16-dev-2332-g4cba65d
moniker.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "ocidl.h"
#include "comcat.h"
#include "olectl.h"
#include "initguid.h"
#include "wine/test.h"
Include dependency graph for moniker.c:

Go to the source code of this file.

Classes

struct  test_factory
 
struct  HeapUnknown
 
struct  test_moniker
 

Macros

#define _WIN32_DCOM
 
#define COBJMACROS
 
#define CONST_VTABLE
 
#define check_interface(a, b, c)   check_interface_(__LINE__, a, b, c)
 
#define ok_ole_success(hr, func)   ok(hr == S_OK, #func " failed with error %#08lx\n", hr)
 
#define CHECK_EXPECTED_METHOD(method_name)   check_expected_method_(__LINE__, method_name)
 
#define TEST_MONIKER_TYPE_TODO(m, t)   _test_moniker_type(m, t, TRUE, __LINE__)
 
#define TEST_MONIKER_TYPE(m, t)   _test_moniker_type(m, t, FALSE, __LINE__)
 
#define TEST_DISPLAY_NAME(m, name)   _test_moniker_name(m, name, __LINE__)
 

Functions

static void check_interface_ (unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
 
static void check_expected_method_ (unsigned int line, const char *method_name)
 
 DEFINE_OLEGUID (CLSID_FileMoniker, 0x303, 0, 0)
 
 DEFINE_OLEGUID (CLSID_ItemMoniker, 0x304, 0, 0)
 
 DEFINE_OLEGUID (CLSID_AntiMoniker, 0x305, 0, 0)
 
 DEFINE_OLEGUID (CLSID_PointerMoniker, 0x306, 0, 0)
 
 DEFINE_OLEGUID (CLSID_CompositeMoniker, 0x309, 0, 0)
 
 DEFINE_OLEGUID (CLSID_ClassMoniker, 0x31a, 0, 0)
 
 DEFINE_OLEGUID (CLSID_ObjrefMoniker, 0x327, 0, 0)
 
static void _test_moniker_type (IMoniker *moniker, DWORD type, BOOL todo, int line)
 
static void _test_moniker_name (IMoniker *moniker, const WCHAR *name, int line)
 
static IMonikercreate_antimoniker (DWORD level)
 
static HRESULT WINAPI pointer_moniker_obj_QueryInterface (IUnknown *iface, REFIID riid, void **obj)
 
static ULONG WINAPI pointer_moniker_obj_AddRef (IUnknown *iface)
 
static ULONG WINAPI pointer_moniker_obj_Release (IUnknown *iface)
 
static HRESULT create_moniker_parse_desc (const char *desc, unsigned int *eaten, IMoniker **moniker)
 
static HRESULT create_moniker_from_desc (const char *desc, IMoniker **moniker)
 
static SIZE_T round_global_size (SIZE_T size)
 
static struct test_factoryimpl_from_IClassFactory (IClassFactory *iface)
 
static struct test_factoryimpl_from_IExternalConnection (IExternalConnection *iface)
 
static HRESULT WINAPI ExternalConnection_QueryInterface (IExternalConnection *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ExternalConnection_AddRef (IExternalConnection *iface)
 
static ULONG WINAPI ExternalConnection_Release (IExternalConnection *iface)
 
static DWORD WINAPI ExternalConnection_AddConnection (IExternalConnection *iface, DWORD extconn, DWORD reserved)
 
static DWORD WINAPI ExternalConnection_ReleaseConnection (IExternalConnection *iface, DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses)
 
static HRESULT WINAPI test_factory_QueryInterface (IClassFactory *iface, REFIID riid, void **obj)
 
static ULONG WINAPI test_factory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI test_factory_Release (IClassFactory *iface)
 
static HRESULT WINAPI test_factory_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
 
static HRESULT WINAPI test_factory_LockServer (IClassFactory *iface, BOOL lock)
 
static void test_factory_init (struct test_factory *factory)
 
static HeapUnknownimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI HeapUnknown_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI HeapUnknown_AddRef (IUnknown *iface)
 
static ULONG WINAPI HeapUnknown_Release (IUnknown *iface)
 
static struct test_monikerimpl_from_IMoniker (IMoniker *iface)
 
static struct test_monikerimpl_from_IROTData (IROTData *iface)
 
static struct test_monikerimpl_from_IOleItemContainer (IOleItemContainer *iface)
 
static struct test_monikerimpl_from_IParseDisplayName (IParseDisplayName *iface)
 
static HRESULT WINAPI test_moniker_parse_QueryInterface (IParseDisplayName *iface, REFIID riid, void **obj)
 
static ULONG WINAPI test_moniker_parse_AddRef (IParseDisplayName *iface)
 
static ULONG WINAPI test_moniker_parse_Release (IParseDisplayName *iface)
 
static HRESULT WINAPI test_moniker_parse_ParseDisplayName (IParseDisplayName *iface, IBindCtx *pbc, LPOLESTR displayname, ULONG *eaten, IMoniker **out)
 
static HRESULT WINAPI test_item_container_QueryInterface (IOleItemContainer *iface, REFIID riid, void **obj)
 
static ULONG WINAPI test_item_container_AddRef (IOleItemContainer *iface)
 
static ULONG WINAPI test_item_container_Release (IOleItemContainer *iface)
 
static HRESULT WINAPI test_item_container_ParseDisplayName (IOleItemContainer *iface, IBindCtx *pbc, LPOLESTR displayname, ULONG *eaten, IMoniker **out)
 
static HRESULT WINAPI test_item_container_EnumObjects (IOleItemContainer *iface, DWORD flags, IEnumUnknown **ppenum)
 
static HRESULT WINAPI test_item_container_LockContainer (IOleItemContainer *iface, BOOL lock)
 
static HRESULT WINAPI test_item_container_GetObject (IOleItemContainer *iface, LPOLESTR item, DWORD bind_speed, IBindCtx *pbc, REFIID riid, void **obj)
 
static HRESULT WINAPI test_item_container_GetObjectStorage (IOleItemContainer *iface, LPOLESTR item, IBindCtx *pbc, REFIID riid, void **obj)
 
static HRESULT WINAPI test_item_container_IsRunning (IOleItemContainer *iface, LPOLESTR item)
 
static HRESULT WINAPI Moniker_QueryInterface (IMoniker *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI Moniker_AddRef (IMoniker *iface)
 
static ULONG WINAPI Moniker_Release (IMoniker *iface)
 
static HRESULT WINAPI Moniker_GetClassID (IMoniker *iface, CLSID *pClassID)
 
static HRESULT WINAPI Moniker_IsDirty (IMoniker *iface)
 
static HRESULT WINAPI Moniker_Load (IMoniker *iface, IStream *pStm)
 
static HRESULT WINAPI Moniker_Save (IMoniker *iface, IStream *pStm, BOOL fClearDirty)
 
static HRESULT WINAPI Moniker_GetSizeMax (IMoniker *iface, ULARGE_INTEGER *pcbSize)
 
static HRESULT WINAPI Moniker_BindToObject (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, void **obj)
 
static HRESULT WINAPI Moniker_BindToStorage (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, VOID **ppvObject)
 
static HRESULT WINAPI Moniker_Reduce (IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
 
static HRESULT WINAPI Moniker_ComposeWith (IMoniker *iface, IMoniker *pmkRight, BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite)
 
static HRESULT WINAPI Moniker_Enum (IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker)
 
static HRESULT WINAPI Moniker_IsEqual (IMoniker *iface, IMoniker *pmkOtherMoniker)
 
static HRESULT WINAPI Moniker_Hash (IMoniker *iface, DWORD *pdwHash)
 
static HRESULT WINAPI Moniker_IsRunning (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
 
static HRESULT WINAPI Moniker_GetTimeOfLastChange (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pFileTime)
 
static HRESULT WINAPI Moniker_Inverse (IMoniker *iface, IMoniker **ppmk)
 
static HRESULT WINAPI Moniker_CommonPrefixWith (IMoniker *iface, IMoniker *pmkOther, IMoniker **ppmkPrefix)
 
static HRESULT WINAPI Moniker_RelativePathTo (IMoniker *iface, IMoniker *pmOther, IMoniker **ppmkRelPath)
 
static HRESULT WINAPI Moniker_GetDisplayName (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
 
static HRESULT WINAPI Moniker_ParseDisplayName (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
 
static HRESULT WINAPI Moniker_IsSystemMoniker (IMoniker *iface, DWORD *pwdMksys)
 
static HRESULT WINAPI ROTData_QueryInterface (IROTData *iface, REFIID riid, VOID **ppvObject)
 
static ULONG WINAPI ROTData_AddRef (IROTData *iface)
 
static ULONG WINAPI ROTData_Release (IROTData *iface)
 
static HRESULT WINAPI ROTData_GetComparisonData (IROTData *iface, BYTE *pbData, ULONG cbMax, ULONG *pcbData)
 
static struct test_monikercreate_test_moniker (void)
 
static void test_ROT (void)
 
static void test_ROT_multiple_entries (void)
 
static HRESULT WINAPI ParseDisplayName_QueryInterface (IParseDisplayName *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ParseDisplayName_AddRef (IParseDisplayName *iface)
 
static ULONG WINAPI ParseDisplayName_Release (IParseDisplayName *iface)
 
static HRESULT WINAPI ParseDisplayName_ParseDisplayName (IParseDisplayName *iface, IBindCtx *pbc, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
 
static int count_moniker_matches (IBindCtx *pbc, IEnumMoniker *spEM)
 
static void test_MkParseDisplayName (void)
 
static void test_moniker (const char *testname, IMoniker *moniker, const BYTE *expected_moniker_marshal_data, unsigned int sizeof_expected_moniker_marshal_data, const BYTE *expected_moniker_saved_data, unsigned int sizeof_expected_moniker_saved_data, const BYTE *expected_moniker_comparison_data, unsigned int sizeof_expected_moniker_comparison_data, int expected_max_size, LPCWSTR expected_display_name)
 
static void test_class_moniker (void)
 
static void test_file_moniker (WCHAR *path)
 
static void test_file_monikers (void)
 
static void test_item_moniker (void)
 
static void stream_write_dword (IStream *stream, DWORD value)
 
static void test_anti_moniker (void)
 
static void test_generic_composite_moniker (void)
 
static void test_pointer_moniker (void)
 
static void test_objref_moniker (void)
 
static void test_bind_context (void)
 
static void test_save_load_filemoniker (void)
 
static void test_MonikerCommonPrefixWith (void)
 
 START_TEST (moniker)
 

Variables

static char const *constexpected_method_list
 
static const WCHAR wszFileName1 [] = {'c',':','\\','w','i','n','d','o','w','s','\\','t','e','s','t','1','.','d','o','c',0}
 
static const WCHAR wszFileName2 [] = {'c',':','\\','w','i','n','d','o','w','s','\\','t','e','s','t','2','.','d','o','c',0}
 
static const CLSID CLSID_TestMoniker
 
static const IUnknownVtbl pointer_moniker_obj_vtbl
 
static IUnknown pm_obj = { &pointer_moniker_obj_vtbl }
 
static const IExternalConnectionVtbl ExternalConnectionVtbl
 
static const IClassFactoryVtbl test_factory_vtbl
 
static const IUnknownVtbl HeapUnknown_Vtbl
 
static const IParseDisplayNameVtbl test_moniker_parse_vtbl
 
static const IOleItemContainerVtbl test_item_container_vtbl
 
static IROTDataVtbl ROTDataVtbl
 
static const IMonikerVtbl MonikerVtbl
 
static LPCWSTR expected_display_name
 
static const IParseDisplayNameVtbl ParseDisplayName_Vtbl
 
static IParseDisplayName ParseDisplayName = { &ParseDisplayName_Vtbl }
 
static const LARGE_INTEGER llZero
 
static const BYTE expected_class_moniker_marshal_data []
 
static const BYTE expected_class_moniker_saved_data []
 
static const BYTE expected_class_moniker_comparison_data []
 
static const WCHAR expected_class_moniker_display_name []
 
static const BYTE expected_item_moniker_comparison_data []
 
static const BYTE expected_item_moniker_comparison_data2 []
 
static const BYTE expected_item_moniker_comparison_data4 []
 
static const BYTE expected_item_moniker_comparison_data5 []
 
static const BYTE expected_item_moniker_comparison_data6 []
 
static const BYTE expected_item_moniker_saved_data []
 
static const BYTE expected_item_moniker_saved_data2 []
 
static const BYTE expected_item_moniker_saved_data3 []
 
static const BYTE expected_item_moniker_saved_data4 []
 
static const BYTE expected_item_moniker_saved_data5 []
 
static const BYTE expected_item_moniker_saved_data6 []
 
static const BYTE expected_item_moniker_marshal_data []
 
static const BYTE expected_item_moniker_marshal_data2 []
 
static const BYTE expected_item_moniker_marshal_data3 []
 
static const BYTE expected_item_moniker_marshal_data4 []
 
static const BYTE expected_item_moniker_marshal_data5 []
 
static const BYTE expected_item_moniker_marshal_data6 []
 
static const BYTE expected_anti_moniker_marshal_data []
 
static const BYTE expected_anti_moniker_marshal_data2 []
 
static const BYTE expected_anti_moniker_saved_data []
 
static const BYTE expected_anti_moniker_saved_data2 []
 
static const BYTE expected_anti_moniker_comparison_data []
 
static const BYTE expected_anti_moniker_comparison_data2 []
 
static const BYTE expected_gc_moniker_marshal_data []
 
static const BYTE expected_gc_moniker_saved_data []
 
static const BYTE expected_gc_moniker_comparison_data []
 

Macro Definition Documentation

◆ _WIN32_DCOM

#define _WIN32_DCOM

Definition at line 21 of file moniker.c.

◆ CHECK_EXPECTED_METHOD

#define CHECK_EXPECTED_METHOD (   method_name)    check_expected_method_(__LINE__, method_name)

Definition at line 57 of file moniker.c.

◆ check_interface

#define check_interface (   a,
  b,
  c 
)    check_interface_(__LINE__, a, b, c)

Definition at line 38 of file moniker.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file moniker.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 23 of file moniker.c.

◆ ok_ole_success

#define ok_ole_success (   hr,
  func 
)    ok(hr == S_OK, #func " failed with error %#08lx\n", hr)

Definition at line 53 of file moniker.c.

◆ TEST_DISPLAY_NAME

#define TEST_DISPLAY_NAME (   m,
  name 
)    _test_moniker_name(m, name, __LINE__)

Definition at line 102 of file moniker.c.

◆ TEST_MONIKER_TYPE

#define TEST_MONIKER_TYPE (   m,
  t 
)    _test_moniker_type(m, t, FALSE, __LINE__)

Definition at line 90 of file moniker.c.

◆ TEST_MONIKER_TYPE_TODO

#define TEST_MONIKER_TYPE_TODO (   m,
  t 
)    _test_moniker_type(m, t, TRUE, __LINE__)

Definition at line 89 of file moniker.c.

Function Documentation

◆ _test_moniker_name()

static void _test_moniker_name ( IMoniker moniker,
const WCHAR name,
int  line 
)
static

Definition at line 103 of file moniker.c.

104{
105 WCHAR *display_name;
106 IBindCtx *pbc;
107 HRESULT hr;
108
109 hr = CreateBindCtx(0, &pbc);
110 ok_(__FILE__, line)(hr == S_OK, "Failed to create bind context, hr %#lx.\n", hr);
111
112 hr = IMoniker_GetDisplayName(moniker, pbc, NULL, &display_name);
113 ok_(__FILE__, line)(hr == S_OK, "Failed to get display name, hr %#lx.\n", hr);
114 ok_(__FILE__, line)(!lstrcmpW(display_name, name), "Unexpected display name %s.\n", wine_dbgstr_w(display_name));
115
116 CoTaskMemFree(display_name);
117 IBindCtx_Release(pbc);
118}
#define ok_(x1, x2)
Definition: atltest.h:61
#define NULL
Definition: types.h:112
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
HRESULT WINAPI CreateBindCtx(DWORD reserved, IBindCtx **bind_context)
Definition: bindctx.c:491
HRESULT hr
Definition: shlfolder.c:183
Definition: parser.c:49
Definition: main.c:40
Definition: name.c:39
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ _test_moniker_type()

static void _test_moniker_type ( IMoniker moniker,
DWORD  type,
BOOL  todo,
int  line 
)
static

Definition at line 91 of file moniker.c.

92{
93 DWORD type2;
94 HRESULT hr;
95
96 hr = IMoniker_IsSystemMoniker(moniker, &type2);
97 ok_(__FILE__, line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
99 ok_(__FILE__, line)(type2 == type, "Unexpected moniker type %ld.\n", type2);
100}
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define todo_wine_if(is_todo)
Definition: minitest.h:81
BOOL todo
Definition: filedlg.c:313

◆ check_expected_method_()

static void check_expected_method_ ( unsigned int  line,
const char method_name 
)
static

Definition at line 58 of file moniker.c.

59{
60 if (!expected_method_list) return;
61 ok(*expected_method_list != NULL, "Extra method %s called\n", method_name);
63 {
64 ok(!strcmp(*expected_method_list, method_name), "Expected %s to be called instead of %s\n",
65 *expected_method_list, method_name);
67 }
68}
#define ok(value,...)
Definition: atltest.h:57
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
static char const *const * expected_method_list
Definition: moniker.c:55

◆ check_interface_()

static void check_interface_ ( unsigned int  line,
void iface_ptr,
REFIID  iid,
BOOL  supported 
)
static

Definition at line 39 of file moniker.c.

40{
41 IUnknown *iface = iface_ptr;
42 HRESULT hr, expected_hr;
43 IUnknown *unk;
44
45 expected_hr = supported ? S_OK : E_NOINTERFACE;
46
47 hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
48 ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
49 if (SUCCEEDED(hr))
50 IUnknown_Release(unk);
51}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ count_moniker_matches()

static int count_moniker_matches ( IBindCtx pbc,
IEnumMoniker spEM 
)
static

Definition at line 1143 of file moniker.c.

1144{
1145 IMoniker * spMoniker;
1146 int matchCnt = 0;
1147
1148 while ((IEnumMoniker_Next(spEM, 1, &spMoniker, NULL)==S_OK))
1149 {
1150 HRESULT hr;
1151 WCHAR * szDisplayn;
1152 hr=IMoniker_GetDisplayName(spMoniker, pbc, NULL, &szDisplayn);
1153 if (SUCCEEDED(hr))
1154 {
1155 if (!lstrcmpiW(szDisplayn, wszFileName1) || !lstrcmpiW(szDisplayn, wszFileName2))
1156 matchCnt++;
1157 CoTaskMemFree(szDisplayn);
1158 }
1159 }
1160 return matchCnt;
1161}
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
static const WCHAR wszFileName1[]
Definition: moniker.c:70
static const WCHAR wszFileName2[]
Definition: moniker.c:71

Referenced by test_MkParseDisplayName().

◆ create_antimoniker()

static IMoniker * create_antimoniker ( DWORD  level)
static

Definition at line 120 of file moniker.c.

121{
125 HRESULT hr;
126
128 ok(hr == S_OK, "Failed to create antimoniker, hr %#lx.\n", hr);
129
131 ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
132
133 hr = IStream_Write(stream, &level, sizeof(level), NULL);
134 ok(hr == S_OK, "Failed to write contents, hr %#lx.\n", hr);
135
136 pos.QuadPart = 0;
137 hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
138 ok(hr == S_OK, "Failed to rewind, hr %#lx.\n", hr);
139
140 hr = IMoniker_Load(moniker, stream);
141 ok(hr == S_OK, "Failed to load, hr %#lx.\n", hr);
142
143 IStream_Release(stream);
144
145 return moniker;
146}
HRESULT WINAPI CreateAntiMoniker(IMoniker **moniker)
Definition: antimoniker.c:626
#define TRUE
Definition: types.h:120
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
GLint level
Definition: gl.h:1546
Definition: parse.h:23

Referenced by create_moniker_parse_desc(), test_anti_moniker(), test_class_moniker(), test_file_moniker(), test_item_moniker(), test_objref_moniker(), and test_pointer_moniker().

◆ create_moniker_from_desc()

static HRESULT create_moniker_from_desc ( const char desc,
IMoniker **  moniker 
)
static

Definition at line 228 of file moniker.c.

229{
230 unsigned int eaten = 0;
231 return create_moniker_parse_desc(desc, &eaten, moniker);
232}
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1204
static HRESULT create_moniker_parse_desc(const char *desc, unsigned int *eaten, IMoniker **moniker)
Definition: moniker.c:180

Referenced by Moniker_Inverse(), test_anti_moniker(), test_class_moniker(), test_generic_composite_moniker(), test_item_moniker(), test_MonikerCommonPrefixWith(), test_pointer_moniker(), and test_ROT().

◆ create_moniker_parse_desc()

static HRESULT create_moniker_parse_desc ( const char desc,
unsigned int eaten,
IMoniker **  moniker 
)
static

Definition at line 180 of file moniker.c.

182{
183 unsigned int comp_len = 0;
184 WCHAR itemnameW[3] = L"Ix";
186 HRESULT hr;
187
188 switch (*desc)
189 {
190 case 'I':
191 itemnameW[1] = desc[1];
192 *eaten = 2;
193 return CreateItemMoniker(L"!", itemnameW, moniker);
194 case 'A':
195 *eaten = 2;
196 *moniker = create_antimoniker(desc[1] - '0');
197 return S_OK;
198 case 'P':
199 *eaten = 1;
201 case 'C':
202 *eaten = 1;
203 desc++;
204
205 comp_len = 0;
206 hr = create_moniker_parse_desc(desc, &comp_len, &left);
207 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
208
209 *eaten += comp_len;
210 desc += comp_len;
211
212 comp_len = 0;
213 hr = create_moniker_parse_desc(desc, &comp_len, &right);
214 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
215
216 *eaten += comp_len;
217
219 IMoniker_Release(left);
220 IMoniker_Release(right);
221 return hr;
222 default:
223 ok(0, "Unexpected description %s.\n", desc);
224 return E_NOTIMPL;
225 }
226}
HRESULT WINAPI CreateGenericComposite(IMoniker *left, IMoniker *right, IMoniker **composite)
#define E_NOTIMPL
Definition: ddrawi.h:99
#define L(x)
Definition: resources.c:13
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
HRESULT WINAPI CreateItemMoniker(const WCHAR *delimiter, const WCHAR *name, IMoniker **ret)
Definition: itemmoniker.c:932
static IMoniker * create_antimoniker(DWORD level)
Definition: moniker.c:120
static IUnknown pm_obj
Definition: moniker.c:178
HRESULT WINAPI CreatePointerMoniker(IUnknown *object, IMoniker **ret)

Referenced by create_moniker_from_desc(), and create_moniker_parse_desc().

◆ create_test_moniker()

static struct test_moniker * create_test_moniker ( void  )
static

Definition at line 878 of file moniker.c.

879{
880 struct test_moniker *obj;
881
882 obj = calloc(1, sizeof(*obj));
883 obj->IMoniker_iface.lpVtbl = &MonikerVtbl;
884 obj->IROTData_iface.lpVtbl = &ROTDataVtbl;
885 obj->IOleItemContainer_iface.lpVtbl = &test_item_container_vtbl;
886 obj->IParseDisplayName_iface.lpVtbl = &test_moniker_parse_vtbl;
887 obj->refcount = 1;
888
889 return obj;
890}
static IROTDataVtbl ROTDataVtbl
Definition: moniker.c:843
static const IParseDisplayNameVtbl test_moniker_parse_vtbl
Definition: moniker.c:482
static const IMonikerVtbl MonikerVtbl
Definition: moniker.c:851
static const IOleItemContainerVtbl test_item_container_vtbl
Definition: moniker.c:561
#define calloc
Definition: rosglue.h:14

Referenced by test_generic_composite_moniker(), test_item_moniker(), and test_ROT().

◆ DEFINE_OLEGUID() [1/7]

DEFINE_OLEGUID ( CLSID_AntiMoniker  ,
0x305  ,
,
 
)

◆ DEFINE_OLEGUID() [2/7]

DEFINE_OLEGUID ( CLSID_ClassMoniker  ,
0x31a  ,
,
 
)

◆ DEFINE_OLEGUID() [3/7]

DEFINE_OLEGUID ( CLSID_CompositeMoniker  ,
0x309  ,
,
 
)

◆ DEFINE_OLEGUID() [4/7]

DEFINE_OLEGUID ( CLSID_FileMoniker  ,
0x303  ,
,
 
)

◆ DEFINE_OLEGUID() [5/7]

DEFINE_OLEGUID ( CLSID_ItemMoniker  ,
0x304  ,
,
 
)

◆ DEFINE_OLEGUID() [6/7]

DEFINE_OLEGUID ( CLSID_ObjrefMoniker  ,
0x327  ,
,
 
)

◆ DEFINE_OLEGUID() [7/7]

DEFINE_OLEGUID ( CLSID_PointerMoniker  ,
0x306  ,
,
 
)

◆ ExternalConnection_AddConnection()

static DWORD WINAPI ExternalConnection_AddConnection ( IExternalConnection iface,
DWORD  extconn,
DWORD  reserved 
)
static

Definition at line 284 of file moniker.c.

285{
287 ok(extconn == EXTCONN_STRONG, "Unexpected connection type %ld\n", extconn);
288 ok(!reserved, "reserved = %lx\n", reserved);
289 return ++factory->external_connections;
290}
r reserved
Definition: btrfs.c:3006
static struct test_factory * impl_from_IExternalConnection(IExternalConnection *iface)
Definition: moniker.c:260
Definition: main.c:439

◆ ExternalConnection_AddRef()

static ULONG WINAPI ExternalConnection_AddRef ( IExternalConnection iface)
static

Definition at line 272 of file moniker.c.

273{
275 return IClassFactory_AddRef(&factory->IClassFactory_iface);
276}
IClassFactory IClassFactory_iface
Definition: main.c:440

◆ ExternalConnection_QueryInterface()

static HRESULT WINAPI ExternalConnection_QueryInterface ( IExternalConnection iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 265 of file moniker.c.

266{
267 ok(0, "unexpected call\n");
268 *ppv = NULL;
269 return E_NOINTERFACE;
270}
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ ExternalConnection_Release()

static ULONG WINAPI ExternalConnection_Release ( IExternalConnection iface)
static

Definition at line 278 of file moniker.c.

279{
281 return IClassFactory_Release(&factory->IClassFactory_iface);
282}

◆ ExternalConnection_ReleaseConnection()

static DWORD WINAPI ExternalConnection_ReleaseConnection ( IExternalConnection iface,
DWORD  extconn,
DWORD  reserved,
BOOL  fLastReleaseCloses 
)
static

Definition at line 292 of file moniker.c.

294{
296 ok(extconn == EXTCONN_STRONG, "Unexpected connection type %ld\n", extconn);
297 ok(!reserved, "reserved = %lx\n", reserved);
298 return --factory->external_connections;
299}

◆ HeapUnknown_AddRef()

static ULONG WINAPI HeapUnknown_AddRef ( IUnknown iface)
static

Definition at line 397 of file moniker.c.

398{
400 return InterlockedIncrement((LONG*)&This->refs);
401}
#define InterlockedIncrement
Definition: armddk.h:53
static MonikerMarshal * impl_from_IUnknown(IUnknown *iface)
Definition: moniker.c:1213
long LONG
Definition: pedump.c:60

◆ HeapUnknown_QueryInterface()

static HRESULT WINAPI HeapUnknown_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 385 of file moniker.c.

386{
388 {
389 IUnknown_AddRef(iface);
390 *ppv = iface;
391 return S_OK;
392 }
393 *ppv = NULL;
394 return E_NOINTERFACE;
395}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ HeapUnknown_Release()

static ULONG WINAPI HeapUnknown_Release ( IUnknown iface)
static

Definition at line 403 of file moniker.c.

404{
406 ULONG refs = InterlockedDecrement((LONG*)&This->refs);
407 if (!refs) free(This);
408 return refs;
409}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5
uint32_t ULONG
Definition: typedefs.h:59

◆ impl_from_IClassFactory()

static struct test_factory * impl_from_IClassFactory ( IClassFactory iface)
static

Definition at line 255 of file moniker.c.

256{
257 return CONTAINING_RECORD(iface, struct test_factory, IClassFactory_iface);
258}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by test_factory_AddRef(), test_factory_QueryInterface(), and test_factory_Release().

◆ impl_from_IExternalConnection()

static struct test_factory * impl_from_IExternalConnection ( IExternalConnection iface)
static

Definition at line 260 of file moniker.c.

261{
262 return CONTAINING_RECORD(iface, struct test_factory, IExternalConnection_iface);
263}

Referenced by ExternalConnection_AddConnection(), ExternalConnection_AddRef(), ExternalConnection_Release(), and ExternalConnection_ReleaseConnection().

◆ impl_from_IMoniker()

static struct test_moniker * impl_from_IMoniker ( IMoniker iface)
static

Definition at line 430 of file moniker.c.

431{
432 return CONTAINING_RECORD(iface, struct test_moniker, IMoniker_iface);
433}

◆ impl_from_IOleItemContainer()

static struct test_moniker * impl_from_IOleItemContainer ( IOleItemContainer iface)
static

Definition at line 440 of file moniker.c.

441{
442 return CONTAINING_RECORD(iface, struct test_moniker, IOleItemContainer_iface);
443}

Referenced by test_item_container_AddRef(), test_item_container_GetObject(), and test_item_container_Release().

◆ impl_from_IParseDisplayName()

static struct test_moniker * impl_from_IParseDisplayName ( IParseDisplayName iface)
static

Definition at line 445 of file moniker.c.

446{
447 return CONTAINING_RECORD(iface, struct test_moniker, IParseDisplayName_iface);
448}

◆ impl_from_IROTData()

static struct test_moniker * impl_from_IROTData ( IROTData iface)
static

Definition at line 435 of file moniker.c.

436{
437 return CONTAINING_RECORD(iface, struct test_moniker, IROTData_iface);
438}

Referenced by ROTData_AddRef(), ROTData_QueryInterface(), and ROTData_Release().

◆ impl_from_IUnknown()

static HeapUnknown * impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 380 of file moniker.c.

381{
382 return CONTAINING_RECORD(iface, HeapUnknown, IUnknown_iface);
383}

◆ Moniker_AddRef()

static ULONG WINAPI Moniker_AddRef ( IMoniker iface)
static

Definition at line 605 of file moniker.c.

606{
607 struct test_moniker *moniker = impl_from_IMoniker(iface);
608 return InterlockedIncrement(&moniker->refcount);
609}
static ITS_IMonikerImpl * impl_from_IMoniker(IMoniker *iface)
Definition: moniker.c:50

◆ Moniker_BindToObject()

static HRESULT WINAPI Moniker_BindToObject ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
REFIID  riid,
void **  obj 
)
static

Definition at line 662 of file moniker.c.

664{
665 struct test_moniker *moniker = impl_from_IMoniker(iface);
666
668 {
669 *obj = &moniker->IOleItemContainer_iface;
670 IMoniker_AddRef(iface);
671 return S_OK;
672 }
673
674 CHECK_EXPECTED_METHOD("Moniker_BindToObject");
675 return E_NOTIMPL;
676}
#define CHECK_EXPECTED_METHOD(method_name)
Definition: moniker.c:57
const GUID IID_IOleItemContainer

◆ Moniker_BindToStorage()

static HRESULT WINAPI Moniker_BindToStorage ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
REFIID  riid,
VOID **  ppvObject 
)
static

Definition at line 679 of file moniker.c.

681{
682 CHECK_EXPECTED_METHOD("Moniker_BindToStorage");
683 return E_NOTIMPL;
684}

◆ Moniker_CommonPrefixWith()

static HRESULT WINAPI Moniker_CommonPrefixWith ( IMoniker iface,
IMoniker pmkOther,
IMoniker **  ppmkPrefix 
)
static

Definition at line 762 of file moniker.c.

763{
764 CHECK_EXPECTED_METHOD("Moniker_CommonPrefixWith");
765 return E_NOTIMPL;
766}

◆ Moniker_ComposeWith()

static HRESULT WINAPI Moniker_ComposeWith ( IMoniker iface,
IMoniker pmkRight,
BOOL  fOnlyIfNotGeneric,
IMoniker **  ppmkComposite 
)
static

Definition at line 703 of file moniker.c.

705{
706 CHECK_EXPECTED_METHOD("Moniker_ComposeWith");
707 return MK_E_NEEDGENERIC;
708}
#define MK_E_NEEDGENERIC
Definition: winerror.h:3893

◆ Moniker_Enum()

static HRESULT WINAPI Moniker_Enum ( IMoniker iface,
BOOL  fForward,
IEnumMoniker **  ppenumMoniker 
)
static

Definition at line 711 of file moniker.c.

712{
713 CHECK_EXPECTED_METHOD("Moniker_Enum");
714
715 if (ppenumMoniker == NULL)
716 return E_POINTER;
717
718 *ppenumMoniker = NULL;
719
720 return S_OK;
721}
#define E_POINTER
Definition: winerror.h:3480

◆ Moniker_GetClassID()

static HRESULT WINAPI Moniker_GetClassID ( IMoniker iface,
CLSID pClassID 
)
static

Definition at line 624 of file moniker.c.

625{
626 CHECK_EXPECTED_METHOD("Moniker_GetClassID");
627
628 *pClassID = CLSID_TestMoniker;
629
630 return S_OK;
631}
static const CLSID CLSID_TestMoniker
Definition: moniker.c:73

◆ Moniker_GetDisplayName()

static HRESULT WINAPI Moniker_GetDisplayName ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
LPOLESTR ppszDisplayName 
)
static

Definition at line 776 of file moniker.c.

778{
779 static const WCHAR wszDisplayName[] = {'*','*','G','e','m','m','a',0};
780 CHECK_EXPECTED_METHOD("Moniker_GetDisplayName");
781 *ppszDisplayName = CoTaskMemAlloc(sizeof(wszDisplayName));
782 memcpy(*ppszDisplayName, wszDisplayName, sizeof(wszDisplayName));
783 return S_OK;
784}
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ Moniker_GetSizeMax()

static HRESULT WINAPI Moniker_GetSizeMax ( IMoniker iface,
ULARGE_INTEGER pcbSize 
)
static

Definition at line 656 of file moniker.c.

657{
658 CHECK_EXPECTED_METHOD("Moniker_GetSizeMax");
659 return E_NOTIMPL;
660}

◆ Moniker_GetTimeOfLastChange()

static HRESULT WINAPI Moniker_GetTimeOfLastChange ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
FILETIME pFileTime 
)
static

Definition at line 746 of file moniker.c.

748{
749 CHECK_EXPECTED_METHOD("Moniker_GetTimeOfLastChange");
750 return E_NOTIMPL;
751}

◆ Moniker_Hash()

static HRESULT WINAPI Moniker_Hash ( IMoniker iface,
DWORD pdwHash 
)
static

Definition at line 731 of file moniker.c.

732{
733 CHECK_EXPECTED_METHOD("Moniker_Hash");
734 return E_NOTIMPL;
735}

◆ Moniker_Inverse()

static HRESULT WINAPI Moniker_Inverse ( IMoniker iface,
IMoniker **  ppmk 
)
static

Definition at line 754 of file moniker.c.

755{
756 struct test_moniker *moniker = impl_from_IMoniker(iface);
757 CHECK_EXPECTED_METHOD("Moniker_Inverse");
758 return create_moniker_from_desc(moniker->inverse, ppmk);
759}
static HRESULT create_moniker_from_desc(const char *desc, IMoniker **moniker)
Definition: moniker.c:228

◆ Moniker_IsDirty()

static HRESULT WINAPI Moniker_IsDirty ( IMoniker iface)
static

Definition at line 634 of file moniker.c.

635{
636 CHECK_EXPECTED_METHOD("Moniker_IsDirty");
637
638 return S_FALSE;
639}
#define S_FALSE
Definition: winerror.h:3451

◆ Moniker_IsEqual()

static HRESULT WINAPI Moniker_IsEqual ( IMoniker iface,
IMoniker pmkOtherMoniker 
)
static

Definition at line 724 of file moniker.c.

725{
726 CHECK_EXPECTED_METHOD("Moniker_IsEqual");
727 return E_NOTIMPL;
728}

◆ Moniker_IsRunning()

static HRESULT WINAPI Moniker_IsRunning ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
IMoniker pmkNewlyRunning 
)
static

Definition at line 738 of file moniker.c.

740{
741 CHECK_EXPECTED_METHOD("Moniker_IsRunning");
742 return 0x8beef000;
743}

◆ Moniker_IsSystemMoniker()

static HRESULT WINAPI Moniker_IsSystemMoniker ( IMoniker iface,
DWORD pwdMksys 
)
static

Definition at line 795 of file moniker.c.

796{
797 CHECK_EXPECTED_METHOD("Moniker_IsSystemMoniker");
798
799 if (!pwdMksys)
800 return E_POINTER;
801
802 (*pwdMksys)=MKSYS_NONE;
803
804 return S_FALSE;
805}

◆ Moniker_Load()

static HRESULT WINAPI Moniker_Load ( IMoniker iface,
IStream pStm 
)
static

Definition at line 642 of file moniker.c.

643{
644 CHECK_EXPECTED_METHOD("Moniker_Load");
645 return E_NOTIMPL;
646}

◆ Moniker_ParseDisplayName()

static HRESULT WINAPI Moniker_ParseDisplayName ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
LPOLESTR  pszDisplayName,
ULONG pchEaten,
IMoniker **  ppmkOut 
)
static

Definition at line 787 of file moniker.c.

789{
790 CHECK_EXPECTED_METHOD("Moniker_ParseDisplayName");
791 return E_NOTIMPL;
792}

◆ Moniker_QueryInterface()

static HRESULT WINAPI Moniker_QueryInterface ( IMoniker iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 575 of file moniker.c.

576{
577 struct test_moniker *moniker = impl_from_IMoniker(iface);
578
579 if (!ppvObject)
580 return E_INVALIDARG;
581
582 *ppvObject = 0;
583
587 IsEqualIID(&IID_IMoniker, riid))
588 *ppvObject = iface;
589 if (IsEqualIID(&IID_IROTData, riid))
590 {
591 CHECK_EXPECTED_METHOD("Moniker_QueryInterface(IID_IROTData)");
592 if (!moniker->no_IROTData)
593 *ppvObject = &moniker->IROTData_iface;
594 }
595
596 if ((*ppvObject)==0)
597 return E_NOINTERFACE;
598
599 IMoniker_AddRef(iface);
600
601 return S_OK;
602}
#define E_INVALIDARG
Definition: ddrawi.h:101
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistStream
Definition: proxy.cpp:13

◆ Moniker_Reduce()

static HRESULT WINAPI Moniker_Reduce ( IMoniker iface,
IBindCtx pbc,
DWORD  dwReduceHowFar,
IMoniker **  ppmkToLeft,
IMoniker **  ppmkReduced 
)
static

Definition at line 687 of file moniker.c.

689{
690 CHECK_EXPECTED_METHOD("Moniker_Reduce");
691
692 if (ppmkReduced==NULL)
693 return E_POINTER;
694
695 IMoniker_AddRef(iface);
696
697 *ppmkReduced=iface;
698
700}
#define MK_S_REDUCED_TO_SELF
Definition: winerror.h:3892

◆ Moniker_RelativePathTo()

static HRESULT WINAPI Moniker_RelativePathTo ( IMoniker iface,
IMoniker pmOther,
IMoniker **  ppmkRelPath 
)
static

Definition at line 769 of file moniker.c.

770{
771 CHECK_EXPECTED_METHOD("Moniker_RelativePathTo");
772 return E_NOTIMPL;
773}

◆ Moniker_Release()

static ULONG WINAPI Moniker_Release ( IMoniker iface)
static

Definition at line 612 of file moniker.c.

613{
614 struct test_moniker *moniker = impl_from_IMoniker(iface);
616
617 if (!refcount)
618 free(moniker);
619
620 return refcount;
621}
LONG refcount
Definition: moniker.c:424

◆ Moniker_Save()

static HRESULT WINAPI Moniker_Save ( IMoniker iface,
IStream pStm,
BOOL  fClearDirty 
)
static

Definition at line 649 of file moniker.c.

650{
651 CHECK_EXPECTED_METHOD("Moniker_Save");
652 return E_NOTIMPL;
653}

◆ ParseDisplayName_AddRef()

static ULONG WINAPI ParseDisplayName_AddRef ( IParseDisplayName iface)
static

Definition at line 1107 of file moniker.c.

1108{
1109 return 2;
1110}

◆ ParseDisplayName_ParseDisplayName()

static HRESULT WINAPI ParseDisplayName_ParseDisplayName ( IParseDisplayName iface,
IBindCtx pbc,
LPOLESTR  pszDisplayName,
ULONG pchEaten,
IMoniker **  ppmkOut 
)
static

Definition at line 1119 of file moniker.c.

1124{
1125 char display_nameA[256];
1126 WideCharToMultiByte(CP_ACP, 0, pszDisplayName, -1, display_nameA, sizeof(display_nameA), NULL, NULL);
1127 ok(!lstrcmpW(pszDisplayName, expected_display_name), "unexpected display name \"%s\"\n", display_nameA);
1128 ok(pszDisplayName == expected_display_name, "pszDisplayName should be the same pointer as passed into MkParseDisplayName\n");
1129 *pchEaten = lstrlenW(pszDisplayName);
1130 return CreateAntiMoniker(ppmkOut);
1131}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define lstrlenW
Definition: compat.h:750
static LPCWSTR expected_display_name
Definition: moniker.c:1117

◆ ParseDisplayName_QueryInterface()

static HRESULT WINAPI ParseDisplayName_QueryInterface ( IParseDisplayName iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1094 of file moniker.c.

1095{
1096 if (IsEqualIID(riid, &IID_IUnknown) ||
1098 {
1099 *ppv = iface;
1100 IParseDisplayName_AddRef(iface);
1101 return S_OK;
1102 }
1103 *ppv = NULL;
1104 return E_NOINTERFACE;
1105}
const GUID IID_IParseDisplayName

◆ ParseDisplayName_Release()

static ULONG WINAPI ParseDisplayName_Release ( IParseDisplayName iface)
static

Definition at line 1112 of file moniker.c.

1113{
1114 return 1;
1115}

◆ pointer_moniker_obj_AddRef()

static ULONG WINAPI pointer_moniker_obj_AddRef ( IUnknown iface)
static

Definition at line 161 of file moniker.c.

162{
163 return 2;
164}

◆ pointer_moniker_obj_QueryInterface()

static HRESULT WINAPI pointer_moniker_obj_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 148 of file moniker.c.

150{
152 {
153 *obj = iface;
154 return S_OK;
155 }
156
157 *obj = NULL;
158 return E_NOINTERFACE;
159}

◆ pointer_moniker_obj_Release()

static ULONG WINAPI pointer_moniker_obj_Release ( IUnknown iface)
static

Definition at line 166 of file moniker.c.

167{
168 return 1;
169}

◆ ROTData_AddRef()

static ULONG WINAPI ROTData_AddRef ( IROTData iface)
static

Definition at line 815 of file moniker.c.

816{
817 struct test_moniker *moniker = impl_from_IROTData(iface);
818 return IMoniker_AddRef(&moniker->IMoniker_iface);
819}
static struct test_moniker * impl_from_IROTData(IROTData *iface)
Definition: moniker.c:435
IMoniker IMoniker_iface
Definition: main.c:41

◆ ROTData_GetComparisonData()

static HRESULT WINAPI ROTData_GetComparisonData ( IROTData iface,
BYTE pbData,
ULONG  cbMax,
ULONG pcbData 
)
static

Definition at line 829 of file moniker.c.

831{
832 CHECK_EXPECTED_METHOD("ROTData_GetComparisonData");
833
834 *pcbData = 1;
835 if (cbMax < *pcbData)
836 return E_OUTOFMEMORY;
837
838 *pbData = 0xde;
839
840 return S_OK;
841}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
_In_ _Out_writes_opt_ pcchValueName _Inout_opt_ LPDWORD _Out_opt_ _Out_writes_bytes_to_opt_ pcbData _Inout_opt_ LPDWORD pcbData
Definition: shlwapi.h:757

◆ ROTData_QueryInterface()

static HRESULT WINAPI ROTData_QueryInterface ( IROTData iface,
REFIID  riid,
VOID **  ppvObject 
)
static

Definition at line 808 of file moniker.c.

809{
810 struct test_moniker *moniker = impl_from_IROTData(iface);
811 return IMoniker_QueryInterface(&moniker->IMoniker_iface, riid, ppvObject);
812}

◆ ROTData_Release()

static ULONG WINAPI ROTData_Release ( IROTData iface)
static

Definition at line 822 of file moniker.c.

823{
824 struct test_moniker *moniker = impl_from_IROTData(iface);
825 return IMoniker_Release(&moniker->IMoniker_iface);
826}

◆ round_global_size()

static SIZE_T round_global_size ( SIZE_T  size)
static

Definition at line 234 of file moniker.c.

235{
236 static SIZE_T global_size_alignment = -1;
237 if (global_size_alignment == -1)
238 {
239 void *p = GlobalAlloc(GMEM_FIXED, 1);
240 global_size_alignment = GlobalSize(p);
241 GlobalFree(p);
242 }
243
244 return ((size + global_size_alignment - 1) & ~(global_size_alignment - 1));
245}
GLsizeiptr size
Definition: glext.h:5919
GLfloat GLfloat p
Definition: glext.h:8902
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define GMEM_FIXED
Definition: winbase.h:317

Referenced by test_moniker().

◆ START_TEST()

START_TEST ( moniker  )

Definition at line 4619 of file moniker.c.

4620{
4622
4623 test_ROT();
4635
4636 /* FIXME: test moniker creation funcs and parsing other moniker formats */
4637
4639
4641}
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
static void test_anti_moniker(void)
Definition: moniker.c:2857
static void test_ROT(void)
Definition: moniker.c:892
static void test_file_monikers(void)
Definition: moniker.c:2256
static void test_ROT_multiple_entries(void)
Definition: moniker.c:1048
static void test_pointer_moniker(void)
Definition: moniker.c:3821
static void test_item_moniker(void)
Definition: moniker.c:2372
static void test_bind_context(void)
Definition: moniker.c:4323
static void test_objref_moniker(void)
Definition: moniker.c:4080
static void test_generic_composite_moniker(void)
Definition: moniker.c:3141
static void test_MkParseDisplayName(void)
Definition: moniker.c:1163
static void test_MonikerCommonPrefixWith(void)
Definition: moniker.c:4505
static void test_class_moniker(void)
Definition: moniker.c:1885
static void test_save_load_filemoniker(void)
Definition: moniker.c:4441
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:279

◆ stream_write_dword()

static void stream_write_dword ( IStream stream,
DWORD  value 
)
static

Definition at line 2841 of file moniker.c.

2842{
2844 HRESULT hr;
2845
2846 pos.QuadPart = 0;
2847 hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
2848 ok(hr == S_OK, "Failed to seek, hr %#lx.\n", hr);
2849
2850 hr = IStream_Write(stream, &value, sizeof(value), NULL);
2851 ok(hr == S_OK, "Stream write failed, hr %#lx.\n", hr);
2852
2853 hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
2854 ok(hr == S_OK, "Failed to seek, hr %#lx.\n", hr);
2855}
Definition: pdh_main.c:96

Referenced by test_anti_moniker().

◆ test_anti_moniker()

static void test_anti_moniker ( void  )
static

Definition at line 2857 of file moniker.c.

2858{
2859 IMoniker *moniker, *moniker2, *moniker3, *inverse, *reduced;
2860 HRESULT hr;
2861 DWORD hash;
2862 IBindCtx *bindctx;
2865 static const WCHAR expected_display_name[] = { '\\','.','.',0 };
2866 IEnumMoniker *enummoniker;
2867 IStream *stream;
2868
2871
2872 check_interface(moniker, &IID_IMoniker, TRUE);
2873 todo_wine
2876 check_interface(moniker, &CLSID_AntiMoniker, TRUE);
2877 check_interface(moniker, &IID_IROTData, TRUE);
2878 check_interface(moniker, &IID_IMarshal, TRUE);
2879
2880 hr = IMoniker_QueryInterface(moniker, &CLSID_AntiMoniker, (void **)&unknown);
2881 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2882 ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n");
2883 IUnknown_Release(unknown);
2884
2885 test_moniker("anti moniker", moniker,
2890
2891 /* Hashing */
2892 hr = IMoniker_Hash(moniker, &hash);
2893 ok_ole_success(hr, IMoniker_Hash);
2894 ok(hash == 0x80000001,
2895 "Hash value != 0x80000001, instead was 0x%08lx\n",
2896 hash);
2897
2898 /* IsSystemMoniker test */
2899 TEST_MONIKER_TYPE(moniker, MKSYS_ANTIMONIKER);
2900
2901 hr = IMoniker_Inverse(moniker, &inverse);
2902 ok(hr == MK_E_NOINVERSE, "IMoniker_Inverse should have returned MK_E_NOINVERSE instead of 0x%08lx\n", hr);
2903 ok(inverse == NULL, "inverse should have been set to NULL instead of %p\n", inverse);
2904
2905 hr = CreateBindCtx(0, &bindctx);
2907
2908 /* IsRunning test */
2909 hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
2910 ok(hr == S_FALSE, "IMoniker_IsRunning should return S_FALSE, not 0x%08lx\n", hr);
2911
2912 hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
2913 ok(hr == E_NOTIMPL, "IMoniker_GetTimeOfLastChange should return E_NOTIMPL, not 0x%08lx\n", hr);
2914
2915 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
2916 ok(hr == E_NOTIMPL, "IMoniker_BindToObject should return E_NOTIMPL, not 0x%08lx\n", hr);
2917
2918 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
2919 ok(hr == E_NOTIMPL, "IMoniker_BindToStorage should return E_NOTIMPL, not 0x%08lx\n", hr);
2920
2921 /* ComposeWith */
2922 hr = CreateAntiMoniker(&moniker2);
2923 ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
2924
2925 moniker3 = moniker;
2926 hr = IMoniker_ComposeWith(moniker, moniker2, TRUE, &moniker3);
2927 ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
2928 ok(!moniker3, "Unexpected interface.\n");
2929
2930 hr = IMoniker_ComposeWith(moniker, moniker2, FALSE, &moniker3);
2931 ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
2932 TEST_MONIKER_TYPE(moniker3, MKSYS_GENERICCOMPOSITE);
2933 IMoniker_Release(moniker3);
2934
2935 IMoniker_Release(moniker2);
2936
2937 /* Load with composed number > 1. */
2938 hr = CreateAntiMoniker(&moniker2);
2939 ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
2940
2942 ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
2943
2945
2946 hr = IMoniker_Load(moniker, stream);
2947 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2948
2949 test_moniker("anti moniker 2", moniker,
2953 20, L"\\..\\..");
2954
2955 hr = IMoniker_IsEqual(moniker, moniker2);
2956 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2957
2958 hr = IMoniker_IsEqual(moniker2, moniker);
2959 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2960
2961 hr = IMoniker_Hash(moniker, &hash);
2962 ok(hr == S_OK, "Failed to get hash value, hr %#lx.\n", hr);
2963 ok(hash == 0x80000002, "Unexpected hash value %#lx.\n", hash);
2964
2965 /* Display name reflects anti combination. */
2966 TEST_DISPLAY_NAME(moniker, L"\\..\\..");
2967
2968 /* Limit is at 0xfffff. */
2969 stream_write_dword(stream, 0xfffff);
2970
2971 hr = IMoniker_Load(moniker, stream);
2972 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2973
2974 hr = IMoniker_Hash(moniker, &hash);
2975 ok(hr == S_OK, "Failed to get hash value, hr %#lx.\n", hr);
2976 ok(hash == 0x800fffff, "Unexpected hash value %#lx.\n", hash);
2977
2978 stream_write_dword(stream, 0xfffff + 1);
2979
2980 hr = IMoniker_Load(moniker, stream);
2981 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2982
2983 hr = IMoniker_Hash(moniker, &hash);
2984 ok(hr == S_OK, "Failed to get hash value, hr %#lx.\n", hr);
2985 ok(hash == 0x800fffff, "Unexpected hash value %#lx.\n", hash);
2986
2987 /* Zero combining counter is also valid. */
2989
2990 hr = IMoniker_Load(moniker, stream);
2991 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2992
2993 hr = IMoniker_IsEqual(moniker, moniker2);
2994 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2995
2996 hr = IMoniker_IsEqual(moniker2, moniker);
2997 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2998
2999 hr = IMoniker_Hash(moniker, &hash);
3000 ok(hr == S_OK, "Failed to get hash value, hr %#lx.\n", hr);
3001 ok(hash == 0x80000000, "Unexpected hash value %#lx.\n", hash);
3002
3004
3005 /* Back to initial value. */
3007
3008 hr = IMoniker_Load(moniker, stream);
3009 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3010
3011 hr = IMoniker_IsEqual(moniker, moniker2);
3012 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3013
3014 hr = IMoniker_IsEqual(moniker2, moniker);
3015 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3016
3017 hr = IMoniker_IsEqual(moniker, NULL);
3018 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3019
3020 /* Reduce() */
3021 hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, &reduced);
3022 ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
3023 ok(reduced == moniker, "Unexpected moniker.\n");
3024 IMoniker_Release(reduced);
3025
3026 /* Enum() */
3027 enummoniker = (void *)0xdeadbeef;
3028 hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
3029 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3030 ok(!enummoniker, "Unexpected pointer.\n");
3031
3032 enummoniker = (void *)0xdeadbeef;
3033 hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
3034 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3035 ok(!enummoniker, "Unexpected pointer.\n");
3036
3037 hr = IMoniker_Enum(moniker, FALSE, NULL);
3038 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3039
3040 hr = IMoniker_Enum(moniker, TRUE, NULL);
3041 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3042
3043 /* CommonPrefixWith() */
3045
3046 hr = IMoniker_Load(moniker, stream);
3047 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3048
3049 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
3050 ok(hr == MK_S_ME, "Unexpected hr %#lx.\n", hr);
3051 ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
3052 IMoniker_Release(moniker3);
3053
3054 hr = IMoniker_CommonPrefixWith(moniker2, moniker, &moniker3);
3055 ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
3056 ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
3057 IMoniker_Release(moniker3);
3058
3060
3061 hr = IMoniker_Load(moniker, stream);
3062 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3063
3065
3066 hr = IMoniker_Load(moniker2, stream);
3067 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3068
3069 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
3070 ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
3071 ok(moniker3 == moniker2, "Unexpected prefix moniker.\n");
3072 IMoniker_Release(moniker3);
3073
3074 hr = IMoniker_CommonPrefixWith(moniker2, moniker, &moniker3);
3075 ok(hr == MK_S_ME, "Unexpected hr %#lx.\n", hr);
3076 ok(moniker3 == moniker2, "Unexpected prefix moniker.\n");
3077 IMoniker_Release(moniker3);
3078
3079 /* Now same length, 0 or 2 */
3081 hr = IMoniker_Load(moniker, stream);
3082 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3083
3085 hr = IMoniker_Load(moniker2, stream);
3086 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3087
3088 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
3089 ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
3090 ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
3091 IMoniker_Release(moniker3);
3092
3094 hr = IMoniker_Load(moniker, stream);
3095 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3096
3098 hr = IMoniker_Load(moniker2, stream);
3099 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3100
3101 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
3102 ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
3103 ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
3104 IMoniker_Release(moniker3);
3105
3106 IStream_Release(stream);
3107 IBindCtx_Release(bindctx);
3108 IMoniker_Release(moniker);
3109 IMoniker_Release(moniker2);
3110
3111 /* RelativePathTo() */
3113 hr = create_moniker_from_desc("I1", &moniker2);
3114 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3115 hr = IMoniker_RelativePathTo(moniker, NULL, NULL);
3116 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3117 hr = IMoniker_RelativePathTo(moniker, NULL, &moniker3);
3118 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3119 hr = IMoniker_RelativePathTo(moniker, moniker2, NULL);
3120 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3121 hr = IMoniker_RelativePathTo(moniker, moniker2, &moniker3);
3122 ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
3123 ok(moniker3 == moniker2, "Unexpected object.\n");
3124 IMoniker_Release(moniker3);
3125 IMoniker_Release(moniker2);
3126
3127 moniker2 = create_antimoniker(2);
3128 hr = IMoniker_RelativePathTo(moniker, moniker2, &moniker3);
3129 ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
3130 ok(moniker3 == moniker2, "Unexpected object.\n");
3131 IMoniker_Release(moniker3);
3132 hr = IMoniker_RelativePathTo(moniker2, moniker, &moniker3);
3133 ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
3134 ok(moniker3 == moniker, "Unexpected object.\n");
3135 IMoniker_Release(moniker3);
3136
3137 IMoniker_Release(moniker2);
3138 IMoniker_Release(moniker);
3139}
#define FALSE
Definition: types.h:117
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define todo_wine
Definition: minitest.h:80
#define TEST_MONIKER_TYPE(m, t)
Definition: moniker.c:90
#define ok_ole_success(hr, func)
Definition: moniker.c:53
static const BYTE expected_anti_moniker_saved_data2[]
Definition: moniker.c:1636
static const BYTE expected_anti_moniker_saved_data[]
Definition: moniker.c:1631
static const BYTE expected_anti_moniker_marshal_data[]
Definition: moniker.c:1609
static const BYTE expected_anti_moniker_comparison_data2[]
Definition: moniker.c:1648
static const BYTE expected_anti_moniker_marshal_data2[]
Definition: moniker.c:1620
#define check_interface(a, b, c)
Definition: moniker.c:38
static const BYTE expected_anti_moniker_comparison_data[]
Definition: moniker.c:1641
#define TEST_DISPLAY_NAME(m, name)
Definition: moniker.c:102
static void stream_write_dword(IStream *stream, DWORD value)
Definition: moniker.c:2841
Definition: _hash_fun.h:40
#define MK_E_NOINVERSE
Definition: winerror.h:3907
#define MK_S_ME
Definition: winerror.h:3895
#define MK_S_HIM
Definition: winerror.h:3897
#define MK_S_US
Definition: winerror.h:3899

Referenced by START_TEST().

◆ test_bind_context()

static void test_bind_context ( void  )
static

Definition at line 4323 of file moniker.c.

4324{
4325 IRunningObjectTable *rot, *rot2;
4326 HRESULT hr;
4327 IBindCtx *pBindCtx;
4328 IEnumString *pEnumString;
4329 BIND_OPTS3 bind_opts;
4331 HeapUnknown *unknown2;
4332 IUnknown *param_obj;
4333 ULONG refs;
4334 static const WCHAR wszParamName[] = {'G','e','m','m','a',0};
4335 static const WCHAR wszNonExistent[] = {'N','o','n','E','x','i','s','t','e','n','t',0};
4336
4337 hr = CreateBindCtx(0, NULL);
4338 ok(hr == E_INVALIDARG, "CreateBindCtx with NULL ppbc should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
4339
4340 hr = CreateBindCtx(0xdeadbeef, &pBindCtx);
4341 ok(hr == E_INVALIDARG, "CreateBindCtx with reserved value non-zero should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
4342
4343 hr = CreateBindCtx(0, &pBindCtx);
4344 ok_ole_success(hr, "CreateBindCtx");
4345
4346 hr = IBindCtx_GetRunningObjectTable(pBindCtx, NULL);
4347 ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
4348
4349 hr = IBindCtx_GetRunningObjectTable(pBindCtx, &rot);
4350 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4351
4352 hr = GetRunningObjectTable(0, &rot2);
4353 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4354 ok(rot == rot2, "Unexpected ROT instance.\n");
4355 IRunningObjectTable_Release(rot);
4356 IRunningObjectTable_Release(rot2);
4357
4358 bind_opts.cbStruct = -1;
4359 hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
4360 ok_ole_success(hr, "IBindCtx_GetBindOptions");
4361 ok(bind_opts.cbStruct == sizeof(BIND_OPTS3) || broken(bind_opts.cbStruct == sizeof(BIND_OPTS2)) /* XP */,
4362 "Unexpected bind_opts.cbStruct %ld.\n", bind_opts.cbStruct);
4363
4364 bind_opts.cbStruct = sizeof(BIND_OPTS);
4365 hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
4366 ok_ole_success(hr, "IBindCtx_GetBindOptions");
4367 ok(bind_opts.cbStruct == sizeof(BIND_OPTS), "bind_opts.cbStruct was %ld\n", bind_opts.cbStruct);
4368
4369 memset(&bind_opts, 0xfe, sizeof(bind_opts));
4370 bind_opts.cbStruct = sizeof(bind_opts);
4371 hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
4372 ok_ole_success(hr, "IBindCtx_GetBindOptions");
4373 ok(bind_opts.cbStruct == sizeof(bind_opts) || bind_opts.cbStruct == sizeof(BIND_OPTS2) /* XP */,
4374 "Unexpected bind_opts.cbStruct %ld.\n", bind_opts.cbStruct);
4375 ok(bind_opts.grfFlags == 0, "bind_opts.grfFlags was 0x%lx instead of 0\n", bind_opts.grfFlags);
4376 ok(bind_opts.grfMode == STGM_READWRITE, "bind_opts.grfMode was 0x%lx instead of STGM_READWRITE\n", bind_opts.grfMode);
4377 ok(bind_opts.dwTickCountDeadline == 0, "bind_opts.dwTickCountDeadline was %ld instead of 0\n", bind_opts.dwTickCountDeadline);
4378 ok(bind_opts.dwTrackFlags == 0, "bind_opts.dwTrackFlags was 0x%lx instead of 0\n", bind_opts.dwTrackFlags);
4379 ok(bind_opts.dwClassContext == (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER),
4380 "bind_opts.dwClassContext should have been 0x15 instead of 0x%lx\n", bind_opts.dwClassContext);
4381 ok(bind_opts.locale == GetThreadLocale(), "bind_opts.locale should have been 0x%lx instead of 0x%lx\n", GetThreadLocale(), bind_opts.locale);
4382 ok(bind_opts.pServerInfo == NULL, "bind_opts.pServerInfo should have been NULL instead of %p\n", bind_opts.pServerInfo);
4383 if (bind_opts.cbStruct >= sizeof(BIND_OPTS3))
4384 ok(bind_opts.hwnd == NULL, "Unexpected bind_opts.hwnd %p.\n", bind_opts.hwnd);
4385
4386 bind_opts.cbStruct = -1;
4387 hr = IBindCtx_SetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
4388 ok(hr == E_INVALIDARG, "IBindCtx_SetBindOptions with bad cbStruct should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
4389
4390 hr = IBindCtx_RegisterObjectParam(pBindCtx, (WCHAR *)wszParamName, NULL);
4391 ok(hr == E_INVALIDARG, "IBindCtx_RegisterObjectParam should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
4392
4393 unknown = malloc(sizeof(*unknown));
4394 unknown->IUnknown_iface.lpVtbl = &HeapUnknown_Vtbl;
4395 unknown->refs = 1;
4396 hr = IBindCtx_RegisterObjectParam(pBindCtx, (WCHAR *)wszParamName, &unknown->IUnknown_iface);
4397 ok_ole_success(hr, "IBindCtx_RegisterObjectParam");
4398
4399 hr = IBindCtx_GetObjectParam(pBindCtx, (WCHAR *)wszParamName, &param_obj);
4400 ok_ole_success(hr, "IBindCtx_GetObjectParam");
4401 IUnknown_Release(param_obj);
4402
4403 hr = IBindCtx_GetObjectParam(pBindCtx, (WCHAR *)wszNonExistent, &param_obj);
4404 ok(hr == E_FAIL, "IBindCtx_GetObjectParam with nonexistent key should have failed with E_FAIL instead of 0x%08lx\n", hr);
4405 ok(param_obj == NULL, "IBindCtx_GetObjectParam with nonexistent key should have set output parameter to NULL instead of %p\n", param_obj);
4406
4407 hr = IBindCtx_RevokeObjectParam(pBindCtx, (WCHAR *)wszNonExistent);
4408 ok(hr == E_FAIL, "IBindCtx_RevokeObjectParam with nonexistent key should have failed with E_FAIL instead of 0x%08lx\n", hr);
4409
4410 hr = IBindCtx_EnumObjectParam(pBindCtx, &pEnumString);
4411 ok(hr == E_NOTIMPL, "IBindCtx_EnumObjectParam should have returned E_NOTIMPL instead of 0x%08lx\n", hr);
4412 ok(!pEnumString, "pEnumString should be NULL\n");
4413
4414 hr = IBindCtx_RegisterObjectBound(pBindCtx, NULL);
4415 ok_ole_success(hr, "IBindCtx_RegisterObjectBound(NULL)");
4416
4417 hr = IBindCtx_RevokeObjectBound(pBindCtx, NULL);
4418 ok(hr == E_INVALIDARG, "IBindCtx_RevokeObjectBound(NULL) should have return E_INVALIDARG instead of 0x%08lx\n", hr);
4419
4420 unknown2 = malloc(sizeof(*unknown));
4421 unknown2->IUnknown_iface.lpVtbl = &HeapUnknown_Vtbl;
4422 unknown2->refs = 1;
4423 hr = IBindCtx_RegisterObjectBound(pBindCtx, &unknown2->IUnknown_iface);
4424 ok_ole_success(hr, "IBindCtx_RegisterObjectBound");
4425
4426 hr = IBindCtx_RevokeObjectBound(pBindCtx, &unknown2->IUnknown_iface);
4427 ok_ole_success(hr, "IBindCtx_RevokeObjectBound");
4428
4429 hr = IBindCtx_RevokeObjectBound(pBindCtx, &unknown2->IUnknown_iface);
4430 ok(hr == MK_E_NOTBOUND, "IBindCtx_RevokeObjectBound with not bound object should have returned MK_E_NOTBOUND instead of 0x%08lx\n", hr);
4431
4432 IBindCtx_Release(pBindCtx);
4433
4434 refs = IUnknown_Release(&unknown->IUnknown_iface);
4435 ok(!refs, "object param should have been destroyed, instead of having %ld refs\n", refs);
4436
4437 refs = IUnknown_Release(&unknown2->IUnknown_iface);
4438 ok(!refs, "bound object should have been destroyed, instead of having %ld refs\n", refs);
4439}
#define broken(x)
Definition: atltest.h:178
#define E_FAIL
Definition: ddrawi.h:102
#define malloc
Definition: debug_ros.c:4
LCID WINAPI GetThreadLocale(void)
Definition: locale.c:2803
HRESULT WINAPI GetRunningObjectTable(DWORD reserved, IRunningObjectTable **ret)
Definition: moniker.c:729
static RunningObjectTableImpl rot
Definition: moniker.c:710
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR wszNonExistent[]
Definition: compobj.c:106
static const IUnknownVtbl HeapUnknown_Vtbl
Definition: moniker.c:411
#define STGM_READWRITE
Definition: objbase.h:936
#define memset(x, y, z)
Definition: compat.h:39
IUnknown IUnknown_iface
Definition: marshal.c:2847
ULONG refs
Definition: marshal.c:2848
#define MK_E_NOTBOUND
Definition: winerror.h:3904

Referenced by START_TEST().

◆ test_class_moniker()

static void test_class_moniker ( void  )
static

Definition at line 1885 of file moniker.c.

1886{
1887 static const struct parse_test
1888 {
1889 const WCHAR *name;
1890 ULONG eaten;
1891 HRESULT hr;
1892 }
1893 tests[] =
1894 {
1895 { L"clsid:11111111-0000-0000-2222-444444444444;extra data:", 54 },
1896 { L"clsid:11111111-0000-0000-2222-444444444444extra data", 52 },
1897 { L"clsid:11111111-0000-0000-2222-444444444444:", 43 },
1898 { L"clsid:11111111-0000-0000-2222-444444444444", 42 },
1899 { L"clsid:{11111111-0000-0000-2222-444444444444}", 44 },
1900 { L"clsid:{11111111-0000-0000-2222-444444444444", 0, MK_E_SYNTAX },
1901 { L"clsid:11111111-0000-0000-2222-444444444444}", 43 },
1902 };
1903 IMoniker *moniker, *moniker2, *inverse, *reduced, *anti, *c;
1904 IEnumMoniker *enummoniker;
1905 ULONG length, eaten;
1908 IROTData *rotdata;
1909 HRESULT hr;
1910 DWORD hash;
1911 IBindCtx *bindctx;
1914 IStream *stream;
1915 BYTE buffer[100];
1916 HGLOBAL hglobal;
1917 unsigned int i;
1918 DWORD *data;
1919
1920 hr = CreateBindCtx(0, &bindctx);
1921 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1922
1923 for (i = 0; i < ARRAY_SIZE(tests); ++i)
1924 {
1925 eaten = 0xdeadbeef;
1926 hr = MkParseDisplayName(bindctx, tests[i].name, &eaten, &moniker);
1927 todo_wine_if(i == 5)
1928 ok(hr == tests[i].hr, "%u: unexpected hr %#lx.\n", i, hr);
1929 ok(eaten == tests[i].eaten, "%u: unexpected eaten length %lu, expected %lu.\n", i, eaten, tests[i].eaten);
1930 if (SUCCEEDED(hr))
1931 {
1932 TEST_MONIKER_TYPE(moniker, MKSYS_CLASSMONIKER);
1933 IMoniker_Release(moniker);
1934 }
1935 }
1936
1937 /* Extended syntax, handled by class moniker directly, only CLSID is meaningful for equality. */
1938 hr = MkParseDisplayName(bindctx, L"clsid:11111111-0000-0000-2222-444444444444;extra data:", &eaten, &moniker);
1939 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1940 ok(eaten == 54, "Unexpected length %lu.\n", eaten);
1941
1942 hr = MkParseDisplayName(bindctx, L"clsid:11111111-0000-0000-2222-444444444444;different extra data:", &eaten, &moniker2);
1943 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1944
1945 TEST_DISPLAY_NAME(moniker, L"clsid:11111111-0000-0000-2222-444444444444;extra data:");
1946 TEST_MONIKER_TYPE(moniker, MKSYS_CLASSMONIKER);
1947 hr = IMoniker_GetSizeMax(moniker, &size);
1948 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1949 ok(size.LowPart == 44, "Unexpected size %lu.\n", size.LowPart);
1950
1951 TEST_MONIKER_TYPE(moniker2, MKSYS_CLASSMONIKER);
1952
1953 hr = IMoniker_IsEqual(moniker, moniker2);
1954 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1955
1956 hr = IMoniker_IsEqual(moniker2, moniker);
1957 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1958
1959 IMoniker_Release(moniker2);
1960 IMoniker_Release(moniker);
1961
1962 /* From persistent state */
1963 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
1964 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1965
1966 hr = CreateClassMoniker(&GUID_NULL, &moniker);
1967 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1968
1969 check_interface(moniker, &IID_IMoniker, TRUE);
1970 check_interface(moniker, &IID_IPersist, TRUE);
1971 check_interface(moniker, &IID_IPersistStream, TRUE);
1972 check_interface(moniker, &CLSID_ClassMoniker, TRUE);
1973 check_interface(moniker, &IID_IROTData, TRUE);
1974 check_interface(moniker, &IID_IMarshal, TRUE);
1975
1976 hr = IMoniker_GetSizeMax(moniker, &size);
1977 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1978 ok(size.QuadPart == 20, "Unexpected size %lu.\n", size.LowPart);
1979
1980 hr = IStream_Write(stream, &CLSID_StdComponentCategoriesMgr, sizeof(CLSID), NULL);
1981 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1982 length = 5 * sizeof(WCHAR);
1983 hr = IStream_Write(stream, &length, sizeof(length), NULL);
1984 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1985 hr = IStream_Write(stream, L"data", length, NULL);
1986 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1987 pos.QuadPart = 0;
1988 hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
1989 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1990
1991 hr = IMoniker_Load(moniker, stream);
1992 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1993
1994 hr = IMoniker_GetSizeMax(moniker, &size);
1995 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1996 ok(size.QuadPart == 30, "Unexpected size %lu.\n", size.LowPart);
1997 TEST_DISPLAY_NAME(moniker, L"clsid:0002E005-0000-0000-C000-000000000046data:");
1998 IStream_Release(stream);
1999
2000 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
2001 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2002
2003 hr = GetHGlobalFromStream(stream, &hglobal);
2004 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2005
2006 hr = IMoniker_Save(moniker, stream, FALSE);
2007 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2008
2009 length = GlobalSize(hglobal);
2010 data = GlobalLock(hglobal);
2011 ok(length == 30, "Unexpected stream size %lu.\n", length);
2012 ok(IsEqualGUID((CLSID *)data, &CLSID_StdComponentCategoriesMgr), "Unexpected clsid.\n");
2013 data += sizeof(CLSID) / sizeof(*data);
2014 ok(*data == 10, "Unexpected data length %lu.\n", *data);
2015 data++;
2016 ok(!lstrcmpW((WCHAR *)data, L"data"), "Unexpected data.\n");
2017
2018 IStream_Release(stream);
2019
2020 /* Extra data does not affect comparison */
2021 hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata);
2022 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2023 hr = IROTData_GetComparisonData(rotdata, buffer, sizeof(buffer), &length);
2024 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2025 ok(length == sizeof(expected_class_moniker_comparison_data), "Unexpected comparison data length %lu.\n", length);
2026 ok(!memcmp(buffer, expected_class_moniker_comparison_data, length), "Unexpected data.\n");
2027 IROTData_Release(rotdata);
2028
2029 IMoniker_Release(moniker);
2030
2031 hr = CreateClassMoniker(&CLSID_StdComponentCategoriesMgr, &moniker);
2032 ok_ole_success(hr, CreateClassMoniker);
2033
2034 hr = IMoniker_GetSizeMax(moniker, &size);
2035 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2036 ok(size.LowPart == 20, "Unexpected size %lu.\n", size.LowPart);
2037
2038 hr = IMoniker_QueryInterface(moniker, &CLSID_ClassMoniker, (void **)&unknown);
2039 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2040 ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n");
2041 IUnknown_Release(unknown);
2042
2043 test_moniker("class moniker", moniker,
2044 expected_class_moniker_marshal_data, sizeof(expected_class_moniker_marshal_data),
2045 expected_class_moniker_saved_data, sizeof(expected_class_moniker_saved_data),
2046 expected_class_moniker_comparison_data, sizeof(expected_class_moniker_comparison_data),
2047 sizeof(expected_class_moniker_saved_data), expected_class_moniker_display_name);
2048
2049 /* Hashing */
2050
2051 hr = IMoniker_Hash(moniker, &hash);
2052 ok_ole_success(hr, IMoniker_Hash);
2053
2054 ok(hash == CLSID_StdComponentCategoriesMgr.Data1,
2055 "Hash value != Data1 field of clsid, instead was 0x%08lx\n",
2056 hash);
2057
2058 /* IsSystemMoniker test */
2059 TEST_MONIKER_TYPE(moniker, MKSYS_CLASSMONIKER);
2060
2061 /* IsRunning test */
2062 hr = IMoniker_IsRunning(moniker, NULL, NULL, NULL);
2063 ok(hr == E_NOTIMPL, "IMoniker_IsRunning should return E_NOTIMPL, not 0x%08lx\n", hr);
2064
2065 hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
2066 ok(hr == E_NOTIMPL, "IMoniker_IsRunning should return E_NOTIMPL, not 0x%08lx\n", hr);
2067
2068 hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
2069 ok(hr == MK_E_UNAVAILABLE, "IMoniker_GetTimeOfLastChange should return MK_E_UNAVAILABLE, not 0x%08lx\n", hr);
2070
2071 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
2072 ok_ole_success(hr, IMoniker_BindToObject);
2073 IUnknown_Release(unknown);
2074
2075 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
2076 ok_ole_success(hr, IMoniker_BindToStorage);
2077 IUnknown_Release(unknown);
2078
2079 hr = IMoniker_Inverse(moniker, &inverse);
2080 ok(hr == S_OK, "Failed to get inverse, hr %#lx.\n", hr);
2081 TEST_MONIKER_TYPE(inverse, MKSYS_ANTIMONIKER);
2082 IMoniker_Release(inverse);
2083
2084 /* Reduce() */
2085 hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, &reduced);
2086 ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
2087 ok(reduced == moniker, "Unexpected moniker.\n");
2088 IMoniker_Release(reduced);
2089
2090 /* Enum() */
2091 enummoniker = (void *)0xdeadbeef;
2092 hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
2093 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2094 ok(!enummoniker, "Unexpected pointer.\n");
2095
2096 enummoniker = (void *)0xdeadbeef;
2097 hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
2098 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2099 ok(!enummoniker, "Unexpected pointer.\n");
2100
2101 hr = IMoniker_Enum(moniker, FALSE, NULL);
2102 todo_wine
2103 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2104
2105 IBindCtx_Release(bindctx);
2106
2107 /* ComposeWith() */
2108
2109 /* C + A -> () */
2110 anti = create_antimoniker(1);
2111 hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
2112 ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
2113 ok(!moniker2, "Unexpected pointer.\n");
2114 IMoniker_Release(anti);
2115
2116 /* C + A2 -> () */
2117 anti = create_antimoniker(2);
2118 hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
2119 ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
2120 ok(!moniker2, "Unexpected pointer.\n");
2121 IMoniker_Release(anti);
2122
2123 /* C + (A,I) -> I */
2124 hr = create_moniker_from_desc("CA1I1", &c);
2125 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2126 hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2);
2127 ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
2128 hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2);
2129 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2130 TEST_MONIKER_TYPE(moniker2, MKSYS_ITEMMONIKER);
2131 IMoniker_Release(moniker2);
2132 IMoniker_Release(c);
2133
2134 /* C + (A2,I) -> I */
2135 hr = create_moniker_from_desc("CA1I1", &c);
2136 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2137 hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2);
2138 ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
2139 hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2);
2140 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2141 TEST_MONIKER_TYPE(moniker2, MKSYS_ITEMMONIKER);
2142 IMoniker_Release(moniker2);
2143 IMoniker_Release(c);
2144
2145 IMoniker_Release(moniker);
2146}
#define ARRAY_SIZE(A)
Definition: main.h:20
void CDECL unexpected(void)
Definition: cpp.c:711
HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
Definition: moniker.c:838
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint buffer
Definition: glext.h:5915
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
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
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define c
Definition: ke_i.h:80
static struct test_info tests[]
#define MK_E_SYNTAX
Definition: winerror.h:3896
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_factory_AddRef()

static ULONG WINAPI test_factory_AddRef ( IClassFactory iface)
static

Definition at line 334 of file moniker.c.

335{
337 return InterlockedIncrement(&factory->refcount);
338}
static struct test_factory * impl_from_IClassFactory(IClassFactory *iface)
Definition: moniker.c:255

◆ test_factory_CreateInstance()

static HRESULT WINAPI test_factory_CreateInstance ( IClassFactory iface,
IUnknown outer,
REFIID  riid,
void **  obj 
)
static

Definition at line 346 of file moniker.c.

348{
349 return E_NOTIMPL;
350}

◆ test_factory_init()

static void test_factory_init ( struct test_factory factory)
static

Definition at line 366 of file moniker.c.

367{
369 factory->IExternalConnection_iface.lpVtbl = &ExternalConnectionVtbl;
370 factory->refcount = 1;
371 factory->external_connections = 0;
372}
static const IClassFactoryVtbl test_factory_vtbl
Definition: moniker.c:357
static const IExternalConnectionVtbl ExternalConnectionVtbl
Definition: moniker.c:301

Referenced by test_MkParseDisplayName(), test_objref_moniker(), test_pointer_moniker(), test_ROT(), and test_ROT_multiple_entries().

◆ test_factory_LockServer()

static HRESULT WINAPI test_factory_LockServer ( IClassFactory iface,
BOOL  lock 
)
static

Definition at line 352 of file moniker.c.

353{
354 return S_OK;
355}

◆ test_factory_QueryInterface()

static HRESULT WINAPI test_factory_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 309 of file moniker.c.

310{
312
313 if (!obj) return E_POINTER;
314
317 {
318 *obj = iface;
319 }
320 else if (IsEqualGUID(riid, &IID_IExternalConnection))
321 {
322 *obj = &factory->IExternalConnection_iface;
323 }
324 else
325 {
326 *obj = NULL;
327 return E_NOINTERFACE;
328 }
329
330 IUnknown_AddRef((IUnknown *)*obj);
331 return S_OK;
332}
const GUID IID_IClassFactory
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

◆ test_factory_Release()

static ULONG WINAPI test_factory_Release ( IClassFactory iface)
static

Definition at line 340 of file moniker.c.

341{
343 return InterlockedDecrement(&factory->refcount);
344}

◆ test_file_moniker()

static void test_file_moniker ( WCHAR path)
static

Definition at line 2148 of file moniker.c.

2149{
2150 IMoniker *moniker1 = NULL, *moniker2 = NULL, *m3, *inverse, *reduced, *anti;
2151 IEnumMoniker *enummoniker;
2152 IBindCtx *bind_ctx;
2153 IStream *stream;
2154 IUnknown *unk;
2155 DWORD hash;
2156 HRESULT hr;
2157
2158 hr = CreateFileMoniker(path, &moniker1);
2160
2161 hr = IMoniker_QueryInterface(moniker1, &CLSID_FileMoniker, (void **)&unk);
2162 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2163 ok(unk == (IUnknown *)moniker1, "Unexpected interface.\n");
2164 IUnknown_Release(unk);
2165
2166 hr = IMoniker_Inverse(moniker1, &inverse);
2167 ok(hr == S_OK, "Failed to get inverse, hr %#lx.\n", hr);
2168 TEST_MONIKER_TYPE(inverse, MKSYS_ANTIMONIKER);
2169 IMoniker_Release(inverse);
2170
2173
2174 /* Marshal */
2175 hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker1, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
2177
2178 /* Rewind */
2179 hr = IStream_Seek(stream, llZero, STREAM_SEEK_SET, NULL);
2180 ok_ole_success(hr, IStream_Seek);
2181
2182 /* Unmarshal */
2183 hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void**)&moniker2);
2185
2186 hr = IMoniker_IsEqual(moniker1, moniker2);
2188
2189 /* Reduce() */
2190 hr = CreateBindCtx(0, &bind_ctx);
2191 ok(hr == S_OK, "Failed to create bind context, hr %#lx.\n", hr);
2192
2193 hr = IMoniker_Reduce(moniker1, NULL, MKRREDUCE_ALL, NULL, &reduced);
2194 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2195
2196 hr = IMoniker_Reduce(moniker1, bind_ctx, MKRREDUCE_ALL, NULL, NULL);
2197 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2198
2199 m3 = anti = create_antimoniker(1);
2200 hr = IMoniker_Reduce(moniker1, bind_ctx, MKRREDUCE_ALL, &m3, &reduced);
2201 ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
2202 ok(reduced == moniker1, "Unexpected moniker.\n");
2203 ok(m3 == anti, "Unexpected pointer.\n");
2204 IMoniker_Release(reduced);
2205 IMoniker_Release(anti);
2206
2207 hr = IMoniker_Reduce(moniker1, bind_ctx, MKRREDUCE_ALL, NULL, &reduced);
2208 ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
2209 ok(reduced == moniker1, "Unexpected moniker.\n");
2210 IMoniker_Release(reduced);
2211
2212 /* Enum() */
2213 enummoniker = (void *)0xdeadbeef;
2214 hr = IMoniker_Enum(moniker1, TRUE, &enummoniker);
2215 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2216 ok(!enummoniker, "Unexpected pointer.\n");
2217
2218 enummoniker = (void *)0xdeadbeef;
2219 hr = IMoniker_Enum(moniker1, FALSE, &enummoniker);
2220 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2221 ok(!enummoniker, "Unexpected pointer.\n");
2222
2223 hr = IMoniker_Enum(moniker1, FALSE, NULL);
2224 todo_wine
2225 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2226
2227 IBindCtx_Release(bind_ctx);
2228
2229 IStream_Release(stream);
2230 IMoniker_Release(moniker2);
2231
2232 /* ComposeWith() */
2233
2234 /* F + A -> () */
2235 anti = create_antimoniker(1);
2236 hr = IMoniker_ComposeWith(moniker1, anti, TRUE, &moniker2);
2237 ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
2238 ok(!moniker2, "Unexpected pointer.\n");
2239 IMoniker_Release(anti);
2240
2241 /* I + A2 -> (A) */
2242 anti = create_antimoniker(2);
2243 hr = IMoniker_ComposeWith(moniker1, anti, TRUE, &moniker2);
2244 ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
2245 TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
2246 hr = IMoniker_Hash(moniker2, &hash);
2247 ok(hr == S_OK, "Failed to get hash, hr %#lx.\n", hr);
2248 ok(hash == 0x80000001, "Unexpected hash.\n");
2249 IMoniker_Release(moniker2);
2250
2251 IMoniker_Release(anti);
2252
2253 IMoniker_Release(moniker1);
2254}
HRESULT WINAPI CoMarshalInterface(IStream *stream, REFIID riid, IUnknown *unk, DWORD dest_context, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:483
HRESULT WINAPI CoUnmarshalInterface(IStream *stream, REFIID riid, void **ppv)
Definition: marshal.c:793
@ IsEqual
Definition: fatprocs.h:1887
HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, IMoniker **ppmk)
Definition: filemoniker.c:1360
static const LARGE_INTEGER llZero
Definition: moniker.c:1425

Referenced by test_file_monikers().

◆ test_file_monikers()

static void test_file_monikers ( void  )
static

Definition at line 2256 of file moniker.c.

2257{
2258 static WCHAR wszFile[][30] = {
2259 {'\\', 'w','i','n','d','o','w','s','\\','s','y','s','t','e','m','\\','t','e','s','t','1','.','d','o','c',0},
2260 {'\\', 'a','b','c','d','e','f','g','\\','h','i','j','k','l','\\','m','n','o','p','q','r','s','t','u','.','m','n','o',0},
2261 /* These map to themselves in Windows-1252 & 932 (Shift-JIS) */
2262 {0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0},
2263 /* U+2020 = DAGGER = 0x86 (1252) = 0x813f (932)
2264 * U+20AC = EURO SIGN = 0x80 (1252) = undef (932)
2265 * U+0100 .. = Latin extended-A
2266 */
2267 {0x20ac, 0x2020, 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109, 0x10a, 0x10b, 0x10c, 0},
2268 };
2270 IMoniker *moniker, *moniker2;
2271 BIND_OPTS bind_opts;
2273 IBindCtx *bindctx;
2274 STATSTG statstg;
2275 HRESULT hr;
2276 int i;
2277
2278 trace("ACP is %u\n", GetACP());
2279
2280 for (i = 0; i < ARRAY_SIZE(wszFile); ++i)
2281 {
2282 int j ;
2283 if (i == 2)
2284 {
2285 BOOL used;
2287 if (used)
2288 {
2289 skip("string 2 doesn't round trip in codepage %u\n", GetACP() );
2290 continue;
2291 }
2292 }
2293 for (j = lstrlenW(wszFile[i]); j > 0; --j)
2294 {
2295 wszFile[i][j] = 0;
2297 }
2298 }
2299
2300 /* BindToStorage() */
2302 GetTempFileNameW(path, L"stg", 1, filename);
2303
2305 0, NULL, NULL, &IID_IStorage, (void **)&storage);
2306 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2307 IStorage_Release(storage);
2308
2310 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
2311
2312 check_interface(moniker, &IID_IMoniker, TRUE);
2313 todo_wine
2316 check_interface(moniker, &CLSID_FileMoniker, TRUE);
2317 check_interface(moniker, &IID_IROTData, TRUE);
2318 check_interface(moniker, &IID_IMarshal, TRUE);
2319
2320 hr = IMoniker_BindToStorage(moniker, NULL, NULL, &IID_IStorage, (void **)&storage);
2321 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2322
2323 hr = CreateBindCtx(0, &bindctx);
2324 ok(hr == S_OK, "Failed to create bind context, hr %#lx.\n", hr);
2325
2326 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IStorage, (void **)&storage);
2327 ok(hr == STG_E_INVALIDFLAG, "Unexpected hr %#lx.\n", hr);
2328
2329 bind_opts.cbStruct = sizeof(bind_opts);
2330 bind_opts.grfMode = STGM_READWRITE | STGM_SHARE_DENY_WRITE;
2331 hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
2332 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2333
2334 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IStorage, (void **)&storage);
2335 ok(hr == STG_E_INVALIDFLAG, "Unexpected hr %#lx.\n", hr);
2336
2337 bind_opts.grfMode = STGM_READ | STGM_SHARE_DENY_WRITE;
2338 hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
2339 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2340
2341 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IStorage, (void **)&storage);
2342 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2343
2344 memset(&statstg, 0, sizeof(statstg));
2345 hr = IStorage_Stat(storage, &statstg, STATFLAG_NONAME);
2346 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2347 ok(statstg.grfMode == (STGM_READ | STGM_SHARE_DENY_WRITE), "Unexpected mode %#lx.\n", statstg.grfMode);
2348
2349 IStorage_Release(storage);
2350 IBindCtx_Release(bindctx);
2351 IMoniker_Release(moniker);
2352
2354
2355 /* IsEqual() */
2356 hr = CreateFileMoniker(L"test.bmp", &moniker);
2357 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
2358
2359 hr = CreateFileMoniker(L"TEST.bmp", &moniker2);
2360 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
2361
2362 hr = IMoniker_IsEqual(moniker, moniker2);
2363 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2364
2365 hr = IMoniker_IsEqual(moniker, NULL);
2366 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2367
2368 IMoniker_Release(moniker2);
2369 IMoniker_Release(moniker);
2370}
static int used
Definition: adh-main.c:39
#define trace
Definition: atltest.h:70
#define skip(...)
Definition: atltest.h:64
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:1999
UINT WINAPI GetACP(void)
Definition: locale.c:2023
HRESULT WINAPI StgCreateStorageEx(const WCHAR *pwcsName, DWORD grfMode, DWORD stgfmt, DWORD grfAttrs, STGOPTIONS *pStgOptions, void *reserved, REFIID riid, void **ppObjectOpen)
Definition: storage32.c:8618
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
unsigned int BOOL
Definition: ntddk_ex.h:94
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 WC_NO_BEST_FIT_CHARS
Definition: unicode.h:46
const char * filename
Definition: ioapi.h:137
static void test_file_moniker(WCHAR *path)
Definition: moniker.c:2148
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:940
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:939
#define STGM_READ
Definition: objbase.h:934
#define STGFMT_STORAGE
Definition: objbase.h:950
static const WCHAR wszFile[]
Definition: urlmon_main.c:386
#define STG_E_INVALIDFLAG
Definition: winerror.h:3683

Referenced by START_TEST().

◆ test_generic_composite_moniker()

static void test_generic_composite_moniker ( void  )
static

Definition at line 3141 of file moniker.c.

3142{
3143 static const struct simplify_test
3144 {
3145 const char *left;
3146 const char *right;
3147 unsigned int result_type;
3148 const WCHAR *name;
3149 }
3150 simplify_tests[] =
3151 {
3152 { "I1", "I2", MKSYS_GENERICCOMPOSITE, L"!I1!I2" },
3153 { "I1", "A2", MKSYS_ANTIMONIKER, L"\\.." },
3154 { "A1", "A1", MKSYS_GENERICCOMPOSITE, L"\\..\\.." },
3155 { "A2", "A1", MKSYS_GENERICCOMPOSITE, L"\\..\\..\\.." },
3156 { "CI1I2", "A1", MKSYS_ITEMMONIKER, L"!I1" },
3157 { "I1", "A1", MKSYS_NONE },
3158 { "CI1I2", "A2", MKSYS_NONE },
3159 { "CI1I2", "A3", MKSYS_ANTIMONIKER, L"\\.." },
3160 { "CI1I3", "CA1I2", MKSYS_GENERICCOMPOSITE, L"!I1!I2" },
3161 };
3162 IMoniker *moniker, *inverse, *moniker1, *moniker2, *moniker3, *moniker4;
3163 IEnumMoniker *enummoniker, *enummoniker2;
3164 struct test_moniker *m, *m2;
3166 DWORD hash, cookie;
3167 HRESULT hr;
3168 IBindCtx *bindctx;
3171 IROTData *rotdata;
3172 IMarshal *marshal;
3173 BYTE buffer[100];
3174 IStream *stream;
3175 unsigned int i;
3176 FILETIME ft;
3177 WCHAR *str;
3178 ULONG len;
3179
3180 hr = CreateBindCtx(0, &bindctx);
3181 ok(hr == S_OK, "Failed to create bind context, hr %#lx.\n", hr);
3182
3183 for (i = 0; i < ARRAY_SIZE(simplify_tests); ++i)
3184 {
3185 IMoniker *left, *right, *composite = NULL;
3186 DWORD moniker_type;
3187 WCHAR *name;
3188
3189 winetest_push_context("simplify[%u]", i);
3190
3191 hr = create_moniker_from_desc(simplify_tests[i].left, &left);
3192 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3193 hr = create_moniker_from_desc(simplify_tests[i].right, &right);
3194 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3195 hr = CreateGenericComposite(left, right, &composite);
3196 ok(hr == S_OK, "Failed to create a composite, hr %#lx.\n", hr);
3197
3198 if (composite)
3199 {
3200 hr = IMoniker_IsSystemMoniker(composite, &moniker_type);
3201 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3202 ok(moniker_type == simplify_tests[i].result_type, "Unexpected result type %lu.\n", moniker_type);
3203
3204 hr = IMoniker_GetDisplayName(composite, bindctx, NULL, &name);
3205 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3206 ok(!lstrcmpW(name, simplify_tests[i].name), "Unexpected result name %s.\n", wine_dbgstr_w(name));
3208
3209 IMoniker_Release(composite);
3210 }
3211 else
3212 ok(simplify_tests[i].result_type == MKSYS_NONE, "Unexpected result type.\n");
3213
3215
3216 IMoniker_Release(left);
3217 IMoniker_Release(right);
3218 }
3219
3220 hr = CreateItemMoniker(L"!", L"Test", &moniker1);
3221 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
3222 hr = CreateItemMoniker(L"#", L"Wine", &moniker2);
3223 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
3224 hr = CreateGenericComposite(moniker1, moniker2, &moniker);
3225 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
3226
3227 check_interface(moniker, &IID_IMoniker, TRUE);
3228 todo_wine
3231 check_interface(moniker, &IID_IROTData, TRUE);
3232 check_interface(moniker, &IID_IMarshal, TRUE);
3233
3234 hr = CreateGenericComposite(moniker1, moniker2, &moniker);
3235 ok(hr == S_OK, "Failed to create composite, hr %#lx.\n", hr);
3236 TEST_MONIKER_TYPE(moniker, MKSYS_GENERICCOMPOSITE);
3237
3238 /* Generic composite is special, as it does not addref in this case. */
3239 hr = IMoniker_QueryInterface(moniker, &CLSID_CompositeMoniker, (void **)&unknown);
3240 todo_wine
3241 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3242 if (SUCCEEDED(hr))
3243 ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n");
3244
3245 test_moniker("generic composite moniker", moniker,
3249 160, L"!Test#Wine");
3250
3251 /* Hashing */
3252
3253 hr = IMoniker_Hash(moniker, &hash);
3254 ok_ole_success(hr, IMoniker_Hash);
3255
3256 ok(hash == 0xd87,
3257 "Hash value != 0xd87, instead was 0x%08lx\n",
3258 hash);
3259
3260 /* IsSystemMoniker test */
3261 TEST_MONIKER_TYPE(moniker, MKSYS_GENERICCOMPOSITE);
3262
3263 hr = CreateBindCtx(0, &bindctx);
3265
3266 /* IsRunning test */
3267 hr = IMoniker_IsRunning(moniker, NULL, NULL, NULL);
3268 ok(hr == E_INVALIDARG, "IMoniker_IsRunning should return E_INVALIDARG, not 0x%08lx\n", hr);
3269
3270 hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
3271 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
3272
3273 hr = IMoniker_IsRunning(moniker, bindctx, NULL, moniker);
3274 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3275
3276 hr = IMoniker_IsRunning(moniker, bindctx, moniker1, moniker);
3277 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
3278
3279 hr = IMoniker_IsRunning(moniker, NULL, moniker1, moniker);
3280 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3281
3282 hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
3283 ok(hr == MK_E_NOTBINDABLE, "IMoniker_GetTimeOfLastChange should return MK_E_NOTBINDABLE, not 0x%08lx\n", hr);
3284
3285 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
3286 ok(hr == E_INVALIDARG, "IMoniker_BindToStorage should return E_INVALIDARG, not 0x%08lx\n", hr);
3287
3288 hr = IMoniker_Inverse(moniker, &inverse);
3289 ok(hr == S_OK, "Failed to get inverse, hr %#lx.\n", hr);
3290 TEST_MONIKER_TYPE(inverse, MKSYS_GENERICCOMPOSITE);
3291 IMoniker_Release(inverse);
3292
3293 /* BindToObject() */
3294 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
3295 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3296
3297 hr = IBindCtx_GetRunningObjectTable(bindctx, &rot);
3298 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3299
3300 hr = IRunningObjectTable_Register(rot, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)moniker,
3301 moniker, &cookie);
3302 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3303
3304 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
3305 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3306 IUnknown_Release(unknown);
3307
3308 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IMoniker, (void **)&unknown);
3309 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3310 IUnknown_Release(unknown);
3311
3312 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IDispatch, (void **)&unknown);
3313 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
3314
3315 hr = IRunningObjectTable_Revoke(rot, cookie);
3316 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3317
3318 IMoniker_Release(moniker);
3319
3320 /* BindToObject() with moniker at left */
3322 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3323
3324 /* (I1,P) */
3325 hr = create_moniker_from_desc("I1", &moniker2);
3326 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3327
3328 hr = CreateGenericComposite(moniker2, moniker, &moniker3);
3329 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3330
3331 hr = IMoniker_BindToObject(moniker3, bindctx, moniker2, &IID_IMoniker, (void **)&unknown);
3332 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
3333
3334 /* Register (I1,I1,P), check if ROT is used for left != NULL case */
3335 hr = CreateGenericComposite(moniker2, moniker3, &moniker4);
3336 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3337
3338 cookie = 0;
3339 hr = IRunningObjectTable_Register(rot, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)moniker4,
3340 moniker4, &cookie);
3341 todo_wine
3342 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3343
3344 hr = IMoniker_BindToObject(moniker3, bindctx, moniker2, &IID_IMoniker, (void **)&unknown);
3345 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
3346
3347 hr = IRunningObjectTable_Revoke(rot, cookie);
3348 todo_wine
3349 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3350
3351 IMoniker_Release(moniker3);
3352 IMoniker_Release(moniker2);
3353 IMoniker_Release(moniker);
3354
3355 IRunningObjectTable_Release(rot);
3356
3357 /* Uninitialized composite */
3358 hr = CoCreateInstance(&CLSID_CompositeMoniker, NULL, CLSCTX_SERVER, &IID_IMoniker, (void **)&moniker);
3359 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3360
3362 ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
3363 /* Exact error is E_OUTOFMEMORY */
3364 hr = IMoniker_Save(moniker, stream, TRUE);
3365 ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
3366 IStream_Release(stream);
3367
3368 hash = 0xdeadbeef;
3369 hr = IMoniker_Hash(moniker, &hash);
3370 ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
3371 ok(hash == 0xdeadbeef, "Unexpected hash %#lx.\n", hash);
3372
3373 hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &str);
3374 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3375
3376 hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata);
3377 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3378 hr = IROTData_GetComparisonData(rotdata, NULL, 0, &len);
3379 ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
3380 IROTData_Release(rotdata);
3381
3382 hr = IMoniker_QueryInterface(moniker, &IID_IMarshal, (void **)&marshal);
3383 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3384 hr = IMarshal_GetMarshalSizeMax(marshal, &IID_IMoniker, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &len);
3385 ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
3386 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IMoniker, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
3387 ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
3388 IMarshal_Release(marshal);
3389
3390 IMoniker_Release(moniker);
3391
3392 /* GetTimeOfLastChange() */
3393 hr = create_moniker_from_desc("CI1I2", &moniker);
3394 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3395
3396 hr = create_moniker_from_desc("I1", &moniker1);
3397 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3398
3399 /* See if non-generic composition is possible */
3400 hr = IMoniker_ComposeWith(moniker1, moniker, TRUE, &moniker2);
3401 ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
3402
3403 hr = IBindCtx_GetRunningObjectTable(bindctx, &rot);
3404 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3405
3406 hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, moniker1, &ft);
3407 ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#lx.\n", hr);
3408
3409 hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &ft);
3410 ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#lx.\n", hr);
3411
3412 hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, NULL);
3413 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3414
3415 hr = IMoniker_GetTimeOfLastChange(moniker, NULL, NULL, &ft);
3416 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3417
3418 hr = IRunningObjectTable_Register(rot, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)moniker,
3419 moniker, &cookie);
3420 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3421
3422 hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &ft);
3423 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3424
3425 hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, moniker1, &ft);
3426 ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#lx.\n", hr);
3427
3428 hr = IRunningObjectTable_Revoke(rot, cookie);
3429 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3430
3431 IRunningObjectTable_Release(rot);
3432
3433 IMoniker_Release(moniker);
3434 IMoniker_Release(moniker1);
3435
3436 /* CommonPrefixWith() */
3437 hr = create_moniker_from_desc("CI1I2", &moniker);
3438 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3439 hr = create_moniker_from_desc("CI1I2", &moniker1);
3440 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3441
3442 hr = IMoniker_CommonPrefixWith(moniker, NULL, NULL);
3443 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3444
3445 hr = IMoniker_CommonPrefixWith(moniker, moniker1, NULL);
3446 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3447
3448 moniker2 = (void *)0xdeadbeef;
3449 hr = IMoniker_CommonPrefixWith(moniker, NULL, &moniker2);
3450 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3451 ok(!moniker2, "Unexpected pointer.\n");
3452
3453 /* With itself */
3454 hr = IMoniker_CommonPrefixWith(moniker, moniker, &moniker2);
3455 ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
3456 hr = IMoniker_IsEqual(moniker, moniker2);
3457 ok(hr == S_OK && moniker2 != moniker, "Unexpected hr %#lx.\n", hr);
3458 IMoniker_Release(moniker2);
3459
3460 /* Equal composites */
3461 hr = IMoniker_CommonPrefixWith(moniker, moniker1, &moniker2);
3462 ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
3463 ok(moniker2 != moniker && moniker2 != moniker1, "Unexpected object.\n");
3464 hr = IMoniker_IsEqual(moniker, moniker2);
3465 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3466 IMoniker_Release(moniker2);
3467
3468 hr = create_moniker_from_desc("I2", &moniker2);
3469 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3470 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
3471 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
3472 IMoniker_Release(moniker2);
3473
3474 hr = create_moniker_from_desc("I1", &moniker2);
3475 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3476 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
3477 ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
3478 hr = IMoniker_IsEqual(moniker2, moniker3);
3479 ok(hr == S_OK && moniker3 != moniker2, "Unexpected object.\n");
3480 IMoniker_Release(moniker3);
3481
3482 hr = IMoniker_CommonPrefixWith(moniker2, moniker, &moniker3);
3483 todo_wine
3484 ok(hr == MK_S_ME, "Unexpected hr %#lx.\n", hr);
3485 if (SUCCEEDED(hr))
3486 {
3487 hr = IMoniker_IsEqual(moniker2, moniker3);
3488 ok(hr == S_OK && moniker3 != moniker2, "Unexpected object.\n");
3489 IMoniker_Release(moniker3);
3490 }
3491
3492 IMoniker_Release(moniker2);
3493
3494 IMoniker_Release(moniker);
3495 IMoniker_Release(moniker1);
3496
3497 /* IsEqual() */
3498 hr = create_moniker_from_desc("CI1I2", &moniker1);
3499 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3500 hr = create_moniker_from_desc("CI1I2", &moniker2);
3501 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3502 hr = IMoniker_IsEqual(moniker1, NULL);
3503 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3504 hr = IMoniker_IsEqual(moniker1, moniker2);
3505 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3506 hr = IMoniker_IsEqual(moniker1, moniker1);
3507 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3508 IMoniker_Release(moniker2);
3509 IMoniker_Release(moniker1);
3510
3511 /* ComposeWith() */
3512 hr = create_moniker_from_desc("CI1I2", &moniker1);
3513 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3514 hr = create_moniker_from_desc("I3", &moniker2);
3515 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3516
3517 hr = IMoniker_ComposeWith(moniker1, NULL, FALSE, &moniker);
3518 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3519 ok(moniker == moniker1, "Unexpected pointer.\n");
3520 IMoniker_Release(moniker);
3521
3522 hr = IMoniker_ComposeWith(moniker1, NULL, TRUE, &moniker);
3523 ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
3524 ok(!moniker, "Unexpected pointer.\n");
3525
3526 IMoniker_Release(moniker2);
3527 IMoniker_Release(moniker1);
3528
3529 /* Inverse() */
3530 hr = create_moniker_from_desc("CI1I2", &moniker1);
3531 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3532 hr = IMoniker_Inverse(moniker1, NULL);
3533 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3534 hr = IMoniker_Inverse(moniker1, &inverse);
3535 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3536 TEST_MONIKER_TYPE(inverse, MKSYS_GENERICCOMPOSITE);
3537 TEST_DISPLAY_NAME(inverse, L"\\..\\..");
3538 IMoniker_Release(inverse);
3539 IMoniker_Release(moniker1);
3540
3541 hr = create_moniker_from_desc("CA1A2", &moniker1);
3542 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3543 inverse = (void *)0xdeadbeef;
3544 hr = IMoniker_Inverse(moniker1, &inverse);
3545 ok(hr == MK_E_NOINVERSE, "Unexpected hr %#lx.\n", hr);
3546 ok(!inverse, "Unexpected pointer.\n");
3547 IMoniker_Release(moniker1);
3548
3549 hr = create_moniker_from_desc("CI1A2", &moniker1);
3550 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3551 inverse = (void *)0xdeadbeef;
3552 hr = IMoniker_Inverse(moniker1, &inverse);
3553 ok(hr == MK_E_NOINVERSE, "Unexpected hr %#lx.\n", hr);
3554 ok(!inverse, "Unexpected pointer.\n");
3555 IMoniker_Release(moniker1);
3556
3557 /* Now with custom moniker to observe inverse order */
3559 m->inverse = "I5";
3560 hr = create_moniker_from_desc("I1", &moniker1);
3561 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3562 hr = CreateGenericComposite(moniker1, &m->IMoniker_iface, &moniker2);
3563 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3564 TEST_MONIKER_TYPE(moniker2, MKSYS_GENERICCOMPOSITE);
3565 inverse = (void *)0xdeadbeef;
3566 hr = IMoniker_Inverse(moniker2, &inverse);
3567 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3568 ok(!inverse, "Unexpected pointer.\n");
3569 IMoniker_Release(moniker1);
3570
3571 /* Use custom monikers for both, so they don't invert to anti monikers. */
3572 m2 = create_test_moniker();
3573 m2->inverse = "I4";
3574
3575 hr = CreateGenericComposite(&m2->IMoniker_iface, &m->IMoniker_iface, &moniker2);
3576 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3577 hr = IMoniker_Inverse(moniker2, &inverse);
3578 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3579 TEST_MONIKER_TYPE(inverse, MKSYS_GENERICCOMPOSITE);
3580 TEST_DISPLAY_NAME(inverse, L"!I5!I4");
3581 IMoniker_Release(inverse);
3582 IMoniker_Release(moniker2);
3583
3584 IMoniker_Release(&m->IMoniker_iface);
3585 IMoniker_Release(&m2->IMoniker_iface);
3586
3587 /* Display name */
3588
3589 /* One component does not support it. */
3591 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3592
3593 hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &str);
3594 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3595
3596 hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, NULL);
3597 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3598
3599 hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &str);
3600 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
3601
3602 /* Comparison data, pointer component does not support it. */
3603 hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata);
3604 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3605 len = 0;
3606 hr = IROTData_GetComparisonData(rotdata, buffer, sizeof(buffer), &len);
3607todo_wine {
3608 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
3609 ok(!len, "Unexpected length %lu.\n", len);
3610}
3611 IROTData_Release(rotdata);
3612
3613 IMoniker_Release(moniker);
3614
3615 /* Reduce() */
3616 hr = create_moniker_from_desc("CI1I2", &moniker);
3617 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3618
3619 hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, NULL);
3620 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3621 hr = IMoniker_Reduce(moniker, bindctx, MKRREDUCE_ALL, NULL, NULL);
3622 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3623 hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, &moniker2);
3624 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3625
3626 hr = IMoniker_Reduce(moniker, bindctx, MKRREDUCE_ALL, NULL, &moniker2);
3627 ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
3628 ok(moniker2 == moniker, "Unexpected object.\n");
3629 IMoniker_Release(moniker2);
3630
3631 IMoniker_Release(moniker);
3632
3633 /* Enum() */
3634 hr = create_moniker_from_desc("CI1CI2I3", &moniker);
3635 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3636
3637 hr = IMoniker_Enum(moniker, FALSE, NULL);
3638 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3639
3640 /* Forward direction */
3641 hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
3642 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3643
3644 hr = IEnumMoniker_Next(enummoniker, 0, NULL, NULL);
3645 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3646
3647 moniker2 = (void *)0xdeadbeef;
3648 hr = IEnumMoniker_Next(enummoniker, 0, &moniker2, NULL);
3649 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3650 ok(!moniker2, "Unexpected pointer.\n");
3651
3652 len = 1;
3653 moniker2 = (void *)0xdeadbeef;
3654 hr = IEnumMoniker_Next(enummoniker, 0, &moniker2, &len);
3655 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3656 ok(!len, "Unexpected count %lu.\n", len);
3657 ok(!moniker2, "Unexpected pointer.\n");
3658
3659 hr = IEnumMoniker_Skip(enummoniker, 0);
3660 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3661
3662 len = 0;
3663 hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
3664 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3665 ok(len == 1, "Unexpected count %lu.\n", len);
3666 TEST_DISPLAY_NAME(moniker2, L"!I1");
3667 IMoniker_Release(moniker2);
3668
3669 len = 0;
3670 hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
3671 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3672 ok(len == 1, "Unexpected count %lu.\n", len);
3673 TEST_DISPLAY_NAME(moniker2, L"!I2");
3674 IMoniker_Release(moniker2);
3675
3676 len = 0;
3677 hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
3678 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3679 ok(len == 1, "Unexpected count %lu.\n", len);
3680 TEST_DISPLAY_NAME(moniker2, L"!I3");
3681 IMoniker_Release(moniker2);
3682
3683 len = 1;
3684 hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
3685 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
3686 ok(!len, "Unexpected count %lu.\n", len);
3687
3688 hr = IEnumMoniker_Skip(enummoniker, 0);
3689 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3690
3691 hr = IEnumMoniker_Skip(enummoniker, 1);
3692 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
3693
3694 hr = IEnumMoniker_Clone(enummoniker, NULL);
3695 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3696
3697 enummoniker2 = (void *)0xdeadbeef;
3698 hr = IEnumMoniker_Clone(enummoniker, &enummoniker2);
3699 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
3700 ok(!enummoniker2, "Unexpected pointer.\n");
3701
3702 hr = IEnumMoniker_Reset(enummoniker);
3703 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3704
3705 hr = IEnumMoniker_Skip(enummoniker, 2);
3706 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3707
3708 len = 0;
3709 hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
3710 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3711 ok(len == 1, "Unexpected count %lu.\n", len);
3712 TEST_DISPLAY_NAME(moniker2, L"!I3");
3713 IMoniker_Release(moniker2);
3714
3715 enummoniker2 = (void *)0xdeadbeef;
3716 hr = IEnumMoniker_Clone(enummoniker, &enummoniker2);
3717 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
3718 ok(!enummoniker2, "Unexpected pointer.\n");
3719
3720 IEnumMoniker_Release(enummoniker);
3721
3722 /* Backward direction */
3723 hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
3724 ok(hr == S_OK, "Failed to get enumerator, hr %#lx.\n", hr);
3725
3726 hr = IEnumMoniker_Next(enummoniker, 0, NULL, NULL);
3727 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3728
3729 moniker2 = (void *)0xdeadbeef;
3730 hr = IEnumMoniker_Next(enummoniker, 0, &moniker2, NULL);
3731 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3732 ok(!moniker2, "Unexpected pointer.\n");
3733
3734 len = 1;
3735 moniker2 = (void *)0xdeadbeef;
3736 hr = IEnumMoniker_Next(enummoniker, 0, &moniker2, &len);
3737 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3738 ok(!len, "Unexpected count %lu.\n", len);
3739 ok(!moniker2, "Unexpected pointer.\n");
3740
3741 hr = IEnumMoniker_Skip(enummoniker, 0);
3742 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3743
3744 len = 0;
3745 hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
3746 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3747 ok(len == 1, "Unexpected count %lu.\n", len);
3748 TEST_DISPLAY_NAME(moniker2, L"!I3");
3749 IMoniker_Release(moniker2);
3750
3751 len = 0;
3752 hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
3753 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3754 ok(len == 1, "Unexpected count %lu.\n", len);
3755 TEST_DISPLAY_NAME(moniker2, L"!I2");
3756 IMoniker_Release(moniker2);
3757
3758 len = 0;
3759 hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
3760 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3761 ok(len == 1, "Unexpected count %lu.\n", len);
3762 TEST_DISPLAY_NAME(moniker2, L"!I1");
3763 IMoniker_Release(moniker2);
3764
3765 len = 1;
3766 hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
3767 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
3768 ok(!len, "Unexpected count %lu.\n", len);
3769
3770 hr = IEnumMoniker_Skip(enummoniker, 0);
3771 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3772
3773 hr = IEnumMoniker_Skip(enummoniker, 1);
3774 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
3775
3776 hr = IEnumMoniker_Clone(enummoniker, NULL);
3777 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3778
3779 enummoniker2 = (void *)0xdeadbeef;
3780 hr = IEnumMoniker_Clone(enummoniker, &enummoniker2);
3781 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
3782 ok(!enummoniker2, "Unexpected pointer.\n");
3783
3784 hr = IEnumMoniker_Reset(enummoniker);
3785 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3786
3787 hr = IEnumMoniker_Skip(enummoniker, 2);
3788 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3789
3790 len = 0;
3791 hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
3792 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3793 ok(len == 1, "Unexpected count %lu.\n", len);
3794 TEST_DISPLAY_NAME(moniker2, L"!I1");
3795 IMoniker_Release(moniker2);
3796
3797 enummoniker2 = (void *)0xdeadbeef;
3798 hr = IEnumMoniker_Clone(enummoniker, &enummoniker2);
3799 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
3800 ok(!enummoniker2, "Unexpected pointer.\n");
3801
3802 IEnumMoniker_Release(enummoniker);
3803
3804 IMoniker_Release(moniker);
3805
3806 /* RelativePathTo() */
3807 hr = create_moniker_from_desc("CI1I2", &moniker1);
3808 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3809
3810 hr = create_moniker_from_desc("CI2I3", &moniker2);
3811 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3812
3813 hr = IMoniker_RelativePathTo(moniker1, NULL, NULL);
3814 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3815 hr = IMoniker_RelativePathTo(moniker1, moniker2, &moniker3);
3816 ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#lx.\n", hr);
3817
3818 IBindCtx_Release(bindctx);
3819}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
GLenum GLsizei len
Definition: glext.h:6722
const GLfloat * m
Definition: glext.h:10848
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
static const BYTE expected_gc_moniker_saved_data[]
Definition: moniker.c:1681
static const BYTE expected_gc_moniker_comparison_data[]
Definition: moniker.c:1694
static const BYTE expected_gc_moniker_marshal_data[]
Definition: moniker.c:1655
static struct test_moniker * create_test_moniker(void)
Definition: moniker.c:878
const GUID IID_IDispatch
const WCHAR * str
Definition: cookie.c:34
IMoniker IMoniker_iface
Definition: moniker.c:420
const char * inverse
Definition: moniker.c:425
#define MK_E_NOPREFIX
Definition: winerror.h:3909
#define MK_E_NOTBINDABLE
Definition: winerror.h:3903
#define E_UNEXPECTED
Definition: winerror.h:3528

Referenced by START_TEST().

◆ test_item_container_AddRef()

static ULONG WINAPI test_item_container_AddRef ( IOleItemContainer iface)
static

Definition at line 506 of file moniker.c.

507{
509 return IMoniker_AddRef(&moniker->IMoniker_iface);
510}
static struct test_moniker * impl_from_IOleItemContainer(IOleItemContainer *iface)
Definition: moniker.c:440

◆ test_item_container_EnumObjects()

static HRESULT WINAPI test_item_container_EnumObjects ( IOleItemContainer iface,
DWORD  flags,
IEnumUnknown **  ppenum 
)
static

Definition at line 524 of file moniker.c.

526{
527 return E_NOTIMPL;
528}

◆ test_item_container_GetObject()

static HRESULT WINAPI test_item_container_GetObject ( IOleItemContainer iface,
LPOLESTR  item,
DWORD  bind_speed,
IBindCtx pbc,
REFIID  riid,
void **  obj 
)
static

Definition at line 535 of file moniker.c.

537{
539
541 {
542 *obj = &moniker->IParseDisplayName_iface;
543 IOleItemContainer_AddRef(iface);
544 }
545
546 return 0x8bee0000 | bind_speed;
547}

◆ test_item_container_GetObjectStorage()

static HRESULT WINAPI test_item_container_GetObjectStorage ( IOleItemContainer iface,
LPOLESTR  item,
IBindCtx pbc,
REFIID  riid,
void **  obj 
)
static

Definition at line 549 of file moniker.c.

551{
552 return 0x8bee0001;
553}

◆ test_item_container_IsRunning()

static HRESULT WINAPI test_item_container_IsRunning ( IOleItemContainer iface,
LPOLESTR  item 
)
static

Definition at line 555 of file moniker.c.

556{
557 ok(0, "Unexpected call.\n");
558 return E_NOTIMPL;
559}

◆ test_item_container_LockContainer()

static HRESULT WINAPI test_item_container_LockContainer ( IOleItemContainer iface,
BOOL  lock 
)
static

Definition at line 530 of file moniker.c.

531{
532 return S_OK;
533}

◆ test_item_container_ParseDisplayName()

static HRESULT WINAPI test_item_container_ParseDisplayName ( IOleItemContainer iface,
IBindCtx pbc,
LPOLESTR  displayname,
ULONG eaten,
IMoniker **  out 
)
static

Definition at line 518 of file moniker.c.

520{
521 return E_NOTIMPL;
522}

◆ test_item_container_QueryInterface()

static HRESULT WINAPI test_item_container_QueryInterface ( IOleItemContainer iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 490 of file moniker.c.

491{
496 {
497 *obj = iface;
498 IOleItemContainer_AddRef(iface);
499 return S_OK;
500 }
501
502 *obj = NULL;
503 return E_NOINTERFACE;
504}
const GUID IID_IOleContainer

◆ test_item_container_Release()

static ULONG WINAPI test_item_container_Release ( IOleItemContainer iface)
static

Definition at line 512 of file moniker.c.

513{
515 return IMoniker_Release(&moniker->IMoniker_iface);
516}

◆ test_item_moniker()

static void test_item_moniker ( void  )
static

Definition at line 2372 of file moniker.c.

2373{
2374 static const char item_moniker_unicode_delim_stream[] =
2375 {
2376 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, '!',
2377 0x00, 0x02, 0x00, 0x00, 0x00, 'A', 0x00,
2378 };
2379 static const char item_moniker_unicode_item_stream[] =
2380 {
2381 0x02, 0x00, 0x00, 0x00, '!', 0x00, 0x05, 0x00,
2382 0x00, 0x00, 0xff, 0xff, 0x00, 'B', 0x00,
2383 };
2384 static const char item_moniker_unicode_delim_item_stream[] =
2385 {
2386 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, '!',
2387 0x00, 0x06, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
2388 0x00, 'C', 0x00,
2389 };
2390 static struct
2391 {
2392 const char *data;
2393 int data_len;
2394 const WCHAR *display_name;
2395 }
2396 item_moniker_data[] =
2397 {
2398 { item_moniker_unicode_delim_stream, sizeof(item_moniker_unicode_delim_stream), L"!A" },
2399 { item_moniker_unicode_item_stream, sizeof(item_moniker_unicode_item_stream), L"!B" },
2400 { item_moniker_unicode_delim_item_stream, sizeof(item_moniker_unicode_delim_item_stream), L"!C" },
2401 };
2402 static const struct
2403 {
2404 const WCHAR *delim1;
2405 const WCHAR *item1;
2406 const WCHAR *delim2;
2407 const WCHAR *item2;
2408 HRESULT hr;
2409 } isequal_tests[] =
2410 {
2411 { L"!", L"Item1", L"!", L"ITEM1", S_OK },
2412 { NULL, L"Item1", L"!", L"ITEM1", S_OK },
2413 { L"", L"Item1", L"!", L"ITEM1", S_OK },
2414 { L"&", L"Item1", L"!", L"ITEM1", S_OK },
2415 {L"&&", L"Item1", L"&", L"&Item1", S_FALSE },
2416 { NULL, L"Item1", NULL, L"Item2", S_FALSE },
2417 { NULL, L"Item1", NULL, L"ITEM1", S_OK },
2418 };
2419 static const struct
2420 {
2421 const WCHAR *delim;
2422 const WCHAR *item;
2423 DWORD hash;
2424 } hash_tests[] =
2425 {
2426 { L"!", L"Test", 0x73c },
2427 { L"%", L"Test", 0x73c },
2428 { L"%", L"TEST", 0x73c },
2429 { L"%", L"T", 0x54 },
2430 { L"%", L"A", 0x41 },
2431 { L"%", L"a", 0x41 },
2432 };
2433 static const char *methods_isrunning[] =
2434 {
2435 "Moniker_IsRunning",
2436 NULL
2437 };
2438 IMoniker *moniker, *moniker1, *moniker2, *moniker3, *reduced, *anti, *inverse, *c;
2439 DWORD i, hash, eaten, cookie;
2440 HRESULT hr;
2441 IBindCtx *bindctx;
2443 static const WCHAR wszDelimiter[] = {'!',0};
2444 static const WCHAR wszObjectName[] = {'T','e','s','t',0};
2445 static const WCHAR expected_display_name[] = { '!','T','e','s','t',0 };
2446 struct test_moniker *container_moniker;
2447 WCHAR displayname[16] = L"display name";
2448 IEnumMoniker *enummoniker;
2450 BIND_OPTS bind_opts;
2452 IStream *stream;
2453
2454 hr = CreateItemMoniker(NULL, wszObjectName, &moniker);
2455 ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
2456
2457 hr = IMoniker_QueryInterface(moniker, &CLSID_ItemMoniker, (void **)&unknown);
2458 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2459 ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n");
2460 IUnknown_Release(unknown);
2461
2462 test_moniker("item moniker 2", moniker,
2466 46, L"Test");
2467
2468 IMoniker_Release(moniker);
2469
2470 hr = CreateItemMoniker(L"", wszObjectName, &moniker);
2471 ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
2472
2473 test_moniker("item moniker 3", moniker,
2477 50, L"Test");
2478
2479 IMoniker_Release(moniker);
2480
2481 hr = CreateItemMoniker(L"&&", wszObjectName, &moniker);
2482 ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
2483
2484 test_moniker("item moniker 4", moniker,
2488 58, L"&&Test");
2489
2490 IMoniker_Release(moniker);
2491
2492 hr = CreateItemMoniker(L"ab", wszObjectName, &moniker);
2493 ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
2494
2495 test_moniker("item moniker 5", moniker,
2499 58, L"abTest");
2500
2501 /* Serialize and load back. */
2502 hr = CreateItemMoniker(NULL, L"object", &moniker2);
2503 ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
2504
2506 ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
2507
2508 hr = CreateBindCtx(0, &bindctx);
2509 ok(hr == S_OK, "Failed to create bind context, hr %#lx.\n", hr);
2510
2511 for (i = 0; i < ARRAY_SIZE(item_moniker_data); ++i)
2512 {
2513 pos.QuadPart = 0;
2514 hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
2515 ok(hr == S_OK, "Failed to seek stream, hr %#lx.\n", hr);
2516
2517 hr = IStream_Write(stream, item_moniker_data[i].data, item_moniker_data[i].data_len, NULL);
2518 ok(hr == S_OK, "Failed to write stream contents, hr %#lx.\n", hr);
2519
2520 pos.QuadPart = 0;
2521 hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
2522 ok(hr == S_OK, "Failed to seek stream, hr %#lx.\n", hr);
2523
2524 hr = IMoniker_Load(moniker2, stream);
2525 ok(hr == S_OK, "Failed to load moniker, hr %#lx.\n", hr);
2526
2527 TEST_DISPLAY_NAME(moniker2, item_moniker_data[i].display_name);
2528 }
2529
2530 IStream_Release(stream);
2531
2532 IMoniker_Release(moniker2);
2533 IMoniker_Release(moniker);
2534
2535 /* Hashing */
2536
2537 for (i = 0; i < ARRAY_SIZE(hash_tests); ++i)
2538 {
2539 hr = CreateItemMoniker(hash_tests[i].delim, hash_tests[i].item, &moniker);
2540 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
2541
2542 hr = IMoniker_Hash(moniker, &hash);
2543 ok(hr == S_OK, "Failed to get hash value, hr %#lx.\n", hr);
2544 ok(hash == hash_tests[i].hash, "%ld: unexpected hash value %#lx.\n", i, hash);
2545
2546 IMoniker_Release(moniker);
2547 }
2548
2549 hr = CreateItemMoniker(wszDelimiter, wszObjectName, &moniker);
2551
2552 test_moniker("item moniker 1", moniker,
2557
2558 /* IsSystemMoniker test */
2559 TEST_MONIKER_TYPE(moniker, MKSYS_ITEMMONIKER);
2560
2561 container_moniker = create_test_moniker();
2562
2563 /* IsRunning test */
2564 hr = IMoniker_IsRunning(moniker, NULL, NULL, NULL);
2565 ok(hr == E_INVALIDARG, "IMoniker_IsRunning should return E_INVALIDARG, not 0x%08lx\n", hr);
2566
2567 hr = IMoniker_IsRunning(moniker, NULL, &container_moniker->IMoniker_iface, NULL);
2568 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2569
2570 hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
2571 ok(hr == S_FALSE, "IMoniker_IsRunning should return S_FALSE, not 0x%08lx\n", hr);
2572
2573 hr = CreateItemMoniker(wszDelimiter, wszObjectName, &moniker2);
2574 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
2575 hr = IMoniker_IsRunning(moniker, bindctx, NULL, moniker2);
2576 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2577 IMoniker_Release(moniker2);
2578
2579 /* Different moniker as newly running. */
2580 hr = CreateItemMoniker(wszDelimiter, L"Item123", &moniker2);
2581 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
2582
2583 hr = IMoniker_IsRunning(moniker, bindctx, NULL, moniker2);
2584 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2585
2586 hr = IBindCtx_GetRunningObjectTable(bindctx, &rot);
2587 ok(hr == S_OK, "Failed to get ROT, hr %#lx.\n", hr);
2588
2589 hr = IRunningObjectTable_Register(rot, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)moniker, moniker, &cookie);
2590 ok(hr == S_OK, "Failed to register, hr %#lx.\n", hr);
2591
2592 hr = IRunningObjectTable_IsRunning(rot, moniker);
2593 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2594
2595 hr = IMoniker_IsRunning(moniker, bindctx, NULL, moniker2);
2596 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2597
2598 hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
2599 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2600
2601 hr = IRunningObjectTable_Revoke(rot, cookie);
2602 ok(hr == S_OK, "Failed to revoke registration, hr %#lx.\n", hr);
2603
2604 IRunningObjectTable_Release(rot);
2605
2606 expected_method_list = methods_isrunning;
2607 hr = IMoniker_IsRunning(moniker, bindctx, &container_moniker->IMoniker_iface, NULL);
2608 ok(hr == 0x8beef000, "Unexpected hr %#lx.\n", hr);
2609
2610 expected_method_list = methods_isrunning;
2611 hr = IMoniker_IsRunning(moniker, bindctx, &container_moniker->IMoniker_iface, moniker2);
2612 ok(hr == 0x8beef000, "Unexpected hr %#lx.\n", hr);
2614
2615 IMoniker_Release(moniker2);
2616
2617 /* BindToObject() */
2618 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
2619 ok(hr == E_INVALIDARG, "IMoniker_BindToStorage should return E_INVALIDARG, not 0x%08lx\n", hr);
2620
2621 hr = IMoniker_BindToObject(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
2622 ok(hr == (0x8bee0000 | BINDSPEED_INDEFINITE), "Unexpected hr %#lx.\n", hr);
2623
2624 bind_opts.cbStruct = sizeof(bind_opts);
2625 hr = IBindCtx_GetBindOptions(bindctx, &bind_opts);
2626 ok(hr == S_OK, "Failed to get bind options, hr %#lx.\n", hr);
2627
2628 bind_opts.dwTickCountDeadline = 1;
2629 hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
2630 ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
2631 hr = IMoniker_BindToObject(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
2632 ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#lx.\n", hr);
2633
2634 bind_opts.dwTickCountDeadline = 2499;
2635 hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
2636 ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
2637 hr = IMoniker_BindToObject(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
2638 ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#lx.\n", hr);
2639
2640 bind_opts.dwTickCountDeadline = 2500;
2641 hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
2642 ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
2643 hr = IMoniker_BindToObject(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
2644 ok(hr == (0x8bee0000 | BINDSPEED_MODERATE), "Unexpected hr %#lx.\n", hr);
2645
2646 /* BindToStorage() */
2647 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
2648 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2649
2650 hr = IMoniker_BindToStorage(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
2651 ok(hr == 0x8bee0001, "Unexpected hr %#lx.\n", hr);
2652
2653 /* ParseDisplayName() */
2654 hr = IMoniker_ParseDisplayName(moniker, bindctx, NULL, displayname, &eaten, &moniker2);
2655 ok(hr == MK_E_SYNTAX, "Unexpected hr %#lx.\n", hr);
2656
2657 bind_opts.dwTickCountDeadline = 0;
2658 hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
2659 ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
2660 hr = IMoniker_ParseDisplayName(moniker, bindctx, &container_moniker->IMoniker_iface, displayname, &eaten, &moniker2);
2661 ok(hr == (0x8bee0000 | BINDSPEED_INDEFINITE), "Unexpected hr %#lx.\n", hr);
2662
2663 bind_opts.dwTickCountDeadline = 1;
2664 hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
2665 ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
2666 hr = IMoniker_ParseDisplayName(moniker, bindctx, &container_moniker->IMoniker_iface, displayname, &eaten, &moniker2);
2667 ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#lx.\n", hr);
2668
2669 bind_opts.dwTickCountDeadline = 2499;
2670 hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
2671 ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
2672 hr = IMoniker_ParseDisplayName(moniker, bindctx, &container_moniker->IMoniker_iface, displayname, &eaten, &moniker2);
2673 ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#lx.\n", hr);
2674
2675 bind_opts.dwTickCountDeadline = 2500;
2676 hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
2677 ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
2678 hr = IMoniker_ParseDisplayName(moniker, bindctx, &container_moniker->IMoniker_iface, displayname, &eaten, &moniker2);
2679 ok(hr == (0x8bee0000 | BINDSPEED_MODERATE), "Unexpected hr %#lx.\n", hr);
2680
2681 IMoniker_Release(&container_moniker->IMoniker_iface);
2682
2683 IBindCtx_Release(bindctx);
2684
2685 hr = IMoniker_Inverse(moniker, &inverse);
2686 ok(hr == S_OK, "Failed to get inverse, hr %#lx.\n", hr);
2687 TEST_MONIKER_TYPE(inverse, MKSYS_ANTIMONIKER);
2688 IMoniker_Release(inverse);
2689
2690 /* Reduce() */
2691 hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, &reduced);
2692 ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
2693 ok(reduced == moniker, "Unexpected moniker.\n");
2694 IMoniker_Release(reduced);
2695
2696 /* Enum() */
2697 enummoniker = (void *)0xdeadbeef;
2698 hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
2699 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2700 ok(!enummoniker, "Unexpected pointer.\n");
2701
2702 enummoniker = (void *)0xdeadbeef;
2703 hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
2704 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2705 ok(!enummoniker, "Unexpected pointer.\n");
2706
2707 hr = IMoniker_Enum(moniker, FALSE, NULL);
2708 todo_wine
2709 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2710
2711 hr = IMoniker_IsEqual(moniker, NULL);
2712 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2713
2714 IMoniker_Release(moniker);
2715
2716 /* IsEqual */
2717 for (i = 0; i < ARRAY_SIZE(isequal_tests); ++i)
2718 {
2719 hr = CreateItemMoniker(isequal_tests[i].delim1, isequal_tests[i].item1, &moniker);
2720 ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
2721
2722 hr = CreateItemMoniker(isequal_tests[i].delim2, isequal_tests[i].item2, &moniker2);
2723 ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
2724
2725 hr = IMoniker_IsEqual(moniker, moniker2);
2726 ok(hr == isequal_tests[i].hr, "%ld: unexpected result %#lx.\n", i, hr);
2727
2728 hr = IMoniker_IsEqual(moniker2, moniker);
2729 ok(hr == isequal_tests[i].hr, "%ld: unexpected result %#lx.\n", i, hr);
2730
2731 IMoniker_Release(moniker);
2732 IMoniker_Release(moniker2);
2733 }
2734
2735 /* Default instance. */
2736 hr = CoCreateInstance(&CLSID_ItemMoniker, NULL, CLSCTX_SERVER, &IID_IMoniker, (void **)&moniker);
2737 ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
2738
2739 test_moniker("item moniker 6", moniker,
2743 34, L"");
2744
2745 hr = CoCreateInstance(&CLSID_ItemMoniker, (IUnknown *)moniker, CLSCTX_SERVER, &IID_IMoniker, (void **)&moniker2);
2746 ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
2747
2748 IMoniker_Release(moniker);
2749
2750 /* ComposeWith() */
2751 hr = CreateItemMoniker(L"!", L"Item", &moniker);
2752 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
2753
2754 /* I + A -> () */
2755 anti = create_antimoniker(1);
2756 hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
2757 ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
2758 ok(!moniker2, "Unexpected pointer.\n");
2759 IMoniker_Release(anti);
2760
2761 /* I + A2 -> A */
2762 anti = create_antimoniker(2);
2763 hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
2764 ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
2765 TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
2766 hr = IMoniker_Hash(moniker2, &hash);
2767 ok(hr == S_OK, "Failed to get hash, hr %#lx.\n", hr);
2768 ok(hash == 0x80000001, "Unexpected hash.\n");
2769 IMoniker_Release(moniker2);
2770
2771 IMoniker_Release(anti);
2772
2773 /* I + (A,A3) -> A3 */
2774
2775 /* Simplification has to through generic composite logic,
2776 even when resolved to non-composite, generic composite option has to be enabled. */
2777 hr = create_moniker_from_desc("CA1A3", &c);
2778 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2779 hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2);
2780 ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
2781 hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2);
2782 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2783 TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
2784 hr = IMoniker_Hash(moniker2, &hash);
2785 ok(hr == S_OK, "Failed to get hash, hr %#lx.\n", hr);
2786 ok(hash == 0x80000003, "Unexpected hash.\n");
2787 IMoniker_Release(moniker2);
2788 IMoniker_Release(c);
2789
2790 IMoniker_Release(moniker);
2791
2792 /* CommonPrefixWith */
2793 hr = CreateItemMoniker(L"!", L"Item", &moniker);
2794 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
2795 hr = CreateItemMoniker(L"#", L"Item", &moniker2);
2796 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
2797
2798 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
2799 ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
2800 ok(moniker3 == moniker, "Unexpected object.\n");
2801 IMoniker_Release(moniker3);
2802
2803 IMoniker_Release(moniker2);
2804
2805 hr = CreateItemMoniker(L"!", L"Item2", &moniker2);
2806 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
2807
2808 moniker3 = (void *)0xdeadbeef;
2809 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
2810 todo_wine
2811{
2812 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
2813 ok(!moniker3, "Unexpected object.\n");
2814}
2815
2816 IMoniker_Release(moniker2);
2817
2818 IMoniker_Release(moniker);
2819
2820 /* RelativePathTo() */
2822 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2823 hr = create_moniker_from_desc("I2", &moniker1);
2824 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2825
2826 hr = IMoniker_RelativePathTo(moniker, NULL, NULL);
2827 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2828 hr = IMoniker_RelativePathTo(moniker, NULL, &moniker2);
2829 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2830 hr = IMoniker_RelativePathTo(moniker, moniker1, NULL);
2831 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2832 moniker2 = (void *)0xdeadbeef;
2833 hr = IMoniker_RelativePathTo(moniker, moniker1, &moniker2);
2834 ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#lx.\n", hr);
2835 ok(!moniker2, "Unexpected pointer.\n");
2836
2837 IMoniker_Release(moniker1);
2838 IMoniker_Release(moniker);
2839}
const GLubyte * c
Definition: glext.h:8905
static const BYTE expected_item_moniker_saved_data2[]
Definition: moniker.c:1507
static const BYTE expected_item_moniker_saved_data3[]
Definition: moniker.c:1513
static const BYTE expected_item_moniker_comparison_data[]
Definition: moniker.c:1462
static const BYTE expected_item_moniker_saved_data6[]
Definition: moniker.c:1531
static const BYTE expected_item_moniker_comparison_data5[]
Definition: moniker.c:1486
static const BYTE expected_item_moniker_saved_data4[]
Definition: moniker.c:1519
static const BYTE expected_item_moniker_comparison_data4[]
Definition: moniker.c:1478
static const BYTE expected_item_moniker_saved_data5[]
Definition: moniker.c:1525
static const BYTE expected_item_moniker_marshal_data3[]
Definition: moniker.c:1561
static const BYTE expected_item_moniker_marshal_data2[]
Definition: moniker.c:1549
static const BYTE expected_item_moniker_marshal_data[]
Definition: moniker.c:1537
static const BYTE expected_item_moniker_saved_data[]
Definition: moniker.c:1501
static const BYTE expected_item_moniker_comparison_data2[]
Definition: moniker.c:1470
static const BYTE expected_item_moniker_comparison_data6[]
Definition: moniker.c:1494
static const BYTE expected_item_moniker_marshal_data5[]
Definition: moniker.c:1585
static const BYTE expected_item_moniker_marshal_data6[]
Definition: moniker.c:1597
static const BYTE expected_item_moniker_marshal_data4[]
Definition: moniker.c:1573
static const struct metadata_item item1[]
Definition: metadata.c:3603
static const struct metadata_item item2[]
Definition: metadata.c:3608

Referenced by START_TEST().

◆ test_MkParseDisplayName()

static void test_MkParseDisplayName ( void  )
static

Definition at line 1163 of file moniker.c.

1164{
1165 IBindCtx * pbc = NULL;
1166 HRESULT hr;
1167 IMoniker * pmk = NULL;
1168 IMoniker * pmk1 = NULL;
1169 IMoniker * pmk2 = NULL;
1170 ULONG eaten;
1171 int matchCnt;
1172 IUnknown * object = NULL;
1173
1174 IUnknown *lpEM1;
1175
1176 IEnumMoniker *spEM1 = NULL;
1177 IEnumMoniker *spEM2 = NULL;
1178 IEnumMoniker *spEM3 = NULL;
1179
1180 DWORD pdwReg1=0;
1181 DWORD pdwReg2=0;
1182 IRunningObjectTable * pprot=NULL;
1183
1184 /* CLSID of My Computer */
1185 static const WCHAR wszDisplayName[] = {'c','l','s','i','d',':',
1186 '2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D',':',0};
1187 static const WCHAR wszDisplayNameClsid[] = {'c','l','s','i','d',':',0};
1188 static const WCHAR wszNonExistentProgId[] = {'N','o','n','E','x','i','s','t','e','n','t','P','r','o','g','I','d',':',0};
1189 static const WCHAR wszDisplayNameRunning[] = {'W','i','n','e','T','e','s','t','R','u','n','n','i','n','g',0};
1190 static const WCHAR wszDisplayNameProgId1[] = {'S','t','d','F','o','n','t',':',0};
1191 static const WCHAR wszDisplayNameProgId2[] = {'@','S','t','d','F','o','n','t',0};
1192 static const WCHAR wszDisplayNameProgIdFail[] = {'S','t','d','F','o','n','t',0};
1193 static const WCHAR wszEmpty[] = {0};
1194 char szDisplayNameFile[256];
1195 WCHAR wszDisplayNameFile[256];
1196 int i, len;
1197
1198 const struct
1199 {
1200 LPBC *ppbc;
1201 LPCOLESTR szDisplayName;
1202 LPDWORD pchEaten;
1203 LPMONIKER *ppmk;
1204 } invalid_parameters[] =
1205 {
1206 {NULL, NULL, NULL, NULL},
1207 {NULL, NULL, NULL, &pmk},
1208 {NULL, NULL, &eaten, NULL},
1209 {NULL, NULL, &eaten, &pmk},
1210 {NULL, wszEmpty, NULL, NULL},
1211 {NULL, wszEmpty, NULL, &pmk},
1212 {NULL, wszEmpty, &eaten, NULL},
1213 {NULL, wszEmpty, &eaten, &pmk},
1214 {&pbc, NULL, NULL, NULL},
1215 {&pbc, NULL, NULL, &pmk},
1216 {&pbc, NULL, &eaten, NULL},
1217 {&pbc, NULL, &eaten, &pmk},
1218 {&pbc, wszEmpty, NULL, NULL},
1219 {&pbc, wszEmpty, NULL, &pmk},
1220 {&pbc, wszEmpty, &eaten, NULL},
1221 {&pbc, wszEmpty, &eaten, &pmk},
1222 };
1223 struct test_factory factory;
1224
1226
1227 hr = CreateBindCtx(0, &pbc);
1229
1230 for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
1231 {
1232 eaten = 0xdeadbeef;
1233 pmk = (IMoniker *)0xdeadbeef;
1234 hr = MkParseDisplayName(invalid_parameters[i].ppbc ? *invalid_parameters[i].ppbc : NULL,
1235 invalid_parameters[i].szDisplayName,
1236 invalid_parameters[i].pchEaten,
1237 invalid_parameters[i].ppmk);
1238 ok(hr == E_INVALIDARG, "[%d] MkParseDisplayName should have failed with E_INVALIDARG instead of 0x%08lx\n", i, hr);
1239 ok(eaten == 0xdeadbeef, "[%d] Processed character count should have been 0xdeadbeef instead of %lu\n", i, eaten);
1240 ok(pmk == (IMoniker *)0xdeadbeef, "[%d] Output moniker pointer should have been 0xdeadbeef instead of %p\n", i, pmk);
1241 }
1242
1243 eaten = 0xdeadbeef;
1244 pmk = (IMoniker *)0xdeadbeef;
1245 hr = MkParseDisplayName(pbc, wszNonExistentProgId, &eaten, &pmk);
1246 todo_wine
1247 ok(hr == MK_E_SYNTAX, "Unexpected hr %#lx.\n", hr);
1248 ok(eaten == 0, "Processed character count should have been 0 instead of %lu\n", eaten);
1249 ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk);
1250
1251 /* no special handling of "clsid:" without the string form of the clsid
1252 * following */
1253 eaten = 0xdeadbeef;
1254 pmk = (IMoniker *)0xdeadbeef;
1255 hr = MkParseDisplayName(pbc, wszDisplayNameClsid, &eaten, &pmk);
1256 todo_wine
1257 ok(hr == MK_E_SYNTAX, "Unexpected hr %#lx.\n", hr);
1258 ok(eaten == 0, "Processed character count should have been 0 instead of %lu\n", eaten);
1259 ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk);
1260
1261 /* shows clsid has higher precedence than a running object */
1262 hr = CreateFileMoniker(wszDisplayName, &pmk);
1264 hr = IBindCtx_GetRunningObjectTable(pbc, &pprot);
1265 ok_ole_success(hr, IBindCtx_GetRunningObjectTable);
1266 hr = IRunningObjectTable_Register(pprot, 0, (IUnknown *)&factory.IClassFactory_iface, pmk, &pdwReg1);
1267 ok_ole_success(hr, IRunningObjectTable_Register);
1268 IMoniker_Release(pmk);
1269 pmk = NULL;
1270 hr = MkParseDisplayName(pbc, wszDisplayName, &eaten, &pmk);
1272 ok(eaten == ARRAY_SIZE(wszDisplayName) - 1,
1273 "Processed character count should have been 43 instead of %lu\n", eaten);
1274 if (pmk)
1275 {
1276 TEST_MONIKER_TYPE(pmk, MKSYS_CLASSMONIKER);
1277 IMoniker_Release(pmk);
1278 }
1279 hr = IRunningObjectTable_Revoke(pprot, pdwReg1);
1280 ok_ole_success(hr, IRunningObjectTable_Revoke);
1281 IRunningObjectTable_Release(pprot);
1282
1283 hr = CreateFileMoniker(wszDisplayNameRunning, &pmk);
1285 hr = IBindCtx_GetRunningObjectTable(pbc, &pprot);
1286 ok_ole_success(hr, IBindCtx_GetRunningObjectTable);
1287 hr = IRunningObjectTable_Register(pprot, 0, (IUnknown *)&factory.IClassFactory_iface, pmk, &pdwReg1);
1288 ok_ole_success(hr, IRunningObjectTable_Register);
1289 IMoniker_Release(pmk);
1290 pmk = NULL;
1291 hr = MkParseDisplayName(pbc, wszDisplayNameRunning, &eaten, &pmk);
1293 ok(eaten == ARRAY_SIZE(wszDisplayNameRunning) - 1,
1294 "Processed character count should have been 15 instead of %lu\n", eaten);
1295 if (pmk)
1296 {
1297 TEST_MONIKER_TYPE(pmk, MKSYS_FILEMONIKER);
1298 IMoniker_Release(pmk);
1299 }
1300 hr = IRunningObjectTable_Revoke(pprot, pdwReg1);
1301 ok_ole_success(hr, IRunningObjectTable_Revoke);
1302 IRunningObjectTable_Release(pprot);
1303
1304 hr = CoRegisterClassObject(&CLSID_StdFont, (IUnknown *)&ParseDisplayName, CLSCTX_INPROC_SERVER, REGCLS_MULTI_SEPARATE, &pdwReg1);
1306
1307 expected_display_name = wszDisplayNameProgId1;
1308 hr = MkParseDisplayName(pbc, wszDisplayNameProgId1, &eaten, &pmk);
1310 ok(eaten == ARRAY_SIZE(wszDisplayNameProgId1) - 1,
1311 "Processed character count should have been 8 instead of %lu\n", eaten);
1312 if (pmk)
1313 {
1314 TEST_MONIKER_TYPE(pmk, MKSYS_ANTIMONIKER);
1315 IMoniker_Release(pmk);
1316 }
1317
1318 expected_display_name = wszDisplayNameProgId2;
1319 hr = MkParseDisplayName(pbc, wszDisplayNameProgId2, &eaten, &pmk);
1321 ok(eaten == ARRAY_SIZE(wszDisplayNameProgId2) - 1,
1322 "Processed character count should have been 8 instead of %lu\n", eaten);
1323 if (pmk)
1324 {
1325 TEST_MONIKER_TYPE(pmk, MKSYS_ANTIMONIKER);
1326 IMoniker_Release(pmk);
1327 }
1328
1329 eaten = 0xdeadbeef;
1330 pmk = (IMoniker *)0xdeadbeef;
1331 hr = MkParseDisplayName(pbc, wszDisplayNameProgIdFail, &eaten, &pmk);
1332 todo_wine
1333 ok(hr == MK_E_SYNTAX, "Unexpected hr %#lx.\n", hr);
1334 ok(eaten == 0, "Processed character count should have been 0 instead of %lu\n", eaten);
1335 ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk);
1336
1337 hr = CoRevokeClassObject(pdwReg1);
1339
1340 GetSystemDirectoryA(szDisplayNameFile, sizeof(szDisplayNameFile));
1341 strcat(szDisplayNameFile, "\\kernel32.dll");
1342 len = MultiByteToWideChar(CP_ACP, 0, szDisplayNameFile, -1, wszDisplayNameFile,
1343 ARRAY_SIZE(wszDisplayNameFile));
1344 hr = MkParseDisplayName(pbc, wszDisplayNameFile, &eaten, &pmk);
1346 ok(eaten == len - 1, "Processed character count should have been %d instead of %lu\n", len - 1, eaten);
1347 if (pmk)
1348 {
1349 TEST_MONIKER_TYPE(pmk, MKSYS_FILEMONIKER);
1350 IMoniker_Release(pmk);
1351 }
1352
1353 hr = MkParseDisplayName(pbc, wszDisplayName, &eaten, &pmk);
1355 ok(eaten == ARRAY_SIZE(wszDisplayName) - 1,
1356 "Processed character count should have been 43 instead of %lu\n", eaten);
1357
1358 if (pmk)
1359 {
1360 hr = IMoniker_BindToObject(pmk, pbc, NULL, &IID_IUnknown, (LPVOID*)&object);
1361 ok_ole_success(hr, IMoniker_BindToObject);
1362
1363 if (SUCCEEDED(hr))
1364 IUnknown_Release(object);
1365 IMoniker_Release(pmk);
1366 }
1367 IBindCtx_Release(pbc);
1368
1369 /* Test the EnumMoniker interface */
1370 hr = CreateBindCtx(0, &pbc);
1372
1374 ok(hr == S_OK, "Failed to create file moniker, hr %#lx.\n", hr);
1376 ok(hr == S_OK, "Failed to create file moniker, hr %#lx.\n", hr);
1377 hr = IBindCtx_GetRunningObjectTable(pbc, &pprot);
1378 ok(hr == S_OK, "Failed to get ROT, hr %#lx.\n", hr);
1379
1380 /* Check EnumMoniker before registering */
1381 hr = IRunningObjectTable_EnumRunning(pprot, &spEM1);
1382 ok(hr == S_OK, "Failed to get enum object, hr %#lx.\n", hr);
1383 hr = IEnumMoniker_QueryInterface(spEM1, &IID_IUnknown, (void *)&lpEM1);
1384 /* Register a couple of Monikers and check is ok */
1385 ok(hr == S_OK, "Failed to get interface, hr %#lx.\n", hr);
1386
1387 matchCnt = count_moniker_matches(pbc, spEM1);
1388
1389 hr = IRunningObjectTable_Register(pprot, ROTFLAGS_REGISTRATIONKEEPSALIVE, lpEM1, pmk1, &pdwReg1);
1390 ok(hr == S_OK, "Failed to register object, hr %#lx.\n", hr);
1391
1392 hr = IRunningObjectTable_Register(pprot, ROTFLAGS_REGISTRATIONKEEPSALIVE, lpEM1, pmk2, &pdwReg2);
1393 ok(hr == S_OK, "Failed to register object, hr %#lx.\n", hr);
1394
1395 hr = IRunningObjectTable_EnumRunning(pprot, &spEM2);
1396 ok(hr == S_OK, "Failed to get enum object, hr %#lx.\n", hr);
1397
1398 matchCnt = count_moniker_matches(pbc, spEM2);
1399 ok(matchCnt==2, "Number of matches should be equal to 2 not %i\n", matchCnt);
1400
1401 IEnumMoniker_Clone(spEM2, &spEM3);
1402
1403 matchCnt = count_moniker_matches(pbc, spEM3);
1404 ok(matchCnt==0, "Number of matches should be equal to 0 not %i\n", matchCnt);
1405 IEnumMoniker_Reset(spEM3);
1406
1407 matchCnt = count_moniker_matches(pbc, spEM3);
1408 ok(matchCnt==2, "Number of matches should be equal to 2 not %i\n", matchCnt);
1409
1410 hr = IRunningObjectTable_Revoke(pprot,pdwReg1);
1411 ok(hr == S_OK, "Failed to revoke, hr %#lx.\n", hr);
1412 hr = IRunningObjectTable_Revoke(pprot,pdwReg2);
1413 ok(hr == S_OK, "Failed to revoke, hr %#lx.\n", hr);
1414 IUnknown_Release(lpEM1);
1415 IEnumMoniker_Release(spEM1);
1416 IEnumMoniker_Release(spEM2);
1417 IEnumMoniker_Release(spEM3);
1418 IMoniker_Release(pmk1);
1419 IMoniker_Release(pmk2);
1420 IRunningObjectTable_Release(pprot);
1421
1422 IBindCtx_Release(pbc);
1423}
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD cookie)
Definition: combase.c:3107
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, IUnknown *object, DWORD clscontext, DWORD flags, DWORD *cookie)
Definition: combase.c:2970
#define MultiByteToWideChar
Definition: compat.h:110
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2202
static const CLSID CLSID_StdFont
Definition: compobj.c:92
static IParseDisplayName ParseDisplayName
Definition: moniker.c:1141
static void test_factory_init(struct test_factory *factory)
Definition: moniker.c:366
static int count_moniker_matches(IBindCtx *pbc, IEnumMoniker *spEM)
Definition: moniker.c:1143
static const WCHAR wszEmpty[]
Definition: misc.c:327
@ REGCLS_MULTI_SEPARATE
Definition: objbase.h:397
interface IMoniker * LPMONIKER
Definition: objfwd.h:9
interface IBindCtx * LPBC
Definition: objfwd.h:18
strcat
Definition: string.h:92
uint32_t * LPDWORD
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_moniker()

static void test_moniker ( const char testname,
IMoniker moniker,
const BYTE expected_moniker_marshal_data,
unsigned int  sizeof_expected_moniker_marshal_data,
const BYTE expected_moniker_saved_data,
unsigned int  sizeof_expected_moniker_saved_data,
const BYTE expected_moniker_comparison_data,
unsigned int  sizeof_expected_moniker_comparison_data,
int  expected_max_size,
LPCWSTR  expected_display_name 
)
static

Definition at line 1707 of file moniker.c.

1713{
1715 IStream * stream;
1716 IROTData * rotdata;
1717 HRESULT hr;
1718 HGLOBAL hglobal;
1719 LPBYTE moniker_data;
1720 DWORD moniker_size;
1721 DWORD i, moniker_type;
1722 BOOL same;
1723 BYTE buffer[128];
1724 IMoniker * moniker_proxy;
1725
1726 hr = IMoniker_IsDirty(moniker);
1727 ok(hr == S_FALSE, "%s: IMoniker_IsDirty should return S_FALSE, not 0x%08lx\n", testname, hr);
1728
1729 /* Display Name */
1731
1732 hr = IMoniker_IsDirty(moniker);
1733 ok(hr == S_FALSE, "%s: IMoniker_IsDirty should return S_FALSE, not 0x%08lx\n", testname, hr);
1734
1735 /* IROTData::GetComparisonData test */
1736
1737 hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata);
1738 ok_ole_success(hr, IMoniker_QueryInterface_IID_IROTData);
1739
1740 hr = IROTData_GetComparisonData(rotdata, buffer, sizeof(buffer), &moniker_size);
1741 ok_ole_success(hr, IROTData_GetComparisonData);
1742
1743 if (hr != S_OK) moniker_size = 0;
1744
1745 /* first check we have the right amount of data */
1746 ok(moniker_size == sizeof_expected_moniker_comparison_data,
1747 "%s: Size of comparison data differs (expected %d, actual %ld)\n",
1748 testname, sizeof_expected_moniker_comparison_data, moniker_size);
1749
1750 /* then do a byte-by-byte comparison */
1751 same = TRUE;
1752 for (i = 0; i < min(moniker_size, sizeof_expected_moniker_comparison_data); i++)
1753 {
1754 if (expected_moniker_comparison_data[i] != buffer[i])
1755 {
1756 same = FALSE;
1757 break;
1758 }
1759 }
1760
1761 ok(same, "%s: Comparison data differs\n", testname);
1762 if (!same)
1763 {
1764 for (i = 0; i < moniker_size; i++)
1765 {
1766 if (i % 8 == 0) printf(" ");
1767 printf("0x%02x,", buffer[i]);
1768 if (i % 8 == 7) printf("\n");
1769 }
1770 printf("\n");
1771 }
1772
1773 IROTData_Release(rotdata);
1774
1777
1778 /* Saving */
1779 moniker_type = 0;
1780 IMoniker_IsSystemMoniker(moniker, &moniker_type);
1781
1782 hr = IMoniker_GetSizeMax(moniker, &max_size);
1783 ok(hr == S_OK, "Failed to get max size, hr %#lx.\n", hr);
1784 todo_wine_if(moniker_type == MKSYS_GENERICCOMPOSITE)
1785 ok(expected_max_size == max_size.u.LowPart, "%s: unexpected max size %lu.\n", testname, max_size.u.LowPart);
1786
1787 hr = IMoniker_Save(moniker, stream, TRUE);
1788 ok_ole_success(hr, IMoniker_Save);
1789
1790 hr = GetHGlobalFromStream(stream, &hglobal);
1792
1793 moniker_size = GlobalSize(hglobal);
1794
1795 moniker_data = GlobalLock(hglobal);
1796
1797 /* first check we have the right amount of data */
1798 ok(moniker_size == round_global_size(sizeof_expected_moniker_saved_data),
1799 "%s: Size of saved data differs (expected %ld, actual %ld)\n",
1800 testname, (DWORD)round_global_size(sizeof_expected_moniker_saved_data), moniker_size);
1801
1802 /* then do a byte-by-byte comparison */
1803 same = TRUE;
1804 for (i = 0; i < min(moniker_size, round_global_size(sizeof_expected_moniker_saved_data)); i++)
1805 {
1806 if (expected_moniker_saved_data[i] != moniker_data[i])
1807 {
1808 same = FALSE;
1809 break;
1810 }
1811 }
1812
1813 ok(same, "%s: Saved data differs\n", testname);
1814 if (!same)
1815 {
1816 for (i = 0; i < moniker_size; i++)
1817 {
1818 if (i % 8 == 0) printf(" ");
1819 printf("0x%02x,", moniker_data[i]);
1820 if (i % 8 == 7) printf("\n");
1821 }
1822 printf("\n");
1823 }
1824
1825 GlobalUnlock(hglobal);
1826
1827 IStream_Release(stream);
1828
1829 /* Marshaling tests */
1830
1833
1834 hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1836
1837 hr = GetHGlobalFromStream(stream, &hglobal);
1839
1840 moniker_size = GlobalSize(hglobal);
1841
1842 moniker_data = GlobalLock(hglobal);
1843
1844 /* first check we have the right amount of data */
1845 ok(moniker_size == round_global_size(sizeof_expected_moniker_marshal_data),
1846 "%s: Size of marshaled data differs (expected %ld, actual %ld)\n",
1847 testname, (DWORD)round_global_size(sizeof_expected_moniker_marshal_data), moniker_size);
1848
1849 /* then do a byte-by-byte comparison */
1850 same = TRUE;
1851 if (expected_moniker_marshal_data)
1852 {
1853 for (i = 0; i < min(moniker_size, round_global_size(sizeof_expected_moniker_marshal_data)); i++)
1854 {
1855 if (expected_moniker_marshal_data[i] != moniker_data[i])
1856 {
1857 same = FALSE;
1858 break;
1859 }
1860 }
1861 }
1862
1863 ok(same, "%s: Marshaled data differs\n", testname);
1864 if (!same)
1865 {
1866 for (i = 0; i < moniker_size; i++)
1867 {
1868 if (i % 8 == 0) printf(" ");
1869 printf("0x%02x,", moniker_data[i]);
1870 if (i % 8 == 7) printf("\n");
1871 }
1872 printf("\n");
1873 }
1874
1875 GlobalUnlock(hglobal);
1876
1877 IStream_Seek(stream, llZero, STREAM_SEEK_SET, NULL);
1878 hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&moniker_proxy);
1880
1881 IStream_Release(stream);
1882 IMoniker_Release(moniker_proxy);
1883}
static INT max_size
Definition: history.c:51
HRESULT WINAPI GetHGlobalFromStream(IStream *stream, HGLOBAL *phglobal)
#define printf
Definition: freeldr.h:104
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
static SIZE_T round_global_size(SIZE_T size)
Definition: moniker.c:234
#define min(a, b)
Definition: monoChain.cc:55
unsigned char * LPBYTE
Definition: typedefs.h:53

◆ test_moniker_parse_AddRef()

static ULONG WINAPI test_moniker_parse_AddRef ( IParseDisplayName iface)
static

Definition at line 464 of file moniker.c.

465{
467 return IMoniker_AddRef(&moniker->IMoniker_iface);
468}
static ITS_IParseDisplayNameImpl * impl_from_IParseDisplayName(IParseDisplayName *iface)
Definition: moniker.c:381

◆ test_moniker_parse_ParseDisplayName()

static HRESULT WINAPI test_moniker_parse_ParseDisplayName ( IParseDisplayName iface,
IBindCtx pbc,
LPOLESTR  displayname,
ULONG eaten,
IMoniker **  out 
)
static

Definition at line 476 of file moniker.c.

478{
479 return E_NOTIMPL;
480}

◆ test_moniker_parse_QueryInterface()

static HRESULT WINAPI test_moniker_parse_QueryInterface ( IParseDisplayName iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 450 of file moniker.c.

451{
454 {
455 *obj = iface;
456 IParseDisplayName_AddRef(iface);
457 return S_OK;
458 }
459
460 *obj = NULL;
461 return E_NOINTERFACE;
462}

◆ test_moniker_parse_Release()

static ULONG WINAPI test_moniker_parse_Release ( IParseDisplayName iface)
static

Definition at line 470 of file moniker.c.

471{
473 return IMoniker_Release(&moniker->IMoniker_iface);
474}

◆ test_MonikerCommonPrefixWith()

static void test_MonikerCommonPrefixWith ( void  )
static

Definition at line 4505 of file moniker.c.

4506{
4507 IMoniker *moniker, *item, *file1, *file2, *composite, *composite2;
4508 HRESULT hr;
4509
4510 moniker = (void *)0xdeadbeef;
4512todo_wine {
4513 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
4514 ok(!moniker, "Unexpected pointer.\n");
4515}
4516 if (hr == E_NOTIMPL)
4517 return;
4518
4519 hr = CreateItemMoniker(L"!", L"Item", &item);
4520 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
4521
4522 moniker = (void *)0xdeadbeef;
4524 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
4525 ok(!moniker, "Unexpected pointer.\n");
4526
4527 moniker = (void *)0xdeadbeef;
4529 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
4530 ok(!moniker, "Unexpected pointer.\n");
4531
4533 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
4534
4535 hr = CreateFileMoniker(L"C:\\test.txt", &file1);
4536 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
4537
4539 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
4540
4542 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
4543
4544 /* F x F */
4545 hr = MonikerCommonPrefixWith(file1, file1, &moniker);
4546 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
4547
4548 hr = CreateFileMoniker(L"C:\\a\\test.txt", &file2);
4549 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
4550
4551 /* F1 x F2 */
4552 hr = MonikerCommonPrefixWith(file1, file2, &moniker);
4553 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
4554
4555 hr = CreateGenericComposite(file1, item, &composite);
4556 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
4557
4558 hr = CreateGenericComposite(file2, item, &composite2);
4559 ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
4560
4561 /* F x (F,I) -> F */
4562 hr = MonikerCommonPrefixWith(file1, composite, &moniker);
4563 ok(hr == MK_S_ME, "Unexpected hr %#lx.\n", hr);
4564 ok(moniker == file1, "Unexpected pointer.\n");
4565 IMoniker_Release(moniker);
4566
4567 /* F1 x (F2,I) -> F */
4568 hr = MonikerCommonPrefixWith(file1, composite2, &moniker);
4569 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4570 TEST_MONIKER_TYPE(moniker, MKSYS_FILEMONIKER);
4571 TEST_DISPLAY_NAME(moniker, L"C:\\");
4572 IMoniker_Release(moniker);
4573
4574 /* (F2,I) x F1 -> F */
4575 hr = MonikerCommonPrefixWith(composite2, file1, &moniker);
4576 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4577 TEST_MONIKER_TYPE(moniker, MKSYS_FILEMONIKER);
4578 TEST_DISPLAY_NAME(moniker, L"C:\\");
4579 IMoniker_Release(moniker);
4580
4581 /* (F,I) x (F) -> F */
4582 hr = MonikerCommonPrefixWith(composite, file1, &moniker);
4583 ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
4584 ok(moniker == file1, "Unexpected pointer.\n");
4585 IMoniker_Release(moniker);
4586
4587 /* (F,I) x (F,I) -> (F,I) */
4588 hr = MonikerCommonPrefixWith(composite, composite, &moniker);
4589 ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
4590 TEST_MONIKER_TYPE(moniker, MKSYS_GENERICCOMPOSITE);
4591 TEST_DISPLAY_NAME(moniker, L"C:\\test.txt!Item");
4592 ok(moniker != composite, "Unexpected pointer.\n");
4593 IMoniker_Release(moniker);
4594
4595 /* (F1,I) x (F2,I) -> () */
4596 hr = MonikerCommonPrefixWith(composite, composite2, &moniker);
4597 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4598 ok(!moniker, "Unexpected pointer %p.\n", moniker);
4599
4600 IMoniker_Release(composite2);
4601 IMoniker_Release(composite);
4602
4603 /* (I1,(I2,I3)) x ((I1,I2),I4) */
4604 hr = create_moniker_from_desc("CI1CI2I3", &composite);
4605 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4606 hr = create_moniker_from_desc("CCI1I2I4", &composite2);
4607 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4608 hr = MonikerCommonPrefixWith(composite, composite2, &moniker);
4609 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4610 TEST_MONIKER_TYPE(moniker, MKSYS_GENERICCOMPOSITE);
4611 TEST_DISPLAY_NAME(moniker, L"!I1!I2");
4612 IMoniker_Release(moniker);
4613
4614 IMoniker_Release(file2);
4615 IMoniker_Release(file1);
4616 IMoniker_Release(item);
4617}
HRESULT WINAPI MonikerCommonPrefixWith(IMoniker *pmkThis, IMoniker *pmkOther, IMoniker **ppmkCommon)

Referenced by START_TEST().

◆ test_objref_moniker()

static void test_objref_moniker ( void  )
static

Definition at line 4080 of file moniker.c.

4081{
4082 IMoniker *moniker, *moniker2, *prefix, *inverse, *anti;
4083 struct test_factory factory;
4084 IEnumMoniker *enummoniker;
4085 DWORD hash, size;
4086 HRESULT hr;
4087 IBindCtx *bindctx;
4090 IStream *stream;
4091 IROTData *rotdata;
4092 LPOLESTR display_name;
4093 IMarshal *marshal;
4095 CLSID clsid;
4096
4098
4100 ok(hr == E_INVALIDARG, "Unexpected hr %#lx\n", hr);
4101
4103 ok(hr == S_OK, "Unexpected hr %#lx\n", hr);
4104
4105 hr = IMoniker_QueryInterface(moniker, &IID_IMoniker, NULL);
4106 ok(hr == E_INVALIDARG, "Unexpected hr %#lx\n", hr);
4107
4108 hr = IMoniker_QueryInterface(moniker, &CLSID_PointerMoniker, (void **)&unknown);
4109 ok(unknown == (IUnknown *)moniker, "Unexpected interface\n");
4110 IUnknown_Release(unknown);
4111
4112 hr = IMoniker_QueryInterface(moniker, &CLSID_ObjrefMoniker, (void **)&unknown);
4113 ok(unknown == (IUnknown *)moniker, "Unexpected interface\n");
4114 IUnknown_Release(unknown);
4115
4116 hr = IMoniker_QueryInterface(moniker, &IID_IMarshal, (void **)&marshal);
4117 ok(hr == S_OK, "Failed to get interface, hr %#lx\n", hr);
4118
4119 hr = IMarshal_GetUnmarshalClass(marshal, NULL, NULL, 0, NULL, 0, &clsid);
4120 ok(hr == S_OK, "Failed to get class, hr %#lx\n", hr);
4121 ok(IsEqualGUID(&clsid, &CLSID_ObjrefMoniker), "Unexpected class %s\n", wine_dbgstr_guid(&clsid));
4122
4123 hr = IMarshal_GetMarshalSizeMax(marshal, &IID_IMoniker, NULL, CLSCTX_INPROC, NULL, 0, &size);
4124 ok(hr == S_OK, "Failed to get marshal size, hr %#lx\n", hr);
4125 ok(size > 0, "Unexpected size %ld\n", size);
4126
4128 ok(hr == S_OK, "Failed to create a stream, hr %#lx\n", hr);
4129
4130 hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
4131 ok(hr == S_OK, "Failed to marshal moniker, hr %#lx\n", hr);
4132
4133 pos.QuadPart = 0;
4134 IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
4135 hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&moniker2);
4136 ok(hr == S_OK, "Failed to unmarshal, hr %#lx\n", hr);
4137 hr = IMoniker_IsEqual(moniker, moniker2);
4138 todo_wine
4139 ok(hr == S_OK, "Expected equal moniker, hr %#lx\n", hr);
4140 IMoniker_Release(moniker2);
4141
4142 IStream_Release(stream);
4143
4144 IMarshal_Release(marshal);
4145
4146 ok(factory.refcount > 1, "Unexpected factory refcount %lu\n", factory.refcount);
4147
4148 /* Display Name */
4149
4150 hr = CreateBindCtx(0, &bindctx);
4151 ok(hr == S_OK, "CreateBindCtx failed: 0x%08lx\n", hr);
4152
4153 hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &display_name);
4154 todo_wine
4155 ok(hr == S_OK, "IMoniker_GetDisplayName failed: 0x%08lx\n", hr);
4156
4157 IBindCtx_Release(bindctx);
4158
4159 hr = IMoniker_IsDirty(moniker);
4160 ok(hr == S_FALSE, "IMoniker_IsDirty should return S_FALSE, not 0x%08lx\n", hr);
4161
4162 /* IROTData::GetComparisonData test */
4163
4164 hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata);
4165 ok(hr == E_NOINTERFACE, "IMoniker_QueryInterface(IID_IROTData) should have returned E_NOINTERFACE instead of 0x%08lx\n", hr);
4166
4167 /* Saving */
4168
4170 ok(hr == S_OK, "CreateStreamOnHGlobal failed: 0x%08lx\n", hr);
4171
4172 hr = IMoniker_Save(moniker, stream, TRUE);
4173 todo_wine
4174 ok(hr == S_OK, "IMoniker_Save failed: 0x%08lx\n", hr);
4175
4176 IStream_Release(stream);
4177
4178 /* Hashing */
4179 hr = IMoniker_Hash(moniker, &hash);
4180 ok(hr == S_OK, "IMoniker_Hash failed: 0x%08lx\n", hr);
4181 ok(hash == PtrToUlong(&factory.IClassFactory_iface), "Unexpected hash value %#lx\n", hash);
4182
4183 /* IsSystemMoniker test */
4184 TEST_MONIKER_TYPE(moniker, MKSYS_OBJREFMONIKER);
4185
4186 hr = IMoniker_Inverse(moniker, &inverse);
4187 todo_wine
4188 ok(hr == S_OK, "Failed to get inverse, hr %#lx\n", hr);
4189if (hr == S_OK)
4190{
4191 TEST_MONIKER_TYPE(inverse, MKSYS_ANTIMONIKER);
4192 IMoniker_Release(inverse);
4193}
4194
4195 hr = CreateBindCtx(0, &bindctx);
4196 ok(hr == S_OK, "CreateBindCtx failed: 0x%08lx\n", hr);
4197
4198 /* IsRunning test */
4199 hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
4200 todo_wine
4201 ok(hr == S_OK, "IMoniker_IsRunning should return S_OK, not 0x%08lx\n", hr);
4202
4203 hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
4204 ok(hr == MK_E_UNAVAILABLE, "IMoniker_GetTimeOfLastChange should return MK_E_UNAVAILABLE, not 0x%08lx\n", hr);
4205
4206 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
4207 todo_wine
4208 ok(hr == S_OK, "IMoniker_BindToObject failed: 0x%08lx\n", hr);
4209 if (hr == S_OK)
4210 IUnknown_Release(unknown);
4211
4212 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
4213 todo_wine
4214 ok(hr == S_OK, "IMoniker_BindToObject failed: 0x%08lx\n", hr);
4215 if (hr == S_OK)
4216 IUnknown_Release(unknown);
4217
4218 IMoniker_Release(moniker);
4219
4220 todo_wine
4221 ok(factory.refcount > 1, "Unexpected factory refcount %lu\n", factory.refcount);
4222
4224 ok(hr == S_OK, "CreateObjrefMoniker failed, hr %#lx\n", hr);
4225
4226 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
4227 todo_wine
4228 ok(hr == E_UNEXPECTED, "IMoniker_BindToObject should have returned E_UNEXPECTED instead of 0x%08lx\n", hr);
4229
4230 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
4231 todo_wine
4232 ok(hr == E_UNEXPECTED, "IMoniker_BindToStorage should have returned E_UNEXPECTED instead of 0x%08lx\n", hr);
4233
4234 IBindCtx_Release(bindctx);
4235
4236 /* Enum() */
4237 enummoniker = (void *)0xdeadbeef;
4238 hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
4239 ok(hr == S_OK, "Unexpected hr %#lx\n", hr);
4240 ok(enummoniker == NULL, "got %p\n", enummoniker);
4241
4242 enummoniker = (void *)0xdeadbeef;
4243 hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
4244 ok(hr == S_OK, "Unexpected hr %#lx\n", hr);
4245 ok(enummoniker == NULL, "got %p\n", enummoniker);
4246
4247 IMoniker_Release(moniker);
4248
4249 /* CommonPrefixWith() */
4251 ok(hr == S_OK, "CreateObjrefMoniker failed: hr %#lx\n", hr);
4252
4254 ok(hr == S_OK, "CreateObjrefMoniker failed: hr %#lx\n", hr);
4255
4256 hr = IMoniker_IsEqual(moniker, NULL);
4257 todo_wine
4258 ok(hr == E_INVALIDARG, "Unexpected hr %#lx\n", hr);
4259
4260 hr = IMoniker_IsEqual(moniker, moniker2);
4261 todo_wine
4262 ok(hr == S_OK, "Unexpected hr %#lx\n", hr);
4263
4264 hr = IMoniker_CommonPrefixWith(moniker, moniker2, NULL);
4265 todo_wine
4266 ok(hr == E_INVALIDARG, "Unexpected hr %#lx\n", hr);
4267
4268 hr = IMoniker_CommonPrefixWith(moniker, NULL, &prefix);
4269 todo_wine
4270 ok(hr == E_INVALIDARG, "Unexpected hr %#lx\n", hr);
4271
4272 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &prefix);
4273 todo_wine
4274 ok(hr == MK_S_US, "Unexpected hr %#lx\n", hr);
4275if (hr == S_OK)
4276{
4277 ok(prefix == moniker, "Unexpected pointer\n");
4278 IMoniker_Release(prefix);
4279}
4280
4281 IMoniker_Release(moniker2);
4282
4283 hr = CreateObjrefMoniker((IUnknown *)moniker, &moniker2);
4284 ok(hr == S_OK, "Failed to create moniker, hr %#lx\n", hr);
4285
4286 hr = IMoniker_IsEqual(moniker, moniker2);
4287 todo_wine
4288 ok(hr == S_FALSE, "Unexpected hr %#lx\n", hr);
4289
4290 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &prefix);
4291 todo_wine
4292 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx\n", hr);
4293
4294 IMoniker_Release(moniker2);
4295
4296 /* ComposeWith() */
4297
4298 /* P + A -> () */
4299 anti = create_antimoniker(1);
4300 hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
4301 todo_wine
4302 ok(hr == S_OK, "Failed to compose, hr %#lx\n", hr);
4303 if (hr == S_OK)
4304 ok(!moniker2, "Unexpected pointer\n");
4305 IMoniker_Release(anti);
4306
4307 /* P + A2 -> A */
4308 anti = create_antimoniker(2);
4309 hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
4310 todo_wine
4311 ok(hr == S_OK, "Failed to compose, hr %#lx\n", hr);
4312if (hr == S_OK)
4313{
4314 TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
4315 IMoniker_Release(moniker2);
4316}
4317
4318 IMoniker_Release(anti);
4319
4320 IMoniker_Release(moniker);
4321}
#define PtrToUlong(u)
Definition: config.h:107
static BSTR *static LPOLESTR
Definition: varformat.c:44
const CLSID * clsid
Definition: msctf.cpp:50
HRESULT WINAPI CreateObjrefMoniker(IUnknown *obj, IMoniker **ret)
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:206
Character const *const prefix
Definition: tempnam.cpp:195
#define MK_E_UNAVAILABLE
Definition: winerror.h:3894

Referenced by START_TEST().

◆ test_pointer_moniker()

static void test_pointer_moniker ( void  )
static

Definition at line 3821 of file moniker.c.

3822{
3823 IMoniker *moniker, *moniker2, *moniker3, *prefix, *inverse, *anti, *c;
3824 struct test_factory factory;
3825 IEnumMoniker *enummoniker;
3826 DWORD hash, size;
3827 HRESULT hr;
3828 IBindCtx *bindctx;
3831 IStream *stream;
3832 LPOLESTR display_name;
3833 IMarshal *marshal;
3835 CLSID clsid;
3836
3838
3840 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3841
3843 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3844
3845 check_interface(moniker, &IID_IMoniker, TRUE);
3846 todo_wine
3849 check_interface(moniker, &CLSID_PointerMoniker, TRUE);
3850 check_interface(moniker, &IID_IMarshal, TRUE);
3851 check_interface(moniker, &IID_IROTData, FALSE);
3852
3853 hr = IMoniker_QueryInterface(moniker, &IID_IMoniker, NULL);
3854 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3855
3856 hr = IMoniker_QueryInterface(moniker, &CLSID_PointerMoniker, (void **)&unknown);
3857 ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n");
3858 IUnknown_Release(unknown);
3859
3860 hr = IMoniker_QueryInterface(moniker, &IID_IMarshal, (void **)&marshal);
3861 ok(hr == S_OK, "Failed to get interface, hr %#lx.\n", hr);
3862
3863 hr = IMarshal_GetUnmarshalClass(marshal, NULL, NULL, 0, NULL, 0, &clsid);
3864 ok(hr == S_OK, "Failed to get class, hr %#lx.\n", hr);
3865 ok(IsEqualGUID(&clsid, &CLSID_PointerMoniker), "Unexpected class %s.\n", wine_dbgstr_guid(&clsid));
3866
3867 hr = IMarshal_GetMarshalSizeMax(marshal, &IID_IMoniker, NULL, CLSCTX_INPROC, NULL, 0, &size);
3868 ok(hr == S_OK, "Failed to get marshal size, hr %#lx.\n", hr);
3869 ok(size > 0, "Unexpected size %ld.\n", size);
3870
3872 ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
3873
3874 hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
3875 ok(hr == S_OK, "Failed to marshal moniker, hr %#lx.\n", hr);
3876
3877 pos.QuadPart = 0;
3878 IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
3879 hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&moniker2);
3880 ok(hr == S_OK, "Failed to unmarshal, hr %#lx.\n", hr);
3881 hr = IMoniker_IsEqual(moniker, moniker2);
3882 ok(hr == S_OK, "Expected equal moniker, hr %#lx.\n", hr);
3883 IMoniker_Release(moniker2);
3884
3885 IStream_Release(stream);
3886
3887 IMarshal_Release(marshal);
3888
3889 ok(factory.refcount > 1, "Unexpected factory refcount %lu.\n", factory.refcount);
3890
3891 /* Display Name */
3892
3893 hr = CreateBindCtx(0, &bindctx);
3895
3896 hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &display_name);
3897 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
3898
3899 hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, NULL);
3900 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3901
3902 display_name = (void *)0xdeadbeef;
3903 hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &display_name);
3904 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3905 ok(!display_name, "Unexpected pointer.\n");
3906
3907 IBindCtx_Release(bindctx);
3908
3909 hr = IMoniker_IsDirty(moniker);
3910 ok(hr == S_FALSE, "IMoniker_IsDirty should return S_FALSE, not 0x%08lx\n", hr);
3911
3912 /* Saving */
3913
3916
3917 hr = IMoniker_Save(moniker, stream, TRUE);
3918 ok(hr == E_NOTIMPL, "IMoniker_Save should have returned E_NOTIMPL instead of 0x%08lx\n", hr);
3919
3920 IStream_Release(stream);
3921
3922 /* Hashing */
3923 hr = IMoniker_Hash(moniker, &hash);
3924 ok_ole_success(hr, IMoniker_Hash);
3925 ok(hash == PtrToUlong(&factory.IClassFactory_iface), "Unexpected hash value %#lx.\n", hash);
3926
3927 /* IsSystemMoniker test */
3928 TEST_MONIKER_TYPE(moniker, MKSYS_POINTERMONIKER);
3929
3930 hr = IMoniker_Inverse(moniker, &inverse);
3931 ok(hr == S_OK, "Failed to get inverse, hr %#lx.\n", hr);
3932 TEST_MONIKER_TYPE(inverse, MKSYS_ANTIMONIKER);
3933 IMoniker_Release(inverse);
3934
3935 hr = CreateBindCtx(0, &bindctx);
3937
3938 /* IsRunning test */
3939 hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
3940 ok(hr == S_OK, "IMoniker_IsRunning should return S_OK, not 0x%08lx\n", hr);
3941
3942 hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
3943 ok(hr == E_NOTIMPL, "IMoniker_GetTimeOfLastChange should return E_NOTIMPL, not 0x%08lx\n", hr);
3944
3945 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
3946 ok_ole_success(hr, IMoniker_BindToObject);
3947 IUnknown_Release(unknown);
3948
3949 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
3950 ok_ole_success(hr, IMoniker_BindToStorage);
3951 IUnknown_Release(unknown);
3952
3953 IMoniker_Release(moniker);
3954
3955 ok(factory.refcount == 1, "Unexpected factory refcount %lu.\n", factory.refcount);
3956
3959
3960 hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
3961 ok(hr == E_UNEXPECTED, "IMoniker_BindToObject should have returned E_UNEXPECTED instead of 0x%08lx\n", hr);
3962
3963 hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
3964 ok(hr == E_UNEXPECTED, "IMoniker_BindToStorage should have returned E_UNEXPECTED instead of 0x%08lx\n", hr);
3965
3966 IBindCtx_Release(bindctx);
3967
3968 /* Enum() */
3969 hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
3970 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
3971
3972 hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
3973 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
3974
3975 IMoniker_Release(moniker);
3976
3977 /* CommonPrefixWith() */
3979 ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
3980
3982 ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
3983
3984 hr = IMoniker_IsEqual(moniker, NULL);
3985 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3986
3987 hr = IMoniker_IsEqual(moniker, moniker2);
3988 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
3989
3990 hr = IMoniker_CommonPrefixWith(moniker, moniker2, NULL);
3991 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3992
3993 hr = IMoniker_CommonPrefixWith(moniker, NULL, &prefix);
3994 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
3995
3996 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &prefix);
3997 ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
3998 ok(prefix == moniker, "Unexpected pointer.\n");
3999 IMoniker_Release(prefix);
4000
4001 IMoniker_Release(moniker2);
4002
4003 hr = CreatePointerMoniker((IUnknown *)moniker, &moniker2);
4004 ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
4005
4006 hr = IMoniker_IsEqual(moniker, moniker2);
4007 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
4008
4009 hr = IMoniker_CommonPrefixWith(moniker, moniker2, &prefix);
4010 ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
4011
4012 IMoniker_Release(moniker2);
4013
4014 /* ComposeWith() */
4015
4016 /* P + A -> () */
4017 anti = create_antimoniker(1);
4018 hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
4019 ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
4020 ok(!moniker2, "Unexpected pointer.\n");
4021 IMoniker_Release(anti);
4022
4023 /* P + A2 -> A */
4024 anti = create_antimoniker(2);
4025 hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
4026 ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
4027 TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
4028 IMoniker_Release(moniker2);
4029
4030 IMoniker_Release(anti);
4031
4032 /* Simplification has to through generic composite logic,
4033 even when resolved to non-composite, generic composite option has to be enabled. */
4034
4035 /* P + (A,A3) -> A3 */
4036 hr = create_moniker_from_desc("CA1A3", &c);
4037 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4038 hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2);
4039 ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
4040 hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2);
4041 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4042 TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
4043 hr = IMoniker_Hash(moniker2, &hash);
4044 ok(hr == S_OK, "Failed to get hash, hr %#lx.\n", hr);
4045 ok(hash == 0x80000003, "Unexpected hash.\n");
4046 IMoniker_Release(moniker2);
4047 IMoniker_Release(c);
4048
4049 /* P + (A,I) -> I */
4050 hr = create_moniker_from_desc("CA1I1", &c);
4051 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4052 hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2);
4053 ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
4054 hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2);
4055 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4056 TEST_MONIKER_TYPE(moniker2, MKSYS_ITEMMONIKER);
4057 IMoniker_Release(moniker2);
4058 IMoniker_Release(c);
4059
4060 /* RelativePathTo() */
4061 hr = create_moniker_from_desc("I1", &moniker3);
4062 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4063 hr = IMoniker_RelativePathTo(moniker, NULL, NULL);
4064 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
4065 moniker2 = (void *)0xdeadbeef;
4066 hr = IMoniker_RelativePathTo(moniker, NULL, &moniker2);
4067 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
4068 ok(!moniker2, "Unexpected pointer.\n");
4069 hr = IMoniker_RelativePathTo(moniker, moniker3, NULL);
4070 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
4071 moniker2 = (void *)0xdeadbeef;
4072 hr = IMoniker_RelativePathTo(moniker, moniker3, &moniker2);
4073 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
4074 ok(!moniker2, "Unexpected pointer.\n");
4075 IMoniker_Release(moniker3);
4076
4077 IMoniker_Release(moniker);
4078}

Referenced by START_TEST().

◆ test_ROT()

static void test_ROT ( void  )
static

Definition at line 892 of file moniker.c.

893{
894 static const WCHAR wszFileName[] = {'B','E','2','0','E','2','F','5','-',
895 '1','9','0','3','-','4','A','A','E','-','B','1','A','F','-',
896 '2','0','4','6','E','5','8','6','C','9','2','5',0};
897 HRESULT hr;
898 IMoniker *pMoniker = NULL, *moniker;
901 struct test_factory factory;
902 DWORD dwCookie;
903 static const char *methods_register_no_ROTData[] =
904 {
905 "Moniker_Reduce",
906 "Moniker_GetTimeOfLastChange",
907 "Moniker_QueryInterface(IID_IROTData)",
908 "Moniker_GetDisplayName",
909 "Moniker_GetClassID",
910 NULL
911 };
912 static const char *methods_register[] =
913 {
914 "Moniker_Reduce",
915 "Moniker_GetTimeOfLastChange",
916 "Moniker_QueryInterface(IID_IROTData)",
917 "ROTData_GetComparisonData",
918 NULL
919 };
920 static const char *methods_isrunning_no_ROTData[] =
921 {
922 "Moniker_Reduce",
923 "Moniker_QueryInterface(IID_IROTData)",
924 "Moniker_GetDisplayName",
925 "Moniker_GetClassID",
926 NULL
927 };
928 static const char *methods_isrunning[] =
929 {
930 "Moniker_Reduce",
931 "Moniker_QueryInterface(IID_IROTData)",
932 "ROTData_GetComparisonData",
933 NULL
934 };
935
937
938 hr = GetRunningObjectTable(0, &pROT);
940
943
944 expected_method_list = methods_register_no_ROTData;
945 /* try with our own moniker that doesn't support IROTData */
946 hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface,
947 &test_moniker->IMoniker_iface, &dwCookie);
948 ok(hr == S_OK, "Failed to register interface, hr %#lx.\n", hr);
949 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
950 ok(factory.external_connections == 1, "external_connections = %d\n", factory.external_connections);
951 ok(factory.refcount > 1, "Unexpected factory refcount %lu.\n", factory.refcount);
952
953 expected_method_list = methods_isrunning_no_ROTData;
954 hr = IRunningObjectTable_IsRunning(pROT, &test_moniker->IMoniker_iface);
955 ok_ole_success(hr, IRunningObjectTable_IsRunning);
956 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
957
958 hr = IRunningObjectTable_Revoke(pROT, dwCookie);
959 ok_ole_success(hr, IRunningObjectTable_Revoke);
960 ok(!factory.external_connections, "external_connections = %d\n", factory.external_connections);
961 ok(factory.refcount == 1, "Unexpected factory refcount %lu.\n", factory.refcount);
962
963 expected_method_list = methods_register;
964 /* try with our own moniker */
966 hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface,
967 &test_moniker->IMoniker_iface, &dwCookie);
968 ok_ole_success(hr, IRunningObjectTable_Register);
969 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
970 ok(factory.refcount > 1, "Unexpected factory refcount %lu.\n", factory.refcount);
971
972 expected_method_list = methods_isrunning;
973 hr = IRunningObjectTable_IsRunning(pROT, &test_moniker->IMoniker_iface);
974 ok_ole_success(hr, IRunningObjectTable_IsRunning);
975 ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
977
978 hr = IRunningObjectTable_Revoke(pROT, dwCookie);
979 ok_ole_success(hr, IRunningObjectTable_Revoke);
980 ok(factory.refcount == 1, "Unexpected factory refcount %lu.\n", factory.refcount);
981
982 hr = CreateFileMoniker(wszFileName, &pMoniker);
984
985 /* test flags: 0 */
986 factory.external_connections = 0;
987 hr = IRunningObjectTable_Register(pROT, 0, (IUnknown *)&factory.IClassFactory_iface, pMoniker, &dwCookie);
988 ok_ole_success(hr, IRunningObjectTable_Register);
989 ok(!factory.external_connections, "external_connections = %d\n", factory.external_connections);
990 ok(factory.refcount > 1, "Unexpected factory refcount %lu.\n", factory.refcount);
991
992 hr = IRunningObjectTable_Revoke(pROT, dwCookie);
993 ok_ole_success(hr, IRunningObjectTable_Revoke);
994 ok(factory.refcount == 1, "Unexpected factory refcount %lu.\n", factory.refcount);
995
996 /* test flags: ROTFLAGS_REGISTRATIONKEEPSALIVE */
997 hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface,
998 pMoniker, &dwCookie);
999 ok_ole_success(hr, IRunningObjectTable_Register);
1000 ok(factory.refcount > 1, "Unexpected factory refcount %lu.\n", factory.refcount);
1001
1002 hr = IRunningObjectTable_Revoke(pROT, dwCookie);
1003 ok_ole_success(hr, IRunningObjectTable_Revoke);
1004 ok(factory.refcount == 1, "Unexpected factory refcount %lu.\n", factory.refcount);
1005
1006 /* test flags: ROTFLAGS_REGISTRATIONKEEPSALIVE|ROTFLAGS_ALLOWANYCLIENT */
1007 /* only succeeds when process is started by SCM and has LocalService
1008 * or RunAs AppId values */
1009 hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE | ROTFLAGS_ALLOWANYCLIENT,
1010 (IUnknown *)&factory.IClassFactory_iface, pMoniker, &dwCookie);
1011 todo_wine {
1012 ok(hr == CO_E_WRONG_SERVER_IDENTITY, "Unexpected hr %#lx.\n", hr);
1013 }
1014 if (SUCCEEDED(hr))
1015 {
1016 hr = IRunningObjectTable_Revoke(pROT, dwCookie);
1017 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1018 }
1019
1020 hr = IRunningObjectTable_Register(pROT, 0xdeadbeef, (IUnknown *)&factory.IClassFactory_iface, pMoniker, &dwCookie);
1021 ok(hr == E_INVALIDARG, "IRunningObjectTable_Register should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1022
1023 IMoniker_Release(pMoniker);
1024 IMoniker_Release(&test_moniker->IMoniker_iface);
1025
1026 /* Pointer moniker does not implement IROTData or display name */
1027 hr = CreatePointerMoniker(NULL, &pMoniker);
1028 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1029 hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface,
1030 pMoniker, &dwCookie);
1031 todo_wine
1032 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
1033 IMoniker_Release(pMoniker);
1034
1036 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1037 hr = CreatePointerMoniker((IUnknown *)moniker, &pMoniker);
1038 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1039 hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface,
1040 pMoniker, &dwCookie);
1041 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
1042 IMoniker_Release(pMoniker);
1043 IMoniker_Release(moniker);
1044
1045 IRunningObjectTable_Release(pROT);
1046}
static WCHAR wszFileName[MAX_PATH]
Definition: wordpad.c:71
HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker **moniker)
Definition: classmoniker.c:627
BOOL no_IROTData
Definition: moniker.c:427
#define CO_E_WRONG_SERVER_IDENTITY
Definition: winerror.h:3498

Referenced by START_TEST().

◆ test_ROT_multiple_entries()

static void test_ROT_multiple_entries ( void  )
static

Definition at line 1048 of file moniker.c.

1049{
1050 HRESULT hr;
1051 IMoniker *pMoniker = NULL;
1052 IRunningObjectTable *pROT = NULL;
1053 DWORD dwCookie1, dwCookie2;
1055 static const WCHAR moniker_path[] =
1056 {'\\', 'w','i','n','d','o','w','s','\\','s','y','s','t','e','m','\\','t','e','s','t','1','.','d','o','c',0};
1057 struct test_factory factory;
1058
1060
1061 hr = GetRunningObjectTable(0, &pROT);
1063
1064 hr = CreateFileMoniker(moniker_path, &pMoniker);
1066
1067 hr = IRunningObjectTable_Register(pROT, 0, (IUnknown *)&factory.IClassFactory_iface, pMoniker, &dwCookie1);
1068 ok_ole_success(hr, IRunningObjectTable_Register);
1069
1070 hr = IRunningObjectTable_Register(pROT, 0, (IUnknown *)&factory.IClassFactory_iface, pMoniker, &dwCookie2);
1071 ok(hr == MK_S_MONIKERALREADYREGISTERED, "IRunningObjectTable_Register should have returned MK_S_MONIKERALREADYREGISTERED instead of 0x%08lx\n", hr);
1072
1073 ok(dwCookie1 != dwCookie2, "cookie returned for registering duplicate object shouldn't match cookie of original object (0x%lx)\n", dwCookie1);
1074
1075 hr = IRunningObjectTable_GetObject(pROT, pMoniker, &pObject);
1076 ok_ole_success(hr, IRunningObjectTable_GetObject);
1077 IUnknown_Release(pObject);
1078
1079 hr = IRunningObjectTable_Revoke(pROT, dwCookie1);
1080 ok_ole_success(hr, IRunningObjectTable_Revoke);
1081
1082 hr = IRunningObjectTable_GetObject(pROT, pMoniker, &pObject);
1083 ok_ole_success(hr, IRunningObjectTable_GetObject);
1084 IUnknown_Release(pObject);
1085
1086 hr = IRunningObjectTable_Revoke(pROT, dwCookie2);
1087 ok_ole_success(hr, IRunningObjectTable_Revoke);
1088
1089 IMoniker_Release(pMoniker);
1090
1091 IRunningObjectTable_Release(pROT);
1092}
FxObject * pObject
#define MK_S_MONIKERALREADYREGISTERED
Definition: winerror.h:3901

Referenced by START_TEST().

◆ test_save_load_filemoniker()

static void test_save_load_filemoniker ( void  )
static

Definition at line 4441 of file moniker.c.

4442{
4443 IMoniker* pMk;
4444 IStream* pStm;
4445 HRESULT hr;
4447 LARGE_INTEGER zero_pos, dead_pos, nulls_pos;
4448 DWORD some_val = 0xFEDCBA98;
4449 int i;
4450
4451 /* see FileMonikerImpl_Save docs */
4452 zero_pos.QuadPart = 0;
4453 dead_pos.QuadPart = sizeof(WORD) + sizeof(DWORD) + (lstrlenW(wszFileName1) + 1) + sizeof(WORD);
4454 nulls_pos.QuadPart = dead_pos.QuadPart + sizeof(WORD);
4455
4456 /* create the stream we're going to write to */
4457 hr = CreateStreamOnHGlobal(NULL, TRUE, &pStm);
4458 ok_ole_success(hr, "CreateStreamOnHGlobal");
4459
4460 size.u.LowPart = 128;
4461 hr = IStream_SetSize(pStm, size);
4462 ok_ole_success(hr, "IStream_SetSize");
4463
4464 /* create and save a moniker */
4466 ok_ole_success(hr, "CreateFileMoniker");
4467
4468 hr = IMoniker_Save(pMk, pStm, TRUE);
4469 ok_ole_success(hr, "IMoniker_Save");
4470 IMoniker_Release(pMk);
4471
4472 /* overwrite the constants with various values */
4473 hr = IStream_Seek(pStm, zero_pos, STREAM_SEEK_SET, NULL);
4474 ok_ole_success(hr, "IStream_Seek");
4475 hr = IStream_Write(pStm, &some_val, sizeof(WORD), NULL);
4476 ok_ole_success(hr, "IStream_Write");
4477
4478 hr = IStream_Seek(pStm, dead_pos, STREAM_SEEK_SET, NULL);
4479 ok_ole_success(hr, "IStream_Seek");
4480 hr = IStream_Write(pStm, &some_val, sizeof(WORD), NULL);
4481 ok_ole_success(hr, "IStream_Write");
4482
4483 hr = IStream_Seek(pStm, nulls_pos, STREAM_SEEK_SET, NULL);
4484 ok_ole_success(hr, "IStream_Seek");
4485 for(i = 0; i < 5; ++i){
4486 hr = IStream_Write(pStm, &some_val, sizeof(DWORD), NULL);
4487 ok_ole_success(hr, "IStream_Write");
4488 }
4489
4490 /* go back to the start of the stream */
4491 hr = IStream_Seek(pStm, zero_pos, STREAM_SEEK_SET, NULL);
4492 ok_ole_success(hr, "IStream_Seek");
4493
4494 /* create a new moniker and load into it */
4496 ok_ole_success(hr, "CreateFileMoniker");
4497
4498 hr = IMoniker_Load(pMk, pStm);
4499 ok_ole_success(hr, "IMoniker_Load");
4500
4501 IMoniker_Release(pMk);
4502 IStream_Release(pStm);
4503}
unsigned short WORD
Definition: ntddk_ex.h:93
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by START_TEST().

Variable Documentation

◆ CLSID_TestMoniker

const CLSID CLSID_TestMoniker
static
Initial value:
=
{
0xb306bfbc,
0x496e,
0x4f53,
{0xb9, 0x3e, 0x2f, 0xf9, 0xc8, 0x32, 0x23, 0xd7}
}

Definition at line 73 of file moniker.c.

Referenced by Moniker_GetClassID().

◆ expected_anti_moniker_comparison_data

const BYTE expected_anti_moniker_comparison_data[]
static
Initial value:
=
{
0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x01,0x00,0x00,0x00,
}

Definition at line 1641 of file moniker.c.

Referenced by test_anti_moniker().

◆ expected_anti_moniker_comparison_data2

const BYTE expected_anti_moniker_comparison_data2[]
static
Initial value:
=
{
0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x02,0x00,0x00,0x00,
}

Definition at line 1648 of file moniker.c.

Referenced by test_anti_moniker().

◆ expected_anti_moniker_marshal_data

const BYTE expected_anti_moniker_marshal_data[]
static
Initial value:
=
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,
}

Definition at line 1609 of file moniker.c.

Referenced by test_anti_moniker().

◆ expected_anti_moniker_marshal_data2

const BYTE expected_anti_moniker_marshal_data2[]
static
Initial value:
=
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,
}

Definition at line 1620 of file moniker.c.

Referenced by test_anti_moniker().

◆ expected_anti_moniker_saved_data

const BYTE expected_anti_moniker_saved_data[]
static
Initial value:
=
{
0x01,0x00,0x00,0x00,
}

Definition at line 1631 of file moniker.c.

Referenced by test_anti_moniker().

◆ expected_anti_moniker_saved_data2

const BYTE expected_anti_moniker_saved_data2[]
static
Initial value:
=
{
0x02,0x00,0x00,0x00,
}

Definition at line 1636 of file moniker.c.

Referenced by test_anti_moniker().

◆ expected_class_moniker_comparison_data

const BYTE expected_class_moniker_comparison_data[]
static
Initial value:
=
{
0x1a,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x05,0xe0,0x02,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
}

Definition at line 1447 of file moniker.c.

Referenced by test_class_moniker().

◆ expected_class_moniker_display_name

const WCHAR expected_class_moniker_display_name[]
static
Initial value:
=
{
'c','l','s','i','d',':','0','0','0','2','E','0','0','5','-','0','0','0',
'0','-','0','0','0','0','-','C','0','0','0','-','0','0','0','0','0','0',
'0','0','0','0','4','6',':',0
}

Definition at line 1455 of file moniker.c.

Referenced by test_class_moniker().

◆ expected_class_moniker_marshal_data

const BYTE expected_class_moniker_marshal_data[]
static
Initial value:
=
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x1a,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
0x05,0xe0,0x02,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,
}

Definition at line 1427 of file moniker.c.

Referenced by test_class_moniker().

◆ expected_class_moniker_saved_data

const BYTE expected_class_moniker_saved_data[]
static
Initial value:
=
{
0x05,0xe0,0x02,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,
}

Definition at line 1440 of file moniker.c.

Referenced by test_class_moniker().

◆ expected_display_name

LPCWSTR expected_display_name
static

◆ expected_gc_moniker_comparison_data

const BYTE expected_gc_moniker_comparison_data[]
static
Initial value:
=
{
0x09,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
'!',0x00, 'T',0x00, 'E',0x00, 'S',0x00,
'T',0x00,0x00,0x00,0x04,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,
0x00,0x00,0x00,0x46, '#',0x00, 'W',0x00,
'I',0x00, 'N',0x00, 'E',0x00,0x00,0x00,
}

Definition at line 1694 of file moniker.c.

Referenced by test_generic_composite_moniker().

◆ expected_gc_moniker_marshal_data

const BYTE expected_gc_moniker_marshal_data[]
static
Initial value:
=
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x09,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x2c,0x01,0x00,0x00,
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,0x21,0x00,0x05,0x00,
0x00,0x00,0x54,0x65,0x73,0x74,0x00,0x4d,
0x45,0x4f,0x57,0x04,0x00,0x00,0x00,0x0f,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,
0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x04,
0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,
0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x00,
0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x02,
0x00,0x00,0x00,0x23,0x00,0x05,0x00,0x00,
0x00,0x57,0x69,0x6e,0x65,0x00,
}

Definition at line 1655 of file moniker.c.

Referenced by test_generic_composite_moniker().

◆ expected_gc_moniker_saved_data

const BYTE expected_gc_moniker_saved_data[]
static
Initial value:
=
{
0x02,0x00,0x00,0x00,0x04,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,
0x00,0x00,0x00,0x46,0x02,0x00,0x00,0x00,
0x21,0x00,0x05,0x00,0x00,0x00,0x54,0x65,
0x73,0x74,0x00,0x04,0x03,0x00,0x00,0x00,
0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,
0x00,0x00,0x46,0x02,0x00,0x00,0x00,0x23,
0x00,0x05,0x00,0x00,0x00,0x57,0x69,0x6e,
0x65,0x00,
}

Definition at line 1681 of file moniker.c.

Referenced by test_generic_composite_moniker().

◆ expected_item_moniker_comparison_data

const BYTE expected_item_moniker_comparison_data[]
static
Initial value:
=
{
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
'!',0x00, 'T',0x00, 'E',0x00, 'S',0x00,
'T',0x00,0x00,0x00,
}

Definition at line 1462 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_comparison_data2

const BYTE expected_item_moniker_comparison_data2[]
static
Initial value:
=
{
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
'T',0x00, 'E',0x00, 'S',0x00, 'T',0x00,
0x00,0x00,
}

Definition at line 1470 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_comparison_data4

const BYTE expected_item_moniker_comparison_data4[]
static
Initial value:
=
{
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
'&',0x00, '&',0x00, 'T',0x00, 'E',0x00,
'S',0x00, 'T',0x00,0x00,0x00,
}

Definition at line 1478 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_comparison_data5

const BYTE expected_item_moniker_comparison_data5[]
static
Initial value:
=
{
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
'A',0x00, 'B',0x00, 'T',0x00, 'E',0x00,
'S',0x00, 'T',0x00,0x00,0x00,
}

Definition at line 1486 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_comparison_data6

const BYTE expected_item_moniker_comparison_data6[]
static
Initial value:
=
{
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,
}

Definition at line 1494 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_marshal_data

const BYTE expected_item_moniker_marshal_data[]
static
Initial value:
=
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,
0x02,0x00,0x00,0x00, '!',0x00,0x05,0x00,
0x00,0x00, 'T', 'e', 's', 't',0x00,
}

Definition at line 1537 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_marshal_data2

const BYTE expected_item_moniker_marshal_data2[]
static
Initial value:
=
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x2e,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
'T', 'e', 's', 't',0x00,
}

Definition at line 1549 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_marshal_data3

const BYTE expected_item_moniker_marshal_data3[]
static
Initial value:
=
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x05,0x00,0x00,
0x00, 'T', 'e', 's', 't',0x00,
}

Definition at line 1561 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_marshal_data4

const BYTE expected_item_moniker_marshal_data4[]
static
Initial value:
=
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x3a,0x00,0x00,0x00,
0x03,0x00,0x00,0x00, '&', '&',0x00,0x05,
0x00,0x00,0x00, 'T', 'e', 's', 't',0x00,
}

Definition at line 1573 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_marshal_data5

const BYTE expected_item_moniker_marshal_data5[]
static
Initial value:
=
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x3a,0x00,0x00,0x00,
0x03,0x00,0x00,0x00, 'a', 'b',0x00,0x05,
0x00,0x00,0x00, 'T', 'e', 's', 't',0x00,
}

Definition at line 1585 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_marshal_data6

const BYTE expected_item_moniker_marshal_data6[]
static
Initial value:
=
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x22,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,
0x00,0x00,
}

Definition at line 1597 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_saved_data

const BYTE expected_item_moniker_saved_data[]
static
Initial value:
=
{
0x02,0x00,0x00,0x00, '!',0x00,0x05,0x00,
0x00,0x00, 'T', 'e', 's', 't',0x00,
}

Definition at line 1501 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_saved_data2

const BYTE expected_item_moniker_saved_data2[]
static
Initial value:
=
{
0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
'T', 'e', 's', 't',0x00,
}

Definition at line 1507 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_saved_data3

const BYTE expected_item_moniker_saved_data3[]
static
Initial value:
=
{
0x01,0x00,0x00,0x00,0x00,0x05,0x00,0x00,
0x00,'T', 'e', 's', 't',0x00,
}

Definition at line 1513 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_saved_data4

const BYTE expected_item_moniker_saved_data4[]
static
Initial value:
=
{
0x03,0x00,0x00,0x00, '&', '&',0x00,0x05,
0x00,0x00,0x00, 'T', 'e', 's', 't',0x00,
}

Definition at line 1519 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_saved_data5

const BYTE expected_item_moniker_saved_data5[]
static
Initial value:
=
{
0x03,0x00,0x00,0x00, 'a', 'b',0x00,0x05,
0x00,0x00,0x00, 'T', 'e', 's', 't',0x00,
}

Definition at line 1525 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_item_moniker_saved_data6

const BYTE expected_item_moniker_saved_data6[]
static
Initial value:
=
{
0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,
0x00,0x00,
}

Definition at line 1531 of file moniker.c.

Referenced by test_item_moniker().

◆ expected_method_list

char const* const* expected_method_list
static

Definition at line 55 of file moniker.c.

Referenced by check_expected_method_(), test_item_moniker(), and test_ROT().

◆ ExternalConnectionVtbl

const IExternalConnectionVtbl ExternalConnectionVtbl
static
Initial value:
= {
}
static ULONG WINAPI ExternalConnection_Release(IExternalConnection *iface)
Definition: moniker.c:278
static DWORD WINAPI ExternalConnection_ReleaseConnection(IExternalConnection *iface, DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses)
Definition: moniker.c:292
static ULONG WINAPI ExternalConnection_AddRef(IExternalConnection *iface)
Definition: moniker.c:272
static HRESULT WINAPI ExternalConnection_QueryInterface(IExternalConnection *iface, REFIID riid, void **ppv)
Definition: moniker.c:265
static DWORD WINAPI ExternalConnection_AddConnection(IExternalConnection *iface, DWORD extconn, DWORD reserved)
Definition: moniker.c:284

Definition at line 301 of file moniker.c.

Referenced by test_factory_init().

◆ HeapUnknown_Vtbl

const IUnknownVtbl HeapUnknown_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI HeapUnknown_AddRef(IUnknown *iface)
Definition: moniker.c:397
static ULONG WINAPI HeapUnknown_Release(IUnknown *iface)
Definition: moniker.c:403
static HRESULT WINAPI HeapUnknown_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: moniker.c:385

Definition at line 411 of file moniker.c.

Referenced by test_bind_context().

◆ llZero

◆ MonikerVtbl

const IMonikerVtbl MonikerVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
Definition: moniker.c:624
static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
Definition: moniker.c:687
static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
Definition: moniker.c:656
static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
Definition: moniker.c:754
static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
Definition: moniker.c:731
static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pwdMksys)
Definition: moniker.c:795
static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight, BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite)
Definition: moniker.c:703
static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, void **obj)
Definition: moniker.c:662
static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
Definition: moniker.c:642
static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pFileTime)
Definition: moniker.c:746
static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
Definition: moniker.c:776
static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
Definition: moniker.c:724
static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
Definition: moniker.c:649
static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppvObject)
Definition: moniker.c:575
static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, VOID **ppvObject)
Definition: moniker.c:679
static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
Definition: moniker.c:634
static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmOther, IMoniker **ppmkRelPath)
Definition: moniker.c:769
static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
Definition: moniker.c:738
static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther, IMoniker **ppmkPrefix)
Definition: moniker.c:762
static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
Definition: moniker.c:605
static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker)
Definition: moniker.c:711
static ULONG WINAPI Moniker_Release(IMoniker *iface)
Definition: moniker.c:612
static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
Definition: moniker.c:787

Definition at line 851 of file moniker.c.

Referenced by create_test_moniker().

◆ ParseDisplayName

IParseDisplayName ParseDisplayName = { &ParseDisplayName_Vtbl }
static

◆ ParseDisplayName_Vtbl

const IParseDisplayNameVtbl ParseDisplayName_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI ParseDisplayName_ParseDisplayName(IParseDisplayName *iface, IBindCtx *pbc, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
Definition: moniker.c:1119
static ULONG WINAPI ParseDisplayName_Release(IParseDisplayName *iface)
Definition: moniker.c:1112
static HRESULT WINAPI ParseDisplayName_QueryInterface(IParseDisplayName *iface, REFIID riid, void **ppv)
Definition: moniker.c:1094
static ULONG WINAPI ParseDisplayName_AddRef(IParseDisplayName *iface)
Definition: moniker.c:1107

Definition at line 1133 of file moniker.c.

◆ pm_obj

IUnknown pm_obj = { &pointer_moniker_obj_vtbl }
static

Definition at line 178 of file moniker.c.

Referenced by create_moniker_parse_desc().

◆ pointer_moniker_obj_vtbl

const IUnknownVtbl pointer_moniker_obj_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI pointer_moniker_obj_Release(IUnknown *iface)
Definition: moniker.c:166
static HRESULT WINAPI pointer_moniker_obj_QueryInterface(IUnknown *iface, REFIID riid, void **obj)
Definition: moniker.c:148
static ULONG WINAPI pointer_moniker_obj_AddRef(IUnknown *iface)
Definition: moniker.c:161

Definition at line 171 of file moniker.c.

◆ ROTDataVtbl

IROTDataVtbl ROTDataVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI ROTData_GetComparisonData(IROTData *iface, BYTE *pbData, ULONG cbMax, ULONG *pcbData)
Definition: moniker.c:829
static ULONG WINAPI ROTData_Release(IROTData *iface)
Definition: moniker.c:822
static HRESULT WINAPI ROTData_QueryInterface(IROTData *iface, REFIID riid, VOID **ppvObject)
Definition: moniker.c:808
static ULONG WINAPI ROTData_AddRef(IROTData *iface)
Definition: moniker.c:815

Definition at line 843 of file moniker.c.

Referenced by create_test_moniker().

◆ test_factory_vtbl

const IClassFactoryVtbl test_factory_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI test_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
Definition: moniker.c:346
static ULONG WINAPI test_factory_Release(IClassFactory *iface)
Definition: moniker.c:340
static ULONG WINAPI test_factory_AddRef(IClassFactory *iface)
Definition: moniker.c:334
static HRESULT WINAPI test_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
Definition: moniker.c:309
static HRESULT WINAPI test_factory_LockServer(IClassFactory *iface, BOOL lock)
Definition: moniker.c:352

Definition at line 357 of file moniker.c.

Referenced by test_factory_init().

◆ test_item_container_vtbl

const IOleItemContainerVtbl test_item_container_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI test_item_container_GetObject(IOleItemContainer *iface, LPOLESTR item, DWORD bind_speed, IBindCtx *pbc, REFIID riid, void **obj)
Definition: moniker.c:535
static HRESULT WINAPI test_item_container_GetObjectStorage(IOleItemContainer *iface, LPOLESTR item, IBindCtx *pbc, REFIID riid, void **obj)
Definition: moniker.c:549
static HRESULT WINAPI test_item_container_ParseDisplayName(IOleItemContainer *iface, IBindCtx *pbc, LPOLESTR displayname, ULONG *eaten, IMoniker **out)
Definition: moniker.c:518
static ULONG WINAPI test_item_container_Release(IOleItemContainer *iface)
Definition: moniker.c:512
static HRESULT WINAPI test_item_container_QueryInterface(IOleItemContainer *iface, REFIID riid, void **obj)
Definition: moniker.c:490
static HRESULT WINAPI test_item_container_EnumObjects(IOleItemContainer *iface, DWORD flags, IEnumUnknown **ppenum)
Definition: moniker.c:524
static HRESULT WINAPI test_item_container_LockContainer(IOleItemContainer *iface, BOOL lock)
Definition: moniker.c:530
static HRESULT WINAPI test_item_container_IsRunning(IOleItemContainer *iface, LPOLESTR item)
Definition: moniker.c:555
static ULONG WINAPI test_item_container_AddRef(IOleItemContainer *iface)
Definition: moniker.c:506

Definition at line 561 of file moniker.c.

Referenced by create_test_moniker().

◆ test_moniker_parse_vtbl

const IParseDisplayNameVtbl test_moniker_parse_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI test_moniker_parse_AddRef(IParseDisplayName *iface)
Definition: moniker.c:464
static ULONG WINAPI test_moniker_parse_Release(IParseDisplayName *iface)
Definition: moniker.c:470
static HRESULT WINAPI test_moniker_parse_ParseDisplayName(IParseDisplayName *iface, IBindCtx *pbc, LPOLESTR displayname, ULONG *eaten, IMoniker **out)
Definition: moniker.c:476
static HRESULT WINAPI test_moniker_parse_QueryInterface(IParseDisplayName *iface, REFIID riid, void **obj)
Definition: moniker.c:450

Definition at line 482 of file moniker.c.

Referenced by create_test_moniker().

◆ wszFileName1

const WCHAR wszFileName1[] = {'c',':','\\','w','i','n','d','o','w','s','\\','t','e','s','t','1','.','d','o','c',0}
static

◆ wszFileName2

const WCHAR wszFileName2[] = {'c',':','\\','w','i','n','d','o','w','s','\\','t','e','s','t','2','.','d','o','c',0}
static

Definition at line 71 of file moniker.c.

Referenced by count_moniker_matches(), and test_MkParseDisplayName().