2011-05-15 15:55:49 +00:00
|
|
|
/*
|
|
|
|
* Fonts folder
|
|
|
|
*
|
2013-09-15 13:06:05 +00:00
|
|
|
* Copyright 2008 Johannes Anderwald <johannes.anderwald@reactos.org>
|
2011-05-15 15:55:49 +00:00
|
|
|
* Copyright 2009 Andrew Hill
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <precomp.h>
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL (shell);
|
|
|
|
|
|
|
|
/*
|
|
|
|
This folder should not exist. It is just a file system folder... The \windows\fonts
|
|
|
|
directory contains a hidden desktop.ini with a UIHandler entry that specifies a class
|
|
|
|
that lives in fontext.dll. The UI handler creates a custom view for the folder, which
|
|
|
|
is what we normally see. However, the folder is a perfectly normal CFSFolder.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* IShellFolder implementation
|
|
|
|
*/
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
class CDesktopFolderEnumZ: public IEnumIDListImpl
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-17 22:53:44 +00:00
|
|
|
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()
|
2011-05-15 15:55:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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)
|
2011-09-07 20:00:32 +00:00
|
|
|
return E_FAIL;
|
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static LPITEMIDLIST _ILCreateFontItem(LPWSTR pszFont, LPWSTR pszFile)
|
|
|
|
{
|
2011-09-07 20:00:32 +00:00
|
|
|
PIDLDATA tmp;
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
PIDLFontStruct * p;
|
2011-12-17 22:53:44 +00:00
|
|
|
int size0 = (char*)&tmp.u.cfont.szName - (char*)&tmp.u.cfont;
|
2011-09-07 20:00:32 +00:00
|
|
|
int size = size0;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-07 20:00:32 +00:00
|
|
|
tmp.type = 0x00;
|
|
|
|
tmp.u.cfont.dummy = 0xFF;
|
|
|
|
tmp.u.cfont.offsFile = wcslen(pszFont) + 1;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-07 20:00:32 +00:00
|
|
|
size += (tmp.u.cfont.offsFile + wcslen(pszFile) + 1) * sizeof(WCHAR);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-07 20:00:32 +00:00
|
|
|
pidl = (LPITEMIDLIST)SHAlloc(size + 4);
|
|
|
|
if (!pidl)
|
|
|
|
return pidl;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
pidl->mkid.cb = size + 2;
|
|
|
|
memcpy(pidl->mkid.abID, &tmp, 2 + size0);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-07 20:00:32 +00:00
|
|
|
p = &((PIDLDATA*)pidl->mkid.abID)->u.cfont;
|
|
|
|
wcscpy(p->szName, pszFont);
|
|
|
|
wcscpy(p->szName + tmp.u.cfont.offsFile, pszFile);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
*(WORD*)((char*)pidl + (size + 2)) = 0;
|
2011-09-07 20:00:32 +00:00
|
|
|
return pidl;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static PIDLFontStruct * _ILGetFontStruct(LPCITEMIDLIST pidl)
|
|
|
|
{
|
2011-09-07 20:00:32 +00:00
|
|
|
LPPIDLDATA pdata = _ILGetDataPointer(pidl);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
if (pdata && pdata->type == 0x00)
|
|
|
|
return (PIDLFontStruct*) & (pdata->u.cfont);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-07 20:00:32 +00:00
|
|
|
return NULL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CDesktopFolderEnumZ::CreateFontsEnumList()
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
BOOL CDesktopFolderEnumZ::CreateFontsEnumList(DWORD dwFlags)
|
|
|
|
{
|
2011-09-07 20:00:32 +00:00
|
|
|
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;
|
2011-12-17 22:53:44 +00:00
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
|
2011-09-07 20:00:32 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
Length = pszPath - szPath;
|
|
|
|
dwIndex = 0;
|
|
|
|
do
|
|
|
|
{
|
2011-12-17 22:53:44 +00:00
|
|
|
dwName = sizeof(szName) / sizeof(WCHAR);
|
|
|
|
dwFile = sizeof(szFile) / sizeof(WCHAR);
|
2011-09-07 20:00:32 +00:00
|
|
|
ret = RegEnumValueW(hKey, dwIndex++, szName, &dwName, NULL, &dwType, (LPBYTE)szFile, &dwFile);
|
|
|
|
if (ret == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
szFile[(sizeof(szFile)/sizeof(WCHAR))-1] = L'\0';
|
2011-12-17 22:53:44 +00:00
|
|
|
if (dwType == REG_SZ && wcslen(szFile) + Length + 1 < (sizeof(szPath) / sizeof(WCHAR)))
|
2011-09-07 20:00:32 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-12-17 22:53:44 +00:00
|
|
|
} while(ret != ERROR_NO_MORE_ITEMS);
|
2011-09-07 20:00:32 +00:00
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
|
|
|
}
|
|
|
|
return TRUE;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CFontsFolder::CFontsFolder()
|
|
|
|
{
|
2011-09-06 23:52:38 +00:00
|
|
|
pidlRoot = NULL;
|
2011-09-07 20:00:32 +00:00
|
|
|
apidl = NULL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CFontsFolder::~CFontsFolder()
|
|
|
|
{
|
2011-09-07 20:00:32 +00:00
|
|
|
TRACE("-- destroying IShellFolder(%p)\n", this);
|
|
|
|
SHFree(pidlRoot);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CFontsFolder::FinalConstruct()
|
|
|
|
{
|
2011-09-07 20:00:32 +00:00
|
|
|
pidlRoot = _ILCreateFont(); /* my qualified pidl */
|
|
|
|
if (pidlRoot == NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::ParseDisplayName
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2011-12-18 21:54:04 +00:00
|
|
|
HRESULT WINAPI CFontsFolder::ParseDisplayName(
|
|
|
|
HWND hwndOwner,
|
|
|
|
LPBC pbcReserved,
|
|
|
|
LPOLESTR lpszDisplayName,
|
|
|
|
DWORD *pchEaten,
|
|
|
|
LPITEMIDLIST *ppidl,
|
|
|
|
DWORD * pdwAttributes)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
HRESULT hr = E_UNEXPECTED;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
|
2011-12-17 22:53:44 +00:00
|
|
|
hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName),
|
|
|
|
pchEaten, ppidl, pdwAttributes);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
*ppidl = 0;
|
|
|
|
if (pchEaten)
|
2011-09-07 20:00:32 +00:00
|
|
|
*pchEaten = 0; /* strange but like the original */
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
TRACE ("(%p)->(-- ret=0x%08x)\n", this, hr);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::EnumObjects
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CFontsFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
|
|
|
|
{
|
2011-09-07 20:00:32 +00:00
|
|
|
CComObject<CDesktopFolderEnumZ> *theEnumerator;
|
|
|
|
CComPtr<IEnumIDList> result;
|
|
|
|
HRESULT hResult;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner, dwFlags, ppEnumIDList);
|
|
|
|
|
|
|
|
if (ppEnumIDList == NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
*ppEnumIDList = NULL;
|
|
|
|
ATLTRY (theEnumerator = new CComObject<CDesktopFolderEnumZ>);
|
|
|
|
if (theEnumerator == NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
2013-11-11 16:42:16 +00:00
|
|
|
hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
|
2011-09-07 20:00:32 +00:00
|
|
|
if (FAILED (hResult))
|
|
|
|
{
|
|
|
|
delete theEnumerator;
|
|
|
|
return hResult;
|
|
|
|
}
|
|
|
|
hResult = theEnumerator->Initialize (dwFlags);
|
|
|
|
if (FAILED (hResult))
|
|
|
|
return hResult;
|
|
|
|
*ppEnumIDList = result.Detach ();
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
TRACE ("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
|
|
|
|
|
2011-09-07 20:00:32 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::BindToObject
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CFontsFolder::BindToObject(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
|
|
|
|
{
|
|
|
|
TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", this,
|
2011-12-17 22:53:44 +00:00
|
|
|
pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return SHELL32_BindToChild (pidlRoot, NULL, pidl, riid, ppvOut);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::BindToStorage
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CFontsFolder::BindToStorage(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
|
|
|
|
{
|
|
|
|
FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
|
2011-12-17 22:53:44 +00:00
|
|
|
pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::CompareIDs
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
HRESULT WINAPI CFontsFolder::CompareIDs(LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::CreateViewObject
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CFontsFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
|
|
|
|
{
|
2011-09-07 20:00:32 +00:00
|
|
|
CComPtr<IShellView> pShellView;
|
2011-05-15 15:55:49 +00:00
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(hwnd=%p,%s,%p)\n", this,
|
2011-12-17 22:53:44 +00:00
|
|
|
hwndOwner, shdebugstr_guid (&riid), ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!ppvOut)
|
|
|
|
return hr;
|
|
|
|
|
2011-09-07 20:00:32 +00:00
|
|
|
*ppvOut = NULL;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-07 20:00:32 +00:00
|
|
|
if (IsEqualIID (riid, IID_IDropTarget))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-09-07 20:00:32 +00:00
|
|
|
WARN ("IDropTarget not implemented\n");
|
|
|
|
hr = E_NOTIMPL;
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
else if (IsEqualIID (riid, IID_IContextMenu))
|
|
|
|
{
|
2011-09-07 20:00:32 +00:00
|
|
|
WARN ("IContextMenu not implemented\n");
|
|
|
|
hr = E_NOTIMPL;
|
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
else if (IsEqualIID (riid, IID_IShellView))
|
|
|
|
{
|
2013-11-11 16:42:16 +00:00
|
|
|
hr = IShellView_Constructor (this, &pShellView);
|
2011-09-07 20:00:32 +00:00
|
|
|
if (pShellView)
|
2011-05-15 15:55:49 +00:00
|
|
|
hr = pShellView->QueryInterface(riid, ppvOut);
|
|
|
|
}
|
|
|
|
TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::GetAttributesOf
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CFontsFolder::GetAttributesOf(UINT cidl, LPCITEMIDLIST *apidl, DWORD *rgfInOut)
|
|
|
|
{
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", this,
|
2011-12-17 22:53:44 +00:00
|
|
|
cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!rgfInOut)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
if (cidl && !apidl)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (*rgfInOut == 0)
|
|
|
|
*rgfInOut = ~0;
|
|
|
|
|
|
|
|
if (cidl == 0)
|
|
|
|
{
|
2011-09-07 20:00:32 +00:00
|
|
|
CComPtr<IShellFolder> psfParent;
|
2011-05-15 15:55:49 +00:00
|
|
|
LPCITEMIDLIST rpidl = NULL;
|
|
|
|
|
2013-11-11 16:42:16 +00:00
|
|
|
hr = SHBindToParent(pidlRoot, IID_PPV_ARG(IShellFolder, &psfParent), (LPCITEMIDLIST *)&rpidl);
|
2011-05-15 15:55:49 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::GetUIObjectOf
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
2011-12-18 21:54:04 +00:00
|
|
|
HRESULT WINAPI CFontsFolder::GetUIObjectOf(
|
|
|
|
HWND hwndOwner,
|
|
|
|
UINT cidl, LPCITEMIDLIST *apidl,
|
|
|
|
REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
LPITEMIDLIST pidl;
|
2011-09-07 20:00:32 +00:00
|
|
|
CComPtr<IUnknown> pObj;
|
2011-05-15 15:55:49 +00:00
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
|
|
|
|
TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
|
2011-12-17 22:53:44 +00:00
|
|
|
hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
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 = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
|
|
|
|
SHFree (pidl);
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID (riid, IID_IExtractIconW) && (cidl == 1))
|
|
|
|
{
|
|
|
|
pidl = ILCombine (pidlRoot, apidl[0]);
|
|
|
|
pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
|
|
|
|
SHFree (pidl);
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID (riid, IID_IDropTarget) && (cidl >= 1))
|
|
|
|
{
|
|
|
|
hr = this->QueryInterface(IID_IDropTarget, (LPVOID *) & pObj);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hr = E_NOINTERFACE;
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && !pObj)
|
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
*ppvOut = pObj.Detach();
|
|
|
|
TRACE ("(%p)->hr=0x%08x\n", this, hr);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::GetDisplayNameOf
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CFontsFolder::GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
|
|
|
|
{
|
2011-12-17 22:48:16 +00:00
|
|
|
PIDLFontStruct *pFont;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
|
2011-05-15 15:55:49 +00:00
|
|
|
pdump (pidl);
|
|
|
|
|
|
|
|
if (!strRet)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2011-12-17 22:48:16 +00:00
|
|
|
pFont = _ILGetFontStruct(pidl);
|
|
|
|
if (pFont)
|
|
|
|
{
|
2011-12-17 22:53:44 +00:00
|
|
|
strRet->pOleStr = (LPWSTR)CoTaskMemAlloc((wcslen(pFont->szName) + 1) * sizeof(WCHAR));
|
2011-12-17 22:48:16 +00:00
|
|
|
if (!strRet->pOleStr)
|
|
|
|
return E_OUTOFMEMORY;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-17 22:48:16 +00:00
|
|
|
wcscpy(strRet->pOleStr, pFont->szName);
|
|
|
|
strRet->uType = STRRET_WSTR;
|
|
|
|
}
|
|
|
|
else if (!pidl->mkid.cb)
|
|
|
|
{
|
|
|
|
WCHAR wszPath[MAX_PATH];
|
|
|
|
|
|
|
|
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
|
2011-12-17 22:53:44 +00:00
|
|
|
(GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING))
|
2011-12-17 22:48:16 +00:00
|
|
|
{
|
|
|
|
if (!SHGetSpecialFolderPathW(NULL, wszPath, CSIDL_FONTS, FALSE))
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
else if (!HCR_GetClassNameW(CLSID_FontsFolderShortcut, wszPath, MAX_PATH))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
strRet->pOleStr = (LPWSTR)CoTaskMemAlloc((wcslen(wszPath) + 1) * sizeof(WCHAR));
|
|
|
|
if (!strRet->pOleStr)
|
|
|
|
return E_OUTOFMEMORY;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-17 22:48:16 +00:00
|
|
|
wcscpy(strRet->pOleStr, wszPath);
|
|
|
|
strRet->uType = STRRET_WSTR;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_INVALIDARG;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::SetNameOf
|
2011-05-15 15:55:49 +00:00
|
|
|
* 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
|
|
|
|
*/
|
2011-09-07 20:00:32 +00:00
|
|
|
HRESULT WINAPI CFontsFolder::SetNameOf(HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
|
2011-12-17 22:53:44 +00:00
|
|
|
LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this,
|
2011-12-17 22:53:44 +00:00
|
|
|
hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CFontsFolder::GetDetailsEx(LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv)
|
|
|
|
{
|
|
|
|
FIXME ("(%p)\n", this);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CFontsFolder::GetDetailsOf(LPCITEMIDLIST 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))
|
|
|
|
{
|
2011-12-17 22:53:44 +00:00
|
|
|
psd->str.pOleStr = (LPWSTR)CoTaskMemAlloc((wcslen(fi.szTypeName) + 1) * sizeof(WCHAR));
|
2011-05-15 15:55:49 +00:00
|
|
|
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))
|
|
|
|
{
|
2011-12-17 22:53:44 +00:00
|
|
|
if (StrFormatByteSizeW(FileSize.QuadPart, buffer, sizeof(buffer) / sizeof(WCHAR)))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
psd->str.pOleStr = (LPWSTR)CoTaskMemAlloc(wcslen(buffer) + 1);
|
|
|
|
if (!psd->str.pOleStr)
|
|
|
|
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;
|
2011-12-17 22:53:44 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CFontsFolder::MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
|
|
|
|
{
|
|
|
|
FIXME ("(%p)\n", this);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::GetClassID
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CFontsFolder::GetClassID(CLSID *lpClassId)
|
|
|
|
{
|
|
|
|
TRACE ("(%p)\n", this);
|
|
|
|
|
|
|
|
if (!lpClassId)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*lpClassId = CLSID_FontsFolderShortcut;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::Initialize
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* NOTES: it makes no sense to change the pidl
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CFontsFolder::Initialize(LPCITEMIDLIST pidl)
|
|
|
|
{
|
|
|
|
TRACE ("(%p)->(%p)\n", this, pidl);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::GetCurFolder
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2011-12-18 21:54:04 +00:00
|
|
|
HRESULT WINAPI CFontsFolder::GetCurFolder(LPITEMIDLIST *pidl)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
TRACE ("(%p)->(%p)\n", this, pidl);
|
|
|
|
|
|
|
|
if (!pidl)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
*pidl = ILClone(pidlRoot);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IContextMenu2 Implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::QueryContextMenu()
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
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);
|
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
if (LoadStringW(shell32_hInstance, IDS_OPEN, szBuffer, sizeof(szBuffer) / sizeof(WCHAR)))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
|
|
|
|
Count++;
|
|
|
|
}
|
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
if (LoadStringW(shell32_hInstance, IDS_PRINT_VERB, szBuffer, sizeof(szBuffer) / sizeof(WCHAR)))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
|
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
|
|
|
|
}
|
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
if (LoadStringW(shell32_hInstance, IDS_COPY, szBuffer, sizeof(szBuffer) / sizeof(WCHAR)))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
if (LoadStringW(shell32_hInstance, IDS_DELETE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR)))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
if (LoadStringW(shell32_hInstance, IDS_PROPERTIES, szBuffer, sizeof(szBuffer) / sizeof(WCHAR)))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::InvokeCommand()
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CFontsFolder::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
|
|
|
|
{
|
|
|
|
SHELLEXECUTEINFOW sei;
|
|
|
|
PIDLFontStruct * pfont;
|
|
|
|
SHFILEOPSTRUCTW op;
|
|
|
|
|
2011-12-17 22:53:44 +00:00
|
|
|
TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n", this, lpcmi, lpcmi->lpVerb, lpcmi->hwnd);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
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)
|
2011-12-17 22:53:44 +00:00
|
|
|
return E_FAIL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
else if (lpcmi->lpVerb == MAKEINTRESOURCEA(4))
|
|
|
|
{
|
|
|
|
FIXME("implement font copying\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
else if (lpcmi->lpVerb == MAKEINTRESOURCEA(6))
|
|
|
|
{
|
2011-12-17 22:53:44 +00:00
|
|
|
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);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::GetCommandString()
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
*/
|
2011-12-17 22:53:44 +00:00
|
|
|
HRESULT WINAPI CFontsFolder::GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-17 22:53:44 +00:00
|
|
|
TRACE("(%p)->(idcom=%lx flags=%x %p name=%p len=%x)\n", this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-07 20:00:32 +00:00
|
|
|
return E_FAIL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CFontsFolder::HandleMenuMsg()
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CFontsFolder::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)->(msg=%x wp=%lx lp=%lx)\n", this, uMsg, wParam, lParam);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|