2 * The parameters of many functions changes between different OS versions
3 * (NT uses Unicode strings, 95 uses ASCII strings)
5 * Copyright 1997 Marcus Meissner
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.
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.
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
26 #include <commoncontrols.h>
28 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
29 WINE_DECLARE_DEBUG_CHANNEL(pidl
);
31 /* FIXME: !!! move flags to header file !!! */
33 #define MRUF_STRING_LIST 0 /* list will contain strings */
34 #define MRUF_BINARY_LIST 1 /* list will contain binary data */
35 #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
37 EXTERN_C HANDLE WINAPI
CreateMRUListA(LPCREATEMRULISTA lpcml
);
38 EXTERN_C INT WINAPI
AddMRUData(HANDLE hList
, LPCVOID lpData
, DWORD cbData
);
39 EXTERN_C INT WINAPI
FindMRUData(HANDLE hList
, LPCVOID lpData
, DWORD cbData
, LPINT lpRegNum
);
40 EXTERN_C INT WINAPI
EnumMRUListA(HANDLE hList
, INT nItemPos
, LPVOID lpBuffer
, DWORD nBufferSize
);
43 /* Get a function pointer from a DLL handle */
44 #define GET_FUNC(func, funcType, module, name, fail) \
47 if (!SHELL32_h##module && !(SHELL32_h##module = LoadLibraryA(#module ".dll"))) return fail; \
48 func = (funcType)GetProcAddress(SHELL32_h##module, name); \
49 if (!func) return fail; \
53 /* Function pointers for GET_FUNC macro */
54 static HMODULE SHELL32_hshlwapi
=NULL
;
57 /*************************************************************************
58 * ParseFieldA [internal]
60 * copies a field from a ',' delimited string
62 * first field is nField = 1
64 DWORD WINAPI
ParseFieldA(
70 WARN("(%s,0x%08x,%p,%d) semi-stub.\n",debugstr_a(src
),nField
,dst
,len
);
72 if (!src
|| !src
[0] || !dst
|| !len
)
75 /* skip n fields delimited by ',' */
78 if (*src
=='\0') return FALSE
;
79 if (*(src
++)==',') nField
--;
82 /* copy part till the next ',' to dst */
83 while ( *src
!='\0' && *src
!=',' && (len
--)>0 ) *(dst
++)=*(src
++);
85 /* finalize the string */
91 /*************************************************************************
92 * ParseFieldW [internal]
94 * copies a field from a ',' delimited string
96 * first field is nField = 1
98 DWORD WINAPI
ParseFieldW(LPCWSTR src
, DWORD nField
, LPWSTR dst
, DWORD len
)
100 WARN("(%s,0x%08x,%p,%d) semi-stub.\n", debugstr_w(src
), nField
, dst
, len
);
102 if (!src
|| !src
[0] || !dst
|| !len
)
105 /* skip n fields delimited by ',' */
108 if (*src
== 0x0) return FALSE
;
109 if (*src
++ == ',') nField
--;
112 /* copy part till the next ',' to dst */
113 while ( *src
!= 0x0 && *src
!= ',' && (len
--)>0 ) *(dst
++) = *(src
++);
115 /* finalize the string */
121 /*************************************************************************
122 * ParseField [SHELL32.58]
124 EXTERN_C DWORD WINAPI
ParseFieldAW(LPCVOID src
, DWORD nField
, LPVOID dst
, DWORD len
)
126 if (SHELL_OsIsUnicode())
127 return ParseFieldW((LPCWSTR
)src
, nField
, (LPWSTR
)dst
, len
);
128 return ParseFieldA((LPCSTR
)src
, nField
, (LPSTR
)dst
, len
);
131 /*************************************************************************
132 * GetFileNameFromBrowse [SHELL32.63]
135 BOOL WINAPI
GetFileNameFromBrowse(
139 LPCWSTR lpstrInitialDir
,
144 typedef BOOL (WINAPI
*GetOpenFileNameProc
)(OPENFILENAMEW
*ofn
);
146 GetOpenFileNameProc pGetOpenFileNameW
;
150 TRACE("%p, %s, %d, %s, %s, %s, %s)\n",
151 hwndOwner
, debugstr_w(lpstrFile
), nMaxFile
, lpstrInitialDir
, lpstrDefExt
,
152 lpstrFilter
, lpstrTitle
);
154 hmodule
= LoadLibraryW(L
"comdlg32.dll");
155 if(!hmodule
) return FALSE
;
156 pGetOpenFileNameW
= (GetOpenFileNameProc
)GetProcAddress(hmodule
, "GetOpenFileNameW");
157 if(!pGetOpenFileNameW
)
159 FreeLibrary(hmodule
);
163 memset(&ofn
, 0, sizeof(ofn
));
165 ofn
.lStructSize
= sizeof(ofn
);
166 ofn
.hwndOwner
= hwndOwner
;
167 ofn
.lpstrFilter
= lpstrFilter
;
168 ofn
.lpstrFile
= lpstrFile
;
169 ofn
.nMaxFile
= nMaxFile
;
170 ofn
.lpstrInitialDir
= lpstrInitialDir
;
171 ofn
.lpstrTitle
= lpstrTitle
;
172 ofn
.lpstrDefExt
= lpstrDefExt
;
173 ofn
.Flags
= OFN_EXPLORER
| OFN_HIDEREADONLY
| OFN_FILEMUSTEXIST
;
174 ret
= pGetOpenFileNameW(&ofn
);
176 FreeLibrary(hmodule
);
180 /*************************************************************************
181 * SHGetSetSettings [SHELL32.68]
183 EXTERN_C VOID WINAPI
SHGetSetSettings(LPSHELLSTATE lpss
, DWORD dwMask
, BOOL bSet
)
187 FIXME("%p 0x%08x TRUE\n", lpss
, dwMask
);
191 SHGetSettings((LPSHELLFLAGSTATE
)lpss
,dwMask
);
195 /*************************************************************************
196 * SHGetSettings [SHELL32.@]
199 * the registry path are for win98 (tested)
200 * and possibly are the same in nt40
203 EXTERN_C VOID WINAPI
SHGetSettings(LPSHELLFLAGSTATE lpsfs
, DWORD dwMask
)
207 DWORD dwDataSize
= sizeof (DWORD
);
209 TRACE("(%p 0x%08x)\n",lpsfs
,dwMask
);
211 if (RegCreateKeyExA(HKEY_CURRENT_USER
, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
212 0, 0, 0, KEY_ALL_ACCESS
, 0, &hKey
, 0))
215 if ( (SSF_SHOWEXTENSIONS
& dwMask
) && !RegQueryValueExA(hKey
, "HideFileExt", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
216 lpsfs
->fShowExtensions
= ((dwData
== 0) ? 0 : 1);
218 if ( (SSF_SHOWINFOTIP
& dwMask
) && !RegQueryValueExA(hKey
, "ShowInfoTip", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
219 lpsfs
->fShowInfoTip
= ((dwData
== 0) ? 0 : 1);
221 if ( (SSF_DONTPRETTYPATH
& dwMask
) && !RegQueryValueExA(hKey
, "DontPrettyPath", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
222 lpsfs
->fDontPrettyPath
= ((dwData
== 0) ? 0 : 1);
224 if ( (SSF_HIDEICONS
& dwMask
) && !RegQueryValueExA(hKey
, "HideIcons", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
225 lpsfs
->fHideIcons
= ((dwData
== 0) ? 0 : 1);
227 if ( (SSF_MAPNETDRVBUTTON
& dwMask
) && !RegQueryValueExA(hKey
, "MapNetDrvBtn", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
228 lpsfs
->fMapNetDrvBtn
= ((dwData
== 0) ? 0 : 1);
230 if ( (SSF_SHOWATTRIBCOL
& dwMask
) && !RegQueryValueExA(hKey
, "ShowAttribCol", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
231 lpsfs
->fShowAttribCol
= ((dwData
== 0) ? 0 : 1);
233 if (((SSF_SHOWALLOBJECTS
| SSF_SHOWSYSFILES
) & dwMask
) && !RegQueryValueExA(hKey
, "Hidden", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
235 { if (SSF_SHOWALLOBJECTS
& dwMask
) lpsfs
->fShowAllObjects
= 0;
236 if (SSF_SHOWSYSFILES
& dwMask
) lpsfs
->fShowSysFiles
= 0;
238 else if (dwData
== 1)
239 { if (SSF_SHOWALLOBJECTS
& dwMask
) lpsfs
->fShowAllObjects
= 1;
240 if (SSF_SHOWSYSFILES
& dwMask
) lpsfs
->fShowSysFiles
= 0;
242 else if (dwData
== 2)
243 { if (SSF_SHOWALLOBJECTS
& dwMask
) lpsfs
->fShowAllObjects
= 0;
244 if (SSF_SHOWSYSFILES
& dwMask
) lpsfs
->fShowSysFiles
= 1;
249 TRACE("-- 0x%04x\n", *(WORD
*)lpsfs
);
252 /*************************************************************************
253 * SHShellFolderView_Message [SHELL32.73]
255 * Send a message to an explorer cabinet window.
258 * hwndCabinet [I] The window containing the shellview to communicate with
259 * dwMessage [I] The SFVM message to send
260 * dwParam [I] Message parameter
266 * Message SFVM_REARRANGE = 1
268 * This message gets sent when a column gets clicked to instruct the
269 * shell view to re-sort the item list. dwParam identifies the column
272 LRESULT WINAPI
SHShellFolderView_Message(
277 FIXME("%p %08x %08lx stub\n",hwndCabinet
, uMessage
, lParam
);
281 /*************************************************************************
282 * RegisterShellHook [SHELL32.181]
284 * Register a shell hook.
287 * hwnd [I] Window handle
288 * dwType [I] Type of hook.
291 * Exported by ordinal
293 BOOL WINAPI
RegisterShellHook(
297 FIXME("(%p,0x%08x):stub.\n",hWnd
, dwType
);
301 /*************************************************************************
302 * ShellMessageBoxW [SHELL32.182]
304 * See ShellMessageBoxA.
307 * shlwapi.ShellMessageBoxWrapW is a duplicate of shell32.ShellMessageBoxW
308 * because we can't forward to it in the .spec file since it's exported by
309 * ordinal. If you change the implementation here please update the code in
312 EXTERN_C
int ShellMessageBoxW(
320 WCHAR szText
[100],szTitle
[100];
321 LPCWSTR pszText
= szText
, pszTitle
= szTitle
;
326 va_start(args
, uType
);
327 /* wvsprintfA(buf,fmt, args); */
329 TRACE("(%p,%p,%p,%p,%08x)\n",
330 hInstance
,hWnd
,lpText
,lpCaption
,uType
);
332 if (IS_INTRESOURCE(lpCaption
))
333 LoadStringW(hInstance
, LOWORD(lpCaption
), szTitle
, sizeof(szTitle
)/sizeof(szTitle
[0]));
335 pszTitle
= lpCaption
;
337 if (IS_INTRESOURCE(lpText
))
338 LoadStringW(hInstance
, LOWORD(lpText
), szText
, sizeof(szText
)/sizeof(szText
[0]));
342 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_STRING
,
343 pszText
, 0, 0, (LPWSTR
)&pszTemp
, 0, &args
);
347 ret
= MessageBoxW(hWnd
,pszTemp
,pszTitle
,uType
);
352 /*************************************************************************
353 * ShellMessageBoxA [SHELL32.183]
355 * Format and output an error message.
358 * hInstance [I] Instance handle of message creator
359 * hWnd [I] Window handle of message creator
360 * lpText [I] Resource Id of title or LPSTR
361 * lpCaption [I] Resource Id of title or LPSTR
362 * uType [I] Type of error message
365 * A return value from MessageBoxA().
368 * Exported by ordinal
370 EXTERN_C
int ShellMessageBoxA(
378 char szText
[100],szTitle
[100];
379 LPCSTR pszText
= szText
, pszTitle
= szTitle
;
384 va_start(args
, uType
);
385 /* wvsprintfA(buf,fmt, args); */
387 TRACE("(%p,%p,%p,%p,%08x)\n",
388 hInstance
,hWnd
,lpText
,lpCaption
,uType
);
390 if (IS_INTRESOURCE(lpCaption
))
391 LoadStringA(hInstance
, LOWORD(lpCaption
), szTitle
, sizeof(szTitle
));
393 pszTitle
= lpCaption
;
395 if (IS_INTRESOURCE(lpText
))
396 LoadStringA(hInstance
, LOWORD(lpText
), szText
, sizeof(szText
));
400 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_STRING
,
401 pszText
, 0, 0, (LPSTR
)&pszTemp
, 0, &args
);
405 ret
= MessageBoxA(hWnd
,pszTemp
,pszTitle
,uType
);
410 /*************************************************************************
411 * SHRegisterDragDrop [SHELL32.86]
413 * Probably equivalent to RegisterDragDrop but under Windows 95 it could use the
414 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
415 * for details. Under Windows 98 this function initializes the true OLE when called
416 * the first time, on XP always returns E_OUTOFMEMORY and it got removed from Vista.
418 * We follow Windows 98 behaviour.
421 * exported by ordinal
424 * RegisterDragDrop, SHLoadOLE
426 HRESULT WINAPI
SHRegisterDragDrop(
428 LPDROPTARGET pDropTarget
)
430 static BOOL ole_initialized
= FALSE
;
433 TRACE("(%p,%p)\n", hWnd
, pDropTarget
);
435 if (!ole_initialized
)
437 hr
= OleInitialize(NULL
);
440 ole_initialized
= TRUE
;
442 return RegisterDragDrop(hWnd
, pDropTarget
);
445 /*************************************************************************
446 * SHRevokeDragDrop [SHELL32.87]
448 * Probably equivalent to RevokeDragDrop but under Windows 95 it could use the
449 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
450 * for details. Function removed from Windows Vista.
452 * We call ole32 RevokeDragDrop which seems to work even if OleInitialize was
456 * exported by ordinal
459 * RevokeDragDrop, SHLoadOLE
461 HRESULT WINAPI
SHRevokeDragDrop(HWND hWnd
)
463 TRACE("(%p)\n", hWnd
);
464 return RevokeDragDrop(hWnd
);
467 /*************************************************************************
468 * SHDoDragDrop [SHELL32.88]
470 * Probably equivalent to DoDragDrop but under Windows 9x it could use the
471 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
475 * exported by ordinal
478 * DoDragDrop, SHLoadOLE
480 HRESULT WINAPI
SHDoDragDrop(
482 LPDATAOBJECT lpDataObject
,
483 LPDROPSOURCE lpDropSource
,
487 FIXME("(%p %p %p 0x%08x %p):stub.\n",
488 hWnd
, lpDataObject
, lpDropSource
, dwOKEffect
, pdwEffect
);
489 return DoDragDrop(lpDataObject
, lpDropSource
, dwOKEffect
, pdwEffect
);
492 /*************************************************************************
493 * ArrangeWindows [SHELL32.184]
496 WORD WINAPI
ArrangeWindows(
503 /* Unimplemented in WinXP SP3 */
504 TRACE("(%p 0x%08x %p 0x%04x %p):stub.\n",
505 hwndParent
, dwReserved
, lpRect
, cKids
, lpKids
);
509 /*************************************************************************
510 * SignalFileOpen [SHELL32.103]
513 * exported by ordinal
516 SignalFileOpen (LPCITEMIDLIST pidl
)
518 FIXME("(0x%08x):stub.\n", pidl
);
523 /*************************************************************************
524 * SHADD_get_policy - helper function for SHAddToRecentDocs
527 * policy [IN] policy name (null termed string) to find
528 * type [OUT] ptr to DWORD to receive type
529 * buffer [OUT] ptr to area to hold data retrieved
530 * len [IN/OUT] ptr to DWORD holding size of buffer and getting
534 * result of the SHQueryValueEx call
536 static INT
SHADD_get_policy(LPCSTR policy
, LPDWORD type
, LPVOID buffer
, LPDWORD len
)
541 /* Get the key for the policies location in the registry
543 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
544 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
545 0, KEY_READ
, &Policy_basekey
)) {
547 if (RegOpenKeyExA(HKEY_CURRENT_USER
,
548 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
549 0, KEY_READ
, &Policy_basekey
)) {
550 TRACE("No Explorer Policies location exists. Policy wanted=%s\n",
553 return ERROR_FILE_NOT_FOUND
;
557 /* Retrieve the data if it exists
559 ret
= SHQueryValueExA(Policy_basekey
, policy
, 0, type
, buffer
, len
);
560 RegCloseKey(Policy_basekey
);
565 /*************************************************************************
566 * SHADD_compare_mru - helper function for SHAddToRecentDocs
569 * data1 [IN] data being looked for
570 * data2 [IN] data in MRU
571 * cbdata [IN] length from FindMRUData call (not used)
574 * position within MRU list that data was added.
576 static INT CALLBACK
SHADD_compare_mru(LPCVOID data1
, LPCVOID data2
, DWORD cbData
)
578 return lstrcmpiA((LPCSTR
)data1
, (LPCSTR
)data2
);
581 /*************************************************************************
582 * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs
585 * mruhandle [IN] handle for created MRU list
586 * doc_name [IN] null termed pure doc name
587 * new_lnk_name [IN] null termed path and file name for .lnk file
588 * buffer [IN/OUT] 2048 byte area to construct MRU data
589 * len [OUT] ptr to int to receive space used in buffer
592 * position within MRU list that data was added.
594 static INT
SHADD_create_add_mru_data(HANDLE mruhandle
, LPCSTR doc_name
, LPCSTR new_lnk_name
,
595 LPSTR buffer
, INT
*len
)
601 * RecentDocs MRU data structure seems to be:
602 * +0h document file name w/ terminating 0h
603 * +nh short int w/ size of remaining
604 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
605 * +n+4h 10 bytes zeros - unknown
606 * +n+eh shortcut file name w/ terminating 0h
607 * +n+e+nh 3 zero bytes - unknown
610 /* Create the MRU data structure for "RecentDocs"
613 lstrcpyA(ptr
, doc_name
);
614 ptr
+= (lstrlenA(buffer
) + 1);
615 wlen
= lstrlenA(new_lnk_name
) + 1 + 12;
616 *((short int*)ptr
) = wlen
;
617 ptr
+= 2; /* step past the length */
618 *(ptr
++) = 0x30; /* unknown reason */
619 *(ptr
++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */
622 lstrcpyA(ptr
, new_lnk_name
);
623 ptr
+= (lstrlenA(new_lnk_name
) + 1);
628 /* Add the new entry into the MRU list
630 return AddMRUData(mruhandle
, buffer
, *len
);
633 /*************************************************************************
634 * SHAddToRecentDocs [SHELL32.@]
636 * Modify (add/clear) Shell's list of recently used documents.
639 * uFlags [IN] SHARD_PATHA, SHARD_PATHW or SHARD_PIDL
640 * pv [IN] string or pidl, NULL clears the list
648 void WINAPI
SHAddToRecentDocs (UINT uFlags
,LPCVOID pv
)
650 /* If list is a string list lpfnCompare has the following prototype
651 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
652 * for binary lists the prototype is
653 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
654 * where cbData is the no. of bytes to compare.
655 * Need to check what return value means identical - 0?
661 CHAR doc_name
[MAX_PATH
];
662 CHAR link_dir
[MAX_PATH
];
663 CHAR new_lnk_filepath
[MAX_PATH
];
664 CHAR new_lnk_name
[MAX_PATH
];
666 CComPtr
<IMalloc
> ppM
;
668 HWND hwnd
= 0; /* FIXME: get real window handle */
670 DWORD data
[64], datalen
, type
;
672 TRACE("%04x %p\n", uFlags
, pv
);
675 * RecentDocs MRU data structure seems to be:
676 * +0h document file name w/ terminating 0h
677 * +nh short int w/ size of remaining
678 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
679 * +n+4h 10 bytes zeros - unknown
680 * +n+eh shortcut file name w/ terminating 0h
681 * +n+e+nh 3 zero bytes - unknown
684 /* See if we need to do anything.
687 ret
=SHADD_get_policy( "NoRecentDocsHistory", &type
, data
, &datalen
);
688 if ((ret
> 0) && (ret
!= ERROR_FILE_NOT_FOUND
)) {
689 ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret
);
692 if (ret
== ERROR_SUCCESS
) {
693 if (!( (type
== REG_DWORD
) ||
694 ((type
== REG_BINARY
) && (datalen
== 4)) )) {
695 ERR("Error policy data for \"NoRecentDocsHistory\" not formatted correctly, type=%d, len=%d\n",
700 TRACE("policy value for NoRecentDocsHistory = %08x\n", data
[0]);
701 /* now test the actual policy value */
706 /* Open key to where the necessary info is
708 /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH)
709 * and the close should be done during the _DETACH. The resulting
710 * key is stored in the DLL global data.
712 if (RegCreateKeyExA(HKEY_CURRENT_USER
,
713 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
714 0, 0, 0, KEY_READ
, 0, &HCUbasekey
, 0)) {
715 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n");
719 /* Get path to user's "Recent" directory
721 if(SUCCEEDED(SHGetMalloc(&ppM
))) {
722 if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd
, CSIDL_RECENT
,
724 SHGetPathFromIDListA(pidl
, link_dir
);
730 ERR("serious issues 1\n");
736 ERR("serious issues 2\n");
738 TRACE("Users Recent dir %s\n", link_dir
);
740 /* If no input, then go clear the lists */
742 /* clear user's Recent dir
745 /* FIXME: delete all files in "link_dir"
747 * while( more files ) {
748 * lstrcpyA(old_lnk_name, link_dir);
749 * PathAppendA(old_lnk_name, filenam);
750 * DeleteFileA(old_lnk_name);
753 FIXME("should delete all files in %s\\\n", link_dir
);
757 /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against
758 * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer
759 * and naturally it fails w/ rc=2. It should do it against
760 * HKEY_CURRENT_USER which is where it is stored, and where
761 * the MRU routines expect it!!!!
763 RegDeleteKeyA(HCUbasekey
, "RecentDocs");
764 RegCloseKey(HCUbasekey
);
768 /* Have data to add, the jobs to be done:
769 * 1. Add document to MRU list in registry "HKCU\Software\
770 * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs".
771 * 2. Add shortcut to document in the user's Recent directory
773 * 3. Add shortcut to Start menu's Documents submenu.
776 /* Get the pure document name from the input
781 SHGetPathFromIDListA((LPCITEMIDLIST
)pv
, doc_name
);
785 lstrcpynA(doc_name
, (LPCSTR
)pv
, MAX_PATH
);
789 WideCharToMultiByte(CP_ACP
, 0, (LPCWSTR
)pv
, -1, doc_name
, MAX_PATH
, NULL
, NULL
);
793 FIXME("Unsupported flags: %u\n", uFlags
);
797 TRACE("full document name %s\n", debugstr_a(doc_name
));
799 /* check if file is a shortcut */
800 ext
= strrchr(doc_name
, '.');
801 if (!lstrcmpiA(ext
, ".lnk"))
803 CComPtr
<IShellLinkA
> ShellLink
;
804 IShellLink_ConstructFromFile(NULL
, IID_IShellLinkA
, (LPCITEMIDLIST
)SHSimpleIDListFromPathA(doc_name
), (LPVOID
*)&ShellLink
);
805 ShellLink
->GetPath(doc_name
, MAX_PATH
, NULL
, 0);
808 ext
= strrchr(doc_name
, '.');
809 if (!lstrcmpiA(ext
, ".exe"))
811 /* executables are not added */
815 PathStripPathA(doc_name
);
816 TRACE("stripped document name %s\n", debugstr_a(doc_name
));
819 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
822 * doc_name - pure file-spec, no path
823 * link_dir - path to the user's Recent directory
824 * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node
826 * new_lnk_name- pure file-spec, no path for new .lnk file
828 * - path and file name of new .lnk file
830 CREATEMRULISTA mymru
;
832 INT len
, pos
, bufused
, err
;
837 CHAR old_lnk_name
[MAX_PATH
];
840 mymru
.cbSize
= sizeof(CREATEMRULISTA
);
841 mymru
.nMaxItems
= 15;
842 mymru
.dwFlags
= MRUF_BINARY_LIST
| MRUF_DELAYED_SAVE
;
843 mymru
.hKey
= HCUbasekey
;
844 mymru
.lpszSubKey
= "RecentDocs";
845 mymru
.lpfnCompare
= (PROC
)SHADD_compare_mru
;
846 mruhandle
= CreateMRUListA(&mymru
);
849 ERR("MRU processing failed, handle zero\n");
850 RegCloseKey(HCUbasekey
);
853 len
= lstrlenA(doc_name
);
854 pos
= FindMRUData(mruhandle
, doc_name
, len
, 0);
856 /* Now get the MRU entry that will be replaced
857 * and delete the .lnk file for it
859 if ((bufused
= EnumMRUListA(mruhandle
, (pos
== -1) ? 14 : pos
,
860 buffer
, 2048)) != -1) {
862 ptr
+= (lstrlenA(buffer
) + 1);
863 slen
= *((short int*)ptr
);
864 ptr
+= 2; /* skip the length area */
865 if (bufused
>= slen
+ (ptr
-buffer
)) {
866 /* buffer size looks good */
867 ptr
+= 12; /* get to string */
868 len
= bufused
- (ptr
-buffer
); /* get length of buf remaining */
869 if ((lstrlenA(ptr
) > 0) && (lstrlenA(ptr
) <= len
-1)) {
870 /* appears to be good string */
871 lstrcpyA(old_lnk_name
, link_dir
);
872 PathAppendA(old_lnk_name
, ptr
);
873 if (!DeleteFileA(old_lnk_name
)) {
874 if ((attr
= GetFileAttributesA(old_lnk_name
)) == INVALID_FILE_ATTRIBUTES
) {
875 if ((err
= GetLastError()) != ERROR_FILE_NOT_FOUND
) {
876 ERR("Delete for %s failed, err=%d, attr=%08x\n",
877 old_lnk_name
, err
, attr
);
880 TRACE("old .lnk file %s did not exist\n",
885 ERR("Delete for %s failed, attr=%08x\n",
890 TRACE("deleted old .lnk file %s\n", old_lnk_name
);
896 /* Create usable .lnk file name for the "Recent" directory
898 wsprintfA(new_lnk_name
, "%s.lnk", doc_name
);
899 lstrcpyA(new_lnk_filepath
, link_dir
);
900 PathAppendA(new_lnk_filepath
, new_lnk_name
);
902 olderrormode
= SetErrorMode(SEM_FAILCRITICALERRORS
);
903 while (GetFileAttributesA(new_lnk_filepath
) != INVALID_FILE_ATTRIBUTES
) {
905 wsprintfA(new_lnk_name
, "%s (%u).lnk", doc_name
, i
);
906 lstrcpyA(new_lnk_filepath
, link_dir
);
907 PathAppendA(new_lnk_filepath
, new_lnk_name
);
909 SetErrorMode(olderrormode
);
910 TRACE("new shortcut will be %s\n", new_lnk_filepath
);
912 /* Now add the new MRU entry and data
914 pos
= SHADD_create_add_mru_data(mruhandle
, doc_name
, new_lnk_name
,
916 FreeMRUList(mruhandle
);
917 TRACE("Updated MRU list, new doc is position %d\n", pos
);
920 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
923 * doc_name - pure file-spec, no path
925 * - path and file name of new .lnk file
926 * uFlags[in] - flags on call to SHAddToRecentDocs
927 * pv[in] - document path/pidl on call to SHAddToRecentDocs
929 CComPtr
<IShellLinkA
> psl
;
930 CComPtr
<IPersistFile
> pPf
;
933 WCHAR widelink
[MAX_PATH
];
937 hres
= CoCreateInstance(CLSID_ShellLink
,
939 CLSCTX_INPROC_SERVER
,
940 IID_PPV_ARG(IShellLinkA
,&psl
));
941 if(SUCCEEDED(hres
)) {
943 hres
= psl
->QueryInterface(IID_PPV_ARG(IPersistFile
,&pPf
));
946 ERR("failed QueryInterface for IPersistFile %08x\n", hres
);
950 /* Set the document path or pidl */
951 if (uFlags
== SHARD_PIDL
) {
952 hres
= psl
->SetIDList((LPCITEMIDLIST
) pv
);
954 hres
= psl
->SetPath((LPCSTR
) pv
);
958 ERR("failed Set{IDList|Path} %08x\n", hres
);
962 lstrcpyA(desc
, "Shortcut to ");
963 lstrcatA(desc
, doc_name
);
964 hres
= psl
->SetDescription(desc
);
967 ERR("failed SetDescription %08x\n", hres
);
971 MultiByteToWideChar(CP_ACP
, 0, new_lnk_filepath
, -1,
973 /* create the short cut */
974 hres
= pPf
->Save(widelink
, TRUE
);
977 ERR("failed IPersistFile::Save %08x\n", hres
);
980 hres
= pPf
->SaveCompleted(widelink
);
981 TRACE("shortcut %s has been created, result=%08x\n",
982 new_lnk_filepath
, hres
);
985 ERR("CoCreateInstance failed, hres=%08x\n", hres
);
993 RegCloseKey(HCUbasekey
);
997 /*************************************************************************
998 * SHCreateShellFolderViewEx [SHELL32.174]
1000 * Create a new instance of the default Shell folder view object.
1004 * Failure: error value
1007 * see IShellFolder::CreateViewObject
1009 HRESULT WINAPI
SHCreateShellFolderViewEx(
1010 LPCSFV psvcbi
, /* [in] shelltemplate struct */
1011 IShellView
**ppv
) /* [out] IShellView pointer */
1016 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n",
1017 psvcbi
->pshf
, psvcbi
->pidl
, psvcbi
->pfnCallback
,
1018 psvcbi
->fvm
, psvcbi
->psvOuter
);
1021 hRes
= IShellView_Constructor(psvcbi
->pshf
, &psf
);
1025 hRes
= psf
->QueryInterface(IID_PPV_ARG(IShellView
, ppv
));
1030 /*************************************************************************
1031 * SHWinHelp [SHELL32.127]
1034 EXTERN_C HRESULT WINAPI
SHWinHelp (DWORD v
, DWORD w
, DWORD x
, DWORD z
)
1035 { FIXME("0x%08x 0x%08x 0x%08x 0x%08x stub\n",v
,w
,x
,z
);
1038 /*************************************************************************
1039 * SHRunControlPanel [SHELL32.161]
1042 EXTERN_C BOOL WINAPI
SHRunControlPanel (LPCWSTR lpcszCmdLine
, HWND hwndMsgParent
)
1044 FIXME("0x%08x 0x%08x stub\n",lpcszCmdLine
,hwndMsgParent
);
1048 static LPUNKNOWN SHELL32_IExplorerInterface
=0;
1049 /*************************************************************************
1050 * SHSetInstanceExplorer [SHELL32.176]
1053 * Sets the interface
1055 VOID WINAPI
SHSetInstanceExplorer (LPUNKNOWN lpUnknown
)
1056 { TRACE("%p\n", lpUnknown
);
1057 SHELL32_IExplorerInterface
= lpUnknown
;
1059 /*************************************************************************
1060 * SHGetInstanceExplorer [SHELL32.@]
1063 * gets the interface pointer of the explorer and a reference
1065 HRESULT WINAPI
SHGetInstanceExplorer (IUnknown
**lpUnknown
)
1066 { TRACE("%p\n", lpUnknown
);
1068 *lpUnknown
= SHELL32_IExplorerInterface
;
1070 if (!SHELL32_IExplorerInterface
)
1073 SHELL32_IExplorerInterface
->AddRef();
1076 /*************************************************************************
1077 * SHFreeUnusedLibraries [SHELL32.123]
1079 * Probably equivalent to CoFreeUnusedLibraries but under Windows 9x it could use
1080 * the shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
1084 * exported by ordinal
1087 * CoFreeUnusedLibraries, SHLoadOLE
1089 void WINAPI
SHFreeUnusedLibraries (void)
1092 CoFreeUnusedLibraries();
1094 /*************************************************************************
1095 * DAD_AutoScroll [SHELL32.129]
1098 BOOL WINAPI
DAD_AutoScroll(HWND hwnd
, AUTO_SCROLL_DATA
*samples
, const POINT
* pt
)
1100 FIXME("hwnd = %p %p %p\n",hwnd
,samples
,pt
);
1103 /*************************************************************************
1104 * DAD_DragEnter [SHELL32.130]
1107 BOOL WINAPI
DAD_DragEnter(HWND hwnd
)
1109 FIXME("hwnd = %p\n",hwnd
);
1112 /*************************************************************************
1113 * DAD_DragEnterEx [SHELL32.131]
1116 BOOL WINAPI
DAD_DragEnterEx(HWND hwnd
, POINT p
)
1118 FIXME("hwnd = %p (%d,%d)\n",hwnd
,p
.x
,p
.y
);
1121 /*************************************************************************
1122 * DAD_DragMove [SHELL32.134]
1125 BOOL WINAPI
DAD_DragMove(POINT p
)
1127 FIXME("(%d,%d)\n",p
.x
,p
.y
);
1130 /*************************************************************************
1131 * DAD_DragLeave [SHELL32.132]
1134 BOOL WINAPI
DAD_DragLeave(VOID
)
1139 /*************************************************************************
1140 * DAD_SetDragImage [SHELL32.136]
1145 BOOL WINAPI
DAD_SetDragImage(
1146 HIMAGELIST himlTrack
,
1149 FIXME("%p %p stub\n",himlTrack
, lppt
);
1152 /*************************************************************************
1153 * DAD_ShowDragImage [SHELL32.137]
1158 BOOL WINAPI
DAD_ShowDragImage(BOOL bShow
)
1160 FIXME("0x%08x stub\n",bShow
);
1164 static const WCHAR szwCabLocation
[] = {
1165 'S','o','f','t','w','a','r','e','\\',
1166 'M','i','c','r','o','s','o','f','t','\\',
1167 'W','i','n','d','o','w','s','\\',
1168 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
1169 'E','x','p','l','o','r','e','r','\\',
1170 'C','a','b','i','n','e','t','S','t','a','t','e',0
1173 static const WCHAR szwSettings
[] = { 'S','e','t','t','i','n','g','s',0 };
1175 /*************************************************************************
1176 * ReadCabinetState [SHELL32.651] NT 4.0
1179 BOOL WINAPI
ReadCabinetState(CABINETSTATE
*cs
, int length
)
1184 TRACE("%p %d\n", cs
, length
);
1186 if( (cs
== NULL
) || (length
< (int)sizeof(*cs
)) )
1189 r
= RegOpenKeyW( HKEY_CURRENT_USER
, szwCabLocation
, &hkey
);
1190 if( r
== ERROR_SUCCESS
)
1193 r
= RegQueryValueExW( hkey
, szwSettings
,
1194 NULL
, &type
, (LPBYTE
)cs
, (LPDWORD
)&length
);
1195 RegCloseKey( hkey
);
1199 /* if we can't read from the registry, create default values */
1200 if ( (r
!= ERROR_SUCCESS
) || (cs
->cLength
< sizeof(*cs
)) ||
1201 (cs
->cLength
!= length
) )
1203 ERR("Initializing shell cabinet settings\n");
1204 memset(cs
, 0, sizeof(*cs
));
1205 cs
->cLength
= sizeof(*cs
);
1207 cs
->fFullPathTitle
= FALSE
;
1208 cs
->fSaveLocalView
= TRUE
;
1209 cs
->fNotShell
= FALSE
;
1210 cs
->fSimpleDefault
= TRUE
;
1211 cs
->fDontShowDescBar
= FALSE
;
1212 cs
->fNewWindowMode
= FALSE
;
1213 cs
->fShowCompColor
= FALSE
;
1214 cs
->fDontPrettyNames
= FALSE
;
1215 cs
->fAdminsCreateCommonGroups
= TRUE
;
1216 cs
->fMenuEnumFilter
= 96;
1222 /*************************************************************************
1223 * WriteCabinetState [SHELL32.652] NT 4.0
1226 BOOL WINAPI
WriteCabinetState(CABINETSTATE
*cs
)
1236 r
= RegCreateKeyExW( HKEY_CURRENT_USER
, szwCabLocation
, 0,
1237 NULL
, 0, KEY_ALL_ACCESS
, NULL
, &hkey
, NULL
);
1238 if( r
== ERROR_SUCCESS
)
1240 r
= RegSetValueExW( hkey
, szwSettings
, 0,
1241 REG_BINARY
, (LPBYTE
) cs
, cs
->cLength
);
1243 RegCloseKey( hkey
);
1246 return (r
==ERROR_SUCCESS
);
1249 /*************************************************************************
1250 * FileIconInit [SHELL32.660]
1253 BOOL WINAPI
FileIconInit(BOOL bFullInit
)
1255 FIXME("(%s)\n", bFullInit
? "true" : "false");
1259 /*************************************************************************
1260 * IsUserAnAdmin [SHELL32.680] NT 4.0
1262 * Checks whether the current user is a member of the Administrators group.
1271 BOOL WINAPI
IsUserAnAdmin(VOID
)
1273 SID_IDENTIFIER_AUTHORITY Authority
= {SECURITY_NT_AUTHORITY
};
1276 PTOKEN_GROUPS lpGroups
;
1279 BOOL bResult
= FALSE
;
1283 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY
, &hToken
))
1288 if (!GetTokenInformation(hToken
, TokenGroups
, NULL
, 0, &dwSize
))
1290 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER
)
1292 CloseHandle(hToken
);
1297 lpGroups
= (PTOKEN_GROUPS
)HeapAlloc(GetProcessHeap(), 0, dwSize
);
1298 if (lpGroups
== NULL
)
1300 CloseHandle(hToken
);
1304 if (!GetTokenInformation(hToken
, TokenGroups
, lpGroups
, dwSize
, &dwSize
))
1306 HeapFree(GetProcessHeap(), 0, lpGroups
);
1307 CloseHandle(hToken
);
1311 CloseHandle(hToken
);
1313 if (!AllocateAndInitializeSid(&Authority
, 2, SECURITY_BUILTIN_DOMAIN_RID
,
1314 DOMAIN_ALIAS_RID_ADMINS
, 0, 0, 0, 0, 0, 0,
1317 HeapFree(GetProcessHeap(), 0, lpGroups
);
1321 for (i
= 0; i
< lpGroups
->GroupCount
; i
++)
1323 if (EqualSid(lpSid
, lpGroups
->Groups
[i
].Sid
))
1331 HeapFree(GetProcessHeap(), 0, lpGroups
);
1335 /*************************************************************************
1336 * SHAllocShared [SHELL32.520]
1338 * See shlwapi.SHAllocShared
1340 HANDLE WINAPI
SHAllocShared(LPVOID lpvData
, DWORD dwSize
, DWORD dwProcId
)
1342 typedef HANDLE (WINAPI
*SHAllocSharedProc
)(LPCVOID
, DWORD
, DWORD
);
1343 static SHAllocSharedProc pSHAllocShared
;
1345 GET_FUNC(pSHAllocShared
, SHAllocSharedProc
, shlwapi
, (char*)7, NULL
);
1346 return pSHAllocShared(lpvData
, dwSize
, dwProcId
);
1349 /*************************************************************************
1350 * SHLockShared [SHELL32.521]
1352 * See shlwapi.SHLockShared
1354 LPVOID WINAPI
SHLockShared(HANDLE hShared
, DWORD dwProcId
)
1356 typedef HANDLE (WINAPI
*SHLockSharedProc
)(HANDLE
, DWORD
);
1357 static SHLockSharedProc pSHLockShared
;
1359 GET_FUNC(pSHLockShared
, SHLockSharedProc
, shlwapi
, (char*)8, NULL
);
1360 return pSHLockShared(hShared
, dwProcId
);
1363 /*************************************************************************
1364 * SHUnlockShared [SHELL32.522]
1366 * See shlwapi.SHUnlockShared
1368 BOOL WINAPI
SHUnlockShared(LPVOID lpView
)
1370 typedef HANDLE (WINAPI
*SHUnlockSharedProc
)(LPCVOID
);
1371 static SHUnlockSharedProc pSHUnlockShared
;
1373 GET_FUNC(pSHUnlockShared
, SHUnlockSharedProc
, shlwapi
, (char*)9, FALSE
);
1374 return pSHUnlockShared(lpView
) != NULL
;
1377 /*************************************************************************
1378 * SHFreeShared [SHELL32.523]
1380 * See shlwapi.SHFreeShared
1382 BOOL WINAPI
SHFreeShared(HANDLE hShared
, DWORD dwProcId
)
1384 typedef HANDLE (WINAPI
*SHFreeSharedProc
)(HANDLE
, DWORD
);
1385 static SHFreeSharedProc pSHFreeShared
;
1387 GET_FUNC(pSHFreeShared
, SHFreeSharedProc
, shlwapi
, (char*)10, FALSE
);
1388 return pSHFreeShared(hShared
, dwProcId
) != NULL
;
1391 /*************************************************************************
1392 * SetAppStartingCursor [SHELL32.99]
1394 EXTERN_C HRESULT WINAPI
SetAppStartingCursor(HWND u
, DWORD v
)
1395 { FIXME("hwnd=%p 0x%04x stub\n",u
,v
);
1399 /*************************************************************************
1400 * SHLoadOLE [SHELL32.151]
1402 * To reduce the memory usage of Windows 95, its shell32 contained an
1403 * internal implementation of a part of COM (see e.g. SHGetMalloc, SHCoCreateInstance,
1404 * SHRegisterDragDrop etc.) that allowed to use in-process STA objects without
1405 * the need to load OLE32.DLL. If OLE32.DLL was already loaded, the SH* function
1406 * would just call the Co* functions.
1408 * The SHLoadOLE was called when OLE32.DLL was being loaded to transfer all the
1409 * information from the shell32 "mini-COM" to ole32.dll.
1411 * See http://blogs.msdn.com/oldnewthing/archive/2004/07/05/173226.aspx for a
1412 * detailed description.
1414 * Under wine ole32.dll is always loaded as it is imported by shlwapi.dll which is
1415 * imported by shell32 and no "mini-COM" is used (except for the "LoadWithoutCOM"
1416 * hack in SHCoCreateInstance)
1418 HRESULT WINAPI
SHLoadOLE(LPARAM lParam
)
1419 { FIXME("0x%08lx stub\n",lParam
);
1422 /*************************************************************************
1423 * DriveType [SHELL32.64]
1426 EXTERN_C
int WINAPI
DriveType(int DriveType
)
1428 WCHAR root
[] = L
"A:\\";
1429 root
[0] = L
'A' + DriveType
;
1430 return GetDriveTypeW(root
);
1433 /*************************************************************************
1434 * InvalidateDriveType [SHELL32.65]
1435 * Unimplemented in XP SP3
1437 EXTERN_C
int WINAPI
InvalidateDriveType(int u
)
1439 TRACE("0x%08x stub\n",u
);
1443 /*************************************************************************
1444 * SHAbortInvokeCommand [SHELL32.198]
1447 EXTERN_C HRESULT WINAPI
SHAbortInvokeCommand(void)
1452 /*************************************************************************
1453 * SHOutOfMemoryMessageBox [SHELL32.126]
1456 int WINAPI
SHOutOfMemoryMessageBox(
1461 FIXME("%p %s 0x%08x stub\n",hwndOwner
, lpCaption
, uType
);
1465 /*************************************************************************
1466 * SHFlushClipboard [SHELL32.121]
1469 EXTERN_C HRESULT WINAPI
SHFlushClipboard(void)
1471 return OleFlushClipboard();
1474 /*************************************************************************
1475 * SHWaitForFileToOpen [SHELL32.97]
1478 BOOL WINAPI
SHWaitForFileToOpen(
1483 FIXME("%p 0x%08x 0x%08x stub\n", pidl
, dwFlags
, dwTimeout
);
1487 /************************************************************************
1488 * RLBuildListOfPaths [SHELL32.146]
1493 EXTERN_C DWORD WINAPI
RLBuildListOfPaths (void)
1498 /************************************************************************
1499 * SHValidateUNC [SHELL32.173]
1502 EXTERN_C BOOL WINAPI
SHValidateUNC (HWND hwndOwner
, LPWSTR pszFile
, UINT fConnect
)
1504 FIXME("0x%08x 0x%08x 0x%08x stub\n",hwndOwner
,pszFile
,fConnect
);
1508 /************************************************************************
1509 * DoEnvironmentSubstA [SHELL32.@]
1511 * See DoEnvironmentSubstW.
1513 EXTERN_C DWORD WINAPI
DoEnvironmentSubstA(LPSTR pszString
, UINT cchString
)
1517 DWORD len
= cchString
;
1519 TRACE("(%s, %d)\n", debugstr_a(pszString
), cchString
);
1520 if (pszString
== NULL
) /* Really return 0? */
1522 if ((dst
= (LPSTR
)HeapAlloc(GetProcessHeap(), 0, cchString
* sizeof(CHAR
))))
1524 len
= ExpandEnvironmentStringsA(pszString
, dst
, cchString
);
1525 /* len includes the terminating 0 */
1526 if (len
&& len
< cchString
)
1529 memcpy(pszString
, dst
, len
);
1534 HeapFree(GetProcessHeap(), 0, dst
);
1536 return MAKELONG(len
, res
);
1539 /************************************************************************
1540 * DoEnvironmentSubstW [SHELL32.@]
1542 * Replace all %KEYWORD% in the string with the value of the named
1543 * environment variable. If the buffer is too small, the string is not modified.
1546 * pszString [I] '\0' terminated string with %keyword%.
1547 * [O] '\0' terminated string with %keyword% substituted.
1548 * cchString [I] size of str.
1551 * Success: The string in the buffer is updated
1553 * LOWORD: characters used in the buffer, including space for the terminating 0
1554 * Failure: buffer too small. The string is not modified.
1556 * LOWORD: provided size of the buffer in characters
1558 EXTERN_C DWORD WINAPI
DoEnvironmentSubstW(LPWSTR pszString
, UINT cchString
)
1562 DWORD len
= cchString
;
1564 TRACE("(%s, %d)\n", debugstr_w(pszString
), cchString
);
1566 if ((cchString
< MAXLONG
) && (dst
= (LPWSTR
)HeapAlloc(GetProcessHeap(), 0, cchString
* sizeof(WCHAR
))))
1568 len
= ExpandEnvironmentStringsW(pszString
, dst
, cchString
);
1569 /* len includes the terminating 0 */
1570 if (len
&& len
<= cchString
)
1573 memcpy(pszString
, dst
, len
* sizeof(WCHAR
));
1578 HeapFree(GetProcessHeap(), 0, dst
);
1580 return MAKELONG(len
, res
);
1583 /************************************************************************
1584 * DoEnvironmentSubst [SHELL32.53]
1586 * See DoEnvironmentSubstA.
1588 DWORD WINAPI
DoEnvironmentSubstAW(LPVOID x
, UINT y
)
1590 if (SHELL_OsIsUnicode())
1591 return DoEnvironmentSubstW((LPWSTR
)x
, y
);
1592 return DoEnvironmentSubstA((LPSTR
)x
, y
);
1595 /*************************************************************************
1596 * GUIDFromStringA [SHELL32.703]
1598 BOOL WINAPI
GUIDFromStringA(LPCSTR str
, LPGUID guid
)
1600 TRACE("GUIDFromStringA() stub\n");
1604 /*************************************************************************
1605 * GUIDFromStringW [SHELL32.704]
1607 BOOL WINAPI
GUIDFromStringW(LPCWSTR str
, LPGUID guid
)
1609 UNICODE_STRING guid_str
;
1611 RtlInitUnicodeString(&guid_str
, str
);
1612 return !RtlGUIDFromString(&guid_str
, guid
);
1615 /*************************************************************************
1616 * PathIsTemporaryW [SHELL32.714]
1618 EXTERN_C BOOL WINAPI
PathIsTemporaryW(LPWSTR Str
)
1620 FIXME("(%s)stub\n", debugstr_w(Str
));
1624 /*************************************************************************
1625 * PathIsTemporaryA [SHELL32.713]
1627 EXTERN_C BOOL WINAPI
PathIsTemporaryA(LPSTR Str
)
1629 FIXME("(%s)stub\n", debugstr_a(Str
));
1633 typedef struct _PSXA
1637 IShellPropSheetExt
*pspsx
[0];
1640 typedef struct _PSXA_CALL
1642 LPFNADDPROPSHEETPAGE lpfnAddReplaceWith
;
1647 } PSXA_CALL
, *PPSXA_CALL
;
1649 static BOOL CALLBACK
PsxaCall(HPROPSHEETPAGE hpage
, LPARAM lParam
)
1651 PPSXA_CALL Call
= (PPSXA_CALL
)lParam
;
1655 if ((Call
->bMultiple
|| !Call
->bCalled
) &&
1656 Call
->lpfnAddReplaceWith(hpage
, Call
->lParam
))
1658 Call
->bCalled
= TRUE
;
1667 /*************************************************************************
1668 * SHAddFromPropSheetExtArray [SHELL32.167]
1670 UINT WINAPI
SHAddFromPropSheetExtArray(HPSXA hpsxa
, LPFNADDPROPSHEETPAGE lpfnAddPage
, LPARAM lParam
)
1674 PPSXA psxa
= (PPSXA
)hpsxa
;
1676 TRACE("(%p,%p,%08lx)\n", hpsxa
, lpfnAddPage
, lParam
);
1680 ZeroMemory(&Call
, sizeof(Call
));
1681 Call
.lpfnAddReplaceWith
= lpfnAddPage
;
1682 Call
.lParam
= lParam
;
1683 Call
.bMultiple
= TRUE
;
1685 /* Call the AddPage method of all registered IShellPropSheetExt interfaces */
1686 for (i
= 0; i
!= psxa
->uiCount
; i
++)
1688 psxa
->pspsx
[i
]->AddPages(PsxaCall
, (LPARAM
)&Call
);
1691 return Call
.uiCount
;
1697 /*************************************************************************
1698 * SHCreatePropSheetExtArray [SHELL32.168]
1700 HPSXA WINAPI
SHCreatePropSheetExtArray(HKEY hKey
, LPCWSTR pszSubKey
, UINT max_iface
)
1702 return SHCreatePropSheetExtArrayEx(hKey
, pszSubKey
, max_iface
, NULL
);
1706 /*************************************************************************
1707 * SHCreatePropSheetExtArrayEx [SHELL32.194]
1709 EXTERN_C HPSXA WINAPI
SHCreatePropSheetExtArrayEx(HKEY hKey
, LPCWSTR pszSubKey
, UINT max_iface
, IDataObject
*pDataObj
)
1711 static const WCHAR szPropSheetSubKey
[] = {'s','h','e','l','l','e','x','\\','P','r','o','p','e','r','t','y','S','h','e','e','t','H','a','n','d','l','e','r','s',0};
1712 WCHAR szHandler
[64];
1714 WCHAR szClsidHandler
[39];
1719 HKEY hkBase
, hkPropSheetHandlers
;
1723 TRACE("(%p,%s,%u)\n", hKey
, debugstr_w(pszSubKey
), max_iface
);
1728 /* Open the registry key */
1729 lRet
= RegOpenKeyW(hKey
, pszSubKey
, &hkBase
);
1730 if (lRet
!= ERROR_SUCCESS
)
1733 lRet
= RegOpenKeyExW(hkBase
, szPropSheetSubKey
, 0, KEY_ENUMERATE_SUB_KEYS
, &hkPropSheetHandlers
);
1734 RegCloseKey(hkBase
);
1735 if (lRet
== ERROR_SUCCESS
)
1737 /* Create and initialize the Property Sheet Extensions Array */
1738 psxa
= (PPSXA
)LocalAlloc(LMEM_FIXED
| LMEM_ZEROINIT
, sizeof(PSXA
) + max_iface
* sizeof(IShellPropSheetExt
*));
1741 psxa
->uiAllocated
= max_iface
;
1743 /* Enumerate all subkeys and attempt to load the shell extensions */
1747 dwHandlerLen
= sizeof(szHandler
) / sizeof(szHandler
[0]);
1748 lRet
= RegEnumKeyExW(hkPropSheetHandlers
, dwIndex
++, szHandler
, &dwHandlerLen
, NULL
, NULL
, NULL
, NULL
);
1749 if (lRet
!= ERROR_SUCCESS
)
1751 if (lRet
== ERROR_MORE_DATA
)
1754 if (lRet
== ERROR_NO_MORE_ITEMS
)
1755 lRet
= ERROR_SUCCESS
;
1758 szHandler
[(sizeof(szHandler
) / sizeof(szHandler
[0])) - 1] = 0;
1759 hr
= CLSIDFromString(szHandler
, &clsid
);
1762 dwClsidSize
= sizeof(szClsidHandler
);
1763 if (SHGetValueW(hkPropSheetHandlers
, szHandler
, NULL
, NULL
, szClsidHandler
, &dwClsidSize
) == ERROR_SUCCESS
)
1765 szClsidHandler
[(sizeof(szClsidHandler
) / sizeof(szClsidHandler
[0])) - 1] = 0;
1766 hr
= CLSIDFromString(szClsidHandler
, &clsid
);
1771 CComPtr
<IShellExtInit
> psxi
;
1772 CComPtr
<IShellPropSheetExt
> pspsx
;
1774 /* Attempt to get an IShellPropSheetExt and an IShellExtInit instance.
1775 Only if both interfaces are supported it's a real shell extension.
1776 Then call IShellExtInit's Initialize method. */
1777 if (SUCCEEDED(CoCreateInstance(clsid
, NULL
, CLSCTX_INPROC_SERVER
/* | CLSCTX_NO_CODE_DOWNLOAD */, IID_PPV_ARG(IShellPropSheetExt
, &pspsx
))))
1779 if (SUCCEEDED(pspsx
->QueryInterface(IID_PPV_ARG(IShellExtInit
, &psxi
))))
1781 if (SUCCEEDED(psxi
->Initialize(NULL
, pDataObj
, hKey
)))
1783 /* Add the IShellPropSheetExt instance to the array */
1784 psxa
->pspsx
[psxa
->uiCount
++] = pspsx
.Detach();
1789 } while (psxa
->uiCount
!= psxa
->uiAllocated
);
1792 lRet
= ERROR_NOT_ENOUGH_MEMORY
;
1794 RegCloseKey(hkPropSheetHandlers
);
1797 if (lRet
!= ERROR_SUCCESS
&& psxa
)
1799 SHDestroyPropSheetExtArray((HPSXA
)psxa
);
1806 /*************************************************************************
1807 * SHReplaceFromPropSheetExtArray [SHELL32.170]
1809 UINT WINAPI
SHReplaceFromPropSheetExtArray(HPSXA hpsxa
, UINT uPageID
, LPFNADDPROPSHEETPAGE lpfnReplaceWith
, LPARAM lParam
)
1813 PPSXA psxa
= (PPSXA
)hpsxa
;
1815 TRACE("(%p,%u,%p,%08lx)\n", hpsxa
, uPageID
, lpfnReplaceWith
, lParam
);
1819 ZeroMemory(&Call
, sizeof(Call
));
1820 Call
.lpfnAddReplaceWith
= lpfnReplaceWith
;
1821 Call
.lParam
= lParam
;
1823 /* Call the ReplacePage method of all registered IShellPropSheetExt interfaces.
1824 Each shell extension is only allowed to call the callback once during the callback. */
1825 for (i
= 0; i
!= psxa
->uiCount
; i
++)
1827 Call
.bCalled
= FALSE
;
1828 psxa
->pspsx
[i
]->ReplacePage(uPageID
, PsxaCall
, (LPARAM
)&Call
);
1831 return Call
.uiCount
;
1837 /*************************************************************************
1838 * SHDestroyPropSheetExtArray [SHELL32.169]
1840 void WINAPI
SHDestroyPropSheetExtArray(HPSXA hpsxa
)
1843 PPSXA psxa
= (PPSXA
)hpsxa
;
1845 TRACE("(%p)\n", hpsxa
);
1849 for (i
= 0; i
!= psxa
->uiCount
; i
++)
1851 psxa
->pspsx
[i
]->Release();
1854 LocalFree((HLOCAL
)psxa
);
1858 /*************************************************************************
1859 * CIDLData_CreateFromIDArray [SHELL32.83]
1861 * Create IDataObject from PIDLs??
1863 HRESULT WINAPI
CIDLData_CreateFromIDArray(
1864 LPCITEMIDLIST pidlFolder
,
1866 LPCITEMIDLIST
*lppidlFiles
,
1867 IDataObject
**ppdataObject
)
1870 HWND hwnd
= 0; /*FIXME: who should be hwnd of owner? set to desktop */
1873 TRACE("(%p, %d, %p, %p)\n", pidlFolder
, cpidlFiles
, lppidlFiles
, ppdataObject
);
1877 for (i
= 0; i
< cpidlFiles
; i
++)
1878 pdump(lppidlFiles
[i
]);
1880 hResult
= IDataObject_Constructor(hwnd
, pidlFolder
, lppidlFiles
, cpidlFiles
, ppdataObject
);
1884 /*************************************************************************
1885 * SHCreateStdEnumFmtEtc [SHELL32.74]
1890 HRESULT WINAPI
SHCreateStdEnumFmtEtc(
1892 const FORMATETC
*lpFormats
,
1893 LPENUMFORMATETC
*ppenumFormatetc
)
1895 IEnumFORMATETC
*pef
;
1897 TRACE("cf=%d fe=%p pef=%p\n", cFormats
, lpFormats
, ppenumFormatetc
);
1899 hRes
= IEnumFORMATETC_Constructor(cFormats
, lpFormats
, &pef
);
1904 hRes
= pef
->QueryInterface(IID_PPV_ARG(IEnumFORMATETC
, ppenumFormatetc
));
1911 /*************************************************************************
1912 * SHCreateShellFolderView (SHELL32.256)
1914 HRESULT WINAPI
SHCreateShellFolderView(const SFV_CREATE
*pcsfv
, IShellView
**ppsv
)
1920 if (!pcsfv
|| pcsfv
->cbSize
!= sizeof(*pcsfv
))
1921 return E_INVALIDARG
;
1923 TRACE("sf=%p outer=%p callback=%p\n",
1924 pcsfv
->pshf
, pcsfv
->psvOuter
, pcsfv
->psfvcb
);
1926 hRes
= IShellView_Constructor(pcsfv
->pshf
, &psf
);
1930 hRes
= psf
->QueryInterface(IID_PPV_ARG(IShellView
, ppsv
));
1936 /*************************************************************************
1937 * SHFindFiles (SHELL32.90)
1939 BOOL WINAPI
SHFindFiles( LPCITEMIDLIST pidlFolder
, LPCITEMIDLIST pidlSaveFile
)
1941 FIXME("%p %p\n", pidlFolder
, pidlSaveFile
);
1945 /*************************************************************************
1946 * SHUpdateImageW (SHELL32.192)
1948 * Notifies the shell that an icon in the system image list has been changed.
1951 * pszHashItem [I] Path to file that contains the icon.
1952 * iIndex [I] Zero-based index of the icon in the file.
1953 * uFlags [I] Flags determining the icon attributes. See notes.
1954 * iImageIndex [I] Index of the icon in the system image list.
1960 * uFlags can be one or more of the following flags:
1961 * GIL_NOTFILENAME - pszHashItem is not a file name.
1962 * GIL_SIMULATEDOC - Create a document icon using the specified icon.
1964 void WINAPI
SHUpdateImageW(LPCWSTR pszHashItem
, int iIndex
, UINT uFlags
, int iImageIndex
)
1966 FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_w(pszHashItem
), iIndex
, uFlags
, iImageIndex
);
1969 /*************************************************************************
1970 * SHUpdateImageA (SHELL32.191)
1972 * See SHUpdateImageW.
1974 VOID WINAPI
SHUpdateImageA(LPCSTR pszHashItem
, INT iIndex
, UINT uFlags
, INT iImageIndex
)
1976 FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_a(pszHashItem
), iIndex
, uFlags
, iImageIndex
);
1979 INT WINAPI
SHHandleUpdateImage(LPCITEMIDLIST pidlExtra
)
1981 FIXME("%p - stub\n", pidlExtra
);
1986 BOOL WINAPI
SHObjectProperties(HWND hwnd
, DWORD dwType
, LPCWSTR szObject
, LPCWSTR szPage
)
1988 FIXME("%p, 0x%08x, %s, %s - stub\n", hwnd
, dwType
, debugstr_w(szObject
), debugstr_w(szPage
));
1993 BOOL WINAPI
SHGetNewLinkInfoA(LPCSTR pszLinkTo
, LPCSTR pszDir
, LPSTR pszName
, BOOL
*pfMustCopy
,
1996 WCHAR wszLinkTo
[MAX_PATH
];
1997 WCHAR wszDir
[MAX_PATH
];
1998 WCHAR wszName
[MAX_PATH
];
2001 MultiByteToWideChar(CP_ACP
, 0, pszLinkTo
, -1, wszLinkTo
, MAX_PATH
);
2002 MultiByteToWideChar(CP_ACP
, 0, pszDir
, -1, wszDir
, MAX_PATH
);
2004 res
= SHGetNewLinkInfoW(wszLinkTo
, wszDir
, wszName
, pfMustCopy
, uFlags
);
2007 WideCharToMultiByte(CP_ACP
, 0, wszName
, -1, pszName
, MAX_PATH
, NULL
, NULL
);
2012 BOOL WINAPI
SHGetNewLinkInfoW(LPCWSTR pszLinkTo
, LPCWSTR pszDir
, LPWSTR pszName
, BOOL
*pfMustCopy
,
2015 const WCHAR
*basename
;
2016 WCHAR
*dst_basename
;
2018 static const WCHAR lnkformat
[] = {'%','s','.','l','n','k',0};
2019 static const WCHAR lnkformatnum
[] = {'%','s',' ','(','%','d',')','.','l','n','k',0};
2021 TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_w(pszLinkTo
), debugstr_w(pszDir
),
2022 pszName
, pfMustCopy
, uFlags
);
2024 *pfMustCopy
= FALSE
;
2026 if (uFlags
& SHGNLI_PIDL
)
2028 FIXME("SHGNLI_PIDL flag unsupported\n");
2033 FIXME("ignoring flags: 0x%08x\n", uFlags
);
2035 /* FIXME: should test if the file is a shortcut or DOS program */
2036 if (GetFileAttributesW(pszLinkTo
) == INVALID_FILE_ATTRIBUTES
)
2039 basename
= strrchrW(pszLinkTo
, '\\');
2041 basename
= basename
+1;
2043 basename
= pszLinkTo
;
2045 lstrcpynW(pszName
, pszDir
, MAX_PATH
);
2046 if (!PathAddBackslashW(pszName
))
2049 dst_basename
= pszName
+ strlenW(pszName
);
2051 snprintfW(dst_basename
, pszName
+ MAX_PATH
- dst_basename
, lnkformat
, basename
);
2053 while (GetFileAttributesW(pszName
) != INVALID_FILE_ATTRIBUTES
)
2055 snprintfW(dst_basename
, pszName
+ MAX_PATH
- dst_basename
, lnkformatnum
, basename
, i
);
2062 /*************************************************************************
2063 * SHStartNetConnectionDialog (SHELL32.@)
2065 HRESULT WINAPI
SHStartNetConnectionDialog(HWND hwnd
, LPCSTR pszRemoteName
, DWORD dwType
)
2067 FIXME("%p, %s, 0x%08x - stub\n", hwnd
, debugstr_a(pszRemoteName
), dwType
);
2071 /*************************************************************************
2072 * SHEmptyRecycleBinA (SHELL32.@)
2074 HRESULT WINAPI
SHEmptyRecycleBinA(HWND hwnd
, LPCSTR pszRootPath
, DWORD dwFlags
)
2076 LPWSTR szRootPathW
= NULL
;
2080 TRACE("%p, %s, 0x%08x\n", hwnd
, debugstr_a(pszRootPath
), dwFlags
);
2084 len
= MultiByteToWideChar(CP_ACP
, 0, pszRootPath
, -1, NULL
, 0);
2086 return HRESULT_FROM_WIN32(GetLastError());
2087 szRootPathW
= (LPWSTR
)HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
2089 return E_OUTOFMEMORY
;
2090 if (MultiByteToWideChar(CP_ACP
, 0, pszRootPath
, -1, szRootPathW
, len
) == 0)
2092 HeapFree(GetProcessHeap(), 0, szRootPathW
);
2093 return HRESULT_FROM_WIN32(GetLastError());
2097 hr
= SHEmptyRecycleBinW(hwnd
, szRootPathW
, dwFlags
);
2098 HeapFree(GetProcessHeap(), 0, szRootPathW
);
2103 HRESULT WINAPI
SHEmptyRecycleBinW(HWND hwnd
, LPCWSTR pszRootPath
, DWORD dwFlags
)
2105 WCHAR szPath
[MAX_PATH
] = {0};
2106 DWORD dwSize
, dwType
;
2109 TRACE("%p, %s, 0x%08x\n", hwnd
, debugstr_w(pszRootPath
), dwFlags
);
2111 if (!(dwFlags
& SHERB_NOCONFIRMATION
))
2114 * enumerate available files
2115 * show confirmation dialog
2117 FIXME("show confirmation dialog\n");
2120 if (dwFlags
& SHERB_NOPROGRESSUI
)
2122 ret
= EmptyRecycleBinW(pszRootPath
);
2127 * show a progress dialog
2129 ret
= EmptyRecycleBinW(pszRootPath
);
2133 return HRESULT_FROM_WIN32(GetLastError());
2135 if (!(dwFlags
& SHERB_NOSOUND
))
2137 dwSize
= sizeof(szPath
);
2138 ret
= RegGetValueW(HKEY_CURRENT_USER
,
2139 L
"AppEvents\\Schemes\\Apps\\Explorer\\EmptyRecycleBin\\.Current",
2141 RRF_RT_REG_EXPAND_SZ
,
2145 if (ret
!= ERROR_SUCCESS
)
2148 if (dwType
!= REG_EXPAND_SZ
) /* type dismatch */
2151 szPath
[(sizeof(szPath
)/sizeof(WCHAR
))-1] = L
'\0';
2152 PlaySoundW(szPath
, NULL
, SND_FILENAME
);
2157 HRESULT WINAPI
SHQueryRecycleBinA(LPCSTR pszRootPath
, LPSHQUERYRBINFO pSHQueryRBInfo
)
2159 LPWSTR szRootPathW
= NULL
;
2163 TRACE("%s, %p\n", debugstr_a(pszRootPath
), pSHQueryRBInfo
);
2167 len
= MultiByteToWideChar(CP_ACP
, 0, pszRootPath
, -1, NULL
, 0);
2169 return HRESULT_FROM_WIN32(GetLastError());
2170 szRootPathW
= (LPWSTR
)HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
2172 return E_OUTOFMEMORY
;
2173 if (MultiByteToWideChar(CP_ACP
, 0, pszRootPath
, -1, szRootPathW
, len
) == 0)
2175 HeapFree(GetProcessHeap(), 0, szRootPathW
);
2176 return HRESULT_FROM_WIN32(GetLastError());
2180 hr
= SHQueryRecycleBinW(szRootPathW
, pSHQueryRBInfo
);
2181 HeapFree(GetProcessHeap(), 0, szRootPathW
);
2186 HRESULT WINAPI
SHQueryRecycleBinW(LPCWSTR pszRootPath
, LPSHQUERYRBINFO pSHQueryRBInfo
)
2188 FIXME("%s, %p - stub\n", debugstr_w(pszRootPath
), pSHQueryRBInfo
);
2190 if (!(pszRootPath
) || (pszRootPath
[0] == 0) ||
2191 !(pSHQueryRBInfo
) || (pSHQueryRBInfo
->cbSize
< sizeof(SHQUERYRBINFO
)))
2193 return E_INVALIDARG
;
2196 pSHQueryRBInfo
->i64Size
= 0;
2197 pSHQueryRBInfo
->i64NumItems
= 0;
2202 /*************************************************************************
2203 * SHSetLocalizedName (SHELL32.@)
2205 EXTERN_C HRESULT WINAPI
SHSetLocalizedName(LPCWSTR pszPath
, LPCWSTR pszResModule
, int idsRes
)
2207 FIXME("%p, %s, %d - stub\n", pszPath
, debugstr_w(pszResModule
), idsRes
);
2212 /*************************************************************************
2213 * LinkWindow_RegisterClass (SHELL32.258)
2215 EXTERN_C BOOL WINAPI
LinkWindow_RegisterClass(void)
2221 /*************************************************************************
2222 * LinkWindow_UnregisterClass (SHELL32.259)
2224 EXTERN_C BOOL WINAPI
LinkWindow_UnregisterClass(void)
2231 /*************************************************************************
2232 * SHFlushSFCache (SHELL32.526)
2234 * Notifies the shell that a user-specified special folder location has changed.
2237 * In Wine, the shell folder registry values are not cached, so this function
2240 EXTERN_C
void WINAPI
SHFlushSFCache(void)
2244 /*************************************************************************
2245 * SHGetImageList (SHELL32.727)
2247 * Returns a copy of a shell image list.
2250 * Windows XP features 4 sizes of image list, and Vista 5. Wine currently
2251 * only supports the traditional small and large image lists, so requests
2252 * for the others will currently fail.
2254 EXTERN_C HRESULT WINAPI
SHGetImageList(int iImageList
, REFIID riid
, void **ppv
)
2256 HIMAGELIST hLarge
, hSmall
;
2258 HRESULT ret
= E_FAIL
;
2260 /* Wine currently only maintains large and small image lists */
2261 if ((iImageList
!= SHIL_LARGE
) && (iImageList
!= SHIL_SMALL
) && (iImageList
!= SHIL_SYSSMALL
))
2263 FIXME("Unsupported image list %i requested\n", iImageList
);
2267 Shell_GetImageLists(&hLarge
, &hSmall
);
2268 hNew
= ImageList_Duplicate(iImageList
== SHIL_LARGE
? hLarge
: hSmall
);
2270 /* Get the interface for the new image list */
2273 IImageList
*imageList
= (IImageList
*) hNew
;
2274 ret
= imageList
->QueryInterface(riid
, ppv
);
2276 ImageList_Destroy(hNew
);
2282 /*************************************************************************
2283 * SHParseDisplayName [shell version 6.0]
2285 EXTERN_C HRESULT WINAPI
SHParseDisplayName(LPCWSTR pszName
, IBindCtx
*pbc
,
2286 LPITEMIDLIST
*ppidl
, SFGAOF sfgaoIn
, SFGAOF
*psfgaoOut
)
2288 CComPtr
<IShellFolder
> psfDesktop
;
2290 ULONG dwAttr
=sfgaoIn
;
2293 return E_INVALIDARG
;
2295 if (!pszName
|| !psfgaoOut
)
2298 return E_INVALIDARG
;
2301 hr
= SHGetDesktopFolder(&psfDesktop
);
2308 hr
= psfDesktop
->ParseDisplayName((HWND
)NULL
, pbc
, (LPOLESTR
)pszName
, (ULONG
*)NULL
, ppidl
, &dwAttr
);
2310 psfDesktop
->Release();
2313 *psfgaoOut
= dwAttr
;