blob: 772cd763305f0d1b91638a37a6f2c7b4c82eb814 [file] [log] [blame]
Alexandre Julliarde658d821997-11-30 17:45:40 +00001/*
Juergen Schmiedba28ba11999-01-23 14:12:48 +00002 * The parameters of many functions changes between different OS versions
3 * (NT uses Unicode strings, 95 uses ASCII strings)
Vincent Béron9a624912002-05-31 23:06:46 +00004 *
Alexandre Julliarde658d821997-11-30 17:45:40 +00005 * Copyright 1997 Marcus Meissner
Alexandre Julliard767e6f61998-08-09 12:47:43 +00006 * 1998 Jürgen Schmied
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00007 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Alexandre Julliarde658d821997-11-30 17:45:40 +000021 */
Rolf Kalbermatter73ffe2a2002-09-06 18:34:37 +000022#include "config.h"
23
Alexandre Julliarde658d821997-11-30 17:45:40 +000024#include <string.h>
Alexandre Julliard383da682000-02-10 22:15:21 +000025#include <stdio.h>
Alexandre Julliarda845b881998-06-01 10:44:35 +000026#include "winerror.h"
Marcus Meissner317af321999-02-17 13:51:06 +000027#include "winreg.h"
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000028#include "wine/debug.h"
Juergen Schmiede8d281d1998-10-24 09:22:57 +000029#include "winnls.h"
Juergen Schmiedba28ba11999-01-23 14:12:48 +000030#include "heap.h"
31
Juergen Schmied28613d31999-04-22 10:11:04 +000032#include "shellapi.h"
Alexandre Julliardb08cb172000-08-03 04:19:24 +000033#include "shlguid.h"
Juergen Schmiedba28ba11999-01-23 14:12:48 +000034#include "shlobj.h"
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000035#include "shell32_main.h"
Alexandre Julliard39541172001-08-16 18:49:56 +000036#include "undocshell.h"
Guy Albertelli60b59be2001-10-02 17:25:36 +000037#include "pidl.h"
Jon Griffiths603f20f2001-12-11 00:30:17 +000038#include "shlwapi.h"
Alexandre Julliardc72a9aa2002-01-31 21:05:05 +000039#include "commdlg.h"
Alexandre Julliarde658d821997-11-30 17:45:40 +000040
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000041WINE_DEFAULT_DEBUG_CHANNEL(shell);
42WINE_DECLARE_DEBUG_CHANNEL(pidl);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000043
Alexandre Julliardfb2eca82002-07-29 00:24:58 +000044/* FIXME: !!! move CREATEMRULIST and flags to header file !!! */
45/* !!! it is in both here and comctl32undoc.c !!! */
46typedef struct tagCREATEMRULIST
47{
48 DWORD cbSize; /* size of struct */
49 DWORD nMaxItems; /* max no. of items in list */
50 DWORD dwFlags; /* see below */
51 HKEY hKey; /* root reg. key under which list is saved */
52 LPCSTR lpszSubKey; /* reg. subkey */
53 PROC lpfnCompare; /* item compare proc */
54} CREATEMRULISTA, *LPCREATEMRULISTA;
55
56/* dwFlags */
57#define MRUF_STRING_LIST 0 /* list will contain strings */
58#define MRUF_BINARY_LIST 1 /* list will contain binary data */
59#define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
60
61extern HANDLE WINAPI CreateMRUListA(LPCREATEMRULISTA lpcml);
62extern DWORD WINAPI FreeMRUList(HANDLE hMRUList);
63extern INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData);
64extern INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum);
65extern INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize);
66
Alexandre Julliarde658d821997-11-30 17:45:40 +000067/*************************************************************************
Juergen Schmied85b92932000-04-28 20:21:49 +000068 * ParseFieldA [internal]
Alexandre Julliard642d3131998-07-12 19:29:36 +000069 *
Francois Gouget070e7492001-11-06 21:01:32 +000070 * copies a field from a ',' delimited string
Vincent Béron9a624912002-05-31 23:06:46 +000071 *
Juergen Schmiedeabe82b2000-02-26 18:45:09 +000072 * first field is nField = 1
Alexandre Julliard44ed71f1997-12-21 19:17:50 +000073 */
Juergen Schmied85b92932000-04-28 20:21:49 +000074DWORD WINAPI ParseFieldA(
75 LPCSTR src,
76 DWORD nField,
77 LPSTR dst,
Vincent Béron9a624912002-05-31 23:06:46 +000078 DWORD len)
Juergen Schmiedeabe82b2000-02-26 18:45:09 +000079{
Francois Gougetb60c4ce2001-10-14 16:15:05 +000080 WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n",debugstr_a(src),nField,dst,len);
Juergen Schmied07e0d941998-12-01 08:55:13 +000081
82 if (!src || !src[0] || !dst || !len)
83 return 0;
84
Juergen Schmiedeabe82b2000-02-26 18:45:09 +000085 /* skip n fields delimited by ',' */
86 while (nField > 1)
87 {
88 if (*src=='\0') return FALSE;
89 if (*(src++)==',') nField--;
Juergen Schmied07e0d941998-12-01 08:55:13 +000090 }
91
Juergen Schmiedeabe82b2000-02-26 18:45:09 +000092 /* copy part till the next ',' to dst */
93 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);
Vincent Béron9a624912002-05-31 23:06:46 +000094
Juergen Schmiedeabe82b2000-02-26 18:45:09 +000095 /* finalize the string */
Juergen Schmied07e0d941998-12-01 08:55:13 +000096 *dst=0x0;
Vincent Béron9a624912002-05-31 23:06:46 +000097
Juergen Schmied07e0d941998-12-01 08:55:13 +000098 return TRUE;
Alexandre Julliard44ed71f1997-12-21 19:17:50 +000099}
100
101/*************************************************************************
Juergen Schmied85b92932000-04-28 20:21:49 +0000102 * ParseFieldW [internal]
103 *
Francois Gouget070e7492001-11-06 21:01:32 +0000104 * copies a field from a ',' delimited string
Vincent Béron9a624912002-05-31 23:06:46 +0000105 *
Juergen Schmied85b92932000-04-28 20:21:49 +0000106 * first field is nField = 1
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000107 */
Vincent Béron9a624912002-05-31 23:06:46 +0000108DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len)
Juergen Schmied85b92932000-04-28 20:21:49 +0000109{
Rolf Kalbermatter247457c2002-12-06 23:20:52 +0000110 WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n", debugstr_w(src), nField, dst, len);
111
112 if (!src || !src[0] || !dst || !len)
113 return 0;
114
115 /* skip n fields delimited by ',' */
116 while (nField > 1)
117 {
118 if (*src == 0x0) return FALSE;
119 if (*src++ == ',') nField--;
120 }
121
122 /* copy part till the next ',' to dst */
123 while ( *src != 0x0 && *src != ',' && (len--)>0 ) *(dst++) = *(src++);
124
125 /* finalize the string */
126 *dst = 0x0;
127
128 return TRUE;
Juergen Schmied85b92932000-04-28 20:21:49 +0000129}
130
131/*************************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +0000132 * ParseField [SHELL32.58]
Juergen Schmied85b92932000-04-28 20:21:49 +0000133 */
Vincent Béron9a624912002-05-31 23:06:46 +0000134DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len)
Juergen Schmied85b92932000-04-28 20:21:49 +0000135{
Alexandre Julliardd586dc92000-08-14 14:35:01 +0000136 if (SHELL_OsIsUnicode())
Juergen Schmied85b92932000-04-28 20:21:49 +0000137 return ParseFieldW(src, nField, dst, len);
138 return ParseFieldA(src, nField, dst, len);
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000139}
140
141/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000142 * GetFileNameFromBrowse [SHELL32.63]
Vincent Béron9a624912002-05-31 23:06:46 +0000143 *
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000144 */
Juergen Schmied85b92932000-04-28 20:21:49 +0000145BOOL WINAPI GetFileNameFromBrowse(
146 HWND hwndOwner,
147 LPSTR lpstrFile,
148 DWORD nMaxFile,
149 LPCSTR lpstrInitialDir,
150 LPCSTR lpstrDefExt,
151 LPCSTR lpstrFilter,
152 LPCSTR lpstrTitle)
153{
Alexandre Julliardc72a9aa2002-01-31 21:05:05 +0000154 HMODULE hmodule;
155 FARPROC pGetOpenFileNameA;
156 OPENFILENAMEA ofn;
157 BOOL ret;
158
Johan Dahlin991fd852002-11-21 23:56:42 +0000159 TRACE("%p, %s, %ld, %s, %s, %s, %s)\n",
Juergen Schmied85b92932000-04-28 20:21:49 +0000160 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,
161 lpstrFilter, lpstrTitle);
162
Alexandre Julliardc72a9aa2002-01-31 21:05:05 +0000163 hmodule = LoadLibraryA("comdlg32.dll");
164 if(!hmodule) return FALSE;
165 pGetOpenFileNameA = GetProcAddress(hmodule, "GetOpenFileNameA");
166 if(!pGetOpenFileNameA)
167 {
168 FreeLibrary(hmodule);
169 return FALSE;
170 }
171
172 memset(&ofn, 0, sizeof(ofn));
173
174 ofn.lStructSize = sizeof(ofn);
175 ofn.hwndOwner = hwndOwner;
176 ofn.lpstrFilter = lpstrFilter;
177 ofn.lpstrFile = lpstrFile;
178 ofn.nMaxFile = nMaxFile;
179 ofn.lpstrInitialDir = lpstrInitialDir;
180 ofn.lpstrTitle = lpstrTitle;
181 ofn.lpstrDefExt = lpstrDefExt;
182 ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
183 ret = pGetOpenFileNameA(&ofn);
Vincent Béron9a624912002-05-31 23:06:46 +0000184
Alexandre Julliardc72a9aa2002-01-31 21:05:05 +0000185 FreeLibrary(hmodule);
186 return ret;
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000187}
188
189/*************************************************************************
Juergen Schmiedfa9d4e42000-11-01 21:36:11 +0000190 * SHGetSetSettings [SHELL32.68]
191 */
Alberto Massaric0e2c5a2002-12-03 21:36:22 +0000192VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Juergen Schmiedfa9d4e42000-11-01 21:36:11 +0000193{
Alberto Massaric0e2c5a2002-12-03 21:36:22 +0000194 if(bSet)
195 {
196 FIXME("%p 0x%08lx TRUE\n", lpss, dwMask);
197 }
198 else
199 {
200 SHGetSettings((LPSHELLFLAGSTATE)lpss,dwMask);
201 }
Juergen Schmiedfa9d4e42000-11-01 21:36:11 +0000202}
203
204/*************************************************************************
205 * SHGetSettings [SHELL32.@]
Vincent Béron9a624912002-05-31 23:06:46 +0000206 *
Juergen Schmiedae2d9a71999-04-10 16:41:50 +0000207 * NOTES
208 * the registry path are for win98 (tested)
209 * and possibly are the same in nt40
Juergen Schmiedfa9d4e42000-11-01 21:36:11 +0000210 *
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000211 */
Mike McCormack46bc5342000-09-18 01:40:13 +0000212VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask)
Juergen Schmiedae2d9a71999-04-10 16:41:50 +0000213{
214 HKEY hKey;
215 DWORD dwData;
216 DWORD dwDataSize = sizeof (DWORD);
217
Mike McCormack46bc5342000-09-18 01:40:13 +0000218 TRACE("(%p 0x%08lx)\n",lpsfs,dwMask);
Vincent Béron9a624912002-05-31 23:06:46 +0000219
Juergen Schmied55c0bca1999-04-22 09:18:33 +0000220 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
Juergen Schmiedae2d9a71999-04-10 16:41:50 +0000221 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
222 return;
Vincent Béron9a624912002-05-31 23:06:46 +0000223
Juergen Schmiedae2d9a71999-04-10 16:41:50 +0000224 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
225 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
226
227 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
228 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
229
230 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
231 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
232
233 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
234 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
235
236 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
237 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
238
239 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
240 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
241
242 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
243 { if (dwData == 0)
244 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
245 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
246 }
247 else if (dwData == 1)
248 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
249 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
250 }
251 else if (dwData == 2)
252 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
253 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
254 }
255 }
256 RegCloseKey (hKey);
257
Alexandre Julliarda099a551999-06-12 15:45:58 +0000258 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000259}
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000260
261/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000262 * SHShellFolderView_Message [SHELL32.73]
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000263 *
264 * PARAMETERS
Vincent Béron9a624912002-05-31 23:06:46 +0000265 * hwndCabinet defines the explorer cabinet window that contains the
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000266 * shellview you need to communicate with
267 * uMsg identifying the SFVM enum to perform
268 * lParam
269 *
Alexandre Julliard829fe321998-07-26 14:27:39 +0000270 * NOTES
271 * Message SFVM_REARRANGE = 1
272 * This message gets sent when a column gets clicked to instruct the
273 * shell view to re-sort the item list. lParam identifies the column
274 * that was clicked.
275 */
Juergen Schmied85b92932000-04-28 20:21:49 +0000276int WINAPI SHShellFolderView_Message(
Vincent Béron9a624912002-05-31 23:06:46 +0000277 HWND hwndCabinet,
Juergen Schmied85b92932000-04-28 20:21:49 +0000278 DWORD dwMessage,
279 DWORD dwParam)
280{
Johan Dahlin991fd852002-11-21 23:56:42 +0000281 FIXME("%p %08lx %08lx stub\n",hwndCabinet, dwMessage, dwParam);
Juergen Schmied85b92932000-04-28 20:21:49 +0000282 return 0;
Alexandre Julliarde658d821997-11-30 17:45:40 +0000283}
284
285/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000286 * RegisterShellHook [SHELL32.181]
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000287 *
288 * PARAMS
289 * hwnd [I] window handle
290 * y [I] flag ????
Vincent Béron9a624912002-05-31 23:06:46 +0000291 *
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000292 * NOTES
293 * exported by ordinal
294 */
Juergen Schmied85b92932000-04-28 20:21:49 +0000295BOOL WINAPI RegisterShellHook(
296 HWND hWnd,
297 DWORD dwType)
298{
Johan Dahlin991fd852002-11-21 23:56:42 +0000299 FIXME("(%p,0x%08lx):stub.\n",hWnd, dwType);
Juergen Schmied85b92932000-04-28 20:21:49 +0000300 return TRUE;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000301}
Alexandre Julliard8da12c41999-01-17 16:55:11 +0000302/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000303 * ShellMessageBoxW [SHELL32.182]
Alexandre Julliard8da12c41999-01-17 16:55:11 +0000304 *
305 * Format and output errormessage.
306 *
Juergen Schmied879a6fe1999-02-09 14:16:44 +0000307 * idText resource ID of title or LPSTR
308 * idTitle resource ID of title or LPSTR
309 *
Alexandre Julliard8da12c41999-01-17 16:55:11 +0000310 * NOTES
311 * exported by ordinal
312 */
Juergen Schmied85b92932000-04-28 20:21:49 +0000313int WINAPIV ShellMessageBoxW(
314 HINSTANCE hInstance,
315 HWND hWnd,
316 LPCWSTR lpText,
317 LPCWSTR lpCaption,
318 UINT uType,
319 ...)
320{
Eric Pouech353962d2000-10-15 00:31:23 +0000321 WCHAR szText[100],szTitle[100];
322 LPCWSTR pszText = szText, pszTitle = szTitle, pszTemp;
Juergen Schmied85b92932000-04-28 20:21:49 +0000323 va_list args;
Eric Pouech353962d2000-10-15 00:31:23 +0000324 int ret;
325
Juergen Schmied85b92932000-04-28 20:21:49 +0000326 va_start(args, uType);
327 /* wvsprintfA(buf,fmt, args); */
Alexandre Julliard8da12c41999-01-17 16:55:11 +0000328
Juergen Schmied85b92932000-04-28 20:21:49 +0000329 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
330 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
Alexandre Julliard8da12c41999-01-17 16:55:11 +0000331
Juergen Schmied85b92932000-04-28 20:21:49 +0000332 if (!HIWORD(lpCaption))
Eric Pouech353962d2000-10-15 00:31:23 +0000333 LoadStringW(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
Juergen Schmied879a6fe1999-02-09 14:16:44 +0000334 else
Juergen Schmied85b92932000-04-28 20:21:49 +0000335 pszTitle = lpCaption;
Juergen Schmied879a6fe1999-02-09 14:16:44 +0000336
Juergen Schmied85b92932000-04-28 20:21:49 +0000337 if (!HIWORD(lpText))
Eric Pouech353962d2000-10-15 00:31:23 +0000338 LoadStringW(hInstance, (DWORD)lpText, szText, sizeof(szText)/sizeof(szText[0]));
Juergen Schmied879a6fe1999-02-09 14:16:44 +0000339 else
Juergen Schmied85b92932000-04-28 20:21:49 +0000340 pszText = lpText;
Juergen Schmied879a6fe1999-02-09 14:16:44 +0000341
Vincent Béron9a624912002-05-31 23:06:46 +0000342 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
Eric Pouech353962d2000-10-15 00:31:23 +0000343 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
Patrik Stridvall95bcd512000-04-29 14:29:05 +0000344
345 va_end(args);
346
Eric Pouech353962d2000-10-15 00:31:23 +0000347 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType);
348 LocalFree((HLOCAL)pszTemp);
349 return ret;
Alexandre Julliard8da12c41999-01-17 16:55:11 +0000350}
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000351
352/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000353 * ShellMessageBoxA [SHELL32.183]
Alexandre Julliarde658d821997-11-30 17:45:40 +0000354 */
Juergen Schmied85b92932000-04-28 20:21:49 +0000355int WINAPIV ShellMessageBoxA(
356 HINSTANCE hInstance,
357 HWND hWnd,
358 LPCSTR lpText,
359 LPCSTR lpCaption,
360 UINT uType,
361 ...)
Ian Schmidtcdff5431999-09-28 13:04:58 +0000362{
Eric Pouech353962d2000-10-15 00:31:23 +0000363 char szText[100],szTitle[100];
364 LPCSTR pszText = szText, pszTitle = szTitle, pszTemp;
Juergen Schmied85b92932000-04-28 20:21:49 +0000365 va_list args;
Eric Pouech353962d2000-10-15 00:31:23 +0000366 int ret;
367
Juergen Schmied85b92932000-04-28 20:21:49 +0000368 va_start(args, uType);
369 /* wvsprintfA(buf,fmt, args); */
Ian Schmidtcdff5431999-09-28 13:04:58 +0000370
Juergen Schmied85b92932000-04-28 20:21:49 +0000371 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
372 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
Ian Schmidtcdff5431999-09-28 13:04:58 +0000373
Juergen Schmied85b92932000-04-28 20:21:49 +0000374 if (!HIWORD(lpCaption))
Eric Pouech353962d2000-10-15 00:31:23 +0000375 LoadStringA(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle));
Juergen Schmied85b92932000-04-28 20:21:49 +0000376 else
377 pszTitle = lpCaption;
Ian Schmidtcdff5431999-09-28 13:04:58 +0000378
Juergen Schmied85b92932000-04-28 20:21:49 +0000379 if (!HIWORD(lpText))
Eric Pouech353962d2000-10-15 00:31:23 +0000380 LoadStringA(hInstance, (DWORD)lpText, szText, sizeof(szText));
Juergen Schmied85b92932000-04-28 20:21:49 +0000381 else
382 pszText = lpText;
Ian Schmidtcdff5431999-09-28 13:04:58 +0000383
Vincent Béron9a624912002-05-31 23:06:46 +0000384 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
Eric Pouech353962d2000-10-15 00:31:23 +0000385 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args);
Patrik Stridvall95bcd512000-04-29 14:29:05 +0000386
387 va_end(args);
388
Eric Pouech353962d2000-10-15 00:31:23 +0000389 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType);
390 LocalFree((HLOCAL)pszTemp);
391 return ret;
Ian Schmidtcdff5431999-09-28 13:04:58 +0000392}
393
394/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000395 * SHRegisterDragDrop [SHELL32.86]
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000396 *
397 * NOTES
Alexandre Julliard642d3131998-07-12 19:29:36 +0000398 * exported by ordinal
Alexandre Julliarda845b881998-06-01 10:44:35 +0000399 */
Juergen Schmied85b92932000-04-28 20:21:49 +0000400HRESULT WINAPI SHRegisterDragDrop(
401 HWND hWnd,
402 LPDROPTARGET pDropTarget)
Juergen Schmiedb18f3d61999-04-01 10:23:09 +0000403{
Johan Dahlin991fd852002-11-21 23:56:42 +0000404 FIXME("(%p,%p):stub.\n", hWnd, pDropTarget);
Alexandre Julliarde1e75372000-04-24 17:17:49 +0000405 if (GetShellOle()) return pRegisterDragDrop(hWnd, pDropTarget);
406 return 0;
Alexandre Julliarda845b881998-06-01 10:44:35 +0000407}
408
409/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000410 * SHRevokeDragDrop [SHELL32.87]
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000411 *
412 * NOTES
Alexandre Julliard642d3131998-07-12 19:29:36 +0000413 * exported by ordinal
Alexandre Julliarda845b881998-06-01 10:44:35 +0000414 */
Juergen Schmied85b92932000-04-28 20:21:49 +0000415HRESULT WINAPI SHRevokeDragDrop(HWND hWnd)
416{
Johan Dahlin991fd852002-11-21 23:56:42 +0000417 FIXME("(%p):stub.\n",hWnd);
Rolf Kalbermatter42d7d1f2002-12-16 22:40:05 +0000418 if (GetShellOle()) return pRevokeDragDrop(hWnd);
Alexandre Julliarda845b881998-06-01 10:44:35 +0000419 return 0;
420}
421
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000422/*************************************************************************
Eric Kohl45f88861999-06-26 11:55:15 +0000423 * SHDoDragDrop [SHELL32.88]
424 *
425 * NOTES
426 * exported by ordinal
427 */
Juergen Schmied85b92932000-04-28 20:21:49 +0000428HRESULT WINAPI SHDoDragDrop(
429 HWND hWnd,
430 LPDATAOBJECT lpDataObject,
431 LPDROPSOURCE lpDropSource,
432 DWORD dwOKEffect,
433 LPDWORD pdwEffect)
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000434{
Johan Dahlin991fd852002-11-21 23:56:42 +0000435 FIXME("(%p %p %p 0x%08lx %p):stub.\n",
Juergen Schmied85b92932000-04-28 20:21:49 +0000436 hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
Rolf Kalbermatter42d7d1f2002-12-16 22:40:05 +0000437 if (GetShellOle()) return pDoDragDrop(lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
438 return 0;
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000439}
440
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000441/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000442 * ArrangeWindows [SHELL32.184]
Vincent Béron9a624912002-05-31 23:06:46 +0000443 *
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000444 */
Juergen Schmied85b92932000-04-28 20:21:49 +0000445WORD WINAPI ArrangeWindows(
446 HWND hwndParent,
447 DWORD dwReserved,
448 LPCRECT lpRect,
449 WORD cKids,
450 CONST HWND * lpKids)
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000451{
Johan Dahlin991fd852002-11-21 23:56:42 +0000452 FIXME("(%p 0x%08lx %p 0x%04x %p):stub.\n",
Juergen Schmied85b92932000-04-28 20:21:49 +0000453 hwndParent, dwReserved, lpRect, cKids, lpKids);
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000454 return 0;
455}
456
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000457/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000458 * SignalFileOpen [SHELL32.103]
Alexandre Julliard642d3131998-07-12 19:29:36 +0000459 *
460 * NOTES
461 * exported by ordinal
462 */
463DWORD WINAPI
464SignalFileOpen (DWORD dwParam1)
465{
Alexandre Julliarda099a551999-06-12 15:45:58 +0000466 FIXME("(0x%08lx):stub.\n", dwParam1);
Alexandre Julliard642d3131998-07-12 19:29:36 +0000467
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000468 return 0;
469}
470
Alexandre Julliard829fe321998-07-26 14:27:39 +0000471/*************************************************************************
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000472 * SHADD_get_policy - helper function for SHAddToRecentDocs
473 *
474 * PARAMETERS
475 * policy [IN] policy name (null termed string) to find
476 * type [OUT] ptr to DWORD to receive type
477 * buffer [OUT] ptr to area to hold data retrieved
478 * len [IN/OUT] ptr to DWORD holding size of buffer and getting
479 * length filled
480 *
481 * RETURNS
482 * result of the SHQueryValueEx call
483 */
484static INT SHADD_get_policy(LPSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len)
485{
486 HKEY Policy_basekey;
487 INT ret;
488
Vincent Béron9a624912002-05-31 23:06:46 +0000489 /* Get the key for the policies location in the registry
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000490 */
491 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
492 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
493 0, KEY_READ, &Policy_basekey)) {
494
495 if (RegOpenKeyExA(HKEY_CURRENT_USER,
496 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
497 0, KEY_READ, &Policy_basekey)) {
Guy Albertelli5a538102001-10-03 18:42:16 +0000498 TRACE("No Explorer Policies location exists. Policy wanted=%s\n",
499 policy);
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000500 *len = 0;
501 return ERROR_FILE_NOT_FOUND;
502 }
503 }
504
505 /* Retrieve the data if it exists
506 */
507 ret = SHQueryValueExA(Policy_basekey, policy, 0, type, buffer, len);
508 RegCloseKey(Policy_basekey);
509 return ret;
510}
511
512
513/*************************************************************************
514 * SHADD_compare_mru - helper function for SHAddToRecentDocs
515 *
516 * PARAMETERS
517 * data1 [IN] data being looked for
518 * data2 [IN] data in MRU
519 * cbdata [IN] length from FindMRUData call (not used)
520 *
521 * RETURNS
522 * position within MRU list that data was added.
523 */
524static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData)
525{
526 return lstrcmpiA(data1, data2);
527}
528
529/*************************************************************************
530 * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs
531 *
532 * PARAMETERS
533 * mruhandle [IN] handle for created MRU list
534 * doc_name [IN] null termed pure doc name
535 * new_lnk_name [IN] null termed path and file name for .lnk file
536 * buffer [IN/OUT] 2048 byte area to consturct MRU data
537 * len [OUT] ptr to int to receive space used in buffer
538 *
539 * RETURNS
540 * position within MRU list that data was added.
541 */
542static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPSTR doc_name, LPSTR new_lnk_name,
543 LPSTR buffer, INT *len)
544{
545 LPSTR ptr;
546 INT wlen;
Vincent Béron9a624912002-05-31 23:06:46 +0000547
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000548 /*FIXME: Document:
549 * RecentDocs MRU data structure seems to be:
550 * +0h document file name w/ terminating 0h
551 * +nh short int w/ size of remaining
Vincent Béron9a624912002-05-31 23:06:46 +0000552 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000553 * +n+4h 10 bytes zeros - unknown
554 * +n+eh shortcut file name w/ terminating 0h
555 * +n+e+nh 3 zero bytes - unknown
556 */
557
558 /* Create the MRU data structure for "RecentDocs"
559 */
560 ptr = buffer;
561 lstrcpyA(ptr, doc_name);
562 ptr += (lstrlenA(buffer) + 1);
563 wlen= lstrlenA(new_lnk_name) + 1 + 12;
564 *((short int*)ptr) = wlen;
565 ptr += 2; /* step past the length */
566 *(ptr++) = 0x30; /* unknown reason */
567 *(ptr++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */
568 memset(ptr, 0, 10);
569 ptr += 10;
570 lstrcpyA(ptr, new_lnk_name);
571 ptr += (lstrlenA(new_lnk_name) + 1);
572 memset(ptr, 0, 3);
573 ptr += 3;
574 *len = ptr - buffer;
575
Vincent Béron9a624912002-05-31 23:06:46 +0000576 /* Add the new entry into the MRU list
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000577 */
Alexandre Julliardfb2eca82002-07-29 00:24:58 +0000578 return AddMRUData(mruhandle, (LPCVOID)buffer, *len);
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000579}
580
581/*************************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +0000582 * SHAddToRecentDocs [SHELL32.@]
Alexandre Julliard829fe321998-07-26 14:27:39 +0000583 *
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000584 * PARAMETERS
585 * uFlags [IN] SHARD_PATH or SHARD_PIDL
586 * pv [IN] string or pidl, NULL clears the list
587 *
Alexandre Julliard829fe321998-07-26 14:27:39 +0000588 * NOTES
589 * exported by name
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000590 *
591 * FIXME: ?? MSDN shows this as a VOID
Alexandre Julliard829fe321998-07-26 14:27:39 +0000592 */
Vincent Béron9a624912002-05-31 23:06:46 +0000593DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000594{
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000595/* If list is a string list lpfnCompare has the following prototype
596 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
597 * for binary lists the prototype is
598 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
599 * where cbData is the no. of bytes to compare.
600 * Need to check what return value means identical - 0?
601 */
602
603
604 UINT olderrormode;
605 HKEY HCUbasekey;
606 CHAR doc_name[MAX_PATH];
607 CHAR link_dir[MAX_PATH];
608 CHAR new_lnk_filepath[MAX_PATH];
609 CHAR new_lnk_name[MAX_PATH];
610 IMalloc *ppM;
611 LPITEMIDLIST pidl;
612 HWND hwnd = 0; /* FIXME: get real window handle */
613 INT ret;
614 DWORD data[64], datalen, type;
615
616 /*FIXME: Document:
617 * RecentDocs MRU data structure seems to be:
618 * +0h document file name w/ terminating 0h
619 * +nh short int w/ size of remaining
Vincent Béron9a624912002-05-31 23:06:46 +0000620 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000621 * +n+4h 10 bytes zeros - unknown
622 * +n+eh shortcut file name w/ terminating 0h
623 * +n+e+nh 3 zero bytes - unknown
624 */
625
626 /* See if we need to do anything.
627 */
628 datalen = 64;
629 ret=SHADD_get_policy( "NoRecentDocsHistory", &type, &data, &datalen);
630 if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) {
631 ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret);
632 return 0;
633 }
634 if (ret == ERROR_SUCCESS) {
Vincent Béron9a624912002-05-31 23:06:46 +0000635 if (!( (type == REG_DWORD) ||
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000636 ((type == REG_BINARY) && (datalen == 4)) )) {
637 ERR("Error policy data for \"NoRecentDocsHistory\" not formated correctly, type=%ld, len=%ld\n",
638 type, datalen);
639 return 0;
Alexandre Julliard829fe321998-07-26 14:27:39 +0000640 }
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000641
642 TRACE("policy value for NoRecentDocsHistory = %08lx\n", data[0]);
643 /* now test the actual policy value */
644 if ( data[0] != 0)
645 return 0;
646 }
647
648 /* Open key to where the necessary info is
649 */
650 /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH)
651 * and the close should be done during the _DETACH. The resulting
652 * key is stored in the DLL global data.
653 */
Guy Albertelli5a538102001-10-03 18:42:16 +0000654 if (RegCreateKeyExA(HKEY_CURRENT_USER,
655 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
656 0, 0, 0, KEY_READ, 0, &HCUbasekey, 0)) {
657 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n");
658 return 0;
659 }
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000660
661 /* Get path to user's "Recent" directory
662 */
663 if(SUCCEEDED(SHGetMalloc(&ppM))) {
Vincent Béron9a624912002-05-31 23:06:46 +0000664 if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT,
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000665 &pidl))) {
666 SHGetPathFromIDListA(pidl, link_dir);
667 IMalloc_Free(ppM, pidl);
Alexandre Julliard829fe321998-07-26 14:27:39 +0000668 }
Guy Albertelli5a538102001-10-03 18:42:16 +0000669 else {
670 /* serious issues */
671 link_dir[0] = 0;
672 ERR("serious issues 1\n");
673 }
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000674 IMalloc_Release(ppM);
675 }
676 else {
677 /* serious issues */
678 link_dir[0] = 0;
Guy Albertelli5a538102001-10-03 18:42:16 +0000679 ERR("serious issues 2\n");
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000680 }
681 TRACE("Users Recent dir %s\n", link_dir);
682
683 /* If no input, then go clear the lists */
684 if (!pv) {
685 /* clear user's Recent dir
686 */
687
688 /* FIXME: delete all files in "link_dir"
689 *
690 * while( more files ) {
691 * lstrcpyA(old_lnk_name, link_dir);
692 * PathAppendA(old_lnk_name, filenam);
693 * DeleteFileA(old_lnk_name);
694 * }
695 */
696 FIXME("should delete all files in %s\\ \n", link_dir);
697
698 /* clear MRU list
699 */
700 /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against
701 * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer
702 * and naturally it fails w/ rc=2. It should do it against
703 * HKEY_CURRENT_USER which is where it is stored, and where
704 * the MRU routines expect it!!!!
705 */
706 RegDeleteKeyA(HCUbasekey, "RecentDocs");
707 RegCloseKey(HCUbasekey);
708 return 0;
709 }
710
711 /* Have data to add, the jobs to be done:
712 * 1. Add document to MRU list in registry "HKCU\Software\
713 * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs".
Vincent Béron9a624912002-05-31 23:06:46 +0000714 * 2. Add shortcut to document in the user's Recent directory
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000715 * (CSIDL_RECENT).
716 * 3. Add shortcut to Start menu's Documents submenu.
717 */
718
719 /* Get the pure document name from the input
720 */
721 if (uFlags & SHARD_PIDL) {
722 SHGetPathFromIDListA((LPCITEMIDLIST) pv, doc_name);
723 }
724 else {
725 lstrcpyA(doc_name, (LPSTR) pv);
726 }
727 TRACE("full document name %s\n", doc_name);
Vincent Béron9a624912002-05-31 23:06:46 +0000728 PathStripPathA(doc_name);
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000729 TRACE("stripped document name %s\n", doc_name);
730
731
732 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
733
Vincent Béron9a624912002-05-31 23:06:46 +0000734 { /* on input needs:
735 * doc_name - pure file-spec, no path
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000736 * link_dir - path to the user's Recent directory
737 * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node
738 * creates:
739 * new_lnk_name- pure file-spec, no path for new .lnk file
740 * new_lnk_filepath
Vincent Béron9a624912002-05-31 23:06:46 +0000741 * - path and file name of new .lnk file
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000742 */
Alexandre Julliardfb2eca82002-07-29 00:24:58 +0000743 CREATEMRULISTA mymru;
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000744 HANDLE mruhandle;
745 INT len, pos, bufused, err;
746 INT i;
747 DWORD attr;
748 CHAR buffer[2048];
749 CHAR *ptr;
750 CHAR old_lnk_name[MAX_PATH];
751 short int slen;
752
Alexandre Julliardfb2eca82002-07-29 00:24:58 +0000753 mymru.cbSize = sizeof(CREATEMRULISTA);
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000754 mymru.nMaxItems = 15;
755 mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE;
756 mymru.hKey = HCUbasekey;
757 mymru.lpszSubKey = "RecentDocs";
758 mymru.lpfnCompare = &SHADD_compare_mru;
Alexandre Julliardfb2eca82002-07-29 00:24:58 +0000759 mruhandle = CreateMRUListA(&mymru);
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000760 if (!mruhandle) {
761 /* MRU failed */
762 ERR("MRU processing failed, handle zero\n");
763 RegCloseKey(HCUbasekey);
764 return 0;
765 }
766 len = lstrlenA(doc_name);
Alexandre Julliardfb2eca82002-07-29 00:24:58 +0000767 pos = FindMRUData(mruhandle, doc_name, len, 0);
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000768
Vincent Béron9a624912002-05-31 23:06:46 +0000769 /* Now get the MRU entry that will be replaced
770 * and delete the .lnk file for it
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000771 */
Alexandre Julliardfb2eca82002-07-29 00:24:58 +0000772 if ((bufused = EnumMRUListA(mruhandle, (pos == -1) ? 14 : pos,
773 buffer, 2048)) != -1) {
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000774 ptr = buffer;
775 ptr += (lstrlenA(buffer) + 1);
776 slen = *((short int*)ptr);
777 ptr += 2; /* skip the length area */
778 if (bufused >= slen + (ptr-buffer)) {
779 /* buffer size looks good */
780 ptr += 12; /* get to string */
781 len = bufused - (ptr-buffer); /* get length of buf remaining */
782 if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) {
783 /* appears to be good string */
784 lstrcpyA(old_lnk_name, link_dir);
785 PathAppendA(old_lnk_name, ptr);
786 if (!DeleteFileA(old_lnk_name)) {
787 if ((attr = GetFileAttributesA(old_lnk_name)) == -1) {
788 if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) {
789 ERR("Delete for %s failed, err=%d, attr=%08lx\n",
790 old_lnk_name, err, attr);
791 }
792 else {
793 TRACE("old .lnk file %s did not exist\n",
794 old_lnk_name);
795 }
796 }
797 else {
798 ERR("Delete for %s failed, attr=%08lx\n",
799 old_lnk_name, attr);
800 }
801 }
802 else {
803 TRACE("deleted old .lnk file %s\n", old_lnk_name);
804 }
805 }
806 }
807 }
808
809 /* Create usable .lnk file name for the "Recent" directory
810 */
811 wsprintfA(new_lnk_name, "%s.lnk", doc_name);
812 lstrcpyA(new_lnk_filepath, link_dir);
813 PathAppendA(new_lnk_filepath, new_lnk_name);
814 i = 1;
815 olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS);
816 while (GetFileAttributesA(new_lnk_filepath) != -1) {
817 i++;
818 wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i);
819 lstrcpyA(new_lnk_filepath, link_dir);
820 PathAppendA(new_lnk_filepath, new_lnk_name);
821 }
822 SetErrorMode(olderrormode);
823 TRACE("new shortcut will be %s\n", new_lnk_filepath);
824
825 /* Now add the new MRU entry and data
826 */
827 pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name,
828 buffer, &len);
Alexandre Julliardfb2eca82002-07-29 00:24:58 +0000829 FreeMRUList(mruhandle);
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000830 TRACE("Updated MRU list, new doc is position %d\n", pos);
831 }
832
833 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
834
Vincent Béron9a624912002-05-31 23:06:46 +0000835 { /* on input needs:
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000836 * doc_name - pure file-spec, no path
837 * new_lnk_filepath
Vincent Béron9a624912002-05-31 23:06:46 +0000838 * - path and file name of new .lnk file
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000839 * uFlags[in] - flags on call to SHAddToRecentDocs
840 * pv[in] - document path/pidl on call to SHAddToRecentDocs
841 */
842 IShellLinkA *psl = NULL;
843 IPersistFile *pPf = NULL;
844 HRESULT hres;
845 CHAR desc[MAX_PATH];
846 WCHAR widelink[MAX_PATH];
847
848 CoInitialize(0);
849
850 hres = CoCreateInstance( &CLSID_ShellLink,
851 NULL,
852 CLSCTX_INPROC_SERVER,
853 &IID_IShellLinkA,
854 (LPVOID )&psl);
855 if(SUCCEEDED(hres)) {
856
Vincent Béron9a624912002-05-31 23:06:46 +0000857 hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile,
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000858 (LPVOID *)&pPf);
859 if(FAILED(hres)) {
860 /* bombed */
861 ERR("failed QueryInterface for IPersistFile %08lx\n", hres);
862 goto fail;
863 }
864
865 /* Set the document path or pidl */
866 if (uFlags & SHARD_PIDL) {
867 hres = IShellLinkA_SetIDList(psl, (LPCITEMIDLIST) pv);
868 } else {
869 hres = IShellLinkA_SetPath(psl, (LPCSTR) pv);
870 }
871 if(FAILED(hres)) {
872 /* bombed */
873 ERR("failed Set{IDList|Path} %08lx\n", hres);
874 goto fail;
875 }
876
877 lstrcpyA(desc, "Shortcut to ");
878 lstrcatA(desc, doc_name);
879 hres = IShellLinkA_SetDescription(psl, desc);
880 if(FAILED(hres)) {
881 /* bombed */
882 ERR("failed SetDescription %08lx\n", hres);
883 goto fail;
884 }
885
Vincent Béron9a624912002-05-31 23:06:46 +0000886 MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1,
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000887 widelink, MAX_PATH);
888 /* create the short cut */
889 hres = IPersistFile_Save(pPf, widelink, TRUE);
890 if(FAILED(hres)) {
891 /* bombed */
892 ERR("failed IPersistFile::Save %08lx\n", hres);
893 IPersistFile_Release(pPf);
894 IShellLinkA_Release(psl);
895 goto fail;
896 }
897 hres = IPersistFile_SaveCompleted(pPf, widelink);
898 IPersistFile_Release(pPf);
899 IShellLinkA_Release(psl);
Vincent Béron9a624912002-05-31 23:06:46 +0000900 TRACE("shortcut %s has been created, result=%08lx\n",
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000901 new_lnk_filepath, hres);
902 }
903 else {
904 ERR("CoCreateInstance failed, hres=%08lx\n", hres);
905 }
906 }
907
908 fail:
909 CoUninitialize();
910
911 /* all done */
912 RegCloseKey(HCUbasekey);
913 return 0;
Alexandre Julliard829fe321998-07-26 14:27:39 +0000914}
Guy Albertellidb1a09d2001-09-21 21:39:06 +0000915
Juergen Schmied6acd0591998-10-11 15:50:14 +0000916/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000917 * SHCreateShellFolderViewEx [SHELL32.174]
Alexandre Julliard829fe321998-07-26 14:27:39 +0000918 *
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000919 * NOTES
920 * see IShellFolder::CreateViewObject
Alexandre Julliard829fe321998-07-26 14:27:39 +0000921 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000922HRESULT WINAPI SHCreateShellFolderViewEx(
Patrik Stridvall2b3aa612000-12-01 23:58:28 +0000923 LPCSHELLFOLDERVIEWINFO psvcbi, /* [in] shelltemplate struct */
924 LPSHELLVIEW* ppv) /* [out] IShellView pointer */
Juergen Schmied43577ec1999-07-25 12:22:57 +0000925{
926 IShellView * psf;
927 HRESULT hRes;
Vincent Béron9a624912002-05-31 23:06:46 +0000928
929 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n",
Juergen Schmied85b92932000-04-28 20:21:49 +0000930 psvcbi->pshf, psvcbi->pidlFolder, psvcbi->lpfnCallback,
931 psvcbi->uViewMode, psvcbi->dwUser);
Juergen Schmied43577ec1999-07-25 12:22:57 +0000932
Juergen Schmied85b92932000-04-28 20:21:49 +0000933 psf = IShellView_Constructor(psvcbi->pshf);
Vincent Béron9a624912002-05-31 23:06:46 +0000934
Juergen Schmied43577ec1999-07-25 12:22:57 +0000935 if (!psf)
936 return E_OUTOFMEMORY;
937
938 IShellView_AddRef(psf);
939 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
940 IShellView_Release(psf);
941
942 return hRes;
Alexandre Julliard829fe321998-07-26 14:27:39 +0000943}
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000944/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000945 * SHWinHelp [SHELL32.127]
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000946 *
947 */
948HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
Alexandre Julliarda099a551999-06-12 15:45:58 +0000949{ FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000950 return 0;
951}
952/*************************************************************************
Eric Kohla8ea46b1998-10-11 13:25:51 +0000953 * SHRunControlPanel [SHELL32.161]
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000954 *
955 */
Eric Kohla8ea46b1998-10-11 13:25:51 +0000956HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
Alexandre Julliarda099a551999-06-12 15:45:58 +0000957{ FIXME("0x%08lx 0x%08lx stub\n",x,z);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000958 return 0;
959}
Juergen Schmiedba28ba11999-01-23 14:12:48 +0000960
Juergen Schmied07e0d941998-12-01 08:55:13 +0000961static LPUNKNOWN SHELL32_IExplorerInterface=0;
Juergen Schmied72b76d11998-11-15 13:28:00 +0000962/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000963 * SHSetInstanceExplorer [SHELL32.176]
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000964 *
Juergen Schmied07e0d941998-12-01 08:55:13 +0000965 * NOTES
966 * Sets the interface
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000967 */
Juergen Schmied07e0d941998-12-01 08:55:13 +0000968HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
Alexandre Julliarda099a551999-06-12 15:45:58 +0000969{ TRACE("%p\n", lpUnknown);
Juergen Schmied07e0d941998-12-01 08:55:13 +0000970 SHELL32_IExplorerInterface = lpUnknown;
971 return (HRESULT) lpUnknown;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000972}
973/*************************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +0000974 * SHGetInstanceExplorer [SHELL32.@]
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000975 *
976 * NOTES
Juergen Schmied07e0d941998-12-01 08:55:13 +0000977 * gets the interface pointer of the explorer and a reference
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000978 */
Juergen Schmied07e0d941998-12-01 08:55:13 +0000979HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
Alexandre Julliarda099a551999-06-12 15:45:58 +0000980{ TRACE("%p\n", lpUnknown);
Juergen Schmied07e0d941998-12-01 08:55:13 +0000981
982 *lpUnknown = SHELL32_IExplorerInterface;
983
984 if (!SHELL32_IExplorerInterface)
985 return E_FAIL;
986
Francois Gouget6e74ec01999-10-13 14:01:40 +0000987 IUnknown_AddRef(SHELL32_IExplorerInterface);
Juergen Schmied07e0d941998-12-01 08:55:13 +0000988 return NOERROR;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000989}
990/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +0000991 * SHFreeUnusedLibraries [SHELL32.123]
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000992 *
993 * NOTES
994 * exported by name
995 */
Juergen Schmied85b92932000-04-28 20:21:49 +0000996void WINAPI SHFreeUnusedLibraries (void)
997{
998 FIXME("stub\n");
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000999}
1000/*************************************************************************
Mike McCormack04650302002-08-14 21:03:07 +00001001 * DAD_AutoScroll [SHELL32.129]
1002 *
1003 */
1004DWORD WINAPI DAD_AutoScroll(HWND hwnd, LPSCROLLSAMPLES samples, LPPOINT pt)
1005{
Johan Dahlin991fd852002-11-21 23:56:42 +00001006 FIXME("hwnd = %p %p %p\n",hwnd,samples,pt);
Mike McCormack04650302002-08-14 21:03:07 +00001007 return 0;
1008}
1009/*************************************************************************
1010 * DAD_DragEnter [SHELL32.130]
1011 *
1012 */
1013BOOL WINAPI DAD_DragEnter(HWND hwnd)
1014{
Johan Dahlin991fd852002-11-21 23:56:42 +00001015 FIXME("hwnd = %p\n",hwnd);
Mike McCormack04650302002-08-14 21:03:07 +00001016 return FALSE;
1017}
1018/*************************************************************************
1019 * DAD_DragEnterEx [SHELL32.131]
1020 *
1021 */
1022BOOL WINAPI DAD_DragEnterEx(HWND hwnd, POINT p)
1023{
Johan Dahlin991fd852002-11-21 23:56:42 +00001024 FIXME("hwnd = %p (%ld,%ld)\n",hwnd,p.x,p.y);
Mike McCormack04650302002-08-14 21:03:07 +00001025 return FALSE;
1026}
1027/*************************************************************************
1028 * DAD_DragMove [SHELL32.134]
1029 *
1030 */
1031BOOL WINAPI DAD_DragMove(POINT p)
1032{
1033 FIXME("(%ld,%ld)\n",p.x,p.y);
1034 return FALSE;
1035}
1036/*************************************************************************
Patrik Stridvalld97f7cd2002-08-17 00:21:53 +00001037 * DAD_DragLeave [SHELL32.132]
Mike McCormack04650302002-08-14 21:03:07 +00001038 *
1039 */
1040BOOL WINAPI DAD_DragLeave(VOID)
1041{
1042 FIXME("\n");
1043 return FALSE;
1044}
1045/*************************************************************************
Eric Kohl8d8a1231999-07-31 13:06:39 +00001046 * DAD_SetDragImage [SHELL32.136]
1047 *
1048 * NOTES
1049 * exported by name
1050 */
Juergen Schmied85b92932000-04-28 20:21:49 +00001051BOOL WINAPI DAD_SetDragImage(
1052 HIMAGELIST himlTrack,
1053 LPPOINT lppt)
1054{
1055 FIXME("%p %p stub\n",himlTrack, lppt);
Eric Kohl8d8a1231999-07-31 13:06:39 +00001056 return 0;
1057}
1058/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001059 * DAD_ShowDragImage [SHELL32.137]
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001060 *
1061 * NOTES
1062 * exported by name
1063 */
Juergen Schmied85b92932000-04-28 20:21:49 +00001064BOOL WINAPI DAD_ShowDragImage(BOOL bShow)
1065{
1066 FIXME("0x%08x stub\n",bShow);
1067 return 0;
Alexandre Julliard767e6f61998-08-09 12:47:43 +00001068}
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001069/*************************************************************************
Patrik Stridvall044855c2001-07-11 18:56:41 +00001070 * ReadCabinetState [SHELL32.651] NT 4.0
Juergen Schmied6acd0591998-10-11 15:50:14 +00001071 *
1072 */
1073HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
Alexandre Julliarda099a551999-06-12 15:45:58 +00001074{ FIXME("0x%04lx 0x%04lx stub\n",u,v);
Juergen Schmied6acd0591998-10-11 15:50:14 +00001075 return 0;
1076}
1077/*************************************************************************
Patrik Stridvall044855c2001-07-11 18:56:41 +00001078 * WriteCabinetState [SHELL32.652] NT 4.0
Juergen Schmied6acd0591998-10-11 15:50:14 +00001079 *
1080 */
1081HRESULT WINAPI WriteCabinetState(DWORD u)
Alexandre Julliarda099a551999-06-12 15:45:58 +00001082{ FIXME("0x%04lx stub\n",u);
Juergen Schmied6acd0591998-10-11 15:50:14 +00001083 return 0;
1084}
1085/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001086 * FileIconInit [SHELL32.660]
Petter Reinholdtsen5a17c031998-10-13 12:49:40 +00001087 *
1088 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001089BOOL WINAPI FileIconInit(BOOL bFullInit)
Alexandre Julliarda099a551999-06-12 15:45:58 +00001090{ FIXME("(%s)\n", bFullInit ? "true" : "false");
Petter Reinholdtsen5a17c031998-10-13 12:49:40 +00001091 return 0;
1092}
1093/*************************************************************************
Patrik Stridvall044855c2001-07-11 18:56:41 +00001094 * IsUserAdmin [SHELL32.680] NT 4.0
Juergen Schmied6acd0591998-10-11 15:50:14 +00001095 *
1096 */
Juergen Schmied72b76d11998-11-15 13:28:00 +00001097HRESULT WINAPI IsUserAdmin(void)
Alexandre Julliarda099a551999-06-12 15:45:58 +00001098{ FIXME("stub\n");
Juergen Schmied6acd0591998-10-11 15:50:14 +00001099 return TRUE;
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001100}
Patrik Stridvallfcfacb92000-03-24 20:46:04 +00001101
Eric Kohla8ea46b1998-10-11 13:25:51 +00001102/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001103 * SHAllocShared [SHELL32.520]
Juergen Schmied61013241998-10-16 15:40:20 +00001104 *
1105 * NOTES
1106 * parameter1 is return value from HeapAlloc
1107 * parameter2 is equal to the size allocated with HeapAlloc
1108 * parameter3 is return value from GetCurrentProcessId
1109 *
1110 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1111 * WM_USER+2 could be the undocumented CWM_SETPATH
1112 * the allocated memory contains a pidl
1113 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001114HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
1115{ HGLOBAL hmem;
Juergen Schmied61013241998-10-16 15:40:20 +00001116 LPVOID pmem;
Vincent Béron9a624912002-05-31 23:06:46 +00001117
Alexandre Julliarda099a551999-06-12 15:45:58 +00001118 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
Alexandre Julliarda3960291999-02-26 11:11:13 +00001119 hmem = GlobalAlloc(GMEM_FIXED, size);
Juergen Schmied61013241998-10-16 15:40:20 +00001120 if (!hmem)
1121 return 0;
Vincent Béron9a624912002-05-31 23:06:46 +00001122
Alexandre Julliarda3960291999-02-26 11:11:13 +00001123 pmem = GlobalLock (hmem);
Juergen Schmied61013241998-10-16 15:40:20 +00001124
1125 if (! pmem)
1126 return 0;
Vincent Béron9a624912002-05-31 23:06:46 +00001127
Juergen Schmied61013241998-10-16 15:40:20 +00001128 memcpy (pmem, psrc, size);
Vincent Béron9a624912002-05-31 23:06:46 +00001129 GlobalUnlock(hmem);
Juergen Schmied61013241998-10-16 15:40:20 +00001130 return hmem;
1131}
1132/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001133 * SHLockShared [SHELL32.521]
Juergen Schmied61013241998-10-16 15:40:20 +00001134 *
1135 * NOTES
1136 * parameter1 is return value from SHAllocShared
1137 * parameter2 is return value from GetCurrentProcessId
Vincent Béron9a624912002-05-31 23:06:46 +00001138 * the receiver of (WM_USER+2) tries to lock the HANDLE (?)
Francois Gouget070e7492001-11-06 21:01:32 +00001139 * the return value seems to be a memory address
Juergen Schmied61013241998-10-16 15:40:20 +00001140 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001141LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
Johan Dahlin991fd852002-11-21 23:56:42 +00001142{ TRACE("handle=%p procID=0x%04lx\n",hmem,procID);
Alexandre Julliarda3960291999-02-26 11:11:13 +00001143 return GlobalLock(hmem);
Juergen Schmied61013241998-10-16 15:40:20 +00001144}
1145/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001146 * SHUnlockShared [SHELL32.522]
Juergen Schmied61013241998-10-16 15:40:20 +00001147 *
1148 * NOTES
1149 * parameter1 is return value from SHLockShared
1150 */
Juergen Schmied85b92932000-04-28 20:21:49 +00001151BOOL WINAPI SHUnlockShared(LPVOID pv)
1152{
1153 TRACE("%p\n",pv);
Vincent Béron9a624912002-05-31 23:06:46 +00001154 return GlobalUnlock((HANDLE)pv);
Juergen Schmied61013241998-10-16 15:40:20 +00001155}
1156/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001157 * SHFreeShared [SHELL32.523]
Juergen Schmied61013241998-10-16 15:40:20 +00001158 *
1159 * NOTES
1160 * parameter1 is return value from SHAllocShared
1161 * parameter2 is return value from GetCurrentProcessId
1162 */
Juergen Schmied85b92932000-04-28 20:21:49 +00001163BOOL WINAPI SHFreeShared(
1164 HANDLE hMem,
1165 DWORD pid)
1166{
Johan Dahlin991fd852002-11-21 23:56:42 +00001167 TRACE("handle=%p 0x%04lx\n",hMem,pid);
1168 return (BOOL)GlobalFree(hMem);
Juergen Schmied61013241998-10-16 15:40:20 +00001169}
1170
1171/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001172 * SetAppStartingCursor [SHELL32.99]
Juergen Schmied61013241998-10-16 15:40:20 +00001173 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001174HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
Johan Dahlin991fd852002-11-21 23:56:42 +00001175{ FIXME("hwnd=%p 0x%04lx stub\n",u,v );
Juergen Schmied61013241998-10-16 15:40:20 +00001176 return 0;
1177}
1178/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001179 * SHLoadOLE [SHELL32.151]
Juergen Schmied61013241998-10-16 15:40:20 +00001180 *
1181 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001182HRESULT WINAPI SHLoadOLE(DWORD u)
Alexandre Julliarda099a551999-06-12 15:45:58 +00001183{ FIXME("0x%04lx stub\n",u);
Juergen Schmied61013241998-10-16 15:40:20 +00001184 return S_OK;
1185}
1186/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001187 * DriveType [SHELL32.64]
Juergen Schmied61013241998-10-16 15:40:20 +00001188 *
1189 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001190HRESULT WINAPI DriveType(DWORD u)
Alexandre Julliarda099a551999-06-12 15:45:58 +00001191{ FIXME("0x%04lx stub\n",u);
Juergen Schmied61013241998-10-16 15:40:20 +00001192 return 0;
1193}
1194/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001195 * SHAbortInvokeCommand [SHELL32.198]
Juergen Schmied61013241998-10-16 15:40:20 +00001196 *
1197 */
Juergen Schmied72b76d11998-11-15 13:28:00 +00001198HRESULT WINAPI SHAbortInvokeCommand(void)
Alexandre Julliarda099a551999-06-12 15:45:58 +00001199{ FIXME("stub\n");
Juergen Schmied61013241998-10-16 15:40:20 +00001200 return 1;
1201}
1202/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001203 * SHOutOfMemoryMessageBox [SHELL32.126]
Juergen Schmied61013241998-10-16 15:40:20 +00001204 *
1205 */
Juergen Schmied85b92932000-04-28 20:21:49 +00001206int WINAPI SHOutOfMemoryMessageBox(
1207 HWND hwndOwner,
1208 LPCSTR lpCaption,
1209 UINT uType)
1210{
Johan Dahlin991fd852002-11-21 23:56:42 +00001211 FIXME("%p %s 0x%08x stub\n",hwndOwner, lpCaption, uType);
Juergen Schmied61013241998-10-16 15:40:20 +00001212 return 0;
1213}
1214/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001215 * SHFlushClipboard [SHELL32.121]
Eric Kohla8ea46b1998-10-11 13:25:51 +00001216 *
1217 */
Juergen Schmied72b76d11998-11-15 13:28:00 +00001218HRESULT WINAPI SHFlushClipboard(void)
Alexandre Julliarda099a551999-06-12 15:45:58 +00001219{ FIXME("stub\n");
Juergen Schmied61013241998-10-16 15:40:20 +00001220 return 1;
Eric Kohla8ea46b1998-10-11 13:25:51 +00001221}
Ulrich Czekallac8a3f7a1999-10-23 16:50:58 +00001222
Juergen Schmied72b76d11998-11-15 13:28:00 +00001223/*************************************************************************
Juergen Schmieddd153f11999-03-13 17:10:36 +00001224 * SHWaitForFileToOpen [SHELL32.97]
Juergen Schmied07e0d941998-12-01 08:55:13 +00001225 *
1226 */
Juergen Schmied85b92932000-04-28 20:21:49 +00001227BOOL WINAPI SHWaitForFileToOpen(
Vincent Béron9a624912002-05-31 23:06:46 +00001228 LPCITEMIDLIST pidl,
Juergen Schmied85b92932000-04-28 20:21:49 +00001229 DWORD dwFlags,
1230 DWORD dwTimeout)
1231{
1232 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout);
Juergen Schmied07e0d941998-12-01 08:55:13 +00001233 return 0;
1234}
Juergen Schmiedddecd8a1999-03-25 10:55:43 +00001235
Juergen Schmiedb18f3d61999-04-01 10:23:09 +00001236/************************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +00001237 * @ [SHELL32.654]
Juergen Schmiedb18f3d61999-04-01 10:23:09 +00001238 *
Juergen Schmied37fe75b1999-07-10 11:54:17 +00001239 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1240 * second one could be a size (0x0c). The size is the same as the structure saved to
1241 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1242 * I'm (js) guessing: this one is just ReadCabinetState ;-)
Juergen Schmiedb18f3d61999-04-01 10:23:09 +00001243 */
Ian Schmidtbeed9831999-05-23 09:28:52 +00001244HRESULT WINAPI shell32_654 (DWORD x, DWORD y)
Alexandre Julliarda099a551999-06-12 15:45:58 +00001245{ FIXME("0x%08lx 0x%08lx stub\n",x,y);
Juergen Schmiedddecd8a1999-03-25 10:55:43 +00001246 return 0;
1247}
Juergen Schmiedb18f3d61999-04-01 10:23:09 +00001248
1249/************************************************************************
1250 * RLBuildListOfPaths [SHELL32.146]
1251 *
1252 * NOTES
1253 * builds a DPA
1254 */
Juergen Schmied43577ec1999-07-25 12:22:57 +00001255DWORD WINAPI RLBuildListOfPaths (void)
Alexandre Julliarda099a551999-06-12 15:45:58 +00001256{ FIXME("stub\n");
Juergen Schmiedb18f3d61999-04-01 10:23:09 +00001257 return 0;
1258}
1259/************************************************************************
Juergen Schmied55c0bca1999-04-22 09:18:33 +00001260 * SHValidateUNC [SHELL32.173]
1261 *
1262 */
Ian Schmidt38aeff01999-05-29 10:52:00 +00001263HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
Juergen Schmied37fe75b1999-07-10 11:54:17 +00001264{
1265 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
Juergen Schmied55c0bca1999-04-22 09:18:33 +00001266 return 0;
1267}
Juergen Schmied37fe75b1999-07-10 11:54:17 +00001268
1269/************************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +00001270 * DoEnvironmentSubstA [SHELL32.@]
Juergen Schmied37fe75b1999-07-10 11:54:17 +00001271 *
1272 */
1273HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1274{
Patrik Stridvallb9050232000-05-11 21:48:28 +00001275 FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y));
Juergen Schmied37fe75b1999-07-10 11:54:17 +00001276 return 0;
1277}
1278
Patrik Stridvallfcfacb92000-03-24 20:46:04 +00001279/************************************************************************
Patrik Stridvall8b216b32001-06-19 18:20:47 +00001280 * DoEnvironmentSubstW [SHELL32.@]
Patrik Stridvallfcfacb92000-03-24 20:46:04 +00001281 *
1282 */
Juergen Schmied37fe75b1999-07-10 11:54:17 +00001283HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1284{
Patrik Stridvallb9050232000-05-11 21:48:28 +00001285 FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y));
Juergen Schmied37fe75b1999-07-10 11:54:17 +00001286 return 0;
1287}
1288
Patrik Stridvallfcfacb92000-03-24 20:46:04 +00001289/************************************************************************
1290 * DoEnvironmentSubst [SHELL32.53]
1291 *
1292 */
Juergen Schmied37fe75b1999-07-10 11:54:17 +00001293HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1294{
Alexandre Julliardd586dc92000-08-14 14:35:01 +00001295 if (SHELL_OsIsUnicode())
Juergen Schmied37fe75b1999-07-10 11:54:17 +00001296 return DoEnvironmentSubstW(x, y);
1297 return DoEnvironmentSubstA(x, y);
1298}
Eric Kohl8d8a1231999-07-31 13:06:39 +00001299
Ian Schmidtcdff5431999-09-28 13:04:58 +00001300/*************************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +00001301 * @ [SHELL32.243]
Vincent Béron9a624912002-05-31 23:06:46 +00001302 *
Ian Schmidtcdff5431999-09-28 13:04:58 +00001303 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1304 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1305 *
1306 */
1307
Vincent Béron9a624912002-05-31 23:06:46 +00001308BOOL WINAPI shell32_243(DWORD a, DWORD b)
1309{
1310 return FALSE;
Ian Schmidtcdff5431999-09-28 13:04:58 +00001311}
Ian Schmidtace09a71999-10-25 15:36:39 +00001312
Juergen Schmied0d18aad2000-06-01 23:25:44 +00001313/*************************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +00001314 * @ [SHELL32.714]
Juergen Schmied0d18aad2000-06-01 23:25:44 +00001315 */
1316DWORD WINAPI SHELL32_714(LPVOID x)
1317{
1318 FIXME("(%s)stub\n", debugstr_w(x));
1319 return 0;
1320}
Eric Pouech92b23182001-02-23 01:12:26 +00001321
1322/*************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +00001323 * SHAddFromPropSheetExtArray [SHELL32.167]
Eric Pouech92b23182001-02-23 01:12:26 +00001324 */
1325DWORD WINAPI SHAddFromPropSheetExtArray(DWORD a, DWORD b, DWORD c)
1326{
1327 FIXME("(%08lx,%08lx,%08lx)stub\n", a, b, c);
1328 return 0;
1329}
1330
1331/*************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +00001332 * SHCreatePropSheetExtArray [SHELL32.168]
Eric Pouech92b23182001-02-23 01:12:26 +00001333 */
1334DWORD WINAPI SHCreatePropSheetExtArray(DWORD a, LPCSTR b, DWORD c)
1335{
1336 FIXME("(%08lx,%s,%08lx)stub\n", a, debugstr_a(b), c);
1337 return 0;
1338}
1339
1340/*************************************************************************
Patrik Stridvall044855c2001-07-11 18:56:41 +00001341 * SHReplaceFromPropSheetExtArray [SHELL32.170]
Eric Pouech92b23182001-02-23 01:12:26 +00001342 */
1343DWORD WINAPI SHReplaceFromPropSheetExtArray(DWORD a, DWORD b, DWORD c, DWORD d)
1344{
1345 FIXME("(%08lx,%08lx,%08lx,%08lx)stub\n", a, b, c, d);
1346 return 0;
1347}
1348
1349/*************************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +00001350 * SHDestroyPropSheetExtArray [SHELL32.169]
Eric Pouech92b23182001-02-23 01:12:26 +00001351 */
1352DWORD WINAPI SHDestroyPropSheetExtArray(DWORD a)
1353{
1354 FIXME("(%08lx)stub\n", a);
1355 return 0;
1356}
Guy Albertelli60b59be2001-10-02 17:25:36 +00001357
1358/*************************************************************************
1359 * CIDLData_CreateFromIDArray [SHELL32.83]
1360 *
1361 * Create IDataObject from PIDLs??
1362 */
1363HRESULT WINAPI CIDLData_CreateFromIDArray(
1364 LPCITEMIDLIST pidlFolder,
1365 DWORD cpidlFiles,
1366 LPCITEMIDLIST *lppidlFiles,
1367 LPDATAOBJECT *ppdataObject)
1368{
Rolf Kalbermattera9644712002-12-13 00:36:52 +00001369 UINT i;
Guy Albertelli60b59be2001-10-02 17:25:36 +00001370 HWND hwnd = 0; /*FIXME: who should be hwnd of owner? set to desktop */
Guy Albertelli60b59be2001-10-02 17:25:36 +00001371
Alexandre Julliard18f4d652002-01-22 00:54:20 +00001372 TRACE("(%p, %ld, %p, %p)\n", pidlFolder, cpidlFiles, lppidlFiles, ppdataObject);
1373 if (TRACE_ON(pidl))
1374 {
Guy Albertelli60b59be2001-10-02 17:25:36 +00001375 pdump (pidlFolder);
Alexandre Julliard18f4d652002-01-22 00:54:20 +00001376 for (i=0; i<cpidlFiles; i++) pdump (lppidlFiles[i]);
Guy Albertelli60b59be2001-10-02 17:25:36 +00001377 }
1378 *ppdataObject = IDataObject_Constructor( hwnd, pidlFolder,
1379 lppidlFiles, cpidlFiles);
1380 if (*ppdataObject) return S_OK;
1381 return E_OUTOFMEMORY;
1382}
Rolf Kalbermatter73ffe2a2002-09-06 18:34:37 +00001383
1384/*************************************************************************
1385 * SHCreateStdEnumFmtEtc [SHELL32.74]
1386 *
1387 * NOTES
1388 *
1389 */
1390HRESULT WINAPI SHCreateStdEnumFmtEtc(
1391 DWORD cFormats,
1392 const FORMATETC *lpFormats,
1393 LPENUMFORMATETC *ppenumFormatetc)
1394{
1395 IEnumFORMATETC *pef;
1396 HRESULT hRes;
1397 TRACE("cf=%ld fe=%p pef=%p\n", cFormats, lpFormats, ppenumFormatetc);
1398
1399 pef = IEnumFORMATETC_Constructor(cFormats, lpFormats);
1400 if (!pef)
1401 return E_OUTOFMEMORY;
1402
1403 IEnumFORMATETC_AddRef(pef);
1404 hRes = IEnumFORMATETC_QueryInterface(pef, &IID_IEnumFORMATETC, (LPVOID*)ppenumFormatetc);
1405 IEnumFORMATETC_Release(pef);
1406
1407 return hRes;
1408}