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 CFileSysBindData
:
31 public CComObjectRootEx
<CComMultiThreadModelNoCS
>,
32 public IFileSystemBindData
35 WIN32_FIND_DATAW findFile
;
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(CFileSysBindData
)
45 DECLARE_PROTECT_FINAL_CONSTRUCT()
47 BEGIN_COM_MAP(CFileSysBindData
)
48 COM_INTERFACE_ENTRY_IID(IID_IFileSystemBindData
, IFileSystemBindData
)
52 HRESULT WINAPI
IFileSystemBindData_Constructor(const WIN32_FIND_DATAW
*pfd
, LPBC
*ppV
)
54 CComPtr
<IFileSystemBindData
> fileSystemBindData
;
55 CComPtr
<IBindCtx
> bindContext
;
59 TRACE("%p, %p\n", pfd
, ppV
);
66 hResult
= CFileSysBindData::_CreatorClass::CreateInstance(NULL
, IID_PPV_ARG(IFileSystemBindData
, &fileSystemBindData
));
69 hResult
= fileSystemBindData
->SetFindData(pfd
);
73 hResult
= CreateBindCtx(0, &bindContext
);
76 bindOpts
.cbStruct
= sizeof(BIND_OPTS
);
77 bindOpts
.grfFlags
= 0;
78 bindOpts
.grfMode
= STGM_CREATE
;
79 bindOpts
.dwTickCountDeadline
= 0;
80 hResult
= bindContext
->SetBindOptions(&bindOpts
);
83 hResult
= bindContext
->RegisterObjectParam((LPOLESTR
)STR_FILE_SYS_BIND_DATA
, fileSystemBindData
);
87 *ppV
= bindContext
.Detach();
92 HRESULT WINAPI
FileSystemBindData_GetFindData(LPBC pbc
, WIN32_FIND_DATAW
*pfd
)
94 CComPtr
<IUnknown
> pUnk
;
95 CComPtr
<IFileSystemBindData
> pfsbd
;
98 TRACE("%p, %p\n", pbc
, pfd
);
103 ret
= pbc
->GetObjectParam((LPOLESTR
)STR_FILE_SYS_BIND_DATA
, &pUnk
);
106 ret
= pUnk
->QueryInterface(IID_PPV_ARG(IFileSystemBindData
, &pfsbd
));
108 ret
= pfsbd
->GetFindData(pfd
);
113 HRESULT WINAPI
FileSystemBindData_SetFindData(LPBC pbc
, const WIN32_FIND_DATAW
*pfd
)
115 CComPtr
<IUnknown
> pUnk
;
116 CComPtr
<IFileSystemBindData
> pfsbd
;
119 TRACE("%p, %p\n", pbc
, pfd
);
121 ret
= pbc
->GetObjectParam((LPOLESTR
)STR_FILE_SYS_BIND_DATA
, &pUnk
);
124 ret
= pUnk
->QueryInterface(IID_PPV_ARG(IFileSystemBindData
, &pfsbd
));
126 ret
= pfsbd
->SetFindData(pfd
);
131 CFileSysBindData::CFileSysBindData()
133 memset(&findFile
, 0, sizeof(WIN32_FIND_DATAW
));
136 CFileSysBindData::~CFileSysBindData()
138 TRACE(" destroying ISFBindPidl(%p)\n", this);
141 HRESULT WINAPI
CFileSysBindData::GetFindData(WIN32_FIND_DATAW
*pfd
)
143 TRACE("(%p), %p\n", this, pfd
);
148 memcpy(pfd
, &findFile
, sizeof(WIN32_FIND_DATAW
));
152 HRESULT WINAPI
CFileSysBindData::SetFindData(const WIN32_FIND_DATAW
*pfd
)
154 TRACE("(%p), %p\n", this, pfd
);
157 memcpy(&findFile
, pfd
, sizeof(WIN32_FIND_DATAW
));
159 memset(&findFile
, 0, sizeof(WIN32_FIND_DATAW
));