ReactOS 0.4.15-dev-7924-g5949c20
CFileSysBindData.cpp
Go to the documentation of this file.
1/*
2 * File System Bind Data object to use as parameter for the bind context to
3 * IShellFolder_ParseDisplayName
4 *
5 * Copyright 2003 Rolf Kalbermatter
6 *
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.
11 *
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.
16 *
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
20 *
21 */
22
23#include "precomp.h"
24
26
27/***********************************************************************
28 * IFileSystemBindData implementation
29 */
31 public CComObjectRootEx<CComMultiThreadModelNoCS>,
33{
34private:
36public:
39
40 // *** IFileSystemBindData methods ***
41 STDMETHOD(SetFindData)(const WIN32_FIND_DATAW *pfd) override;
43
46
48 COM_INTERFACE_ENTRY_IID(IID_IFileSystemBindData, IFileSystemBindData)
50};
51
53{
54 CComPtr<IFileSystemBindData> fileSystemBindData;
55 CComPtr<IBindCtx> bindContext;
56 BIND_OPTS bindOpts;
57 HRESULT hResult;
58
59 TRACE("%p, %p\n", pfd, ppV);
60
61 if (ppV == NULL)
62 return E_INVALIDARG;
63
64 *ppV = NULL;
65
66 hResult = CFileSysBindData::_CreatorClass::CreateInstance(NULL, IID_PPV_ARG(IFileSystemBindData, &fileSystemBindData));
67 if (FAILED(hResult))
68 return hResult;
69 hResult = fileSystemBindData->SetFindData(pfd);
70 if (FAILED(hResult))
71 return hResult;
72
73 hResult = CreateBindCtx(0, &bindContext);
74 if (FAILED(hResult))
75 return hResult;
76 bindOpts.cbStruct = sizeof(BIND_OPTS);
77 bindOpts.grfFlags = 0;
78 bindOpts.grfMode = STGM_CREATE;
79 bindOpts.dwTickCountDeadline = 0;
80 hResult = bindContext->SetBindOptions(&bindOpts);
81 if (FAILED(hResult))
82 return hResult;
83 hResult = bindContext->RegisterObjectParam((LPOLESTR)STR_FILE_SYS_BIND_DATA, fileSystemBindData);
84 if (FAILED(hResult))
85 return hResult;
86
87 *ppV = bindContext.Detach();
88
89 return S_OK;
90}
91
93{
97
98 TRACE("%p, %p\n", pbc, pfd);
99
100 if (!pfd)
101 return E_INVALIDARG;
102
103 ret = pbc->GetObjectParam((LPOLESTR)STR_FILE_SYS_BIND_DATA, &pUnk);
104 if (SUCCEEDED(ret))
105 {
107 if (SUCCEEDED(ret))
108 ret = pfsbd->GetFindData(pfd);
109 }
110 return ret;
111}
112
114{
117 HRESULT ret;
118
119 TRACE("%p, %p\n", pbc, pfd);
120
121 ret = pbc->GetObjectParam((LPOLESTR)STR_FILE_SYS_BIND_DATA, &pUnk);
122 if (SUCCEEDED(ret))
123 {
125 if (SUCCEEDED(ret))
126 ret = pfsbd->SetFindData(pfd);
127 }
128 return ret;
129}
130
132{
133 memset(&findFile, 0, sizeof(WIN32_FIND_DATAW));
134}
135
137{
138 TRACE(" destroying ISFBindPidl(%p)\n", this);
139}
140
142{
143 TRACE("(%p), %p\n", this, pfd);
144
145 if (!pfd)
146 return E_INVALIDARG;
147
149 return S_OK;
150}
151
153{
154 TRACE("(%p), %p\n", this, pfd);
155
156 if (pfd)
158 else
159 memset(&findFile, 0, sizeof(WIN32_FIND_DATAW));
160 return S_OK;
161}
HRESULT WINAPI FileSystemBindData_GetFindData(LPBC pbc, WIN32_FIND_DATAW *pfd)
HRESULT WINAPI FileSystemBindData_SetFindData(LPBC pbc, const WIN32_FIND_DATAW *pfd)
HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC *ppV)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define STDMETHOD(m)
Definition: basetyps.h:62
T * Detach()
Definition: atlcomcli.h:186
WIN32_FIND_DATAW findFile
STDMETHOD() SetFindData(const WIN32_FIND_DATAW *pfd) override
STDMETHOD() GetFindData(WIN32_FIND_DATAW *pfd) override
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
nsresult QueryInterface(nsIIDRef riid, void **result)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define END_COM_MAP()
Definition: atlcom.h:592
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static LPOLESTR
Definition: stg_prop.c:27
#define STGM_CREATE
Definition: objbase.h:926
interface IBindCtx * LPBC
Definition: objfwd.h:18
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
static PIXELFORMATDESCRIPTOR pfd
Definition: ssstars.c:67
int ret
#define WINAPI
Definition: msvc.h:6
#define IID_PPV_ARG(Itype, ppType)
#define const
Definition: zconf.h:233