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