mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 21:36:11 +00:00
revert part of rev 31787 as we don't support IROT in rpcss
fixes FoxitReader, GVIM and many other apps See issue #2361 for more details. svn path=/trunk/; revision=37039
This commit is contained in:
parent
c2a7f9fd0f
commit
a83186227a
2 changed files with 113 additions and 356 deletions
|
@ -19,11 +19,14 @@
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*
|
||||||
|
* TODO:
|
||||||
|
* - IRunningObjectTable should work interprocess, but currently doesn't.
|
||||||
|
* Native (on Win2k at least) uses an undocumented RPC interface, IROT, to
|
||||||
|
* communicate with RPCSS which contains the table of marshalled data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include <assert.h>
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -39,33 +42,25 @@
|
||||||
#include "wine/list.h"
|
#include "wine/list.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
#include "wine/exception.h"
|
|
||||||
|
|
||||||
#include "compobj_private.h"
|
#include "compobj_private.h"
|
||||||
#include "moniker.h"
|
#include "moniker.h"
|
||||||
#include "irot.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||||
|
|
||||||
/* see MSDN docs for IROTData::GetComparisonData, which states what this
|
/* see MSDN docs for IROTData::GetComparisonData, which states what this
|
||||||
* constant is
|
* constant is (http://msdn2.microsoft.com/en-us/library/ms693773.aspx) */
|
||||||
*/
|
|
||||||
#define MAX_COMPARISON_DATA 2048
|
#define MAX_COMPARISON_DATA 2048
|
||||||
|
|
||||||
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
|
|
||||||
{
|
|
||||||
return I_RpcExceptionFilter(eptr->ExceptionRecord->ExceptionCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* define the structure of the running object table elements */
|
/* define the structure of the running object table elements */
|
||||||
struct rot_entry
|
struct rot_entry
|
||||||
{
|
{
|
||||||
struct list entry;
|
struct list entry;
|
||||||
InterfaceData* object; /* marshaled running object*/
|
MInterfacePointer* object; /* marshaled running object*/
|
||||||
MonikerComparisonData* moniker_data; /* moniker comparison data that identifies this object */
|
MInterfacePointer* moniker; /* marshaled moniker that identifies this object */
|
||||||
|
MInterfacePointer* moniker_data; /* moniker comparison data that identifies this object */
|
||||||
DWORD cookie; /* cookie identifying this object */
|
DWORD cookie; /* cookie identifying this object */
|
||||||
FILETIME last_modified;
|
FILETIME last_modified;
|
||||||
IrotContextHandle ctxt_handle;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* define the RunningObjectTableImpl structure */
|
/* define the RunningObjectTableImpl structure */
|
||||||
|
@ -79,7 +74,16 @@ typedef struct RunningObjectTableImpl
|
||||||
} RunningObjectTableImpl;
|
} RunningObjectTableImpl;
|
||||||
|
|
||||||
static RunningObjectTableImpl* runningObjectTableInstance = NULL;
|
static RunningObjectTableImpl* runningObjectTableInstance = NULL;
|
||||||
static IrotHandle irot_handle;
|
|
||||||
|
|
||||||
|
|
||||||
|
static inline HRESULT WINAPI
|
||||||
|
IrotRegister(DWORD *cookie)
|
||||||
|
{
|
||||||
|
static LONG last_cookie = 1;
|
||||||
|
*cookie = InterlockedIncrement(&last_cookie);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* define the EnumMonikerImpl structure */
|
/* define the EnumMonikerImpl structure */
|
||||||
typedef struct EnumMonikerImpl
|
typedef struct EnumMonikerImpl
|
||||||
|
@ -87,79 +91,17 @@ typedef struct EnumMonikerImpl
|
||||||
const IEnumMonikerVtbl *lpVtbl;
|
const IEnumMonikerVtbl *lpVtbl;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
InterfaceList *moniker_list;
|
MInterfacePointer **monikers;
|
||||||
|
ULONG moniker_count;
|
||||||
ULONG pos;
|
ULONG pos;
|
||||||
} EnumMonikerImpl;
|
} EnumMonikerImpl;
|
||||||
|
|
||||||
|
|
||||||
/* IEnumMoniker Local functions*/
|
/* IEnumMoniker Local functions*/
|
||||||
static HRESULT WINAPI EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list,
|
static HRESULT WINAPI EnumMonikerImpl_CreateEnumROTMoniker(MInterfacePointer **monikers,
|
||||||
ULONG pos, IEnumMoniker **ppenumMoniker);
|
ULONG moniker_count, ULONG pos, IEnumMoniker **ppenumMoniker);
|
||||||
|
|
||||||
static IrotHandle get_irot_handle(void)
|
static HRESULT create_stream_on_mip_ro(const MInterfacePointer *mip, IStream **stream)
|
||||||
{
|
|
||||||
if (!irot_handle)
|
|
||||||
{
|
|
||||||
RPC_STATUS status;
|
|
||||||
RPC_WSTR binding;
|
|
||||||
IrotHandle new_handle;
|
|
||||||
unsigned short ncacn_np[] = IROT_PROTSEQ;
|
|
||||||
unsigned short endpoint[] = IROT_ENDPOINT;
|
|
||||||
status = RpcStringBindingComposeW(NULL, ncacn_np, NULL, endpoint, NULL, &binding);
|
|
||||||
if (status == RPC_S_OK)
|
|
||||||
{
|
|
||||||
status = RpcBindingFromStringBindingW(binding, &new_handle);
|
|
||||||
RpcStringFreeW(&binding);
|
|
||||||
}
|
|
||||||
if (status != RPC_S_OK)
|
|
||||||
return NULL;
|
|
||||||
if (InterlockedCompareExchangePointer(&irot_handle, new_handle, NULL))
|
|
||||||
/* another thread beat us to it */
|
|
||||||
RpcBindingFree(&new_handle);
|
|
||||||
}
|
|
||||||
return irot_handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL start_rpcss(void)
|
|
||||||
{
|
|
||||||
PROCESS_INFORMATION pi;
|
|
||||||
STARTUPINFOW si;
|
|
||||||
static WCHAR cmd[6];
|
|
||||||
static const WCHAR rpcss[] = {'r','p','c','s','s',0};
|
|
||||||
BOOL rslt;
|
|
||||||
|
|
||||||
TRACE("\n");
|
|
||||||
|
|
||||||
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
|
|
||||||
ZeroMemory(&si, sizeof(STARTUPINFOA));
|
|
||||||
si.cb = sizeof(STARTUPINFOA);
|
|
||||||
|
|
||||||
memcpy(cmd, rpcss, sizeof(rpcss));
|
|
||||||
|
|
||||||
rslt = CreateProcessW(
|
|
||||||
NULL, /* executable */
|
|
||||||
cmd, /* command line */
|
|
||||||
NULL, /* process security attributes */
|
|
||||||
NULL, /* primary thread security attributes */
|
|
||||||
FALSE, /* inherit handles */
|
|
||||||
0, /* creation flags */
|
|
||||||
NULL, /* use parent's environment */
|
|
||||||
NULL, /* use parent's current directory */
|
|
||||||
&si, /* STARTUPINFO pointer */
|
|
||||||
&pi /* PROCESS_INFORMATION */
|
|
||||||
);
|
|
||||||
|
|
||||||
if (rslt)
|
|
||||||
{
|
|
||||||
CloseHandle(pi.hProcess);
|
|
||||||
CloseHandle(pi.hThread);
|
|
||||||
Sleep(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rslt;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT create_stream_on_mip_ro(const InterfaceData *mip, IStream **stream)
|
|
||||||
{
|
{
|
||||||
HGLOBAL hglobal = GlobalAlloc(0, mip->ulCntData);
|
HGLOBAL hglobal = GlobalAlloc(0, mip->ulCntData);
|
||||||
void *pv = GlobalLock(hglobal);
|
void *pv = GlobalLock(hglobal);
|
||||||
|
@ -170,33 +112,7 @@ static HRESULT create_stream_on_mip_ro(const InterfaceData *mip, IStream **strea
|
||||||
|
|
||||||
static inline void rot_entry_delete(struct rot_entry *rot_entry)
|
static inline void rot_entry_delete(struct rot_entry *rot_entry)
|
||||||
{
|
{
|
||||||
if (rot_entry->cookie)
|
/* FIXME: revoke entry from rpcss's copy of the ROT */
|
||||||
{
|
|
||||||
InterfaceData *object = NULL;
|
|
||||||
InterfaceData *moniker = NULL;
|
|
||||||
__TRY
|
|
||||||
{
|
|
||||||
IrotRevoke(get_irot_handle(), rot_entry->cookie,
|
|
||||||
&rot_entry->ctxt_handle, &object, &moniker);
|
|
||||||
}
|
|
||||||
__EXCEPT(rpc_filter)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
__ENDTRY
|
|
||||||
MIDL_user_free(object);
|
|
||||||
if (moniker)
|
|
||||||
{
|
|
||||||
IStream *stream;
|
|
||||||
HRESULT hr;
|
|
||||||
hr = create_stream_on_mip_ro(moniker, &stream);
|
|
||||||
if (hr == S_OK)
|
|
||||||
{
|
|
||||||
CoReleaseMarshalData(stream);
|
|
||||||
IUnknown_Release(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MIDL_user_free(moniker);
|
|
||||||
}
|
|
||||||
if (rot_entry->object)
|
if (rot_entry->object)
|
||||||
{
|
{
|
||||||
IStream *stream;
|
IStream *stream;
|
||||||
|
@ -208,13 +124,25 @@ static inline void rot_entry_delete(struct rot_entry *rot_entry)
|
||||||
IUnknown_Release(stream);
|
IUnknown_Release(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (rot_entry->moniker)
|
||||||
|
{
|
||||||
|
IStream *stream;
|
||||||
|
HRESULT hr;
|
||||||
|
hr = create_stream_on_mip_ro(rot_entry->moniker, &stream);
|
||||||
|
if (hr == S_OK)
|
||||||
|
{
|
||||||
|
CoReleaseMarshalData(stream);
|
||||||
|
IUnknown_Release(stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, rot_entry->object);
|
HeapFree(GetProcessHeap(), 0, rot_entry->object);
|
||||||
|
HeapFree(GetProcessHeap(), 0, rot_entry->moniker);
|
||||||
HeapFree(GetProcessHeap(), 0, rot_entry->moniker_data);
|
HeapFree(GetProcessHeap(), 0, rot_entry->moniker_data);
|
||||||
HeapFree(GetProcessHeap(), 0, rot_entry);
|
HeapFree(GetProcessHeap(), 0, rot_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* moniker_data must be freed with HeapFree when no longer in use */
|
/* moniker_data must be freed with HeapFree when no longer in use */
|
||||||
static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MonikerComparisonData **moniker_data)
|
static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MInterfacePointer **moniker_data)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IROTData *pROTData = NULL;
|
IROTData *pROTData = NULL;
|
||||||
|
@ -222,14 +150,8 @@ static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MonikerComparison
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
ULONG size = MAX_COMPARISON_DATA;
|
ULONG size = MAX_COMPARISON_DATA;
|
||||||
*moniker_data = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MonikerComparisonData, abData[size]));
|
*moniker_data = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MInterfacePointer, abData[size]));
|
||||||
if (!*moniker_data)
|
|
||||||
{
|
|
||||||
IROTData_Release(pROTData);
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
}
|
|
||||||
hr = IROTData_GetComparisonData(pROTData, (*moniker_data)->abData, size, &size);
|
hr = IROTData_GetComparisonData(pROTData, (*moniker_data)->abData, size, &size);
|
||||||
IROTData_Release(pROTData);
|
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
{
|
{
|
||||||
ERR("Failed to copy comparison data into buffer, hr = 0x%08x\n", hr);
|
ERR("Failed to copy comparison data into buffer, hr = 0x%08x\n", hr);
|
||||||
|
@ -263,7 +185,7 @@ static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MonikerComparison
|
||||||
|
|
||||||
len = strlenW(pszDisplayName);
|
len = strlenW(pszDisplayName);
|
||||||
*moniker_data = HeapAlloc(GetProcessHeap(), 0,
|
*moniker_data = HeapAlloc(GetProcessHeap(), 0,
|
||||||
FIELD_OFFSET(MonikerComparisonData, abData[sizeof(CLSID) + (len+1)*sizeof(WCHAR)]));
|
FIELD_OFFSET(MInterfacePointer, abData[sizeof(CLSID) + (len+1)*sizeof(WCHAR)]));
|
||||||
if (!*moniker_data)
|
if (!*moniker_data)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(pszDisplayName);
|
CoTaskMemFree(pszDisplayName);
|
||||||
|
@ -273,7 +195,6 @@ static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MonikerComparison
|
||||||
|
|
||||||
memcpy(&(*moniker_data)->abData[0], &clsid, sizeof(clsid));
|
memcpy(&(*moniker_data)->abData[0], &clsid, sizeof(clsid));
|
||||||
memcpy(&(*moniker_data)->abData[sizeof(clsid)], pszDisplayName, (len+1)*sizeof(WCHAR));
|
memcpy(&(*moniker_data)->abData[sizeof(clsid)], pszDisplayName, (len+1)*sizeof(WCHAR));
|
||||||
CoTaskMemFree(pszDisplayName);
|
|
||||||
}
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -346,7 +267,6 @@ static HRESULT WINAPI
|
||||||
RunningObjectTableImpl_Destroy(void)
|
RunningObjectTableImpl_Destroy(void)
|
||||||
{
|
{
|
||||||
struct list *cursor, *cursor2;
|
struct list *cursor, *cursor2;
|
||||||
IrotHandle old_handle;
|
|
||||||
|
|
||||||
TRACE("()\n");
|
TRACE("()\n");
|
||||||
|
|
||||||
|
@ -368,11 +288,6 @@ RunningObjectTableImpl_Destroy(void)
|
||||||
HeapFree(GetProcessHeap(),0,runningObjectTableInstance);
|
HeapFree(GetProcessHeap(),0,runningObjectTableInstance);
|
||||||
runningObjectTableInstance = NULL;
|
runningObjectTableInstance = NULL;
|
||||||
|
|
||||||
old_handle = irot_handle;
|
|
||||||
irot_handle = NULL;
|
|
||||||
if (old_handle)
|
|
||||||
RpcBindingFree(&old_handle);
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +341,6 @@ RunningObjectTableImpl_Register(IRunningObjectTable* iface, DWORD grfFlags,
|
||||||
IStream *pStream = NULL;
|
IStream *pStream = NULL;
|
||||||
DWORD mshlflags;
|
DWORD mshlflags;
|
||||||
IBindCtx *pbc;
|
IBindCtx *pbc;
|
||||||
InterfaceData *moniker = NULL;
|
|
||||||
|
|
||||||
TRACE("(%p,%d,%p,%p,%p)\n",This,grfFlags,punkObject,pmkObjectName,pdwRegister);
|
TRACE("(%p,%d,%p,%p,%p)\n",This,grfFlags,punkObject,pmkObjectName,pdwRegister);
|
||||||
|
|
||||||
|
@ -464,7 +378,7 @@ RunningObjectTableImpl_Register(IRunningObjectTable* iface, DWORD grfFlags,
|
||||||
const void *pv = GlobalLock(hglobal);
|
const void *pv = GlobalLock(hglobal);
|
||||||
rot_entry->object = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MInterfacePointer, abData[size]));
|
rot_entry->object = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MInterfacePointer, abData[size]));
|
||||||
rot_entry->object->ulCntData = size;
|
rot_entry->object->ulCntData = size;
|
||||||
memcpy(rot_entry->object->abData, pv, size);
|
memcpy(&rot_entry->object->abData, pv, size);
|
||||||
GlobalUnlock(hglobal);
|
GlobalUnlock(hglobal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -528,9 +442,9 @@ RunningObjectTableImpl_Register(IRunningObjectTable* iface, DWORD grfFlags,
|
||||||
{
|
{
|
||||||
SIZE_T size = GlobalSize(hglobal);
|
SIZE_T size = GlobalSize(hglobal);
|
||||||
const void *pv = GlobalLock(hglobal);
|
const void *pv = GlobalLock(hglobal);
|
||||||
moniker = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(InterfaceData, abData[size]));
|
rot_entry->moniker = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MInterfacePointer, abData[size]));
|
||||||
moniker->ulCntData = size;
|
rot_entry->moniker->ulCntData = size;
|
||||||
memcpy(moniker->abData, pv, size);
|
memcpy(&rot_entry->moniker->abData, pv, size);
|
||||||
GlobalUnlock(hglobal);
|
GlobalUnlock(hglobal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -538,35 +452,13 @@ RunningObjectTableImpl_Register(IRunningObjectTable* iface, DWORD grfFlags,
|
||||||
IMoniker_Release(pmkObjectName);
|
IMoniker_Release(pmkObjectName);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, moniker);
|
|
||||||
rot_entry_delete(rot_entry);
|
rot_entry_delete(rot_entry);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: not the right signature of IrotRegister function */
|
||||||
while (TRUE)
|
hr = IrotRegister(&rot_entry->cookie);
|
||||||
{
|
if (hr != S_OK)
|
||||||
__TRY
|
|
||||||
{
|
|
||||||
hr = IrotRegister(get_irot_handle(), rot_entry->moniker_data,
|
|
||||||
rot_entry->object, moniker,
|
|
||||||
&rot_entry->last_modified, grfFlags,
|
|
||||||
&rot_entry->cookie, &rot_entry->ctxt_handle);
|
|
||||||
}
|
|
||||||
__EXCEPT(rpc_filter)
|
|
||||||
{
|
|
||||||
hr = HRESULT_FROM_WIN32(GetExceptionCode());
|
|
||||||
}
|
|
||||||
__ENDTRY
|
|
||||||
if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE))
|
|
||||||
{
|
|
||||||
if (start_rpcss())
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
HeapFree(GetProcessHeap(), 0, moniker);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
{
|
||||||
rot_entry_delete(rot_entry);
|
rot_entry_delete(rot_entry);
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -576,6 +468,7 @@ RunningObjectTableImpl_Register(IRunningObjectTable* iface, DWORD grfFlags,
|
||||||
*pdwRegister = rot_entry->cookie;
|
*pdwRegister = rot_entry->cookie;
|
||||||
|
|
||||||
EnterCriticalSection(&This->lock);
|
EnterCriticalSection(&This->lock);
|
||||||
|
/* FIXME: see if object was registered before and return MK_S_MONIKERALREADYREGISTERED */
|
||||||
list_add_tail(&This->rot, &rot_entry->entry);
|
list_add_tail(&This->rot, &rot_entry->entry);
|
||||||
LeaveCriticalSection(&This->lock);
|
LeaveCriticalSection(&This->lock);
|
||||||
|
|
||||||
|
@ -623,9 +516,9 @@ static HRESULT WINAPI
|
||||||
RunningObjectTableImpl_IsRunning( IRunningObjectTable* iface, IMoniker *pmkObjectName)
|
RunningObjectTableImpl_IsRunning( IRunningObjectTable* iface, IMoniker *pmkObjectName)
|
||||||
{
|
{
|
||||||
RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
|
RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
|
||||||
MonikerComparisonData *moniker_data;
|
MInterfacePointer *moniker_data;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
const struct rot_entry *rot_entry;
|
struct rot_entry *rot_entry;
|
||||||
|
|
||||||
TRACE("(%p,%p)\n",This,pmkObjectName);
|
TRACE("(%p,%p)\n",This,pmkObjectName);
|
||||||
|
|
||||||
|
@ -639,10 +532,10 @@ RunningObjectTableImpl_IsRunning( IRunningObjectTable* iface, IMoniker *pmkObjec
|
||||||
|
|
||||||
hr = S_FALSE;
|
hr = S_FALSE;
|
||||||
EnterCriticalSection(&This->lock);
|
EnterCriticalSection(&This->lock);
|
||||||
LIST_FOR_EACH_ENTRY(rot_entry, &This->rot, const struct rot_entry, entry)
|
LIST_FOR_EACH_ENTRY(rot_entry, &This->rot, struct rot_entry, entry)
|
||||||
{
|
{
|
||||||
if ((rot_entry->moniker_data->ulCntData == moniker_data->ulCntData) &&
|
if ((rot_entry->moniker_data->ulCntData == moniker_data->ulCntData) &&
|
||||||
!memcmp(moniker_data->abData, rot_entry->moniker_data->abData, moniker_data->ulCntData))
|
!memcmp(&moniker_data->abData, &rot_entry->moniker_data->abData, moniker_data->ulCntData))
|
||||||
{
|
{
|
||||||
hr = S_OK;
|
hr = S_OK;
|
||||||
break;
|
break;
|
||||||
|
@ -650,27 +543,7 @@ RunningObjectTableImpl_IsRunning( IRunningObjectTable* iface, IMoniker *pmkObjec
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&This->lock);
|
LeaveCriticalSection(&This->lock);
|
||||||
|
|
||||||
if (hr == S_FALSE)
|
/* FIXME: call IrotIsRunning */
|
||||||
{
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
__TRY
|
|
||||||
{
|
|
||||||
hr = IrotIsRunning(get_irot_handle(), moniker_data);
|
|
||||||
}
|
|
||||||
__EXCEPT(rpc_filter)
|
|
||||||
{
|
|
||||||
hr = HRESULT_FROM_WIN32(GetExceptionCode());
|
|
||||||
}
|
|
||||||
__ENDTRY
|
|
||||||
if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE))
|
|
||||||
{
|
|
||||||
if (start_rpcss())
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, moniker_data);
|
HeapFree(GetProcessHeap(), 0, moniker_data);
|
||||||
|
|
||||||
|
@ -689,9 +562,7 @@ RunningObjectTableImpl_GetObject( IRunningObjectTable* iface,
|
||||||
IMoniker *pmkObjectName, IUnknown **ppunkObject)
|
IMoniker *pmkObjectName, IUnknown **ppunkObject)
|
||||||
{
|
{
|
||||||
RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
|
RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
|
||||||
MonikerComparisonData *moniker_data;
|
MInterfacePointer *moniker_data;
|
||||||
InterfaceData *object = NULL;
|
|
||||||
IrotCookie cookie;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
struct rot_entry *rot_entry;
|
struct rot_entry *rot_entry;
|
||||||
|
|
||||||
|
@ -714,7 +585,7 @@ RunningObjectTableImpl_GetObject( IRunningObjectTable* iface,
|
||||||
LIST_FOR_EACH_ENTRY(rot_entry, &This->rot, struct rot_entry, entry)
|
LIST_FOR_EACH_ENTRY(rot_entry, &This->rot, struct rot_entry, entry)
|
||||||
{
|
{
|
||||||
if ((rot_entry->moniker_data->ulCntData == moniker_data->ulCntData) &&
|
if ((rot_entry->moniker_data->ulCntData == moniker_data->ulCntData) &&
|
||||||
!memcmp(moniker_data->abData, rot_entry->moniker_data->abData, moniker_data->ulCntData))
|
!memcmp(&moniker_data->abData, &rot_entry->moniker_data->abData, moniker_data->ulCntData))
|
||||||
{
|
{
|
||||||
IStream *pStream;
|
IStream *pStream;
|
||||||
hr = create_stream_on_mip_ro(rot_entry->object, &pStream);
|
hr = create_stream_on_mip_ro(rot_entry->object, &pStream);
|
||||||
|
@ -732,39 +603,9 @@ RunningObjectTableImpl_GetObject( IRunningObjectTable* iface,
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&This->lock);
|
LeaveCriticalSection(&This->lock);
|
||||||
|
|
||||||
TRACE("moniker unavailable locally, calling SCM\n");
|
/* FIXME: call IrotGetObject */
|
||||||
|
WARN("Moniker unavailable - app may require interprocess running object table\n");
|
||||||
while (TRUE)
|
hr = MK_E_UNAVAILABLE;
|
||||||
{
|
|
||||||
__TRY
|
|
||||||
{
|
|
||||||
hr = IrotGetObject(get_irot_handle(), moniker_data, &object, &cookie);
|
|
||||||
}
|
|
||||||
__EXCEPT(rpc_filter)
|
|
||||||
{
|
|
||||||
hr = HRESULT_FROM_WIN32(GetExceptionCode());
|
|
||||||
}
|
|
||||||
__ENDTRY
|
|
||||||
if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE))
|
|
||||||
{
|
|
||||||
if (start_rpcss())
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
IStream *pStream;
|
|
||||||
hr = create_stream_on_mip_ro(object, &pStream);
|
|
||||||
if (hr == S_OK)
|
|
||||||
{
|
|
||||||
hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)ppunkObject);
|
|
||||||
IStream_Release(pStream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
WARN("Moniker unavailable, IrotGetObject returned 0x%08x\n", hr);
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, moniker_data);
|
HeapFree(GetProcessHeap(), 0, moniker_data);
|
||||||
|
|
||||||
|
@ -784,7 +625,6 @@ RunningObjectTableImpl_NoteChangeTime(IRunningObjectTable* iface,
|
||||||
{
|
{
|
||||||
RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
|
RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
|
||||||
struct rot_entry *rot_entry;
|
struct rot_entry *rot_entry;
|
||||||
HRESULT hr = E_INVALIDARG;
|
|
||||||
|
|
||||||
TRACE("(%p,%d,%p)\n",This,dwRegister,pfiletime);
|
TRACE("(%p,%d,%p)\n",This,dwRegister,pfiletime);
|
||||||
|
|
||||||
|
@ -795,34 +635,14 @@ RunningObjectTableImpl_NoteChangeTime(IRunningObjectTable* iface,
|
||||||
{
|
{
|
||||||
rot_entry->last_modified = *pfiletime;
|
rot_entry->last_modified = *pfiletime;
|
||||||
LeaveCriticalSection(&This->lock);
|
LeaveCriticalSection(&This->lock);
|
||||||
|
return S_OK;
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
__TRY
|
|
||||||
{
|
|
||||||
hr = IrotNoteChangeTime(get_irot_handle(), dwRegister, pfiletime);
|
|
||||||
}
|
|
||||||
__EXCEPT(rpc_filter)
|
|
||||||
{
|
|
||||||
hr = HRESULT_FROM_WIN32(GetExceptionCode());
|
|
||||||
}
|
|
||||||
__ENDTRY
|
|
||||||
if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE))
|
|
||||||
{
|
|
||||||
if (start_rpcss())
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
goto done;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&This->lock);
|
LeaveCriticalSection(&This->lock);
|
||||||
|
|
||||||
done:
|
/* FIXME: call IrotNoteChangeTime */
|
||||||
TRACE("-- 0x08%x\n", hr);
|
|
||||||
return hr;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -838,8 +658,8 @@ RunningObjectTableImpl_GetTimeOfLastChange(IRunningObjectTable* iface,
|
||||||
{
|
{
|
||||||
HRESULT hr = MK_E_UNAVAILABLE;
|
HRESULT hr = MK_E_UNAVAILABLE;
|
||||||
RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
|
RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
|
||||||
MonikerComparisonData *moniker_data;
|
MInterfacePointer *moniker_data;
|
||||||
const struct rot_entry *rot_entry;
|
struct rot_entry *rot_entry;
|
||||||
|
|
||||||
TRACE("(%p,%p,%p)\n",This,pmkObjectName,pfiletime);
|
TRACE("(%p,%p,%p)\n",This,pmkObjectName,pfiletime);
|
||||||
|
|
||||||
|
@ -857,10 +677,10 @@ RunningObjectTableImpl_GetTimeOfLastChange(IRunningObjectTable* iface,
|
||||||
hr = MK_E_UNAVAILABLE;
|
hr = MK_E_UNAVAILABLE;
|
||||||
|
|
||||||
EnterCriticalSection(&This->lock);
|
EnterCriticalSection(&This->lock);
|
||||||
LIST_FOR_EACH_ENTRY(rot_entry, &This->rot, const struct rot_entry, entry)
|
LIST_FOR_EACH_ENTRY(rot_entry, &This->rot, struct rot_entry, entry)
|
||||||
{
|
{
|
||||||
if ((rot_entry->moniker_data->ulCntData == moniker_data->ulCntData) &&
|
if ((rot_entry->moniker_data->ulCntData == moniker_data->ulCntData) &&
|
||||||
!memcmp(moniker_data->abData, rot_entry->moniker_data->abData, moniker_data->ulCntData))
|
!memcmp(&moniker_data->abData, &rot_entry->moniker_data->abData, moniker_data->ulCntData))
|
||||||
{
|
{
|
||||||
*pfiletime = rot_entry->last_modified;
|
*pfiletime = rot_entry->last_modified;
|
||||||
hr = S_OK;
|
hr = S_OK;
|
||||||
|
@ -869,31 +689,9 @@ RunningObjectTableImpl_GetTimeOfLastChange(IRunningObjectTable* iface,
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&This->lock);
|
LeaveCriticalSection(&This->lock);
|
||||||
|
|
||||||
if (hr != S_OK)
|
/* FIXME: if (hr != S_OK) call IrotGetTimeOfLastChange */
|
||||||
{
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
__TRY
|
|
||||||
{
|
|
||||||
hr = IrotGetTimeOfLastChange(get_irot_handle(), moniker_data, pfiletime);
|
|
||||||
}
|
|
||||||
__EXCEPT(rpc_filter)
|
|
||||||
{
|
|
||||||
hr = HRESULT_FROM_WIN32(GetExceptionCode());
|
|
||||||
}
|
|
||||||
__ENDTRY
|
|
||||||
if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE))
|
|
||||||
{
|
|
||||||
if (start_rpcss())
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, moniker_data);
|
HeapFree(GetProcessHeap(), 0, moniker_data);
|
||||||
|
|
||||||
TRACE("-- 0x%08x\n", hr);
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -907,36 +705,33 @@ static HRESULT WINAPI
|
||||||
RunningObjectTableImpl_EnumRunning(IRunningObjectTable* iface,
|
RunningObjectTableImpl_EnumRunning(IRunningObjectTable* iface,
|
||||||
IEnumMoniker **ppenumMoniker)
|
IEnumMoniker **ppenumMoniker)
|
||||||
{
|
{
|
||||||
RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
|
|
||||||
InterfaceList *interface_list = NULL;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
|
||||||
|
MInterfacePointer **monikers;
|
||||||
|
ULONG moniker_count = 0;
|
||||||
|
const struct rot_entry *rot_entry;
|
||||||
|
ULONG i = 0;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", This, ppenumMoniker);
|
EnterCriticalSection(&This->lock);
|
||||||
|
|
||||||
*ppenumMoniker = NULL;
|
LIST_FOR_EACH_ENTRY( rot_entry, &This->rot, const struct rot_entry, entry )
|
||||||
|
moniker_count++;
|
||||||
|
|
||||||
while (TRUE)
|
monikers = HeapAlloc(GetProcessHeap(), 0, moniker_count * sizeof(*monikers));
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY( rot_entry, &This->rot, const struct rot_entry, entry )
|
||||||
{
|
{
|
||||||
__TRY
|
SIZE_T size = FIELD_OFFSET(MInterfacePointer, abData[rot_entry->moniker->ulCntData]);
|
||||||
{
|
monikers[i] = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
hr = IrotEnumRunning(get_irot_handle(), &interface_list);
|
memcpy(monikers[i], rot_entry->moniker, size);
|
||||||
}
|
i++;
|
||||||
__EXCEPT(rpc_filter)
|
|
||||||
{
|
|
||||||
hr = HRESULT_FROM_WIN32(GetExceptionCode());
|
|
||||||
}
|
|
||||||
__ENDTRY
|
|
||||||
if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE))
|
|
||||||
{
|
|
||||||
if (start_rpcss())
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
LeaveCriticalSection(&This->lock);
|
||||||
hr = EnumMonikerImpl_CreateEnumROTMoniker(interface_list,
|
|
||||||
0, ppenumMoniker);
|
/* FIXME: call IrotEnumRunning and append data */
|
||||||
|
|
||||||
|
hr = EnumMonikerImpl_CreateEnumROTMoniker(monikers, moniker_count, 0, ppenumMoniker);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -972,9 +767,9 @@ HRESULT WINAPI RunningObjectTableImpl_Initialize(void)
|
||||||
/* initialize the virtual table function */
|
/* initialize the virtual table function */
|
||||||
runningObjectTableInstance->lpVtbl = &VT_RunningObjectTableImpl;
|
runningObjectTableInstance->lpVtbl = &VT_RunningObjectTableImpl;
|
||||||
|
|
||||||
/* the initial reference is set to "1" so that it isn't destroyed after its
|
/* the initial reference is set to "1" ! because if set to "0" it will be not practis when */
|
||||||
* first use until the process is destroyed, as the running object table is
|
/* the ROT referred many times not in the same time (all the objects in the ROT will */
|
||||||
* a process-wide cache of a global table */
|
/* be removed every time the ROT is removed ) */
|
||||||
runningObjectTableInstance->ref = 1;
|
runningObjectTableInstance->ref = 1;
|
||||||
|
|
||||||
list_init(&runningObjectTableInstance->rot);
|
list_init(&runningObjectTableInstance->rot);
|
||||||
|
@ -1078,21 +873,6 @@ static HRESULT get_moniker_for_progid_display_name(LPBC pbc,
|
||||||
IParseDisplayName *pdn;
|
IParseDisplayName *pdn;
|
||||||
hr = IMoniker_BindToObject(class_moniker, pbc, NULL,
|
hr = IMoniker_BindToObject(class_moniker, pbc, NULL,
|
||||||
&IID_IParseDisplayName, (void **)&pdn);
|
&IID_IParseDisplayName, (void **)&pdn);
|
||||||
/* fallback to using IClassFactory to get IParseDisplayName -
|
|
||||||
* adsldp.dll depends on this */
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
IClassFactory *pcf;
|
|
||||||
hr = IMoniker_BindToObject(class_moniker, pbc, NULL,
|
|
||||||
&IID_IClassFactory, (void **)&pcf);
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
hr = IClassFactory_CreateInstance(pcf, NULL,
|
|
||||||
&IID_IParseDisplayName,
|
|
||||||
(void **)&pdn);
|
|
||||||
IClassFactory_Release(pcf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
IMoniker_Release(class_moniker);
|
IMoniker_Release(class_moniker);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
|
@ -1211,9 +991,9 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
/* If the file is not a storage object then attempt to match various bits in the file against a
|
/* if the file is not a storage object then attemps to match various bits in the file against a
|
||||||
pattern in the registry. This case is not frequently used, so I present only the pseudocode for
|
pattern in the registry. this case is not frequently used ! so I present only the psodocode for
|
||||||
this case.
|
this case
|
||||||
|
|
||||||
for(i=0;i<nFileTypes;i++)
|
for(i=0;i<nFileTypes;i++)
|
||||||
|
|
||||||
|
@ -1240,7 +1020,7 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
|
||||||
nbElm=FileMonikerImpl_DecomposePath(filePathName,&pathDec);
|
nbElm=FileMonikerImpl_DecomposePath(filePathName,&pathDec);
|
||||||
absFile=pathDec[nbElm-1];
|
absFile=pathDec[nbElm-1];
|
||||||
|
|
||||||
/* failed if the path represents a directory and not an absolute file name*/
|
/* failed if the path represente a directory and not an absolute file name*/
|
||||||
if (!lstrcmpW(absFile, bkslashW))
|
if (!lstrcmpW(absFile, bkslashW))
|
||||||
return MK_E_INVALIDEXTENSION;
|
return MK_E_INVALIDEXTENSION;
|
||||||
|
|
||||||
|
@ -1335,9 +1115,9 @@ static ULONG WINAPI EnumMonikerImpl_Release(IEnumMoniker* iface)
|
||||||
|
|
||||||
TRACE("(%p) Deleting\n",This);
|
TRACE("(%p) Deleting\n",This);
|
||||||
|
|
||||||
for (i = 0; i < This->moniker_list->size; i++)
|
for (i = 0; i < This->moniker_count; i++)
|
||||||
HeapFree(GetProcessHeap(), 0, This->moniker_list->interfaces[i]);
|
HeapFree(GetProcessHeap(), 0, This->monikers[i]);
|
||||||
HeapFree(GetProcessHeap(), 0, This->moniker_list);
|
HeapFree(GetProcessHeap(), 0, This->monikers);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1352,13 +1132,13 @@ static HRESULT WINAPI EnumMonikerImpl_Next(IEnumMoniker* iface, ULONG celt, IM
|
||||||
EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
|
EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
TRACE("(%p) TabCurrentPos %d Tablastindx %d\n", This, This->pos, This->moniker_list->size);
|
TRACE("(%p) TabCurrentPos %d Tablastindx %d\n", This, This->pos, This->moniker_count);
|
||||||
|
|
||||||
/* retrieve the requested number of moniker from the current position */
|
/* retrieve the requested number of moniker from the current position */
|
||||||
for(i = 0; (This->pos < This->moniker_list->size) && (i < celt); i++)
|
for(i = 0; (This->pos < This->moniker_count) && (i < celt); i++)
|
||||||
{
|
{
|
||||||
IStream *stream;
|
IStream *stream;
|
||||||
hr = create_stream_on_mip_ro(This->moniker_list->interfaces[This->pos++], &stream);
|
hr = create_stream_on_mip_ro(This->monikers[This->pos++], &stream);
|
||||||
if (hr != S_OK) break;
|
if (hr != S_OK) break;
|
||||||
hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&rgelt[i]);
|
hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&rgelt[i]);
|
||||||
IStream_Release(stream);
|
IStream_Release(stream);
|
||||||
|
@ -1387,7 +1167,7 @@ static HRESULT WINAPI EnumMonikerImpl_Skip(IEnumMoniker* iface, ULONG celt)
|
||||||
|
|
||||||
TRACE("(%p)\n",This);
|
TRACE("(%p)\n",This);
|
||||||
|
|
||||||
if (This->pos + celt >= This->moniker_list->size)
|
if (This->pos + celt >= This->moniker_count)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
This->pos += celt;
|
This->pos += celt;
|
||||||
|
@ -1415,35 +1195,21 @@ static HRESULT WINAPI EnumMonikerImpl_Reset(IEnumMoniker* iface)
|
||||||
static HRESULT WINAPI EnumMonikerImpl_Clone(IEnumMoniker* iface, IEnumMoniker ** ppenum)
|
static HRESULT WINAPI EnumMonikerImpl_Clone(IEnumMoniker* iface, IEnumMoniker ** ppenum)
|
||||||
{
|
{
|
||||||
EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
|
EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
|
||||||
InterfaceList *moniker_list;
|
MInterfacePointer **monikers = HeapAlloc(GetProcessHeap(), 0, sizeof(*monikers)*This->moniker_count);
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
TRACE("(%p)\n",This);
|
TRACE("(%p)\n",This);
|
||||||
|
|
||||||
*ppenum = NULL;
|
for (i = 0; i < This->moniker_count; i++)
|
||||||
|
|
||||||
moniker_list = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(InterfaceList, interfaces[This->moniker_list->size]));
|
|
||||||
if (!moniker_list)
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
|
|
||||||
moniker_list->size = This->moniker_list->size;
|
|
||||||
for (i = 0; i < This->moniker_list->size; i++)
|
|
||||||
{
|
{
|
||||||
SIZE_T size = FIELD_OFFSET(InterfaceData, abData[This->moniker_list->interfaces[i]->ulCntData]);
|
SIZE_T size = FIELD_OFFSET(MInterfacePointer, abData[This->monikers[i]->ulCntData]);
|
||||||
moniker_list->interfaces[i] = HeapAlloc(GetProcessHeap(), 0, size);
|
monikers[i] = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
if (!moniker_list->interfaces[i])
|
memcpy(monikers[i], This->monikers[i], size);
|
||||||
{
|
|
||||||
ULONG end = i;
|
|
||||||
for (i = 0; i < end; i++)
|
|
||||||
HeapFree(GetProcessHeap(), 0, moniker_list->interfaces[i]);
|
|
||||||
HeapFree(GetProcessHeap(), 0, moniker_list);
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
}
|
|
||||||
memcpy(moniker_list->interfaces[i], This->moniker_list->interfaces[i], size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the enum structure */
|
/* copy the enum structure */
|
||||||
return EnumMonikerImpl_CreateEnumROTMoniker(moniker_list, This->pos, ppenum);
|
return EnumMonikerImpl_CreateEnumROTMoniker(monikers, This->moniker_count,
|
||||||
|
This->pos, ppenum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Virtual function table for the IEnumMoniker class. */
|
/* Virtual function table for the IEnumMoniker class. */
|
||||||
|
@ -1463,7 +1229,8 @@ static const IEnumMonikerVtbl VT_EnumMonikerImpl =
|
||||||
* Used by EnumRunning to create the structure and EnumClone
|
* Used by EnumRunning to create the structure and EnumClone
|
||||||
* to copy the structure
|
* to copy the structure
|
||||||
*/
|
*/
|
||||||
static HRESULT WINAPI EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list,
|
static HRESULT WINAPI EnumMonikerImpl_CreateEnumROTMoniker(MInterfacePointer **monikers,
|
||||||
|
ULONG moniker_count,
|
||||||
ULONG current_pos,
|
ULONG current_pos,
|
||||||
IEnumMoniker **ppenumMoniker)
|
IEnumMoniker **ppenumMoniker)
|
||||||
{
|
{
|
||||||
|
@ -1483,7 +1250,8 @@ static HRESULT WINAPI EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *monike
|
||||||
/* the initial reference is set to "1" */
|
/* the initial reference is set to "1" */
|
||||||
This->ref = 1; /* set the ref count to one */
|
This->ref = 1; /* set the ref count to one */
|
||||||
This->pos = current_pos; /* Set the list start posn */
|
This->pos = current_pos; /* Set the list start posn */
|
||||||
This->moniker_list = moniker_list;
|
This->moniker_count = moniker_count; /* Need the same size table as ROT */
|
||||||
|
This->monikers = monikers;
|
||||||
|
|
||||||
*ppenumMoniker = (IEnumMoniker*)This;
|
*ppenumMoniker = (IEnumMoniker*)This;
|
||||||
|
|
||||||
|
@ -1659,13 +1427,3 @@ HRESULT MonikerMarshal_Create(IMoniker *inner, IUnknown **outer)
|
||||||
*outer = (IUnknown *)&This->lpVtbl;
|
*outer = (IUnknown *)&This->lpVtbl;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * __RPC_USER MIDL_user_allocate(size_t size)
|
|
||||||
{
|
|
||||||
return HeapAlloc(GetProcessHeap(), 0, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void __RPC_USER MIDL_user_free(void *p)
|
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(), 0, p);
|
|
||||||
}
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>user32</library>
|
<library>user32</library>
|
||||||
<library>gdi32</library>
|
<library>gdi32</library>
|
||||||
<library>ole32_irot_client</library>
|
|
||||||
<library>ole32_proxy</library>
|
<library>ole32_proxy</library>
|
||||||
<library>rpcrt4</library>
|
<library>rpcrt4</library>
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue