Author: gadamopoulos
Date: Mon Nov 3 21:14:49 2014
New Revision: 65236
URL:
http://svn.reactos.org/svn/reactos?rev=65236&view=rev
Log:
[SHELL32]
- Make CFontsFolder a dumb wrapper around CFSFolder
Modified:
branches/shell-experiments/dll/win32/shell32/folders/fonts.cpp
branches/shell-experiments/dll/win32/shell32/folders/fonts.h
Modified: branches/shell-experiments/dll/win32/shell32/folders/fonts.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/fonts.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/fonts.cpp [iso-8859-1] Mon Nov 3
21:14:49 2014
@@ -34,142 +34,11 @@
* IShellFolder implementation
*/
-class CDesktopFolderEnumZ: public IEnumIDListImpl
-{
- public:
- CDesktopFolderEnumZ();
- ~CDesktopFolderEnumZ();
- HRESULT WINAPI Initialize(DWORD dwFlags);
- BOOL CreateFontsEnumList(DWORD dwFlags);
-
- BEGIN_COM_MAP(CDesktopFolderEnumZ)
- COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
- END_COM_MAP()
-};
-
-static shvheader FontsSFHeader[] = {
- {IDS_SHV_COLUMN8, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
- {IDS_SHV_COLUMN_FONTTYPE , SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT,
LVCFMT_RIGHT, 15},
- {IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
- {IDS_SHV_COLUMN12, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15}
-};
-
-#define COLUMN_NAME 0
-#define COLUMN_TYPE 1
-#define COLUMN_SIZE 2
-#define COLUMN_FILENAME 3
-
-#define FontsSHELLVIEWCOLUMNS (4)
-
-CDesktopFolderEnumZ::CDesktopFolderEnumZ()
-{
-}
-
-CDesktopFolderEnumZ::~CDesktopFolderEnumZ()
-{
-}
-
-HRESULT WINAPI CDesktopFolderEnumZ::Initialize(DWORD dwFlags)
-{
- if (CreateFontsEnumList(dwFlags) == FALSE)
- return E_FAIL;
- return S_OK;
-}
-
-static LPITEMIDLIST _ILCreateFontItem(LPWSTR pszFont, LPWSTR pszFile)
-{
- LPITEMIDLIST pidl;
- LPPIDLDATA data;
- int length = wcslen(pszFont) + 1;
- int size = sizeof(PIDLDATA) + sizeof(ITEMIDLIST);
-
- size += length * sizeof(WCHAR);
- size += (wcslen(pszFile) + 1) * sizeof(WCHAR);
-
- pidl = (LPITEMIDLIST)SHAlloc(size + 5);
- if (!pidl)
- return pidl;
-
- ZeroMemory(pidl, size + 5);
- pidl->mkid.cb = size + 3;
-
- data = _ILGetDataPointer(pidl);
- data->type = 0x00;
- data->u.cfont.dummy = 0xFF;
- data->u.cfont.offsFile = length;
- wcscpy(data->u.cfont.szName, pszFont);
- wcscpy(&data->u.cfont.szName[length], pszFile);
-
- return pidl;
-}
-
-static PIDLFontStruct * _ILGetFontStruct(LPCITEMIDLIST pidl)
-{
- LPPIDLDATA pdata = _ILGetDataPointer(pidl);
-
- if (pdata && pdata->type == 0x00)
- return (PIDLFontStruct*) & (pdata->u.cfont);
-
- return NULL;
-}
-
-/**************************************************************************
- * CDesktopFolderEnumZ::CreateFontsEnumList()
- */
-BOOL CDesktopFolderEnumZ::CreateFontsEnumList(DWORD dwFlags)
-{
- WCHAR szPath[MAX_PATH];
- WCHAR szName[LF_FACESIZE+20];
- WCHAR szFile[MAX_PATH];
- LPWSTR pszPath;
- UINT Length;
- LONG ret;
- DWORD dwType, dwName, dwFile, dwIndex;
- LPITEMIDLIST pidl;
- HKEY hKey;
-
- if (dwFlags & SHCONTF_NONFOLDERS)
- {
- if (!SHGetSpecialFolderPathW(NULL, szPath, CSIDL_FONTS, FALSE))
- return FALSE;
-
- pszPath = PathAddBackslashW(szPath);
- if (!pszPath)
- return FALSE;
- if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows
NT\\CurrentVersion\\Fonts", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
- return FALSE;
-
- Length = pszPath - szPath;
- dwIndex = 0;
- do
- {
- dwName = sizeof(szName) / sizeof(WCHAR);
- dwFile = sizeof(szFile) / sizeof(WCHAR);
- ret = RegEnumValueW(hKey, dwIndex++, szName, &dwName, NULL, &dwType,
(LPBYTE)szFile, &dwFile);
- if (ret == ERROR_SUCCESS)
- {
- szFile[(sizeof(szFile)/sizeof(WCHAR))-1] = L'\0';
- if (dwType == REG_SZ && wcslen(szFile) + Length + 1 <
(sizeof(szPath) / sizeof(WCHAR)))
- {
- wcscpy(&szPath[Length], szFile);
- pidl = _ILCreateFontItem(szName, szPath);
- TRACE("pidl %p name %s path %s\n", pidl,
debugstr_w(szName), debugstr_w(szPath));
- if (pidl)
- {
- if (!AddToEnumList(pidl))
- SHFree(pidl);
- }
- }
- }
- } while(ret != ERROR_NO_MORE_ITEMS);
- RegCloseKey(hKey);
-
- }
- return TRUE;
-}
-
CFontsFolder::CFontsFolder()
{
+ m_pisfInner = NULL;
+ m_pisf2Inner = NULL;
+
pidlRoot = NULL;
apidl = NULL;
}
@@ -182,259 +51,83 @@
HRESULT WINAPI CFontsFolder::FinalConstruct()
{
- pidlRoot = _ILCreateFont(); /* my qualified pidl */
- if (pidlRoot == NULL)
- return E_OUTOFMEMORY;
- return S_OK;
-}
-
-/**************************************************************************
-* CFontsFolder::ParseDisplayName
-*/
-HRESULT WINAPI CFontsFolder::ParseDisplayName(
- HWND hwndOwner,
- LPBC pbcReserved,
- LPOLESTR lpszDisplayName,
- DWORD *pchEaten,
- PIDLIST_RELATIVE *ppidl,
- DWORD * pdwAttributes)
-{
- HRESULT hr = E_UNEXPECTED;
-
- TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
- hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName),
- pchEaten, ppidl, pdwAttributes);
-
- *ppidl = 0;
- if (pchEaten)
- *pchEaten = 0; /* strange but like the original */
-
- TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr);
+ HRESULT hr;
+ CComPtr<IPersistFolder3> ppf3;
+ hr = SHCoCreateInstance(NULL, &CLSID_ShellFSFolder, NULL,
IID_PPV_ARG(IShellFolder, &m_pisfInner));
+ if (FAILED(hr))
+ return hr;
+
+ hr = m_pisfInner->QueryInterface(IID_PPV_ARG(IShellFolder2, &m_pisf2Inner));
+ if (FAILED(hr))
+ return hr;
+
+ hr = m_pisfInner->QueryInterface(IID_PPV_ARG(IPersistFolder3, &ppf3));
+ if (FAILED(hr))
+ return hr;
+
+ PERSIST_FOLDER_TARGET_INFO info;
+ ZeroMemory(&info, sizeof(PERSIST_FOLDER_TARGET_INFO));
+ info.csidl = CSIDL_FONTS;
+ hr = ppf3->InitializeEx(NULL, _ILCreateFont(), &info);
return hr;
}
-/**************************************************************************
-* CFontsFolder::EnumObjects
-*/
+
+HRESULT WINAPI CFontsFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR
lpszDisplayName,
+ ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
+{
+ return m_pisfInner->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten,
ppidl, pdwAttributes);
+}
+
HRESULT WINAPI CFontsFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST
*ppEnumIDList)
{
- return ShellObjectCreatorInit<CDesktopFolderEnumZ>(dwFlags, IID_IEnumIDList,
ppEnumIDList);
-}
-
-/**************************************************************************
-* CFontsFolder::BindToObject
-*/
+ return m_pisfInner->EnumObjects(hwndOwner, dwFlags, ppEnumIDList);
+}
+
HRESULT WINAPI CFontsFolder::BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved,
REFIID riid, LPVOID *ppvOut)
{
- TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", this,
- pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
-
- return SHELL32_BindToChild (pidlRoot, NULL, pidl, riid, ppvOut);
-}
-
-/**************************************************************************
-* CFontsFolder::BindToStorage
-*/
+ return m_pisfInner->BindToObject(pidl, pbcReserved, riid, ppvOut);
+}
+
HRESULT WINAPI CFontsFolder::BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved,
REFIID riid, LPVOID *ppvOut)
{
- FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
- pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
-
- *ppvOut = NULL;
- return E_NOTIMPL;
-}
-
-/**************************************************************************
-* CFontsFolder::CompareIDs
-*/
+ return m_pisfInner->BindToStorage(pidl, pbcReserved, riid, ppvOut);
+}
HRESULT WINAPI CFontsFolder::CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1,
PCUIDLIST_RELATIVE pidl2)
{
- int nReturn;
-
- TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", this, lParam, pidl1,
pidl2);
- nReturn = SHELL32_CompareIDs (this, lParam, pidl1, pidl2);
- TRACE ("-- %i\n", nReturn);
- return nReturn;
-}
-
-/**************************************************************************
-* CFontsFolder::CreateViewObject
-*/
+ return m_pisfInner->CompareIDs(lParam, pidl1, pidl2);
+}
+
HRESULT WINAPI CFontsFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID
*ppvOut)
{
- CComPtr<IShellView> pShellView;
- HRESULT hr = E_INVALIDARG;
-
- TRACE ("(%p)->(hwnd=%p,%s,%p)\n", this,
- hwndOwner, shdebugstr_guid (&riid), ppvOut);
-
- if (!ppvOut)
- return hr;
-
- *ppvOut = NULL;
-
- if (IsEqualIID (riid, IID_IDropTarget))
- {
- WARN ("IDropTarget not implemented\n");
- hr = E_NOTIMPL;
- }
- else if (IsEqualIID (riid, IID_IContextMenu))
- {
- WARN ("IContextMenu not implemented\n");
- hr = E_NOTIMPL;
- }
- else if (IsEqualIID (riid, IID_IShellView))
- {
- hr = IShellView_Constructor (this, &pShellView);
- if (pShellView)
- hr = pShellView->QueryInterface(riid, ppvOut);
- }
- TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
- return hr;
-}
-
-/**************************************************************************
-* CFontsFolder::GetAttributesOf
-*/
+ return m_pisfInner->CreateViewObject(hwndOwner, riid, ppvOut);
+}
+
HRESULT WINAPI CFontsFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl,
DWORD *rgfInOut)
{
- HRESULT hr = S_OK;
-
- TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", this,
- cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
-
- if (!rgfInOut)
- return E_INVALIDARG;
- if (cidl && !apidl)
- return E_INVALIDARG;
-
- if (*rgfInOut == 0)
- *rgfInOut = ~0;
-
- if (cidl == 0)
- {
- CComPtr<IShellFolder> psfParent;
- LPCITEMIDLIST rpidl = NULL;
-
- hr = SHBindToParent(pidlRoot, IID_PPV_ARG(IShellFolder, &psfParent),
(LPCITEMIDLIST *)&rpidl);
- if (SUCCEEDED(hr))
- SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
- }
- else
- {
- while (cidl > 0 && *apidl)
- {
- pdump (*apidl);
- SHELL32_GetItemAttributes (this, *apidl, rgfInOut);
- apidl++;
- cidl--;
- }
- }
-
- /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
- *rgfInOut &= ~SFGAO_VALIDATE;
-
- TRACE ("-- result=0x%08x\n", *rgfInOut);
- return hr;
-}
-
-/**************************************************************************
-* CFontsFolder::GetUIObjectOf
-*
-* PARAMETERS
-* hwndOwner [in] Parent window for any output
-* cidl [in] array size
-* apidl [in] simple pidl array
-* riid [in] Requested Interface
-* prgfInOut [ ] reserved
-* ppvObject [out] Resulting Interface
-*
-*/
-HRESULT WINAPI CFontsFolder::GetUIObjectOf(
- HWND hwndOwner,
- UINT cidl, PCUITEMID_CHILD_ARRAY apidl,
- REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
-{
- LPITEMIDLIST pidl;
- CComPtr<IUnknown> pObj;
- HRESULT hr = E_INVALIDARG;
-
- TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
- hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
-
- if (!ppvOut)
- return hr;
-
- *ppvOut = NULL;
-
- if (IsEqualIID (riid, IID_IContextMenu) && (cidl >= 1))
- {
- pObj = (IContextMenu *)this;
- this->apidl = apidl[0];
- hr = S_OK;
- }
- else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
- {
- hr = IDataObject_Constructor (hwndOwner, pidlRoot, apidl, cidl, (IDataObject
**)&pObj);
- }
- else if (IsEqualIID (riid, IID_IExtractIconA) && (cidl == 1))
- {
- pidl = ILCombine (pidlRoot, apidl[0]);
- pObj = IExtractIconA_Constructor (pidl);
- SHFree (pidl);
- hr = S_OK;
- }
- else if (IsEqualIID (riid, IID_IExtractIconW) && (cidl == 1))
- {
- pidl = ILCombine (pidlRoot, apidl[0]);
- pObj = IExtractIconW_Constructor (pidl);
- SHFree (pidl);
- hr = S_OK;
- }
- else if (IsEqualIID (riid, IID_IDropTarget) && (cidl >= 1))
- {
- IDropTarget * pDt = NULL;
- hr = this->QueryInterface(IID_PPV_ARG(IDropTarget, &pDt));
- pObj = pDt;
- }
- else
- hr = E_NOINTERFACE;
-
- if (SUCCEEDED(hr) && !pObj)
- hr = E_OUTOFMEMORY;
-
- *ppvOut = pObj.Detach();
- TRACE ("(%p)->hr=0x%08x\n", this, hr);
- return hr;
-}
-
-/**************************************************************************
-* CFontsFolder::GetDisplayNameOf
-*
-*/
+ return m_pisfInner->GetAttributesOf(cidl, apidl, rgfInOut);
+}
+
+HRESULT WINAPI CFontsFolder::GetUIObjectOf(HWND hwndOwner, UINT cidl,
PCUITEMID_CHILD_ARRAY apidl,
+ REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
+{
+ return m_pisfInner->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut,
ppvOut);
+}
+
HRESULT WINAPI CFontsFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags,
LPSTRRET strRet)
{
- PIDLFontStruct *pFont;
-
- TRACE("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
+ if (!_ILIsSpecialFolder(pidl))
+ return m_pisfInner->GetDisplayNameOf(pidl, dwFlags, strRet);
+
+ TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
pdump (pidl);
if (!strRet)
return E_INVALIDARG;
- pFont = _ILGetFontStruct(pidl);
- if (pFont)
- {
- strRet->pOleStr = (LPWSTR)CoTaskMemAlloc((wcslen(pFont->szName) + 1) *
sizeof(WCHAR));
- if (!strRet->pOleStr)
- return E_OUTOFMEMORY;
-
- wcscpy(strRet->pOleStr, pFont->szName);
- strRet->uType = STRRET_WSTR;
- }
- else if (!pidl->mkid.cb)
+if (!pidl->mkid.cb)
{
WCHAR wszPath[MAX_PATH];
@@ -453,176 +146,52 @@
wcscpy(strRet->pOleStr, wszPath);
strRet->uType = STRRET_WSTR;
+
+ return S_OK;
}
else
return E_INVALIDARG;
-
- return S_OK;
-}
-
-/**************************************************************************
-* CFontsFolder::SetNameOf
-* Changes the name of a file object or subfolder, possibly changing its item
-* identifier in the process.
-*
-* PARAMETERS
-* hwndOwner [in] Owner window for output
-* pidl [in] simple pidl of item to change
-* lpszName [in] the items new display name
-* dwFlags [in] SHGNO formatting flags
-* ppidlOut [out] simple pidl returned
-*/
-HRESULT WINAPI CFontsFolder::SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, /*simple
pidl */
- LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD
*pPidlOut)
-{
- FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this,
- hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
- return E_FAIL;
+}
+
+HRESULT WINAPI CFontsFolder::SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, /* simple
pidl */
+ LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
+{
+ return m_pisfInner->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
}
HRESULT WINAPI CFontsFolder::GetDefaultSearchGUID(GUID *pguid)
{
- FIXME ("(%p)\n", this);
- return E_NOTIMPL;
-}
-
-HRESULT WINAPI CFontsFolder::EnumSearches(IEnumExtraSearch **ppenum)
-{
- FIXME ("(%p)\n", this);
- return E_NOTIMPL;
+ return m_pisf2Inner->GetDefaultSearchGUID(pguid);
+}
+
+HRESULT WINAPI CFontsFolder::EnumSearches(IEnumExtraSearch ** ppenum)
+{
+ return m_pisf2Inner->EnumSearches(ppenum);
}
HRESULT WINAPI CFontsFolder::GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG
*pDisplay)
{
- TRACE ("(%p)\n", this);
-
- if (pSort)
- *pSort = 0;
- if (pDisplay)
- *pDisplay = 0;
-
- return S_OK;
+ return m_pisf2Inner->GetDefaultColumn(dwRes, pSort, pDisplay);
}
HRESULT WINAPI CFontsFolder::GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags)
{
- TRACE ("(%p)\n", this);
-
- if (!pcsFlags || iColumn >= FontsSHELLVIEWCOLUMNS)
- return E_INVALIDARG;
- *pcsFlags = FontsSFHeader[iColumn].pcsFlags;
- return S_OK;
+ return m_pisf2Inner->GetDefaultColumnState(iColumn, pcsFlags);
}
HRESULT WINAPI CFontsFolder::GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid,
VARIANT *pv)
{
- FIXME ("(%p)\n", this);
- return E_NOTIMPL;
+ return m_pisf2Inner->GetDetailsEx(pidl, pscid, pv);
}
HRESULT WINAPI CFontsFolder::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn,
SHELLDETAILS *psd)
{
- WCHAR buffer[MAX_PATH] = {0};
- HRESULT hr = E_FAIL;
- PIDLFontStruct * pfont;
- HANDLE hFile;
- LARGE_INTEGER FileSize;
- SHFILEINFOW fi;
-
- TRACE("(%p, %p, %d, %p)\n", this, pidl, iColumn, psd);
-
- if (iColumn >= FontsSHELLVIEWCOLUMNS)
- return E_FAIL;
-
- psd->fmt = FontsSFHeader[iColumn].fmt;
- psd->cxChar = FontsSFHeader[iColumn].cxChar;
- if (pidl == NULL)
- {
- psd->str.uType = STRRET_WSTR;
- if (LoadStringW(shell32_hInstance, FontsSFHeader[iColumn].colnameid, buffer,
MAX_PATH))
- hr = SHStrDupW(buffer, &psd->str.pOleStr);
-
- return hr;
- }
-
- if (iColumn == COLUMN_NAME)
- {
- psd->str.uType = STRRET_WSTR;
- return GetDisplayNameOf(pidl, SHGDN_NORMAL, &psd->str);
- }
-
- psd->str.uType = STRRET_CSTR;
- psd->str.cStr[0] = '\0';
-
- switch(iColumn)
- {
- case COLUMN_TYPE:
- pfont = _ILGetFontStruct(pidl);
- if (pfont)
- {
- if (SHGetFileInfoW(pfont->szName + pfont->offsFile, 0, &fi,
sizeof(fi), SHGFI_TYPENAME))
- {
- psd->str.pOleStr = (LPWSTR)CoTaskMemAlloc((wcslen(fi.szTypeName) +
1) * sizeof(WCHAR));
- if (!psd->str.pOleStr)
- return E_OUTOFMEMORY;
- wcscpy(psd->str.pOleStr, fi.szTypeName);
- psd->str.uType = STRRET_WSTR;
- return S_OK;
- }
- }
- break;
- case COLUMN_SIZE:
- pfont = _ILGetFontStruct(pidl);
- if (pfont)
- {
- hFile = CreateFileW(pfont->szName + pfont->offsFile, GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (hFile != INVALID_HANDLE_VALUE)
- {
- if (GetFileSizeEx(hFile, &FileSize))
- {
- if (StrFormatByteSizeW(FileSize.QuadPart, buffer, sizeof(buffer)
/ sizeof(WCHAR)))
- {
- psd->str.pOleStr = (LPWSTR)CoTaskMemAlloc((wcslen(buffer)
+ 1) * sizeof(WCHAR));
- if (!psd->str.pOleStr)
- {
- CloseHandle(hFile);
- return E_OUTOFMEMORY;
- }
- wcscpy(psd->str.pOleStr, buffer);
- psd->str.uType = STRRET_WSTR;
- CloseHandle(hFile);
- return S_OK;
- }
- }
- CloseHandle(hFile);
- }
- }
- break;
- case COLUMN_FILENAME:
- pfont = _ILGetFontStruct(pidl);
- if (pfont)
- {
- psd->str.pOleStr = (LPWSTR)CoTaskMemAlloc((wcslen(pfont->szName +
pfont->offsFile) + 1) * sizeof(WCHAR));
- if (psd->str.pOleStr)
- {
- psd->str.uType = STRRET_WSTR;
- wcscpy(psd->str.pOleStr, pfont->szName + pfont->offsFile);
- return S_OK;
- }
- else
- return E_OUTOFMEMORY;
- }
- break;
- }
-
- return E_FAIL;
+ return m_pisf2Inner->GetDetailsOf(pidl, iColumn, psd);
}
HRESULT WINAPI CFontsFolder::MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
{
- FIXME ("(%p)\n", this);
-
- return E_NOTIMPL;
+ return m_pisf2Inner->MapColumnToSCID(column, pscid);
}
/************************************************************************
@@ -666,125 +235,3 @@
return S_OK;
}
-
-/**************************************************************************
-* IContextMenu2 Implementation
-*/
-
-/**************************************************************************
-* CFontsFolder::QueryContextMenu()
-*/
-HRESULT WINAPI CFontsFolder::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT
idCmdFirst, UINT idCmdLast, UINT uFlags)
-{
- WCHAR szBuffer[30] = {0};
- ULONG Count = 1;
-
- TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x
)\n",
- this, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
-
- if (LoadStringW(shell32_hInstance, IDS_OPEN, szBuffer, sizeof(szBuffer) /
sizeof(WCHAR)))
- {
- szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
- _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING,
szBuffer, MFS_DEFAULT);
- Count++;
- }
-
- if (LoadStringW(shell32_hInstance, IDS_PRINT_VERB, szBuffer, sizeof(szBuffer) /
sizeof(WCHAR)))
- {
- szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
- _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING,
szBuffer, MFS_ENABLED);
- }
-
- if (LoadStringW(shell32_hInstance, IDS_COPY, szBuffer, sizeof(szBuffer) /
sizeof(WCHAR)))
- {
- szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
- _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR,
NULL, MFS_ENABLED);
- _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING,
szBuffer, MFS_ENABLED);
- }
-
- if (LoadStringW(shell32_hInstance, IDS_DELETE, szBuffer, sizeof(szBuffer) /
sizeof(WCHAR)))
- {
- szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
- _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR,
NULL, MFS_ENABLED);
- _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING,
szBuffer, MFS_ENABLED);
- }
-
- if (LoadStringW(shell32_hInstance, IDS_PROPERTIES, szBuffer, sizeof(szBuffer) /
sizeof(WCHAR)))
- {
- szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
- _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR,
NULL, MFS_ENABLED);
- _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING,
szBuffer, MFS_ENABLED);
- }
-
- return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Count);
-}
-
-/**************************************************************************
-* CFontsFolder::InvokeCommand()
-*/
-HRESULT WINAPI CFontsFolder::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
-{
- SHELLEXECUTEINFOW sei;
- PIDLFontStruct * pfont;
- SHFILEOPSTRUCTW op;
-
- TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n", this, lpcmi,
lpcmi->lpVerb, lpcmi->hwnd);
-
- if (lpcmi->lpVerb == MAKEINTRESOURCEA(1) || lpcmi->lpVerb ==
MAKEINTRESOURCEA(2) || lpcmi->lpVerb == MAKEINTRESOURCEA(7))
- {
- ZeroMemory(&sei, sizeof(sei));
- sei.cbSize = sizeof(sei);
- sei.hwnd = lpcmi->hwnd;
- sei.nShow = SW_SHOWNORMAL;
- if (lpcmi->lpVerb == MAKEINTRESOURCEA(1))
- sei.lpVerb = L"open";
- else if (lpcmi->lpVerb == MAKEINTRESOURCEA(2))
- sei.lpVerb = L"print";
- else if (lpcmi->lpVerb == MAKEINTRESOURCEA(7))
- sei.lpVerb = L"properties";
-
- pfont = _ILGetFontStruct(apidl);
- sei.lpFile = pfont->szName + pfont->offsFile;
-
- if (ShellExecuteExW(&sei) == FALSE)
- return E_FAIL;
- }
- else if (lpcmi->lpVerb == MAKEINTRESOURCEA(4))
- {
- FIXME("implement font copying\n");
- return E_NOTIMPL;
- }
- else if (lpcmi->lpVerb == MAKEINTRESOURCEA(6))
- {
- ZeroMemory(&op, sizeof(op));
- op.hwnd = lpcmi->hwnd;
- op.wFunc = FO_DELETE;
- op.fFlags = FOF_ALLOWUNDO;
- pfont = _ILGetFontStruct(apidl);
- op.pFrom = pfont->szName + pfont->offsFile;
- SHFileOperationW(&op);
- }
-
- return S_OK;
-}
-
-/**************************************************************************
- * CFontsFolder::GetCommandString()
- *
- */
-HRESULT WINAPI CFontsFolder::GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT
*lpReserved, LPSTR lpszName, UINT uMaxNameLen)
-{
- TRACE("(%p)->(idcom=%lx flags=%x %p name=%p len=%x)\n", this, idCommand,
uFlags, lpReserved, lpszName, uMaxNameLen);
-
- return E_FAIL;
-}
-
-/**************************************************************************
-* CFontsFolder::HandleMenuMsg()
-*/
-HRESULT WINAPI CFontsFolder::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- TRACE("(%p)->(msg=%x wp=%lx lp=%lx)\n", this, uMsg, wParam, lParam);
-
- return E_NOTIMPL;
-}
Modified: branches/shell-experiments/dll/win32/shell32/folders/fonts.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/fonts.h [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/folders/fonts.h [iso-8859-1] Mon Nov 3
21:14:49 2014
@@ -26,10 +26,12 @@
public CComCoClass<CFontsFolder, &CLSID_FontsFolderShortcut>,
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IShellFolder2,
- public IPersistFolder2,
- public IContextMenu2
+ public IPersistFolder2
{
private:
+ CComPtr<IShellFolder> m_pisfInner;
+ CComPtr<IShellFolder2> m_pisf2Inner;
+
/* both paths are parsible from the desktop */
LPITEMIDLIST pidlRoot; /* absolute pidl */
LPCITEMIDLIST apidl; /* currently focused font item */
@@ -68,14 +70,6 @@
// IPersistFolder2
virtual HRESULT WINAPI GetCurFolder(LPITEMIDLIST *pidl);
- // IContextMenu
- virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT
idCmdFirst, UINT idCmdLast, UINT uFlags);
- virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
- virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT
*lpReserved, LPSTR lpszName, UINT uMaxNameLen);
-
- // IContextMenu2
- virtual HRESULT WINAPI HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
-
DECLARE_REGISTRY_RESOURCEID(IDR_FONTSFOLDERSHORTCUT)
DECLARE_NOT_AGGREGATABLE(CFontsFolder)
@@ -87,8 +81,6 @@
COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
- COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
- COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
END_COM_MAP()
};