mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 18:56:48 +00:00
[OLEAUT32]
* Sync with Wine 1.5.26. svn path=/trunk/; revision=58588
This commit is contained in:
parent
a85aee22bc
commit
a6c07ee5d8
14 changed files with 300 additions and 184 deletions
|
@ -19,6 +19,6 @@
|
|||
#ifndef _CONNPT_H
|
||||
#define _CONNPT_H
|
||||
|
||||
HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid, IConnectionPoint **pCP);
|
||||
HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid, IConnectionPoint **pCP) DECLSPEC_HIDDEN;
|
||||
|
||||
#endif /* _CONNPT_H */
|
||||
|
|
|
@ -93,14 +93,15 @@ typedef struct {
|
|||
} u;
|
||||
} bstr_t;
|
||||
|
||||
#define BUCKET_SIZE 16
|
||||
#define BUCKET_BUFFER_SIZE 6
|
||||
|
||||
typedef struct {
|
||||
unsigned short head;
|
||||
unsigned short cnt;
|
||||
bstr_t *buf[6];
|
||||
bstr_t *buf[BUCKET_BUFFER_SIZE];
|
||||
} bstr_cache_entry_t;
|
||||
|
||||
#define BUCKET_SIZE 16
|
||||
|
||||
#define ARENA_INUSE_FILLER 0x55
|
||||
#define ARENA_TAIL_FILLER 0xab
|
||||
#define ARENA_FREE_FILLER 0xfeeefeee
|
||||
|
@ -141,7 +142,7 @@ static bstr_t *alloc_bstr(size_t size)
|
|||
|
||||
if(cache_entry) {
|
||||
ret = cache_entry->buf[cache_entry->head++];
|
||||
cache_entry->head %= sizeof(cache_entry->buf)/sizeof(*cache_entry->buf);
|
||||
cache_entry->head %= BUCKET_BUFFER_SIZE;
|
||||
cache_entry->cnt--;
|
||||
}
|
||||
|
||||
|
@ -260,14 +261,26 @@ void WINAPI SysFreeString(BSTR str)
|
|||
bstr = bstr_from_str(str);
|
||||
cache_entry = get_cache_entry(bstr->size+sizeof(WCHAR));
|
||||
if(cache_entry) {
|
||||
unsigned i;
|
||||
|
||||
EnterCriticalSection(&cs_bstr_cache);
|
||||
|
||||
/* According to tests, freeing a string that's already in cache doesn't corrupt anything.
|
||||
* For that to work we need to search the cache. */
|
||||
for(i=0; i < cache_entry->cnt; i++) {
|
||||
if(cache_entry->buf[(cache_entry->head+i) % BUCKET_BUFFER_SIZE] == bstr) {
|
||||
WARN_(heap)("String already is in cache!\n");
|
||||
LeaveCriticalSection(&cs_bstr_cache);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(cache_entry->cnt < sizeof(cache_entry->buf)/sizeof(*cache_entry->buf)) {
|
||||
cache_entry->buf[(cache_entry->head+cache_entry->cnt)%((sizeof(cache_entry->buf)/sizeof(*cache_entry->buf)))] = bstr;
|
||||
cache_entry->buf[(cache_entry->head+cache_entry->cnt) % BUCKET_BUFFER_SIZE] = bstr;
|
||||
cache_entry->cnt++;
|
||||
|
||||
if(WARN_ON(heap)) {
|
||||
unsigned i, n = bstr_alloc_size(bstr->size) / sizeof(DWORD) - 1;
|
||||
unsigned n = bstr_alloc_size(bstr->size) / sizeof(DWORD) - 1;
|
||||
bstr->size = ARENA_FREE_FILLER;
|
||||
for(i=0; i<n; i++)
|
||||
bstr->u.dwptr[i] = ARENA_FREE_FILLER;
|
||||
|
|
|
@ -1423,8 +1423,8 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface, IStream *pStm)
|
|||
} while (!headerisdata);
|
||||
|
||||
if (statfailed) { /* we don't know the size ... read all we get */
|
||||
int sizeinc = 4096;
|
||||
int origsize = sizeinc;
|
||||
unsigned int sizeinc = 4096;
|
||||
unsigned int origsize = sizeinc;
|
||||
ULONG nread = 42;
|
||||
|
||||
TRACE("Reading all data from stream.\n");
|
||||
|
|
|
@ -143,7 +143,7 @@ static HRESULT WINAPI PropertyPageSite_TranslateAccelerator(
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
IPropertyPageSiteVtbl PropertyPageSiteVtbl = {
|
||||
static IPropertyPageSiteVtbl PropertyPageSiteVtbl = {
|
||||
PropertyPageSite_QueryInterface,
|
||||
PropertyPageSite_AddRef,
|
||||
PropertyPageSite_Release,
|
||||
|
@ -171,7 +171,7 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect(LPOCPFIPARAMS lpParams)
|
|||
IPropertyPage **property_page;
|
||||
PropertyPageSite *property_page_site;
|
||||
HRESULT res;
|
||||
int i;
|
||||
ULONG i;
|
||||
HMODULE hcomctl;
|
||||
HRSRC property_sheet_dialog_find = NULL;
|
||||
HGLOBAL property_sheet_dialog_load = NULL;
|
||||
|
|
|
@ -619,7 +619,7 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
|
|||
ret->name = NULL;
|
||||
}
|
||||
|
||||
ret->fields = HeapAlloc(GetProcessHeap(), 0, ret->n_vars*sizeof(VARDESC));
|
||||
ret->fields = HeapAlloc(GetProcessHeap(), 0, ret->n_vars*sizeof(fieldstr));
|
||||
for(i = 0; i<ret->n_vars; i++) {
|
||||
VARDESC *vardesc;
|
||||
hres = ITypeInfo_GetVarDesc(pTypeInfo, i, &vardesc);
|
||||
|
|
|
@ -137,29 +137,29 @@ _unmarshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN *pUnk) {
|
|||
DWORD xsize;
|
||||
|
||||
TRACE("...%s...\n",debugstr_guid(riid));
|
||||
|
||||
|
||||
*pUnk = NULL;
|
||||
hres = xbuf_get(buf,(LPBYTE)&xsize,sizeof(xsize));
|
||||
if (hres) {
|
||||
ERR("xbuf_get failed\n");
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
if (xsize == 0) return S_OK;
|
||||
|
||||
|
||||
hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
|
||||
if (hres) {
|
||||
ERR("Stream create failed %x\n",hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
hres = IStream_Write(pStm,buf->base+buf->curoff,xsize,&res);
|
||||
if (hres) {
|
||||
ERR("stream write %x\n",hres);
|
||||
IStream_Release(pStm);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
memset(&seekto,0,sizeof(seekto));
|
||||
hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos);
|
||||
if (hres) {
|
||||
|
@ -167,14 +167,14 @@ _unmarshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN *pUnk) {
|
|||
IStream_Release(pStm);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
hres = CoUnmarshalInterface(pStm,riid,(LPVOID*)pUnk);
|
||||
if (hres) {
|
||||
ERR("Unmarshalling interface %s failed with %x\n",debugstr_guid(riid),hres);
|
||||
IStream_Release(pStm);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
IStream_Release(pStm);
|
||||
return xbuf_skip(buf,xsize);
|
||||
}
|
||||
|
@ -204,25 +204,25 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
|
|||
hres = E_FAIL;
|
||||
|
||||
TRACE("...%s...\n",debugstr_guid(riid));
|
||||
|
||||
|
||||
hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
|
||||
if (hres) {
|
||||
ERR("Stream create failed %x\n",hres);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
hres = CoMarshalInterface(pStm,riid,pUnk,0,NULL,0);
|
||||
if (hres) {
|
||||
ERR("Marshalling interface %s failed with %x\n", debugstr_guid(riid), hres);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
hres = IStream_Stat(pStm,&ststg,STATFLAG_NONAME);
|
||||
if (hres) {
|
||||
ERR("Stream stat failed\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
tempbuf = HeapAlloc(GetProcessHeap(), 0, ststg.cbSize.u.LowPart);
|
||||
memset(&seekto,0,sizeof(seekto));
|
||||
hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos);
|
||||
|
@ -230,22 +230,22 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
|
|||
ERR("Failed Seek %x\n",hres);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
hres = IStream_Read(pStm,tempbuf,ststg.cbSize.u.LowPart,&res);
|
||||
if (hres) {
|
||||
ERR("Failed Read %x\n",hres);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
xsize = ststg.cbSize.u.LowPart;
|
||||
xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize));
|
||||
hres = xbuf_add(buf,tempbuf,ststg.cbSize.u.LowPart);
|
||||
|
||||
|
||||
HeapFree(GetProcessHeap(),0,tempbuf);
|
||||
IStream_Release(pStm);
|
||||
|
||||
|
||||
return hres;
|
||||
|
||||
|
||||
fail:
|
||||
xsize = 0;
|
||||
xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize));
|
||||
|
@ -412,15 +412,15 @@ static HRESULT num_of_funcs(ITypeInfo *tinfo, unsigned int *num,
|
|||
#include "pshpack1.h"
|
||||
|
||||
typedef struct _TMAsmProxy {
|
||||
BYTE popleax;
|
||||
DWORD lealeax;
|
||||
BYTE pushleax;
|
||||
BYTE pushlval;
|
||||
DWORD nr;
|
||||
BYTE pushleax;
|
||||
BYTE lcall;
|
||||
DWORD xcall;
|
||||
BYTE lret;
|
||||
WORD bytestopop;
|
||||
BYTE nop;
|
||||
WORD nop;
|
||||
} TMAsmProxy;
|
||||
|
||||
#include "poppack.h"
|
||||
|
@ -1216,7 +1216,7 @@ deserialize_param(
|
|||
);
|
||||
return S_OK;
|
||||
}
|
||||
case VT_SAFEARRAY: {
|
||||
case VT_SAFEARRAY: {
|
||||
if (readit)
|
||||
{
|
||||
ULONG flags = MAKELONG(MSHCTX_DIFFERENTMACHINE, NDR_LOCAL_DATA_REPRESENTATION);
|
||||
|
@ -1338,13 +1338,13 @@ static inline BOOL is_out_elem(const ELEMDESC *elem)
|
|||
return (elem->u.paramdesc.wParamFlags & PARAMFLAG_FOUT || !elem->u.paramdesc.wParamFlags);
|
||||
}
|
||||
|
||||
static DWORD
|
||||
xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
||||
static DWORD WINAPI xCall(int method, void **args)
|
||||
{
|
||||
DWORD *args = ((DWORD*)&tpinfo)+1, *xargs;
|
||||
TMProxyImpl *tpinfo = args[0];
|
||||
DWORD *xargs;
|
||||
const FUNCDESC *fdesc;
|
||||
HRESULT hres;
|
||||
int i, relaydeb = TRACE_ON(olerelay);
|
||||
int i;
|
||||
marshal_state buf;
|
||||
RPCOLEMESSAGE msg;
|
||||
ULONG status;
|
||||
|
@ -1376,7 +1376,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
|||
|
||||
LeaveCriticalSection(&tpinfo->crit);
|
||||
|
||||
if (relaydeb) {
|
||||
if (TRACE_ON(olerelay)) {
|
||||
TRACE_(olerelay)("->");
|
||||
if (iname)
|
||||
TRACE_(olerelay)("%s:",relaystr(iname));
|
||||
|
@ -1401,10 +1401,10 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
|||
if (nrofnames > sizeof(names)/sizeof(names[0]))
|
||||
ERR("Need more names!\n");
|
||||
|
||||
xargs = args;
|
||||
xargs = (DWORD *)(args + 1);
|
||||
for (i=0;i<fdesc->cParams;i++) {
|
||||
ELEMDESC *elem = fdesc->lprgelemdescParam+i;
|
||||
if (relaydeb) {
|
||||
if (TRACE_ON(olerelay)) {
|
||||
if (i) TRACE_(olerelay)(",");
|
||||
if (i+1<nrofnames && names[i+1])
|
||||
TRACE_(olerelay)("%s=",relaystr(names[i+1]));
|
||||
|
@ -1415,7 +1415,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
|||
if (elem->tdesc.vt != VT_PTR)
|
||||
{
|
||||
xargs+=_argsize(&elem->tdesc, tinfo);
|
||||
if (relaydeb) TRACE_(olerelay)("[out]");
|
||||
TRACE_(olerelay)("[out]");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
@ -1427,7 +1427,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
|||
hres = serialize_param(
|
||||
tinfo,
|
||||
is_in_elem(elem),
|
||||
relaydeb,
|
||||
TRACE_ON(olerelay),
|
||||
FALSE,
|
||||
&elem->tdesc,
|
||||
xargs,
|
||||
|
@ -1440,7 +1440,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
|||
}
|
||||
xargs+=_argsize(&elem->tdesc, tinfo);
|
||||
}
|
||||
if (relaydeb) TRACE_(olerelay)(")");
|
||||
TRACE_(olerelay)(")");
|
||||
|
||||
memset(&msg,0,sizeof(msg));
|
||||
msg.cbBuffer = buf.curoff;
|
||||
|
@ -1451,14 +1451,14 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
|||
goto exit;
|
||||
}
|
||||
memcpy(msg.Buffer,buf.base,buf.curoff);
|
||||
if (relaydeb) TRACE_(olerelay)("\n");
|
||||
TRACE_(olerelay)("\n");
|
||||
hres = IRpcChannelBuffer_SendReceive(chanbuf,&msg,&status);
|
||||
if (hres) {
|
||||
ERR("RpcChannelBuffer SendReceive failed, %x\n",hres);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (relaydeb) TRACE_(olerelay)(" status = %08x (",status);
|
||||
TRACE_(olerelay)(" status = %08x (",status);
|
||||
if (buf.base)
|
||||
buf.base = HeapReAlloc(GetProcessHeap(),0,buf.base,msg.cbBuffer);
|
||||
else
|
||||
|
@ -1468,25 +1468,24 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
|||
buf.curoff = 0;
|
||||
|
||||
/* generic deserializer using typelib description */
|
||||
xargs = args;
|
||||
xargs = (DWORD *)(args + 1);
|
||||
status = S_OK;
|
||||
for (i=0;i<fdesc->cParams;i++) {
|
||||
ELEMDESC *elem = fdesc->lprgelemdescParam+i;
|
||||
|
||||
if (relaydeb) {
|
||||
if (i) TRACE_(olerelay)(",");
|
||||
if (i+1<nrofnames && names[i+1]) TRACE_(olerelay)("%s=",relaystr(names[i+1]));
|
||||
}
|
||||
if (i) TRACE_(olerelay)(",");
|
||||
if (i+1<nrofnames && names[i+1]) TRACE_(olerelay)("%s=",relaystr(names[i+1]));
|
||||
|
||||
/* No need to marshal other data than FOUT and any VT_PTR */
|
||||
if (!is_out_elem(elem) && (elem->tdesc.vt != VT_PTR)) {
|
||||
xargs += _argsize(&elem->tdesc, tinfo);
|
||||
if (relaydeb) TRACE_(olerelay)("[in]");
|
||||
TRACE_(olerelay)("[in]");
|
||||
continue;
|
||||
}
|
||||
hres = deserialize_param(
|
||||
tinfo,
|
||||
is_out_elem(elem),
|
||||
relaydeb,
|
||||
TRACE_ON(olerelay),
|
||||
FALSE,
|
||||
&(elem->tdesc),
|
||||
xargs,
|
||||
|
@ -1503,7 +1502,7 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
|||
hres = xbuf_get(&buf, (LPBYTE)&remoteresult, sizeof(DWORD));
|
||||
if (hres != S_OK)
|
||||
goto exit;
|
||||
if (relaydeb) TRACE_(olerelay)(") = %08x\n", remoteresult);
|
||||
TRACE_(olerelay)(") = %08x\n", remoteresult);
|
||||
|
||||
hres = remoteresult;
|
||||
|
||||
|
@ -1639,7 +1638,7 @@ static ULONG WINAPI TMarshalDispatchChannel_Release(LPRPCCHANNELBUFFER iface)
|
|||
if (ref)
|
||||
return ref;
|
||||
|
||||
IRpcChannelBuffer_Release(This->pDelegateChannel);
|
||||
IRpcChannelBuffer_Release(This->pDelegateChannel);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1727,8 +1726,8 @@ static inline HRESULT get_facbuf_for_iid(REFIID riid, IPSFactoryBuffer **facbuf)
|
|||
static HRESULT init_proxy_entry_point(TMProxyImpl *proxy, unsigned int num)
|
||||
{
|
||||
int j;
|
||||
/* nrofargs without This */
|
||||
int nrofargs;
|
||||
/* nrofargs including This */
|
||||
int nrofargs = 1;
|
||||
ITypeInfo *tinfo2;
|
||||
TMAsmProxy *xasm = proxy->asmstubs + num;
|
||||
HRESULT hres;
|
||||
|
@ -1741,7 +1740,6 @@ static HRESULT init_proxy_entry_point(TMProxyImpl *proxy, unsigned int num)
|
|||
}
|
||||
ITypeInfo_Release(tinfo2);
|
||||
/* some args take more than 4 byte on the stack */
|
||||
nrofargs = 0;
|
||||
for (j=0;j<fdesc->cParams;j++)
|
||||
nrofargs += _argsize(&fdesc->lprgelemdescParam[j].tdesc, proxy->tinfo);
|
||||
|
||||
|
@ -1750,25 +1748,21 @@ static HRESULT init_proxy_entry_point(TMProxyImpl *proxy, unsigned int num)
|
|||
ERR("calling convention is not stdcall????\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
/* popl %eax - return ptr
|
||||
* pushl <nr>
|
||||
/* leal 4(%esp),%eax
|
||||
* pushl %eax
|
||||
* pushl <nr>
|
||||
* call xCall
|
||||
* lret <nr> (+4)
|
||||
*
|
||||
*
|
||||
* arg3 arg2 arg1 <method> <returnptr>
|
||||
* lret <nr>
|
||||
*/
|
||||
xasm->popleax = 0x58;
|
||||
xasm->lealeax = 0x0424448d;
|
||||
xasm->pushleax = 0x50;
|
||||
xasm->pushlval = 0x68;
|
||||
xasm->nr = num;
|
||||
xasm->pushleax = 0x50;
|
||||
xasm->lcall = 0xe8; /* relative jump */
|
||||
xasm->xcall = (DWORD)xCall;
|
||||
xasm->xcall -= (DWORD)&(xasm->lret);
|
||||
xasm->lcall = 0xe8;
|
||||
xasm->xcall = (char *)xCall - (char *)&xasm->lret;
|
||||
xasm->lret = 0xc2;
|
||||
xasm->bytestopop = (nrofargs+2)*4; /* pop args, This, iMethod */
|
||||
xasm->nop = 0x90;
|
||||
xasm->bytestopop = nrofargs * 4;
|
||||
xasm->nop = 0x9090;
|
||||
proxy->lpvtbl[fdesc->oVft / sizeof(void *)] = xasm;
|
||||
#else
|
||||
FIXME("not implemented on non i386\n");
|
||||
|
@ -1808,8 +1802,6 @@ PSFacBuf_CreateProxy(
|
|||
proxy = CoTaskMemAlloc(sizeof(TMProxyImpl));
|
||||
if (!proxy) return E_OUTOFMEMORY;
|
||||
|
||||
assert(sizeof(TMAsmProxy) == 16);
|
||||
|
||||
proxy->dispatch = NULL;
|
||||
proxy->dispatch_proxy = NULL;
|
||||
proxy->outerunknown = pUnkOuter;
|
||||
|
@ -1871,40 +1863,23 @@ PSFacBuf_CreateProxy(
|
|||
proxy->lpvtbl[i] = ProxyIUnknown_Release;
|
||||
break;
|
||||
case 3:
|
||||
if(!defer_to_dispatch)
|
||||
{
|
||||
hres = init_proxy_entry_point(proxy, i);
|
||||
if(FAILED(hres)) return hres;
|
||||
}
|
||||
if(!defer_to_dispatch) hres = init_proxy_entry_point(proxy, i);
|
||||
else proxy->lpvtbl[3] = ProxyIDispatch_GetTypeInfoCount;
|
||||
break;
|
||||
case 4:
|
||||
if(!defer_to_dispatch)
|
||||
{
|
||||
hres = init_proxy_entry_point(proxy, i);
|
||||
if(FAILED(hres)) return hres;
|
||||
}
|
||||
if(!defer_to_dispatch) hres = init_proxy_entry_point(proxy, i);
|
||||
else proxy->lpvtbl[4] = ProxyIDispatch_GetTypeInfo;
|
||||
break;
|
||||
case 5:
|
||||
if(!defer_to_dispatch)
|
||||
{
|
||||
hres = init_proxy_entry_point(proxy, i);
|
||||
if(FAILED(hres)) return hres;
|
||||
}
|
||||
if(!defer_to_dispatch) hres = init_proxy_entry_point(proxy, i);
|
||||
else proxy->lpvtbl[5] = ProxyIDispatch_GetIDsOfNames;
|
||||
break;
|
||||
case 6:
|
||||
if(!defer_to_dispatch)
|
||||
{
|
||||
hres = init_proxy_entry_point(proxy, i);
|
||||
if(FAILED(hres)) return hres;
|
||||
}
|
||||
if(!defer_to_dispatch) hres = init_proxy_entry_point(proxy, i);
|
||||
else proxy->lpvtbl[6] = ProxyIDispatch_Invoke;
|
||||
break;
|
||||
default:
|
||||
hres = init_proxy_entry_point(proxy, i);
|
||||
if(FAILED(hres)) return hres;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -986,7 +986,7 @@ typedef struct tagTLBImpLib
|
|||
/* internal ITypeLib data */
|
||||
typedef struct tagITypeLibImpl
|
||||
{
|
||||
const ITypeLib2Vtbl *lpVtbl;
|
||||
ITypeLib2 ITypeLib2_iface;
|
||||
const ITypeCompVtbl *lpVtblTypeComp;
|
||||
LONG ref;
|
||||
TLIBATTR LibAttr; /* guid,lcid,syskind,version,flags */
|
||||
|
@ -2547,9 +2547,10 @@ static HRESULT TLB_PEFile_Open(LPCWSTR path, INT index, LPVOID *ppBase, DWORD *p
|
|||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
hr = E_FAIL;
|
||||
}
|
||||
|
||||
TRACE("No TYPELIB resource found\n");
|
||||
hr = E_FAIL;
|
||||
}
|
||||
|
||||
TLB_PEFile_Release((IUnknown *)&This->lpvtbl);
|
||||
|
@ -2918,7 +2919,7 @@ static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath
|
|||
if (!strcmpiW(entry->path, pszPath) && entry->index == index)
|
||||
{
|
||||
TRACE("cache hit\n");
|
||||
*ppTypeLib = (ITypeLib2*)entry;
|
||||
*ppTypeLib = &entry->ITypeLib2_iface;
|
||||
ITypeLib2_AddRef(*ppTypeLib);
|
||||
LeaveCriticalSection(&cache_section);
|
||||
return S_OK;
|
||||
|
@ -2952,8 +2953,6 @@ static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath
|
|||
ret = TYPE_E_CANTLOADLIBRARY;
|
||||
IUnknown_Release(pFile);
|
||||
}
|
||||
else
|
||||
ret = TYPE_E_CANTLOADLIBRARY;
|
||||
|
||||
if(*ppTypeLib) {
|
||||
ITypeLibImpl *impl = (ITypeLibImpl*)*ppTypeLib;
|
||||
|
@ -2969,8 +2968,15 @@ static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath
|
|||
list_add_head(&tlb_cache, &impl->entry);
|
||||
LeaveCriticalSection(&cache_section);
|
||||
ret = S_OK;
|
||||
} else
|
||||
ERR("Loading of typelib %s failed with error %d\n", debugstr_w(pszFileName), GetLastError());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ret != E_FAIL)
|
||||
ERR("Loading of typelib %s failed with error %d\n", debugstr_w(pszFileName), GetLastError());
|
||||
|
||||
ret = TYPE_E_CANTLOADLIBRARY;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2984,7 +2990,7 @@ static ITypeLibImpl* TypeLibImpl_Constructor(void)
|
|||
pTypeLibImpl = heap_alloc_zero(sizeof(ITypeLibImpl));
|
||||
if (!pTypeLibImpl) return NULL;
|
||||
|
||||
pTypeLibImpl->lpVtbl = &tlbvt;
|
||||
pTypeLibImpl->ITypeLib2_iface.lpVtbl = &tlbvt;
|
||||
pTypeLibImpl->lpVtblTypeComp = &tlbtcvt;
|
||||
pTypeLibImpl->ref = 1;
|
||||
|
||||
|
@ -3202,7 +3208,7 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
|
|||
}
|
||||
|
||||
TRACE("(%p)\n", pTypeLibImpl);
|
||||
return (ITypeLib2*) pTypeLibImpl;
|
||||
return &pTypeLibImpl->ITypeLib2_iface;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4200,58 +4206,53 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
|
|||
}
|
||||
|
||||
heap_free(pOtherTypeInfoBlks);
|
||||
return (ITypeLib2*)pTypeLibImpl;
|
||||
return &pTypeLibImpl->ITypeLib2_iface;
|
||||
}
|
||||
|
||||
/* ITypeLib::QueryInterface
|
||||
*/
|
||||
static HRESULT WINAPI ITypeLib2_fnQueryInterface(
|
||||
ITypeLib2 * iface,
|
||||
REFIID riid,
|
||||
VOID **ppvObject)
|
||||
static inline ITypeLibImpl *impl_from_ITypeLib2(ITypeLib2 *iface)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
return CONTAINING_RECORD(iface, ITypeLibImpl, ITypeLib2_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITypeLib2_fnQueryInterface(ITypeLib2 *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
|
||||
TRACE("(%p)->(IID: %s)\n",This,debugstr_guid(riid));
|
||||
|
||||
*ppvObject=NULL;
|
||||
if(IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid,&IID_ITypeLib)||
|
||||
IsEqualIID(riid,&IID_ITypeLib2))
|
||||
{
|
||||
*ppvObject = This;
|
||||
*ppv = &This->ITypeLib2_iface;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppv = NULL;
|
||||
TRACE("-- Interface: E_NOINTERFACE\n");
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
if(*ppvObject)
|
||||
{
|
||||
ITypeLib2_AddRef(iface);
|
||||
TRACE("-- Interface: (%p)->(%p)\n",ppvObject,*ppvObject);
|
||||
return S_OK;
|
||||
}
|
||||
TRACE("-- Interface: E_NOINTERFACE\n");
|
||||
return E_NOINTERFACE;
|
||||
IUnknown_AddRef((IUnknown*)*ppv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ITypeLib::AddRef
|
||||
*/
|
||||
static ULONG WINAPI ITypeLib2_fnAddRef( ITypeLib2 *iface)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->ref was %u\n",This, ref - 1);
|
||||
TRACE("(%p) ref=%u\n", This, ref);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* ITypeLib::Release
|
||||
*/
|
||||
static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p)->(%u)\n",This, ref);
|
||||
TRACE("(%p) ref=%u\n",This, ref);
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
|
@ -4295,7 +4296,7 @@ static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
|
|||
LIST_FOR_EACH_ENTRY_SAFE(pImpLib, pImpLibNext, &This->implib_list, TLBImpLib, entry)
|
||||
{
|
||||
if (pImpLib->pImpTypeLib)
|
||||
ITypeLib_Release((ITypeLib *)pImpLib->pImpTypeLib);
|
||||
ITypeLib2_Release(&pImpLib->pImpTypeLib->ITypeLib2_iface);
|
||||
SysFreeString(pImpLib->name);
|
||||
|
||||
list_remove(&pImpLib->entry);
|
||||
|
@ -4324,7 +4325,7 @@ static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
|
|||
*/
|
||||
static UINT WINAPI ITypeLib2_fnGetTypeInfoCount( ITypeLib2 *iface)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
TRACE("(%p)->count is %d\n",This, This->TypeInfoCount);
|
||||
return This->TypeInfoCount;
|
||||
}
|
||||
|
@ -4338,7 +4339,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfo(
|
|||
UINT index,
|
||||
ITypeInfo **ppTInfo)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl*)iface;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
|
||||
TRACE("%p %u %p\n", This, index, ppTInfo);
|
||||
|
||||
|
@ -4364,7 +4365,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoType(
|
|||
UINT index,
|
||||
TYPEKIND *pTKind)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
|
||||
TRACE("(%p, %d, %p)\n", This, index, pTKind);
|
||||
|
||||
|
@ -4389,8 +4390,8 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoOfGuid(
|
|||
REFGUID guid,
|
||||
ITypeInfo **ppTInfo)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
UINT i;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
int i;
|
||||
|
||||
TRACE("%p %s %p\n", This, debugstr_guid(guid), ppTInfo);
|
||||
|
||||
|
@ -4414,7 +4415,7 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
|
|||
ITypeLib2 *iface,
|
||||
LPTLIBATTR *attr)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
|
||||
TRACE("(%p, %p)\n", This, attr);
|
||||
|
||||
|
@ -4437,7 +4438,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeComp(
|
|||
ITypeLib2 *iface,
|
||||
ITypeComp **ppTComp)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
|
||||
TRACE("(%p)->(%p)\n",This,ppTComp);
|
||||
*ppTComp = (ITypeComp *)&This->lpVtblTypeComp;
|
||||
|
@ -4463,13 +4464,10 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation(
|
|||
DWORD *pdwHelpContext,
|
||||
BSTR *pBstrHelpFile)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
HRESULT result = E_INVALIDARG;
|
||||
|
||||
ITypeInfo *pTInfo;
|
||||
|
||||
|
||||
TRACE("(%p) index %d Name(%p) DocString(%p) HelpContext(%p) HelpFile(%p)\n",
|
||||
This, index,
|
||||
pBstrName, pBstrDocString,
|
||||
|
@ -4557,8 +4555,9 @@ static HRESULT WINAPI ITypeLib2_fnIsName(
|
|||
ULONG lHashVal,
|
||||
BOOL *pfName)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
UINT nNameBufLen = (lstrlenW(szNameBuf)+1)*sizeof(WCHAR), tic, fdc, vrc, pc;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
int tic;
|
||||
UINT nNameBufLen = (lstrlenW(szNameBuf)+1)*sizeof(WCHAR), fdc, vrc;
|
||||
|
||||
TRACE("(%p)->(%s,%08x,%p)\n", This, debugstr_w(szNameBuf), lHashVal,
|
||||
pfName);
|
||||
|
@ -4569,6 +4568,8 @@ static HRESULT WINAPI ITypeLib2_fnIsName(
|
|||
if(!memcmp(szNameBuf,pTInfo->Name, nNameBufLen)) goto ITypeLib2_fnIsName_exit;
|
||||
for(fdc = 0; fdc < pTInfo->TypeAttr.cFuncs; ++fdc) {
|
||||
TLBFuncDesc *pFInfo = &pTInfo->funcdescs[fdc];
|
||||
int pc;
|
||||
|
||||
if(!memcmp(szNameBuf,pFInfo->Name, nNameBufLen)) goto ITypeLib2_fnIsName_exit;
|
||||
for(pc=0; pc < pFInfo->funcdesc.cParams; pc++)
|
||||
if(!memcmp(szNameBuf,pFInfo->pParamDesc[pc].Name, nNameBufLen))
|
||||
|
@ -4603,8 +4604,9 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
|
|||
MEMBERID *memid,
|
||||
UINT16 *found)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
UINT tic, count = 0;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
int tic;
|
||||
UINT count = 0;
|
||||
UINT len;
|
||||
|
||||
TRACE("(%p)->(%s %u %p %p %p)\n", This, debugstr_w(name), hash, ppTInfo, memid, found);
|
||||
|
@ -4621,7 +4623,7 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
|
|||
if(!memcmp(name, pTInfo->Name, len)) goto ITypeLib2_fnFindName_exit;
|
||||
for(fdc = 0; fdc < pTInfo->TypeAttr.cFuncs; ++fdc) {
|
||||
TLBFuncDesc *func = &pTInfo->funcdescs[fdc];
|
||||
UINT pc;
|
||||
int pc;
|
||||
|
||||
if(!memcmp(name, func->Name, len)) goto ITypeLib2_fnFindName_exit;
|
||||
for(pc = 0; pc < func->funcdesc.cParams; pc++) {
|
||||
|
@ -4656,10 +4658,9 @@ static VOID WINAPI ITypeLib2_fnReleaseTLibAttr(
|
|||
ITypeLib2 *iface,
|
||||
TLIBATTR *pTLibAttr)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
TRACE("freeing (%p)\n",This);
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
TRACE("(%p)->(%p)\n", This, pTLibAttr);
|
||||
heap_free(pTLibAttr);
|
||||
|
||||
}
|
||||
|
||||
/* ITypeLib2::GetCustData
|
||||
|
@ -4671,10 +4672,10 @@ static HRESULT WINAPI ITypeLib2_fnGetCustData(
|
|||
REFGUID guid,
|
||||
VARIANT *pVarVal)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
TLBCustData *pCData;
|
||||
|
||||
TRACE("%p %s %p\n", This, debugstr_guid(guid), pVarVal);
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(guid), pVarVal);
|
||||
|
||||
pCData = TLB_get_custdata_by_guid(&This->custdata_list, guid);
|
||||
if(!pCData)
|
||||
|
@ -4697,7 +4698,7 @@ static HRESULT WINAPI ITypeLib2_fnGetLibStatistics(
|
|||
ULONG *pcUniqueNames,
|
||||
ULONG *pcchUniqueNames)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
|
||||
FIXME("(%p): stub!\n", This);
|
||||
|
||||
|
@ -4721,7 +4722,7 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation2(
|
|||
DWORD *pdwHelpStringContext,
|
||||
BSTR *pbstrHelpStringDll)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
HRESULT result;
|
||||
ITypeInfo *pTInfo;
|
||||
|
||||
|
@ -4807,8 +4808,8 @@ static HRESULT WINAPI ITypeLib2_fnGetAllCustData(
|
|||
ITypeLib2 * iface,
|
||||
CUSTDATA *pCustData)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
TRACE("%p %p\n", iface, pCustData);
|
||||
ITypeLibImpl *This = impl_from_ITypeLib2(iface);
|
||||
TRACE("(%p)->(%p)\n", This, pCustData);
|
||||
return TLB_copy_all_custdata(&This->custdata_list, pCustData);
|
||||
}
|
||||
|
||||
|
@ -4838,21 +4839,21 @@ static HRESULT WINAPI ITypeLibComp_fnQueryInterface(ITypeComp * iface, REFIID ri
|
|||
{
|
||||
ITypeLibImpl *This = impl_from_ITypeComp(iface);
|
||||
|
||||
return ITypeLib2_QueryInterface((ITypeLib2 *)This, riid, ppv);
|
||||
return ITypeLib2_QueryInterface(&This->ITypeLib2_iface, riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI ITypeLibComp_fnAddRef(ITypeComp * iface)
|
||||
{
|
||||
ITypeLibImpl *This = impl_from_ITypeComp(iface);
|
||||
|
||||
return ITypeLib2_AddRef((ITypeLib2 *)This);
|
||||
return ITypeLib2_AddRef(&This->ITypeLib2_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI ITypeLibComp_fnRelease(ITypeComp * iface)
|
||||
{
|
||||
ITypeLibImpl *This = impl_from_ITypeComp(iface);
|
||||
|
||||
return ITypeLib2_Release((ITypeLib2 *)This);
|
||||
return ITypeLib2_Release(&This->ITypeLib2_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITypeLibComp_fnBind(
|
||||
|
@ -5001,7 +5002,7 @@ static HRESULT WINAPI ITypeLibComp_fnBindType(
|
|||
ITypeComp ** ppTComp)
|
||||
{
|
||||
ITypeLibImpl *This = impl_from_ITypeComp(iface);
|
||||
UINT i;
|
||||
int i;
|
||||
|
||||
TRACE("(%s, %x, %p, %p)\n", debugstr_w(szName), lHash, ppTInfo, ppTComp);
|
||||
|
||||
|
@ -5096,14 +5097,14 @@ static ULONG WINAPI ITypeInfo_fnAddRef( ITypeInfo2 *iface)
|
|||
TRACE("(%p)->ref is %u\n",This, ref);
|
||||
|
||||
if (ref == 1 /* incremented from 0 */)
|
||||
ITypeLib2_AddRef((ITypeLib2*)This->pTypeLib);
|
||||
ITypeLib2_AddRef(&This->pTypeLib->ITypeLib2_iface);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static void ITypeInfoImpl_Destroy(ITypeInfoImpl *This)
|
||||
{
|
||||
UINT i, j;
|
||||
UINT i;
|
||||
|
||||
TRACE("destroying ITypeInfo(%p)\n",This);
|
||||
|
||||
|
@ -5118,6 +5119,7 @@ static void ITypeInfoImpl_Destroy(ITypeInfoImpl *This)
|
|||
|
||||
for (i = 0; i < This->TypeAttr.cFuncs; ++i)
|
||||
{
|
||||
int j;
|
||||
TLBFuncDesc *pFInfo = &This->funcdescs[i];
|
||||
for(j = 0; j < pFInfo->funcdesc.cParams; j++)
|
||||
{
|
||||
|
@ -5179,7 +5181,7 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
|
|||
if (!ref)
|
||||
{
|
||||
BOOL not_attached_to_typelib = This->not_attached_to_typelib;
|
||||
ITypeLib2_Release((ITypeLib2*)This->pTypeLib);
|
||||
ITypeLib2_Release(&This->pTypeLib->ITypeLib2_iface);
|
||||
if (not_attached_to_typelib)
|
||||
heap_free(This);
|
||||
/* otherwise This will be freed when typelib is freed */
|
||||
|
@ -6191,6 +6193,10 @@ DispCallFunc(
|
|||
case VT_CY:
|
||||
V_UI8(pvargResult) = call_method( func, argspos - 1, args + 1, &stack_offset );
|
||||
break;
|
||||
case VT_HRESULT:
|
||||
WARN("invalid return type %u\n", vtReturn);
|
||||
heap_free( args );
|
||||
return E_INVALIDARG;
|
||||
default:
|
||||
V_UI4(pvargResult) = call_method( func, argspos - 1, args + 1, &stack_offset );
|
||||
break;
|
||||
|
@ -6269,6 +6275,10 @@ DispCallFunc(
|
|||
args[0] = (DWORD_PTR)pvargResult; /* arg 0 is a pointer to the result */
|
||||
call_method( func, argspos, args );
|
||||
break;
|
||||
case VT_HRESULT:
|
||||
WARN("invalid return type %u\n", vtReturn);
|
||||
heap_free( args );
|
||||
return E_INVALIDARG;
|
||||
default:
|
||||
V_UI8(pvargResult) = call_method( func, argspos - 1, args + 1 );
|
||||
break;
|
||||
|
@ -7053,7 +7063,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo(
|
|||
} else {
|
||||
if(ref_type->pImpTLInfo->pImpTypeLib) {
|
||||
TRACE("typeinfo in imported typelib that is already loaded\n");
|
||||
pTLib = (ITypeLib*)ref_type->pImpTLInfo->pImpTypeLib;
|
||||
pTLib = (ITypeLib*)&ref_type->pImpTLInfo->pImpTypeLib->ITypeLib2_iface;
|
||||
ITypeLib_AddRef(pTLib);
|
||||
result = S_OK;
|
||||
} else {
|
||||
|
@ -7838,7 +7848,7 @@ HRESULT WINAPI CreateDispTypeInfo(
|
|||
*pptinfo = (ITypeInfo*)pTIClass;
|
||||
|
||||
ITypeInfo_AddRef(*pptinfo);
|
||||
ITypeLib_Release((ITypeLib *)&pTypeLibImpl->lpVtbl);
|
||||
ITypeLib2_Release(&pTypeLibImpl->ITypeLib2_iface);
|
||||
|
||||
return S_OK;
|
||||
|
||||
|
|
|
@ -597,16 +597,16 @@ WORD typeofarray
|
|||
#include "poppack.h"
|
||||
|
||||
/* heap allocation helpers */
|
||||
extern void* heap_alloc_zero(unsigned size);
|
||||
extern void* heap_alloc(unsigned size);
|
||||
extern void* heap_realloc(void *ptr, unsigned size);
|
||||
extern void heap_free(void *ptr);
|
||||
extern void* heap_alloc_zero(unsigned size) DECLSPEC_HIDDEN __WINE_ALLOC_SIZE(1);
|
||||
extern void* heap_alloc(unsigned size) DECLSPEC_HIDDEN __WINE_ALLOC_SIZE(1);
|
||||
extern void* heap_realloc(void *ptr, unsigned size) DECLSPEC_HIDDEN;
|
||||
extern void heap_free(void *ptr) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const FUNCDESC **ppFuncDesc );
|
||||
HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const FUNCDESC **ppFuncDesc ) DECLSPEC_HIDDEN;
|
||||
|
||||
extern DWORD _invoke(FARPROC func,CALLCONV callconv, int nrargs, DWORD *args);
|
||||
extern DWORD _invoke(FARPROC func,CALLCONV callconv, int nrargs, DWORD *args) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT TMARSHAL_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv);
|
||||
HRESULT TMARSHAL_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv) DECLSPEC_HIDDEN;
|
||||
|
||||
/* The OLE Automation ProxyStub Interface Class (aka Typelib Marshaler) */
|
||||
DEFINE_OLEGUID( CLSID_PSDispatch, 0x00020420, 0x0000, 0x0000 );
|
||||
|
|
|
@ -2053,8 +2053,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
|
|||
if(This->dual)
|
||||
This->dual->typedata = This->typedata;
|
||||
} else {
|
||||
unsigned int j;
|
||||
|
||||
iter = This->typedata->next;
|
||||
for(i=0; i<index; i++)
|
||||
for (j = 0; j < index; j++)
|
||||
iter = iter->next;
|
||||
|
||||
insert->next = iter->next;
|
||||
|
|
|
@ -1911,7 +1911,7 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
|
|||
WCHAR fmt_buff[80];
|
||||
|
||||
if (!GetLocaleInfoW(lcid, dwFmt, fmt_buff, sizeof(fmt_buff)/sizeof(WCHAR)) ||
|
||||
!GetDateFormatW(lcid, 0, &udate.st, fmt_buff, pBuff,
|
||||
!get_date_format(lcid, 0, &udate.st, fmt_buff, pBuff,
|
||||
sizeof(buff)/sizeof(WCHAR)-(pBuff-buff)))
|
||||
{
|
||||
hRes = E_INVALIDARG;
|
||||
|
|
|
@ -3134,9 +3134,9 @@ HRESULT WINAPI VarAnd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
|
|||
LOCALE_USER_DEFAULT, 0, &d)))
|
||||
hres = VariantChangeType(&varLeft,&varLeft,
|
||||
VARIANT_LOCALBOOL, VT_BOOL);
|
||||
if (SUCCEEDED(hres) && V_VT(&varLeft) != resvt)
|
||||
hres = VariantChangeType(&varLeft,&varLeft,0,resvt);
|
||||
if (FAILED(hres)) goto VarAnd_Exit;
|
||||
if (SUCCEEDED(hres) && V_VT(&varLeft) != resvt)
|
||||
hres = VariantChangeType(&varLeft,&varLeft,0,resvt);
|
||||
if (FAILED(hres)) goto VarAnd_Exit;
|
||||
}
|
||||
|
||||
if (resvt == VT_I4 && V_VT(&varRight) == VT_UI4)
|
||||
|
|
|
@ -48,12 +48,12 @@
|
|||
#define VTBIT_VARIANT (1 << VT_VARIANT)
|
||||
#define VTBIT_15 (1 << 15) /* no variant type with this number */
|
||||
|
||||
extern const char * const wine_vtypes[];
|
||||
extern const char * const wine_vtypes[] DECLSPEC_HIDDEN;
|
||||
#define debugstr_vt(v) (((v)&VT_TYPEMASK) <= VT_CLSID ? wine_vtypes[((v)&VT_TYPEMASK)] : \
|
||||
((v)&VT_TYPEMASK) == VT_BSTR_BLOB ? "VT_BSTR_BLOB": "Invalid")
|
||||
#define debugstr_VT(v) (!(v) ? "(null)" : debugstr_vt(V_TYPE((v))))
|
||||
|
||||
extern const char * const wine_vflags[];
|
||||
extern const char * const wine_vflags[] DECLSPEC_HIDDEN;
|
||||
#define debugstr_vf(v) (wine_vflags[((v)&VT_EXTRA_TYPE)>>12])
|
||||
#define debugstr_VF(v) (!(v) ? "(null)" : debugstr_vf(V_EXTRA_TYPE(v)))
|
||||
|
||||
|
@ -125,5 +125,7 @@ typedef struct tagVARIANT_NUMBER_CHARS
|
|||
} VARIANT_NUMBER_CHARS;
|
||||
|
||||
|
||||
BOOL VARIANT_GetLocalisedText(LANGID, DWORD, WCHAR *);
|
||||
HRESULT VARIANT_ClearInd(VARIANTARG *);
|
||||
BOOL VARIANT_GetLocalisedText(LANGID, DWORD, WCHAR *) DECLSPEC_HIDDEN;
|
||||
HRESULT VARIANT_ClearInd(VARIANTARG *) DECLSPEC_HIDDEN;
|
||||
BOOL get_date_format(LCID, DWORD, const SYSTEMTIME *,
|
||||
const WCHAR *, WCHAR *, int) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -6579,6 +6579,120 @@ HRESULT WINAPI VarBstrFromCy(CY cyIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut)
|
|||
return *pbstrOut ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
static inline int output_int_len(int o, int min_len, WCHAR *date, int date_len)
|
||||
{
|
||||
int len, tmp;
|
||||
|
||||
if(min_len >= date_len)
|
||||
return -1;
|
||||
|
||||
for(len=0, tmp=o; tmp; tmp/=10) len++;
|
||||
if(!len) len++;
|
||||
if(len >= date_len)
|
||||
return -1;
|
||||
|
||||
for(tmp=min_len-len; tmp>0; tmp--)
|
||||
*date++ = '0';
|
||||
for(tmp=len; tmp>0; tmp--, o/=10)
|
||||
date[tmp-1] = '0' + o%10;
|
||||
return min_len>len ? min_len : len;
|
||||
}
|
||||
|
||||
/* format date string, similar to GetDateFormatW function but works on bigger range of dates */
|
||||
BOOL get_date_format(LCID lcid, DWORD flags, const SYSTEMTIME *st,
|
||||
const WCHAR *fmt, WCHAR *date, int date_len)
|
||||
{
|
||||
static const LCTYPE dayname[] = {
|
||||
LOCALE_SDAYNAME7, LOCALE_SDAYNAME1, LOCALE_SDAYNAME2, LOCALE_SDAYNAME3,
|
||||
LOCALE_SDAYNAME4, LOCALE_SDAYNAME5, LOCALE_SDAYNAME6
|
||||
};
|
||||
static const LCTYPE sdayname[] = {
|
||||
LOCALE_SABBREVDAYNAME7, LOCALE_SABBREVDAYNAME1, LOCALE_SABBREVDAYNAME2,
|
||||
LOCALE_SABBREVDAYNAME3, LOCALE_SABBREVDAYNAME4, LOCALE_SABBREVDAYNAME5,
|
||||
LOCALE_SABBREVDAYNAME6
|
||||
};
|
||||
static const LCTYPE monthname[] = {
|
||||
LOCALE_SMONTHNAME1, LOCALE_SMONTHNAME2, LOCALE_SMONTHNAME3, LOCALE_SMONTHNAME4,
|
||||
LOCALE_SMONTHNAME5, LOCALE_SMONTHNAME6, LOCALE_SMONTHNAME7, LOCALE_SMONTHNAME8,
|
||||
LOCALE_SMONTHNAME9, LOCALE_SMONTHNAME10, LOCALE_SMONTHNAME11, LOCALE_SMONTHNAME12
|
||||
};
|
||||
static const LCTYPE smonthname[] = {
|
||||
LOCALE_SABBREVMONTHNAME1, LOCALE_SABBREVMONTHNAME2, LOCALE_SABBREVMONTHNAME3,
|
||||
LOCALE_SABBREVMONTHNAME4, LOCALE_SABBREVMONTHNAME5, LOCALE_SABBREVMONTHNAME6,
|
||||
LOCALE_SABBREVMONTHNAME7, LOCALE_SABBREVMONTHNAME8, LOCALE_SABBREVMONTHNAME9,
|
||||
LOCALE_SABBREVMONTHNAME10, LOCALE_SABBREVMONTHNAME11, LOCALE_SABBREVMONTHNAME12
|
||||
};
|
||||
|
||||
if(flags & ~(LOCALE_NOUSEROVERRIDE|VAR_DATEVALUEONLY))
|
||||
FIXME("ignoring flags %x\n", flags);
|
||||
flags &= LOCALE_NOUSEROVERRIDE;
|
||||
|
||||
while(*fmt && date_len) {
|
||||
int count = 1;
|
||||
|
||||
switch(*fmt) {
|
||||
case 'd':
|
||||
case 'M':
|
||||
case 'y':
|
||||
case 'g':
|
||||
while(*fmt == *(fmt+count))
|
||||
count++;
|
||||
fmt += count-1;
|
||||
}
|
||||
|
||||
switch(*fmt) {
|
||||
case 'd':
|
||||
if(count >= 4)
|
||||
count = GetLocaleInfoW(lcid, dayname[st->wDayOfWeek] | flags, date, date_len)-1;
|
||||
else if(count == 3)
|
||||
count = GetLocaleInfoW(lcid, sdayname[st->wDayOfWeek] | flags, date, date_len)-1;
|
||||
else
|
||||
count = output_int_len(st->wDay, count, date, date_len);
|
||||
break;
|
||||
case 'M':
|
||||
if(count >= 4)
|
||||
count = GetLocaleInfoW(lcid, monthname[st->wMonth-1] | flags, date, date_len)-1;
|
||||
else if(count == 3)
|
||||
count = GetLocaleInfoW(lcid, smonthname[st->wMonth-1] | flags, date, date_len)-1;
|
||||
else
|
||||
count = output_int_len(st->wMonth, count, date, date_len);
|
||||
break;
|
||||
case 'y':
|
||||
if(count >= 3)
|
||||
count = output_int_len(st->wYear, 0, date, date_len);
|
||||
else
|
||||
count = output_int_len(st->wYear%100, count, date, date_len);
|
||||
break;
|
||||
case 'g':
|
||||
if(count == 2) {
|
||||
FIXME("Should be using GetCalendarInfo(CAL_SERASTRING), defaulting to 'AD'\n");
|
||||
|
||||
*date++ = 'A';
|
||||
date_len--;
|
||||
if(date_len)
|
||||
*date = 'D';
|
||||
else
|
||||
count = -1;
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
default:
|
||||
*date = *fmt;
|
||||
}
|
||||
|
||||
if(count < 0)
|
||||
break;
|
||||
fmt++;
|
||||
date += count;
|
||||
date_len -= count;
|
||||
}
|
||||
|
||||
if(!date_len)
|
||||
return FALSE;
|
||||
*date++ = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* VarBstrFromDate [OLEAUT32.114]
|
||||
*
|
||||
|
@ -6599,7 +6713,7 @@ HRESULT WINAPI VarBstrFromDate(DATE dateIn, LCID lcid, ULONG dwFlags, BSTR* pbst
|
|||
{
|
||||
SYSTEMTIME st;
|
||||
DWORD dwFormatFlags = dwFlags & LOCALE_NOUSEROVERRIDE;
|
||||
WCHAR date[128], *time;
|
||||
WCHAR date[128], fmt_buff[80], *time;
|
||||
|
||||
TRACE("(%g,0x%08x,0x%08x,%p)\n", dateIn, lcid, dwFlags, pbstrOut);
|
||||
|
||||
|
@ -6622,15 +6736,15 @@ HRESULT WINAPI VarBstrFromDate(DATE dateIn, LCID lcid, ULONG dwFlags, BSTR* pbst
|
|||
|
||||
if (whole == 0.0)
|
||||
dwFlags |= VAR_TIMEVALUEONLY;
|
||||
else if (partial < 1e-12)
|
||||
else if (partial > -1e-12 && partial < 1e-12)
|
||||
dwFlags |= VAR_DATEVALUEONLY;
|
||||
}
|
||||
|
||||
if (dwFlags & VAR_TIMEVALUEONLY)
|
||||
date[0] = '\0';
|
||||
else
|
||||
if (!GetDateFormatW(lcid, dwFormatFlags|DATE_SHORTDATE, &st, NULL, date,
|
||||
sizeof(date)/sizeof(WCHAR)))
|
||||
if (!GetLocaleInfoW(lcid, LOCALE_SSHORTDATE, fmt_buff, sizeof(fmt_buff)/sizeof(WCHAR)) ||
|
||||
!get_date_format(lcid, dwFlags, &st, fmt_buff, date, sizeof(date)/sizeof(WCHAR)))
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!(dwFlags & VAR_DATEVALUEONLY))
|
||||
|
|
|
@ -132,7 +132,7 @@ reactos/dll/win32/odbc32 # Out of sync. Depends on port of Linux ODBC.
|
|||
reactos/dll/win32/odbccp32 # Synced to Wine-1.5.19
|
||||
reactos/dll/win32/ole32 # Synced to Wine-1.5.26
|
||||
reactos/dll/win32/oleacc # Autosync
|
||||
reactos/dll/win32/oleaut32 # Synced to Wine-1.5.19
|
||||
reactos/dll/win32/oleaut32 # Synced to Wine-1.5.26
|
||||
reactos/dll/win32/olecli32 # Synced to Wine-1.5.19
|
||||
reactos/dll/win32/oledlg # Autosync
|
||||
reactos/dll/win32/olepro32 # Autosync
|
||||
|
|
Loading…
Reference in a new issue