Revert revision 14118 changes
Modified: trunk/reactos/lib/shell32/Makefile.in
Modified: trunk/reactos/lib/shell32/brsfolder.c
Modified: trunk/reactos/lib/shell32/classes.c
Modified: trunk/reactos/lib/shell32/clipboard.c
Modified: trunk/reactos/lib/shell32/dialogs.c
Modified: trunk/reactos/lib/shell32/enumidlist.c
Modified: trunk/reactos/lib/shell32/enumidlist.h
Modified: trunk/reactos/lib/shell32/folders.c
Modified: trunk/reactos/lib/shell32/pidl.c
Modified: trunk/reactos/lib/shell32/pidl.h
Modified: trunk/reactos/lib/shell32/shell32.spec
Modified: trunk/reactos/lib/shell32/shell32_Es.rc
Modified: trunk/reactos/lib/shell32/shell32_Pt.rc
Modified: trunk/reactos/lib/shell32/shell32_main.c
Modified: trunk/reactos/lib/shell32/shell32_main.h
Modified: trunk/reactos/lib/shell32/shelllink.c
Modified: trunk/reactos/lib/shell32/shellpath.c
Modified: trunk/reactos/lib/shell32/shfldr.h
Modified: trunk/reactos/lib/shell32/shfldr_desktop.c
Modified: trunk/reactos/lib/shell32/shfldr_fs.c
Modified: trunk/reactos/lib/shell32/shfldr_mycomp.c
Deleted: trunk/reactos/lib/shell32/shfldr_unixfs.c
Modified: trunk/reactos/lib/shell32/shlexec.c
Modified: trunk/reactos/lib/shell32/shlfileop.c
Modified: trunk/reactos/lib/shell32/shlfolder.c
Modified: trunk/reactos/lib/shell32/shlfsbind.c
Modified: trunk/reactos/lib/shell32/shlview.c
_____
Modified: trunk/reactos/lib/shell32/Makefile.in
--- trunk/reactos/lib/shell32/Makefile.in 2005-03-16 11:50:24 UTC
(rev 14133)
+++ trunk/reactos/lib/shell32/Makefile.in 2005-03-16 12:33:26 UTC
(rev 14134)
@@ -37,7 +37,6 @@
shfldr_desktop.c \
shfldr_fs.c \
shfldr_mycomp.c \
- shfldr_unixfs.c \
shlexec.c \
shlfileop.c \
shlfolder.c \
@@ -78,7 +77,7 @@
$(LDPATH) $(RC16) $(RC16FLAGS) -fo$@ $(SRCDIR)/version16.rc
shell.spec.c: shell.spec version16.res
- $(WINEBUILD) $(DEFS) $(DLLFLAGS) --dll -o $@ --main-module
$(MODULE) --res version16.res --export $(SRCDIR)/shell.spec
+ $(WINEBUILD) $(DEFS) $(DLLFLAGS) -o $@ --main-module $(MODULE)
--res version16.res --dll $(SRCDIR)/shell.spec
authors.c: $(TOPSRCDIR)/AUTHORS
(LC_ALL=C; export LC_ALL; echo 'const char * const
SHELL_Authors[] = {' && \
_____
Modified: trunk/reactos/lib/shell32/brsfolder.c
--- trunk/reactos/lib/shell32/brsfolder.c 2005-03-16 11:50:24 UTC
(rev 14133)
+++ trunk/reactos/lib/shell32/brsfolder.c 2005-03-16 12:33:26 UTC
(rev 14134)
@@ -55,95 +55,68 @@
return SHCONTF_FOLDERS | (ulFlags & BIF_BROWSEINCLUDEFILES ?
SHCONTF_NONFOLDERS : 0);
}
-/**********************************************************************
********
- * InitializeTreeView [Internal]
- *
- * Called from WM_INITDIALOG handler.
- *
- * PARAMS
- * hwndParent [I] The BrowseForFolder dialog
- * root [I] ITEMIDLIST of the root shell folder
- */
static void InitializeTreeView(HWND hwndParent, LPCITEMIDLIST root)
{
- LPITEMIDLIST pidlParent, pidlChild;
- HIMAGELIST hImageList;
- HRESULT hr;
- IShellFolder *lpsfParent, *lpsfRoot;
- IEnumIDList * pEnumChildren = NULL;
+ HIMAGELIST hImageList;
+ IShellFolder * lpsf;
+ HRESULT hr;
+ IEnumIDList * pEnumIL = NULL;
+ LPITEMIDLIST parentofroot;
+ parentofroot = ILClone(root);
+ ILRemoveLastID(parentofroot);
- TRACE("dlg=%p tree=%p\n", hwndParent, hwndTreeView );
-
- hwndTreeView = GetDlgItem (hwndParent, IDD_TREEVIEW);
- if (!hwndTreeView) {
- FIXME("Could not get handle to treeview control! Error:
%08lx\n", GetLastError());
- return;
- }
- Shell_GetImageList(NULL, &hImageList);
+ hwndTreeView = GetDlgItem (hwndParent, IDD_TREEVIEW);
+ Shell_GetImageList(NULL, &hImageList);
- if (hImageList)
- TreeView_SetImageList(hwndTreeView, hImageList, 0);
+ TRACE("dlg=%p tree=%p\n", hwndParent, hwndTreeView );
- /* We want to call InsertTreeViewItem down the code, in order to
insert
- * the root item of the treeview. Due to InsertTreeViewItem's
signature,
- * we need the following to do this:
- *
- * + An ITEMIDLIST corresponding to _the parent_ of root.
- * + An ITEMIDLIST, which is a relative path from root's parent to
root
- * (containing a single SHITEMID).
- * + An IShellFolder interface pointer of root's parent folder.
- *
- * If root is 'Desktop', then root's parent is also 'Desktop'.
- */
+ if (hImageList && hwndTreeView)
+ TreeView_SetImageList(hwndTreeView, hImageList, 0);
- pidlParent = ILClone(root);
- ILRemoveLastID(pidlParent);
- pidlChild = ILClone(ILFindLastID(root));
-
- if (_ILIsDesktop(pidlParent)) {
- hr = SHGetDesktopFolder(&lpsfParent);
- } else {
- IShellFolder *lpsfDesktop;
- hr = SHGetDesktopFolder(&lpsfDesktop);
- if (!SUCCEEDED(hr)) {
- WARN("SHGetDesktopFolder failed! hr = %08lx\n", hr);
- return;
- }
- hr = IShellFolder_BindToObject(lpsfDesktop, pidlParent, 0,
&IID_IShellFolder, (LPVOID*)&lpsfParent);
- IShellFolder_Release(lpsfDesktop);
- }
-
- if (!SUCCEEDED(hr)) {
- WARN("Could not bind to parent shell folder! hr = %08lx\n",
hr);
- return;
- }
+ if (_ILIsDesktop (root)) {
+ hr = SHGetDesktopFolder(&lpsf);
+ } else {
+ IShellFolder * lpsfdesktop;
- if (pidlChild && pidlChild->mkid.cb) {
- hr = IShellFolder_BindToObject(lpsfParent, pidlChild, 0,
&IID_IShellFolder, (LPVOID*)&lpsfRoot);
- } else {
- lpsfRoot = lpsfParent;
- hr = IShellFolder_AddRef(lpsfParent);
- }
-
- if (!SUCCEEDED(hr)) {
- WARN("Could not bind to root shell folder! hr = %08lx\n", hr);
- IShellFolder_Release(lpsfParent);
- return;
- }
+ hr = SHGetDesktopFolder(&lpsfdesktop);
+ if (SUCCEEDED(hr)) {
+ hr = IShellFolder_BindToObject(lpsfdesktop, parentofroot,
0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf);
+ IShellFolder_Release(lpsfdesktop);
+ }
+ }
+ if (SUCCEEDED(hr))
+ {
+ IShellFolder * pSFRoot;
+ if (_ILIsPidlSimple(root))
+ {
+ pSFRoot = lpsf;
+ IShellFolder_AddRef(pSFRoot);
+ }
+ else
+ hr =
IShellFolder_BindToObject(lpsf,ILFindLastID(root),0,&IID_IShellFolder,(L
PVOID *)&pSFRoot);
+ if (SUCCEEDED(hr))
+ {
+ hr = IShellFolder_EnumObjects(
+ pSFRoot,
+ hwndParent,
+ BrowseFlagsToSHCONTF(lpBrowseInfo->ulFlags),
+ &pEnumIL);
+ IShellFolder_Release(pSFRoot);
+ }
+ }
- hr = IShellFolder_EnumObjects(lpsfRoot, hwndParent,
BrowseFlagsToSHCONTF(lpBrowseInfo->ulFlags), &pEnumChildren);
- if (!SUCCEEDED(hr)) {
- WARN("Could not get child iterator! hr = %08lx\n", hr);
- IShellFolder_Release(lpsfParent);
- IShellFolder_Release(lpsfRoot);
- return;
- }
+ if (SUCCEEDED(hr) && hwndTreeView)
+ {
+ TreeView_DeleteAllItems(hwndTreeView);
+ TreeView_Expand(hwndTreeView,
+ InsertTreeViewItem(lpsf, _ILIsPidlSimple(root)
? root : ILFindLastID(root), parentofroot, pEnumIL, TVI_ROOT),
+ TVE_EXPAND);
+ }
- TreeView_DeleteAllItems(hwndTreeView);
- TreeView_Expand(hwndTreeView, InsertTreeViewItem(lpsfParent,
pidlChild, pidlParent, pEnumChildren, TVI_ROOT), TVE_EXPAND);
+ if (SUCCEEDED(hr))
+ IShellFolder_Release(lpsf);
- IShellFolder_Release(lpsfRoot);
- IShellFolder_Release(lpsfParent);
+ TRACE("done\n");
}
static int GetIcon(LPITEMIDLIST lpi, UINT uFlags)
@@ -176,27 +149,12 @@
typedef struct tagID
{
- LPSHELLFOLDER lpsfParent; /* IShellFolder of the parent */
- LPITEMIDLIST lpi; /* PIDL relativ to parent */
- LPITEMIDLIST lpifq; /* Fully qualified PIDL */
- IEnumIDList* pEnumIL; /* Children iterator */
+ LPSHELLFOLDER lpsfParent;
+ LPITEMIDLIST lpi;
+ LPITEMIDLIST lpifq;
+ IEnumIDList* pEnumIL;
} TV_ITEMDATA, *LPTV_ITEMDATA;
-/**********************************************************************
********
- * GetName [Internal]
- *
- * Query a shell folder for the display name of one of it's children
- *
- * PARAMS
- * lpsf [I] IShellFolder interface of the folder to be
queried.
- * lpi [I] ITEMIDLIST of the child, relative to parent
- * dwFlags [I] as in IShellFolder::GetDisplayNameOf
- * lpFriendlyName [O] The desired display name in unicode
- *
- * RETURNS
- * Success: TRUE
- * Failure: FALSE
- */
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD
dwFlags, LPWSTR lpFriendlyName)
{
BOOL bSuccess=TRUE;
@@ -217,22 +175,7 @@
return bSuccess;
}
-/**********************************************************************
********
- * InsertTreeViewItem [Internal]
- *
- * PARAMS
- * lpsf [I] IShellFolder interface of the item's parent shell
folder
- * pidl [I] ITEMIDLIST of the child to insert, relativ to parent
- * pidlParent [I] ITEMIDLIST of the parent shell folder
- * pEnumIL [I] Iterator for the children of the item to be inserted
- * hParent [I] The treeview-item that represents the parent shell
folder
- *
- * RETURNS
- * Success: Handle to the created and inserted treeview-item
- * Failure: NULL
- */
-static HTREEITEM InsertTreeViewItem(IShellFolder * lpsf, LPCITEMIDLIST
pidl,
- LPCITEMIDLIST pidlParent, IEnumIDList* pEnumIL, HTREEITEM hParent)
+static HTREEITEM InsertTreeViewItem(IShellFolder * lpsf, LPCITEMIDLIST
pidl, LPCITEMIDLIST pidlParent, IEnumIDList* pEnumIL, HTREEITEM hParent)
{
TVITEMW tvi;
TVINSERTSTRUCTW tvins;
@@ -268,18 +211,6 @@
return (HTREEITEM)TreeView_InsertItemW(hwndTreeView, &tvins);
}
-/**********************************************************************
********
- * FillTreeView [Internal]
- *
- * For each child (given by lpe) of the parent shell folder, which is
given by
- * lpsf and whose PIDL is pidl, insert a treeview-item right under
hParent
- *
- * PARAMS
- * lpsf [I] IShellFolder interface of the parent shell folder
- * pidl [I] ITEMIDLIST of the parent shell folder
- * hParent [I] The treeview item that represents the parent shell
folder
- * lpe [I] An iterator for the children of the parent shell folder
- */
static void FillTreeView(IShellFolder * lpsf, LPITEMIDLIST pidl,
HTREEITEM hParent, IEnumIDList* lpe)
{
HTREEITEM hPrev = 0;
@@ -288,11 +219,7 @@
HRESULT hr;
HWND hwnd=GetParent(hwndTreeView);
- TRACE("%p %p %x %p\n",lpsf, pidl, (INT)hParent, lpe);
-
- /* No IEnumIDList -> No children */
- if (!lpe) return;
-
+ TRACE("%p %p %x\n",lpsf, pidl, (INT)hParent);
SetCapture(GetParent(hwndTreeView));
SetCursor(LoadCursorA(0, (LPSTR)IDC_WAIT));
_____
Modified: trunk/reactos/lib/shell32/classes.c
--- trunk/reactos/lib/shell32/classes.c 2005-03-16 11:50:24 UTC (rev
14133)
+++ trunk/reactos/lib/shell32/classes.c 2005-03-16 12:33:26 UTC (rev
14134)
@@ -116,7 +116,7 @@
BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR
szVerb, LPWSTR szDest, DWORD len )
{
- static const WCHAR swShell[] =
{'s','h','e','l','l','\\',0};
+ static const WCHAR swShell[] =
{'\\','s','h','e','l','l','\\',0};
static const WCHAR swCommand[] =
{'\\','c','o','m','m','a','n','d',0};
BOOL ret = FALSE;
_____
Modified: trunk/reactos/lib/shell32/clipboard.c
--- trunk/reactos/lib/shell32/clipboard.c 2005-03-16 11:50:24 UTC
(rev 14133)
+++ trunk/reactos/lib/shell32/clipboard.c 2005-03-16 12:33:26 UTC
(rev 14134)
@@ -26,7 +26,7 @@
* - a right mousebutton-copy sets the following formats:
* classic:
* Shell IDList Array
- * Preferred Drop Effect
+ * Prefered Drop Effect
* Shell Object Offsets
* HDROP
* FileName
_____
Modified: trunk/reactos/lib/shell32/dialogs.c
--- trunk/reactos/lib/shell32/dialogs.c 2005-03-16 11:50:24 UTC (rev
14133)
+++ trunk/reactos/lib/shell32/dialogs.c 2005-03-16 12:33:26 UTC (rev
14134)
@@ -127,9 +127,9 @@
case WM_INITDIALOG :
prfdp = (RUNFILEDLGPARAMS *)lParam ;
SetWindowTextA (hwnd, prfdp->lpstrTitle) ;
- SetClassLongPtrW (hwnd, GCLP_HICON, (LPARAM)prfdp->hIcon) ;
- SendMessageW (GetDlgItem (hwnd, 12297), STM_SETICON,
- (WPARAM)LoadIconW (NULL,
(LPCWSTR)IDI_WINLOGO), 0);
+ SetClassLongA (hwnd, GCL_HICON, (LPARAM)prfdp->hIcon) ;
+ SendMessageA (GetDlgItem (hwnd, 12297), STM_SETICON,
+ (WPARAM)LoadIconA (NULL, (LPSTR)IDI_WINLOGO),
0);
FillList (GetDlgItem (hwnd, 12298), NULL) ;
SetFocus (GetDlgItem (hwnd, 12298)) ;
return TRUE ;
@@ -283,7 +283,7 @@
if (NULL != pszLatest)
{
- if (!lstrcmpiA(pszCmd, pszLatest))
+ if (!strcasecmp (pszCmd, pszLatest))
{
/*
sprintf (szDbgMsg, "Found existing (%d).\n", Nix) ;
_____
Modified: trunk/reactos/lib/shell32/enumidlist.c
--- trunk/reactos/lib/shell32/enumidlist.c 2005-03-16 11:50:24 UTC
(rev 14133)
+++ trunk/reactos/lib/shell32/enumidlist.c 2005-03-16 12:33:26 UTC
(rev 14134)
@@ -25,7 +25,6 @@
#define COBJMACROS
#include "wine/debug.h"
-#include "wine/unicode.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
@@ -104,27 +103,24 @@
*/
BOOL CreateFolderEnumList(
IEnumIDList *list,
- LPCWSTR lpszPath,
+ LPCSTR lpszPath,
DWORD dwFlags)
{
LPITEMIDLIST pidl=NULL;
- WIN32_FIND_DATAW stffile;
+ WIN32_FIND_DATAA stffile;
HANDLE hFile;
- WCHAR szPath[MAX_PATH];
+ CHAR szPath[MAX_PATH];
BOOL succeeded = TRUE;
- const static WCHAR stars[] = { '*','.','*',0 };
- const static WCHAR dot[] = { '.',0 };
- const static WCHAR dotdot[] = { '.','.',0 };
- TRACE("(%p)->(path=%s flags=0x%08lx)
\n",list,debugstr_w(lpszPath),dwFlags);
+ TRACE("(%p)->(path=%s flags=0x%08lx)
\n",list,debugstr_a(lpszPath),dwFlags);
if(!lpszPath || !lpszPath[0]) return FALSE;
- strcpyW(szPath, lpszPath);
- PathAddBackslashW(szPath);
- strcatW(szPath,stars);
+ strcpy(szPath, lpszPath);
+ PathAddBackslashA(szPath);
+ strcat(szPath,"*.*");
- hFile = FindFirstFileW(szPath,&stffile);
+ hFile = FindFirstFileA(szPath,&stffile);
if ( hFile != INVALID_HANDLE_VALUE )
{
BOOL findFinished = FALSE;
@@ -136,21 +132,21 @@
{
if ( (stffile.dwFileAttributes &
FILE_ATTRIBUTE_DIRECTORY) &&
dwFlags & SHCONTF_FOLDERS &&
- strcmpW(stffile.cFileName, dot) &&
strcmpW(stffile.cFileName, dotdot))
+ strcmp (stffile.cFileName, ".") && strcmp
(stffile.cFileName, ".."))
{
- pidl = _ILCreateFromFindDataW(&stffile);
+ pidl = _ILCreateFromFindDataA(&stffile);
succeeded = succeeded && AddToEnumList(list, pidl);
}
else if (!(stffile.dwFileAttributes &
FILE_ATTRIBUTE_DIRECTORY)
&& dwFlags & SHCONTF_NONFOLDERS)
{
- pidl = _ILCreateFromFindDataW(&stffile);
+ pidl = _ILCreateFromFindDataA(&stffile);
succeeded = succeeded && AddToEnumList(list, pidl);
}
}
if (succeeded)
{
- if (!FindNextFileW(hFile, &stffile))
+ if (!FindNextFileA(hFile, &stffile))
{
if (GetLastError() == ERROR_NO_MORE_FILES)
findFinished = TRUE;
_____
Modified: trunk/reactos/lib/shell32/enumidlist.h
--- trunk/reactos/lib/shell32/enumidlist.h 2005-03-16 11:50:24 UTC
(rev 14133)
+++ trunk/reactos/lib/shell32/enumidlist.h 2005-03-16 12:33:26 UTC
(rev 14134)
@@ -25,6 +25,6 @@
/* Enumerates the folders and/or files (depending on dwFlags) in
lpszPath and
* adds them to the already-created list.
*/
-BOOL CreateFolderEnumList(IEnumIDList *list, LPCWSTR lpszPath, DWORD
dwFlags);
+BOOL CreateFolderEnumList(IEnumIDList *list, LPCSTR lpszPath, DWORD
dwFlags);
#endif /* ndef __ENUMIDLIST_H__ */
_____
Modified: trunk/reactos/lib/shell32/folders.c
--- trunk/reactos/lib/shell32/folders.c 2005-03-16 11:50:24 UTC (rev
14133)
+++ trunk/reactos/lib/shell32/folders.c 2005-03-16 12:33:26 UTC (rev
14134)
@@ -328,7 +328,7 @@
found = TRUE;
}
- else if (!lstrcmpiA(sTemp, "lnkfile"))
+ else if (!strcasecmp(sTemp, "lnkfile"))
{
/* extract icon from shell shortcut */
IShellFolder* dsf;
_____
Modified: trunk/reactos/lib/shell32/pidl.c
--- trunk/reactos/lib/shell32/pidl.c 2005-03-16 11:50:24 UTC (rev
14133)
+++ trunk/reactos/lib/shell32/pidl.c 2005-03-16 12:33:26 UTC (rev
14134)
@@ -1,7 +1,7 @@
/*
- * pidl Handling
+ * pidl Handling
*
- * Copyright 1998 Juergen Schmied
+ * Copyright 1998 Juergen Schmied
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -57,7 +57,7 @@
extern BOOL WINAPI Free(LPVOID);
/***********************************************************************
**
- * ILGetDisplayNameEx [SHELL32.186]
+ * ILGetDisplayNameEx [SHELL32.186]
*
* Retrieves the display name of an ItemIDList
*
@@ -75,108 +75,106 @@
*/
BOOL WINAPI ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl,
LPSTR path, DWORD type)
{
- BOOL ret = FALSE;
- WCHAR wPath[MAX_PATH];
+ BOOL ret = FALSE;
+ WCHAR wPath[MAX_PATH];
- TRACE("%p %p %p %ld\n", psf, pidl, path, type);
+ TRACE("%p %p %p %ld\n", psf, pidl, path, type);
- if (!pidl || !path)
- return FALSE;
+ if (!pidl || !path)
+ return FALSE;
- ret = ILGetDisplayNameExW(psf, pidl, wPath, type);
- WideCharToMultiByte(CP_ACP, 0, wPath, -1, path, MAX_PATH, NULL,
NULL);
- TRACE("%p %p %s\n", psf, pidl, debugstr_a(path));
+ ret = ILGetDisplayNameExW(psf, pidl, wPath, type);
+ WideCharToMultiByte(CP_ACP, 0, wPath, -1, path, MAX_PATH, NULL,
NULL);
+ TRACE("%p %p %s\n", psf, pidl, debugstr_a(path));
- return ret;
+ return ret;
}
BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl,
LPWSTR path, DWORD type)
{
- LPSHELLFOLDER psfParent, lsf = psf;
- HRESULT ret = NO_ERROR;
- LPCITEMIDLIST pidllast;
- STRRET strret;
- DWORD flag;
+ LPSHELLFOLDER psfParent, lsf = psf;
+ HRESULT ret = NO_ERROR;
+ LPCITEMIDLIST pidllast;
+ STRRET strret;
+ DWORD flag;
- TRACE("%p %p %p %ld\n", psf, pidl, path, type);
+ TRACE("%p %p %p %ld\n", psf, pidl, path, type);
- if (!pidl || !path)
- return FALSE;
+ if (!pidl || !path)
+ return FALSE;
- if (!lsf)
- {
- ret = SHGetDesktopFolder(&lsf);
- if (FAILED(ret))
- return FALSE;
- }
+ if (!lsf)
+ {
+ ret = SHGetDesktopFolder(&lsf);
+ if (FAILED(ret))
+ return FALSE;
+ }
- if (type >= 0 && type <= 2)
- {
- switch (type)
- {
- case ILGDN_FORPARSING:
- flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
- break;
- case ILGDN_NORMAL:
- flag = SHGDN_NORMAL;
- break;
- case ILGDN_INFOLDER:
- flag = SHGDN_INFOLDER;
- break;
- default:
- FIXME("Unknown type parameter = %lx\n", type);
- flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
- break;
- }
- if (!*(const WORD*)pidl || type == ILGDN_FORPARSING)
- {
- ret = IShellFolder_GetDisplayNameOf(lsf, pidl, flag,
&strret);
- if (SUCCEEDED(ret))
- {
- ret = StrRetToStrNW(path, MAX_PATH, &strret, pidl);
- }
- }
- else
- {
- ret = SHBindToParent(pidl, &IID_IShellFolder,
(LPVOID*)&psfParent, &pidllast);
- if (SUCCEEDED(ret))
- {
- ret = IShellFolder_GetDisplayNameOf(psfParent,
pidllast, flag, &strret);
- if (SUCCEEDED(ret))
- {
- ret = StrRetToStrNW(path, MAX_PATH, &strret,
pidllast);
- }
- IShellFolder_Release(psfParent);
- }
- }
- }
+ if (type >= 0 && type <= 2)
+ {
+ switch (type)
+ {
+ case ILGDN_FORPARSING:
+ flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
+ break;
+ case ILGDN_NORMAL:
+ flag = SHGDN_NORMAL;
+ break;
+ case ILGDN_INFOLDER:
+ flag = SHGDN_INFOLDER;
+ break;
+ default:
+ FIXME("Unknown type parameter = %lx\n", type);
+ flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
+ break;
+ }
+ if (!*(const WORD*)pidl || type == ILGDN_FORPARSING)
+ {
+ ret = IShellFolder_GetDisplayNameOf(lsf, pidl, flag,
&strret);
+ if (SUCCEEDED(ret))
+ {
+ ret = StrRetToStrNW(path, MAX_PATH, &strret, pidl);
+ }
+ }
+ else
+ {
+ ret = SHBindToParent(pidl, &IID_IShellFolder,
(LPVOID*)&psfParent, &pidllast);
+ if (SUCCEEDED(ret))
+ {
+ ret = IShellFolder_GetDisplayNameOf(psfParent, pidllast,
flag, &strret);
+ if (SUCCEEDED(ret))
+ {
+ ret = StrRetToStrNW(path, MAX_PATH, &strret, pidllast);
+ }
+ IShellFolder_Release(psfParent);
+ }
+ }
+ }
- TRACE("%p %p %s\n", psf, pidl, debugstr_w(path));
+ TRACE("%p %p %s\n", psf, pidl, debugstr_w(path));
- if (!psf)
- IShellFolder_Release(lsf);
- return SUCCEEDED(ret);
+ if (!psf)
+ IShellFolder_Release(lsf);
+ return SUCCEEDED(ret);
}
BOOL WINAPI ILGetDisplayNameEx(LPSHELLFOLDER psf, LPCITEMIDLIST pidl,
LPVOID path, DWORD type)
{
- TRACE_(shell)("%p %p %p %ld\n", psf, pidl, path, type);
-
- if (SHELL_OsIsUnicode())
- return ILGetDisplayNameExW(psf, pidl, path, type);
- return ILGetDisplayNameExA(psf, pidl, path, type);
+ TRACE_(shell)("%p %p %p %ld\n", psf, pidl, path, type);
+ if (SHELL_OsIsUnicode())
+ return ILGetDisplayNameExW(psf, pidl, path, type);
+ return ILGetDisplayNameExA(psf, pidl, path, type);
}
/***********************************************************************
**
- * ILGetDisplayName [SHELL32.15]
+ * ILGetDisplayName [SHELL32.15]
*/
BOOL WINAPI ILGetDisplayName(LPCITEMIDLIST pidl, LPVOID path)
{
- TRACE_(shell)("%p %p\n", pidl, path);
-
- if (SHELL_OsIsUnicode())
- return ILGetDisplayNameExW(NULL, pidl, path, ILGDN_FORPARSING);
- return ILGetDisplayNameExA(NULL, pidl, path, ILGDN_FORPARSING);
+ TRACE_(shell)("%p %p\n", pidl, path);
+ if (SHELL_OsIsUnicode())
+ return ILGetDisplayNameExW(NULL, pidl, path,
ILGDN_FORPARSING);
+ return ILGetDisplayNameExA(NULL, pidl, path, ILGDN_FORPARSING);
}
/***********************************************************************
**
@@ -187,21 +185,20 @@
*/
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
{
- LPCITEMIDLIST pidlLast = pidl;
+ LPCITEMIDLIST pidlLast = pidl;
- TRACE("(pidl=%p)\n",pidl);
+ TRACE("(pidl=%p)\n",pidl);
- if (!pidl)
- return NULL;
+ if (!pidl)
+ return NULL;
- while (pidl->mkid.cb)
- {
- pidlLast = pidl;
- pidl = ILGetNext(pidl);
- }
- return (LPITEMIDLIST)pidlLast;
+ while (pidl->mkid.cb)
+ {
+ pidlLast = pidl;
+ pidl = ILGetNext(pidl);
+ }
+ return (LPITEMIDLIST)pidlLast;
}
-
/***********************************************************************
**
* ILRemoveLastID [SHELL32.17]
*
@@ -210,12 +207,12 @@
*/
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
{
- TRACE_(shell)("pidl=%p\n",pidl);
+ TRACE_(shell)("pidl=%p\n",pidl);
- if (!pidl || !pidl->mkid.cb)
- return 0;
- ILFindLastID(pidl)->mkid.cb = 0;
- return 1;
+ if (!pidl || !pidl->mkid.cb)
+ return 0;
+ ILFindLastID(pidl)->mkid.cb = 0;
+ return 1;
}
/***********************************************************************
**
@@ -225,24 +222,22 @@
* duplicate an idlist
*/
LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl)
-{
- DWORD len;
- LPITEMIDLIST newpidl;
+{ DWORD len;
+ LPITEMIDLIST newpidl;
- if (!pidl)
- return NULL;
+ if (!pidl)
+ return NULL;
- len = ILGetSize(pidl);
- newpidl = (LPITEMIDLIST)SHAlloc(len);
- if (newpidl)
- memcpy(newpidl,pidl,len);
+ len = ILGetSize(pidl);
+ newpidl = (LPITEMIDLIST)SHAlloc(len);
+ if (newpidl)
+ memcpy(newpidl,pidl,len);
- TRACE("pidl=%p newpidl=%p\n",pidl, newpidl);
- pdump(pidl);
+ TRACE("pidl=%p newpidl=%p\n",pidl, newpidl);
+ pdump(pidl);
- return newpidl;
+ return newpidl;
}
-
/***********************************************************************
**
* ILCloneFirst [SHELL32.19]
*
@@ -250,28 +245,27 @@
* duplicates the first idlist of a complex pidl
*/
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
-{
- DWORD len;
- LPITEMIDLIST pidlNew = NULL;
+{ DWORD len;
+ LPITEMIDLIST pidlNew = NULL;
- TRACE("pidl=%p \n",pidl);
- pdump(pidl);
+ TRACE("pidl=%p \n",pidl);
+ pdump(pidl);
- if (pidl)
- {
- len = pidl->mkid.cb;
- pidlNew = (LPITEMIDLIST) SHAlloc (len+2);
- if (pidlNew)
- {
- memcpy(pidlNew,pidl,len+2); /* 2 -> mind a desktop
pidl */
+ if (pidl)
+ {
+ len = pidl->mkid.cb;
+ pidlNew = (LPITEMIDLIST) SHAlloc (len+2);
+ if (pidlNew)
+ {
+ memcpy(pidlNew,pidl,len+2); /* 2 -> mind a desktop
pidl */
- if (len)
- ILGetNext(pidlNew)->mkid.cb = 0x00;
- }
- }
- TRACE("-- newpidl=%p\n",pidlNew);
+ if (len)
+ ILGetNext(pidlNew)->mkid.cb = 0x00;
+ }
+ }
+ TRACE("-- newpidl=%p\n",pidlNew);
- return pidlNew;
+ return pidlNew;
}
/***********************************************************************
**
@@ -281,58 +275,51 @@
* the first two bytes are the len, the pidl is following then
*/
HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST *
ppPidl)
-{
- WORD wLen = 0;
- DWORD dwBytesRead;
- HRESULT ret = E_FAIL;
+{ WORD wLen = 0;
+ DWORD dwBytesRead;
+ HRESULT ret = E_FAIL;
- TRACE_(shell)("%p %p\n", pStream , ppPidl);
+ TRACE_(shell)("%p %p\n", pStream , ppPidl);
- if (*ppPidl)
- {
- SHFree(*ppPidl);
- *ppPidl = NULL;
- }
+ if (*ppPidl)
+ { SHFree(*ppPidl);
+ *ppPidl = NULL;
+ }
- IStream_AddRef (pStream);
+ IStream_AddRef (pStream);
- if (SUCCEEDED(IStream_Read(pStream, (LPVOID)&wLen, 2,
&dwBytesRead)))
- {
- TRACE("PIDL length is %d\n", wLen);
- if (wLen != 0)
- {
- *ppPidl = SHAlloc (wLen);
- if (SUCCEEDED(IStream_Read(pStream, *ppPidl , wLen,
&dwBytesRead)))
- {
- TRACE("Stream read OK\n");
- ret = S_OK;
- }
- else
- {
- WARN("reading pidl failed\n");
- SHFree(*ppPidl);
- *ppPidl = NULL;
- }
- }
- else
- {
- *ppPidl = NULL;
- ret = S_OK;
- }
- }
+ if (SUCCEEDED(IStream_Read(pStream, (LPVOID)&wLen, 2,
&dwBytesRead)))
+ {
+ TRACE("PIDL length is %d\n", wLen);
+ if (wLen != 0) {
+ *ppPidl = SHAlloc (wLen);
+ if (SUCCEEDED(IStream_Read(pStream, *ppPidl , wLen,
&dwBytesRead))) {
+ TRACE("Stream read OK\n");
+ ret = S_OK;
+ } else {
+ WARN("reading pidl failed\n");
+ SHFree(*ppPidl);
+ *ppPidl = NULL;
+ }
+ } else {
+ *ppPidl = NULL;
+ ret = S_OK;
+ }
+ }
- /* we are not yet fully compatible */
- if (*ppPidl && !pcheck(*ppPidl))
- {
- WARN("Check failed\n");
- SHFree(*ppPidl);
- *ppPidl = NULL;
- }
+ /* we are not yet fully compatible */
+ if (*ppPidl && !pcheck(*ppPidl))
+ {
+ WARN("Check failed\n");
+ SHFree(*ppPidl);
+ *ppPidl = NULL;
+ }
- IStream_Release (pStream);
- TRACE("done\n");
- return ret;
+
+ IStream_Release (pStream);
+ TRACE("done\n");
+ return ret;
}
/***********************************************************************
**
@@ -343,29 +330,30 @@
*/
HRESULT WINAPI ILSaveToStream (IStream * pStream, LPCITEMIDLIST pPidl)
{
- LPCITEMIDLIST pidl;
- WORD wLen = 0;
- HRESULT ret = E_FAIL;
+ LPCITEMIDLIST pidl;
+ WORD wLen = 0;
+ HRESULT ret = E_FAIL;
- TRACE_(shell)("%p %p\n", pStream, pPidl);
+ TRACE_(shell)("%p %p\n", pStream, pPidl);
- IStream_AddRef (pStream);
+ IStream_AddRef (pStream);
- pidl = pPidl;
- while (pidl->mkid.cb)
- {
- wLen += sizeof(WORD) + pidl->mkid.cb;
- pidl = ILGetNext(pidl);
- }
+ pidl = pPidl;
+ while (pidl->mkid.cb)
+ {
+ wLen += sizeof(WORD) + pidl->mkid.cb;
+ pidl = ILGetNext(pidl);
+ }
- if (SUCCEEDED(IStream_Write(pStream, (LPVOID)&wLen, 2, NULL)))
- {
- if (SUCCEEDED(IStream_Write(pStream, pPidl, wLen, NULL)))
- ret = S_OK;
- }
- IStream_Release (pStream);
+ if (SUCCEEDED(IStream_Write(pStream, (LPVOID)&wLen, 2, NULL)))
+ {
+ if (SUCCEEDED(IStream_Write(pStream, pPidl, wLen, NULL)))
+ { ret = S_OK;
+ }
+ }
+ IStream_Release (pStream);
- return ret;
+ return ret;
}
/***********************************************************************
**
@@ -387,37 +375,45 @@
*/
HRESULT WINAPI SHILCreateFromPathA(LPCSTR path, LPITEMIDLIST * ppidl,
DWORD * attributes)
{
- WCHAR lpszDisplayName[MAX_PATH];
+ LPSHELLFOLDER sf;
+ WCHAR lpszDisplayName[MAX_PATH];
+ DWORD pchEaten;
+ HRESULT ret = E_FAIL;
- TRACE_(shell)("%s %p 0x%08lx\n", path, ppidl, attributes ?
*attributes : 0);
+ TRACE_(shell)("%s %p 0x%08lx\n", path, ppidl, attributes ?
*attributes : 0);
- if (!MultiByteToWideChar(CP_ACP, 0, path, -1, lpszDisplayName,
MAX_PATH))
- lpszDisplayName[MAX_PATH-1] = 0;
+ if (!MultiByteToWideChar(CP_ACP, 0, path, -1, lpszDisplayName,
MAX_PATH))
+ lpszDisplayName[MAX_PATH-1] = 0;
- return SHILCreateFromPathW(lpszDisplayName, ppidl, attributes);
+ if (SUCCEEDED (SHGetDesktopFolder(&sf)))
+ {
+ ret = IShellFolder_ParseDisplayName(sf, 0, NULL,
lpszDisplayName, &pchEaten, ppidl, attributes);
+ IShellFolder_Release(sf);
+ }
+ return ret;
}
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST * ppidl,
DWORD * attributes)
{
- LPSHELLFOLDER sf;
- DWORD pchEaten;
- HRESULT ret = E_FAIL;
+ LPSHELLFOLDER sf;
+ DWORD pchEaten;
+ HRESULT ret = E_FAIL;
- TRACE_(shell)("%s %p 0x%08lx\n", debugstr_w(path), ppidl,
attributes ? *attributes : 0);
+ TRACE_(shell)("%s %p 0x%08lx\n", debugstr_w(path), ppidl,
attributes ? *attributes : 0);
- if (SUCCEEDED (SHGetDesktopFolder(&sf)))
- {
- ret = IShellFolder_ParseDisplayName(sf, 0, NULL, (LPWSTR)path,
&pchEaten, ppidl, attributes);
- IShellFolder_Release(sf);
- }
- return ret;
+ if (SUCCEEDED (SHGetDesktopFolder(&sf)))
+ {
+ ret = IShellFolder_ParseDisplayName(sf, 0, NULL, (LPWSTR)path,
&pchEaten, ppidl, attributes);
+ IShellFolder_Release(sf);
+ }
+ return ret;
}
HRESULT WINAPI SHILCreateFromPathAW (LPCVOID path, LPITEMIDLIST *
ppidl, DWORD * attributes)
{
- if ( SHELL_OsIsUnicode())
- return SHILCreateFromPathW (path, ppidl, attributes);
- return SHILCreateFromPathA (path, ppidl, attributes);
+ if ( SHELL_OsIsUnicode())
+ return SHILCreateFromPathW (path, ppidl, attributes);
+ return SHILCreateFromPathA (path, ppidl, attributes);
}
/***********************************************************************
**
@@ -426,9 +422,9 @@
* Create an ItemIDList to one of the special folders.
* PARAMS
- * hwndOwner [in]
- * nFolder [in] CSIDL_xxxxx
- * fCreate [in] Create folder if it does not exist
+ * hwndOwner [in]
+ * nFolder [in] CSIDL_xxxxx
+ * fCreate [in] Create folder if it does not exist
*
* RETURNS
* Success: The newly created pidl
@@ -440,15 +436,14 @@
* shells IMalloc interface, aka ILFree.
*/
LPITEMIDLIST WINAPI SHCloneSpecialIDList(HWND hwndOwner, DWORD nFolder,
BOOL fCreate)
-{
- LPITEMIDLIST ppidl;
- TRACE_(shell)("(hwnd=%p,csidl=0x%lx,%s).\n", hwndOwner, nFolder,
fCreate ? "T" : "F");
+{ LPITEMIDLIST ppidl;
+ TRACE_(shell)("(hwnd=%p,csidl=0x%lx,%s).\n", hwndOwner, nFolder,
fCreate ? "T" : "F");
- if (fCreate)
- nFolder |= CSIDL_FLAG_CREATE;
+ if (fCreate)
+ nFolder |= CSIDL_FLAG_CREATE;
- SHGetSpecialFolderLocation(hwndOwner, nFolder, &ppidl);
- return ppidl;
+ SHGetSpecialFolderLocation(hwndOwner, nFolder, &ppidl);
+ return ppidl;
}
/***********************************************************************
**
@@ -466,22 +461,21 @@
* exported by ordinal.
*/
[truncated at 1000 lines; 10064 more skipped]