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
23 #include <wine/config.h>
25 #define WIN32_NO_STATUS
33 #include <undocshell.h>
36 #include <commoncontrols.h>
37 #include <recyclebin.h>
40 #include <wine/debug.h>
41 #include <wine/unicode.h>
44 #include "shell32_main.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
47 WINE_DECLARE_DEBUG_CHANNEL(pidl
);
49 /* FIXME: !!! move CREATEMRULIST and flags to header file !!! */
50 /* !!! it is in both here and comctl32undoc.c !!! */
51 typedef struct tagCREATEMRULIST
53 DWORD cbSize
; /* size of struct */
54 DWORD nMaxItems
; /* max no. of items in list */
55 DWORD dwFlags
; /* see below */
56 HKEY hKey
; /* root reg. key under which list is saved */
57 LPCSTR lpszSubKey
; /* reg. subkey */
58 int (CALLBACK
*lpfnCompare
)(LPCVOID
, LPCVOID
, DWORD
); /* item compare proc */
59 } CREATEMRULISTA
, *LPCREATEMRULISTA
;
62 #define MRUF_STRING_LIST 0 /* list will contain strings */
63 #define MRUF_BINARY_LIST 1 /* list will contain binary data */
64 #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
66 extern HANDLE WINAPI
CreateMRUListA(LPCREATEMRULISTA lpcml
);
67 extern VOID WINAPI
FreeMRUList(HANDLE hMRUList
);
68 extern INT WINAPI
AddMRUData(HANDLE hList
, LPCVOID lpData
, DWORD cbData
);
69 extern INT WINAPI
FindMRUData(HANDLE hList
, LPCVOID lpData
, DWORD cbData
, LPINT lpRegNum
);
70 extern INT WINAPI
EnumMRUListA(HANDLE hList
, INT nItemPos
, LPVOID lpBuffer
, DWORD nBufferSize
);
73 /* Get a function pointer from a DLL handle */
74 #define GET_FUNC(func, funcType, module, name, fail) \
77 if (!SHELL32_h##module && !(SHELL32_h##module = LoadLibraryA(#module ".dll"))) return fail; \
78 func = (funcType)GetProcAddress(SHELL32_h##module, name); \
79 if (!func) return fail; \
83 /* Function pointers for GET_FUNC macro */
84 static HMODULE SHELL32_hshlwapi
=NULL
;
87 /*************************************************************************
88 * ParseFieldA [internal]
90 * copies a field from a ',' delimited string
92 * first field is nField = 1
94 DWORD WINAPI
ParseFieldA(
100 WARN("(%s,0x%08x,%p,%d) semi-stub.\n",debugstr_a(src
),nField
,dst
,len
);
102 if (!src
|| !src
[0] || !dst
|| !len
)
105 /* skip n fields delimited by ',' */
108 if (*src
=='\0') return FALSE
;
109 if (*(src
++)==',') nField
--;
112 /* copy part till the next ',' to dst */
113 while ( *src
!='\0' && *src
!=',' && (len
--)>0 ) *(dst
++)=*(src
++);
115 /* finalize the string */
121 /*************************************************************************
122 * ParseFieldW [internal]
124 * copies a field from a ',' delimited string
126 * first field is nField = 1
128 DWORD WINAPI
ParseFieldW(LPCWSTR src
, DWORD nField
, LPWSTR dst
, DWORD len
)
130 WARN("(%s,0x%08x,%p,%d) semi-stub.\n", debugstr_w(src
), nField
, dst
, len
);
132 if (!src
|| !src
[0] || !dst
|| !len
)
135 /* skip n fields delimited by ',' */
138 if (*src
== 0x0) return FALSE
;
139 if (*src
++ == ',') nField
--;
142 /* copy part till the next ',' to dst */
143 while ( *src
!= 0x0 && *src
!= ',' && (len
--)>0 ) *(dst
++) = *(src
++);
145 /* finalize the string */
151 /*************************************************************************
152 * ParseField [SHELL32.58]
154 DWORD WINAPI
ParseFieldAW(LPCVOID src
, DWORD nField
, LPVOID dst
, DWORD len
)
156 if (SHELL_OsIsUnicode())
157 return ParseFieldW(src
, nField
, dst
, len
);
158 return ParseFieldA(src
, nField
, dst
, len
);
161 /*************************************************************************
162 * GetFileNameFromBrowse [SHELL32.63]
165 BOOL WINAPI
GetFileNameFromBrowse(
169 LPCWSTR lpstrInitialDir
,
174 typedef BOOL (WINAPI
*GetOpenFileNameProc
)(OPENFILENAMEW
*ofn
);
176 GetOpenFileNameProc pGetOpenFileNameW
;
180 TRACE("%p, %s, %d, %s, %s, %s, %s)\n",
181 hwndOwner
, debugstr_w(lpstrFile
), nMaxFile
, lpstrInitialDir
, lpstrDefExt
,
182 lpstrFilter
, lpstrTitle
);
184 hmodule
= LoadLibraryW(L
"comdlg32.dll");
185 if(!hmodule
) return FALSE
;
186 pGetOpenFileNameW
= (GetOpenFileNameProc
)GetProcAddress(hmodule
, "GetOpenFileNameW");
187 if(!pGetOpenFileNameW
)
189 FreeLibrary(hmodule
);
193 memset(&ofn
, 0, sizeof(ofn
));
195 ofn
.lStructSize
= sizeof(ofn
);
196 ofn
.hwndOwner
= hwndOwner
;
197 ofn
.lpstrFilter
= lpstrFilter
;
198 ofn
.lpstrFile
= lpstrFile
;
199 ofn
.nMaxFile
= nMaxFile
;
200 ofn
.lpstrInitialDir
= lpstrInitialDir
;
201 ofn
.lpstrTitle
= lpstrTitle
;
202 ofn
.lpstrDefExt
= lpstrDefExt
;
203 ofn
.Flags
= OFN_EXPLORER
| OFN_HIDEREADONLY
| OFN_FILEMUSTEXIST
;
204 ret
= pGetOpenFileNameW(&ofn
);
206 FreeLibrary(hmodule
);
210 /*************************************************************************
211 * SHGetSetSettings [SHELL32.68]
213 VOID WINAPI
SHGetSetSettings(LPSHELLSTATE lpss
, DWORD dwMask
, BOOL bSet
)
217 FIXME("%p 0x%08x TRUE\n", lpss
, dwMask
);
221 SHGetSettings((LPSHELLFLAGSTATE
)lpss
,dwMask
);
225 /*************************************************************************
226 * SHGetSettings [SHELL32.@]
229 * the registry path are for win98 (tested)
230 * and possibly are the same in nt40
233 VOID WINAPI
SHGetSettings(LPSHELLFLAGSTATE lpsfs
, DWORD dwMask
)
237 DWORD dwDataSize
= sizeof (DWORD
);
239 TRACE("(%p 0x%08x)\n",lpsfs
,dwMask
);
241 if (RegCreateKeyExA(HKEY_CURRENT_USER
, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
242 0, 0, 0, KEY_ALL_ACCESS
, 0, &hKey
, 0))
245 if ( (SSF_SHOWEXTENSIONS
& dwMask
) && !RegQueryValueExA(hKey
, "HideFileExt", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
246 lpsfs
->fShowExtensions
= ((dwData
== 0) ? 0 : 1);
248 if ( (SSF_SHOWINFOTIP
& dwMask
) && !RegQueryValueExA(hKey
, "ShowInfoTip", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
249 lpsfs
->fShowInfoTip
= ((dwData
== 0) ? 0 : 1);
251 if ( (SSF_DONTPRETTYPATH
& dwMask
) && !RegQueryValueExA(hKey
, "DontPrettyPath", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
252 lpsfs
->fDontPrettyPath
= ((dwData
== 0) ? 0 : 1);
254 if ( (SSF_HIDEICONS
& dwMask
) && !RegQueryValueExA(hKey
, "HideIcons", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
255 lpsfs
->fHideIcons
= ((dwData
== 0) ? 0 : 1);
257 if ( (SSF_MAPNETDRVBUTTON
& dwMask
) && !RegQueryValueExA(hKey
, "MapNetDrvBtn", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
258 lpsfs
->fMapNetDrvBtn
= ((dwData
== 0) ? 0 : 1);
260 if ( (SSF_SHOWATTRIBCOL
& dwMask
) && !RegQueryValueExA(hKey
, "ShowAttribCol", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
261 lpsfs
->fShowAttribCol
= ((dwData
== 0) ? 0 : 1);
263 if (((SSF_SHOWALLOBJECTS
| SSF_SHOWSYSFILES
) & dwMask
) && !RegQueryValueExA(hKey
, "Hidden", 0, 0, (LPBYTE
)&dwData
, &dwDataSize
))
265 { if (SSF_SHOWALLOBJECTS
& dwMask
) lpsfs
->fShowAllObjects
= 0;
266 if (SSF_SHOWSYSFILES
& dwMask
) lpsfs
->fShowSysFiles
= 0;
268 else if (dwData
== 1)
269 { if (SSF_SHOWALLOBJECTS
& dwMask
) lpsfs
->fShowAllObjects
= 1;
270 if (SSF_SHOWSYSFILES
& dwMask
) lpsfs
->fShowSysFiles
= 0;
272 else if (dwData
== 2)
273 { if (SSF_SHOWALLOBJECTS
& dwMask
) lpsfs
->fShowAllObjects
= 0;
274 if (SSF_SHOWSYSFILES
& dwMask
) lpsfs
->fShowSysFiles
= 1;
279 TRACE("-- 0x%04x\n", *(WORD
*)lpsfs
);
282 /*************************************************************************
283 * SHShellFolderView_Message [SHELL32.73]
285 * Send a message to an explorer cabinet window.
288 * hwndCabinet [I] The window containing the shellview to communicate with
289 * dwMessage [I] The SFVM message to send
290 * dwParam [I] Message parameter
296 * Message SFVM_REARRANGE = 1
298 * This message gets sent when a column gets clicked to instruct the
299 * shell view to re-sort the item list. dwParam identifies the column
302 LRESULT WINAPI
SHShellFolderView_Message(
307 FIXME("%p %08x %08lx stub\n",hwndCabinet
, uMessage
, lParam
);
311 /*************************************************************************
312 * RegisterShellHook [SHELL32.181]
314 * Register a shell hook.
317 * hwnd [I] Window handle
318 * dwType [I] Type of hook.
321 * Exported by ordinal
323 BOOL WINAPI
RegisterShellHook(
328 return RegisterShellHookWindow(hWnd
);
329 else if (dwType
== 0)
330 return DeregisterShellHookWindow(hWnd
);
332 ERR("Unsupported argument");
336 /*************************************************************************
337 * ShellMessageBoxW [SHELL32.182]
339 * See ShellMessageBoxA.
342 * shlwapi.ShellMessageBoxWrapW is a duplicate of shell32.ShellMessageBoxW
343 * because we can't forward to it in the .spec file since it's exported by
344 * ordinal. If you change the implementation here please update the code in
347 int ShellMessageBoxW(
355 WCHAR szText
[100],szTitle
[100];
356 LPCWSTR pszText
= szText
, pszTitle
= szTitle
;
361 __ms_va_start(args
, uType
);
362 /* wvsprintfA(buf,fmt, args); */
364 TRACE("(%p,%p,%p,%p,%08x)\n",
365 hInstance
,hWnd
,lpText
,lpCaption
,uType
);
367 if (IS_INTRESOURCE(lpCaption
))
368 LoadStringW(hInstance
, LOWORD(lpCaption
), szTitle
, sizeof(szTitle
)/sizeof(szTitle
[0]));
370 pszTitle
= lpCaption
;
372 if (IS_INTRESOURCE(lpText
))
373 LoadStringW(hInstance
, LOWORD(lpText
), szText
, sizeof(szText
)/sizeof(szText
[0]));
377 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_STRING
,
378 pszText
, 0, 0, (LPWSTR
)&pszTemp
, 0, &args
);
382 ret
= MessageBoxW(hWnd
,pszTemp
,pszTitle
,uType
);
387 /*************************************************************************
388 * ShellMessageBoxA [SHELL32.183]
390 * Format and output an error message.
393 * hInstance [I] Instance handle of message creator
394 * hWnd [I] Window handle of message creator
395 * lpText [I] Resource Id of title or LPSTR
396 * lpCaption [I] Resource Id of title or LPSTR
397 * uType [I] Type of error message
400 * A return value from MessageBoxA().
403 * Exported by ordinal
405 int ShellMessageBoxA(
413 char szText
[100],szTitle
[100];
414 LPCSTR pszText
= szText
, pszTitle
= szTitle
;
419 __ms_va_start(args
, uType
);
420 /* wvsprintfA(buf,fmt, args); */
422 TRACE("(%p,%p,%p,%p,%08x)\n",
423 hInstance
,hWnd
,lpText
,lpCaption
,uType
);
425 if (IS_INTRESOURCE(lpCaption
))
426 LoadStringA(hInstance
, LOWORD(lpCaption
), szTitle
, sizeof(szTitle
));
428 pszTitle
= lpCaption
;
430 if (IS_INTRESOURCE(lpText
))
431 LoadStringA(hInstance
, LOWORD(lpText
), szText
, sizeof(szText
));
435 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_STRING
,
436 pszText
, 0, 0, (LPSTR
)&pszTemp
, 0, &args
);
440 ret
= MessageBoxA(hWnd
,pszTemp
,pszTitle
,uType
);
445 /*************************************************************************
446 * SHRegisterDragDrop [SHELL32.86]
448 * Probably equivalent to RegisterDragDrop 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. Under Windows 98 this function initializes the true OLE when called
451 * the first time, on XP always returns E_OUTOFMEMORY and it got removed from Vista.
453 * We follow Windows 98 behaviour.
456 * exported by ordinal
459 * RegisterDragDrop, SHLoadOLE
461 HRESULT WINAPI
SHRegisterDragDrop(
463 LPDROPTARGET pDropTarget
)
465 static BOOL ole_initialized
= FALSE
;
468 TRACE("(%p,%p)\n", hWnd
, pDropTarget
);
470 if (!ole_initialized
)
472 hr
= OleInitialize(NULL
);
475 ole_initialized
= TRUE
;
477 return RegisterDragDrop(hWnd
, pDropTarget
);
480 /*************************************************************************
481 * SHRevokeDragDrop [SHELL32.87]
483 * Probably equivalent to RevokeDragDrop but under Windows 95 it could use the
484 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
485 * for details. Function removed from Windows Vista.
487 * We call ole32 RevokeDragDrop which seems to work even if OleInitialize was
491 * exported by ordinal
494 * RevokeDragDrop, SHLoadOLE
496 HRESULT WINAPI
SHRevokeDragDrop(HWND hWnd
)
498 TRACE("(%p)\n", hWnd
);
499 return RevokeDragDrop(hWnd
);
502 /*************************************************************************
503 * SHDoDragDrop [SHELL32.88]
505 * Probably equivalent to DoDragDrop but under Windows 9x it could use the
506 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
510 * exported by ordinal
513 * DoDragDrop, SHLoadOLE
515 HRESULT WINAPI
SHDoDragDrop(
517 LPDATAOBJECT lpDataObject
,
518 LPDROPSOURCE lpDropSource
,
522 FIXME("(%p %p %p 0x%08x %p):stub.\n",
523 hWnd
, lpDataObject
, lpDropSource
, dwOKEffect
, pdwEffect
);
524 return DoDragDrop(lpDataObject
, lpDropSource
, dwOKEffect
, pdwEffect
);
527 /*************************************************************************
528 * ArrangeWindows [SHELL32.184]
531 WORD WINAPI
ArrangeWindows(HWND hwndParent
, DWORD dwReserved
, const RECT
*lpRect
,
532 WORD cKids
, const HWND
*lpKids
)
534 /* Unimplemented in WinXP SP3 */
535 TRACE("(%p 0x%08x %p 0x%04x %p):stub.\n",
536 hwndParent
, dwReserved
, lpRect
, cKids
, lpKids
);
540 /*************************************************************************
541 * SignalFileOpen [SHELL32.103]
544 * exported by ordinal
547 SignalFileOpen (PCIDLIST_ABSOLUTE pidl
)
549 FIXME("(%p):stub.\n", pidl
);
554 /*************************************************************************
555 * SHADD_get_policy - helper function for SHAddToRecentDocs
558 * policy [IN] policy name (null termed string) to find
559 * type [OUT] ptr to DWORD to receive type
560 * buffer [OUT] ptr to area to hold data retrieved
561 * len [IN/OUT] ptr to DWORD holding size of buffer and getting
565 * result of the SHQueryValueEx call
567 static INT
SHADD_get_policy(LPCSTR policy
, LPDWORD type
, LPVOID buffer
, LPDWORD len
)
572 /* Get the key for the policies location in the registry
574 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE
,
575 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
576 0, KEY_READ
, &Policy_basekey
)) {
578 if (RegOpenKeyExA(HKEY_CURRENT_USER
,
579 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
580 0, KEY_READ
, &Policy_basekey
)) {
581 TRACE("No Explorer Policies location exists. Policy wanted=%s\n",
584 return ERROR_FILE_NOT_FOUND
;
588 /* Retrieve the data if it exists
590 ret
= SHQueryValueExA(Policy_basekey
, policy
, 0, type
, buffer
, len
);
591 RegCloseKey(Policy_basekey
);
596 /*************************************************************************
597 * SHADD_compare_mru - helper function for SHAddToRecentDocs
600 * data1 [IN] data being looked for
601 * data2 [IN] data in MRU
602 * cbdata [IN] length from FindMRUData call (not used)
605 * position within MRU list that data was added.
607 static INT CALLBACK
SHADD_compare_mru(LPCVOID data1
, LPCVOID data2
, DWORD cbData
)
609 return lstrcmpiA(data1
, data2
);
612 /*************************************************************************
613 * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs
616 * mruhandle [IN] handle for created MRU list
617 * doc_name [IN] null termed pure doc name
618 * new_lnk_name [IN] null termed path and file name for .lnk file
619 * buffer [IN/OUT] 2048 byte area to construct MRU data
620 * len [OUT] ptr to int to receive space used in buffer
623 * position within MRU list that data was added.
625 static INT
SHADD_create_add_mru_data(HANDLE mruhandle
, LPCSTR doc_name
, LPCSTR new_lnk_name
,
626 LPSTR buffer
, INT
*len
)
632 * RecentDocs MRU data structure seems to be:
633 * +0h document file name w/ terminating 0h
634 * +nh short int w/ size of remaining
635 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
636 * +n+4h 10 bytes zeros - unknown
637 * +n+eh shortcut file name w/ terminating 0h
638 * +n+e+nh 3 zero bytes - unknown
641 /* Create the MRU data structure for "RecentDocs"
644 lstrcpyA(ptr
, doc_name
);
645 ptr
+= (lstrlenA(buffer
) + 1);
646 wlen
= lstrlenA(new_lnk_name
) + 1 + 12;
647 *((short int*)ptr
) = wlen
;
648 ptr
+= 2; /* step past the length */
649 *(ptr
++) = 0x30; /* unknown reason */
650 *(ptr
++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */
653 lstrcpyA(ptr
, new_lnk_name
);
654 ptr
+= (lstrlenA(new_lnk_name
) + 1);
659 /* Add the new entry into the MRU list
661 return AddMRUData(mruhandle
, buffer
, *len
);
664 /*************************************************************************
665 * SHAddToRecentDocs [SHELL32.@]
667 * Modify (add/clear) Shell's list of recently used documents.
670 * uFlags [IN] SHARD_PATHA, SHARD_PATHW or SHARD_PIDL
671 * pv [IN] string or pidl, NULL clears the list
679 void WINAPI
SHAddToRecentDocs (UINT uFlags
,LPCVOID pv
)
681 /* If list is a string list lpfnCompare has the following prototype
682 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
683 * for binary lists the prototype is
684 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
685 * where cbData is the no. of bytes to compare.
686 * Need to check what return value means identical - 0?
692 CHAR doc_name
[MAX_PATH
];
693 CHAR link_dir
[MAX_PATH
];
694 CHAR new_lnk_filepath
[MAX_PATH
];
695 CHAR new_lnk_name
[MAX_PATH
];
699 HWND hwnd
= 0; /* FIXME: get real window handle */
701 DWORD data
[64], datalen
, type
;
703 TRACE("%04x %p\n", uFlags
, pv
);
706 * RecentDocs MRU data structure seems to be:
707 * +0h document file name w/ terminating 0h
708 * +nh short int w/ size of remaining
709 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
710 * +n+4h 10 bytes zeros - unknown
711 * +n+eh shortcut file name w/ terminating 0h
712 * +n+e+nh 3 zero bytes - unknown
715 /* See if we need to do anything.
718 ret
=SHADD_get_policy( "NoRecentDocsHistory", &type
, data
, &datalen
);
719 if ((ret
> 0) && (ret
!= ERROR_FILE_NOT_FOUND
)) {
720 ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret
);
723 if (ret
== ERROR_SUCCESS
) {
724 if (!( (type
== REG_DWORD
) ||
725 ((type
== REG_BINARY
) && (datalen
== 4)) )) {
726 ERR("Error policy data for \"NoRecentDocsHistory\" not formatted correctly, type=%d, len=%d\n",
731 TRACE("policy value for NoRecentDocsHistory = %08x\n", data
[0]);
732 /* now test the actual policy value */
737 /* Open key to where the necessary info is
739 /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH)
740 * and the close should be done during the _DETACH. The resulting
741 * key is stored in the DLL global data.
743 if (RegCreateKeyExA(HKEY_CURRENT_USER
,
744 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
745 0, 0, 0, KEY_READ
, 0, &HCUbasekey
, 0)) {
746 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n");
750 /* Get path to user's "Recent" directory
752 if(SUCCEEDED(SHGetMalloc(&ppM
))) {
753 if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd
, CSIDL_RECENT
,
755 SHGetPathFromIDListA(pidl
, link_dir
);
756 IMalloc_Free(ppM
, pidl
);
761 ERR("serious issues 1\n");
763 IMalloc_Release(ppM
);
768 ERR("serious issues 2\n");
770 TRACE("Users Recent dir %s\n", link_dir
);
772 /* If no input, then go clear the lists */
774 /* clear user's Recent dir
777 /* FIXME: delete all files in "link_dir"
779 * while( more files ) {
780 * lstrcpyA(old_lnk_name, link_dir);
781 * PathAppendA(old_lnk_name, filenam);
782 * DeleteFileA(old_lnk_name);
785 FIXME("should delete all files in %s\\\n", link_dir
);
789 /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against
790 * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer
791 * and naturally it fails w/ rc=2. It should do it against
792 * HKEY_CURRENT_USER which is where it is stored, and where
793 * the MRU routines expect it!!!!
795 RegDeleteKeyA(HCUbasekey
, "RecentDocs");
796 RegCloseKey(HCUbasekey
);
800 /* Have data to add, the jobs to be done:
801 * 1. Add document to MRU list in registry "HKCU\Software\
802 * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs".
803 * 2. Add shortcut to document in the user's Recent directory
805 * 3. Add shortcut to Start menu's Documents submenu.
808 /* Get the pure document name from the input
813 SHGetPathFromIDListA(pv
, doc_name
);
817 lstrcpynA(doc_name
, pv
, MAX_PATH
);
821 WideCharToMultiByte(CP_ACP
, 0, pv
, -1, doc_name
, MAX_PATH
, NULL
, NULL
);
825 FIXME("Unsupported flags: %u\n", uFlags
);
829 TRACE("full document name %s\n", debugstr_a(doc_name
));
832 /* check if file is a shortcut */
833 ext
= strrchr(doc_name
, '.');
834 if (!lstrcmpiA(ext
, ".lnk"))
836 IShellLinkA
* ShellLink
;
837 IShellLink_ConstructFromFile(NULL
, &IID_IShellLinkA
, (LPCITEMIDLIST
)SHSimpleIDListFromPathA(doc_name
), (LPVOID
*)&ShellLink
);
838 IShellLinkA_GetPath(ShellLink
, doc_name
, MAX_PATH
, NULL
, 0);
839 IShellLinkA_Release(ShellLink
);
842 ext
= strrchr(doc_name
, '.');
843 if (!lstrcmpiA(ext
, ".exe"))
845 /* executables are not added */
850 PathStripPathA(doc_name
);
851 TRACE("stripped document name %s\n", debugstr_a(doc_name
));
854 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
857 * doc_name - pure file-spec, no path
858 * link_dir - path to the user's Recent directory
859 * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node
861 * new_lnk_name- pure file-spec, no path for new .lnk file
863 * - path and file name of new .lnk file
865 CREATEMRULISTA mymru
;
867 INT len
, pos
, bufused
, err
;
872 CHAR old_lnk_name
[MAX_PATH
];
875 mymru
.cbSize
= sizeof(CREATEMRULISTA
);
876 mymru
.nMaxItems
= 15;
877 mymru
.dwFlags
= MRUF_BINARY_LIST
| MRUF_DELAYED_SAVE
;
878 mymru
.hKey
= HCUbasekey
;
879 mymru
.lpszSubKey
= "RecentDocs";
880 mymru
.lpfnCompare
= SHADD_compare_mru
;
881 mruhandle
= CreateMRUListA(&mymru
);
884 ERR("MRU processing failed, handle zero\n");
885 RegCloseKey(HCUbasekey
);
888 len
= lstrlenA(doc_name
);
889 pos
= FindMRUData(mruhandle
, doc_name
, len
, 0);
891 /* Now get the MRU entry that will be replaced
892 * and delete the .lnk file for it
894 if ((bufused
= EnumMRUListA(mruhandle
, (pos
== -1) ? 14 : pos
,
895 buffer
, 2048)) != -1) {
897 ptr
+= (lstrlenA(buffer
) + 1);
898 slen
= *((short int*)ptr
);
899 ptr
+= 2; /* skip the length area */
900 if (bufused
>= slen
+ (ptr
-buffer
)) {
901 /* buffer size looks good */
902 ptr
+= 12; /* get to string */
903 len
= bufused
- (ptr
-buffer
); /* get length of buf remaining */
904 if ((lstrlenA(ptr
) > 0) && (lstrlenA(ptr
) <= len
-1)) {
905 /* appears to be good string */
906 lstrcpyA(old_lnk_name
, link_dir
);
907 PathAppendA(old_lnk_name
, ptr
);
908 if (!DeleteFileA(old_lnk_name
)) {
909 if ((attr
= GetFileAttributesA(old_lnk_name
)) == INVALID_FILE_ATTRIBUTES
) {
910 if ((err
= GetLastError()) != ERROR_FILE_NOT_FOUND
) {
911 ERR("Delete for %s failed, err=%d, attr=%08x\n",
912 old_lnk_name
, err
, attr
);
915 TRACE("old .lnk file %s did not exist\n",
920 ERR("Delete for %s failed, attr=%08x\n",
925 TRACE("deleted old .lnk file %s\n", old_lnk_name
);
931 /* Create usable .lnk file name for the "Recent" directory
933 wsprintfA(new_lnk_name
, "%s.lnk", doc_name
);
934 lstrcpyA(new_lnk_filepath
, link_dir
);
935 PathAppendA(new_lnk_filepath
, new_lnk_name
);
937 olderrormode
= SetErrorMode(SEM_FAILCRITICALERRORS
);
938 while (GetFileAttributesA(new_lnk_filepath
) != INVALID_FILE_ATTRIBUTES
) {
940 wsprintfA(new_lnk_name
, "%s (%u).lnk", doc_name
, i
);
941 lstrcpyA(new_lnk_filepath
, link_dir
);
942 PathAppendA(new_lnk_filepath
, new_lnk_name
);
944 SetErrorMode(olderrormode
);
945 TRACE("new shortcut will be %s\n", new_lnk_filepath
);
947 /* Now add the new MRU entry and data
949 pos
= SHADD_create_add_mru_data(mruhandle
, doc_name
, new_lnk_name
,
951 FreeMRUList(mruhandle
);
952 TRACE("Updated MRU list, new doc is position %d\n", pos
);
955 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
958 * doc_name - pure file-spec, no path
960 * - path and file name of new .lnk file
961 * uFlags[in] - flags on call to SHAddToRecentDocs
962 * pv[in] - document path/pidl on call to SHAddToRecentDocs
964 IShellLinkA
*psl
= NULL
;
965 IPersistFile
*pPf
= NULL
;
968 WCHAR widelink
[MAX_PATH
];
972 hres
= CoCreateInstance( &CLSID_ShellLink
,
974 CLSCTX_INPROC_SERVER
,
977 if(SUCCEEDED(hres
)) {
979 hres
= IShellLinkA_QueryInterface(psl
, &IID_IPersistFile
,
983 ERR("failed QueryInterface for IPersistFile %08x\n", hres
);
987 /* Set the document path or pidl */
988 if (uFlags
== SHARD_PIDL
) {
989 hres
= IShellLinkA_SetIDList(psl
, pv
);
991 hres
= IShellLinkA_SetPath(psl
, pv
);
995 ERR("failed Set{IDList|Path} %08x\n", hres
);
999 lstrcpyA(desc
, "Shortcut to ");
1000 lstrcatA(desc
, doc_name
);
1001 hres
= IShellLinkA_SetDescription(psl
, desc
);
1004 ERR("failed SetDescription %08x\n", hres
);
1008 MultiByteToWideChar(CP_ACP
, 0, new_lnk_filepath
, -1,
1009 widelink
, MAX_PATH
);
1010 /* create the short cut */
1011 hres
= IPersistFile_Save(pPf
, widelink
, TRUE
);
1014 ERR("failed IPersistFile::Save %08x\n", hres
);
1015 IPersistFile_Release(pPf
);
1016 IShellLinkA_Release(psl
);
1019 hres
= IPersistFile_SaveCompleted(pPf
, widelink
);
1020 IPersistFile_Release(pPf
);
1021 IShellLinkA_Release(psl
);
1022 TRACE("shortcut %s has been created, result=%08x\n",
1023 new_lnk_filepath
, hres
);
1026 ERR("CoCreateInstance failed, hres=%08x\n", hres
);
1034 RegCloseKey(HCUbasekey
);
1038 /*************************************************************************
1039 * SHCreateShellFolderViewEx [SHELL32.174]
1041 * Create a new instance of the default Shell folder view object.
1045 * Failure: error value
1048 * see IShellFolder::CreateViewObject
1050 HRESULT WINAPI
SHCreateShellFolderViewEx(
1051 LPCSFV psvcbi
, /* [in] shelltemplate struct */
1052 IShellView
**ppv
) /* [out] IShellView pointer */
1057 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n",
1058 psvcbi
->pshf
, psvcbi
->pidl
, psvcbi
->pfnCallback
,
1059 psvcbi
->fvm
, psvcbi
->psvOuter
);
1062 hRes
= IShellView_Constructor(psvcbi
->pshf
, &psf
);
1067 hRes
= IShellView_QueryInterface(psf
, &IID_IShellView
, (LPVOID
*)ppv
);
1068 IShellView_Release(psf
);
1072 /*************************************************************************
1073 * SHWinHelp [SHELL32.127]
1076 HRESULT WINAPI
SHWinHelp (DWORD v
, DWORD w
, DWORD x
, DWORD z
)
1077 { FIXME("0x%08x 0x%08x 0x%08x 0x%08x stub\n",v
,w
,x
,z
);
1080 /*************************************************************************
1081 * SHRunControlPanel [SHELL32.161]
1084 BOOL WINAPI
SHRunControlPanel (LPCWSTR commandLine
, HWND parent
)
1086 FIXME("(%s, %p): stub\n", debugstr_w(commandLine
), parent
);
1090 static LPUNKNOWN SHELL32_IExplorerInterface
=0;
1091 /*************************************************************************
1092 * SHSetInstanceExplorer [SHELL32.176]
1095 * Sets the interface
1097 VOID WINAPI
SHSetInstanceExplorer (LPUNKNOWN lpUnknown
)
1098 { TRACE("%p\n", lpUnknown
);
1099 SHELL32_IExplorerInterface
= lpUnknown
;
1101 /*************************************************************************
1102 * SHGetInstanceExplorer [SHELL32.@]
1105 * gets the interface pointer of the explorer and a reference
1107 HRESULT WINAPI
SHGetInstanceExplorer (IUnknown
**lpUnknown
)
1108 { TRACE("%p\n", lpUnknown
);
1110 *lpUnknown
= SHELL32_IExplorerInterface
;
1112 if (!SHELL32_IExplorerInterface
)
1115 IUnknown_AddRef(SHELL32_IExplorerInterface
);
1118 /*************************************************************************
1119 * SHFreeUnusedLibraries [SHELL32.123]
1121 * Probably equivalent to CoFreeUnusedLibraries but under Windows 9x it could use
1122 * the shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
1126 * exported by ordinal
1129 * CoFreeUnusedLibraries, SHLoadOLE
1131 void WINAPI
SHFreeUnusedLibraries (void)
1134 CoFreeUnusedLibraries();
1136 /*************************************************************************
1137 * DAD_AutoScroll [SHELL32.129]
1140 BOOL WINAPI
DAD_AutoScroll(HWND hwnd
, AUTO_SCROLL_DATA
*samples
, const POINT
* pt
)
1142 FIXME("hwnd = %p %p %p\n",hwnd
,samples
,pt
);
1145 /*************************************************************************
1146 * DAD_DragEnter [SHELL32.130]
1149 BOOL WINAPI
DAD_DragEnter(HWND hwnd
)
1151 FIXME("hwnd = %p\n",hwnd
);
1154 /*************************************************************************
1155 * DAD_DragEnterEx [SHELL32.131]
1158 BOOL WINAPI
DAD_DragEnterEx(HWND hwnd
, POINT p
)
1160 FIXME("hwnd = %p (%d,%d)\n",hwnd
,p
.x
,p
.y
);
1163 /*************************************************************************
1164 * DAD_DragMove [SHELL32.134]
1167 BOOL WINAPI
DAD_DragMove(POINT p
)
1169 FIXME("(%d,%d)\n",p
.x
,p
.y
);
1172 /*************************************************************************
1173 * DAD_DragLeave [SHELL32.132]
1176 BOOL WINAPI
DAD_DragLeave(VOID
)
1181 /*************************************************************************
1182 * DAD_SetDragImage [SHELL32.136]
1187 BOOL WINAPI
DAD_SetDragImage(
1188 HIMAGELIST himlTrack
,
1191 FIXME("%p %p stub\n",himlTrack
, lppt
);
1194 /*************************************************************************
1195 * DAD_ShowDragImage [SHELL32.137]
1200 BOOL WINAPI
DAD_ShowDragImage(BOOL bShow
)
1202 FIXME("0x%08x stub\n",bShow
);
1206 static const WCHAR szwCabLocation
[] = {
1207 'S','o','f','t','w','a','r','e','\\',
1208 'M','i','c','r','o','s','o','f','t','\\',
1209 'W','i','n','d','o','w','s','\\',
1210 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
1211 'E','x','p','l','o','r','e','r','\\',
1212 'C','a','b','i','n','e','t','S','t','a','t','e',0
1215 static const WCHAR szwSettings
[] = { 'S','e','t','t','i','n','g','s',0 };
1217 /*************************************************************************
1218 * ReadCabinetState [SHELL32.651] NT 4.0
1221 BOOL WINAPI
ReadCabinetState(CABINETSTATE
*cs
, int length
)
1226 TRACE("%p %d\n", cs
, length
);
1228 if( (cs
== NULL
) || (length
< (int)sizeof(*cs
)) )
1231 r
= RegOpenKeyW( HKEY_CURRENT_USER
, szwCabLocation
, &hkey
);
1232 if( r
== ERROR_SUCCESS
)
1235 r
= RegQueryValueExW( hkey
, szwSettings
,
1236 NULL
, &type
, (LPBYTE
)cs
, (LPDWORD
)&length
);
1237 RegCloseKey( hkey
);
1241 /* if we can't read from the registry, create default values */
1242 if ( (r
!= ERROR_SUCCESS
) || (cs
->cLength
< sizeof(*cs
)) ||
1243 (cs
->cLength
!= length
) )
1245 ERR("Initializing shell cabinet settings\n");
1246 memset(cs
, 0, sizeof(*cs
));
1247 cs
->cLength
= sizeof(*cs
);
1249 cs
->fFullPathTitle
= FALSE
;
1250 cs
->fSaveLocalView
= TRUE
;
1251 cs
->fNotShell
= FALSE
;
1252 cs
->fSimpleDefault
= TRUE
;
1253 cs
->fDontShowDescBar
= FALSE
;
1254 cs
->fNewWindowMode
= FALSE
;
1255 cs
->fShowCompColor
= FALSE
;
1256 cs
->fDontPrettyNames
= FALSE
;
1257 cs
->fAdminsCreateCommonGroups
= TRUE
;
1258 cs
->fMenuEnumFilter
= 96;
1264 /*************************************************************************
1265 * WriteCabinetState [SHELL32.652] NT 4.0
1268 BOOL WINAPI
WriteCabinetState(CABINETSTATE
*cs
)
1278 r
= RegCreateKeyExW( HKEY_CURRENT_USER
, szwCabLocation
, 0,
1279 NULL
, 0, KEY_ALL_ACCESS
, NULL
, &hkey
, NULL
);
1280 if( r
== ERROR_SUCCESS
)
1282 r
= RegSetValueExW( hkey
, szwSettings
, 0,
1283 REG_BINARY
, (LPBYTE
) cs
, cs
->cLength
);
1285 RegCloseKey( hkey
);
1288 return (r
==ERROR_SUCCESS
);
1291 /*************************************************************************
1292 * FileIconInit [SHELL32.660]
1295 BOOL WINAPI
FileIconInit(BOOL bFullInit
)
1296 { FIXME("(%s)\n", bFullInit
? "true" : "false");
1300 /*************************************************************************
1301 * IsUserAnAdmin [SHELL32.680] NT 4.0
1303 * Checks whether the current user is a member of the Administrators group.
1312 BOOL WINAPI
IsUserAnAdmin(VOID
)
1314 SID_IDENTIFIER_AUTHORITY Authority
= {SECURITY_NT_AUTHORITY
};
1317 PTOKEN_GROUPS lpGroups
;
1320 BOOL bResult
= FALSE
;
1323 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY
, &hToken
))
1328 if (!GetTokenInformation(hToken
, TokenGroups
, NULL
, 0, &dwSize
))
1330 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER
)
1332 CloseHandle(hToken
);
1337 lpGroups
= HeapAlloc(GetProcessHeap(), 0, dwSize
);
1338 if (lpGroups
== NULL
)
1340 CloseHandle(hToken
);
1344 if (!GetTokenInformation(hToken
, TokenGroups
, lpGroups
, dwSize
, &dwSize
))
1346 HeapFree(GetProcessHeap(), 0, lpGroups
);
1347 CloseHandle(hToken
);
1351 CloseHandle(hToken
);
1352 if (!AllocateAndInitializeSid(&Authority
, 2, SECURITY_BUILTIN_DOMAIN_RID
,
1353 DOMAIN_ALIAS_RID_ADMINS
, 0, 0, 0, 0, 0, 0,
1356 HeapFree(GetProcessHeap(), 0, lpGroups
);
1360 for (i
= 0; i
< lpGroups
->GroupCount
; i
++)
1362 if (EqualSid(lpSid
, lpGroups
->Groups
[i
].Sid
))
1370 HeapFree(GetProcessHeap(), 0, lpGroups
);
1374 /*************************************************************************
1375 * SHAllocShared [SHELL32.520]
1377 * See shlwapi.SHAllocShared
1379 HANDLE WINAPI
SHAllocShared(LPCVOID lpvData
, DWORD dwSize
, DWORD dwProcId
)
1381 typedef HANDLE (WINAPI
*SHAllocSharedProc
)(LPCVOID
, DWORD
, DWORD
);
1382 static SHAllocSharedProc pSHAllocShared
;
1384 GET_FUNC(pSHAllocShared
, SHAllocSharedProc
, shlwapi
, (char*)7, NULL
);
1385 return pSHAllocShared(lpvData
, dwSize
, dwProcId
);
1388 /*************************************************************************
1389 * SHLockShared [SHELL32.521]
1391 * See shlwapi.SHLockShared
1393 LPVOID WINAPI
SHLockShared(HANDLE hShared
, DWORD dwProcId
)
1395 typedef HANDLE (WINAPI
*SHLockSharedProc
)(HANDLE
, DWORD
);
1396 static SHLockSharedProc pSHLockShared
;
1398 GET_FUNC(pSHLockShared
, SHLockSharedProc
, shlwapi
, (char*)8, NULL
);
1399 return pSHLockShared(hShared
, dwProcId
);
1402 /*************************************************************************
1403 * SHUnlockShared [SHELL32.522]
1405 * See shlwapi.SHUnlockShared
1407 BOOL WINAPI
SHUnlockShared(LPVOID lpView
)
1409 typedef HANDLE (WINAPI
*SHUnlockSharedProc
)(LPCVOID
);
1410 static SHUnlockSharedProc pSHUnlockShared
;
1412 GET_FUNC(pSHUnlockShared
, SHUnlockSharedProc
, shlwapi
, (char*)9, FALSE
);
1413 return pSHUnlockShared(lpView
) != NULL
;
1416 /*************************************************************************
1417 * SHFreeShared [SHELL32.523]
1419 * See shlwapi.SHFreeShared
1421 BOOL WINAPI
SHFreeShared(HANDLE hShared
, DWORD dwProcId
)
1423 typedef HANDLE (WINAPI
*SHFreeSharedProc
)(HANDLE
, DWORD
);
1424 static SHFreeSharedProc pSHFreeShared
;
1426 GET_FUNC(pSHFreeShared
, SHFreeSharedProc
, shlwapi
, (char*)10, FALSE
);
1427 return pSHFreeShared(hShared
, dwProcId
) != NULL
;
1430 /*************************************************************************
1431 * SetAppStartingCursor [SHELL32.99]
1433 HRESULT WINAPI
SetAppStartingCursor(HWND u
, DWORD v
)
1434 { FIXME("hwnd=%p 0x%04x stub\n",u
,v
);
1438 /*************************************************************************
1439 * SHLoadOLE [SHELL32.151]
1441 * To reduce the memory usage of Windows 95, its shell32 contained an
1442 * internal implementation of a part of COM (see e.g. SHGetMalloc, SHCoCreateInstance,
1443 * SHRegisterDragDrop etc.) that allowed to use in-process STA objects without
1444 * the need to load OLE32.DLL. If OLE32.DLL was already loaded, the SH* function
1445 * would just call the Co* functions.
1447 * The SHLoadOLE was called when OLE32.DLL was being loaded to transfer all the
1448 * information from the shell32 "mini-COM" to ole32.dll.
1450 * See http://blogs.msdn.com/oldnewthing/archive/2004/07/05/173226.aspx for a
1451 * detailed description.
1453 * Under wine ole32.dll is always loaded as it is imported by shlwapi.dll which is
1454 * imported by shell32 and no "mini-COM" is used (except for the "LoadWithoutCOM"
1455 * hack in SHCoCreateInstance)
1457 HRESULT WINAPI
SHLoadOLE(LPARAM lParam
)
1458 { FIXME("0x%08lx stub\n",lParam
);
1461 /*************************************************************************
1462 * DriveType [SHELL32.64]
1465 int WINAPI
DriveType(int DriveType
)
1467 WCHAR root
[] = L
"A:\\";
1468 root
[0] = L
'A' + DriveType
;
1469 return GetDriveTypeW(root
);
1471 /*************************************************************************
1472 * InvalidateDriveType [SHELL32.65]
1473 * Unimplemented in XP SP3
1475 int WINAPI
InvalidateDriveType(int u
)
1477 TRACE("0x%08x stub\n",u
);
1480 /*************************************************************************
1481 * SHAbortInvokeCommand [SHELL32.198]
1484 HRESULT WINAPI
SHAbortInvokeCommand(void)
1488 /*************************************************************************
1489 * SHOutOfMemoryMessageBox [SHELL32.126]
1492 int WINAPI
SHOutOfMemoryMessageBox(
1497 FIXME("%p %s 0x%08x stub\n",hwndOwner
, lpCaption
, uType
);
1500 /*************************************************************************
1501 * SHFlushClipboard [SHELL32.121]
1504 HRESULT WINAPI
SHFlushClipboard(void)
1506 return OleFlushClipboard();
1509 /*************************************************************************
1510 * SHWaitForFileToOpen [SHELL32.97]
1513 BOOL WINAPI
SHWaitForFileToOpen(
1518 FIXME("%p 0x%08x 0x%08x stub\n", pidl
, dwFlags
, dwTimeout
);
1522 /************************************************************************
1523 * RLBuildListOfPaths [SHELL32.146]
1528 DWORD WINAPI
RLBuildListOfPaths (void)
1532 /************************************************************************
1533 * SHValidateUNC [SHELL32.173]
1536 BOOL WINAPI
SHValidateUNC (HWND hwndOwner
, PWSTR pszFile
, UINT fConnect
)
1538 FIXME("(%p, %s, 0x%08x): stub\n", hwndOwner
, debugstr_w(pszFile
), fConnect
);
1542 /************************************************************************
1543 * DoEnvironmentSubstA [SHELL32.@]
1545 * See DoEnvironmentSubstW.
1547 DWORD WINAPI
DoEnvironmentSubstA(LPSTR pszString
, UINT cchString
)
1551 DWORD len
= cchString
;
1553 TRACE("(%s, %d)\n", debugstr_a(pszString
), cchString
);
1554 if (pszString
== NULL
) /* Really return 0? */
1556 if ((dst
= (LPSTR
)HeapAlloc(GetProcessHeap(), 0, cchString
* sizeof(CHAR
))))
1558 len
= ExpandEnvironmentStringsA(pszString
, dst
, cchString
);
1559 /* len includes the terminating 0 */
1560 if (len
&& len
< cchString
)
1563 memcpy(pszString
, dst
, len
);
1568 HeapFree(GetProcessHeap(), 0, dst
);
1570 return MAKELONG(len
, res
);
1573 /************************************************************************
1574 * DoEnvironmentSubstW [SHELL32.@]
1576 * Replace all %KEYWORD% in the string with the value of the named
1577 * environment variable. If the buffer is too small, the string is not modified.
1580 * pszString [I] '\0' terminated string with %keyword%.
1581 * [O] '\0' terminated string with %keyword% substituted.
1582 * cchString [I] size of str.
1585 * Success: The string in the buffer is updated
1587 * LOWORD: characters used in the buffer, including space for the terminating 0
1588 * Failure: buffer too small. The string is not modified.
1590 * LOWORD: provided size of the buffer in characters
1592 DWORD WINAPI
DoEnvironmentSubstW(LPWSTR pszString
, UINT cchString
)
1596 DWORD len
= cchString
;
1598 TRACE("(%s, %d)\n", debugstr_w(pszString
), cchString
);
1600 if ((cchString
< MAXLONG
) && (dst
= HeapAlloc(GetProcessHeap(), 0, cchString
* sizeof(WCHAR
))))
1602 len
= ExpandEnvironmentStringsW(pszString
, dst
, cchString
);
1603 /* len includes the terminating 0 */
1604 if (len
&& len
<= cchString
)
1607 memcpy(pszString
, dst
, len
* sizeof(WCHAR
));
1612 HeapFree(GetProcessHeap(), 0, dst
);
1614 return MAKELONG(len
, res
);
1617 /************************************************************************
1618 * DoEnvironmentSubst [SHELL32.53]
1620 * See DoEnvironmentSubstA.
1622 DWORD WINAPI
DoEnvironmentSubstAW(LPVOID x
, UINT y
)
1624 if (SHELL_OsIsUnicode())
1625 return DoEnvironmentSubstW(x
, y
);
1626 return DoEnvironmentSubstA(x
, y
);
1629 /*************************************************************************
1630 * GUIDFromStringA [SHELL32.703]
1632 BOOL WINAPI
GUIDFromStringA(LPCSTR str
, LPGUID guid
)
1634 TRACE("GUIDFromStringA() stub\n");
1638 /*************************************************************************
1639 * GUIDFromStringW [SHELL32.704]
1641 BOOL WINAPI
GUIDFromStringW(LPCWSTR str
, LPGUID guid
)
1643 UNICODE_STRING guid_str
;
1645 RtlInitUnicodeString(&guid_str
, str
);
1646 return !RtlGUIDFromString(&guid_str
, guid
);
1649 /*************************************************************************
1650 * PathIsTemporaryW [SHELL32.714]
1652 BOOL WINAPI
PathIsTemporaryW(LPWSTR Str
)
1654 FIXME("(%s)stub\n", debugstr_w(Str
));
1658 typedef struct _PSXA
1662 IShellPropSheetExt
*pspsx
[1];
1665 typedef struct _PSXA_CALL
1667 LPFNADDPROPSHEETPAGE lpfnAddReplaceWith
;
1672 } PSXA_CALL
, *PPSXA_CALL
;
1674 static BOOL CALLBACK
PsxaCall(HPROPSHEETPAGE hpage
, LPARAM lParam
)
1676 PPSXA_CALL Call
= (PPSXA_CALL
)lParam
;
1680 if ((Call
->bMultiple
|| !Call
->bCalled
) &&
1681 Call
->lpfnAddReplaceWith(hpage
, Call
->lParam
))
1683 Call
->bCalled
= TRUE
;
1692 /*************************************************************************
1693 * SHAddFromPropSheetExtArray [SHELL32.167]
1695 UINT WINAPI
SHAddFromPropSheetExtArray(HPSXA hpsxa
, LPFNADDPROPSHEETPAGE lpfnAddPage
, LPARAM lParam
)
1699 PPSXA psxa
= (PPSXA
)hpsxa
;
1701 TRACE("(%p,%p,%08lx)\n", hpsxa
, lpfnAddPage
, lParam
);
1705 ZeroMemory(&Call
, sizeof(Call
));
1706 Call
.lpfnAddReplaceWith
= lpfnAddPage
;
1707 Call
.lParam
= lParam
;
1708 Call
.bMultiple
= TRUE
;
1710 /* Call the AddPage method of all registered IShellPropSheetExt interfaces */
1711 for (i
= 0; i
!= psxa
->uiCount
; i
++)
1713 psxa
->pspsx
[i
]->lpVtbl
->AddPages(psxa
->pspsx
[i
], PsxaCall
, (LPARAM
)&Call
);
1716 return Call
.uiCount
;
1722 /*************************************************************************
1723 * SHCreatePropSheetExtArray [SHELL32.168]
1725 HPSXA WINAPI
SHCreatePropSheetExtArray(HKEY hKey
, LPCWSTR pszSubKey
, UINT max_iface
)
1727 return SHCreatePropSheetExtArrayEx(hKey
, pszSubKey
, max_iface
, NULL
);
1730 /*************************************************************************
1731 * SHCreatePropSheetExtArrayEx [SHELL32.194]
1733 HPSXA WINAPI
SHCreatePropSheetExtArrayEx(HKEY hKey
, LPCWSTR pszSubKey
, UINT max_iface
, LPDATAOBJECT pDataObj
)
1735 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};
1736 WCHAR szHandler
[64];
1738 WCHAR szClsidHandler
[39];
1743 IShellExtInit
*psxi
;
1744 IShellPropSheetExt
*pspsx
;
1745 HKEY hkBase
, hkPropSheetHandlers
;
1748 TRACE("(%p,%s,%u)\n", hKey
, debugstr_w(pszSubKey
), max_iface
);
1753 /* Open the registry key */
1754 lRet
= RegOpenKeyW(hKey
, pszSubKey
, &hkBase
);
1755 if (lRet
!= ERROR_SUCCESS
)
1758 lRet
= RegOpenKeyExW(hkBase
, szPropSheetSubKey
, 0, KEY_ENUMERATE_SUB_KEYS
, &hkPropSheetHandlers
);
1759 RegCloseKey(hkBase
);
1760 if (lRet
== ERROR_SUCCESS
)
1762 /* Create and initialize the Property Sheet Extensions Array */
1763 psxa
= LocalAlloc(LMEM_FIXED
, FIELD_OFFSET(PSXA
, pspsx
[max_iface
]));
1766 ZeroMemory(psxa
, FIELD_OFFSET(PSXA
, pspsx
[max_iface
]));
1767 psxa
->uiAllocated
= max_iface
;
1769 /* Enumerate all subkeys and attempt to load the shell extensions */
1773 dwHandlerLen
= sizeof(szHandler
) / sizeof(szHandler
[0]);
1774 lRet
= RegEnumKeyExW(hkPropSheetHandlers
, dwIndex
++, szHandler
, &dwHandlerLen
, NULL
, NULL
, NULL
, NULL
);
1775 if (lRet
!= ERROR_SUCCESS
)
1777 if (lRet
== ERROR_MORE_DATA
)
1780 if (lRet
== ERROR_NO_MORE_ITEMS
)
1781 lRet
= ERROR_SUCCESS
;
1785 /* The CLSID is stored either in the key itself or in its default value. */
1786 if (FAILED(lRet
= SHCLSIDFromStringW(szHandler
, &clsid
)))
1788 dwClsidSize
= sizeof(szClsidHandler
);
1789 if (SHGetValueW(hkPropSheetHandlers
, szHandler
, NULL
, NULL
, szClsidHandler
, &dwClsidSize
) == ERROR_SUCCESS
)
1791 /* Force a NULL-termination and convert the string */
1792 szClsidHandler
[(sizeof(szClsidHandler
) / sizeof(szClsidHandler
[0])) - 1] = 0;
1793 lRet
= SHCLSIDFromStringW(szClsidHandler
, &clsid
);
1797 if (SUCCEEDED(lRet
))
1799 /* Attempt to get an IShellPropSheetExt and an IShellExtInit instance.
1800 Only if both interfaces are supported it's a real shell extension.
1801 Then call IShellExtInit's Initialize method. */
1802 if (SUCCEEDED(CoCreateInstance(&clsid
, NULL
, CLSCTX_INPROC_SERVER
/* | CLSCTX_NO_CODE_DOWNLOAD */, &IID_IShellPropSheetExt
, (LPVOID
*)&pspsx
)))
1804 if (SUCCEEDED(pspsx
->lpVtbl
->QueryInterface(pspsx
, &IID_IShellExtInit
, (PVOID
*)&psxi
)))
1806 if (SUCCEEDED(psxi
->lpVtbl
->Initialize(psxi
, NULL
, pDataObj
, hKey
)))
1808 /* Add the IShellPropSheetExt instance to the array */
1809 psxa
->pspsx
[psxa
->uiCount
++] = pspsx
;
1813 psxi
->lpVtbl
->Release(psxi
);
1814 pspsx
->lpVtbl
->Release(pspsx
);
1818 pspsx
->lpVtbl
->Release(pspsx
);
1822 } while (psxa
->uiCount
!= psxa
->uiAllocated
);
1825 lRet
= ERROR_NOT_ENOUGH_MEMORY
;
1827 RegCloseKey(hkPropSheetHandlers
);
1830 if (lRet
!= ERROR_SUCCESS
&& psxa
)
1832 SHDestroyPropSheetExtArray((HPSXA
)psxa
);
1839 /*************************************************************************
1840 * SHReplaceFromPropSheetExtArray [SHELL32.170]
1842 UINT WINAPI
SHReplaceFromPropSheetExtArray(HPSXA hpsxa
, UINT uPageID
, LPFNADDPROPSHEETPAGE lpfnReplaceWith
, LPARAM lParam
)
1846 PPSXA psxa
= (PPSXA
)hpsxa
;
1848 TRACE("(%p,%u,%p,%08lx)\n", hpsxa
, uPageID
, lpfnReplaceWith
, lParam
);
1852 ZeroMemory(&Call
, sizeof(Call
));
1853 Call
.lpfnAddReplaceWith
= lpfnReplaceWith
;
1854 Call
.lParam
= lParam
;
1856 /* Call the ReplacePage method of all registered IShellPropSheetExt interfaces.
1857 Each shell extension is only allowed to call the callback once during the callback. */
1858 for (i
= 0; i
!= psxa
->uiCount
; i
++)
1860 Call
.bCalled
= FALSE
;
1861 psxa
->pspsx
[i
]->lpVtbl
->ReplacePage(psxa
->pspsx
[i
], uPageID
, PsxaCall
, (LPARAM
)&Call
);
1864 return Call
.uiCount
;
1870 /*************************************************************************
1871 * SHDestroyPropSheetExtArray [SHELL32.169]
1873 void WINAPI
SHDestroyPropSheetExtArray(HPSXA hpsxa
)
1876 PPSXA psxa
= (PPSXA
)hpsxa
;
1878 TRACE("(%p)\n", hpsxa
);
1882 for (i
= 0; i
!= psxa
->uiCount
; i
++)
1884 psxa
->pspsx
[i
]->lpVtbl
->Release(psxa
->pspsx
[i
]);
1891 /*************************************************************************
1892 * CIDLData_CreateFromIDArray [SHELL32.83]
1894 * Create IDataObject from PIDLs??
1896 HRESULT WINAPI
CIDLData_CreateFromIDArray(
1897 LPCITEMIDLIST pidlFolder
,
1899 LPCITEMIDLIST
*lppidlFiles
,
1900 LPDATAOBJECT
*ppdataObject
)
1903 HWND hwnd
= 0; /*FIXME: who should be hwnd of owner? set to desktop */
1906 TRACE("(%p, %d, %p, %p)\n", pidlFolder
, cpidlFiles
, lppidlFiles
, ppdataObject
);
1910 for (i
=0; i
<cpidlFiles
; i
++) pdump (lppidlFiles
[i
]);
1912 hResult
= IDataObject_Constructor(hwnd
, pidlFolder
, lppidlFiles
, cpidlFiles
, ppdataObject
);
1916 /*************************************************************************
1917 * SHCreateStdEnumFmtEtc [SHELL32.74]
1922 HRESULT WINAPI
SHCreateStdEnumFmtEtc(
1924 const FORMATETC
*lpFormats
,
1925 LPENUMFORMATETC
*ppenumFormatetc
)
1927 IEnumFORMATETC
*pef
;
1929 TRACE("cf=%d fe=%p pef=%p\n", cFormats
, lpFormats
, ppenumFormatetc
);
1931 hRes
= IEnumFORMATETC_Constructor(cFormats
, lpFormats
, &pef
);
1935 IEnumFORMATETC_AddRef(pef
);
1936 hRes
= IEnumFORMATETC_QueryInterface(pef
, &IID_IEnumFORMATETC
, (LPVOID
*)ppenumFormatetc
);
1937 IEnumFORMATETC_Release(pef
);
1942 /*************************************************************************
1943 * SHFindFiles (SHELL32.90)
1945 BOOL WINAPI
SHFindFiles( LPCITEMIDLIST pidlFolder
, LPCITEMIDLIST pidlSaveFile
)
1947 FIXME("%p %p\n", pidlFolder
, pidlSaveFile
);
1951 /*************************************************************************
1952 * SHUpdateImageW (SHELL32.192)
1954 * Notifies the shell that an icon in the system image list has been changed.
1957 * pszHashItem [I] Path to file that contains the icon.
1958 * iIndex [I] Zero-based index of the icon in the file.
1959 * uFlags [I] Flags determining the icon attributes. See notes.
1960 * iImageIndex [I] Index of the icon in the system image list.
1966 * uFlags can be one or more of the following flags:
1967 * GIL_NOTFILENAME - pszHashItem is not a file name.
1968 * GIL_SIMULATEDOC - Create a document icon using the specified icon.
1970 void WINAPI
SHUpdateImageW(LPCWSTR pszHashItem
, int iIndex
, UINT uFlags
, int iImageIndex
)
1972 FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_w(pszHashItem
), iIndex
, uFlags
, iImageIndex
);
1975 /*************************************************************************
1976 * SHUpdateImageA (SHELL32.191)
1978 * See SHUpdateImageW.
1980 VOID WINAPI
SHUpdateImageA(LPCSTR pszHashItem
, INT iIndex
, UINT uFlags
, INT iImageIndex
)
1982 FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_a(pszHashItem
), iIndex
, uFlags
, iImageIndex
);
1985 INT WINAPI
SHHandleUpdateImage(LPCITEMIDLIST pidlExtra
)
1987 FIXME("%p - stub\n", pidlExtra
);
1992 BOOL WINAPI
SHObjectProperties(HWND hwnd
, DWORD dwType
, LPCWSTR szObject
, LPCWSTR szPage
)
1994 FIXME("%p, 0x%08x, %s, %s - stub\n", hwnd
, dwType
, debugstr_w(szObject
), debugstr_w(szPage
));
1999 BOOL WINAPI
SHGetNewLinkInfoA(LPCSTR pszLinkTo
, LPCSTR pszDir
, LPSTR pszName
, BOOL
*pfMustCopy
,
2002 WCHAR wszLinkTo
[MAX_PATH
];
2003 WCHAR wszDir
[MAX_PATH
];
2004 WCHAR wszName
[MAX_PATH
];
2007 MultiByteToWideChar(CP_ACP
, 0, pszLinkTo
, -1, wszLinkTo
, MAX_PATH
);
2008 MultiByteToWideChar(CP_ACP
, 0, pszDir
, -1, wszDir
, MAX_PATH
);
2010 res
= SHGetNewLinkInfoW(wszLinkTo
, wszDir
, wszName
, pfMustCopy
, uFlags
);
2013 WideCharToMultiByte(CP_ACP
, 0, wszName
, -1, pszName
, MAX_PATH
, NULL
, NULL
);
2018 BOOL WINAPI
SHGetNewLinkInfoW(LPCWSTR pszLinkTo
, LPCWSTR pszDir
, LPWSTR pszName
, BOOL
*pfMustCopy
,
2021 const WCHAR
*basename
;
2022 WCHAR
*dst_basename
;
2024 static const WCHAR lnkformat
[] = {'%','s','.','l','n','k',0};
2025 static const WCHAR lnkformatnum
[] = {'%','s',' ','(','%','d',')','.','l','n','k',0};
2027 TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_w(pszLinkTo
), debugstr_w(pszDir
),
2028 pszName
, pfMustCopy
, uFlags
);
2030 *pfMustCopy
= FALSE
;
2032 if (uFlags
& SHGNLI_PIDL
)
2034 FIXME("SHGNLI_PIDL flag unsupported\n");
2039 FIXME("ignoring flags: 0x%08x\n", uFlags
);
2041 /* FIXME: should test if the file is a shortcut or DOS program */
2042 if (GetFileAttributesW(pszLinkTo
) == INVALID_FILE_ATTRIBUTES
)
2045 basename
= strrchrW(pszLinkTo
, '\\');
2047 basename
= basename
+1;
2049 basename
= pszLinkTo
;
2051 lstrcpynW(pszName
, pszDir
, MAX_PATH
);
2052 if (!PathAddBackslashW(pszName
))
2055 dst_basename
= pszName
+ strlenW(pszName
);
2057 snprintfW(dst_basename
, pszName
+ MAX_PATH
- dst_basename
, lnkformat
, basename
);
2059 while (GetFileAttributesW(pszName
) != INVALID_FILE_ATTRIBUTES
)
2061 snprintfW(dst_basename
, pszName
+ MAX_PATH
- dst_basename
, lnkformatnum
, basename
, i
);
2068 HRESULT WINAPI
SHStartNetConnectionDialog(HWND hwnd
, LPCSTR pszRemoteName
, DWORD dwType
)
2070 FIXME("%p, %s, 0x%08x - stub\n", hwnd
, debugstr_a(pszRemoteName
), dwType
);
2074 /*************************************************************************
2075 * SHSetLocalizedName (SHELL32.@)
2077 HRESULT WINAPI
SHSetLocalizedName(LPCWSTR pszPath
, LPCWSTR pszResModule
, int idsRes
)
2079 FIXME("%p, %s, %d - stub\n", pszPath
, debugstr_w(pszResModule
), idsRes
);
2084 /*************************************************************************
2085 * LinkWindow_RegisterClass (SHELL32.258)
2087 BOOL WINAPI
LinkWindow_RegisterClass(void)
2093 /*************************************************************************
2094 * LinkWindow_UnregisterClass (SHELL32.259)
2096 BOOL WINAPI
LinkWindow_UnregisterClass(void)
2102 /*************************************************************************
2103 * SHFlushSFCache (SHELL32.526)
2105 * Notifies the shell that a user-specified special folder location has changed.
2108 * In Wine, the shell folder registry values are not cached, so this function
2111 void WINAPI
SHFlushSFCache(void)
2115 /*************************************************************************
2116 * SHGetImageList (SHELL32.727)
2118 * Returns a copy of a shell image list.
2121 * Windows XP features 4 sizes of image list, and Vista 5. Wine currently
2122 * only supports the traditional small and large image lists, so requests
2123 * for the others will currently fail.
2125 HRESULT WINAPI
SHGetImageList(int iImageList
, REFIID riid
, void **ppv
)
2127 HIMAGELIST hLarge
, hSmall
;
2129 HRESULT ret
= E_FAIL
;
2131 /* Wine currently only maintains large and small image lists */
2132 if ((iImageList
!= SHIL_LARGE
) && (iImageList
!= SHIL_SMALL
) && (iImageList
!= SHIL_SYSSMALL
))
2134 FIXME("Unsupported image list %i requested\n", iImageList
);
2138 Shell_GetImageLists(&hLarge
, &hSmall
);
2140 hNew
= ImageList_Duplicate(iImageList
== SHIL_LARGE
? hLarge
: hSmall
);
2142 /* Get the interface for the new image list */
2145 ret
= HIMAGELIST_QueryInterface(hNew
, riid
, ppv
);
2146 ImageList_Destroy(hNew
);
2149 /* Duplicating the imagelist causes the start menu items not to draw on
2150 * the first show. Was the Duplicate necessary for some reason? I believe
2151 * Windows returns the raw pointer here. */
2152 hNew
= (iImageList
== SHIL_LARGE
? hLarge
: hSmall
);
2153 ret
= IImageList2_QueryInterface((IImageList2
*) hNew
, riid
, ppv
);
2159 /*************************************************************************
2160 * SHCreateShellFolderView [SHELL32.256]
2162 * Create a new instance of the default Shell folder view object.
2166 * Failure: error value
2169 * see IShellFolder::CreateViewObject
2171 HRESULT WINAPI
SHCreateShellFolderView(const SFV_CREATE
*pcsfv
,
2178 if (!pcsfv
|| pcsfv
->cbSize
!= sizeof(*pcsfv
))
2179 return E_INVALIDARG
;
2181 TRACE("sf=%p outer=%p callback=%p\n",
2182 pcsfv
->pshf
, pcsfv
->psvOuter
, pcsfv
->psfvcb
);
2184 hRes
= IShellView_Constructor(pcsfv
->pshf
, &psf
);
2188 hRes
= IShellView_QueryInterface(psf
, &IID_IShellView
, (LPVOID
*)ppsv
);
2189 IShellView_Release(psf
);
2194 /*************************************************************************
2195 * PathIsTemporaryA [SHELL32.713]
2197 BOOL WINAPI
PathIsTemporaryA(LPSTR Str
)
2199 FIXME("(%s)stub\n", debugstr_a(Str
));
2203 /*************************************************************************
2204 * SHEmptyRecycleBinA (SHELL32.@)
2206 HRESULT WINAPI
SHEmptyRecycleBinA(HWND hwnd
, LPCSTR pszRootPath
, DWORD dwFlags
)
2208 LPWSTR szRootPathW
= NULL
;
2212 TRACE("%p, %s, 0x%08x\n", hwnd
, debugstr_a(pszRootPath
), dwFlags
);
2216 len
= MultiByteToWideChar(CP_ACP
, 0, pszRootPath
, -1, NULL
, 0);
2218 return HRESULT_FROM_WIN32(GetLastError());
2219 szRootPathW
= (LPWSTR
)HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
2221 return E_OUTOFMEMORY
;
2222 if (MultiByteToWideChar(CP_ACP
, 0, pszRootPath
, -1, szRootPathW
, len
) == 0)
2224 HeapFree(GetProcessHeap(), 0, szRootPathW
);
2225 return HRESULT_FROM_WIN32(GetLastError());
2229 hr
= SHEmptyRecycleBinW(hwnd
, szRootPathW
, dwFlags
);
2230 HeapFree(GetProcessHeap(), 0, szRootPathW
);
2235 HRESULT WINAPI
SHEmptyRecycleBinW(HWND hwnd
, LPCWSTR pszRootPath
, DWORD dwFlags
)
2237 WCHAR szPath
[MAX_PATH
] = {0};
2238 DWORD dwSize
, dwType
;
2241 TRACE("%p, %s, 0x%08x\n", hwnd
, debugstr_w(pszRootPath
), dwFlags
);
2243 if (!(dwFlags
& SHERB_NOCONFIRMATION
))
2246 * enumerate available files
2247 * show confirmation dialog
2249 FIXME("show confirmation dialog\n");
2252 if (dwFlags
& SHERB_NOPROGRESSUI
)
2254 ret
= EmptyRecycleBinW(pszRootPath
);
2259 * show a progress dialog
2261 ret
= EmptyRecycleBinW(pszRootPath
);
2265 return HRESULT_FROM_WIN32(GetLastError());
2267 if (!(dwFlags
& SHERB_NOSOUND
))
2269 dwSize
= sizeof(szPath
);
2270 ret
= RegGetValueW(HKEY_CURRENT_USER
,
2271 L
"AppEvents\\Schemes\\Apps\\Explorer\\EmptyRecycleBin\\.Current",
2273 RRF_RT_REG_EXPAND_SZ
,
2277 if (ret
!= ERROR_SUCCESS
)
2280 if (dwType
!= REG_EXPAND_SZ
) /* type dismatch */
2283 szPath
[(sizeof(szPath
)/sizeof(WCHAR
))-1] = L
'\0';
2284 PlaySoundW(szPath
, NULL
, SND_FILENAME
);
2289 HRESULT WINAPI
SHQueryRecycleBinA(LPCSTR pszRootPath
, LPSHQUERYRBINFO pSHQueryRBInfo
)
2291 LPWSTR szRootPathW
= NULL
;
2295 TRACE("%s, %p\n", debugstr_a(pszRootPath
), pSHQueryRBInfo
);
2299 len
= MultiByteToWideChar(CP_ACP
, 0, pszRootPath
, -1, NULL
, 0);
2301 return HRESULT_FROM_WIN32(GetLastError());
2302 szRootPathW
= (LPWSTR
)HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
2304 return E_OUTOFMEMORY
;
2305 if (MultiByteToWideChar(CP_ACP
, 0, pszRootPath
, -1, szRootPathW
, len
) == 0)
2307 HeapFree(GetProcessHeap(), 0, szRootPathW
);
2308 return HRESULT_FROM_WIN32(GetLastError());
2312 hr
= SHQueryRecycleBinW(szRootPathW
, pSHQueryRBInfo
);
2313 HeapFree(GetProcessHeap(), 0, szRootPathW
);
2318 HRESULT WINAPI
SHQueryRecycleBinW(LPCWSTR pszRootPath
, LPSHQUERYRBINFO pSHQueryRBInfo
)
2320 FIXME("%s, %p - stub\n", debugstr_w(pszRootPath
), pSHQueryRBInfo
);
2322 if (!(pszRootPath
) || (pszRootPath
[0] == 0) ||
2323 !(pSHQueryRBInfo
) || (pSHQueryRBInfo
->cbSize
< sizeof(SHQUERYRBINFO
)))
2325 return E_INVALIDARG
;
2328 pSHQueryRBInfo
->i64Size
= 0;
2329 pSHQueryRBInfo
->i64NumItems
= 0;