diff --git a/reactos/subsys/system/explorer/explorer.cpp b/reactos/subsys/system/explorer/explorer.cpp index 6144b0908ad..d4a862da662 100644 --- a/reactos/subsys/system/explorer/explorer.cpp +++ b/reactos/subsys/system/explorer/explorer.cpp @@ -172,12 +172,8 @@ void IconCache::init() } -const Icon& IconCache::extract(String path) +const Icon& IconCache::extract(const String& path) { -#ifndef __WINE__ ///@todo - _tcslwr((LPTSTR)path.c_str()); -#endif - PathMap::iterator found = _pathMap.find(path); if (found != _pathMap.end()) diff --git a/reactos/subsys/system/explorer/globals.h b/reactos/subsys/system/explorer/globals.h index 6d4d3b7448a..a5d559f3364 100644 --- a/reactos/subsys/system/explorer/globals.h +++ b/reactos/subsys/system/explorer/globals.h @@ -44,7 +44,7 @@ enum ICON_TYPE { IT_STATIC, IT_CACHED, IT_DYNAMIC, - IT_SYSCACHE + IT_SYSCACHE ///@todo }; enum ICON_ID { @@ -85,7 +85,7 @@ struct Icon { struct IconCache { void init(); - const Icon& extract(String path); + const Icon& extract(const String& path); const Icon& extract(LPCTSTR path, int idx); const Icon& extract(IExtractIcon* pExtract, LPCTSTR path, int idx); diff --git a/reactos/subsys/system/explorer/shell/shellfs.cpp b/reactos/subsys/system/explorer/shell/shellfs.cpp index 4af67eccea6..409b2c6b1ff 100644 --- a/reactos/subsys/system/explorer/shell/shellfs.cpp +++ b/reactos/subsys/system/explorer/shell/shellfs.cpp @@ -61,11 +61,13 @@ bool ShellDirectory::fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN if (SUCCEEDED(hr)) { LPCTSTR path = (LPCTSTR)GlobalLock(medium.UNION_MEMBER(hGlobal)); - UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS); // fill with drive names "C:", ... + assert(_tcslen(path) < GlobalSize(medium.UNION_MEMBER(hGlobal))); _tcscpy(pw32fdata->cFileName, path); + UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS); + if (GetFileAttributesEx(path, GetFileExInfoStandard, &fad)) { pw32fdata->dwFileAttributes = fad.dwFileAttributes; pw32fdata->ftCreationTime = fad.ftCreationTime; @@ -115,14 +117,13 @@ ShellPath ShellEntry::create_absolute_pidl() const CONTEXT("ShellEntry::create_absolute_pidl()"); if (_up) - if (_up->_etype==ET_SHELL) { + if (_up->_etype == ET_SHELL) { ShellDirectory* dir = static_cast(_up); if (dir->_pidl->mkid.cb) // Caching of absolute PIDLs could enhance performance. return _pidl.create_absolute_pidl(dir->create_absolute_pidl()); - } else { + } else return _pidl.create_absolute_pidl(_up->create_absolute_pidl()); - } return _pidl; } @@ -138,13 +139,13 @@ bool ShellEntry::get_path(PTSTR path) const return false; */ FileSysShellPath fs_path(create_absolute_pidl()); + LPCTSTR ret = fs_path; - if (!(LPCTSTR)fs_path) + if (ret) { + _tcscpy(path, ret); + return true; + } else return false; - - _tcscpy(path, fs_path); - - return true; } diff --git a/reactos/subsys/system/explorer/utility/shellclasses.cpp b/reactos/subsys/system/explorer/utility/shellclasses.cpp index d447f3e7173..5b92959e0b2 100644 --- a/reactos/subsys/system/explorer/utility/shellclasses.cpp +++ b/reactos/subsys/system/explorer/utility/shellclasses.cpp @@ -130,6 +130,8 @@ CommonDesktop::~CommonDesktop() HRESULT path_from_pidlA(IShellFolder* folder, LPCITEMIDLIST pidl, LPSTR buffer, int len) { + CONTEXT("path_from_pidlA()"); + StrRetA str; HRESULT hr = folder->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str); diff --git a/reactos/subsys/system/explorer/utility/shellclasses.h b/reactos/subsys/system/explorer/utility/shellclasses.h index bafd0bde600..7a5b965fe50 100644 --- a/reactos/subsys/system/explorer/utility/shellclasses.h +++ b/reactos/subsys/system/explorer/utility/shellclasses.h @@ -545,10 +545,9 @@ struct ShellPath : public SShellPtr { CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCWSTR)"); - if (path) { - ULONG l; - CHECKERROR(folder->ParseDisplayName(0, 0, (LPOLESTR)path, &l, &_p, 0)); - } else + if (path) + CHECKERROR(folder->ParseDisplayName(0, 0, (LPOLESTR)path, NULL, &_p, 0)); + else _p = NULL; } @@ -556,10 +555,9 @@ struct ShellPath : public SShellPtr { OBJ_CONTEXT("ShellPath::ShellPath(LPCWSTR)", path); - if (path) { - ULONG l; - CHECKERROR(Desktop()->ParseDisplayName(0, 0, (LPOLESTR)path, &l, &_p, 0)); - } else + if (path) + CHECKERROR(Desktop()->ParseDisplayName(0, 0, (LPOLESTR)path, NULL, &_p, 0)); + else _p = NULL; } @@ -567,12 +565,11 @@ struct ShellPath : public SShellPtr { CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCSTR)"); - ULONG l; WCHAR b[MAX_PATH]; if (path) { MultiByteToWideChar(CP_ACP, 0, path, -1, b, MAX_PATH); - CHECKERROR(folder->ParseDisplayName(0, 0, b, &l, &_p, 0)); + CHECKERROR(folder->ParseDisplayName(0, 0, b, NULL, &_p, 0)); } else _p = NULL; } @@ -581,12 +578,11 @@ struct ShellPath : public SShellPtr { CONTEXT("ShellPath::ShellPath(LPCSTR)"); - ULONG l; WCHAR b[MAX_PATH]; if (path) { MultiByteToWideChar(CP_ACP, 0, path, -1, b, MAX_PATH); - CHECKERROR(Desktop()->ParseDisplayName(0, 0, b, &l, &_p, 0)); + CHECKERROR(Desktop()->ParseDisplayName(0, 0, b, NULL, &_p, 0)); } else _p = NULL; }