Commit d604eb12 authored by François Gouget's avatar François Gouget Committed by Alexandre Julliard

First step to make it possible to call COM interfaces from C++ code in

Winelib.
parent 374a0a8f
...@@ -20,19 +20,19 @@ type win16 ...@@ -20,19 +20,19 @@ type win16
# as 16->32 relays. They use the cdecl calling convention. # as 16->32 relays. They use the cdecl calling convention.
# IStorage # IStorage
500 cdecl IStorage16_QueryInterface(ptr ptr ptr) IStorage16_QueryInterface 500 cdecl IStorage16_QueryInterface(ptr ptr ptr) IStorage16_fnQueryInterface
501 cdecl IStorage16_AddRef(ptr) IStorage16_AddRef 501 cdecl IStorage16_AddRef(ptr) IStorage16_fnAddRef
502 cdecl IStorage16_Release(ptr) IStorage16_Release 502 cdecl IStorage16_Release(ptr) IStorage16_fnRelease
#503 cdecl IStorage16_CreateStream(ptr str long long long ptr) IStorage16_CreateStream #503 cdecl IStorage16_CreateStream(ptr str long long long ptr) IStorage16_fnCreateStream
503 stub IStorage16_CreateStream 503 stub IStorage16_CreateStream
504 cdecl IStorage16_OpenStream(ptr str ptr long long ptr) IStorage16_OpenStream 504 cdecl IStorage16_OpenStream(ptr str ptr long long ptr) IStorage16_fnOpenStream
#505 cdecl IStorage16_CreateStorage(ptr str long long long ptr) IStorage16_CreateStorage #505 cdecl IStorage16_CreateStorage(ptr str long long long ptr) IStorage16_fnCreateStorage
505 stub IStorage16_CreateStorage 505 stub IStorage16_CreateStorage
506 cdecl IStorage16_OpenStorage(ptr str ptr long ptr long ptr) IStorage16_OpenStorage 506 cdecl IStorage16_OpenStorage(ptr str ptr long ptr long ptr) IStorage16_fnOpenStorage
507 cdecl IStorage16_CopyTo(ptr long ptr ptr ptr) IStorage16_CopyTo 507 cdecl IStorage16_CopyTo(ptr long ptr ptr ptr) IStorage16_fnCopyTo
508 stub IStorage16_MoveElementTo 508 stub IStorage16_MoveElementTo
509 cdecl IStorage16_Commit(ptr long) IStorage16_Commit 509 cdecl IStorage16_Commit(ptr long) IStorage16_fnCommit
510 stub IStorage16_Revert 510 stub IStorage16_Revert
511 stub IStorage16_EnumElements 511 stub IStorage16_EnumElements
512 stub IStorage16_DestroyElement 512 stub IStorage16_DestroyElement
...@@ -40,16 +40,16 @@ type win16 ...@@ -40,16 +40,16 @@ type win16
514 stub IStorage16_SetElementTimes 514 stub IStorage16_SetElementTimes
515 stub IStorage16_SetClass 515 stub IStorage16_SetClass
516 stub IStorage16_SetStateBits 516 stub IStorage16_SetStateBits
517 cdecl IStorage16_Stat(ptr ptr long) IStorage16_Stat 517 cdecl IStorage16_Stat(ptr ptr long) IStorage16_fnStat
# IStream # IStream
518 cdecl IStream16_QueryInterface(ptr ptr ptr) IStream16_QueryInterface 518 cdecl IStream16_QueryInterface(ptr ptr ptr) IStream16_fnQueryInterface
519 cdecl IStream16_AddRef(ptr) IStream16_AddRef 519 cdecl IStream16_AddRef(ptr) IStream16_fnAddRef
520 cdecl IStream16_Release(ptr) IStream16_Release 520 cdecl IStream16_Release(ptr) IStream16_fnRelease
521 cdecl IStream16_Read(ptr ptr long ptr) IStream16_Read 521 cdecl IStream16_Read(ptr ptr long ptr) IStream16_fnRead
#522 cdecl IStream16_Write(ptr ptr long ptr) IStream16_Write #522 cdecl IStream16_Write(ptr ptr long ptr) IStream16_fnWrite
522 stub IStream16_Write 522 stub IStream16_Write
523 cdecl IStream16_Seek(ptr long long long ptr) IStream16_Seek 523 cdecl IStream16_Seek(ptr long long long ptr) IStream16_fnSeek
524 stub IStream16_SetSize 524 stub IStream16_SetSize
525 stub IStream16_CopyTo 525 stub IStream16_CopyTo
526 stub IStream16_Commit 526 stub IStream16_Commit
......
...@@ -25,19 +25,7 @@ DEFINE_OLEGUID(IID_IRootStorage,0x12,0,0); ...@@ -25,19 +25,7 @@ DEFINE_OLEGUID(IID_IRootStorage,0x12,0,0);
DEFINE_OLEGUID(IID_IMessageFilter,0x16,0,0); DEFINE_OLEGUID(IID_IMessageFilter,0x16,0,0);
DEFINE_OLEGUID(IID_IStdMarshalInfo,0x18,0,0); DEFINE_OLEGUID(IID_IStdMarshalInfo,0x18,0,0);
#define THIS LPUNKNOWN this #include "objbase.h"
typedef struct IUnknown *LPUNKNOWN,IUnknown;
typedef struct {
STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
} *LPUNKNOWN_VTABLE,IUnknown_VTable;
struct IUnknown {
LPUNKNOWN_VTABLE lpvtbl;
DWORD ref;
};
#undef THIS
#define THIS LPCLASSFACTORY this #define THIS LPCLASSFACTORY this
typedef struct IClassFactory *LPCLASSFACTORY,IClassFactory; typedef struct IClassFactory *LPCLASSFACTORY,IClassFactory;
......
...@@ -20,14 +20,19 @@ ...@@ -20,14 +20,19 @@
#include "module.h" #include "module.h"
#include "debug.h" #include "debug.h"
/* /* --- IUnknown implementation */
* IUnknown
*/ typedef struct _IUnknown {
/* IUnknown fields */
ICOM_VTABLE(IUnknown)* lpvtbl;
DWORD ref;
} _IUnknown;
/****************************************************************************** /******************************************************************************
* IUnknown_AddRef [VTABLE:IUNKNOWN.1] * IUnknown_AddRef [VTABLE:IUNKNOWN.1]
*/ */
static ULONG WINAPI IUnknown_AddRef(LPUNKNOWN this) { static ULONG WINAPI IUnknown_fnAddRef(LPUNKNOWN iface) {
ICOM_THIS(IUnknown,iface);
TRACE(relay,"(%p)->AddRef()\n",this); TRACE(relay,"(%p)->AddRef()\n",this);
return ++(this->ref); return ++(this->ref);
} }
...@@ -35,7 +40,8 @@ static ULONG WINAPI IUnknown_AddRef(LPUNKNOWN this) { ...@@ -35,7 +40,8 @@ static ULONG WINAPI IUnknown_AddRef(LPUNKNOWN this) {
/****************************************************************************** /******************************************************************************
* IUnknown_Release [VTABLE:IUNKNOWN.2] * IUnknown_Release [VTABLE:IUNKNOWN.2]
*/ */
static ULONG WINAPI IUnknown_Release(LPUNKNOWN this) { static ULONG WINAPI IUnknown_fnRelease(LPUNKNOWN iface) {
ICOM_THIS(IUnknown,iface);
TRACE(relay,"(%p)->Release()\n",this); TRACE(relay,"(%p)->Release()\n",this);
if (!--(this->ref)) { if (!--(this->ref)) {
HeapFree(GetProcessHeap(),0,this); HeapFree(GetProcessHeap(),0,this);
...@@ -47,7 +53,8 @@ static ULONG WINAPI IUnknown_Release(LPUNKNOWN this) { ...@@ -47,7 +53,8 @@ static ULONG WINAPI IUnknown_Release(LPUNKNOWN this) {
/****************************************************************************** /******************************************************************************
* IUnknown_QueryInterface [VTABLE:IUNKNOWN.0] * IUnknown_QueryInterface [VTABLE:IUNKNOWN.0]
*/ */
static HRESULT WINAPI IUnknown_QueryInterface(LPUNKNOWN this,REFIID refiid,LPVOID *obj) { static HRESULT WINAPI IUnknown_fnQueryInterface(LPUNKNOWN iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IUnknown,iface);
char xrefiid[50]; char xrefiid[50];
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid); WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
...@@ -60,10 +67,10 @@ static HRESULT WINAPI IUnknown_QueryInterface(LPUNKNOWN this,REFIID refiid,LPVOI ...@@ -60,10 +67,10 @@ static HRESULT WINAPI IUnknown_QueryInterface(LPUNKNOWN this,REFIID refiid,LPVOI
return OLE_E_ENUM_NOMORE; return OLE_E_ENUM_NOMORE;
} }
static IUnknown_VTable uvt = { static ICOM_VTABLE(IUnknown) uvt = {
IUnknown_QueryInterface, IUnknown_fnQueryInterface,
IUnknown_AddRef, IUnknown_fnAddRef,
IUnknown_Release IUnknown_fnRelease
}; };
/****************************************************************************** /******************************************************************************
...@@ -71,12 +78,12 @@ static IUnknown_VTable uvt = { ...@@ -71,12 +78,12 @@ static IUnknown_VTable uvt = {
*/ */
LPUNKNOWN LPUNKNOWN
IUnknown_Constructor() { IUnknown_Constructor() {
LPUNKNOWN unk; _IUnknown* unk;
unk = (LPUNKNOWN)HeapAlloc(GetProcessHeap(),0,sizeof(IUnknown)); unk = (_IUnknown*)HeapAlloc(GetProcessHeap(),0,sizeof(IUnknown));
unk->lpvtbl = &uvt; unk->lpvtbl = &uvt;
unk->ref = 1; unk->ref = 1;
return unk; return (LPUNKNOWN)unk;
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment