Release 980628
[wine/gsoc-2012-control.git] / ole / folders.c
blob1c37812fe9a8c2855f41f77f5b9bb2a10cc6cddd
1 /*
2 * Shell Folder stuff
4 * Copyright 1997 Marcus Meissner
6 * currently work in progress on IShellFolders,IEnumIDList and pidl handling
7 * <contact juergen.schmied@metronet.de, 980624>
8 */
10 #include <ctype.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include "ole.h"
14 #include "ole2.h"
15 #include "debug.h"
16 #include "compobj.h"
17 #include "interfaces.h"
18 #include "shlobj.h"
19 #include "winerror.h"
21 /******************************************************************************
22 * IEnumIDList implementation
25 static ULONG WINAPI IEnumIDList_AddRef(LPENUMIDLIST this) {
26 TRACE(ole,"(%p)->()\n",this);
27 return ++(this->ref);
30 static ULONG WINAPI IEnumIDList_Release(LPENUMIDLIST this) {
31 TRACE(ole,"(%p)->()\n",this);
32 if (!--(this->ref)) {
33 WARN(ole," freeing IEnumIDList(%p)\n",this);
34 HeapFree(GetProcessHeap(),0,this);
35 return 0;
37 return this->ref;
40 static HRESULT WINAPI IEnumIDList_Next(
41 LPENUMIDLIST this,ULONG celt,LPITEMIDLIST *rgelt,ULONG *pceltFetched
42 ) {
43 FIXME(ole,"(%p)->(%ld,%p,%p),stub!\n",
44 this,celt,rgelt,pceltFetched
46 *pceltFetched = 0; /* we don't have any ... */
47 return 0;
50 static IEnumIDList_VTable eidlvt = {
51 (void *)1,
52 IEnumIDList_AddRef,
53 IEnumIDList_Release,
54 IEnumIDList_Next,
55 (void *)5,
56 (void *)6,
57 (void *)7
60 LPENUMIDLIST IEnumIDList_Constructor() {
61 LPENUMIDLIST lpeidl;
63 lpeidl= (LPENUMIDLIST)HeapAlloc(GetProcessHeap(),0,sizeof(IEnumIDList));
64 lpeidl->ref = 1;
65 lpeidl->lpvtbl = &eidlvt;
66 return lpeidl;
69 /******************************************************************************
70 * IShellFolder implementation
72 static ULONG WINAPI IShellFolder_Release(LPSHELLFOLDER this) {
73 TRACE(ole,"(%p)->(count=%lu)\n",this,this->ref);
74 if (!--(this->ref)) {
75 WARN(ole," freeing IShellFolder(%p)\n",this);
76 HeapFree(GetProcessHeap(),0,this);
77 return 0;
79 return this->ref;
82 static ULONG WINAPI IShellFolder_AddRef(LPSHELLFOLDER this) {
83 TRACE(ole,"(%p)->(count=%lu)\n",this,(this->ref)+1);
84 return ++(this->ref);
87 static HRESULT WINAPI IShellFolder_GetAttributesOf(
88 LPSHELLFOLDER this,UINT32 cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut
89 ) {
90 FIXME(ole,"\n (%p)->(%d,%p->(%p),%p),stub!\n",
91 this,cidl,apidl,*apidl,rgfInOut
93 return E_NOTIMPL;
96 /*---------------------------------------------------------------
97 ! IShellFolder_BindToObject
100 static HRESULT WINAPI IShellFolder_BindToObject(
101 LPSHELLFOLDER this,LPCITEMIDLIST pidl,LPBC pbcReserved,
102 REFIID riid,LPVOID * ppvOut)
103 { char xclsid[50];
105 WINE_StringFromCLSID(riid,xclsid);
107 FIXME(ole,"(%p)->(pidl:%p,%p,%s,%p),stub!\n",this,pidl,pbcReserved,xclsid,ppvOut);
108 *ppvOut = IShellFolder_Constructor();
110 return E_NOTIMPL;
112 /*---------------------------------------------------------------
113 ! IShellFolder_ParseDisplayName
116 static HRESULT WINAPI IShellFolder_ParseDisplayName(
117 LPSHELLFOLDER this,HWND32 hwndOwner,LPBC pbcReserved,
118 LPOLESTR32 lpszDisplayName,DWORD *pchEaten,LPITEMIDLIST *ppidl,
119 DWORD *pdwAttributes
120 ) { TRACE(ole,"(%p)->(%08x,%p,%p=%s,%p,%p,%p)\n",
121 this,hwndOwner,pbcReserved,lpszDisplayName,debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes
123 // if (pbcReserved)
124 // *(DWORD*)pbcReserved = 0;
126 *ppidl = (LPITEMIDLIST)HeapAlloc(GetProcessHeap(),0,sizeof(ITEMIDLIST));
127 (*ppidl)->mkid.cb = 0x0; /*the first ITEMIDLIST*/
128 (*ppidl)->mkid.abID[0] = 0x0; /*the first ITEMIDLIST*/
130 // ((LPITEMIDLIST) (((LPBYTE)ppidl)+4) )->mkid.cb=0; /*the second ITEMIDLIST*/
131 // ((LPITEMIDLIST) (((LPBYTE)ppidl)+4) )->mkid.abID[0]=0; /*the second ITEMIDLIST*/
132 FIXME(shell, "return dummy ITEMIDLIST only (pidl %p)\n",*ppidl);
134 /* it is NULL if the caller don't request attributes*/
135 if (pdwAttributes)
136 { *pdwAttributes=SFGAO_FOLDER;
139 //*pchEaten = lstrlen32W(lpszDisplayName); /* number of char's parsed*/
140 //TRACE(shell,"%1 chars parsed",*pchEaten)
141 return NOERROR;
144 static HRESULT WINAPI IShellFolder_EnumObjects(
145 LPSHELLFOLDER this,HWND32 hwndOwner,DWORD grfFlags,
146 LPENUMIDLIST* ppenumIDList
148 FIXME(ole,"(%p)->(0x%04x,0x%08lx,%p),stub!\n",
149 this,hwndOwner,grfFlags,ppenumIDList
151 *ppenumIDList = IEnumIDList_Constructor();
152 return 0;
155 static HRESULT WINAPI IShellFolder_CreateViewObject(
156 LPSHELLFOLDER this,HWND32 hwndOwner,REFIID riid,LPVOID *ppv
158 char xclsid[50];
160 WINE_StringFromCLSID(riid,xclsid);
161 FIXME(ole,"(%p)->(0x%04x,%s,%p),stub!\n",
162 this,hwndOwner,xclsid,ppv
164 *(DWORD*)ppv = 0;
165 return 0;
169 static struct IShellFolder_VTable sfvt = {
170 (void *)1,
171 IShellFolder_AddRef,
172 IShellFolder_Release,
173 IShellFolder_ParseDisplayName,
174 IShellFolder_EnumObjects,
175 IShellFolder_BindToObject,
176 (void *)7,
177 (void *)8,
178 IShellFolder_CreateViewObject,
179 IShellFolder_GetAttributesOf,
180 (void *)11,
181 (void *)12,
182 (void *)13
185 LPSHELLFOLDER IShellFolder_Constructor() {
186 LPSHELLFOLDER sf;
187 sf = (LPSHELLFOLDER)HeapAlloc(GetProcessHeap(),0,sizeof(IShellFolder));
188 sf->ref = 1;
189 sf->lpvtbl = &sfvt;
190 TRACE(ole,"(%p)->()\n",sf);
191 return sf;
194 static struct IShellLink_VTable slvt = {
195 (void *)1,
196 (void *)2,
197 (void *)3,
198 (void *)4,
199 (void *)5,
200 (void *)6,
201 (void *)7,
202 (void *)8,
203 (void *)9,
204 (void *)10,
205 (void *)11,
206 (void *)12,
207 (void *)13,
208 (void *)14,
209 (void *)15,
210 (void *)16,
211 (void *)17,
212 (void *)18,
213 (void *)19,
214 (void *)20,
215 (void *)21
218 LPSHELLLINK IShellLink_Constructor() {
219 LPSHELLLINK sl;
221 sl = (LPSHELLLINK)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLink));
222 sl->ref = 1;
223 sl->lpvtbl = &slvt;
224 return sl;