[CMAKE]
[reactos.git] / dll / win32 / browseui / browseuiord.cpp
1 /*
2 * ReactOS browseui
3 *
4 * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #include <windows.h>
22 #include <shlobj.h>
23 #include <shlobj_undoc.h>
24 #include <shlguid.h>
25 #include <shlguid_undoc.h>
26 #include <shlwapi_undoc.h>
27
28 extern DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter);
29
30 /*************************************************************************
31 * InitOCHostClass [BROWSEUI.101]
32 */
33 extern "C" void WINAPI InitOCHostClass(long param8)
34 {
35 // forwards to shdocvw
36 }
37
38 /*************************************************************************
39 * SHOpenFolderWindow [BROWSEUI.102]
40 */
41 extern "C" long WINAPI SHOpenFolderWindow(IEThreadParamBlock *param8)
42 {
43 return 0;
44 }
45
46 /*************************************************************************
47 * SHCreateSavedWindows [BROWSEUI.105]
48 * Called to recreate explorer windows from previous session
49 */
50 extern "C" void WINAPI SHCreateSavedWindows()
51 {
52 }
53
54 /*************************************************************************
55 * SHCreateFromDesktop [BROWSEUI.106]
56 * parameter is a FolderInfo
57 */
58 extern "C" long WINAPI SHCreateFromDesktop(long param8)
59 {
60 return -1;
61 }
62
63 /*************************************************************************
64 * SHExplorerParseCmdLine [BROWSEUI.107]
65 */
66 extern "C" long WINAPI SHExplorerParseCmdLine(LPCTSTR commandLine)
67 {
68 return -1;
69 }
70
71 /*************************************************************************
72 * UEMRegisterNotify [BROWSEUI.118]
73 */
74 extern "C" void WINAPI UEMRegisterNotify(long param8, long paramC)
75 {
76 }
77
78 /*************************************************************************
79 * SHCreateBandForPidl [BROWSEUI.120]
80 */
81 extern "C" HRESULT WINAPI SHCreateBandForPidl(LPCITEMIDLIST param8, IUnknown *paramC, BOOL param10)
82 {
83 return E_NOTIMPL;
84 }
85
86 /*************************************************************************
87 * SHPidlFromDataObject [BROWSEUI.121]
88 */
89 extern "C" HRESULT WINAPI SHPidlFromDataObject(IDataObject *param8, long *paramC, long param10, FILEDESCRIPTORW *param14)
90 {
91 return E_NOTIMPL;
92 }
93
94 /*************************************************************************
95 * IDataObject_GetDeskBandState [BROWSEUI.122]
96 */
97 extern "C" long WINAPI IDataObject_GetDeskBandState(long param8)
98 {
99 return -1;
100 }
101
102 /*************************************************************************
103 * SHCreateIETHREADPARAM [BROWSEUI.123]
104 */
105 extern "C" IEThreadParamBlock *WINAPI SHCreateIETHREADPARAM(long param8, long paramC, IUnknown *param10, IUnknown *param14)
106 {
107 IEThreadParamBlock *result;
108
109 result = (IEThreadParamBlock *)LocalAlloc(LMEM_ZEROINIT, 256);
110 if (result == NULL)
111 return NULL;
112 result->offset0 = param8;
113 result->offset8 = paramC;
114 result->offsetC = param10;
115 if (param10 != NULL)
116 param10->AddRef();
117 result->offset14 = param14;
118 if (param14 != NULL)
119 param14->AddRef();
120 return result;
121 }
122
123 /*************************************************************************
124 * SHCloneIETHREADPARAM [BROWSEUI.124]
125 */
126 extern "C" IEThreadParamBlock *WINAPI SHCloneIETHREADPARAM(IEThreadParamBlock *param)
127 {
128 IEThreadParamBlock *result;
129
130 result = (IEThreadParamBlock *)LocalAlloc(LMEM_FIXED, 256);
131 if (result == NULL)
132 return NULL;
133 memcpy(result, param, 0x40 * 4);
134 if (result->directoryPIDL != NULL)
135 result->directoryPIDL = ILClone(result->directoryPIDL);
136 if (result->offset7C != NULL)
137 result->offset7C = ILClone(result->offset7C);
138 if (result->offset80 != NULL)
139 result->offset80 = ILClone(result->offset80);
140 if (result->offset70 != NULL)
141 result->offset70->AddRef();
142 #if 0
143 if (result->offsetC != NULL)
144 result->offsetC->Method2C();
145 #endif
146 return result;
147 }
148
149 /*************************************************************************
150 * SHParseIECommandLine [BROWSEUI.125]
151 */
152 extern "C" long WINAPI SHParseIECommandLine(long param8, long paramC)
153 {
154 return -1;
155 }
156
157 /*************************************************************************
158 * SHDestroyIETHREADPARAM [BROWSEUI.126]
159 */
160 extern "C" void WINAPI SHDestroyIETHREADPARAM(IEThreadParamBlock *param)
161 {
162 if (param == NULL)
163 return;
164 if (param->directoryPIDL != NULL)
165 ILFree(param->directoryPIDL);
166 if (param->offset7C != NULL)
167 ILFree(param->offset7C);
168 if ((param->offset4 & 0x80000) == 0 && param->offset80 != NULL)
169 ILFree(param->offset80);
170 if (param->offset14 != NULL)
171 param->offset14->Release();
172 if (param->offset70 != NULL)
173 param->offset70->Release();
174 if (param->offset78 != NULL)
175 param->offset78->Release();
176 if (param->offsetC != NULL)
177 param->offsetC->Release();
178 if (param->offsetF8 != NULL)
179 param->offsetF8->Release();
180 LocalFree(param);
181 }
182
183 /*************************************************************************
184 * SHOnCWMCommandLine [BROWSEUI.127]
185 */
186 extern "C" HRESULT WINAPI SHOnCWMCommandLine(long param8)
187 {
188 return E_NOTIMPL;
189 }
190
191 /*************************************************************************
192 * Channel_GetFolderPidl [BROWSEUI.128]
193 */
194 extern "C" LPITEMIDLIST WINAPI Channel_GetFolderPidl()
195 {
196 return NULL;
197 }
198
199 /*************************************************************************
200 * ChannelBand_Create [BROWSEUI.129]
201 */
202 extern "C" IUnknown *WINAPI ChannelBand_Create(LPITEMIDLIST pidl)
203 {
204 return NULL;
205 }
206
207 /*************************************************************************
208 * Channels_SetBandInfoSFB [BROWSEUI.130]
209 */
210 extern "C" HRESULT WINAPI Channels_SetBandInfoSFB(IUnknown *param8)
211 {
212 return E_NOTIMPL;
213 }
214
215 /*************************************************************************
216 * IUnknown_SetBandInfoSFB [BROWSEUI.131]
217 */
218 extern "C" HRESULT WINAPI IUnknown_SetBandInfoSFB(IUnknown *param8, long paramC)
219 {
220 return E_NOTIMPL;
221 }
222
223 /*************************************************************************
224 * Channel_QuickLaunch [BROWSEUI.133]
225 */
226 extern "C" HRESULT WINAPI Channel_QuickLaunch()
227 {
228 return E_NOTIMPL;
229 }
230
231 /*************************************************************************
232 * SHGetNavigateTarget [BROWSEUI.134]
233 */
234 extern "C" HRESULT WINAPI SHGetNavigateTarget(long param8, long paramC, long param10, long param14)
235 {
236 return E_NOTIMPL;
237 }
238
239 /*************************************************************************
240 * GetInfoTip [BROWSEUI.135]
241 */
242 extern "C" HRESULT WINAPI GetInfoTip(IUnknown *param8, long paramC, LPTSTR *param10, long cchMax)
243 {
244 return E_NOTIMPL;
245 }
246
247 /*************************************************************************
248 * SHEnumClassesOfCategories [BROWSEUI.136]
249 */
250 extern "C" HRESULT WINAPI SHEnumClassesOfCategories(long param8, long paramC, long param10, long param14, long param18)
251 {
252 return E_NOTIMPL;
253 }
254
255 /*************************************************************************
256 * SHWriteClassesOfCategories [BROWSEUI.137]
257 */
258 extern "C" HRESULT WINAPI SHWriteClassesOfCategories(long param8, long paramC, long param10, long param14, long param18, long param1C, long param20)
259 {
260 return E_NOTIMPL;
261 }
262
263 /*************************************************************************
264 * SHIsExplorerBrowser [BROWSEUI.138]
265 */
266 extern "C" BOOL WINAPI SHIsExplorerBrowser()
267 {
268 return TRUE;
269 }
270
271 // 75FA56C1h
272 // (pidl, 0, -1, 1)
273 // this function should handle creating a new process if needed, but I'm leaving that out for now
274 // this function always opens a new window - it does NOT check for duplicates
275 /*************************************************************************
276 * SHOpenNewFrame [BROWSEUI.103]
277 */
278 extern "C" HRESULT WINAPI SHOpenNewFrame(LPITEMIDLIST pidl, IUnknown *paramC, long param10, long param14)
279 {
280 IEThreadParamBlock *parameters;
281 HANDLE threadHandle;
282 DWORD threadID;
283
284 parameters = SHCreateIETHREADPARAM(0, 1, paramC, NULL);
285 if (parameters == NULL)
286 {
287 ILFree(pidl);
288 return E_OUTOFMEMORY;
289 }
290 if (paramC != NULL)
291 parameters->offset10 = param10;
292 parameters->directoryPIDL = pidl;
293 parameters->offset4 = param14;
294 threadHandle = CreateThread(NULL, 0x10000, BrowserThreadProc, parameters, 0, &threadID);
295 if (threadHandle != NULL)
296 {
297 CloseHandle(threadHandle);
298 return S_OK;
299 }
300 SHDestroyIETHREADPARAM(parameters);
301 return E_FAIL;
302 }