Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenshlfsbind.cpp
Go to the documentation of this file.
00001 /* 00002 * File System Bind Data object to use as parameter for the bind context to 00003 * IShellFolder_ParseDisplayName 00004 * 00005 * Copyright 2003 Rolf Kalbermatter 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00020 * 00021 */ 00022 00023 #include <precomp.h> 00024 00025 WINE_DEFAULT_DEBUG_CHANNEL(pidl); 00026 00027 /*********************************************************************** 00028 * IFileSystemBindData implementation 00029 */ 00030 class IFileSystemBindDataImpl : 00031 public CComObjectRootEx<CComMultiThreadModelNoCS>, 00032 public IFileSystemBindData 00033 { 00034 private: 00035 WIN32_FIND_DATAW findFile; 00036 public: 00037 IFileSystemBindDataImpl(); 00038 ~IFileSystemBindDataImpl(); 00039 00040 // *** IFileSystemBindData methods *** 00041 virtual HRESULT STDMETHODCALLTYPE SetFindData(const WIN32_FIND_DATAW *pfd); 00042 virtual HRESULT STDMETHODCALLTYPE GetFindData(WIN32_FIND_DATAW *pfd); 00043 00044 DECLARE_NOT_AGGREGATABLE(IFileSystemBindDataImpl) 00045 DECLARE_PROTECT_FINAL_CONSTRUCT() 00046 00047 BEGIN_COM_MAP(IFileSystemBindDataImpl) 00048 COM_INTERFACE_ENTRY_IID(IID_IFileSystemBindData, IFileSystemBindData) 00049 END_COM_MAP() 00050 }; 00051 00052 static const WCHAR wFileSystemBindData[] = { 00053 'F','i','l','e',' ','S','y','s','t','e','m',' ','B','i','n','d','D','a','t','a',0}; 00054 00055 HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC *ppV) 00056 { 00057 CComPtr<IFileSystemBindData> fileSystemBindData; 00058 CComPtr<IBindCtx> bindContext; 00059 BIND_OPTS bindOpts; 00060 HRESULT hResult; 00061 00062 TRACE("%p, %p\n", pfd, ppV); 00063 00064 if (ppV == NULL) 00065 return E_INVALIDARG; 00066 00067 *ppV = NULL; 00068 00069 hResult = IFileSystemBindDataImpl::_CreatorClass::CreateInstance(NULL, IID_IFileSystemBindData, (void **)&fileSystemBindData); 00070 if (FAILED(hResult)) 00071 return hResult; 00072 hResult = fileSystemBindData->SetFindData(pfd); 00073 if (FAILED(hResult)) 00074 return hResult; 00075 00076 hResult = CreateBindCtx(0, &bindContext); 00077 if (FAILED(hResult)) 00078 return hResult; 00079 bindOpts.cbStruct = sizeof(BIND_OPTS); 00080 bindOpts.grfFlags = 0; 00081 bindOpts.grfMode = STGM_CREATE; 00082 bindOpts.dwTickCountDeadline = 0; 00083 hResult = bindContext->SetBindOptions(&bindOpts); 00084 if (FAILED(hResult)) 00085 return hResult; 00086 hResult = bindContext->RegisterObjectParam((LPOLESTR)wFileSystemBindData, fileSystemBindData); 00087 if (FAILED(hResult)) 00088 return hResult; 00089 00090 *ppV = bindContext.Detach(); 00091 00092 return S_OK; 00093 } 00094 00095 HRESULT WINAPI FileSystemBindData_GetFindData(LPBC pbc, WIN32_FIND_DATAW *pfd) 00096 { 00097 CComPtr<IUnknown> pUnk; 00098 CComPtr<IFileSystemBindData> pfsbd; 00099 HRESULT ret; 00100 00101 TRACE("%p, %p\n", pbc, pfd); 00102 00103 if (!pfd) 00104 return E_INVALIDARG; 00105 00106 ret = pbc->GetObjectParam((LPOLESTR)wFileSystemBindData, &pUnk); 00107 if (SUCCEEDED(ret)) 00108 { 00109 ret = pUnk->QueryInterface(IID_IFileSystemBindData, (LPVOID *)&pfsbd); 00110 if (SUCCEEDED(ret)) 00111 ret = pfsbd->GetFindData(pfd); 00112 } 00113 return ret; 00114 } 00115 00116 HRESULT WINAPI FileSystemBindData_SetFindData(LPBC pbc, const WIN32_FIND_DATAW *pfd) 00117 { 00118 CComPtr<IUnknown> pUnk; 00119 CComPtr<IFileSystemBindData> pfsbd; 00120 HRESULT ret; 00121 00122 TRACE("%p, %p\n", pbc, pfd); 00123 00124 ret = pbc->GetObjectParam((LPOLESTR)wFileSystemBindData, &pUnk); 00125 if (SUCCEEDED(ret)) 00126 { 00127 ret = pUnk->QueryInterface(IID_IFileSystemBindData, (LPVOID *)&pfsbd); 00128 if (SUCCEEDED(ret)) 00129 ret = pfsbd->SetFindData(pfd); 00130 } 00131 return ret; 00132 } 00133 00134 IFileSystemBindDataImpl::IFileSystemBindDataImpl() 00135 { 00136 memset(&findFile, 0, sizeof(WIN32_FIND_DATAW)); 00137 } 00138 00139 IFileSystemBindDataImpl::~IFileSystemBindDataImpl() 00140 { 00141 TRACE(" destroying ISFBindPidl(%p)\n", this); 00142 } 00143 00144 HRESULT WINAPI IFileSystemBindDataImpl::GetFindData(WIN32_FIND_DATAW *pfd) 00145 { 00146 TRACE("(%p), %p\n", this, pfd); 00147 00148 if (!pfd) 00149 return E_INVALIDARG; 00150 00151 memcpy(pfd, &findFile, sizeof(WIN32_FIND_DATAW)); 00152 return NOERROR; 00153 } 00154 00155 HRESULT WINAPI IFileSystemBindDataImpl::SetFindData(const WIN32_FIND_DATAW *pfd) 00156 { 00157 TRACE("(%p), %p\n", this, pfd); 00158 00159 if (pfd) 00160 memcpy(&findFile, pfd, sizeof(WIN32_FIND_DATAW)); 00161 else 00162 memset(&findFile, 0, sizeof(WIN32_FIND_DATAW)); 00163 return NOERROR; 00164 } Generated on Sun May 27 2012 04:26:27 for ReactOS by
1.7.6.1
|