mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 03:12:59 +00:00
some small improvements
svn path=/trunk/; revision=7489
This commit is contained in:
parent
769315c915
commit
38883fca0b
5 changed files with 23 additions and 28 deletions
|
@ -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);
|
PathMap::iterator found = _pathMap.find(path);
|
||||||
|
|
||||||
if (found != _pathMap.end())
|
if (found != _pathMap.end())
|
||||||
|
|
|
@ -44,7 +44,7 @@ enum ICON_TYPE {
|
||||||
IT_STATIC,
|
IT_STATIC,
|
||||||
IT_CACHED,
|
IT_CACHED,
|
||||||
IT_DYNAMIC,
|
IT_DYNAMIC,
|
||||||
IT_SYSCACHE
|
IT_SYSCACHE ///@todo
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ICON_ID {
|
enum ICON_ID {
|
||||||
|
@ -85,7 +85,7 @@ struct Icon {
|
||||||
struct IconCache {
|
struct IconCache {
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
const Icon& extract(String path);
|
const Icon& extract(const String& path);
|
||||||
const Icon& extract(LPCTSTR path, int idx);
|
const Icon& extract(LPCTSTR path, int idx);
|
||||||
const Icon& extract(IExtractIcon* pExtract, LPCTSTR path, int idx);
|
const Icon& extract(IExtractIcon* pExtract, LPCTSTR path, int idx);
|
||||||
|
|
||||||
|
|
|
@ -61,11 +61,13 @@ bool ShellDirectory::fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN
|
||||||
|
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
LPCTSTR path = (LPCTSTR)GlobalLock(medium.UNION_MEMBER(hGlobal));
|
LPCTSTR path = (LPCTSTR)GlobalLock(medium.UNION_MEMBER(hGlobal));
|
||||||
UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS);
|
|
||||||
|
|
||||||
// fill with drive names "C:", ...
|
// fill with drive names "C:", ...
|
||||||
|
assert(_tcslen(path) < GlobalSize(medium.UNION_MEMBER(hGlobal)));
|
||||||
_tcscpy(pw32fdata->cFileName, path);
|
_tcscpy(pw32fdata->cFileName, path);
|
||||||
|
|
||||||
|
UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||||
|
|
||||||
if (GetFileAttributesEx(path, GetFileExInfoStandard, &fad)) {
|
if (GetFileAttributesEx(path, GetFileExInfoStandard, &fad)) {
|
||||||
pw32fdata->dwFileAttributes = fad.dwFileAttributes;
|
pw32fdata->dwFileAttributes = fad.dwFileAttributes;
|
||||||
pw32fdata->ftCreationTime = fad.ftCreationTime;
|
pw32fdata->ftCreationTime = fad.ftCreationTime;
|
||||||
|
@ -115,14 +117,13 @@ ShellPath ShellEntry::create_absolute_pidl() const
|
||||||
CONTEXT("ShellEntry::create_absolute_pidl()");
|
CONTEXT("ShellEntry::create_absolute_pidl()");
|
||||||
|
|
||||||
if (_up)
|
if (_up)
|
||||||
if (_up->_etype==ET_SHELL) {
|
if (_up->_etype == ET_SHELL) {
|
||||||
ShellDirectory* dir = static_cast<ShellDirectory*>(_up);
|
ShellDirectory* dir = static_cast<ShellDirectory*>(_up);
|
||||||
|
|
||||||
if (dir->_pidl->mkid.cb) // Caching of absolute PIDLs could enhance performance.
|
if (dir->_pidl->mkid.cb) // Caching of absolute PIDLs could enhance performance.
|
||||||
return _pidl.create_absolute_pidl(dir->create_absolute_pidl());
|
return _pidl.create_absolute_pidl(dir->create_absolute_pidl());
|
||||||
} else {
|
} else
|
||||||
return _pidl.create_absolute_pidl(_up->create_absolute_pidl());
|
return _pidl.create_absolute_pidl(_up->create_absolute_pidl());
|
||||||
}
|
|
||||||
|
|
||||||
return _pidl;
|
return _pidl;
|
||||||
}
|
}
|
||||||
|
@ -138,13 +139,13 @@ bool ShellEntry::get_path(PTSTR path) const
|
||||||
return false;
|
return false;
|
||||||
*/
|
*/
|
||||||
FileSysShellPath fs_path(create_absolute_pidl());
|
FileSysShellPath fs_path(create_absolute_pidl());
|
||||||
|
LPCTSTR ret = fs_path;
|
||||||
|
|
||||||
if (!(LPCTSTR)fs_path)
|
if (ret) {
|
||||||
|
_tcscpy(path, ret);
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_tcscpy(path, fs_path);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,8 @@ CommonDesktop::~CommonDesktop()
|
||||||
|
|
||||||
HRESULT path_from_pidlA(IShellFolder* folder, LPCITEMIDLIST pidl, LPSTR buffer, int len)
|
HRESULT path_from_pidlA(IShellFolder* folder, LPCITEMIDLIST pidl, LPSTR buffer, int len)
|
||||||
{
|
{
|
||||||
|
CONTEXT("path_from_pidlA()");
|
||||||
|
|
||||||
StrRetA str;
|
StrRetA str;
|
||||||
|
|
||||||
HRESULT hr = folder->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str);
|
HRESULT hr = folder->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str);
|
||||||
|
|
|
@ -545,10 +545,9 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
|
||||||
{
|
{
|
||||||
CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCWSTR)");
|
CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCWSTR)");
|
||||||
|
|
||||||
if (path) {
|
if (path)
|
||||||
ULONG l;
|
CHECKERROR(folder->ParseDisplayName(0, 0, (LPOLESTR)path, NULL, &_p, 0));
|
||||||
CHECKERROR(folder->ParseDisplayName(0, 0, (LPOLESTR)path, &l, &_p, 0));
|
else
|
||||||
} else
|
|
||||||
_p = NULL;
|
_p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,10 +555,9 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
|
||||||
{
|
{
|
||||||
OBJ_CONTEXT("ShellPath::ShellPath(LPCWSTR)", path);
|
OBJ_CONTEXT("ShellPath::ShellPath(LPCWSTR)", path);
|
||||||
|
|
||||||
if (path) {
|
if (path)
|
||||||
ULONG l;
|
CHECKERROR(Desktop()->ParseDisplayName(0, 0, (LPOLESTR)path, NULL, &_p, 0));
|
||||||
CHECKERROR(Desktop()->ParseDisplayName(0, 0, (LPOLESTR)path, &l, &_p, 0));
|
else
|
||||||
} else
|
|
||||||
_p = NULL;
|
_p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,12 +565,11 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
|
||||||
{
|
{
|
||||||
CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCSTR)");
|
CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCSTR)");
|
||||||
|
|
||||||
ULONG l;
|
|
||||||
WCHAR b[MAX_PATH];
|
WCHAR b[MAX_PATH];
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
MultiByteToWideChar(CP_ACP, 0, path, -1, b, MAX_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
|
} else
|
||||||
_p = NULL;
|
_p = NULL;
|
||||||
}
|
}
|
||||||
|
@ -581,12 +578,11 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
|
||||||
{
|
{
|
||||||
CONTEXT("ShellPath::ShellPath(LPCSTR)");
|
CONTEXT("ShellPath::ShellPath(LPCSTR)");
|
||||||
|
|
||||||
ULONG l;
|
|
||||||
WCHAR b[MAX_PATH];
|
WCHAR b[MAX_PATH];
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
MultiByteToWideChar(CP_ACP, 0, path, -1, b, MAX_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
|
} else
|
||||||
_p = NULL;
|
_p = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue