ReactOS 0.4.16-dev-2354-g16de117
moniker.c File Reference
#include <stdarg.h>
#include <string.h>
#include "wine/list.h"
#include "wine/debug.h"
#include "compobj_private.h"
#include "moniker.h"
#include "irot.h"
#include "pathcch.h"
Include dependency graph for moniker.c:

Go to the source code of this file.

Classes

struct  rot_entry
 
struct  RunningObjectTableImpl
 
struct  EnumMonikerImpl
 
struct  MonikerMarshal
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct RunningObjectTableImpl RunningObjectTableImpl
 
typedef struct EnumMonikerImpl EnumMonikerImpl
 
typedef struct MonikerMarshal MonikerMarshal
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
BOOL WINAPI InternalIsProcessInitialized (void)
 
HRESULT WINAPI InternalIrotRegister (const MonikerComparisonData *moniker_data, const InterfaceData *object, const InterfaceData *moniker, const FILETIME *time, DWORD flags, IrotCookie *cookie, IrotContextHandle *ctxt_handle)
 
HRESULT WINAPI InternalIrotIsRunning (const MonikerComparisonData *moniker_data)
 
HRESULT WINAPI InternalIrotGetObject (const MonikerComparisonData *moniker_data, PInterfaceData *obj, IrotCookie *cookie)
 
HRESULT WINAPI InternalIrotNoteChangeTime (IrotCookie cookie, const FILETIME *time)
 
HRESULT WINAPI InternalIrotGetTimeOfLastChange (const MonikerComparisonData *moniker_data, FILETIME *time)
 
HRESULT WINAPI InternalIrotEnumRunning (PInterfaceList *list)
 
HRESULT WINAPI InternalIrotRevoke (IrotCookie cookie, IrotContextHandle *ctxt_handle, PInterfaceData *object, PInterfaceData *moniker)
 
static RunningObjectTableImplimpl_from_IRunningObjectTable (IRunningObjectTable *iface)
 
static EnumMonikerImplimpl_from_IEnumMoniker (IEnumMoniker *iface)
 
static HRESULT EnumMonikerImpl_CreateEnumROTMoniker (InterfaceList *moniker_list, ULONG pos, IEnumMoniker **ppenumMoniker)
 
static HRESULT create_stream_on_mip_ro (const InterfaceData *mip, IStream **stream)
 
static void rot_entry_delete (struct rot_entry *rot_entry)
 
static HRESULT get_moniker_comparison_data (IMoniker *pMoniker, MonikerComparisonData **moniker_data)
 
static HRESULT reduce_moniker (IMoniker *pmk, IBindCtx *pbc, IMoniker **pmkReduced)
 
static HRESULT WINAPI RunningObjectTableImpl_QueryInterface (IRunningObjectTable *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI RunningObjectTableImpl_AddRef (IRunningObjectTable *iface)
 
static ULONG WINAPI RunningObjectTableImpl_Release (IRunningObjectTable *iface)
 
static HRESULT WINAPI RunningObjectTableImpl_Register (IRunningObjectTable *iface, DWORD flags, IUnknown *punkObject, IMoniker *pmkObjectName, DWORD *pdwRegister)
 
static HRESULT WINAPI RunningObjectTableImpl_Revoke (IRunningObjectTable *iface, DWORD dwRegister)
 
static HRESULT WINAPI RunningObjectTableImpl_IsRunning (IRunningObjectTable *iface, IMoniker *pmkObjectName)
 
static HRESULT WINAPI RunningObjectTableImpl_GetObject (IRunningObjectTable *iface, IMoniker *pmkObjectName, IUnknown **ppunkObject)
 
static HRESULT WINAPI RunningObjectTableImpl_NoteChangeTime (IRunningObjectTable *iface, DWORD dwRegister, FILETIME *pfiletime)
 
static HRESULT WINAPI RunningObjectTableImpl_GetTimeOfLastChange (IRunningObjectTable *iface, IMoniker *pmkObjectName, FILETIME *pfiletime)
 
static HRESULT WINAPI RunningObjectTableImpl_EnumRunning (IRunningObjectTable *iface, IEnumMoniker **ppenumMoniker)
 
HRESULT WINAPI GetRunningObjectTable (DWORD reserved, IRunningObjectTable **ret)
 
void WINAPI DestroyRunningObjectTable (void)
 
static HRESULT get_moniker_for_progid_display_name (LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
 
HRESULT WINAPI MkParseDisplayName (LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
 
HRESULT WINAPI GetClassFile (LPCOLESTR filePathName, CLSID *pclsid)
 
static HRESULT WINAPI EnumMonikerImpl_QueryInterface (IEnumMoniker *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI EnumMonikerImpl_AddRef (IEnumMoniker *iface)
 
static ULONG WINAPI EnumMonikerImpl_Release (IEnumMoniker *iface)
 
static HRESULT WINAPI EnumMonikerImpl_Next (IEnumMoniker *iface, ULONG celt, IMoniker **rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI EnumMonikerImpl_Skip (IEnumMoniker *iface, ULONG celt)
 
static HRESULT WINAPI EnumMonikerImpl_Reset (IEnumMoniker *iface)
 
static HRESULT WINAPI EnumMonikerImpl_Clone (IEnumMoniker *iface, IEnumMoniker **ppenum)
 
static MonikerMarshalimpl_from_IUnknown (IUnknown *iface)
 
static MonikerMarshalimpl_from_IMarshal (IMarshal *iface)
 
static HRESULT WINAPI MonikerMarshalInner_QueryInterface (IUnknown *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI MonikerMarshalInner_AddRef (IUnknown *iface)
 
static ULONG WINAPI MonikerMarshalInner_Release (IUnknown *iface)
 
static HRESULT WINAPI MonikerMarshal_QueryInterface (IMarshal *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI MonikerMarshal_AddRef (IMarshal *iface)
 
static ULONG WINAPI MonikerMarshal_Release (IMarshal *iface)
 
static HRESULT WINAPI MonikerMarshal_GetUnmarshalClass (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
 
static HRESULT WINAPI MonikerMarshal_GetMarshalSizeMax (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
 
static HRESULT WINAPI MonikerMarshal_MarshalInterface (LPMARSHAL iface, IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags)
 
static HRESULT WINAPI MonikerMarshal_UnmarshalInterface (LPMARSHAL iface, IStream *pStm, REFIID riid, void **ppv)
 
static HRESULT WINAPI MonikerMarshal_ReleaseMarshalData (LPMARSHAL iface, IStream *pStm)
 
static HRESULT WINAPI MonikerMarshal_DisconnectObject (LPMARSHAL iface, DWORD dwReserved)
 
HRESULT MonikerMarshal_Create (IMoniker *inner, IUnknown **outer)
 
void *__RPC_USER MIDL_user_allocate (SIZE_T size)
 
void __RPC_USER MIDL_user_free (void *p)
 

Variables

static const IRunningObjectTableVtbl VT_RunningObjectTableImpl
 
static RunningObjectTableImpl rot
 
static RTL_CRITICAL_SECTION_DEBUG critsect_debug
 
static const IEnumMonikerVtbl VT_EnumMonikerImpl
 
static const IUnknownVtbl VT_MonikerMarshalInner
 
static const IMarshalVtbl VT_MonikerMarshal
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 27 of file moniker.c.

Typedef Documentation

◆ EnumMonikerImpl

◆ MonikerMarshal

◆ RunningObjectTableImpl

Function Documentation

◆ create_stream_on_mip_ro()

static HRESULT create_stream_on_mip_ro ( const InterfaceData *  mip,
IStream **  stream 
)
static

Definition at line 96 of file moniker.c.

97{
98 HGLOBAL hglobal = GlobalAlloc(0, mip->ulCntData);
99 void *pv = GlobalLock(hglobal);
100 memcpy(pv, mip->abData, mip->ulCntData);
101 GlobalUnlock(hglobal);
102 return CreateStreamOnHGlobal(hglobal, TRUE, stream);
103}
#define TRUE
Definition: types.h:120
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: parse.h:23

Referenced by EnumMonikerImpl_Next(), rot_entry_delete(), and RunningObjectTableImpl_GetObject().

◆ DestroyRunningObjectTable()

void WINAPI DestroyRunningObjectTable ( void  )

Definition at line 748 of file moniker.c.

749{
750 struct rot_entry *rot_entry, *cursor2;
751
752 TRACE("\n");
753
756 {
759 }
761}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void rot_entry_delete(struct rot_entry *rot_entry)
Definition: moniker.c:105
static RunningObjectTableImpl rot
Definition: moniker.c:710
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
#define TRACE(s)
Definition: solgame.cpp:4
struct list rot
Definition: moniker.c:68
CRITICAL_SECTION lock
Definition: moniker.c:69
Definition: irotp.c:37
struct list entry
Definition: irotp.c:38
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by CoUninitialize().

◆ EnumMonikerImpl_AddRef()

static ULONG WINAPI EnumMonikerImpl_AddRef ( IEnumMoniker iface)
static

Definition at line 1017 of file moniker.c.

1018{
1020
1021 TRACE("(%p)\n",This);
1022
1023 return InterlockedIncrement(&This->ref);
1024}
#define InterlockedIncrement
Definition: armddk.h:53
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)
Definition: moniker.c:87

◆ EnumMonikerImpl_Clone()

static HRESULT WINAPI EnumMonikerImpl_Clone ( IEnumMoniker iface,
IEnumMoniker **  ppenum 
)
static

Definition at line 1122 of file moniker.c.

1123{
1125 InterfaceList *moniker_list;
1126 ULONG i;
1127
1128 TRACE("(%p)\n",This);
1129
1130 *ppenum = NULL;
1131
1132 moniker_list = malloc(FIELD_OFFSET(InterfaceList, interfaces[This->moniker_list->size]));
1133 if (!moniker_list)
1134 return E_OUTOFMEMORY;
1135
1136 moniker_list->size = This->moniker_list->size;
1137 for (i = 0; i < This->moniker_list->size; i++)
1138 {
1139 SIZE_T size = FIELD_OFFSET(InterfaceData, abData[This->moniker_list->interfaces[i]->ulCntData]);
1140 moniker_list->interfaces[i] = malloc(size);
1141 if (!moniker_list->interfaces[i])
1142 {
1143 ULONG end = i;
1144 for (i = 0; i < end; i++)
1145 free(moniker_list->interfaces[i]);
1146 free(moniker_list);
1147 return E_OUTOFMEMORY;
1148 }
1149 memcpy(moniker_list->interfaces[i], This->moniker_list->interfaces[i], size);
1150 }
1151
1152 /* copy the enum structure */
1153 return EnumMonikerImpl_CreateEnumROTMoniker(moniker_list, This->pos, ppenum);
1154}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
static HRESULT EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list, ULONG pos, IEnumMoniker **ppenumMoniker)
Definition: moniker.c:1173
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
_In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceList
Definition: usbdlib.h:181

◆ EnumMonikerImpl_CreateEnumROTMoniker()

static HRESULT EnumMonikerImpl_CreateEnumROTMoniker ( InterfaceList moniker_list,
ULONG  pos,
IEnumMoniker **  ppenumMoniker 
)
static

Definition at line 1173 of file moniker.c.

1176{
1178
1179 if (!ppenumMoniker)
1180 return E_INVALIDARG;
1181
1183 if (!This) return E_OUTOFMEMORY;
1184
1185 TRACE("(%p)\n", This);
1186
1187 /* initialize the virtual table function */
1188 This->IEnumMoniker_iface.lpVtbl = &VT_EnumMonikerImpl;
1189
1190 /* the initial reference is set to "1" */
1191 This->ref = 1; /* set the ref count to one */
1192 This->pos = current_pos; /* Set the list start posn */
1193 This->moniker_list = moniker_list;
1194
1195 *ppenumMoniker = &This->IEnumMoniker_iface;
1196
1197 return S_OK;
1198}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
static const IEnumMonikerVtbl VT_EnumMonikerImpl
Definition: moniker.c:1157
#define S_OK
Definition: intsafe.h:52

Referenced by EnumMonikerImpl_Clone(), and RunningObjectTableImpl_EnumRunning().

◆ EnumMonikerImpl_Next()

static HRESULT WINAPI EnumMonikerImpl_Next ( IEnumMoniker iface,
ULONG  celt,
IMoniker **  rgelt,
ULONG pceltFetched 
)
static

Definition at line 1056 of file moniker.c.

1057{
1058 ULONG i;
1060 HRESULT hr = S_OK;
1061
1062 TRACE("%p, %lu, %p, %p.\n", iface, celt, rgelt, pceltFetched);
1063
1064 /* retrieve the requested number of moniker from the current position */
1065 for(i = 0; (This->pos < This->moniker_list->size) && (i < celt); i++)
1066 {
1067 IStream *stream;
1068 hr = create_stream_on_mip_ro(This->moniker_list->interfaces[This->pos++], &stream);
1069 if (hr != S_OK) break;
1070 hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&rgelt[i]);
1071 IStream_Release(stream);
1072 if (hr != S_OK) break;
1073 }
1074
1075 if (pceltFetched != NULL)
1076 *pceltFetched= i;
1077
1078 if (hr != S_OK)
1079 return hr;
1080
1081 if (i == celt)
1082 return S_OK;
1083 else
1084 return S_FALSE;
1085
1086}
HRESULT WINAPI CoUnmarshalInterface(IStream *stream, REFIID riid, void **ppv)
Definition: marshal.c:793
static HRESULT create_stream_on_mip_ro(const InterfaceData *mip, IStream **stream)
Definition: moniker.c:96
HRESULT hr
Definition: shlfolder.c:183
#define S_FALSE
Definition: winerror.h:3451

◆ EnumMonikerImpl_QueryInterface()

static HRESULT WINAPI EnumMonikerImpl_QueryInterface ( IEnumMoniker iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 993 of file moniker.c.

994{
996
997 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppvObject);
998
999 /* validate arguments */
1000 if (ppvObject == NULL)
1001 return E_INVALIDARG;
1002
1003 *ppvObject = NULL;
1004
1006 *ppvObject = &This->IEnumMoniker_iface;
1007 else
1008 return E_NOINTERFACE;
1009
1010 IEnumMoniker_AddRef(iface);
1011 return S_OK;
1012}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IEnumMoniker
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ EnumMonikerImpl_Release()

static ULONG WINAPI EnumMonikerImpl_Release ( IEnumMoniker iface)
static

Definition at line 1029 of file moniker.c.

1030{
1032 ULONG ref;
1033
1034 TRACE("(%p)\n",This);
1035
1036 ref = InterlockedDecrement(&This->ref);
1037
1038 /* uninitialize ROT structure if there are no more references to it */
1039 if (ref == 0)
1040 {
1041 ULONG i;
1042
1043 TRACE("(%p) Deleting\n",This);
1044
1045 for (i = 0; i < This->moniker_list->size; i++)
1046 free(This->moniker_list->interfaces[i]);
1047 free(This->moniker_list);
1049 }
1050
1051 return ref;
1052}
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:735
Definition: send.c:48

◆ EnumMonikerImpl_Reset()

static HRESULT WINAPI EnumMonikerImpl_Reset ( IEnumMoniker iface)
static

Definition at line 1108 of file moniker.c.

1109{
1111
1112 This->pos = 0; /* set back to start of list */
1113
1114 TRACE("(%p)\n",This);
1115
1116 return S_OK;
1117}

◆ EnumMonikerImpl_Skip()

static HRESULT WINAPI EnumMonikerImpl_Skip ( IEnumMoniker iface,
ULONG  celt 
)
static

Definition at line 1091 of file moniker.c.

1092{
1094
1095 TRACE("(%p)\n",This);
1096
1097 if (This->pos + celt >= This->moniker_list->size)
1098 return S_FALSE;
1099
1100 This->pos += celt;
1101
1102 return S_OK;
1103}

◆ get_moniker_comparison_data()

static HRESULT get_moniker_comparison_data ( IMoniker pMoniker,
MonikerComparisonData **  moniker_data 
)
static

Definition at line 144 of file moniker.c.

145{
146 HRESULT hr;
147 IROTData *pROTData = NULL;
148 hr = IMoniker_QueryInterface(pMoniker, &IID_IROTData, (void *)&pROTData);
149 if (SUCCEEDED(hr))
150 {
151 ULONG size = ROT_COMPARE_MAX;
152 *moniker_data = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MonikerComparisonData, abData[size]));
153 if (!*moniker_data)
154 {
155 IROTData_Release(pROTData);
156 return E_OUTOFMEMORY;
157 }
158 hr = IROTData_GetComparisonData(pROTData, (*moniker_data)->abData, size, &size);
159 IROTData_Release(pROTData);
160 if (hr != S_OK)
161 {
162 ERR("Failed to copy comparison data into buffer, hr = %#lx\n", hr);
163 HeapFree(GetProcessHeap(), 0, *moniker_data);
164 *moniker_data = NULL;
165 return hr;
166 }
167 (*moniker_data)->ulCntData = size;
168 }
169 else
170 {
171 IBindCtx *pbc;
172 LPOLESTR pszDisplayName;
173 CLSID clsid;
174 int len;
175
176 TRACE("generating comparison data from display name\n");
177
178 hr = CreateBindCtx(0, &pbc);
179 if (FAILED(hr))
180 return hr;
181 hr = IMoniker_GetDisplayName(pMoniker, pbc, NULL, &pszDisplayName);
182 IBindCtx_Release(pbc);
183 if (FAILED(hr))
184 return hr;
185 hr = IMoniker_GetClassID(pMoniker, &clsid);
186 if (FAILED(hr))
187 {
188 CoTaskMemFree(pszDisplayName);
189 return hr;
190 }
191
192 len = lstrlenW(pszDisplayName);
193 *moniker_data = HeapAlloc(GetProcessHeap(), 0,
194 FIELD_OFFSET(MonikerComparisonData, abData[sizeof(CLSID) + (len+1)*sizeof(WCHAR)]));
195 if (!*moniker_data)
196 {
197 CoTaskMemFree(pszDisplayName);
198 return E_OUTOFMEMORY;
199 }
200 (*moniker_data)->ulCntData = sizeof(CLSID) + (len+1)*sizeof(WCHAR);
201
202 memcpy(&(*moniker_data)->abData[0], &clsid, sizeof(clsid));
203 memcpy(&(*moniker_data)->abData[sizeof(clsid)], pszDisplayName, (len+1)*sizeof(WCHAR));
204 CoTaskMemFree(pszDisplayName);
205 }
206 return S_OK;
207}
#define ERR(fmt,...)
Definition: precomp.h:57
#define lstrlenW
Definition: compat.h:750
GLenum GLsizei len
Definition: glext.h:6722
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
static BSTR *static LPOLESTR
Definition: varformat.c:44
const CLSID * clsid
Definition: msctf.cpp:50
IID CLSID
Definition: mstsclib_i.c:62
HRESULT WINAPI CreateBindCtx(DWORD reserved, IBindCtx **bind_context)
Definition: bindctx.c:491
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by RunningObjectTableImpl_GetObject(), RunningObjectTableImpl_GetTimeOfLastChange(), RunningObjectTableImpl_IsRunning(), and RunningObjectTableImpl_Register().

◆ get_moniker_for_progid_display_name()

static HRESULT get_moniker_for_progid_display_name ( LPBC  pbc,
LPCOLESTR  szDisplayName,
LPDWORD  pchEaten,
LPMONIKER ppmk 
)
static

Definition at line 763 of file moniker.c.

767{
768 CLSID clsid;
769 HRESULT hr;
771 LPCWSTR start = szDisplayName;
772 LPCWSTR end;
773 int len;
774 IMoniker *class_moniker;
775
776 if (*start == '@')
777 start++;
778
779 /* find end delimiter */
780 for (end = start; *end; end++)
781 if (*end == ':')
782 break;
783
784 len = end - start;
785
786 /* must start with '@' or have a ':' somewhere and mustn't be one character
787 * long (since that looks like an absolute path) */
788 if (((start == szDisplayName) && (*end == '\0')) || (len <= 1))
789 return MK_E_SYNTAX;
790
791 progid = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
792 if (progid)
793 {
794 memcpy(progid, start, len * sizeof(WCHAR));
795 progid[len] = '\0';
796 }
799 if (FAILED(hr))
800 return MK_E_SYNTAX;
801
802 hr = CreateClassMoniker(&clsid, &class_moniker);
803 if (SUCCEEDED(hr))
804 {
806 hr = IMoniker_BindToObject(class_moniker, pbc, NULL,
807 &IID_IParseDisplayName, (void **)&pdn);
808 /* fallback to using IClassFactory to get IParseDisplayName -
809 * adsldp.dll depends on this */
810 if (FAILED(hr))
811 {
812 IClassFactory *pcf;
813 hr = IMoniker_BindToObject(class_moniker, pbc, NULL,
814 &IID_IClassFactory, (void **)&pcf);
815 if (SUCCEEDED(hr))
816 {
817 hr = IClassFactory_CreateInstance(pcf, NULL,
819 (void **)&pdn);
820 IClassFactory_Release(pcf);
821 }
822 }
823 IMoniker_Release(class_moniker);
824 if (SUCCEEDED(hr))
825 {
826 hr = IParseDisplayName_ParseDisplayName(pdn, pbc,
827 (LPOLESTR)szDisplayName,
828 pchEaten, ppmk);
829 IParseDisplayName_Release(pdn);
830 }
831 }
832 return hr;
833}
const GUID IID_IClassFactory
HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker **moniker)
Definition: classmoniker.c:627
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, CLSID *clsid)
Definition: combase.c:1437
#define progid(str)
Definition: exdisp.idl:31
GLuint start
Definition: gl.h:1545
const GUID IID_IParseDisplayName
#define MK_E_SYNTAX
Definition: winerror.h:3896
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by MkParseDisplayName().

◆ GetClassFile()

HRESULT WINAPI GetClassFile ( LPCOLESTR  filePathName,
CLSID pclsid 
)

Definition at line 921 of file moniker.c.

922{
923 IStorage *pstg=0;
924 HRESULT res;
925 LONG sizeProgId, ret;
926 LPOLESTR progId=0;
927 const WCHAR *extension;
928
929 TRACE("%s, %p\n", debugstr_w(filePathName), pclsid);
930
931 /* if the file contain a storage object the return the CLSID written by IStorage_SetClass method*/
932 if((StgIsStorageFile(filePathName))==S_OK){
933
935
936 if (SUCCEEDED(res)) {
937 res=ReadClassStg(pstg,pclsid);
938 IStorage_Release(pstg);
939 }
940
941 return res;
942 }
943 /* If the file is not a storage object then attempt to match various bits in the file against a
944 pattern in the registry. This case is not frequently used, so I present only the pseudocode for
945 this case.
946
947 for(i=0;i<nFileTypes;i++)
948
949 for(i=0;j<nPatternsForType;j++){
950
951 PATTERN pat;
952 HANDLE hFile;
953
954 pat=ReadPatternFromRegistry(i,j);
955 hFile=CreateFileW(filePathName,,,,,,hFile);
956 SetFilePosition(hFile,pat.offset);
957 ReadFile(hFile,buf,pat.size,&r,NULL);
958 if (memcmp(buf&pat.mask,pat.pattern.pat.size)==0){
959
960 *pclsid=ReadCLSIDFromRegistry(i);
961 return S_OK;
962 }
963 }
964 */
965
966 /* if the above strategies fail then search for the extension key in the registry */
967
968 res = PathCchFindExtension(filePathName, PATHCCH_MAX_CCH, &extension);
969 if (FAILED(res) || !extension || !*extension || !wcscmp(extension, L"."))
971
972 ret = RegQueryValueW(HKEY_CLASSES_ROOT, extension, NULL, &sizeProgId);
973 if (!ret) {
974 /* get the progId associated to the extension */
975 progId = CoTaskMemAlloc(sizeProgId);
976 ret = RegQueryValueW(HKEY_CLASSES_ROOT, extension, progId, &sizeProgId);
977 if (!ret)
978 /* return the clsid associated to the progId */
979 res = CLSIDFromProgID(progId, pclsid);
980 else
982 CoTaskMemFree(progId);
983 }
984 else
986
987 return res != S_OK ? MK_E_INVALIDEXTENSION : res;
988}
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4241
HRESULT WINAPI ReadClassStg(IStorage *pstg, CLSID *pclsid)
Definition: storage32.c:72
HRESULT WINAPI StgIsStorageFile(LPCOLESTR fn)
Definition: storage32.c:191
HRESULT WINAPI PathCchFindExtension(const WCHAR *path, SIZE_T size, const WCHAR **extension)
Definition: path.c:730
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
HRESULT WINAPI StgOpenStorage(const OLECHAR *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8701
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
GLuint res
Definition: glext.h:9613
#define debugstr_w
Definition: kernel32.h:32
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:939
#define STGM_READ
Definition: objbase.h:934
#define PATHCCH_MAX_CCH
Definition: pathcch.h:52
long LONG
Definition: pedump.c:60
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define MK_E_INVALIDEXTENSION
Definition: winerror.h:3900
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by CoGetInstanceFromFile(), FileMonikerImpl_BindToObject(), and UIINSERTOBJECTDLG_OnOpen().

◆ GetRunningObjectTable()

HRESULT WINAPI GetRunningObjectTable ( DWORD  reserved,
IRunningObjectTable **  ret 
)

Definition at line 729 of file moniker.c.

730{
731 TRACE("%#lx, %p\n", reserved, ret);
732
733 if (reserved!=0)
734 return E_UNEXPECTED;
735
737 return CO_E_NOTINITIALIZED;
738
740 IRunningObjectTable_AddRef(*ret);
741
742 return S_OK;
743}
#define CO_E_NOTINITIALIZED
BOOL WINAPI InternalIsProcessInitialized(void)
Definition: combase.c:391
r reserved
Definition: btrfs.c:3006
IRunningObjectTable IRunningObjectTable_iface
Definition: moniker.c:67
#define E_UNEXPECTED
Definition: winerror.h:3528

Referenced by BindCtxImpl_GetRunningObjectTable(), GetActiveObject(), IHlinkBC_GetObject(), IHlinkBC_Register(), IHlinkBC_Revoke(), RegisterActiveObject(), RevokeActiveObject(), test_bind_context(), test_ROT(), and test_ROT_multiple_entries().

◆ impl_from_IEnumMoniker()

static EnumMonikerImpl * impl_from_IEnumMoniker ( IEnumMoniker iface)
inlinestatic

Definition at line 87 of file moniker.c.

88{
89 return CONTAINING_RECORD(iface, EnumMonikerImpl, IEnumMoniker_iface);
90}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by EnumMonikerImpl_AddRef(), EnumMonikerImpl_Clone(), EnumMonikerImpl_Next(), EnumMonikerImpl_QueryInterface(), EnumMonikerImpl_Release(), EnumMonikerImpl_Reset(), and EnumMonikerImpl_Skip().

◆ impl_from_IMarshal()

◆ impl_from_IRunningObjectTable()

◆ impl_from_IUnknown()

static MonikerMarshal * impl_from_IUnknown ( IUnknown iface)
inlinestatic

◆ InternalIrotEnumRunning()

HRESULT WINAPI InternalIrotEnumRunning ( PInterfaceList *  list)

Definition at line 353 of file rpc.c.

354{
358}
Definition: list.h:37
static RPC_BINDING_HANDLE get_irot_handle(void)
Definition: rpc.c:273
#define RPCSS_CALL_START
Definition: rpc.c:290
#define RPCSS_CALL_END
Definition: rpc.c:295
HRESULT __cdecl IrotEnumRunning(IrotHandle h, PInterfaceList *list)
Definition: irotp.c:315

Referenced by RunningObjectTableImpl_EnumRunning().

◆ InternalIrotGetObject()

HRESULT WINAPI InternalIrotGetObject ( const MonikerComparisonData moniker_data,
PInterfaceData *  obj,
IrotCookie *  cookie 
)

Definition at line 331 of file rpc.c.

333{
335 hr = IrotGetObject(get_irot_handle(), moniker_data, obj, cookie);
337}
HRESULT __cdecl IrotGetObject(IrotHandle h, const MonikerComparisonData *moniker_data, PInterfaceData *obj, IrotCookie *cookie)
Definition: irotp.c:221
Definition: cookie.c:34

Referenced by RunningObjectTableImpl_GetObject().

◆ InternalIrotGetTimeOfLastChange()

HRESULT WINAPI InternalIrotGetTimeOfLastChange ( const MonikerComparisonData moniker_data,
FILETIME time 
)

Definition at line 346 of file rpc.c.

347{
351}
HRESULT __cdecl IrotGetTimeOfLastChange(IrotHandle h, const MonikerComparisonData *moniker_data, FILETIME *time)
Definition: irotp.c:287
__u16 time
Definition: mkdosfs.c:8

Referenced by RunningObjectTableImpl_GetTimeOfLastChange().

◆ InternalIrotIsRunning()

HRESULT WINAPI InternalIrotIsRunning ( const MonikerComparisonData moniker_data)

Definition at line 324 of file rpc.c.

325{
327 hr = IrotIsRunning(get_irot_handle(), moniker_data);
329}
HRESULT __cdecl IrotIsRunning(IrotHandle h, const MonikerComparisonData *data)
Definition: irotp.c:196

Referenced by RunningObjectTableImpl_IsRunning().

◆ InternalIrotNoteChangeTime()

HRESULT WINAPI InternalIrotNoteChangeTime ( IrotCookie  cookie,
const FILETIME time 
)

Definition at line 339 of file rpc.c.

340{
344}
HRESULT __cdecl IrotNoteChangeTime(IrotHandle h, IrotCookie cookie, const FILETIME *last_modified_time)
Definition: irotp.c:263

Referenced by RunningObjectTableImpl_NoteChangeTime().

◆ InternalIrotRegister()

HRESULT WINAPI InternalIrotRegister ( const MonikerComparisonData moniker_data,
const InterfaceData *  object,
const InterfaceData *  moniker,
const FILETIME time,
DWORD  flags,
IrotCookie *  cookie,
IrotContextHandle *  ctxt_handle 
)

Definition at line 315 of file rpc.c.

318{
320 hr = IrotRegister(get_irot_handle(), moniker_data, object, moniker, time, flags, cookie, ctxt_handle);
322}
GLbitfield flags
Definition: glext.h:7161
HRESULT __cdecl IrotRegister(IrotHandle h, const MonikerComparisonData *data, const InterfaceData *obj, const InterfaceData *mk, const FILETIME *time, DWORD grfFlags, IrotCookie *cookie, IrotContextHandle *ctxt_handle)
Definition: irotp.c:71
Definition: main.c:40

Referenced by RunningObjectTableImpl_Register().

◆ InternalIrotRevoke()

HRESULT WINAPI InternalIrotRevoke ( IrotCookie  cookie,
IrotContextHandle *  ctxt_handle,
PInterfaceData *  object,
PInterfaceData *  moniker 
)

Definition at line 360 of file rpc.c.

362{
364 hr = IrotRevoke(get_irot_handle(), cookie, ctxt_handle, object, moniker);
366}
HRESULT __cdecl IrotRevoke(IrotHandle h, IrotCookie cookie, IrotContextHandle *ctxt_handle, PInterfaceData *obj, PInterfaceData *mk)
Definition: irotp.c:149

Referenced by rot_entry_delete().

◆ InternalIsProcessInitialized()

BOOL WINAPI InternalIsProcessInitialized ( void  )

Definition at line 391 of file combase.c.

392{
393 struct apartment *apt;
394
395 if (!(apt = apartment_get_current_or_mta()))
396 return FALSE;
398
399 return TRUE;
400}
void apartment_release(struct apartment *apt)
Definition: apartment.c:444
struct apartment * apartment_get_current_or_mta(void)
Definition: apartment.c:623
#define FALSE
Definition: types.h:117

Referenced by CoGetContextToken(), CoGetPSClsid(), CoRegisterPSClsid(), GetRunningObjectTable(), and RoGetAgileReference().

◆ MIDL_user_allocate()

void *__RPC_USER MIDL_user_allocate ( SIZE_T  size)

Definition at line 1375 of file moniker.c.

1376{
1377 return malloc(size);
1378}

◆ MIDL_user_free()

void __RPC_USER MIDL_user_free ( void p)

Definition at line 1380 of file moniker.c.

1381{
1382 free(p);
1383}
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by rot_entry_delete().

◆ MkParseDisplayName()

HRESULT WINAPI MkParseDisplayName ( LPBC  pbc,
LPCOLESTR  szDisplayName,
LPDWORD  pchEaten,
LPMONIKER ppmk 
)

Definition at line 838 of file moniker.c.

840{
843 DWORD chEaten;
844
845 TRACE("(%p, %s, %p, %p)\n", pbc, debugstr_w(szDisplayName), pchEaten, ppmk);
846
847 if (!pbc || !IsValidInterface((LPUNKNOWN) pbc))
848 return E_INVALIDARG;
849
850 if (!szDisplayName || !*szDisplayName)
851 return E_INVALIDARG;
852
853 if (!pchEaten || !ppmk)
854 return E_INVALIDARG;
855
856 *pchEaten = 0;
857 *ppmk = NULL;
858
859 if (!wcsnicmp(szDisplayName, L"clsid:", 6))
860 {
861 hr = ClassMoniker_CreateFromDisplayName(pbc, szDisplayName, &chEaten, &moniker);
862 if (FAILED(hr) && (hr != MK_E_SYNTAX))
863 return hr;
864 }
865 else
866 {
867 hr = get_moniker_for_progid_display_name(pbc, szDisplayName, &chEaten, &moniker);
868 if (FAILED(hr) && (hr != MK_E_SYNTAX))
869 return hr;
870 }
871
872 if (FAILED(hr))
873 {
874 hr = FileMoniker_CreateFromDisplayName(pbc, szDisplayName, &chEaten, &moniker);
875 if (FAILED(hr) && (hr != MK_E_SYNTAX))
876 return hr;
877 }
878
879 if (SUCCEEDED(hr))
880 {
881 while (TRUE)
882 {
883 IMoniker *next_moniker;
884 *pchEaten += chEaten;
885 szDisplayName += chEaten;
886 if (!*szDisplayName)
887 {
888 *ppmk = moniker;
889 return S_OK;
890 }
891 chEaten = 0;
892 hr = IMoniker_ParseDisplayName(moniker, pbc, NULL,
893 (LPOLESTR)szDisplayName, &chEaten,
894 &next_moniker);
895 IMoniker_Release(moniker);
896 if (FAILED(hr))
897 {
898 *pchEaten = 0;
899 break;
900 }
901 moniker = next_moniker;
902 }
903 }
904
905 return hr;
906}
HRESULT ClassMoniker_CreateFromDisplayName(LPBC pbc, const WCHAR *display_name, DWORD *eaten, IMoniker **moniker)
Definition: classmoniker.c:634
static LPVOID LPUNKNOWN
Definition: dinput.c:53
#define wcsnicmp
Definition: compat.h:14
static HRESULT get_moniker_for_progid_display_name(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
Definition: moniker.c:763
HRESULT FileMoniker_CreateFromDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, IMoniker **ppmk)
Definition: filemoniker.c:1396
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI IsValidInterface(LPUNKNOWN punk)
Definition: ole32_main.c:172

Referenced by CoGetObject(), Global_GetObject(), HlinkParseDisplayName(), IHlink_fnSetStringReference(), MkParseDisplayNameEx(), test_class_moniker(), and test_MkParseDisplayName().

◆ MonikerMarshal_AddRef()

static ULONG WINAPI MonikerMarshal_AddRef ( IMarshal iface)
static

Definition at line 1266 of file moniker.c.

1267{
1269 return IMoniker_AddRef(This->moniker);
1270}
static MonikerMarshal * impl_from_IMarshal(IMarshal *iface)
Definition: moniker.c:1218

◆ MonikerMarshal_Create()

HRESULT MonikerMarshal_Create ( IMoniker inner,
IUnknown **  outer 
)

Definition at line 1361 of file moniker.c.

1362{
1363 MonikerMarshal *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1364 if (!This) return E_OUTOFMEMORY;
1365
1366 This->IUnknown_iface.lpVtbl = &VT_MonikerMarshalInner;
1367 This->IMarshal_iface.lpVtbl = &VT_MonikerMarshal;
1368 This->ref = 1;
1369 This->moniker = inner;
1370
1371 *outer = &This->IUnknown_iface;
1372 return S_OK;
1373}
static const IUnknownVtbl VT_MonikerMarshalInner
Definition: moniker.c:1253
static const IMarshalVtbl VT_MonikerMarshal
Definition: moniker.c:1348
static IUnknown * outer
Definition: compobj.c:82

Referenced by AntiMonikerImpl_QueryInterface(), ClassMoniker_QueryInterface(), FileMonikerImpl_QueryInterface(), and ItemMonikerImpl_QueryInterface().

◆ MonikerMarshal_DisconnectObject()

static HRESULT WINAPI MonikerMarshal_DisconnectObject ( LPMARSHAL  iface,
DWORD  dwReserved 
)
static

Definition at line 1340 of file moniker.c.

1341{
1342 TRACE("()\n");
1343 /* can't disconnect a state-based marshal as nothing on server side to
1344 * disconnect from */
1345 return S_OK;
1346}

◆ MonikerMarshal_GetMarshalSizeMax()

static HRESULT WINAPI MonikerMarshal_GetMarshalSizeMax ( LPMARSHAL  iface,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags,
DWORD pSize 
)
static

Definition at line 1290 of file moniker.c.

1293{
1295 HRESULT hr;
1297
1298 TRACE("%s, %p, %lx, %p, %lx, %p.\n", debugstr_guid(riid), pv,
1299 dwDestContext, pvDestContext, mshlflags, pSize);
1300
1301 hr = IMoniker_GetSizeMax(This->moniker, &size);
1302 if (hr == S_OK)
1303 *pSize = (DWORD)size.QuadPart;
1304 return hr;
1305}
#define DWORD
Definition: nt_native.h:44

◆ MonikerMarshal_GetUnmarshalClass()

static HRESULT WINAPI MonikerMarshal_GetUnmarshalClass ( LPMARSHAL  iface,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags,
CLSID pCid 
)
static

Definition at line 1278 of file moniker.c.

1281{
1283
1284 TRACE("%s, %p, %lx, %p, %lx, %p.\n", debugstr_guid(riid), pv,
1285 dwDestContext, pvDestContext, mshlflags, pCid);
1286
1287 return IMoniker_GetClassID(This->moniker, pCid);
1288}

◆ MonikerMarshal_MarshalInterface()

static HRESULT WINAPI MonikerMarshal_MarshalInterface ( LPMARSHAL  iface,
IStream pStm,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags 
)
static

Definition at line 1307 of file moniker.c.

1310{
1312
1313 TRACE("%p, %s, %p, %lx, %p, %lx.\n", pStm, debugstr_guid(riid), pv,
1314 dwDestContext, pvDestContext, mshlflags);
1315
1316 return IMoniker_Save(This->moniker, pStm, FALSE);
1317}

◆ MonikerMarshal_QueryInterface()

static HRESULT WINAPI MonikerMarshal_QueryInterface ( IMarshal iface,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 1260 of file moniker.c.

1261{
1263 return IMoniker_QueryInterface(This->moniker, riid, ppv);
1264}
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ MonikerMarshal_Release()

static ULONG WINAPI MonikerMarshal_Release ( IMarshal iface)
static

Definition at line 1272 of file moniker.c.

1273{
1275 return IMoniker_Release(This->moniker);
1276}

◆ MonikerMarshal_ReleaseMarshalData()

static HRESULT WINAPI MonikerMarshal_ReleaseMarshalData ( LPMARSHAL  iface,
IStream pStm 
)
static

Definition at line 1332 of file moniker.c.

1333{
1334 TRACE("()\n");
1335 /* can't release a state-based marshal as nothing on server side to
1336 * release */
1337 return S_OK;
1338}

◆ MonikerMarshal_UnmarshalInterface()

static HRESULT WINAPI MonikerMarshal_UnmarshalInterface ( LPMARSHAL  iface,
IStream pStm,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1319 of file moniker.c.

1320{
1322 HRESULT hr;
1323
1324 TRACE("(%p, %s, %p)\n", pStm, debugstr_guid(riid), ppv);
1325
1326 hr = IMoniker_Load(This->moniker, pStm);
1327 if (hr == S_OK)
1328 hr = IMoniker_QueryInterface(This->moniker, riid, ppv);
1329 return hr;
1330}

◆ MonikerMarshalInner_AddRef()

static ULONG WINAPI MonikerMarshalInner_AddRef ( IUnknown iface)
static

Definition at line 1238 of file moniker.c.

1239{
1241 return InterlockedIncrement(&This->ref);
1242}
static MonikerMarshal * impl_from_IUnknown(IUnknown *iface)
Definition: moniker.c:1213

◆ MonikerMarshalInner_QueryInterface()

static HRESULT WINAPI MonikerMarshalInner_QueryInterface ( IUnknown iface,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 1223 of file moniker.c.

1224{
1226 TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
1227 *ppv = NULL;
1228 if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IMarshal, riid))
1229 {
1230 *ppv = &This->IMarshal_iface;
1231 IMarshal_AddRef(&This->IMarshal_iface);
1232 return S_OK;
1233 }
1234 FIXME("No interface for %s\n", debugstr_guid(riid));
1235 return E_NOINTERFACE;
1236}
#define FIXME(fmt,...)
Definition: precomp.h:53

◆ MonikerMarshalInner_Release()

static ULONG WINAPI MonikerMarshalInner_Release ( IUnknown iface)
static

Definition at line 1244 of file moniker.c.

1245{
1248
1249 if (!ref) HeapFree(GetProcessHeap(), 0, This);
1250 return ref;
1251}

◆ reduce_moniker()

static HRESULT reduce_moniker ( IMoniker pmk,
IBindCtx pbc,
IMoniker **  pmkReduced 
)
static

Definition at line 209 of file moniker.c.

210{
211 IBindCtx *pbcNew = NULL;
212 HRESULT hr;
213 if (!pbc)
214 {
215 hr = CreateBindCtx(0, &pbcNew);
216 if (FAILED(hr))
217 return hr;
218 pbc = pbcNew;
219 }
220 hr = IMoniker_Reduce(pmk, pbc, MKRREDUCE_ALL, NULL, pmkReduced);
221 if (FAILED(hr))
222 ERR("reducing moniker failed with error %#lx.\n", hr);
223 if (pbcNew) IBindCtx_Release(pbcNew);
224 return hr;
225}

Referenced by RunningObjectTableImpl_GetObject(), RunningObjectTableImpl_GetTimeOfLastChange(), RunningObjectTableImpl_IsRunning(), and RunningObjectTableImpl_Register().

◆ rot_entry_delete()

static void rot_entry_delete ( struct rot_entry rot_entry)
static

Definition at line 105 of file moniker.c.

106{
107 if (rot_entry->cookie)
108 {
109 InterfaceData *object = NULL;
110 InterfaceData *moniker = NULL;
111
113 MIDL_user_free(object);
114 if (moniker)
115 {
117 HRESULT hr;
119 if (hr == S_OK)
120 {
122 IStream_Release(stream);
123 }
124 }
126 }
127 if (rot_entry->object)
128 {
130 HRESULT hr;
132 if (hr == S_OK)
133 {
135 IStream_Release(stream);
136 }
137 }
141}
HRESULT WINAPI CoReleaseMarshalData(IStream *stream)
Definition: marshal.c:673
void __RPC_USER MIDL_user_free(void *p)
Definition: moniker.c:1380
HRESULT WINAPI InternalIrotRevoke(IrotCookie cookie, IrotContextHandle *ctxt_handle, PInterfaceData *object, PInterfaceData *moniker)
Definition: rpc.c:360
IrotContextHandle ctxt_handle
Definition: moniker.c:61
InterfaceData * object
Definition: irotp.c:39
MonikerComparisonData * moniker_data
Definition: irotp.c:41
DWORD cookie
Definition: irotp.c:42

Referenced by DestroyRunningObjectTable(), RunningObjectTableImpl_Register(), and RunningObjectTableImpl_Revoke().

◆ RunningObjectTableImpl_AddRef()

static ULONG WINAPI RunningObjectTableImpl_AddRef ( IRunningObjectTable iface)
static

Definition at line 257 of file moniker.c.

258{
259 TRACE("%p\n", iface);
260
261 return 2;
262}

◆ RunningObjectTableImpl_EnumRunning()

static HRESULT WINAPI RunningObjectTableImpl_EnumRunning ( IRunningObjectTable iface,
IEnumMoniker **  ppenumMoniker 
)
static

Definition at line 677 of file moniker.c.

679{
682 HRESULT hr;
683
684 TRACE("(%p, %p)\n", This, ppenumMoniker);
685
686 *ppenumMoniker = NULL;
687
689 if (SUCCEEDED(hr))
691
692 return hr;
693}
static struct regsvr_interface const interface_list[]
Definition: regsvr.c:477
HRESULT WINAPI InternalIrotEnumRunning(PInterfaceList *list)
Definition: rpc.c:353
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:82

◆ RunningObjectTableImpl_GetObject()

static HRESULT WINAPI RunningObjectTableImpl_GetObject ( IRunningObjectTable iface,
IMoniker pmkObjectName,
IUnknown **  ppunkObject 
)
static

Definition at line 511 of file moniker.c.

513{
515 MonikerComparisonData *moniker_data;
516 InterfaceData *object = NULL;
517 IrotCookie cookie;
518 HRESULT hr;
519 struct rot_entry *rot_entry;
520
521 TRACE("(%p,%p,%p)\n",This,pmkObjectName,ppunkObject);
522
523 if (ppunkObject == NULL)
524 return E_POINTER;
525
526 *ppunkObject = NULL;
527
528 hr = reduce_moniker(pmkObjectName, NULL, &pmkObjectName);
529 if (FAILED(hr))
530 return hr;
532 IMoniker_Release(pmkObjectName);
533 if (hr != S_OK)
534 return hr;
535
538 {
541 {
542 IStream *pStream;
545
546 if (hr == S_OK)
547 {
548 hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)ppunkObject);
549 IStream_Release(pStream);
550 }
551
553
554 return hr;
555 }
556 }
558
559 TRACE("moniker unavailable locally, calling SCM\n");
560
562 if (SUCCEEDED(hr))
563 {
564 IStream *pStream;
565 hr = create_stream_on_mip_ro(object, &pStream);
566 if (hr == S_OK)
567 {
568 hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)ppunkObject);
569 IStream_Release(pStream);
570 }
571 }
572 else
573 WARN("Moniker unavailable, IrotGetObject returned %#lx\n", hr);
574
576
577 return hr;
578}
#define WARN(fmt,...)
Definition: precomp.h:61
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
HRESULT WINAPI InternalIrotGetObject(const MonikerComparisonData *moniker_data, PInterfaceData *obj, IrotCookie *cookie)
Definition: rpc.c:331
static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MonikerComparisonData **moniker_data)
Definition: moniker.c:144
static HRESULT reduce_moniker(IMoniker *pmk, IBindCtx *pbc, IMoniker **pmkReduced)
Definition: moniker.c:209
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define E_POINTER
Definition: winerror.h:3480

◆ RunningObjectTableImpl_GetTimeOfLastChange()

static HRESULT WINAPI RunningObjectTableImpl_GetTimeOfLastChange ( IRunningObjectTable iface,
IMoniker pmkObjectName,
FILETIME pfiletime 
)
static

Definition at line 625 of file moniker.c.

627{
630 MonikerComparisonData *moniker_data;
631 const struct rot_entry *rot_entry;
632
633 TRACE("(%p,%p,%p)\n",This,pmkObjectName,pfiletime);
634
635 if (pmkObjectName==NULL || pfiletime==NULL)
636 return E_INVALIDARG;
637
638 hr = reduce_moniker(pmkObjectName, NULL, &pmkObjectName);
639 if (FAILED(hr))
640 return hr;
642 IMoniker_Release(pmkObjectName);
643 if (hr != S_OK)
644 return hr;
645
647
649 LIST_FOR_EACH_ENTRY(rot_entry, &This->rot, const struct rot_entry, entry)
650 {
653 {
654 *pfiletime = rot_entry->last_modified;
655 hr = S_OK;
656 break;
657 }
658 }
660
661 if (hr != S_OK)
663
665
666 TRACE("-- %#lx\n", hr);
667 return hr;
668}
HRESULT WINAPI InternalIrotGetTimeOfLastChange(const MonikerComparisonData *moniker_data, FILETIME *time)
Definition: rpc.c:346
FILETIME last_modified
Definition: irotp.c:43
#define MK_E_UNAVAILABLE
Definition: winerror.h:3894

◆ RunningObjectTableImpl_IsRunning()

static HRESULT WINAPI RunningObjectTableImpl_IsRunning ( IRunningObjectTable iface,
IMoniker pmkObjectName 
)
static

Definition at line 465 of file moniker.c.

466{
468 MonikerComparisonData *moniker_data;
469 HRESULT hr;
470 const struct rot_entry *rot_entry;
471
472 TRACE("(%p,%p)\n",This,pmkObjectName);
473
474 hr = reduce_moniker(pmkObjectName, NULL, &pmkObjectName);
475 if (FAILED(hr))
476 return hr;
478 IMoniker_Release(pmkObjectName);
479 if (hr != S_OK)
480 return hr;
481
482 hr = S_FALSE;
484 LIST_FOR_EACH_ENTRY(rot_entry, &This->rot, const struct rot_entry, entry)
485 {
488 {
489 hr = S_OK;
490 break;
491 }
492 }
494
495 if (hr == S_FALSE)
497
499
500 return hr;
501}
HRESULT WINAPI InternalIrotIsRunning(const MonikerComparisonData *moniker_data)
Definition: rpc.c:324

◆ RunningObjectTableImpl_NoteChangeTime()

static HRESULT WINAPI RunningObjectTableImpl_NoteChangeTime ( IRunningObjectTable iface,
DWORD  dwRegister,
FILETIME pfiletime 
)
static

Definition at line 588 of file moniker.c.

590{
592 struct rot_entry *rot_entry;
594
595 TRACE("%p, %ld, %p.\n", iface, dwRegister, pfiletime);
596
599 {
600 if (rot_entry->cookie == dwRegister)
601 {
602 rot_entry->last_modified = *pfiletime;
604
605 hr = InternalIrotNoteChangeTime(dwRegister, pfiletime);
606
607 goto done;
608 }
609 }
611
612done:
613 TRACE("-- %#lx\n", hr);
614 return hr;
615}
HRESULT WINAPI InternalIrotNoteChangeTime(IrotCookie cookie, const FILETIME *time)
Definition: rpc.c:339

◆ RunningObjectTableImpl_QueryInterface()

static HRESULT WINAPI RunningObjectTableImpl_QueryInterface ( IRunningObjectTable iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 231 of file moniker.c.

233{
235
236 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppvObject);
237
238 /* validate arguments */
239
240 if (ppvObject==0)
241 return E_INVALIDARG;
242
243 *ppvObject = 0;
244
246 IsEqualIID(&IID_IRunningObjectTable, riid))
247 *ppvObject = &This->IRunningObjectTable_iface;
248
249 if ((*ppvObject)==0)
250 return E_NOINTERFACE;
251
252 IRunningObjectTable_AddRef(iface);
253
254 return S_OK;
255}

◆ RunningObjectTableImpl_Register()

static HRESULT WINAPI RunningObjectTableImpl_Register ( IRunningObjectTable iface,
DWORD  flags,
IUnknown punkObject,
IMoniker pmkObjectName,
DWORD pdwRegister 
)
static

Definition at line 281 of file moniker.c.

283{
285 struct rot_entry *rot_entry;
286 HRESULT hr = S_OK;
287 IStream *pStream = NULL;
288 DWORD mshlflags;
289 IBindCtx *pbc;
290 InterfaceData *moniker = NULL;
291
292 TRACE("%p, %#lx, %p, %p, %p\n", iface, flags, punkObject, pmkObjectName, pdwRegister);
293
294 if (flags & ~(ROTFLAGS_REGISTRATIONKEEPSALIVE|ROTFLAGS_ALLOWANYCLIENT))
295 {
296 ERR("Invalid flags: %#lx\n", flags & ~(ROTFLAGS_REGISTRATIONKEEPSALIVE|ROTFLAGS_ALLOWANYCLIENT));
297 return E_INVALIDARG;
298 }
299
300 if (punkObject==NULL || pmkObjectName==NULL || pdwRegister==NULL)
301 return E_INVALIDARG;
302
304 if (!rot_entry)
305 return E_OUTOFMEMORY;
306
307 /* marshal object */
308 hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
309 if (hr != S_OK)
310 {
312 return hr;
313 }
314 mshlflags = flags & ROTFLAGS_REGISTRATIONKEEPSALIVE ? MSHLFLAGS_TABLESTRONG : MSHLFLAGS_TABLEWEAK;
315 hr = CoMarshalInterface(pStream, &IID_IUnknown, punkObject, MSHCTX_LOCAL | MSHCTX_NOSHAREDMEM, NULL, mshlflags);
316 /* FIXME: a cleaner way would be to create an IStream class that writes
317 * directly to an MInterfacePointer */
318 if (hr == S_OK)
319 {
320 HGLOBAL hglobal;
321 hr = GetHGlobalFromStream(pStream, &hglobal);
322 if (hr == S_OK)
323 {
324 SIZE_T size = GlobalSize(hglobal);
325 const void *pv = GlobalLock(hglobal);
326 rot_entry->object = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MInterfacePointer, abData[size]));
327 rot_entry->object->ulCntData = size;
328 memcpy(rot_entry->object->abData, pv, size);
329 GlobalUnlock(hglobal);
330 }
331 }
332 IStream_Release(pStream);
333 if (hr != S_OK)
334 {
336 return hr;
337 }
338
339 hr = CreateBindCtx(0, &pbc);
340 if (FAILED(hr))
341 {
343 return hr;
344 }
345
346 hr = reduce_moniker(pmkObjectName, pbc, &pmkObjectName);
347 if (FAILED(hr))
348 {
350 IBindCtx_Release(pbc);
351 return hr;
352 }
353
354 hr = IMoniker_GetTimeOfLastChange(pmkObjectName, pbc, NULL,
356 IBindCtx_Release(pbc);
357 if (FAILED(hr))
358 {
360 hr = S_OK;
361 }
362
363 hr = get_moniker_comparison_data(pmkObjectName,
365 if (hr != S_OK)
366 {
368 IMoniker_Release(pmkObjectName);
369 return hr;
370 }
371
372 hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
373 if (hr != S_OK)
374 {
376 IMoniker_Release(pmkObjectName);
377 return hr;
378 }
379 /* marshal moniker */
380 hr = CoMarshalInterface(pStream, &IID_IMoniker, (IUnknown *)pmkObjectName,
381 MSHCTX_LOCAL | MSHCTX_NOSHAREDMEM, NULL, MSHLFLAGS_TABLESTRONG);
382 /* FIXME: a cleaner way would be to create an IStream class that writes
383 * directly to an MInterfacePointer */
384 if (hr == S_OK)
385 {
386 HGLOBAL hglobal;
387 hr = GetHGlobalFromStream(pStream, &hglobal);
388 if (hr == S_OK)
389 {
390 SIZE_T size = GlobalSize(hglobal);
391 const void *pv = GlobalLock(hglobal);
392 moniker = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(InterfaceData, abData[size]));
393 moniker->ulCntData = size;
394 memcpy(moniker->abData, pv, size);
395 GlobalUnlock(hglobal);
396 }
397 }
398 IStream_Release(pStream);
399 IMoniker_Release(pmkObjectName);
400 if (hr != S_OK)
401 {
404 return hr;
405 }
406
409
411 if (FAILED(hr))
412 {
414 return hr;
415 }
416
417 /* gives a registration identifier to the registered object*/
418 *pdwRegister = rot_entry->cookie;
419
423
424 return hr;
425}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
HRESULT WINAPI CoFileTimeNow(FILETIME *filetime)
Definition: combase.c:1007
HRESULT WINAPI GetHGlobalFromStream(IStream *stream, HGLOBAL *phglobal)
HRESULT WINAPI CoMarshalInterface(IStream *stream, REFIID riid, IUnknown *unk, DWORD dest_context, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:483
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
HRESULT WINAPI InternalIrotRegister(const MonikerComparisonData *moniker_data, const InterfaceData *object, const InterfaceData *moniker, const FILETIME *time, DWORD flags, IrotCookie *cookie, IrotContextHandle *ctxt_handle)
Definition: rpc.c:315
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090

◆ RunningObjectTableImpl_Release()

static ULONG WINAPI RunningObjectTableImpl_Release ( IRunningObjectTable iface)
static

Definition at line 264 of file moniker.c.

265{
266 TRACE("%p\n", iface);
267
268 return 1;
269}

◆ RunningObjectTableImpl_Revoke()

static HRESULT WINAPI RunningObjectTableImpl_Revoke ( IRunningObjectTable iface,
DWORD  dwRegister 
)
static

Definition at line 434 of file moniker.c.

435{
437 struct rot_entry *rot_entry;
438
439 TRACE("%p, %ld.\n", iface, dwRegister);
440
443 {
444 if (rot_entry->cookie == dwRegister)
445 {
448
450 return S_OK;
451 }
452 }
454
455 return E_INVALIDARG;
456}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ critsect_debug

RTL_CRITICAL_SECTION_DEBUG critsect_debug
static
Initial value:
=
{
0, 0, &rot.lock,
0, 0, { (DWORD_PTR)(__FILE__ ": RunningObjectTable_section") }
}
static RTL_CRITICAL_SECTION_DEBUG critsect_debug
Definition: moniker.c:712
#define DWORD_PTR
Definition: treelist.c:76

Definition at line 712 of file moniker.c.

◆ rot

Initial value:
=
{
.IRunningObjectTable_iface.lpVtbl = &VT_RunningObjectTableImpl,
.lock = { &critsect_debug, -1, 0, 0, 0, 0 },
.rot = LIST_INIT(rot.rot),
}
static const IRunningObjectTableVtbl VT_RunningObjectTableImpl
Definition: moniker.c:696
#define LIST_INIT(head)
Definition: queue.h:197

Definition at line 710 of file moniker.c.

Referenced by DestroyRunningObjectTable(), GetRunningObjectTable(), test_bind_context(), test_generic_composite_moniker(), and test_item_moniker().

◆ VT_EnumMonikerImpl

const IEnumMonikerVtbl VT_EnumMonikerImpl
static
Initial value:
=
{
}
static HRESULT WINAPI EnumMonikerImpl_Reset(IEnumMoniker *iface)
Definition: moniker.c:1108
static ULONG WINAPI EnumMonikerImpl_Release(IEnumMoniker *iface)
Definition: moniker.c:1029
static HRESULT WINAPI EnumMonikerImpl_Clone(IEnumMoniker *iface, IEnumMoniker **ppenum)
Definition: moniker.c:1122
static HRESULT WINAPI EnumMonikerImpl_Skip(IEnumMoniker *iface, ULONG celt)
Definition: moniker.c:1091
static HRESULT WINAPI EnumMonikerImpl_Next(IEnumMoniker *iface, ULONG celt, IMoniker **rgelt, ULONG *pceltFetched)
Definition: moniker.c:1056
static ULONG WINAPI EnumMonikerImpl_AddRef(IEnumMoniker *iface)
Definition: moniker.c:1017
static HRESULT WINAPI EnumMonikerImpl_QueryInterface(IEnumMoniker *iface, REFIID riid, void **ppvObject)
Definition: moniker.c:993

Definition at line 1157 of file moniker.c.

Referenced by EnumMonikerImpl_CreateEnumROTMoniker().

◆ VT_MonikerMarshal

const IMarshalVtbl VT_MonikerMarshal
static
Initial value:
=
{
}
static HRESULT WINAPI MonikerMarshal_MarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags)
Definition: moniker.c:1307
static HRESULT WINAPI MonikerMarshal_DisconnectObject(LPMARSHAL iface, DWORD dwReserved)
Definition: moniker.c:1340
static HRESULT WINAPI MonikerMarshal_GetMarshalSizeMax(LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
Definition: moniker.c:1290
static ULONG WINAPI MonikerMarshal_AddRef(IMarshal *iface)
Definition: moniker.c:1266
static HRESULT WINAPI MonikerMarshal_GetUnmarshalClass(LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
Definition: moniker.c:1278
static HRESULT WINAPI MonikerMarshal_QueryInterface(IMarshal *iface, REFIID riid, LPVOID *ppv)
Definition: moniker.c:1260
static ULONG WINAPI MonikerMarshal_Release(IMarshal *iface)
Definition: moniker.c:1272
static HRESULT WINAPI MonikerMarshal_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm)
Definition: moniker.c:1332
static HRESULT WINAPI MonikerMarshal_UnmarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, void **ppv)
Definition: moniker.c:1319

Definition at line 1348 of file moniker.c.

Referenced by MonikerMarshal_Create().

◆ VT_MonikerMarshalInner

const IUnknownVtbl VT_MonikerMarshalInner
static
Initial value:
=
{
}
static HRESULT WINAPI MonikerMarshalInner_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppv)
Definition: moniker.c:1223
static ULONG WINAPI MonikerMarshalInner_Release(IUnknown *iface)
Definition: moniker.c:1244
static ULONG WINAPI MonikerMarshalInner_AddRef(IUnknown *iface)
Definition: moniker.c:1238

Definition at line 1253 of file moniker.c.

Referenced by MonikerMarshal_Create().

◆ VT_RunningObjectTableImpl

const IRunningObjectTableVtbl VT_RunningObjectTableImpl
static
Initial value:
=
{
}
static HRESULT WINAPI RunningObjectTableImpl_QueryInterface(IRunningObjectTable *iface, REFIID riid, void **ppvObject)
Definition: moniker.c:231
static HRESULT WINAPI RunningObjectTableImpl_GetObject(IRunningObjectTable *iface, IMoniker *pmkObjectName, IUnknown **ppunkObject)
Definition: moniker.c:511
static HRESULT WINAPI RunningObjectTableImpl_EnumRunning(IRunningObjectTable *iface, IEnumMoniker **ppenumMoniker)
Definition: moniker.c:677
static HRESULT WINAPI RunningObjectTableImpl_Revoke(IRunningObjectTable *iface, DWORD dwRegister)
Definition: moniker.c:434
static HRESULT WINAPI RunningObjectTableImpl_Register(IRunningObjectTable *iface, DWORD flags, IUnknown *punkObject, IMoniker *pmkObjectName, DWORD *pdwRegister)
Definition: moniker.c:281
static ULONG WINAPI RunningObjectTableImpl_Release(IRunningObjectTable *iface)
Definition: moniker.c:264
static HRESULT WINAPI RunningObjectTableImpl_NoteChangeTime(IRunningObjectTable *iface, DWORD dwRegister, FILETIME *pfiletime)
Definition: moniker.c:588
static ULONG WINAPI RunningObjectTableImpl_AddRef(IRunningObjectTable *iface)
Definition: moniker.c:257
static HRESULT WINAPI RunningObjectTableImpl_GetTimeOfLastChange(IRunningObjectTable *iface, IMoniker *pmkObjectName, FILETIME *pfiletime)
Definition: moniker.c:625
static HRESULT WINAPI RunningObjectTableImpl_IsRunning(IRunningObjectTable *iface, IMoniker *pmkObjectName)
Definition: moniker.c:465

Definition at line 696 of file moniker.c.