Commit a6bfa0dd authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

shell32: Use an iface instead of a vtbl pointer in IFileSystemBindDataImpl.

parent 151b3516
...@@ -41,11 +41,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(pidl); ...@@ -41,11 +41,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(pidl);
*/ */
typedef struct typedef struct
{ {
const IFileSystemBindDataVtbl *lpVtbl; IFileSystemBindData IFileSystemBindData_iface;
LONG ref; LONG ref;
WIN32_FIND_DATAW findFile; WIN32_FIND_DATAW findFile;
} IFileSystemBindDataImpl; } IFileSystemBindDataImpl;
static inline IFileSystemBindDataImpl *impl_from_IFileSystemBindData(IFileSystemBindData *iface)
{
return CONTAINING_RECORD(iface, IFileSystemBindDataImpl, IFileSystemBindData_iface);
}
static HRESULT WINAPI IFileSystemBindData_fnQueryInterface(IFileSystemBindData *, REFIID, LPVOID*); static HRESULT WINAPI IFileSystemBindData_fnQueryInterface(IFileSystemBindData *, REFIID, LPVOID*);
static ULONG WINAPI IFileSystemBindData_fnAddRef(IFileSystemBindData *); static ULONG WINAPI IFileSystemBindData_fnAddRef(IFileSystemBindData *);
static ULONG WINAPI IFileSystemBindData_fnRelease(IFileSystemBindData *); static ULONG WINAPI IFileSystemBindData_fnRelease(IFileSystemBindData *);
...@@ -80,9 +85,9 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC ...@@ -80,9 +85,9 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC
if (!sb) if (!sb)
return ret; return ret;
sb->lpVtbl = &sbvt; sb->IFileSystemBindData_iface.lpVtbl = &sbvt;
sb->ref = 1; sb->ref = 1;
IFileSystemBindData_fnSetFindData((IFileSystemBindData*)sb, pfd); IFileSystemBindData_fnSetFindData(&sb->IFileSystemBindData_iface, pfd);
ret = CreateBindCtx(0, ppV); ret = CreateBindCtx(0, ppV);
if (SUCCEEDED(ret)) if (SUCCEEDED(ret))
...@@ -96,7 +101,7 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC ...@@ -96,7 +101,7 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC
IBindCtx_SetBindOptions(*ppV, &bindOpts); IBindCtx_SetBindOptions(*ppV, &bindOpts);
IBindCtx_RegisterObjectParam(*ppV, (LPOLESTR)wFileSystemBindData, (LPUNKNOWN)sb); IBindCtx_RegisterObjectParam(*ppV, (LPOLESTR)wFileSystemBindData, (LPUNKNOWN)sb);
IFileSystemBindData_Release((IFileSystemBindData*)sb); IFileSystemBindData_Release(&sb->IFileSystemBindData_iface);
} }
else else
HeapFree(GetProcessHeap(), 0, sb); HeapFree(GetProcessHeap(), 0, sb);
...@@ -106,7 +111,7 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC ...@@ -106,7 +111,7 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC
static HRESULT WINAPI IFileSystemBindData_fnQueryInterface( static HRESULT WINAPI IFileSystemBindData_fnQueryInterface(
IFileSystemBindData *iface, REFIID riid, LPVOID *ppV) IFileSystemBindData *iface, REFIID riid, LPVOID *ppV)
{ {
IFileSystemBindDataImpl *This = (IFileSystemBindDataImpl *)iface; IFileSystemBindDataImpl *This = impl_from_IFileSystemBindData(iface);
TRACE("(%p)->(\n\tIID:\t%s, %p)\n", This, debugstr_guid(riid), ppV); TRACE("(%p)->(\n\tIID:\t%s, %p)\n", This, debugstr_guid(riid), ppV);
*ppV = NULL; *ppV = NULL;
...@@ -128,7 +133,7 @@ static HRESULT WINAPI IFileSystemBindData_fnQueryInterface( ...@@ -128,7 +133,7 @@ static HRESULT WINAPI IFileSystemBindData_fnQueryInterface(
static ULONG WINAPI IFileSystemBindData_fnAddRef(IFileSystemBindData *iface) static ULONG WINAPI IFileSystemBindData_fnAddRef(IFileSystemBindData *iface)
{ {
IFileSystemBindDataImpl *This = (IFileSystemBindDataImpl *)iface; IFileSystemBindDataImpl *This = impl_from_IFileSystemBindData(iface);
ULONG refCount = InterlockedIncrement(&This->ref); ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%i)\n", This, refCount - 1); TRACE("(%p)->(count=%i)\n", This, refCount - 1);
...@@ -138,7 +143,7 @@ static ULONG WINAPI IFileSystemBindData_fnAddRef(IFileSystemBindData *iface) ...@@ -138,7 +143,7 @@ static ULONG WINAPI IFileSystemBindData_fnAddRef(IFileSystemBindData *iface)
static ULONG WINAPI IFileSystemBindData_fnRelease(IFileSystemBindData *iface) static ULONG WINAPI IFileSystemBindData_fnRelease(IFileSystemBindData *iface)
{ {
IFileSystemBindDataImpl *This = (IFileSystemBindDataImpl *)iface; IFileSystemBindDataImpl *This = impl_from_IFileSystemBindData(iface);
ULONG refCount = InterlockedDecrement(&This->ref); ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%i)\n", This, refCount + 1); TRACE("(%p)->(count=%i)\n", This, refCount + 1);
...@@ -154,7 +159,7 @@ static ULONG WINAPI IFileSystemBindData_fnRelease(IFileSystemBindData *iface) ...@@ -154,7 +159,7 @@ static ULONG WINAPI IFileSystemBindData_fnRelease(IFileSystemBindData *iface)
static HRESULT WINAPI IFileSystemBindData_fnGetFindData( static HRESULT WINAPI IFileSystemBindData_fnGetFindData(
IFileSystemBindData *iface, WIN32_FIND_DATAW *pfd) IFileSystemBindData *iface, WIN32_FIND_DATAW *pfd)
{ {
IFileSystemBindDataImpl *This = (IFileSystemBindDataImpl *)iface; IFileSystemBindDataImpl *This = impl_from_IFileSystemBindData(iface);
TRACE("(%p), %p\n", This, pfd); TRACE("(%p), %p\n", This, pfd);
if (!pfd) if (!pfd)
...@@ -167,7 +172,7 @@ static HRESULT WINAPI IFileSystemBindData_fnGetFindData( ...@@ -167,7 +172,7 @@ static HRESULT WINAPI IFileSystemBindData_fnGetFindData(
static HRESULT WINAPI IFileSystemBindData_fnSetFindData( static HRESULT WINAPI IFileSystemBindData_fnSetFindData(
IFileSystemBindData *iface, const WIN32_FIND_DATAW *pfd) IFileSystemBindData *iface, const WIN32_FIND_DATAW *pfd)
{ {
IFileSystemBindDataImpl *This = (IFileSystemBindDataImpl *)iface; IFileSystemBindDataImpl *This = impl_from_IFileSystemBindData(iface);
TRACE("(%p), %p\n", This, pfd); TRACE("(%p), %p\n", This, pfd);
if (pfd) if (pfd)
......
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