ReactOS 0.4.17-dev-573-g8315b8c
shellord.c
Go to the documentation of this file.
1/*
2 * The parameters of many functions changes between different OS versions
3 * (NT uses Unicode strings, 95 uses ASCII strings)
4 *
5 * Copyright 1997 Marcus Meissner
6 * 1998 Jürgen Schmied
7 *
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23#include <wine/config.h>
24
25#define WIN32_NO_STATUS
26#define _INC_WINDOWS
27#define COBJMACROS
28
29#include <windef.h>
30#include <winbase.h>
31#include <wine/winternl.h>
32#include <shlobj.h>
33#include <undocshell.h>
34#include <shlwapi.h>
35#include <commdlg.h>
36#include <commoncontrols.h>
37#include "../shellrecyclebin/recyclebin.h"
38
39#include <wine/debug.h>
40#include <wine/unicode.h>
41
42#include "pidl.h"
43#include "shell32_main.h"
44
47
48#ifdef __REACTOS__
49#include <comctl32_undoc.h>
50#include <shlwapi_undoc.h>
51#else
52/* FIXME: !!! move CREATEMRULIST and flags to header file !!! */
53/* !!! it is in both here and comctl32undoc.c !!! */
54typedef struct tagCREATEMRULIST
55{
56 DWORD cbSize; /* size of struct */
57 DWORD nMaxItems; /* max no. of items in list */
58 DWORD dwFlags; /* see below */
59 HKEY hKey; /* root reg. key under which list is saved */
60 LPCSTR lpszSubKey; /* reg. subkey */
61 int (CALLBACK *lpfnCompare)(LPCVOID, LPCVOID, DWORD); /* item compare proc */
63
64/* dwFlags */
65#define MRUF_STRING_LIST 0 /* list will contain strings */
66#define MRUF_BINARY_LIST 1 /* list will contain binary data */
67#define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
68
70extern VOID WINAPI FreeMRUList(HANDLE hMRUList);
72extern INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum);
73extern INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize);
74#endif
75
76/*************************************************************************
77 * ParseFieldA [internal]
78 *
79 * copies a field from a ',' delimited string
80 *
81 * first field is nField = 1
82 */
84 LPCSTR src,
85 DWORD nField,
86 LPSTR dst,
87 DWORD len)
88{
89 WARN("(%s,0x%08x,%p,%d) semi-stub.\n",debugstr_a(src),nField,dst,len);
90
91 if (!src || !src[0] || !dst || !len)
92 return 0;
93
94 /* skip n fields delimited by ',' */
95 while (nField > 1)
96 {
97 if (*src=='\0') return FALSE;
98 if (*(src++)==',') nField--;
99 }
100
101 /* copy part till the next ',' to dst */
102 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);
103
104 /* finalize the string */
105 *dst=0x0;
106
107 return TRUE;
108}
109
110/*************************************************************************
111 * ParseFieldW [internal]
112 *
113 * copies a field from a ',' delimited string
114 *
115 * first field is nField = 1
116 */
118{
119 WARN("(%s,0x%08x,%p,%d) semi-stub.\n", debugstr_w(src), nField, dst, len);
120
121 if (!src || !src[0] || !dst || !len)
122 return 0;
123
124 /* skip n fields delimited by ',' */
125 while (nField > 1)
126 {
127 if (*src == 0x0) return FALSE;
128 if (*src++ == ',') nField--;
129 }
130
131 /* copy part till the next ',' to dst */
132 while ( *src != 0x0 && *src != ',' && (len--)>0 ) *(dst++) = *(src++);
133
134 /* finalize the string */
135 *dst = 0x0;
136
137 return TRUE;
138}
139
140/*************************************************************************
141 * ParseField [SHELL32.58]
142 */
144{
145 if (SHELL_OsIsUnicode())
146 return ParseFieldW(src, nField, dst, len);
147 return ParseFieldA(src, nField, dst, len);
148}
149
150/*************************************************************************
151 * GetFileNameFromBrowse [SHELL32.63]
152 *
153 */
155 HWND hwndOwner,
156 LPWSTR lpstrFile,
157 UINT nMaxFile,
158 LPCWSTR lpstrInitialDir,
159 LPCWSTR lpstrDefExt,
160 LPCWSTR lpstrFilter,
161 LPCWSTR lpstrTitle)
162{
163typedef BOOL (WINAPI *GetOpenFileNameProc)(OPENFILENAMEW *ofn);
165 GetOpenFileNameProc pGetOpenFileNameW;
167 BOOL ret;
168
169 TRACE("%p, %s, %d, %s, %s, %s, %s)\n",
170 hwndOwner, debugstr_w(lpstrFile), nMaxFile, lpstrInitialDir, lpstrDefExt,
171 lpstrFilter, lpstrTitle);
172
173 hmodule = LoadLibraryW(L"comdlg32.dll");
174 if(!hmodule) return FALSE;
175 pGetOpenFileNameW = (GetOpenFileNameProc)GetProcAddress(hmodule, "GetOpenFileNameW");
176 if(!pGetOpenFileNameW)
177 {
179 return FALSE;
180 }
181
182 memset(&ofn, 0, sizeof(ofn));
183
184 ofn.lStructSize = sizeof(ofn);
185 ofn.hwndOwner = hwndOwner;
186 ofn.lpstrFilter = lpstrFilter;
187 ofn.lpstrFile = lpstrFile;
188 ofn.nMaxFile = nMaxFile;
189 ofn.lpstrInitialDir = lpstrInitialDir;
190 ofn.lpstrTitle = lpstrTitle;
191 ofn.lpstrDefExt = lpstrDefExt;
193 ret = pGetOpenFileNameW(&ofn);
194
196 return ret;
197}
198
199#ifdef __REACTOS__
200BOOL SHELL_GlobalCounterChanged(LONG *pCounter, SHELL_GCOUNTER_DECLAREPARAMETERS(handle, id))
201{
203 if (*pCounter == count)
204 return FALSE;
205 *pCounter = count;
206 return TRUE;
207}
208
212SHELL_GCOUNTER_DEFINE_GUID(SHGCGUID_ShellState, 0x7cb834f0, 0x527b, 0x11d2, 0x9d, 0x1f, 0x00, 0x00, 0xf8, 0x05, 0xca, 0x57);
213SHELL_GCOUNTER_DEFINE_HANDLE(g_hShellState);
214#define SHELL_GCOUNTER_SHELLSTATE SHELL_GCOUNTER_PARAMETERS(g_hShellState, GLOBALCOUNTER_SHELLSETTINGSCHANGED)
215static LONG g_ShellStateCounter = 0;
216static UINT g_CachedSSF = 0;
217static REGSHELLSTATE g_ShellState;
218enum { ssf_autocheckselect = 0x00800000, ssf_iconsonly = 0x01000000,
219 ssf_showtypeoverlay = 0x02000000, ssf_showstatusbar = 0x04000000 };
220#endif //__REACTOS__
221
222/*************************************************************************
223 * SHGetSetSettings [SHELL32.68]
224 */
226{
227#ifdef __REACTOS__
228 const DWORD inverted = SSF_SHOWEXTENSIONS;
229 LPSHELLSTATE gpss = &g_ShellState.ss;
230 HKEY hKeyAdv;
231
232 if (!SHELL_GlobalCounterIsInitialized(g_hShellState))
233 {
234 SHELL_GlobalCounterCreate(&SHGCGUID_ShellState, g_hShellState);
235 }
236
237 if (!lpss)
238 {
239 SHELL_GlobalCounterIncrement(SHELL_GCOUNTER_SHELLSTATE);
240 return;
241 }
242
243 hKeyAdv = SHGetShellKey(SHKEY_Root_HKCU | SHKEY_Key_Explorer, L"Advanced", bSet);
244 if (!hKeyAdv && bSet)
245 return;
246
247#define SSF_STRUCTONLY (SSF_NOCONFIRMRECYCLE | SSF_DOUBLECLICKINWEBVIEW | SSF_DESKTOPHTML | \
248 SSF_WIN95CLASSIC | SSF_SORTCOLUMNS | SSF_STARTPANELON)
249#define SSF_ALL (0x07FFFFFF & ~0x40)
250#define SSF_IMPLEMENTED ((SSF_ALL) & ~(SSF_SERVERADMINUI)) // SERVERADMINUI is written by Explorer and read by IsOS()
251#define SHGSS_GetSetStruct(getsetmacro) \
252 do { \
253 getsetmacro(fNoConfirmRecycle, SSF_NOCONFIRMRECYCLE); \
254 getsetmacro(fDoubleClickInWebView, SSF_DOUBLECLICKINWEBVIEW); \
255 getsetmacro(fDesktopHTML, SSF_DESKTOPHTML); \
256 getsetmacro(fWin95Classic, SSF_WIN95CLASSIC); \
257 getsetmacro(lParamSort, SSF_SORTCOLUMNS); \
258 getsetmacro(iSortDirection, SSF_SORTCOLUMNS); \
259 getsetmacro(fStartPanelOn, SSF_STARTPANELON); \
260 } while (0)
261#define SHGSS_GetSetAdv(getsetmacro) \
262 do { \
263 getsetmacro(L"HideFileExt", fShowExtensions, SSF_SHOWEXTENSIONS); \
264 getsetmacro(L"ShowCompColor", fShowCompColor, SSF_SHOWCOMPCOLOR); \
265 getsetmacro(L"DontPrettyPath", fDontPrettyPath, SSF_DONTPRETTYPATH); \
266 getsetmacro(L"ShowAttribCol", fShowAttribCol, SSF_SHOWATTRIBCOL); \
267 getsetmacro(L"MapNetDrvBtn", fMapNetDrvBtn, SSF_MAPNETDRVBUTTON); \
268 getsetmacro(L"ShowInfoTip", fShowInfoTip, SSF_SHOWINFOTIP); \
269 getsetmacro(L"HideIcons", fHideIcons, SSF_HIDEICONS); \
270 getsetmacro(L"WebView", fWebView, SSF_WEBVIEW); \
271 getsetmacro(L"Filter", fFilter, SSF_FILTER); \
272 getsetmacro(L"ShowSuperHidden", fShowSuperHidden, SSF_SHOWSUPERHIDDEN); \
273 getsetmacro(L"NoNetCrawling", fNoNetCrawling, SSF_NONETCRAWLING); \
274 getsetmacro(L"SeparateProcess", fSepProcess, SSF_SEPPROCESS); \
275 getsetmacro(L"AutoCheckSelect", fAutoCheckSelect, ssf_autocheckselect); \
276 getsetmacro(L"IconsOnly", fIconsOnly, ssf_iconsonly); \
277 getsetmacro(L"ShowTypeOverlay", fShowTypeOverlay, ssf_showtypeoverlay); \
278 getsetmacro(L"ShowStatusBar", fShowStatusBar, ssf_showstatusbar); \
279 } while (0)
280
281 if (bSet)
282 {
283 DWORD changed = 0, notcached = ~g_CachedSSF & SSF_IMPLEMENTED;
284 if (notcached & ~dwMask)
285 {
286 // All entries in gpss have to be initialized (except the item we are about to set) because we are about to write the whole struct to the registry
287 SHELLSTATE tempstate;
288 SHGetSetSettings(&tempstate, notcached & ~dwMask, FALSE); // Read entries that are not in gpss/g_CachedSSF
289 }
290
291#define SHGSS_WriteAdv(name, value, SSF) \
292 do { \
293 DWORD val = (value), cb = sizeof(DWORD); \
294 if (SHSetValueW(hKeyAdv, NULL, (name), REG_DWORD, &val, cb) == ERROR_SUCCESS) \
295 { \
296 ++changed; \
297 } \
298 } while (0)
299#define SHGSS_SetAdv(name, field, SSF) \
300 do { \
301 if ((dwMask & (SSF)) && gpss->field != lpss->field) \
302 { \
303 const DWORD bitval = (gpss->field = lpss->field); \
304 SHGSS_WriteAdv((name), ((SSF) & inverted) ? !bitval : !!bitval, (SSF)); \
305 } \
306 } while (0)
307#define SHGSS_SetStruct(field, SSF) \
308 do { \
309 if ((dwMask & (SSF)) && gpss->field != lpss->field) \
310 { \
311 gpss->field = lpss->field; \
312 ++changed; \
313 } \
314 } while (0)
315
316 if ((dwMask & SSF_SHOWALLOBJECTS) && gpss->fShowAllObjects != lpss->fShowAllObjects)
317 {
318 gpss->fShowAllObjects = lpss->fShowAllObjects;
319 SHGSS_WriteAdv(L"Hidden", lpss->fShowAllObjects ? 1 : 2, SSF_SHOWALLOBJECTS);
320 }
321 SHGSS_SetStruct(fShowSysFiles, SSF_SHOWSYSFILES);
322 SHGSS_GetSetAdv(SHGSS_SetAdv);
323 SHGSS_GetSetStruct(SHGSS_SetStruct);
324 if (changed)
325 {
326 if ((dwMask & SSF_SHOWSUPERHIDDEN) && (DLL_EXPORT_VERSION) < _WIN32_WINNT_VISTA)
327 {
328 // This is probably a Windows bug but write this alternative name just in case someone reads it
329 DWORD val = gpss->fShowSuperHidden != FALSE;
330 SHSetValueW(hKeyAdv, NULL, L"SuperHidden", REG_DWORD, &val, sizeof(val));
331 }
332 SHELL32_WriteRegShellState(&g_ShellState); // Write the new SHELLSTATE
333 SHGetSetSettings(NULL, 0, TRUE); // Invalidate counter
334 SHSendMessageBroadcastW(WM_SETTINGCHANGE, 0, (LPARAM)L"ShellState"); // Notify everyone
335 }
336 }
337 else
338 {
339 DWORD read = 0, data, cb, dummy = 0;
341 if (SHELL_GlobalCounterChanged(&g_ShellStateCounter, SHELL_GCOUNTER_SHELLSTATE))
342 g_CachedSSF = 0;
343
344#define SHGSS_ReadAdv(name, SSF) ( \
345 (g_CachedSSF & (SSF)) != (SSF) && (cb = sizeof(DWORD)) != 0 && \
346 SHQueryValueEx(hKeyAdv, (name), NULL, NULL, &data, &cb) == ERROR_SUCCESS && \
347 cb == sizeof(DWORD) && (read |= (SSF)) != 0 )
348#define SHGSS_GetFieldHelper(field, SSF, src, dst, cachevar) \
349 do { \
350 if (dwMask & (SSF)) \
351 { \
352 (dst)->field = (src)->field; \
353 cachevar |= (SSF); \
354 } \
355 } while (0)
356#define SHGSS_CacheField(field, SSF) SHGSS_GetFieldHelper(field, (SSF), &rss.ss, gpss, read)
357#define SHGSS_GetField(field, SSF) SHGSS_GetFieldHelper(field, (SSF), gpss, lpss, dummy)
358#define SHGSS_GetAdv(name, field, SSF) \
359 do { \
360 if (SHGSS_ReadAdv((name), (SSF))) \
361 gpss->field = ((SSF) & inverted) ? data == FALSE : data != FALSE; \
362 SHGSS_GetFieldHelper(field, (SSF), gpss, lpss, read); \
363 } while (0)
364
365 if (SHGSS_ReadAdv(L"Hidden", SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES))
366 {
367 gpss->fShowAllObjects = data == 1;
368 gpss->fShowSysFiles = data > 1;
369 }
370 SHGSS_GetField(fShowAllObjects, SSF_SHOWALLOBJECTS);
371 SHGSS_GetField(fShowSysFiles, SSF_SHOWSYSFILES);
372 SHGSS_GetSetAdv(SHGSS_GetAdv);
373 if (dwMask & ~(read | g_CachedSSF))
374 {
375 REGSHELLSTATE rss;
377 {
378 SHGSS_GetSetStruct(SHGSS_CacheField); // Copy the requested items to gpss
379 }
380 else
381 {
383 read = 0; // The advanced items we read are no longer valid in gpss
384 g_CachedSSF = SSF_STRUCTONLY;
385 /* HACKFIX: This should not be needed. Defaults should be used
386 * until an override option is selected. See CORE-20585. */
387 rss.ss = *gpss;
389 }
390 }
391 SHGSS_GetSetStruct(SHGSS_GetField); // Copy requested items from gpss to output
392 g_CachedSSF |= read;
393 }
394 if (hKeyAdv)
395 RegCloseKey(hKeyAdv);
396#else
397 if(bSet)
398 {
399 FIXME("%p 0x%08x TRUE\n", lpss, dwMask);
400 }
401 else
402 {
403 SHGetSettings((LPSHELLFLAGSTATE)lpss,dwMask);
404 }
405#endif //__REACTOS__
406}
407
408/*************************************************************************
409 * SHGetSettings [SHELL32.@]
410 *
411 * NOTES
412 * the registry path are for win98 (tested)
413 * and possibly are the same in nt40
414 *
415 */
417{
418#ifdef __REACTOS__
421 *lpsfs = *(LPSHELLFLAGSTATE)&ss;
422 if (dwMask & SSF_HIDEICONS)
423 lpsfs->fHideIcons = ss.fHideIcons;
424 if (dwMask & ssf_autocheckselect)
425 lpsfs->fAutoCheckSelect = ss.fAutoCheckSelect;
426 if (dwMask & ssf_iconsonly)
427 lpsfs->fIconsOnly = ss.fIconsOnly;
428#else
429 HKEY hKey;
431 DWORD dwDataSize = sizeof (DWORD);
432
433 TRACE("(%p 0x%08x)\n",lpsfs,dwMask);
434
435 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
436 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
437 return;
438
439 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
440 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
441
442 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
443 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
444
445 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
446 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
447
448 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
449 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
450
451 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
452 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
453
454 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
455 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
456
457 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
458 { if (dwData == 0)
459 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
460 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
461 }
462 else if (dwData == 1)
463 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
464 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
465 }
466 else if (dwData == 2)
467 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
468 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
469 }
470 }
472#endif //__REACTOS__
473 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
474}
475
476/*************************************************************************
477 * SHShellFolderView_Message [SHELL32.73]
478 *
479 * Send a message to an explorer cabinet window.
480 *
481 * PARAMS
482 * hwndCabinet [I] The window containing the shellview to communicate with
483 * dwMessage [I] The SFVM message to send
484 * dwParam [I] Message parameter
485 *
486 * RETURNS
487 * fixme.
488 *
489 * NOTES
490 * Message SFVM_REARRANGE = 1
491 *
492 * This message gets sent when a column gets clicked to instruct the
493 * shell view to re-sort the item list. dwParam identifies the column
494 * that was clicked.
495 */
497 HWND hwndCabinet,
498 UINT uMessage,
500{
501 FIXME("%p %08x %08lx stub\n",hwndCabinet, uMessage, lParam);
502 return 0;
503}
504
505/*************************************************************************
506 * RegisterShellHook [SHELL32.181]
507 *
508 * Register a shell hook.
509 *
510 * PARAMS
511 * hwnd [I] Window handle
512 * dwType [I] Type of hook.
513 *
514 * NOTES
515 * Exported by ordinal
516 */
518 HWND hWnd,
519 DWORD dwType)
520{
521 if (dwType == 3)
522 {
525 }
526 else if (dwType == 0)
527 {
529 }
530
531 ERR("Unsupported argument");
532 return FALSE;
533}
534
535/*************************************************************************
536 * ShellMessageBoxW [SHELL32.182]
537 *
538 * See ShellMessageBoxA.
539 *
540 */
541#ifdef __REACTOS__
542/*
543 * shell32.ShellMessageBoxW directly redirects to shlwapi.ShellMessageBoxWrapW,
544 * while shell32.ShellMessageBoxA is a copy-paste ANSI adaptation of the
545 * shlwapi.ShellMessageBoxWrapW function.
546 *
547 * From Vista+ onwards, all the implementation of ShellMessageBoxA/W that
548 * were existing in shell32 has been completely moved to shlwapi, so that
549 * shell32.ShellMessageBoxA and shell32.ShellMessageBoxW are redirections
550 * to the corresponding shlwapi functions.
551 *
552 */
553#else // !__REACTOS__
554/*
555 * NOTE:
556 * shlwapi.ShellMessageBoxWrapW is a duplicate of shell32.ShellMessageBoxW
557 * because we can't forward to it in the .spec file since it's exported by
558 * ordinal. If you change the implementation here please update the code in
559 * shlwapi as well.
560 */
561// Wine version, broken.
564 HWND hWnd,
565 LPCWSTR lpText,
566 LPCWSTR lpCaption,
567 UINT uType,
568 ...)
569{
570 WCHAR szText[100],szTitle[100];
571 LPCWSTR pszText = szText, pszTitle = szTitle;
572 LPWSTR pszTemp;
574 int ret;
575
576 __ms_va_start(args, uType);
577 /* wvsprintfA(buf,fmt, args); */
578
579 TRACE("(%p,%p,%p,%p,%08x)\n",
580 hInstance,hWnd,lpText,lpCaption,uType);
581
582 if (IS_INTRESOURCE(lpCaption))
584 else
585 pszTitle = lpCaption;
586
587 if (IS_INTRESOURCE(lpText))
588 LoadStringW(hInstance, LOWORD(lpText), szText, ARRAY_SIZE(szText));
589 else
590 pszText = lpText;
591
593 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
594
596
597 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType);
598 LocalFree(pszTemp);
599 return ret;
600}
601#endif
602
603/*************************************************************************
604 * ShellMessageBoxA [SHELL32.183]
605 *
606 * Format and output an error message.
607 *
608 * PARAMS
609 * hInstance [I] Instance handle of message creator
610 * hWnd [I] Window handle of message creator
611 * lpText [I] Resource Id of title or LPSTR
612 * lpCaption [I] Resource Id of title or LPSTR
613 * uType [I] Type of error message
614 *
615 * RETURNS
616 * A return value from MessageBoxA().
617 *
618 * NOTES
619 * Exported by ordinal
620 */
621#ifdef __REACTOS__
622/*
623 * Note that we cannot straightforwardly implement ShellMessageBoxA around
624 * ShellMessageBoxW, by converting some parameters from ANSI to UNICODE,
625 * because there may be some variadic ANSI strings, associated with '%s'
626 * printf-like formatters inside the format string, that would also need
627 * to be converted; however there is no way for us to find these and perform
628 * the conversion ourselves.
629 * Therefore, we re-implement ShellMessageBoxA by doing a copy-paste ANSI
630 * adaptation of the shlwapi.ShellMessageBoxWrapW function.
631 */
632#endif
635 HWND hWnd,
636 LPCSTR lpText,
637 LPCSTR lpCaption,
638 UINT uType,
639 ...)
640{
641#ifdef __REACTOS__
642 CHAR *szText = NULL, szTitle[100];
643 LPCSTR pszText, pszTitle = szTitle;
644 LPSTR pszTemp;
646 int ret;
647
648 __ms_va_start(args, uType);
649
650 TRACE("(%p,%p,%p,%p,%08x)\n", hInstance, hWnd, lpText, lpCaption, uType);
651
652 if (IS_INTRESOURCE(lpCaption))
654 else
655 pszTitle = lpCaption;
656
657 if (IS_INTRESOURCE(lpText))
658 {
659 /* Retrieve the length of the Unicode string and obtain the maximum
660 * possible length for the corresponding ANSI string (not counting
661 * any possible NULL-terminator). */
662 const WCHAR *ptr;
663 UINT len = LoadStringW(hInstance, LOWORD(lpText), (LPWSTR)&ptr, 0);
664
666 NULL, 0, NULL, NULL);
667
668 if (len)
669 {
670 szText = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(CHAR));
671 if (szText) LoadStringA(hInstance, LOWORD(lpText), szText, len + 1);
672 }
673 pszText = szText;
674 if (!pszText) {
675 WARN("Failed to load id %d\n", LOWORD(lpText));
677 return 0;
678 }
679 }
680 else
681 pszText = lpText;
682
684 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args);
685
687
688 ret = MessageBoxA(hWnd, pszTemp, pszTitle, uType | MB_SETFOREGROUND);
689
690 HeapFree(GetProcessHeap(), 0, szText);
691 LocalFree(pszTemp);
692 return ret;
693
694#else // __REACTOS__
695
696// Wine version, broken.
697 char szText[100],szTitle[100];
698 LPCSTR pszText = szText, pszTitle = szTitle;
699 LPSTR pszTemp;
701 int ret;
702
703 __ms_va_start(args, uType);
704 /* wvsprintfA(buf,fmt, args); */
705
706 TRACE("(%p,%p,%p,%p,%08x)\n",
707 hInstance,hWnd,lpText,lpCaption,uType);
708
709 if (IS_INTRESOURCE(lpCaption))
710 LoadStringA(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle));
711 else
712 pszTitle = lpCaption;
713
714 if (IS_INTRESOURCE(lpText))
715 LoadStringA(hInstance, LOWORD(lpText), szText, sizeof(szText));
716 else
717 pszText = lpText;
718
720 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args);
721
723
724 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType);
725 LocalFree(pszTemp);
726 return ret;
727#endif
728}
729
730/*************************************************************************
731 * SHRegisterDragDrop [SHELL32.86]
732 *
733 * Probably equivalent to RegisterDragDrop but under Windows 95 it could use the
734 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
735 * for details. Under Windows 98 this function initializes the true OLE when called
736 * the first time, on XP always returns E_OUTOFMEMORY and it got removed from Vista.
737 *
738 * We follow Windows 98 behaviour.
739 *
740 * NOTES
741 * exported by ordinal
742 *
743 * SEE ALSO
744 * RegisterDragDrop, SHLoadOLE
745 */
747 HWND hWnd,
748 LPDROPTARGET pDropTarget)
749{
750 static BOOL ole_initialized = FALSE;
751 HRESULT hr;
752
753 TRACE("(%p,%p)\n", hWnd, pDropTarget);
754
755 if (!ole_initialized)
756 {
758 if (FAILED(hr))
759 return hr;
760 ole_initialized = TRUE;
761 }
762 return RegisterDragDrop(hWnd, pDropTarget);
763}
764
765/*************************************************************************
766 * SHRevokeDragDrop [SHELL32.87]
767 *
768 * Probably equivalent to RevokeDragDrop but under Windows 95 it could use the
769 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
770 * for details. Function removed from Windows Vista.
771 *
772 * We call ole32 RevokeDragDrop which seems to work even if OleInitialize was
773 * not called.
774 *
775 * NOTES
776 * exported by ordinal
777 *
778 * SEE ALSO
779 * RevokeDragDrop, SHLoadOLE
780 */
782{
783 TRACE("(%p)\n", hWnd);
784 return RevokeDragDrop(hWnd);
785}
786
787/*************************************************************************
788 * SHDoDragDrop [SHELL32.88]
789 *
790 * Probably equivalent to DoDragDrop but under Windows 9x it could use the
791 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
792 * for details
793 *
794 * NOTES
795 * exported by ordinal
796 *
797 * SEE ALSO
798 * DoDragDrop, SHLoadOLE
799 */
801 HWND hWnd,
802 LPDATAOBJECT lpDataObject,
803 LPDROPSOURCE lpDropSource,
804 DWORD dwOKEffect,
805 LPDWORD pdwEffect)
806{
807 FIXME("(%p %p %p 0x%08x %p):stub.\n",
808 hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
809 return DoDragDrop(lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
810}
811
812/*************************************************************************
813 * ArrangeWindows [SHELL32.184]
814 *
815 */
817 WORD cKids, const HWND *lpKids)
818{
819 /* Unimplemented in WinXP SP3 */
820 TRACE("(%p 0x%08x %p 0x%04x %p):stub.\n",
821 hwndParent, dwReserved, lpRect, cKids, lpKids);
822 return 0;
823}
824
825/*************************************************************************
826 * SignalFileOpen [SHELL32.103]
827 *
828 * NOTES
829 * exported by ordinal
830 */
833{
834 FIXME("(%p):stub.\n", pidl);
835
836 return FALSE;
837}
838
839#ifndef __REACTOS__
840
841/*************************************************************************
842 * SHADD_get_policy - helper function for SHAddToRecentDocs
843 *
844 * PARAMETERS
845 * policy [IN] policy name (null termed string) to find
846 * type [OUT] ptr to DWORD to receive type
847 * buffer [OUT] ptr to area to hold data retrieved
848 * len [IN/OUT] ptr to DWORD holding size of buffer and getting
849 * length filled
850 *
851 * RETURNS
852 * result of the SHQueryValueEx call
853 */
855{
856 HKEY Policy_basekey;
857 INT ret;
858
859 /* Get the key for the policies location in the registry
860 */
862 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
863 0, KEY_READ, &Policy_basekey)) {
864
866 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
867 0, KEY_READ, &Policy_basekey)) {
868 TRACE("No Explorer Policies location exists. Policy wanted=%s\n",
869 policy);
870 *len = 0;
872 }
873 }
874
875 /* Retrieve the data if it exists
876 */
877 ret = SHQueryValueExA(Policy_basekey, policy, 0, type, buffer, len);
878 RegCloseKey(Policy_basekey);
879 return ret;
880}
881
882#endif // __REACTOS__
883
884/*************************************************************************
885 * SHADD_compare_mru - helper function for SHAddToRecentDocs
886 *
887 * PARAMETERS
888 * data1 [IN] data being looked for
889 * data2 [IN] data in MRU
890 * cbdata [IN] length from FindMRUData call (not used)
891 *
892 * RETURNS
893 * position within MRU list that data was added.
894 */
896{
897#ifdef __REACTOS__
898 LPCWSTR psz1, psz2;
899 INT iCmp = lstrcmpiW(data1, data2);
900 if (iCmp != 0)
901 return iCmp;
902 psz1 = data1;
903 psz2 = data2;
904 psz1 += lstrlenW(psz1) + 1;
905 psz2 += lstrlenW(psz2) + 1;
906 return lstrcmpiW(psz1, psz2);
907#else
908 return lstrcmpiA(data1, data2);
909#endif
910}
911
912#ifdef __REACTOS__
913static BOOL
914DoStoreMRUData(LPBYTE pbBuffer, LPDWORD pcbBuffer,
915 LPCWSTR pszTargetTitle, LPCWSTR pszTargetPath, LPCWSTR pszLinkTitle)
916{
917 DWORD ib = 0, cb;
918 INT cchTargetTitle = lstrlenW(pszTargetTitle);
919 INT cchTargetPath = lstrlenW(pszTargetPath);
920 INT cchLinkTitle = lstrlenW(pszLinkTitle);
921
922 cb = (cchTargetTitle + 1 + cchTargetPath + 1 + cchLinkTitle + 2) * sizeof(WCHAR);
923 if (cb > *pcbBuffer)
924 return FALSE;
925
926 ZeroMemory(pbBuffer, *pcbBuffer);
927
928 cb = (cchTargetTitle + 1) * sizeof(WCHAR);
929 if (ib + cb > *pcbBuffer)
930 return FALSE;
931 CopyMemory(&pbBuffer[ib], pszTargetTitle, cb);
932 ib += cb;
933
934 cb = (cchTargetPath + 1) * sizeof(WCHAR);
935 if (ib + cb > *pcbBuffer)
936 return FALSE;
937 CopyMemory(&pbBuffer[ib], pszTargetPath, cb);
938 ib += cb;
939
940 cb = (cchLinkTitle + 1) * sizeof(WCHAR);
941 if (ib + cb > *pcbBuffer)
942 return FALSE;
943 CopyMemory(&pbBuffer[ib], pszLinkTitle, cb);
944 ib += cb;
945
946 *pcbBuffer = ib;
947 return TRUE;
948}
949#else
950/*************************************************************************
951 * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs
952 *
953 * PARAMETERS
954 * mruhandle [IN] handle for created MRU list
955 * doc_name [IN] null termed pure doc name
956 * new_lnk_name [IN] null termed path and file name for .lnk file
957 * buffer [IN/OUT] 2048 byte area to construct MRU data
958 * len [OUT] ptr to int to receive space used in buffer
959 *
960 * RETURNS
961 * position within MRU list that data was added.
962 */
963static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPCSTR doc_name, LPCSTR new_lnk_name,
965{
966 LPSTR ptr;
967 INT wlen;
968
969 /*FIXME: Document:
970 * RecentDocs MRU data structure seems to be:
971 * +0h document file name w/ terminating 0h
972 * +nh short int w/ size of remaining
973 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
974 * +n+4h 10 bytes zeros - unknown
975 * +n+eh shortcut file name w/ terminating 0h
976 * +n+e+nh 3 zero bytes - unknown
977 */
978
979 /* Create the MRU data structure for "RecentDocs"
980 */
981 ptr = buffer;
982 lstrcpyA(ptr, doc_name);
983 ptr += (lstrlenA(buffer) + 1);
984 wlen= lstrlenA(new_lnk_name) + 1 + 12;
985 *((short int*)ptr) = wlen;
986 ptr += 2; /* step past the length */
987 *(ptr++) = 0x30; /* unknown reason */
988 *(ptr++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */
989 memset(ptr, 0, 10);
990 ptr += 10;
991 lstrcpyA(ptr, new_lnk_name);
992 ptr += (lstrlenA(new_lnk_name) + 1);
993 memset(ptr, 0, 3);
994 ptr += 3;
995 *len = ptr - buffer;
996
997 /* Add the new entry into the MRU list
998 */
999 return AddMRUData(mruhandle, buffer, *len);
1000}
1001#endif
1002
1003/*************************************************************************
1004 * SHAddToRecentDocs [SHELL32.@]
1005 *
1006 * Modify (add/clear) Shell's list of recently used documents.
1007 *
1008 * PARAMETERS
1009 * uFlags [IN] SHARD_PATHA, SHARD_PATHW or SHARD_PIDL
1010 * pv [IN] string or pidl, NULL clears the list
1011 *
1012 * NOTES
1013 * exported by name
1014 *
1015 * FIXME
1016 * convert to unicode
1017 */
1019{
1020#ifdef __REACTOS__
1021 INT ret;
1022 WCHAR szTargetPath[MAX_PATH], szLinkDir[MAX_PATH], szLinkFile[MAX_PATH], szDescription[80];
1024 DWORD cbBuffer;
1025 HANDLE hFind;
1027 HKEY hExplorerKey;
1028 LONG error;
1029 LPWSTR pchDotExt, pchTargetTitle, pchLinkTitle;
1030 MRUINFOW mru;
1031 HANDLE hMRUList = NULL;
1032 IShellLinkW *psl = NULL;
1033 IPersistFile *pPf = NULL;
1034 HRESULT hr;
1035 BYTE Buffer[(MAX_PATH + 64) * sizeof(WCHAR)];
1036
1037 TRACE("%04x %p\n", uFlags, pv);
1038
1039 /* check policy */
1041 TRACE("policy value for NoRecentDocsHistory = %08x\n", ret);
1042 if (ret != 0)
1043 return;
1044
1045 /* store to szTargetPath */
1046 szTargetPath[0] = 0;
1047 if (pv)
1048 {
1049 switch (uFlags)
1050 {
1051 case SHARD_PATHA:
1052 MultiByteToWideChar(CP_ACP, 0, pv, -1, szLinkDir, ARRAYSIZE(szLinkDir));
1053 GetFullPathNameW(szLinkDir, ARRAYSIZE(szTargetPath), szTargetPath, NULL);
1054 break;
1055
1056 case SHARD_PATHW:
1057 GetFullPathNameW(pv, ARRAYSIZE(szTargetPath), szTargetPath, NULL);
1058 break;
1059
1060 case SHARD_PIDL:
1061 SHGetPathFromIDListW(pv, szLinkDir);
1062 GetFullPathNameW(szLinkDir, ARRAYSIZE(szTargetPath), szTargetPath, NULL);
1063 break;
1064
1065 default:
1066 FIXME("Unsupported flags: %u\n", uFlags);
1067 return;
1068 }
1069 }
1070
1071 /* get recent folder */
1073 {
1074 ERR("serious issues 1\n");
1075 return;
1076 }
1077 TRACE("Users Recent dir %S\n", szLinkDir);
1078
1079 /* open Explorer key */
1080 error = RegCreateKeyExW(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer",
1081 0, NULL, 0,
1082 KEY_READ | KEY_WRITE, NULL, &hExplorerKey, NULL);
1083 if (error)
1084 {
1085 ERR("Failed to RegCreateKeyExW: 0x%08X\n", error);
1086 return;
1087 }
1088
1089 if (!pv)
1090 {
1091 TRACE("pv is NULL, so delete all shortcut files in %S\n", szLinkDir);
1092
1093 lstrcpynW(szLinkFile, szLinkDir, ARRAYSIZE(szLinkFile));
1094 PathAppendW(szLinkFile, L"*.lnk");
1095
1096 hFind = FindFirstFileW(szLinkFile, &find);
1097 if (hFind != INVALID_HANDLE_VALUE)
1098 {
1099 do
1100 {
1101 lstrcpynW(szLinkFile, szLinkDir, ARRAYSIZE(szLinkFile));
1102 PathAppendW(szLinkFile, find.cFileName);
1103 DeleteFileW(szLinkFile);
1104 } while (FindNextFile(hFind, &find));
1105 FindClose(hFind);
1106 }
1107
1108 SHDeleteKeyW(hExplorerKey, L"RecentDocs");
1109 RegCloseKey(hExplorerKey);
1110 return;
1111 }
1112
1113 if (szTargetPath[0] == 0 || !PathFileExistsW(szTargetPath) ||
1114 PathIsDirectoryW(szTargetPath))
1115 {
1116 /* path is not normal file */
1117 RegCloseKey(hExplorerKey);
1118 return;
1119 }
1120
1121 hr = CoInitialize(NULL);
1122 if (FAILED(hr))
1123 {
1124 ERR("CoInitialize: %08X\n", hr);
1125 RegCloseKey(hExplorerKey);
1126 return;
1127 }
1128
1129 /* check if file is a shortcut */
1130 ret = 0;
1131 pchDotExt = PathFindExtensionW(szTargetPath);
1132 while (lstrcmpiW(pchDotExt, L".lnk") == 0)
1133 {
1134 hr = IShellLink_ConstructFromPath(szTargetPath, &IID_IShellLinkW, (LPVOID*)&psl);
1135 if (FAILED(hr))
1136 {
1137 ERR("IShellLink_ConstructFromPath: 0x%08X\n", hr);
1138 goto Quit;
1139 }
1140
1141 IShellLinkW_GetPath(psl, szPath, ARRAYSIZE(szPath), NULL, 0);
1142 IShellLinkW_Release(psl);
1143 psl = NULL;
1144
1145 lstrcpynW(szTargetPath, szPath, ARRAYSIZE(szTargetPath));
1146 pchDotExt = PathFindExtensionW(szTargetPath);
1147
1148 if (++ret >= 8)
1149 {
1150 ERR("Link loop?\n");
1151 goto Quit;
1152 }
1153 }
1154 if (!lstrcmpiW(pchDotExt, L".exe"))
1155 {
1156 /* executables are not added */
1157 goto Quit;
1158 }
1159
1160 /* *** JOB 0: Build strings *** */
1161
1162 pchTargetTitle = PathFindFileNameW(szTargetPath);
1163
1164 lstrcpyW(szDescription, L"Shortcut to ");
1166
1167 lstrcpynW(szLinkFile, szLinkDir, ARRAYSIZE(szLinkFile));
1168 PathAppendW(szLinkFile, pchTargetTitle);
1169 StrCatBuffW(szLinkFile, L".lnk", ARRAYSIZE(szLinkFile));
1170 pchLinkTitle = PathFindFileNameW(szLinkFile);
1171
1172 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
1173
1174 /* store MRU data */
1175 cbBuffer = sizeof(Buffer);
1176 ret = DoStoreMRUData(Buffer, &cbBuffer, pchTargetTitle, szTargetPath, pchLinkTitle);
1177 if (!ret)
1178 {
1179 ERR("DoStoreMRUData failed: %d\n", ret);
1180 goto Quit;
1181 }
1182
1183 /* create MRU list */
1184 mru.cbSize = sizeof(mru);
1185 mru.uMax = 16;
1187 mru.hKey = hExplorerKey;
1188 mru.lpszSubKey = L"RecentDocs";
1189 mru.lpfnCompare = (MRUCMPPROCW)SHADD_compare_mru;
1190 hMRUList = CreateMRUListW(&mru);
1191 if (!hMRUList)
1192 {
1193 ERR("CreateMRUListW failed\n");
1194 goto Quit;
1195 }
1196
1197 /* already exists? */
1198 ret = FindMRUData(hMRUList, Buffer, cbBuffer, NULL);
1199 if (ret >= 0)
1200 {
1201 /* Just touch for speed */
1202 HANDLE hFile;
1206 {
1207 TRACE("Just touch file '%S'.\n", szLinkFile);
1209 goto Quit;
1210 }
1211 }
1212
1213 /* add MRU data */
1214 ret = AddMRUData(hMRUList, Buffer, cbBuffer);
1215 if (ret < 0)
1216 {
1217 ERR("AddMRUData failed: %d\n", ret);
1218 goto Quit;
1219 }
1220
1221 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
1222
1223 hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
1224 &IID_IShellLinkW, (LPVOID *)&psl);
1225 if (FAILED(hr))
1226 {
1227 ERR("CoInitialize for IID_IShellLinkW: %08X\n", hr);
1228 goto Quit;
1229 }
1230
1231 hr = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (LPVOID *)&pPf);
1232 if (FAILED(hr))
1233 {
1234 ERR("IShellLinkW_QueryInterface: %08X\n", hr);
1235 goto Quit;
1236 }
1237
1238 if (uFlags == SHARD_PIDL)
1239 hr = IShellLinkW_SetIDList(psl, pv);
1240 else
1241 hr = IShellLinkW_SetPath(psl, pv);
1242
1243 IShellLinkW_SetDescription(psl, szDescription);
1244
1245 hr = IPersistFile_Save(pPf, szLinkFile, TRUE);
1246 if (FAILED(hr))
1247 {
1248 ERR("IPersistFile_Save: 0x%08X\n", hr);
1249 }
1250
1251 hr = IPersistFile_SaveCompleted(pPf, szLinkFile);
1252 if (FAILED(hr))
1253 {
1254 ERR("IPersistFile_SaveCompleted: 0x%08X\n", hr);
1255 }
1256
1257Quit:
1258 if (hMRUList)
1259 FreeMRUList(hMRUList);
1260 if (pPf)
1261 IPersistFile_Release(pPf);
1262 if (psl)
1263 IShellLinkW_Release(psl);
1265 RegCloseKey(hExplorerKey);
1266#else
1267/* If list is a string list lpfnCompare has the following prototype
1268 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
1269 * for binary lists the prototype is
1270 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
1271 * where cbData is the no. of bytes to compare.
1272 * Need to check what return value means identical - 0?
1273 */
1274
1275
1276 UINT olderrormode;
1277 HKEY HCUbasekey;
1278 CHAR doc_name[MAX_PATH];
1279 CHAR link_dir[MAX_PATH];
1280 CHAR new_lnk_filepath[MAX_PATH];
1281 CHAR new_lnk_name[MAX_PATH];
1282 CHAR * ext;
1283 IMalloc *ppM;
1284 LPITEMIDLIST pidl;
1285 HWND hwnd = 0; /* FIXME: get real window handle */
1286 INT ret;
1287 DWORD data[64], datalen, type;
1288
1289 TRACE("%04x %p\n", uFlags, pv);
1290
1291 /*FIXME: Document:
1292 * RecentDocs MRU data structure seems to be:
1293 * +0h document file name w/ terminating 0h
1294 * +nh short int w/ size of remaining
1295 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
1296 * +n+4h 10 bytes zeros - unknown
1297 * +n+eh shortcut file name w/ terminating 0h
1298 * +n+e+nh 3 zero bytes - unknown
1299 */
1300
1301 /* See if we need to do anything.
1302 */
1303 datalen = 64;
1304 ret=SHADD_get_policy( "NoRecentDocsHistory", &type, data, &datalen);
1305 if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) {
1306 ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret);
1307 return;
1308 }
1309 if (ret == ERROR_SUCCESS) {
1310 if (!( (type == REG_DWORD) ||
1311 ((type == REG_BINARY) && (datalen == 4)) )) {
1312 ERR("Error policy data for \"NoRecentDocsHistory\" not formatted correctly, type=%d, len=%d\n",
1313 type, datalen);
1314 return;
1315 }
1316
1317 TRACE("policy value for NoRecentDocsHistory = %08x\n", data[0]);
1318 /* now test the actual policy value */
1319 if ( data[0] != 0)
1320 return;
1321 }
1322
1323 /* Open key to where the necessary info is
1324 */
1325 /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH)
1326 * and the close should be done during the _DETACH. The resulting
1327 * key is stored in the DLL global data.
1328 */
1330 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
1331 0, 0, 0, KEY_READ, 0, &HCUbasekey, 0)) {
1332 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n");
1333 return;
1334 }
1335
1336 /* Get path to user's "Recent" directory
1337 */
1338 if(SUCCEEDED(SHGetMalloc(&ppM))) {
1340 &pidl))) {
1341 SHGetPathFromIDListA(pidl, link_dir);
1342 IMalloc_Free(ppM, pidl);
1343 }
1344 else {
1345 /* serious issues */
1346 link_dir[0] = 0;
1347 ERR("serious issues 1\n");
1348 }
1349 IMalloc_Release(ppM);
1350 }
1351 else {
1352 /* serious issues */
1353 link_dir[0] = 0;
1354 ERR("serious issues 2\n");
1355 }
1356 TRACE("Users Recent dir %s\n", link_dir);
1357
1358 /* If no input, then go clear the lists */
1359 if (!pv) {
1360 /* clear user's Recent dir
1361 */
1362
1363 /* FIXME: delete all files in "link_dir"
1364 *
1365 * while( more files ) {
1366 * lstrcpyA(old_lnk_name, link_dir);
1367 * PathAppendA(old_lnk_name, filenam);
1368 * DeleteFileA(old_lnk_name);
1369 * }
1370 */
1371 FIXME("should delete all files in %s\\\n", link_dir);
1372
1373 /* clear MRU list
1374 */
1375 /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against
1376 * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer
1377 * and naturally it fails w/ rc=2. It should do it against
1378 * HKEY_CURRENT_USER which is where it is stored, and where
1379 * the MRU routines expect it!!!!
1380 */
1381 RegDeleteKeyA(HCUbasekey, "RecentDocs");
1382 RegCloseKey(HCUbasekey);
1383 return;
1384 }
1385
1386 /* Have data to add, the jobs to be done:
1387 * 1. Add document to MRU list in registry "HKCU\Software\
1388 * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs".
1389 * 2. Add shortcut to document in the user's Recent directory
1390 * (CSIDL_RECENT).
1391 * 3. Add shortcut to Start menu's Documents submenu.
1392 */
1393
1394 /* Get the pure document name from the input
1395 */
1396 switch (uFlags)
1397 {
1398 case SHARD_PIDL:
1399 if (!SHGetPathFromIDListA(pv, doc_name))
1400 {
1401 WARN("can't get path from PIDL\n");
1402 return;
1403 }
1404 break;
1405
1406 case SHARD_PATHA:
1407 lstrcpynA(doc_name, pv, MAX_PATH);
1408 break;
1409
1410 case SHARD_PATHW:
1411 WideCharToMultiByte(CP_ACP, 0, pv, -1, doc_name, MAX_PATH, NULL, NULL);
1412 break;
1413
1414 default:
1415 FIXME("Unsupported flags: %u\n", uFlags);
1416 return;
1417 }
1418
1419 TRACE("full document name %s\n", debugstr_a(doc_name));
1420
1421 PathStripPathA(doc_name);
1422 TRACE("stripped document name %s\n", debugstr_a(doc_name));
1423
1424
1425 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
1426
1427 { /* on input needs:
1428 * doc_name - pure file-spec, no path
1429 * link_dir - path to the user's Recent directory
1430 * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node
1431 * creates:
1432 * new_lnk_name- pure file-spec, no path for new .lnk file
1433 * new_lnk_filepath
1434 * - path and file name of new .lnk file
1435 */
1436 CREATEMRULISTA mymru;
1437 HANDLE mruhandle;
1438 INT len, pos, bufused, err;
1439 INT i;
1440 DWORD attr;
1441 CHAR buffer[2048];
1442 CHAR *ptr;
1443 CHAR old_lnk_name[MAX_PATH];
1444 short int slen;
1445
1446 mymru.cbSize = sizeof(CREATEMRULISTA);
1447 mymru.nMaxItems = 15;
1449 mymru.hKey = HCUbasekey;
1450 mymru.lpszSubKey = "RecentDocs";
1451 mymru.lpfnCompare = SHADD_compare_mru;
1452 mruhandle = CreateMRUListA(&mymru);
1453 if (!mruhandle) {
1454 /* MRU failed */
1455 ERR("MRU processing failed, handle zero\n");
1456 RegCloseKey(HCUbasekey);
1457 return;
1458 }
1459 len = lstrlenA(doc_name);
1460 pos = FindMRUData(mruhandle, doc_name, len, 0);
1461
1462 /* Now get the MRU entry that will be replaced
1463 * and delete the .lnk file for it
1464 */
1465 if ((bufused = EnumMRUListA(mruhandle, (pos == -1) ? 14 : pos,
1466 buffer, 2048)) != -1) {
1467 ptr = buffer;
1468 ptr += (lstrlenA(buffer) + 1);
1469 slen = *((short int*)ptr);
1470 ptr += 2; /* skip the length area */
1471 if (bufused >= slen + (ptr-buffer)) {
1472 /* buffer size looks good */
1473 ptr += 12; /* get to string */
1474 len = bufused - (ptr-buffer); /* get length of buf remaining */
1475 if (ptr[0] && (lstrlenA(ptr) <= len-1)) {
1476 /* appears to be good string */
1477 lstrcpyA(old_lnk_name, link_dir);
1478 PathAppendA(old_lnk_name, ptr);
1479 if (!DeleteFileA(old_lnk_name)) {
1480 if ((attr = GetFileAttributesA(old_lnk_name)) == INVALID_FILE_ATTRIBUTES) {
1481 if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) {
1482 ERR("Delete for %s failed, err=%d, attr=%08x\n",
1483 old_lnk_name, err, attr);
1484 }
1485 else {
1486 TRACE("old .lnk file %s did not exist\n",
1487 old_lnk_name);
1488 }
1489 }
1490 else {
1491 ERR("Delete for %s failed, attr=%08x\n",
1492 old_lnk_name, attr);
1493 }
1494 }
1495 else {
1496 TRACE("deleted old .lnk file %s\n", old_lnk_name);
1497 }
1498 }
1499 }
1500 }
1501
1502 /* Create usable .lnk file name for the "Recent" directory
1503 */
1504 wsprintfA(new_lnk_name, "%s.lnk", doc_name);
1505 lstrcpyA(new_lnk_filepath, link_dir);
1506 PathAppendA(new_lnk_filepath, new_lnk_name);
1507 i = 1;
1508 olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS);
1509 while (GetFileAttributesA(new_lnk_filepath) != INVALID_FILE_ATTRIBUTES) {
1510 i++;
1511 wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i);
1512 lstrcpyA(new_lnk_filepath, link_dir);
1513 PathAppendA(new_lnk_filepath, new_lnk_name);
1514 }
1515 SetErrorMode(olderrormode);
1516 TRACE("new shortcut will be %s\n", new_lnk_filepath);
1517
1518 /* Now add the new MRU entry and data
1519 */
1520 pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name,
1521 buffer, &len);
1522 FreeMRUList(mruhandle);
1523 TRACE("Updated MRU list, new doc is position %d\n", pos);
1524 }
1525
1526 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
1527
1528 { /* on input needs:
1529 * doc_name - pure file-spec, no path
1530 * new_lnk_filepath
1531 * - path and file name of new .lnk file
1532 * uFlags[in] - flags on call to SHAddToRecentDocs
1533 * pv[in] - document path/pidl on call to SHAddToRecentDocs
1534 */
1535 IShellLinkA *psl = NULL;
1536 IPersistFile *pPf = NULL;
1537 HRESULT hres;
1539 WCHAR widelink[MAX_PATH];
1540
1541 CoInitialize(0);
1542
1543 hres = CoCreateInstance( &CLSID_ShellLink,
1544 NULL,
1545 CLSCTX_INPROC_SERVER,
1546 &IID_IShellLinkA,
1547 (LPVOID )&psl);
1548 if(SUCCEEDED(hres)) {
1549
1550 hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile,
1551 (LPVOID *)&pPf);
1552 if(FAILED(hres)) {
1553 /* bombed */
1554 ERR("failed QueryInterface for IPersistFile %08x\n", hres);
1555 goto fail;
1556 }
1557
1558 /* Set the document path or pidl */
1559 if (uFlags == SHARD_PIDL) {
1560 hres = IShellLinkA_SetIDList(psl, pv);
1561 } else {
1562 hres = IShellLinkA_SetPath(psl, pv);
1563 }
1564 if(FAILED(hres)) {
1565 /* bombed */
1566 ERR("failed Set{IDList|Path} %08x\n", hres);
1567 goto fail;
1568 }
1569
1570 lstrcpyA(desc, "Shortcut to ");
1571 lstrcatA(desc, doc_name);
1572 hres = IShellLinkA_SetDescription(psl, desc);
1573 if(FAILED(hres)) {
1574 /* bombed */
1575 ERR("failed SetDescription %08x\n", hres);
1576 goto fail;
1577 }
1578
1579 MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1,
1580 widelink, MAX_PATH);
1581 /* create the short cut */
1582 hres = IPersistFile_Save(pPf, widelink, TRUE);
1583 if(FAILED(hres)) {
1584 /* bombed */
1585 ERR("failed IPersistFile::Save %08x\n", hres);
1586 IPersistFile_Release(pPf);
1587 IShellLinkA_Release(psl);
1588 goto fail;
1589 }
1590 hres = IPersistFile_SaveCompleted(pPf, widelink);
1591 IPersistFile_Release(pPf);
1592 IShellLinkA_Release(psl);
1593 TRACE("shortcut %s has been created, result=%08x\n",
1594 new_lnk_filepath, hres);
1595 }
1596 else {
1597 ERR("CoCreateInstance failed, hres=%08x\n", hres);
1598 }
1599 }
1600
1601 fail:
1603
1604 /* all done */
1605 RegCloseKey(HCUbasekey);
1606 return;
1607#endif
1608}
1609
1610/*************************************************************************
1611 * SHCreateShellFolderViewEx [SHELL32.174]
1612 *
1613 * Create a new instance of the default Shell folder view object.
1614 *
1615 * RETURNS
1616 * Success: S_OK
1617 * Failure: error value
1618 *
1619 * NOTES
1620 * see IShellFolder::CreateViewObject
1621 */
1622 #ifndef __REACTOS__
1623
1625 LPCSFV psvcbi, /* [in] shelltemplate struct */
1626 IShellView **ppv) /* [out] IShellView pointer */
1627{
1628 IShellView * psf;
1629 HRESULT hRes;
1630
1631 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n",
1632 psvcbi->pshf, psvcbi->pidl, psvcbi->pfnCallback,
1633 psvcbi->fvm, psvcbi->psvOuter);
1634
1635 *ppv = NULL;
1636 hRes = IShellView_Constructor(psvcbi->pshf, &psf);
1637
1638 if (FAILED(hRes))
1639 return hRes;
1640
1641 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
1642 IShellView_Release(psf);
1643
1644 return hRes;
1645}
1646#endif
1647
1648/*************************************************************************
1649 * SHWinHelp [SHELL32.127]
1650 *
1651 */
1653{
1654 TRACE("(%p, %s, 0x%08x, %p)\n", hwnd, debugstr_w(pszHelp), uCommand, dwData);
1655 if (!WinHelpW(hwnd, pszHelp, uCommand, dwData))
1656 {
1657#if 0
1660#endif
1661 return FALSE;
1662 }
1663 return TRUE;
1664}
1665/*************************************************************************
1666 * SHRunControlPanel [SHELL32.161]
1667 *
1668 */
1669#ifdef __REACTOS__
1672{
1673 /*
1674 * TODO: Run in-process when possible, using
1675 * HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\InProcCPLs
1676 * and possibly some extra rules.
1677 * See also https://docs.microsoft.com/en-us/windows/win32/api/shlobj/nf-shlobj-shruncontrolpanel
1678 * "If the specified Control Panel item is already running, SHRunControlPanel
1679 * attempts to switch to that instance rather than opening a new instance."
1680 * This function is not supported as of Windows Vista, where it always returns FALSE.
1681 * However we need to keep it "alive" even when ReactOS is compliled as NT6+
1682 * in order to keep control panel elements launch commands.
1683 */
1684 WCHAR parameters[MAX_PATH] = L"shell32.dll,Control_RunDLL ";
1685 if (!commandLine)
1686 return FALSE;
1687 wcscat(parameters, commandLine);
1688 return ((INT_PTR)ShellExecuteW(parent, L"open", L"rundll32.exe", parameters, NULL, SW_SHOWNORMAL) > 32);
1689}
1690#endif
1691
1693{
1694#ifdef __REACTOS__
1695 TRACE("(%s, %p)n", debugstr_w(commandLine), parent);
1696 /* MSDN indicates that ROS should have a version check here but Vista+ just forwards to SHUNIMPL
1697 if (LOBYTE(GetVersion()) >= 6)
1698 return FALSE;
1699 */
1700 return SHELL32_RunControlPanel(commandLine, parent);
1701#else
1702 FIXME("(%s, %p): stub\n", debugstr_w(commandLine), parent);
1703 return FALSE;
1704#endif
1705}
1706
1708/*************************************************************************
1709 * SHSetInstanceExplorer [SHELL32.176]
1710 *
1711 * NOTES
1712 * Sets the interface
1713 */
1715{ TRACE("%p\n", lpUnknown);
1716 SHELL32_IExplorerInterface = lpUnknown;
1717}
1718/*************************************************************************
1719 * SHGetInstanceExplorer [SHELL32.@]
1720 *
1721 * NOTES
1722 * gets the interface pointer of the explorer and a reference
1723 */
1725{ TRACE("%p\n", lpUnknown);
1726
1727 *lpUnknown = SHELL32_IExplorerInterface;
1728
1730 return E_FAIL;
1731
1732 IUnknown_AddRef(SHELL32_IExplorerInterface);
1733 return S_OK;
1734}
1735/*************************************************************************
1736 * SHFreeUnusedLibraries [SHELL32.123]
1737 *
1738 * Probably equivalent to CoFreeUnusedLibraries but under Windows 9x it could use
1739 * the shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
1740 * for details
1741 *
1742 * NOTES
1743 * exported by ordinal
1744 *
1745 * SEE ALSO
1746 * CoFreeUnusedLibraries, SHLoadOLE
1747 */
1749{
1750 FIXME("stub\n");
1752}
1753/*************************************************************************
1754 * DAD_AutoScroll [SHELL32.129]
1755 *
1756 */
1758{
1759 FIXME("hwnd = %p %p %p\n",hwnd,samples,pt);
1760 return FALSE;
1761}
1762/*************************************************************************
1763 * DAD_DragEnter [SHELL32.130]
1764 *
1765 */
1767{
1768 FIXME("hwnd = %p\n",hwnd);
1769 return FALSE;
1770}
1771/*************************************************************************
1772 * DAD_DragEnterEx [SHELL32.131]
1773 *
1774 */
1776{
1777 FIXME("hwnd = %p (%d,%d)\n",hwnd,p.x,p.y);
1778 return FALSE;
1779}
1780/*************************************************************************
1781 * DAD_DragMove [SHELL32.134]
1782 *
1783 */
1785{
1786 FIXME("(%d,%d)\n",p.x,p.y);
1787 return FALSE;
1788}
1789/*************************************************************************
1790 * DAD_DragLeave [SHELL32.132]
1791 *
1792 */
1794{
1795 FIXME("\n");
1796 return FALSE;
1797}
1798/*************************************************************************
1799 * DAD_SetDragImage [SHELL32.136]
1800 *
1801 * NOTES
1802 * exported by name
1803 */
1805 HIMAGELIST himlTrack,
1806 LPPOINT lppt)
1807{
1808 FIXME("%p %p stub\n",himlTrack, lppt);
1809 return FALSE;
1810}
1811/*************************************************************************
1812 * DAD_ShowDragImage [SHELL32.137]
1813 *
1814 * NOTES
1815 * exported by name
1816 */
1818{
1819 FIXME("0x%08x stub\n",bShow);
1820 return FALSE;
1821}
1822
1823/*************************************************************************
1824 * ReadCabinetState [SHELL32.651] NT 4.0
1825 *
1826 */
1828{
1829 HKEY hkey = 0;
1830 DWORD type, r;
1831 C_ASSERT(sizeof(*cs) == FIELD_OFFSET(CABINETSTATE, fMenuEnumFilter) + sizeof(UINT));
1832
1833 TRACE("%p %d\n", cs, length);
1834
1835 if( (cs == NULL) || (length < (int)sizeof(*cs)) )
1836 return FALSE;
1837
1838 r = RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CabinetState", &hkey );
1839 if( r == ERROR_SUCCESS )
1840 {
1841 type = REG_BINARY;
1842 r = RegQueryValueExW( hkey, L"Settings",
1843 NULL, &type, (LPBYTE)cs, (LPDWORD)&length );
1844 RegCloseKey( hkey );
1845
1846 }
1847
1848 /* if we can't read from the registry, create default values */
1849 if ( (r != ERROR_SUCCESS) || (cs->cLength < sizeof(*cs)) ||
1850 (cs->cLength != length) )
1851 {
1852 SHELLSTATE shellstate;
1853 shellstate.fWin95Classic = FALSE;
1855
1856 TRACE("Initializing shell cabinet settings\n");
1857 memset(cs, 0, sizeof(*cs));
1858 cs->cLength = sizeof(*cs);
1859 cs->nVersion = 2;
1860 cs->fFullPathTitle = FALSE;
1861 cs->fSaveLocalView = TRUE;
1862 cs->fNotShell = FALSE;
1863 cs->fSimpleDefault = TRUE;
1864 cs->fDontShowDescBar = FALSE;
1865 cs->fNewWindowMode = shellstate.fWin95Classic;
1866 cs->fShowCompColor = FALSE;
1867 cs->fDontPrettyNames = FALSE;
1868 cs->fAdminsCreateCommonGroups = TRUE;
1869 cs->fMenuEnumFilter = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS;
1870 }
1871
1872 return TRUE;
1873}
1874
1875/*************************************************************************
1876 * WriteCabinetState [SHELL32.652] NT 4.0
1877 *
1878 */
1880{
1881 DWORD r;
1882 HKEY hkey = 0;
1883
1884 TRACE("%p\n",cs);
1885
1886 if( cs == NULL )
1887 return FALSE;
1888
1889 r = RegCreateKeyExW( HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CabinetState", 0,
1890 NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
1891 if( r == ERROR_SUCCESS )
1892 {
1893 r = RegSetValueExW( hkey, L"Settings", 0,
1894 REG_BINARY, (LPBYTE) cs, cs->cLength);
1895
1896 RegCloseKey( hkey );
1897 }
1898
1899#ifdef __REACTOS__
1900 /* TODO: if (r==ERROR_SUCCESS) Increment GLOBALCOUNTER_FOLDERSETTINGSCHANGE */
1901#endif
1902 return (r==ERROR_SUCCESS);
1903}
1904
1905/*************************************************************************
1906 * FileIconInit [SHELL32.660]
1907 *
1908 */
1910{
1911 return SIC_Initialize();
1912}
1913
1914/*************************************************************************
1915 * SetAppStartingCursor [SHELL32.99]
1916 */
1918{ FIXME("hwnd=%p 0x%04x stub\n",u,v );
1919 return 0;
1920}
1921
1922/*************************************************************************
1923 * SHLoadOLE [SHELL32.151]
1924 *
1925 * To reduce the memory usage of Windows 95, its shell32 contained an
1926 * internal implementation of a part of COM (see e.g. SHGetMalloc, SHCoCreateInstance,
1927 * SHRegisterDragDrop etc.) that allowed to use in-process STA objects without
1928 * the need to load OLE32.DLL. If OLE32.DLL was already loaded, the SH* function
1929 * would just call the Co* functions.
1930 *
1931 * The SHLoadOLE was called when OLE32.DLL was being loaded to transfer all the
1932 * information from the shell32 "mini-COM" to ole32.dll.
1933 *
1934 * See https://devblogs.microsoft.com/oldnewthing/20040705-00/?p=38573 for a
1935 * detailed description.
1936 *
1937 * Under wine ole32.dll is always loaded as it is imported by shlwapi.dll which is
1938 * imported by shell32 and no "mini-COM" is used (except for the "LoadWithoutCOM"
1939 * hack in SHCoCreateInstance)
1940 */
1942{ FIXME("0x%08lx stub\n",lParam);
1943 return S_OK;
1944}
1945/*************************************************************************
1946 * DriveType [SHELL32.64]
1947 *
1948 */
1950{
1951 WCHAR root[] = L"A:\\";
1952 root[0] = L'A' + DriveType;
1953 return GetDriveTypeW(root);
1954}
1955/*************************************************************************
1956 * InvalidateDriveType [SHELL32.65]
1957 * Unimplemented in XP SP3
1958 */
1960{
1961 TRACE("0x%08x stub\n",u);
1962 return 0;
1963}
1964/*************************************************************************
1965 * SHAbortInvokeCommand [SHELL32.198]
1966 *
1967 */
1969{ FIXME("stub\n");
1970 return 1;
1971}
1972/*************************************************************************
1973 * SHOutOfMemoryMessageBox [SHELL32.126]
1974 *
1975 */
1977 HWND hwndOwner,
1978 LPCSTR lpCaption,
1979 UINT uType)
1980{
1981 FIXME("%p %s 0x%08x stub\n",hwndOwner, lpCaption, uType);
1982 return 0;
1983}
1984/*************************************************************************
1985 * SHFlushClipboard [SHELL32.121]
1986 *
1987 */
1989{
1990 return OleFlushClipboard();
1991}
1992
1993/*************************************************************************
1994 * SHWaitForFileToOpen [SHELL32.97]
1995 *
1996 */
1998 LPCITEMIDLIST pidl,
1999 DWORD dwFlags,
2000 DWORD dwTimeout)
2001{
2002 FIXME("%p 0x%08x 0x%08x stub\n", pidl, dwFlags, dwTimeout);
2003 return FALSE;
2004}
2005
2006/************************************************************************
2007 * RLBuildListOfPaths [SHELL32.146]
2008 *
2009 * NOTES
2010 * builds a DPA
2011 */
2013{ FIXME("stub\n");
2014 return 0;
2015}
2016/************************************************************************
2017 * SHValidateUNC [SHELL32.173]
2018 *
2019 */
2020BOOL WINAPI SHValidateUNC (HWND hwndOwner, PWSTR pszFile, UINT fConnect)
2021{
2022 FIXME("(%p, %s, 0x%08x): stub\n", hwndOwner, debugstr_w(pszFile), fConnect);
2023 return FALSE;
2024}
2025
2026/************************************************************************
2027 * DoEnvironmentSubstA [SHELL32.@]
2028 *
2029 * See DoEnvironmentSubstW.
2030 */
2032{
2033 LPSTR dst;
2034 BOOL res = FALSE;
2035 DWORD len = cchString;
2036
2037 TRACE("(%s, %d)\n", debugstr_a(pszString), cchString);
2038 if (pszString == NULL) /* Really return 0? */
2039 return 0;
2040 if ((dst = (LPSTR)HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(CHAR))))
2041 {
2042 len = ExpandEnvironmentStringsA(pszString, dst, cchString);
2043 /* len includes the terminating 0 */
2044 if (len && len < cchString)
2045 {
2046 res = TRUE;
2047 memcpy(pszString, dst, len);
2048 }
2049 else
2050 len = cchString;
2051
2053 }
2054 return MAKELONG(len, res);
2055}
2056
2057/************************************************************************
2058 * DoEnvironmentSubstW [SHELL32.@]
2059 *
2060 * Replace all %KEYWORD% in the string with the value of the named
2061 * environment variable. If the buffer is too small, the string is not modified.
2062 *
2063 * PARAMS
2064 * pszString [I] '\0' terminated string with %keyword%.
2065 * [O] '\0' terminated string with %keyword% substituted.
2066 * cchString [I] size of str.
2067 *
2068 * RETURNS
2069 * Success: The string in the buffer is updated
2070 * HIWORD: TRUE
2071 * LOWORD: characters used in the buffer, including space for the terminating 0
2072 * Failure: buffer too small. The string is not modified.
2073 * HIWORD: FALSE
2074 * LOWORD: provided size of the buffer in characters
2075 */
2077{
2078 LPWSTR dst;
2079 BOOL res = FALSE;
2080 DWORD len = cchString;
2081
2082 TRACE("(%s, %d)\n", debugstr_w(pszString), cchString);
2083
2084 if ((cchString < MAXLONG) && (dst = HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(WCHAR))))
2085 {
2086 len = ExpandEnvironmentStringsW(pszString, dst, cchString);
2087 /* len includes the terminating 0 */
2088 if (len && len <= cchString)
2089 {
2090 res = TRUE;
2091 memcpy(pszString, dst, len * sizeof(WCHAR));
2092 }
2093 else
2094 len = cchString;
2095
2097 }
2098 return MAKELONG(len, res);
2099}
2100
2101/************************************************************************
2102 * DoEnvironmentSubst [SHELL32.53]
2103 *
2104 * See DoEnvironmentSubstA.
2105 */
2107{
2108 if (SHELL_OsIsUnicode())
2109 return DoEnvironmentSubstW(x, y);
2110 return DoEnvironmentSubstA(x, y);
2111}
2112
2113/*************************************************************************
2114 * GUIDFromStringA [SHELL32.703]
2115 */
2117{
2118 ANSI_STRING ansi_str;
2119 WCHAR szWide[40];
2120 UNICODE_STRING guid_str = { 0, sizeof(szWide), szWide };
2121 if (*str != '{')
2122 return FALSE;
2123 RtlInitAnsiString(&ansi_str, str);
2124 return !RtlAnsiStringToUnicodeString(&guid_str, &ansi_str, FALSE) &&
2125 !RtlGUIDFromString(&guid_str, guid);
2126}
2127
2128/*************************************************************************
2129 * GUIDFromStringW [SHELL32.704]
2130 */
2132{
2133 UNICODE_STRING guid_str;
2134 if (!str || *str != L'{')
2135 return FALSE;
2136 RtlInitUnicodeString(&guid_str, str);
2137 return !RtlGUIDFromString(&guid_str, guid);
2138}
2139
2140/*************************************************************************
2141 * PathIsTemporaryA [SHELL32.713]
2142 */
2143#ifdef __REACTOS__
2146#else
2148#endif
2149{
2150#ifdef __REACTOS__
2151 WCHAR szWide[MAX_PATH];
2152
2153 TRACE("(%s)\n", debugstr_a(Str));
2154
2155 SHAnsiToUnicode(Str, szWide, _countof(szWide));
2156 return PathIsTemporaryW(szWide);
2157#else
2158 FIXME("(%s)stub\n", debugstr_a(Str));
2159 return FALSE;
2160#endif
2161}
2162
2163/*************************************************************************
2164 * PathIsTemporaryW [SHELL32.714]
2165 */
2166#ifdef __REACTOS__
2169#else
2171#endif
2172{
2173#ifdef __REACTOS__
2174 WCHAR szLongPath[MAX_PATH], szTempPath[MAX_PATH];
2175 DWORD attrs;
2176 LPCWSTR pszTarget = Str;
2177
2178 TRACE("(%s)\n", debugstr_w(Str));
2179
2180 attrs = GetFileAttributesW(Str);
2181 if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_TEMPORARY))
2182 return TRUE;
2183
2186 {
2187 return FALSE;
2188 }
2189
2190 if (GetLongPathNameW(Str, szLongPath, _countof(szLongPath)))
2191 pszTarget = szLongPath;
2192
2193 return (PathIsEqualOrSubFolder(szTempPath, pszTarget) ||
2196#else
2197 FIXME("(%s)stub\n", debugstr_w(Str));
2198 return FALSE;
2199#endif
2200}
2201
2202typedef struct _PSXA
2203{
2208
2209typedef struct _PSXA_CALL
2210{
2217
2219{
2221
2222 if (Call != NULL)
2223 {
2224 if ((Call->bMultiple || !Call->bCalled) &&
2225 Call->lpfnAddReplaceWith(hpage, Call->lParam))
2226 {
2227 Call->bCalled = TRUE;
2228 Call->uiCount++;
2229 return TRUE;
2230 }
2231 }
2232
2233 return FALSE;
2234}
2235
2236/*************************************************************************
2237 * SHAddFromPropSheetExtArray [SHELL32.167]
2238 */
2240{
2241 PSXA_CALL Call;
2242 UINT i;
2243 PPSXA psxa = (PPSXA)hpsxa;
2244
2245 TRACE("(%p,%p,%08lx)\n", hpsxa, lpfnAddPage, lParam);
2246
2247 if (psxa)
2248 {
2249 ZeroMemory(&Call, sizeof(Call));
2250 Call.lpfnAddReplaceWith = lpfnAddPage;
2251 Call.lParam = lParam;
2252 Call.bMultiple = TRUE;
2253
2254 /* Call the AddPage method of all registered IShellPropSheetExt interfaces */
2255 for (i = 0; i != psxa->uiCount; i++)
2256 {
2257 psxa->pspsx[i]->lpVtbl->AddPages(psxa->pspsx[i], PsxaCall, (LPARAM)&Call);
2258 }
2259
2260 return Call.uiCount;
2261 }
2262
2263 return 0;
2264}
2265
2266/*************************************************************************
2267 * SHCreatePropSheetExtArray [SHELL32.168]
2268 */
2270{
2271 return SHCreatePropSheetExtArrayEx(hKey, pszSubKey, max_iface, NULL);
2272}
2273
2274/*************************************************************************
2275 * SHCreatePropSheetExtArrayEx [SHELL32.194]
2276 */
2278{
2279 WCHAR szHandler[64];
2280 DWORD dwHandlerLen;
2281 WCHAR szClsidHandler[39];
2282 DWORD dwClsidSize;
2283 CLSID clsid;
2284 LONG lRet;
2285 DWORD dwIndex;
2286 IShellExtInit *psxi;
2287 IShellPropSheetExt *pspsx;
2288 HKEY hkBase, hkPropSheetHandlers;
2289 PPSXA psxa = NULL;
2290
2291 TRACE("(%p,%s,%u)\n", hKey, debugstr_w(pszSubKey), max_iface);
2292
2293 if (max_iface == 0)
2294 return NULL;
2295
2296 /* Open the registry key */
2297 lRet = RegOpenKeyW(hKey, pszSubKey, &hkBase);
2298 if (lRet != ERROR_SUCCESS)
2299 return NULL;
2300
2301 lRet = RegOpenKeyExW(hkBase, L"shellex\\PropertySheetHandlers", 0, KEY_ENUMERATE_SUB_KEYS, &hkPropSheetHandlers);
2302 RegCloseKey(hkBase);
2303 if (lRet == ERROR_SUCCESS)
2304 {
2305 /* Create and initialize the Property Sheet Extensions Array */
2306 psxa = LocalAlloc(LMEM_FIXED, FIELD_OFFSET(PSXA, pspsx[max_iface]));
2307 if (psxa)
2308 {
2309 ZeroMemory(psxa, FIELD_OFFSET(PSXA, pspsx[max_iface]));
2310 psxa->uiAllocated = max_iface;
2311
2312 /* Enumerate all subkeys and attempt to load the shell extensions */
2313 dwIndex = 0;
2314 do
2315 {
2316 dwHandlerLen = sizeof(szHandler) / sizeof(szHandler[0]);
2317 lRet = RegEnumKeyExW(hkPropSheetHandlers, dwIndex++, szHandler, &dwHandlerLen, NULL, NULL, NULL, NULL);
2318 if (lRet != ERROR_SUCCESS)
2319 {
2320 if (lRet == ERROR_MORE_DATA)
2321 continue;
2322
2323 if (lRet == ERROR_NO_MORE_ITEMS)
2324 lRet = ERROR_SUCCESS;
2325 break;
2326 }
2327
2328 /* The CLSID is stored either in the key itself or in its default value. */
2329 if (FAILED(lRet = SHCLSIDFromStringW(szHandler, &clsid)))
2330 {
2331 dwClsidSize = sizeof(szClsidHandler);
2332 if (SHGetValueW(hkPropSheetHandlers, szHandler, NULL, NULL, szClsidHandler, &dwClsidSize) == ERROR_SUCCESS)
2333 {
2334 /* Force a NULL-termination and convert the string */
2335 szClsidHandler[(sizeof(szClsidHandler) / sizeof(szClsidHandler[0])) - 1] = 0;
2336 lRet = SHCLSIDFromStringW(szClsidHandler, &clsid);
2337 }
2338 }
2339
2340 if (SUCCEEDED(lRet))
2341 {
2342 /* Attempt to get an IShellPropSheetExt and an IShellExtInit instance.
2343 Only if both interfaces are supported it's a real shell extension.
2344 Then call IShellExtInit's Initialize method. */
2345 if (SUCCEEDED(CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER/* | CLSCTX_NO_CODE_DOWNLOAD */, &IID_IShellPropSheetExt, (LPVOID *)&pspsx)))
2346 {
2347 if (SUCCEEDED(pspsx->lpVtbl->QueryInterface(pspsx, &IID_IShellExtInit, (PVOID *)&psxi)))
2348 {
2349 if (SUCCEEDED(psxi->lpVtbl->Initialize(psxi, NULL, pDataObj, hKey)))
2350 {
2351 /* Add the IShellPropSheetExt instance to the array */
2352 psxa->pspsx[psxa->uiCount++] = pspsx;
2353 }
2354 else
2355 {
2356 psxi->lpVtbl->Release(psxi);
2357 pspsx->lpVtbl->Release(pspsx);
2358 }
2359 }
2360 else
2361 pspsx->lpVtbl->Release(pspsx);
2362 }
2363 }
2364
2365 } while (psxa->uiCount != psxa->uiAllocated);
2366 }
2367 else
2369
2370 RegCloseKey(hkPropSheetHandlers);
2371 }
2372
2373 if (lRet != ERROR_SUCCESS && psxa)
2374 {
2375 SHDestroyPropSheetExtArray((HPSXA)psxa);
2376 psxa = NULL;
2377 }
2378
2379 return (HPSXA)psxa;
2380}
2381
2382/*************************************************************************
2383 * SHReplaceFromPropSheetExtArray [SHELL32.170]
2384 */
2386{
2387 PSXA_CALL Call;
2388 UINT i;
2389 PPSXA psxa = (PPSXA)hpsxa;
2390
2391 TRACE("(%p,%u,%p,%08lx)\n", hpsxa, uPageID, lpfnReplaceWith, lParam);
2392
2393 if (psxa)
2394 {
2395 ZeroMemory(&Call, sizeof(Call));
2396 Call.lpfnAddReplaceWith = lpfnReplaceWith;
2397 Call.lParam = lParam;
2398
2399 /* Call the ReplacePage method of all registered IShellPropSheetExt interfaces.
2400 Each shell extension is only allowed to call the callback once during the callback. */
2401 for (i = 0; i != psxa->uiCount; i++)
2402 {
2403 Call.bCalled = FALSE;
2404 psxa->pspsx[i]->lpVtbl->ReplacePage(psxa->pspsx[i], uPageID, PsxaCall, (LPARAM)&Call);
2405 }
2406
2407 return Call.uiCount;
2408 }
2409
2410 return 0;
2411}
2412
2413/*************************************************************************
2414 * SHDestroyPropSheetExtArray [SHELL32.169]
2415 */
2417{
2418 UINT i;
2419 PPSXA psxa = (PPSXA)hpsxa;
2420
2421 TRACE("(%p)\n", hpsxa);
2422
2423 if (psxa)
2424 {
2425 for (i = 0; i != psxa->uiCount; i++)
2426 {
2427 psxa->pspsx[i]->lpVtbl->Release(psxa->pspsx[i]);
2428 }
2429
2430 LocalFree(psxa);
2431 }
2432}
2433
2434/*************************************************************************
2435 * CIDLData_CreateFromIDArray [SHELL32.83]
2436 *
2437 * Create IDataObject from PIDLs??
2438 */
2440 PCIDLIST_ABSOLUTE pidlFolder,
2441 UINT cpidlFiles,
2442 PCUIDLIST_RELATIVE_ARRAY lppidlFiles,
2443 LPDATAOBJECT *ppdataObject)
2444{
2445 UINT i;
2446 HWND hwnd = 0; /*FIXME: who should be hwnd of owner? set to desktop */
2447 HRESULT hResult;
2448
2449 TRACE("(%p, %d, %p, %p)\n", pidlFolder, cpidlFiles, lppidlFiles, ppdataObject);
2450 if (TRACE_ON(pidl))
2451 {
2452 pdump (pidlFolder);
2453 for (i=0; i<cpidlFiles; i++) pdump (lppidlFiles[i]);
2454 }
2455 hResult = IDataObject_Constructor(hwnd, pidlFolder, lppidlFiles, cpidlFiles, FALSE, ppdataObject);
2456 return hResult;
2457}
2458
2459/*************************************************************************
2460 * SHCreateStdEnumFmtEtc [SHELL32.74]
2461 *
2462 * NOTES
2463 *
2464 */
2466 UINT cFormats,
2467 const FORMATETC *lpFormats,
2468 LPENUMFORMATETC *ppenumFormatetc)
2469{
2470 IEnumFORMATETC *pef;
2471 HRESULT hRes;
2472 TRACE("cf=%d fe=%p pef=%p\n", cFormats, lpFormats, ppenumFormatetc);
2473
2474 hRes = IEnumFORMATETC_Constructor(cFormats, lpFormats, &pef);
2475 if (FAILED(hRes))
2476 return hRes;
2477
2478 IEnumFORMATETC_AddRef(pef);
2479 hRes = IEnumFORMATETC_QueryInterface(pef, &IID_IEnumFORMATETC, (LPVOID*)ppenumFormatetc);
2480 IEnumFORMATETC_Release(pef);
2481
2482 return hRes;
2483}
2484
2485/*************************************************************************
2486 * SHFindFiles (SHELL32.90)
2487 */
2489{
2490 FIXME("params ignored: %p %p\n", pidlFolder, pidlSaveFile);
2492 {
2493 return FALSE;
2494 }
2495 /* Open the search results folder */
2496 /* FIXME: CSearchBar should be opened as well */
2497 return ShellExecuteW(NULL, NULL, L"explorer.exe", L"::{E17D4FC0-5564-11D1-83F2-00A0C90DC849}", NULL, SW_SHOWNORMAL) > (HINSTANCE)32;
2498}
2499
2500/*************************************************************************
2501 * SHUpdateImageW (SHELL32.192)
2502 *
2503 * Notifies the shell that an icon in the system image list has been changed.
2504 *
2505 * PARAMS
2506 * pszHashItem [I] Path to file that contains the icon.
2507 * iIndex [I] Zero-based index of the icon in the file.
2508 * uFlags [I] Flags determining the icon attributes. See notes.
2509 * iImageIndex [I] Index of the icon in the system image list.
2510 *
2511 * RETURNS
2512 * Nothing
2513 *
2514 * NOTES
2515 * uFlags can be one or more of the following flags:
2516 * GIL_NOTFILENAME - pszHashItem is not a file name.
2517 * GIL_SIMULATEDOC - Create a document icon using the specified icon.
2518#ifdef __REACTOS__
2519 * https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shupdateimagew
2520#endif
2521 */
2522void WINAPI SHUpdateImageW(LPCWSTR pszHashItem, int iIndex, UINT uFlags, int iImageIndex)
2523{
2524#ifdef __REACTOS__
2525 // If iImageIndex == -1 (undetermined), it will fall back to the default value of 1.
2526 INT iEffectiveImageIndex = (iImageIndex == -1) ? 1 : iImageIndex;
2527
2529 item1.cbSize = sizeof(item1);
2530 item1.iIndex = iIndex;
2531 item1.iEffective = iEffectiveImageIndex;
2532 item1.uFlags = uFlags;
2533 item1.iEffective2 = iEffectiveImageIndex;
2534 item1.terminator = 0;
2535
2537
2538 LPWSTR pEnd = StrCpyNXW(item2.szHashItem, pszHashItem, _countof(item2.szHashItem));
2539 *pEnd = UNICODE_NULL;
2540
2541 item2.cbOffset = (WORD)((PBYTE)pEnd - (PBYTE)&item2);
2542 item2.iIndex = iIndex;
2543 item2.iEffectiveImageIndex = iEffectiveImageIndex;
2544 item2.uFlags = uFlags;
2545 item2.dwProcessId = GetCurrentProcessId();
2546 item2.terminator = 0;
2547
2549#else
2550 FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_w(pszHashItem), iIndex, uFlags, iImageIndex);
2551#endif
2552}
2553
2554/*************************************************************************
2555 * SHUpdateImageA (SHELL32.191)
2556 *
2557 * See SHUpdateImageW.
2558#ifdef __REACTOS__
2559 * https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shupdateimagea
2560#endif
2561 */
2562VOID WINAPI SHUpdateImageA(LPCSTR pszHashItem, INT iIndex, UINT uFlags, INT iImageIndex)
2563{
2564#ifdef __REACTOS__
2565 WCHAR szHashItem[MAX_PATH];
2566 SHAnsiToUnicode(pszHashItem, szHashItem, _countof(szHashItem));
2567 SHUpdateImageW(szHashItem, iIndex, uFlags, iImageIndex);
2568#else
2569 FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_a(pszHashItem), iIndex, uFlags, iImageIndex);
2570#endif
2571}
2572
2573#ifdef __REACTOS__
2579#endif
2581{
2582#ifdef __REACTOS__
2583 if (!pidlExtra)
2584 return -1;
2585
2587 (UNALIGNED const SHCNF_UPDATEIMAGE_DATA_2*)pidlExtra;
2588 if (pData->dwProcessId == GetCurrentProcessId())
2589 return pData->iEffectiveImageIndex;
2590
2591 WCHAR szHashItem[MAX_PATH];
2592 StrCpyNW(szHashItem, pData->szHashItem, _countof(szHashItem));
2593
2594 return SHLookupIconIndexW(szHashItem, pData->iIndex, pData->uFlags);
2595#else
2596 FIXME("%p - stub\n", pidlExtra);
2597
2598 return -1;
2599#endif
2600}
2601
2603{
2604 LPITEMIDLIST pidl = NULL;
2605 switch (dwType)
2606 {
2607 case SHOP_FILEPATH:
2608 pidl = ILCreateFromPathW(szObject);
2609 break;
2610 }
2611 if (pidl)
2612 {
2613 SHELLEXECUTEINFOW sei = { sizeof(sei), SEE_MASK_INVOKEIDLIST, hwnd, L"properties",
2614 NULL, szPage, NULL, SW_SHOWNORMAL, NULL, pidl };
2615 BOOL result = ShellExecuteExW(&sei);
2616 ILFree(pidl);
2617 return result;
2618 }
2619
2620 FIXME("%p, 0x%08x, %s, %s - stub\n", hwnd, dwType, debugstr_w(szObject), debugstr_w(szPage));
2621
2622 return TRUE;
2623}
2624
2626 UINT uFlags)
2627{
2628 WCHAR wszLinkTo[MAX_PATH];
2629 WCHAR wszDir[MAX_PATH];
2630 WCHAR wszName[MAX_PATH];
2631 BOOL res;
2632
2633 MultiByteToWideChar(CP_ACP, 0, pszLinkTo, -1, wszLinkTo, MAX_PATH);
2634 MultiByteToWideChar(CP_ACP, 0, pszDir, -1, wszDir, MAX_PATH);
2635
2636 res = SHGetNewLinkInfoW(wszLinkTo, wszDir, wszName, pfMustCopy, uFlags);
2637
2638 if (res)
2639 WideCharToMultiByte(CP_ACP, 0, wszName, -1, pszName, MAX_PATH, NULL, NULL);
2640
2641 return res;
2642}
2643
2645 UINT uFlags)
2646{
2647 const WCHAR *basename;
2648 WCHAR *dst_basename;
2649 int i=2;
2650
2651 TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_w(pszLinkTo), debugstr_w(pszDir),
2652 pszName, pfMustCopy, uFlags);
2653
2654 *pfMustCopy = FALSE;
2655
2656 if (uFlags & SHGNLI_PIDL)
2657 {
2658 FIXME("SHGNLI_PIDL flag unsupported\n");
2659 return FALSE;
2660 }
2661
2662 if (uFlags)
2663 FIXME("ignoring flags: 0x%08x\n", uFlags);
2664
2665 /* FIXME: should test if the file is a shortcut or DOS program */
2667 return FALSE;
2668
2669 basename = strrchrW(pszLinkTo, '\\');
2670 if (basename)
2671 basename = basename+1;
2672 else
2673 basename = pszLinkTo;
2674
2675 lstrcpynW(pszName, pszDir, MAX_PATH);
2676 if (!PathAddBackslashW(pszName))
2677 return FALSE;
2678
2679 dst_basename = pszName + strlenW(pszName);
2680
2681 snprintfW(dst_basename, pszName + MAX_PATH - dst_basename, L"%s.lnk", basename);
2682
2684 {
2685 snprintfW(dst_basename, pszName + MAX_PATH - dst_basename, L"%s (%d).lnk", basename, i);
2686 i++;
2687 }
2688
2689 return TRUE;
2690}
2691
2693{
2694#ifdef __REACTOS__
2695 if (SHELL_OsIsUnicode())
2696 return SHStartNetConnectionDialogW(hwnd, (LPCWSTR)pszRemoteName, dwType);
2697 return SHStartNetConnectionDialogA(hwnd, pszRemoteName, dwType);
2698#else
2699 FIXME("%p, %s, 0x%08x - stub\n", hwnd, debugstr_a(pszRemoteName), dwType);
2700
2701 return S_OK;
2702#endif
2703}
2704
2705#ifndef __REACTOS__ /* See ../utils.cpp */
2706/*************************************************************************
2707 * SHSetLocalizedName (SHELL32.@)
2708 */
2709HRESULT WINAPI SHSetLocalizedName(LPCWSTR pszPath, LPCWSTR pszResModule, int idsRes)
2710{
2711 FIXME("%p, %s, %d - stub\n", pszPath, debugstr_w(pszResModule), idsRes);
2712
2713 return S_OK;
2714}
2715#endif
2716
2717#ifndef __REACTOS__ // See ../utils.cpp
2718/*************************************************************************
2719 * LinkWindow_RegisterClass (SHELL32.258)
2720 */
2722{
2723 FIXME("()\n");
2724 return TRUE;
2725}
2726
2727/*************************************************************************
2728 * LinkWindow_UnregisterClass (SHELL32.259)
2729 */
2731{
2732 FIXME("()\n");
2733 return TRUE;
2734}
2735#endif
2736
2737/*************************************************************************
2738 * SHFlushSFCache (SHELL32.526)
2739 *
2740 * Notifies the shell that a user-specified special folder location has changed.
2741 *
2742 * NOTES
2743 * In Wine, the shell folder registry values are not cached, so this function
2744 * has no effect.
2745 */
2747{
2748}
2749
2750/*************************************************************************
2751 * SHGetImageList (SHELL32.727)
2752 *
2753 * Returns a copy of a shell image list.
2754 *
2755 * NOTES
2756 * Windows XP features 4 sizes of image list, and Vista 5. Wine currently
2757 * only supports the traditional small and large image lists, so requests
2758 * for the others will currently fail.
2759 */
2760HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
2761{
2762 HIMAGELIST hLarge, hSmall;
2763 HIMAGELIST hNew;
2764 HRESULT ret = E_FAIL;
2765
2766 /* Wine currently only maintains large and small image lists */
2767 if ((iImageList != SHIL_LARGE) && (iImageList != SHIL_SMALL) && (iImageList != SHIL_SYSSMALL))
2768 {
2769 FIXME("Unsupported image list %i requested\n", iImageList);
2770 return E_FAIL;
2771 }
2772
2773 Shell_GetImageLists(&hLarge, &hSmall);
2774#ifndef __REACTOS__
2775 hNew = ImageList_Duplicate(iImageList == SHIL_LARGE ? hLarge : hSmall);
2776
2777 /* Get the interface for the new image list */
2778 if (hNew)
2779 {
2781 ImageList_Destroy(hNew);
2782 }
2783#else
2784 /* Duplicating the imagelist causes the start menu items not to draw on
2785 * the first show. Was the Duplicate necessary for some reason? I believe
2786 * Windows returns the raw pointer here. */
2787 hNew = (iImageList == SHIL_LARGE ? hLarge : hSmall);
2788 ret = IImageList2_QueryInterface((IImageList2 *) hNew, riid, ppv);
2789#endif
2790
2791 return ret;
2792}
2793
2794#ifndef __REACTOS__
2795
2796/*************************************************************************
2797 * SHCreateShellFolderView [SHELL32.256]
2798 *
2799 * Create a new instance of the default Shell folder view object.
2800 *
2801 * RETURNS
2802 * Success: S_OK
2803 * Failure: error value
2804 *
2805 * NOTES
2806 * see IShellFolder::CreateViewObject
2807 */
2809 IShellView **ppsv)
2810{
2811 IShellView * psf;
2812 HRESULT hRes;
2813
2814 *ppsv = NULL;
2815 if (!pcsfv || pcsfv->cbSize != sizeof(*pcsfv))
2816 return E_INVALIDARG;
2817
2818 TRACE("sf=%p outer=%p callback=%p\n",
2819 pcsfv->pshf, pcsfv->psvOuter, pcsfv->psfvcb);
2820
2821 hRes = IShellView_Constructor(pcsfv->pshf, &psf);
2822 if (FAILED(hRes))
2823 return hRes;
2824
2825 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppsv);
2826 IShellView_Release(psf);
2827
2828 return hRes;
2829}
2830#endif
2831
2832
2833/*************************************************************************
2834 * SHTestTokenMembership [SHELL32.245]
2835 *
2836 * Checks whether a given token is a mamber of a local group with the
2837 * specified RID.
2838 *
2839 */
2841WINAPI
2843{
2845 DWORD nSubAuthority0, nSubAuthority1;
2846 DWORD nSubAuthorityCount;
2847 PSID SidToCheck;
2848 BOOL IsMember = FALSE;
2849
2850 if ((ulRID == SECURITY_SERVICE_RID) || ulRID == SECURITY_LOCAL_SYSTEM_RID)
2851 {
2852 nSubAuthority0 = ulRID;
2853 nSubAuthority1 = 0;
2854 nSubAuthorityCount= 1;
2855 }
2856 else
2857 {
2858 nSubAuthority0 = SECURITY_BUILTIN_DOMAIN_RID;
2859 nSubAuthority1 = ulRID;
2860 nSubAuthorityCount= 2;
2861 }
2862
2863 if (!AllocateAndInitializeSid(&ntAuth,
2864 nSubAuthorityCount,
2865 nSubAuthority0,
2866 nSubAuthority1,
2867 0, 0, 0, 0, 0, 0,
2868 &SidToCheck))
2869 {
2870 return FALSE;
2871 }
2872
2873 if (!CheckTokenMembership(TokenHandle, SidToCheck, &IsMember))
2874 {
2875 IsMember = FALSE;
2876 }
2877
2878 FreeSid(SidToCheck);
2879 return IsMember;
2880}
2881
2882/*************************************************************************
2883 * IsUserAnAdmin [SHELL32.680] NT 4.0
2884 *
2885 * Checks whether the current user is a member of the Administrators group.
2886 *
2887 * PARAMS
2888 * None
2889 *
2890 * RETURNS
2891 * Success: TRUE
2892 * Failure: FALSE
2893 */
2895{
2897}
2898
2899/*************************************************************************
2900 * SHLimitInputEdit(SHELL32.@)
2901 */
2902
2903/* TODO: Show baloon popup window with TTS_BALLOON */
2904
2905typedef struct UxSubclassInfo
2906{
2912
2913static void
2915{
2916 if (!pInfo)
2917 return;
2918
2919 RemovePropW(pInfo->hwnd, L"UxSubclassInfo");
2920
2923
2925
2926 HeapFree(GetProcessHeap(), 0, pInfo);
2927}
2928
2929static BOOL
2930DoSanitizeText(LPWSTR pszSanitized, LPCWSTR pszInvalidChars, LPCWSTR pszValidChars)
2931{
2932 LPWSTR pch1, pch2;
2933 BOOL bFound = FALSE;
2934
2935 for (pch1 = pch2 = pszSanitized; *pch1; ++pch1)
2936 {
2937 if (pszInvalidChars)
2938 {
2939 if (wcschr(pszInvalidChars, *pch1) != NULL)
2940 {
2941 bFound = TRUE;
2942 continue;
2943 }
2944 }
2945 else if (pszValidChars)
2946 {
2947 if (wcschr(pszValidChars, *pch1) == NULL)
2948 {
2949 bFound = TRUE;
2950 continue;
2951 }
2952 }
2953
2954 *pch2 = *pch1;
2955 ++pch2;
2956 }
2957 *pch2 = 0;
2958
2959 return bFound;
2960}
2961
2962static void
2964{
2965 HGLOBAL hData;
2966 LPWSTR pszText, pszSanitized;
2967 DWORD cbData;
2968
2970 return;
2971 if (!OpenClipboard(hwnd))
2972 return;
2973
2975 pszText = GlobalLock(hData);
2976 if (!pszText)
2977 {
2979 return;
2980 }
2981 SHStrDupW(pszText, &pszSanitized);
2982 GlobalUnlock(hData);
2983
2984 if (pszSanitized &&
2985 DoSanitizeText(pszSanitized, pInfo->pwszInvalidChars, pInfo->pwszValidChars))
2986 {
2987 MessageBeep(0xFFFFFFFF);
2988
2989 /* Update clipboard text */
2990 cbData = (lstrlenW(pszSanitized) + 1) * sizeof(WCHAR);
2992 pszText = GlobalLock(hData);
2993 if (pszText)
2994 {
2995 CopyMemory(pszText, pszSanitized, cbData);
2996 GlobalUnlock(hData);
2997
2999 }
3000 }
3001
3002 CoTaskMemFree(pszSanitized);
3004}
3005
3006static LRESULT CALLBACK
3008{
3009 WNDPROC fnWndProc;
3010 WCHAR wch;
3011 UxSubclassInfo *pInfo = GetPropW(hwnd, L"UxSubclassInfo");
3012 if (!pInfo)
3013 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
3014
3015 fnWndProc = pInfo->fnWndProc;
3016
3017 switch (uMsg)
3018 {
3019 case WM_KEYDOWN:
3020 if (GetKeyState(VK_SHIFT) < 0 && wParam == VK_INSERT)
3021 DoSanitizeClipboard(hwnd, pInfo);
3022 else if (GetKeyState(VK_CONTROL) < 0 && wParam == L'V')
3023 DoSanitizeClipboard(hwnd, pInfo);
3024
3025 return CallWindowProcW(fnWndProc, hwnd, uMsg, wParam, lParam);
3026
3027 case WM_PASTE:
3028 DoSanitizeClipboard(hwnd, pInfo);
3029 return CallWindowProcW(fnWndProc, hwnd, uMsg, wParam, lParam);
3030
3031 case WM_CHAR:
3032 if (GetKeyState(VK_CONTROL) < 0 && wParam == L'V')
3033 break;
3034
3035 if (pInfo->pwszInvalidChars)
3036 {
3037 if (wcschr(pInfo->pwszInvalidChars, (WCHAR)wParam) != NULL)
3038 {
3039 MessageBeep(0xFFFFFFFF);
3040 break;
3041 }
3042 }
3043 else if (pInfo->pwszValidChars)
3044 {
3045 if (wcschr(pInfo->pwszValidChars, (WCHAR)wParam) == NULL)
3046 {
3047 MessageBeep(0xFFFFFFFF);
3048 break;
3049 }
3050 }
3051 return CallWindowProcW(fnWndProc, hwnd, uMsg, wParam, lParam);
3052
3053 case WM_UNICHAR:
3054 if (wParam == UNICODE_NOCHAR)
3055 return TRUE;
3056
3057 /* FALL THROUGH */
3058
3059 case WM_IME_CHAR:
3060 wch = (WCHAR)wParam;
3061 if (GetKeyState(VK_CONTROL) < 0 && wch == L'V')
3062 break;
3063
3064 if (!IsWindowUnicode(hwnd) && HIBYTE(wch) != 0)
3065 {
3066 CHAR data[] = {HIBYTE(wch), LOBYTE(wch)};
3067 MultiByteToWideChar(CP_ACP, 0, data, 2, &wch, 1);
3068 }
3069
3070 if (pInfo->pwszInvalidChars)
3071 {
3072 if (wcschr(pInfo->pwszInvalidChars, wch) != NULL)
3073 {
3074 MessageBeep(0xFFFFFFFF);
3075 break;
3076 }
3077 }
3078 else if (pInfo->pwszValidChars)
3079 {
3080 if (wcschr(pInfo->pwszValidChars, wch) == NULL)
3081 {
3082 MessageBeep(0xFFFFFFFF);
3083 break;
3084 }
3085 }
3086 return CallWindowProcW(fnWndProc, hwnd, uMsg, wParam, lParam);
3087
3088 case WM_NCDESTROY:
3090 return CallWindowProcW(fnWndProc, hwnd, uMsg, wParam, lParam);
3091
3092 default:
3093 return CallWindowProcW(fnWndProc, hwnd, uMsg, wParam, lParam);
3094 }
3095
3096 return 0;
3097}
3098
3099static UxSubclassInfo *
3101{
3102 UxSubclassInfo *pInfo;
3104 if (!pInfo)
3105 {
3106 ERR("HeapAlloc failed.\n");
3108 CoTaskMemFree(invalid);
3109 return NULL;
3110 }
3111
3113 if (!pInfo->fnWndProc)
3114 {
3115 ERR("SetWindowLongPtrW failed\n");
3117 CoTaskMemFree(invalid);
3118 HeapFree(GetProcessHeap(), 0, pInfo);
3119 return NULL;
3120 }
3121
3122 pInfo->hwnd = hwnd;
3123 pInfo->pwszValidChars = valid;
3124 pInfo->pwszInvalidChars = invalid;
3125 if (!SetPropW(hwnd, L"UxSubclassInfo", pInfo))
3126 {
3128 pInfo = NULL;
3129 }
3130 return pInfo;
3131}
3132
3135{
3136 IItemNameLimits *pLimits;
3137 HRESULT hr;
3138 LPWSTR pwszValidChars, pwszInvalidChars;
3139 UxSubclassInfo *pInfo;
3140
3141 pInfo = GetPropW(hWnd, L"UxSubclassInfo");
3142 if (pInfo)
3143 {
3145 pInfo = NULL;
3146 }
3147
3148 hr = psf->lpVtbl->QueryInterface(psf, &IID_IItemNameLimits, (LPVOID *)&pLimits);
3149 if (FAILED(hr))
3150 {
3151 ERR("hr: %x\n", hr);
3152 return hr;
3153 }
3154
3155 pwszValidChars = pwszInvalidChars = NULL;
3156 hr = pLimits->lpVtbl->GetValidCharacters(pLimits, &pwszValidChars, &pwszInvalidChars);
3157 if (FAILED(hr))
3158 {
3159 ERR("hr: %x\n", hr);
3160 pLimits->lpVtbl->Release(pLimits);
3161 return hr;
3162 }
3163
3164 pInfo = UxSubclassInfo_Create(hWnd, pwszValidChars, pwszInvalidChars);
3165 if (!pInfo)
3166 hr = E_FAIL;
3167
3168 pLimits->lpVtbl->Release(pLimits);
3169
3170 return hr;
3171}
3172
3173#ifdef __REACTOS__
3174/*************************************************************************
3175 * SHLimitInputCombo [SHELL32.748]
3176 *
3177 * Sets limits on valid characters for a combobox control.
3178 * This function works like SHLimitInputEdit, but the target is a combobox
3179 * instead of a textbox.
3180 */
3183{
3184 HWND hwndEdit;
3185
3186 TRACE("%p %p\n", hWnd, psf);
3187
3189 if (!hwndEdit)
3190 return E_FAIL;
3191
3192 return SHLimitInputEdit(hwndEdit, psf);
3193}
3194#endif
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject)
HRESULT IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[], IEnumFORMATETC **ppFormat)
UINT DriveType
#define shell32_hInstance
#define read
Definition: acwin.h:97
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:78
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define CF_UNICODETEXT
Definition: constants.h:408
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define EXTERN_C
Definition: basetyps.h:12
#define RegCloseKey(hKey)
Definition: registry.h:49
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
HINSTANCE hInstance
Definition: charmap.c:19
Definition: bufpool.h:45
WPARAM wParam
Definition: combotst.c:138
HWND hwndEdit
Definition: combotst.c:65
LPARAM lParam
Definition: combotst.c:139
INT(CALLBACK * MRUCMPPROCW)(LPCWSTR, LPCWSTR)
#define MRU_BINARY
HANDLE WINAPI CreateMRUListW(const MRUINFOW *infoW)
#define MRU_CACHEWRITE
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
static HWND hwndParent
Definition: cryptui.c:299
static TAGID TAGID find
Definition: db.cpp:156
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:322
HRESULT hr
Definition: delayimp.cpp:582
#define ERROR_SUCCESS
Definition: deptool.c:10
static LPVOID LPUNKNOWN
Definition: dinput.c:53
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR szDescription[]
Definition: provider.c:55
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1034
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
BOOL WINAPI CheckTokenMembership(IN HANDLE ExistingTokenHandle, IN PSID SidToCheck, OUT PBOOL IsMember)
Definition: token.c:21
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
Definition: security.c:674
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:698
UINT uFlags
Definition: api.c:59
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: combase.c:1936
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
HRESULT WINAPI HIMAGELIST_QueryInterface(HIMAGELIST himl, REFIID riid, void **ppv)
Definition: imagelist.c:4132
HIMAGELIST WINAPI ImageList_Duplicate(HIMAGELIST himlSrc)
Definition: imagelist.c:1819
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define lstrcpynA
Definition: compat.h:751
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define GENERIC_READ
Definition: compat.h:135
#define TRACE_ON(x)
Definition: compat.h:75
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CreateFileW
Definition: compat.h:741
#define WINE_DECLARE_DEBUG_CHANNEL(x)
Definition: compat.h:45
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define LoadLibraryW(x)
Definition: compat.h:747
#define FILE_SHARE_READ
Definition: compat.h:136
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
static const WCHAR *const ext[]
Definition: module.c:53
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:372
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:751
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:620
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:1999
DWORD WINAPI GetLongPathNameW(IN LPCWSTR lpszShortPath, OUT LPWSTR lpszLongPath, IN DWORD cchBuffer)
Definition: path.c:1456
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
DWORD WINAPI FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:483
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4133
#define IS_INTRESOURCE(x)
Definition: loader.c:613
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1677
void WINAPI PathStripPathA(char *path)
Definition: path.c:2292
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
Definition: path.c:1250
BOOL WINAPI PathFileExistsW(const WCHAR *path)
Definition: path.c:2583
WCHAR *WINAPI StrCatBuffW(WCHAR *str, const WCHAR *cat, INT max_len)
Definition: string.c:1434
WCHAR *WINAPI StrCpyNXW(WCHAR *dst, const WCHAR *src, int len)
Definition: string.c:1072
INT WINAPI DECLSPEC_HOTPATCH LoadStringA(HINSTANCE instance, UINT resource_id, LPSTR buffer, INT buflen)
Definition: string.c:1307
WCHAR *WINAPI StrCpyNW(WCHAR *dst, const WCHAR *src, int count)
Definition: string.c:470
GUID guid
Definition: version.c:147
static void basename(LPCWSTR path, LPWSTR name)
Definition: profile.c:38
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
HRESULT WINAPI OleFlushClipboard(void)
Definition: clipboard.c:2290
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:547
HRESULT WINAPI DoDragDrop(IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
Definition: ole2.c:737
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:629
HRESULT WINAPI SHStrDupW(const WCHAR *src, WCHAR **dest)
Definition: main.c:1692
DWORD WINAPI SHGetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2222
DWORD WINAPI SHQueryValueExA(HKEY hkey, const char *name, DWORD *reserved, DWORD *type, void *buff, DWORD *buff_len)
Definition: main.c:2149
DWORD WINAPI SHAnsiToUnicode(const char *src, WCHAR *dest, int dest_len)
Definition: main.c:1801
DWORD WINAPI SHSetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD type, const void *data, DWORD data_len)
Definition: main.c:2292
DWORD WINAPI SHDeleteKeyW(HKEY hkey, const WCHAR *subkey)
Definition: main.c:1886
#define ShellMessageBoxW
Definition: precomp.h:63
EXTERN_C BOOL WINAPI SHELL32_RunControlPanel(_In_ PCWSTR commandLine, _In_opt_ HWND parent)
EXTERN_C HRESULT WINAPI SHStartNetConnectionDialogW(_In_ HWND hwnd, _In_ LPCWSTR pszRemoteName, _In_ DWORD dwType)
Definition: stubs.cpp:457
EXTERN_C INT WINAPI SHLookupIconIndexW(LPCWSTR lpName, INT iIndex, UINT uFlags)
Definition: stubs.cpp:413
EXTERN_C BOOL WINAPI PathIsEqualOrSubFolder(_In_ LPCWSTR pszPath1OrCSIDL, _In_ LPCWSTR pszPath2)
Definition: utils.cpp:1660
EXTERN_C HRESULT WINAPI SHStartNetConnectionDialogA(_In_ HWND hwnd, _In_ LPCSTR pszRemoteName, _In_ DWORD dwType)
Definition: utils.cpp:1551
HRESULT WINAPI SHGetMalloc(LPMALLOC *lpmal)
Definition: shellole.c:329
DWORD WINAPI SHCLSIDFromStringW(LPCWSTR clsid, CLSID *id)
Definition: shellole.c:300
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3385
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3220
DWORD WINAPI SHSendMessageBroadcastW(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ordinal.c:3616
HKEY WINAPI SHGetShellKey(DWORD flags, LPCWSTR sub_key, BOOL create)
Definition: ordinal.c:4049
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:669
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define pt(x, y)
Definition: drawing.c:79
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
r parent
Definition: btrfs.c:3010
#define UlongToPtr(u)
Definition: config.h:106
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
BOOLEAN valid
EXTERN_C BOOL SHELL32_ReadRegShellState(PREGSHELLSTATE prss)
Definition: general.cpp:79
EXTERN_C void SHELL32_GetDefaultShellState(LPSHELLSTATE pss)
Definition: general.cpp:34
EXTERN_C LSTATUS SHELL32_WriteRegShellState(PREGSHELLSTATE prss)
Definition: general.cpp:52
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizei samples
Definition: glext.h:7006
GLuint res
Definition: glext.h:9613
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLenum GLenum dst
Definition: glext.h:6340
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint GLfloat * val
Definition: glext.h:7180
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
unsigned int UINT
Definition: sysinfo.c:13
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define ss
Definition: i386-dis.c:441
#define cs
Definition: i386-dis.c:442
BOOL SIC_Initialize(void)
Definition: iconcache.cpp:515
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:689
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT GetValidCharacters([out, string] LPWSTR *ppwszValidChars, [out, string] LPWSTR *ppwszInvalidChars)
HRESULT ReplacePage([in] EXPPS uPageID, [in] LPFNSVADDPROPSHEETPAGE pfnReplaceWith, [in] LPARAM lParam)
HRESULT AddPages([in] LPFNSVADDPROPSHEETPAGE pfnAddPage, [in] LPARAM lParam)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
nsresult QueryInterface(nsIIDRef riid, void **result)
nsrefcnt Release()
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define C_ASSERT(e)
Definition: intsafe.h:73
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1033
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
HWND hList
Definition: livecd.c:10
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define ZeroMemory
Definition: minwinbase.h:31
#define CopyMemory
Definition: minwinbase.h:29
#define LMEM_FIXED
Definition: minwinbase.h:81
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
int * LPINT
Definition: minwindef.h:151
CONST void * LPCVOID
Definition: minwindef.h:164
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
LPCWSTR szPath
Definition: env.c:37
static PVOID ptr
Definition: dispmode.c:27
static char szTempPath[MAX_PATH]
Definition: data.c:16
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1204
HRESULT hres
Definition: protocol.c:465
static HMODULE hmodule
Definition: rasapi.c:29
@ SHKEY_Key_Explorer
Definition: ordinal.c:2807
@ SHKEY_Root_HKCU
Definition: ordinal.c:2805
static const struct metadata_item item1[]
Definition: metadata.c:3603
static const struct metadata_item item2[]
Definition: metadata.c:3608
static BYTE parameters[]
Definition: asn.c:558
const CLSID * clsid
Definition: msctf.cpp:50
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
_In_ HANDLE hFile
Definition: mswsock.h:90
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
_In_ ACCESS_MASK _In_ ULONG _Out_ PHANDLE TokenHandle
Definition: psfuncs.h:727
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define REG_BINARY
Definition: nt_native.h:1499
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define KEY_READ
Definition: nt_native.h:1026
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1022
#define BOOL
Definition: nt_native.h:43
#define KEY_WRITE
Definition: nt_native.h:1034
#define DWORD
Definition: nt_native.h:44
#define GENERIC_WRITE
Definition: nt_native.h:90
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define FILE_ATTRIBUTE_TEMPORARY
Definition: nt_native.h:708
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:331
#define UNICODE_NULL
static HANDLE ULONG_PTR dwData
Definition: pipe.c:111
interface IEnumFORMATETC * LPENUMFORMATETC
Definition: objfwd.h:24
interface IDataObject * LPDATAOBJECT
Definition: objfwd.h:21
const GUID IID_IEnumFORMATETC
const GUID IID_IPersistFile
#define PathAppendA
Definition: pathcch.h:309
#define PathAddBackslashW
Definition: pathcch.h:302
#define PathAppendW
Definition: pathcch.h:310
#define UNALIGNED
Definition: pecoff.h:347
#define LOWORD(l)
Definition: pedump.c:82
#define ES_READONLY
Definition: pedump.c:675
BYTE * PBYTE
Definition: pedump.c:66
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1051
BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath)
Definition: pidl.c:1434
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1496
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:1108
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
Definition: prsht.h:327
#define REFIID
Definition: guiddef.h:118
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
_In_opt_ LPCSTR pszSubKey
Definition: shlwapi.h:783
#define err(...)
#define WM_UNICHAR
Definition: richedit.h:67
const WCHAR * str
#define REG_DWORD
Definition: sdbapi.c:615
wcscat
#define LoadStringW
Definition: utils.h:64
#define memset(x, y, z)
Definition: compat.h:39
#define args
Definition: format.c:66
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:196
#define SHIL_SYSSMALL
Definition: shellapi.h:187
#define SHIL_SMALL
Definition: shellapi.h:185
_In_ LPCSTR pszDir
Definition: shellapi.h:609
#define SHIL_LARGE
Definition: shellapi.h:184
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
_In_ LPCSTR _Out_ BOOL * pfMustCopy
Definition: shellapi.h:611
#define SHGNLI_PIDL
Definition: shellapi.h:416
BOOL WINAPI SignalFileOpen(PCIDLIST_ABSOLUTE pidl)
Definition: shellord.c:832
struct _PSXA_CALL * PPSXA_CALL
HRESULT WINAPI SHLoadOLE(LPARAM lParam)
Definition: shellord.c:1941
static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData)
Definition: shellord.c:895
DWORD WINAPI DoEnvironmentSubstAW(LPVOID x, UINT y)
Definition: shellord.c:2106
static BOOL DoSanitizeText(LPWSTR pszSanitized, LPCWSTR pszInvalidChars, LPCWSTR pszValidChars)
Definition: shellord.c:2930
HRESULT WINAPI SHRegisterDragDrop(HWND hWnd, LPDROPTARGET pDropTarget)
Definition: shellord.c:746
WORD WINAPI ArrangeWindows(HWND hwndParent, DWORD dwReserved, const RECT *lpRect, WORD cKids, const HWND *lpKids)
Definition: shellord.c:816
DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT cchString)
Definition: shellord.c:2076
HRESULT WINAPI SHAbortInvokeCommand(void)
Definition: shellord.c:1968
BOOL WINAPI DAD_AutoScroll(HWND hwnd, AUTO_SCROLL_DATA *samples, const POINT *pt)
Definition: shellord.c:1757
void WINAPI SHUpdateImageW(LPCWSTR pszHashItem, int iIndex, UINT uFlags, int iImageIndex)
Definition: shellord.c:2522
void WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv)
Definition: shellord.c:1018
HRESULT WINAPI SHStartNetConnectionDialog(HWND hwnd, LPCSTR pszRemoteName, DWORD dwType)
Definition: shellord.c:2692
int WINAPI InvalidateDriveType(int u)
Definition: shellord.c:1959
VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask)
Definition: shellord.c:416
BOOL WINAPI RegisterShellHook(HWND hWnd, DWORD dwType)
Definition: shellord.c:517
BOOL WINAPI SHObjectProperties(HWND hwnd, DWORD dwType, LPCWSTR szObject, LPCWSTR szPage)
Definition: shellord.c:2602
#define MRUF_BINARY_LIST
Definition: shellord.c:66
void WINAPI SHFreeUnusedLibraries(void)
Definition: shellord.c:1748
static BOOL CALLBACK PsxaCall(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: shellord.c:2218
struct _PSXA PSXA
BOOL WINAPI DAD_DragEnter(HWND hwnd)
Definition: shellord.c:1766
#define MRUF_DELAYED_SAVE
Definition: shellord.c:67
INT WINAPI SHHandleUpdateImage(PCIDLIST_ABSOLUTE pidlExtra)
Definition: shellord.c:2580
void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
Definition: shellord.c:2416
HRESULT WINAPI SHCreateStdEnumFmtEtc(UINT cFormats, const FORMATETC *lpFormats, LPENUMFORMATETC *ppenumFormatetc)
Definition: shellord.c:2465
EXTERN_C BOOL WINAPI SHTestTokenMembership(HANDLE TokenHandle, ULONG ulRID)
Definition: shellord.c:2842
BOOL WINAPI DAD_SetDragImage(HIMAGELIST himlTrack, LPPOINT lppt)
Definition: shellord.c:1804
INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum)
struct _PSXA * PPSXA
HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
Definition: shellord.c:2760
static void DoSanitizeClipboard(HWND hwnd, UxSubclassInfo *pInfo)
Definition: shellord.c:2963
HANDLE WINAPI CreateMRUListA(LPCREATEMRULISTA lpcml)
DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len)
Definition: shellord.c:143
void WINAPI SHFlushSFCache(void)
Definition: shellord.c:2746
BOOL WINAPI LinkWindow_RegisterClass(void)
Definition: shellord.c:2721
BOOL WINAPI GUIDFromStringA(LPCSTR str, LPGUID guid)
Definition: shellord.c:2116
BOOL WINAPI PathIsTemporaryW(LPWSTR Str)
Definition: shellord.c:2170
struct tagCREATEMRULIST * LPCREATEMRULISTA
BOOL WINAPI GUIDFromStringW(LPCWSTR str, LPGUID guid)
Definition: shellord.c:2131
BOOL WINAPI LinkWindow_UnregisterClass(DWORD dwUnused)
Definition: shellord.c:2730
VOID WINAPI SHUpdateImageA(LPCSTR pszHashItem, INT iIndex, UINT uFlags, INT iImageIndex)
Definition: shellord.c:2562
HRESULT WINAPI SHWinHelp(HWND hwnd, LPCWSTR pszHelp, UINT uCommand, ULONG_PTR dwData)
Definition: shellord.c:1652
HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, LPDATAOBJECT pDataObj)
Definition: shellord.c:2277
DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len)
Definition: shellord.c:117
static LRESULT CALLBACK LimitEditWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: shellord.c:3007
BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
Definition: shellord.c:1827
BOOL WINAPI FileIconInit(BOOL bFullInit)
Definition: shellord.c:1909
int ShellMessageBoxA(HINSTANCE hInstance, HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType,...)
Definition: shellord.c:633
BOOL WINAPI DAD_ShowDragImage(BOOL bShow)
Definition: shellord.c:1817
BOOL WINAPI DAD_DragEnterEx(HWND hwnd, POINT p)
Definition: shellord.c:1775
DWORD WINAPI RLBuildListOfPaths(void)
Definition: shellord.c:2012
VOID WINAPI FreeMRUList(HANDLE hMRUList)
BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, BOOL *pfMustCopy, UINT uFlags)
Definition: shellord.c:2644
static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPCSTR doc_name, LPCSTR new_lnk_name, LPSTR buffer, INT *len)
Definition: shellord.c:963
DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString)
Definition: shellord.c:2031
VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Definition: shellord.c:225
static INT SHADD_get_policy(LPCSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len)
Definition: shellord.c:854
HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
Definition: shellord.c:1917
HRESULT WINAPI SHRevokeDragDrop(HWND hWnd)
Definition: shellord.c:781
BOOL WINAPI SHRunControlPanel(_In_ LPCWSTR commandLine, _In_opt_ HWND parent)
Definition: shellord.c:1692
HRESULT WINAPI SHLimitInputEdit(HWND hWnd, IShellFolder *psf)
Definition: shellord.c:3134
struct _PSXA_CALL PSXA_CALL
BOOL WINAPI SHValidateUNC(HWND hwndOwner, PWSTR pszFile, UINT fConnect)
Definition: shellord.c:2020
BOOL WINAPI SHWaitForFileToOpen(LPCITEMIDLIST pidl, DWORD dwFlags, DWORD dwTimeout)
Definition: shellord.c:1997
HRESULT WINAPI SHGetInstanceExplorer(IUnknown **lpUnknown)
Definition: shellord.c:1724
static UxSubclassInfo * UxSubclassInfo_Create(HWND hwnd, LPWSTR valid, LPWSTR invalid)
Definition: shellord.c:3100
INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize)
UINT WINAPI SHReplaceFromPropSheetExtArray(HPSXA hpsxa, UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam)
Definition: shellord.c:2385
BOOL WINAPI SHGetNewLinkInfoA(LPCSTR pszLinkTo, LPCSTR pszDir, LPSTR pszName, BOOL *pfMustCopy, UINT uFlags)
Definition: shellord.c:2625
BOOL WINAPI DAD_DragMove(POINT p)
Definition: shellord.c:1784
struct tagCREATEMRULIST CREATEMRULISTA
HRESULT WINAPI SHSetLocalizedName(LPCWSTR pszPath, LPCWSTR pszResModule, int idsRes)
Definition: shellord.c:2709
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: shellord.c:2808
VOID WINAPI SHSetInstanceExplorer(LPUNKNOWN lpUnknown)
Definition: shellord.c:1714
HRESULT WINAPI SHCreateShellFolderViewEx(LPCSFV psvcbi, IShellView **ppv)
Definition: shellord.c:1624
BOOL WINAPI SHFindFiles(PCIDLIST_ABSOLUTE pidlFolder, PCIDLIST_ABSOLUTE pidlSaveFile)
Definition: shellord.c:2488
LRESULT WINAPI SHShellFolderView_Message(HWND hwndCabinet, UINT uMessage, LPARAM lParam)
Definition: shellord.c:496
static void UxSubclassInfo_Destroy(UxSubclassInfo *pInfo)
Definition: shellord.c:2914
BOOL WINAPI GetFileNameFromBrowse(HWND hwndOwner, LPWSTR lpstrFile, UINT nMaxFile, LPCWSTR lpstrInitialDir, LPCWSTR lpstrDefExt, LPCWSTR lpstrFilter, LPCWSTR lpstrTitle)
Definition: shellord.c:154
HRESULT WINAPI CIDLData_CreateFromIDArray(PCIDLIST_ABSOLUTE pidlFolder, UINT cpidlFiles, PCUIDLIST_RELATIVE_ARRAY lppidlFiles, LPDATAOBJECT *ppdataObject)
Definition: shellord.c:2439
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
Definition: shellord.c:2239
int WINAPI SHOutOfMemoryMessageBox(HWND hwndOwner, LPCSTR lpCaption, UINT uType)
Definition: shellord.c:1976
static LPUNKNOWN SHELL32_IExplorerInterface
Definition: shellord.c:1707
INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData)
BOOL WINAPI PathIsTemporaryA(LPSTR Str)
Definition: shellord.c:2147
HPSXA WINAPI SHCreatePropSheetExtArray(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface)
Definition: shellord.c:2269
BOOL WINAPI WriteCabinetState(CABINETSTATE *cs)
Definition: shellord.c:1879
HRESULT WINAPI SHDoDragDrop(HWND hWnd, LPDATAOBJECT lpDataObject, LPDROPSOURCE lpDropSource, DWORD dwOKEffect, LPDWORD pdwEffect)
Definition: shellord.c:800
DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len)
Definition: shellord.c:83
HRESULT WINAPI SHFlushClipboard(void)
Definition: shellord.c:1988
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2778
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2723
static IMalloc * ppM
Definition: shlfolder.c:47
#define CSIDL_INTERNET_CACHE
Definition: shlobj.h:2222
#define SSF_FILTER
Definition: shlobj.h:1636
#define CSIDL_RECENT
Definition: shlobj.h:2199
#define SSF_DONTPRETTYPATH
Definition: shlobj.h:1631
#define SSF_SORTCOLUMNS
Definition: shlobj.h:1625
#define CSIDL_CDBURN_AREA
Definition: shlobj.h:2246
struct SHELLFLAGSTATE * LPSHELLFLAGSTATE
#define SHCNE_UPDATEIMAGE
Definition: shlobj.h:1922
#define SSF_WIN95CLASSIC
Definition: shlobj.h:1630
#define SSF_SHOWATTRIBCOL
Definition: shlobj.h:1628
#define SSF_SHOWSYSFILES
Definition: shlobj.h:1626
BOOL WINAPI IsUserAnAdmin(void)
Definition: shellord.c:2894
#define SHARD_PATHW
Definition: shlobj.h:1192
#define SHARD_PIDL
Definition: shlobj.h:1190
#define SSF_MAPNETDRVBUTTON
Definition: shlobj.h:1632
#define SSF_SHOWEXTENSIONS
Definition: shlobj.h:1622
#define SSF_SHOWSUPERHIDDEN
Definition: shlobj.h:1638
#define SSF_SHOWALLOBJECTS
Definition: shlobj.h:1621
#define SHARD_PATHA
Definition: shlobj.h:1191
@ REST_NORECENTDOCSHISTORY
Definition: shlobj.h:1691
@ REST_NOFIND
Definition: shlobj.h:1667
BOOL WINAPI DAD_DragLeave(void)
Definition: shellord.c:1793
#define SSF_SHOWINFOTIP
Definition: shlobj.h:1633
#define SHCNF_IDLIST
Definition: shlobj.h:1939
#define SSF_HIDEICONS
Definition: shlobj.h:1634
#define SHELL_GlobalCounterIncrement(handle)
Definition: shlwapi_undoc.h:54
#define SHELL_GlobalCounterIsInitialized(handle)
Definition: shlwapi_undoc.h:52
#define SHELL_GCOUNTER_DEFINE_GUID(name, a, b, c, d, e, f, g, h, i, j, k)
Definition: shlwapi_undoc.h:44
#define SHELL_GCOUNTER_PARAMETERS(handle, id)
Definition: shlwapi_undoc.h:46
#define SHELL_GCOUNTER_DECLAREPARAMETERS(handle, id)
Definition: shlwapi_undoc.h:56
#define SHELL_GlobalCounterGet(handle)
Definition: shlwapi_undoc.h:53
#define SHELL_GCOUNTER_DEFINE_HANDLE(name)
Definition: shlwapi_undoc.h:45
#define SHELL_GlobalCounterCreate(refguid, handle)
Definition: shlwapi_undoc.h:47
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
Definition: shpolicy.c:166
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const PCUIDLIST_RELATIVE * PCUIDLIST_RELATIVE_ARRAY
Definition: shtypes.idl:58
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
OPENFILENAME ofn
Definition: sndrec32.cpp:56
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
SHELLSTATE ss
Definition: ShellState.cpp:22
BOOL fMapNetDrvBtn
Definition: shlobj.h:1610
BOOL fShowInfoTip
Definition: shlobj.h:1611
BOOL fHideIcons
Definition: shlobj.h:1612
BOOL fIconsOnly
Definition: shlobj.h:1614
BOOL fShowExtensions
Definition: shlobj.h:1601
BOOL fAutoCheckSelect
Definition: shlobj.h:1613
BOOL fShowSysFiles
Definition: shlobj.h:1603
BOOL fDontPrettyPath
Definition: shlobj.h:1608
BOOL fShowAllObjects
Definition: shlobj.h:1600
BOOL fShowAttribCol
Definition: shlobj.h:1609
BOOL fShowSysFiles
Definition: shlobj.h:1561
BOOL fWin95Classic
Definition: shlobj.h:1565
BOOL fShowSuperHidden
Definition: shlobj.h:1573
BOOL fShowAllObjects
Definition: shlobj.h:1557
LPWSTR pwszValidChars
Definition: shellord.c:2909
LPWSTR pwszInvalidChars
Definition: shellord.c:2910
WNDPROC fnWndProc
Definition: shellord.c:2908
Definition: shlobj.h:1291
FOLDERVIEWMODE fvm
Definition: shlobj.h:1298
IShellView * psvOuter
Definition: shlobj.h:1294
LPFNVIEWCALLBACK pfnCallback
Definition: shlobj.h:1297
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1295
IShellFolder * pshf
Definition: shlobj.h:1293
LPFNADDPROPSHEETPAGE lpfnAddReplaceWith
Definition: shellord.c:2211
LPARAM lParam
Definition: shellord.c:2212
BOOL bCalled
Definition: shellord.c:2213
BOOL bMultiple
Definition: shellord.c:2214
UINT uiCount
Definition: shellord.c:2215
UINT uiCount
Definition: shellord.c:2204
IShellPropSheetExt * pspsx[1]
Definition: shellord.c:2206
UINT uiAllocated
Definition: shellord.c:2205
IShellFolderViewCB * psfvcb
Definition: shlobj.h:1376
IShellView * psvOuter
Definition: shlobj.h:1375
UINT cbSize
Definition: shlobj.h:1373
IShellFolder * pshf
Definition: shlobj.h:1374
Definition: match.c:390
Definition: cookie.c:202
Definition: tftpd.h:126
Definition: tftpd.h:138
LPCSTR lpszSubKey
Definition: shellord.c:60
DWORD nMaxItems
Definition: shellord.c:57
LPWSTR lpszSubKey
LPCSTR lpstrDefExt
Definition: commdlg.h:345
HWND hwndOwner
Definition: commdlg.h:330
LPCSTR lpstrTitle
Definition: commdlg.h:341
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337
#define GWLP_WNDPROC
Definition: treelist.c:66
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
HANDLE HINSTANCE
Definition: typedefs.h:77
uint16_t * PWSTR
Definition: typedefs.h:56
const char * LPCSTR
Definition: typedefs.h:52
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
uint32_t * LPDWORD
Definition: typedefs.h:59
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
#define MAXLONG
Definition: umtypes.h:116
HRESULT WINAPI SHLimitInputCombo(HWND hWnd, IShellFolder *psf)
HWND WINAPI SetTaskmanWindow(HWND)
Definition: window.c:1902
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define SHOP_FILEPATH
Definition: vfdshmenu.cpp:36
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:398
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1155
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:396
#define FindNextFile
Definition: winbase.h:3509
#define GMEM_MOVEABLE
Definition: winbase.h:318
#define GMEM_SHARE
Definition: winbase.h:329
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define __ms_va_list
Definition: windef.h:250
#define __ms_va_end(list)
Definition: windef.h:252
#define __ms_va_start(list, arg)
Definition: windef.h:251
#define WINAPI
Definition: msvc.h:6
#define strlenW(s)
Definition: unicode.h:28
#define strrchrW(s, c)
Definition: unicode.h:35
#define snprintfW
Definition: unicode.h:60
NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING, GUID *)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define SW_SHOWNORMAL
Definition: winuser.h:781
BOOL WINAPI DeregisterShellHookWindow(_In_ HWND)
#define MB_SETFOREGROUND
Definition: winuser.h:825
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define WM_PASTE
Definition: winuser.h:1891
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI RegisterShellHookWindow(_In_ HWND)
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
HWND WINAPI GetTopWindow(_In_opt_ HWND)
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
BOOL WINAPI WinHelpW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_ UINT, _In_ ULONG_PTR)
#define VK_CONTROL
Definition: winuser.h:2239
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
BOOL WINAPI MessageBeep(_In_ UINT uType)
HANDLE WINAPI GetClipboardData(_In_ UINT)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
#define WM_SETTINGCHANGE
Definition: winuser.h:1657
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define WM_IME_CHAR
Definition: winuser.h:1862
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
#define WM_CHAR
Definition: winuser.h:1745
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define WM_NCDESTROY
Definition: winuser.h:1712
#define MB_ICONSTOP
Definition: winuser.h:814
#define VK_SHIFT
Definition: winuser.h:2238
#define WM_KEYDOWN
Definition: winuser.h:1743
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
#define SetWindowLongPtrW
Definition: winuser.h:5512
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GWL_STYLE
Definition: winuser.h:863
#define VK_INSERT
Definition: winuser.h:2268
SHORT WINAPI GetKeyState(_In_ int)
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:581
#define SECURITY_SERVICE_RID
Definition: setypes.h:562
#define SECURITY_LOCAL_SYSTEM_RID
Definition: setypes.h:574
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:652
unsigned char BYTE
Definition: xxhash.c:193