~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/shell32/shlfsbind.c

Version: ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  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 #include "config.h"
 23 #include "wine/port.h"
 24 
 25 #include <stdarg.h>
 26 
 27 #define COBJMACROS
 28 
 29 #include "windef.h"
 30 #include "winbase.h"
 31 #include "winuser.h"
 32 #include "shlobj.h"
 33 #include "shell32_main.h"
 34 
 35 #include "wine/debug.h"
 36 
 37 WINE_DEFAULT_DEBUG_CHANNEL(pidl);
 38 
 39 /***********************************************************************
 40  * IFileSystemBindData implementation
 41  */
 42 typedef struct
 43 {
 44     IFileSystemBindData IFileSystemBindData_iface;
 45     LONG ref;
 46     WIN32_FIND_DATAW findFile;
 47 } FileSystemBindData;
 48 
 49 static inline FileSystemBindData *impl_from_IFileSystemBindData(IFileSystemBindData *iface)
 50 {
 51     return CONTAINING_RECORD(iface, FileSystemBindData, IFileSystemBindData_iface);
 52 }
 53 
 54 static HRESULT WINAPI FileSystemBindData_QueryInterface(
 55                 IFileSystemBindData *iface, REFIID riid, LPVOID *ppV)
 56 {
 57     FileSystemBindData *This = impl_from_IFileSystemBindData(iface);
 58 
 59     TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppV);
 60 
 61     *ppV = NULL;
 62 
 63     if (IsEqualIID(riid, &IID_IUnknown) ||
 64         IsEqualIID(riid, &IID_IFileSystemBindData))
 65     {
 66         *ppV = &This->IFileSystemBindData_iface;
 67     }
 68 
 69     if (*ppV)
 70     {
 71         IFileSystemBindData_AddRef(iface);
 72         TRACE("-- Interface: (%p)->(%p)\n", ppV, *ppV);
 73         return S_OK;
 74     }
 75     TRACE("-- Interface: E_NOINTERFACE\n");
 76     return E_NOINTERFACE;
 77 }
 78 
 79 static ULONG WINAPI FileSystemBindData_AddRef(IFileSystemBindData *iface)
 80 {
 81     FileSystemBindData *This = impl_from_IFileSystemBindData(iface);
 82     ULONG ref = InterlockedIncrement(&This->ref);
 83     TRACE("(%p)->(%u)\n", This, ref);
 84     return ref;
 85 }
 86 
 87 static ULONG WINAPI FileSystemBindData_Release(IFileSystemBindData *iface)
 88 {
 89     FileSystemBindData *This = impl_from_IFileSystemBindData(iface);
 90     ULONG ref = InterlockedDecrement(&This->ref);
 91 
 92     TRACE("(%p)->(%u)\n", This, ref);
 93 
 94     if (!ref)
 95         HeapFree(GetProcessHeap(), 0, This);
 96 
 97     return ref;
 98 }
 99 
100 static HRESULT WINAPI FileSystemBindData_GetFindData(IFileSystemBindData *iface, WIN32_FIND_DATAW *pfd)
101 {
102     FileSystemBindData *This = impl_from_IFileSystemBindData(iface);
103 
104     TRACE("(%p)->(%p)\n", This, pfd);
105 
106     if (!pfd)
107         return E_INVALIDARG;
108 
109     *pfd = This->findFile;
110     return S_OK;
111 }
112 
113 static HRESULT WINAPI FileSystemBindData_SetFindData(IFileSystemBindData *iface, const WIN32_FIND_DATAW *pfd)
114 {
115     FileSystemBindData *This = impl_from_IFileSystemBindData(iface);
116 
117     TRACE("(%p)->(%p)\n", This, pfd);
118 
119     if (pfd)
120         This->findFile = *pfd;
121     else
122         memset(&This->findFile, 0, sizeof(WIN32_FIND_DATAW));
123     return S_OK;
124 }
125 
126 static const IFileSystemBindDataVtbl FileSystemBindDataVtbl = {
127     FileSystemBindData_QueryInterface,
128     FileSystemBindData_AddRef,
129     FileSystemBindData_Release,
130     FileSystemBindData_SetFindData,
131     FileSystemBindData_GetFindData,
132 };
133 
134 HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *find_data, LPBC *ppV)
135 {
136     FileSystemBindData *This;
137     HRESULT ret;
138 
139     TRACE("(%p %p)\n", find_data, ppV);
140 
141     if (!ppV)
142        return E_INVALIDARG;
143 
144     *ppV = NULL;
145 
146     This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
147     if (!This) return E_OUTOFMEMORY;
148 
149     This->IFileSystemBindData_iface.lpVtbl = &FileSystemBindDataVtbl;
150     This->ref = 1;
151     IFileSystemBindData_SetFindData(&This->IFileSystemBindData_iface, find_data);
152 
153     ret = CreateBindCtx(0, ppV);
154     if (SUCCEEDED(ret))
155     {
156         static const WCHAR nameW[] = {
157             'F','i','l','e',' ','S','y','s','t','e','m',' ','B','i','n','d',' ','D','a','t','a',0};
158         BIND_OPTS bindOpts;
159 
160         bindOpts.cbStruct = sizeof(BIND_OPTS);
161         bindOpts.grfFlags = 0;
162         bindOpts.grfMode = STGM_CREATE;
163         bindOpts.dwTickCountDeadline = 0;
164         IBindCtx_SetBindOptions(*ppV, &bindOpts);
165         IBindCtx_RegisterObjectParam(*ppV, (WCHAR*)nameW, (IUnknown*)&This->IFileSystemBindData_iface);
166 
167         IFileSystemBindData_Release(&This->IFileSystemBindData_iface);
168     }
169     else
170         HeapFree(GetProcessHeap(), 0, This);
171     return ret;
172 }
173 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.