2 * File System Bind Data object to use as parameter for the bind context to
3 * IShellFolder_ParseDisplayName
5 * Copyright 2003 Rolf Kalbermatter
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 WINE_DEFAULT_DEBUG_CHANNEL(pidl
);
27 /***********************************************************************
28 * IFileSystemBindData implementation
30 class IFileSystemBindDataImpl
:
31 public CComObjectRootEx
<CComMultiThreadModelNoCS
>,
32 public IFileSystemBindData
35 WIN32_FIND_DATAW findFile
;
37 IFileSystemBindDataImpl();
38 ~IFileSystemBindDataImpl();
40 // *** IFileSystemBindData methods ***
41 virtual HRESULT STDMETHODCALLTYPE
SetFindData(const WIN32_FIND_DATAW
*pfd
);
42 virtual HRESULT STDMETHODCALLTYPE
GetFindData(WIN32_FIND_DATAW
*pfd
);
44 DECLARE_NOT_AGGREGATABLE(IFileSystemBindDataImpl
)
45 DECLARE_PROTECT_FINAL_CONSTRUCT()
47 BEGIN_COM_MAP(IFileSystemBindDataImpl
)
48 COM_INTERFACE_ENTRY_IID(IID_IFileSystemBindData
, IFileSystemBindData
)
52 static const WCHAR wFileSystemBindData
[] = {
53 'F','i','l','e',' ','S','y','s','t','e','m',' ','B','i','n','d','D','a','t','a',0};
55 HRESULT WINAPI
IFileSystemBindData_Constructor(const WIN32_FIND_DATAW
*pfd
, LPBC
*ppV
)
57 CComPtr
<IFileSystemBindData
> fileSystemBindData
;
58 CComPtr
<IBindCtx
> bindContext
;
62 TRACE("%p, %p\n", pfd
, ppV
);
69 hResult
= IFileSystemBindDataImpl::_CreatorClass::CreateInstance(NULL
, IID_IFileSystemBindData
, (void **)&fileSystemBindData
);
72 hResult
= fileSystemBindData
->SetFindData(pfd
);
76 hResult
= CreateBindCtx(0, &bindContext
);
79 bindOpts
.cbStruct
= sizeof(BIND_OPTS
);
80 bindOpts
.grfFlags
= 0;
81 bindOpts
.grfMode
= STGM_CREATE
;
82 bindOpts
.dwTickCountDeadline
= 0;
83 hResult
= bindContext
->SetBindOptions(&bindOpts
);
86 hResult
= bindContext
->RegisterObjectParam((LPOLESTR
)wFileSystemBindData
, fileSystemBindData
);
90 *ppV
= bindContext
.Detach();
95 HRESULT WINAPI
FileSystemBindData_GetFindData(LPBC pbc
, WIN32_FIND_DATAW
*pfd
)
97 CComPtr
<IUnknown
> pUnk
;
98 CComPtr
<IFileSystemBindData
> pfsbd
;
101 TRACE("%p, %p\n", pbc
, pfd
);
106 ret
= pbc
->GetObjectParam((LPOLESTR
)wFileSystemBindData
, &pUnk
);
109 ret
= pUnk
->QueryInterface(IID_IFileSystemBindData
, (LPVOID
*)&pfsbd
);
111 ret
= pfsbd
->GetFindData(pfd
);
116 HRESULT WINAPI
FileSystemBindData_SetFindData(LPBC pbc
, const WIN32_FIND_DATAW
*pfd
)
118 CComPtr
<IUnknown
> pUnk
;
119 CComPtr
<IFileSystemBindData
> pfsbd
;
122 TRACE("%p, %p\n", pbc
, pfd
);
124 ret
= pbc
->GetObjectParam((LPOLESTR
)wFileSystemBindData
, &pUnk
);
127 ret
= pUnk
->QueryInterface(IID_IFileSystemBindData
, (LPVOID
*)&pfsbd
);
129 ret
= pfsbd
->SetFindData(pfd
);
134 IFileSystemBindDataImpl::IFileSystemBindDataImpl()
136 memset(&findFile
, 0, sizeof(WIN32_FIND_DATAW
));
139 IFileSystemBindDataImpl::~IFileSystemBindDataImpl()
141 TRACE(" destroying ISFBindPidl(%p)\n", this);
144 HRESULT WINAPI
IFileSystemBindDataImpl::GetFindData(WIN32_FIND_DATAW
*pfd
)
146 TRACE("(%p), %p\n", this, pfd
);
151 memcpy(pfd
, &findFile
, sizeof(WIN32_FIND_DATAW
));
155 HRESULT WINAPI
IFileSystemBindDataImpl::SetFindData(const WIN32_FIND_DATAW
*pfd
)
157 TRACE("(%p), %p\n", this, pfd
);
160 memcpy(&findFile
, pfd
, sizeof(WIN32_FIND_DATAW
));
162 memset(&findFile
, 0, sizeof(WIN32_FIND_DATAW
));