[SHELL32] Add 'm_' prefix to CFSFolder members (#2129)

CORE-7585
This commit is contained in:
Katayama Hirofumi MZ 2019-12-05 05:35:25 +09:00 committed by GitHub
parent e26c8bc66f
commit 2fad488a85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 62 deletions

View file

@ -437,9 +437,9 @@ HRESULT WINAPI CFileSysEnum::Initialize(LPWSTR lpszPath, DWORD dwFlags)
CFSFolder::CFSFolder() CFSFolder::CFSFolder()
{ {
pclsid = (CLSID *)&CLSID_ShellFSFolder; m_pclsid = &CLSID_ShellFSFolder;
sPathTarget = NULL; m_sPathTarget = NULL;
pidlRoot = NULL; m_pidlRoot = NULL;
m_bGroupPolicyActive = 0; m_bGroupPolicyActive = 0;
} }
@ -447,8 +447,8 @@ CFSFolder::~CFSFolder()
{ {
TRACE("-- destroying IShellFolder(%p)\n", this); TRACE("-- destroying IShellFolder(%p)\n", this);
SHFree(pidlRoot); SHFree(m_pidlRoot);
SHFree(sPathTarget); SHFree(m_sPathTarget);
} }
@ -654,7 +654,7 @@ HRESULT WINAPI CFSFolder::ParseDisplayName(HWND hwndOwner,
else else
{ {
/* build the full pathname to the element */ /* build the full pathname to the element */
lstrcpynW(szPath, sPathTarget, MAX_PATH - 1); lstrcpynW(szPath, m_sPathTarget, MAX_PATH - 1);
PathAddBackslashW(szPath); PathAddBackslashW(szPath);
len = wcslen(szPath); len = wcslen(szPath);
lstrcpynW(szPath + len, szElement, MAX_PATH - len); lstrcpynW(szPath + len, szElement, MAX_PATH - len);
@ -702,7 +702,7 @@ HRESULT WINAPI CFSFolder::EnumObjects(
DWORD dwFlags, DWORD dwFlags,
LPENUMIDLIST *ppEnumIDList) LPENUMIDLIST *ppEnumIDList)
{ {
return ShellObjectCreatorInit<CFileSysEnum>(sPathTarget, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList)); return ShellObjectCreatorInit<CFileSysEnum>(m_sPathTarget, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
} }
/************************************************************************** /**************************************************************************
@ -725,7 +725,7 @@ HRESULT WINAPI CFSFolder::BindToObject(
CComPtr<IShellFolder> pSF; CComPtr<IShellFolder> pSF;
HRESULT hr; HRESULT hr;
if (!pidlRoot || !ppvOut || !pidl || !pidl->mkid.cb) if (!m_pidlRoot || !ppvOut || !pidl || !pidl->mkid.cb)
{ {
ERR("CFSFolder::BindToObject: Invalid parameters\n"); ERR("CFSFolder::BindToObject: Invalid parameters\n");
return E_INVALIDARG; return E_INVALIDARG;
@ -747,7 +747,7 @@ HRESULT WINAPI CFSFolder::BindToObject(
PERSIST_FOLDER_TARGET_INFO pfti = {0}; PERSIST_FOLDER_TARGET_INFO pfti = {0};
pfti.dwAttributes = -1; pfti.dwAttributes = -1;
pfti.csidl = -1; pfti.csidl = -1;
PathCombineW(pfti.szTargetParsingName, sPathTarget, pDataW->wszName); PathCombineW(pfti.szTargetParsingName, m_sPathTarget, pDataW->wszName);
/* Get the CLSID to bind to */ /* Get the CLSID to bind to */
CLSID clsidFolder; CLSID clsidFolder;
@ -767,7 +767,7 @@ HRESULT WINAPI CFSFolder::BindToObject(
return hr; return hr;
} }
hr = SHELL32_BindToSF(pidlRoot, &pfti, pidl, &clsidFolder, riid, ppvOut); hr = SHELL32_BindToSF(m_pidlRoot, &pfti, pidl, &clsidFolder, riid, ppvOut);
if (FAILED_UNEXPECTEDLY(hr)) if (FAILED_UNEXPECTEDLY(hr))
return hr; return hr;
@ -876,19 +876,19 @@ HRESULT WINAPI CFSFolder::CreateViewObject(HWND hwndOwner,
if (bIsDropTarget || bIsShellView) if (bIsDropTarget || bIsShellView)
{ {
DWORD dwDirAttributes = _ILGetFileAttributes(ILFindLastID(pidlRoot), NULL, 0); DWORD dwDirAttributes = _ILGetFileAttributes(ILFindLastID(m_pidlRoot), NULL, 0);
if ((dwDirAttributes & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) != 0) if ((dwDirAttributes & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) != 0)
{ {
CLSID clsidFolder; CLSID clsidFolder;
hr = SHELL32_GetCLSIDForDirectory(sPathTarget, L"UICLSID", &clsidFolder); hr = SHELL32_GetCLSIDForDirectory(m_sPathTarget, L"UICLSID", &clsidFolder);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
CComPtr<IPersistFolder> spFolder; CComPtr<IPersistFolder> spFolder;
hr = SHCoCreateInstance(NULL, &clsidFolder, NULL, IID_PPV_ARG(IPersistFolder, &spFolder)); hr = SHCoCreateInstance(NULL, &clsidFolder, NULL, IID_PPV_ARG(IPersistFolder, &spFolder));
if (!FAILED_UNEXPECTEDLY(hr)) if (!FAILED_UNEXPECTEDLY(hr))
{ {
hr = spFolder->Initialize(pidlRoot); hr = spFolder->Initialize(m_pidlRoot);
if (!FAILED_UNEXPECTEDLY(hr)) if (!FAILED_UNEXPECTEDLY(hr))
{ {
@ -909,7 +909,7 @@ HRESULT WINAPI CFSFolder::CreateViewObject(HWND hwndOwner,
// No UICLSID handler found, continue to the default handlers // No UICLSID handler found, continue to the default handlers
if (bIsDropTarget) if (bIsDropTarget)
{ {
hr = CFSDropTarget_CreateInstance(sPathTarget, riid, ppvOut); hr = CFSDropTarget_CreateInstance(m_sPathTarget, riid, ppvOut);
} }
else if (IsEqualIID (riid, IID_IContextMenu)) else if (IsEqualIID (riid, IID_IContextMenu))
{ {
@ -920,7 +920,7 @@ HRESULT WINAPI CFSFolder::CreateViewObject(HWND hwndOwner,
DEFCONTEXTMENU dcm; DEFCONTEXTMENU dcm;
dcm.hwnd = hwndOwner; dcm.hwnd = hwndOwner;
dcm.pcmcb = this; dcm.pcmcb = this;
dcm.pidlFolder = pidlRoot; dcm.pidlFolder = m_pidlRoot;
dcm.psf = this; dcm.psf = this;
dcm.cidl = 0; dcm.cidl = 0;
dcm.apidl = NULL; dcm.apidl = NULL;
@ -968,7 +968,7 @@ HRESULT WINAPI CFSFolder::GetAttributesOf(UINT cidl,
if(cidl == 0) if(cidl == 0)
{ {
LPCITEMIDLIST rpidl = ILFindLastID(pidlRoot); LPCITEMIDLIST rpidl = ILFindLastID(m_pidlRoot);
if (_ILIsFolder(rpidl) || _ILIsValue(rpidl)) if (_ILIsFolder(rpidl) || _ILIsValue(rpidl))
{ {
@ -977,7 +977,7 @@ HRESULT WINAPI CFSFolder::GetAttributesOf(UINT cidl,
else if (_ILIsDrive(rpidl)) else if (_ILIsDrive(rpidl))
{ {
IShellFolder *psfParent = NULL; IShellFolder *psfParent = NULL;
hr = SHBindToParent(pidlRoot, IID_PPV_ARG(IShellFolder, &psfParent), NULL); hr = SHBindToParent(m_pidlRoot, IID_PPV_ARG(IShellFolder, &psfParent), NULL);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
hr = psfParent->GetAttributesOf(1, &rpidl, (SFGAOF*)rgfInOut); hr = psfParent->GetAttributesOf(1, &rpidl, (SFGAOF*)rgfInOut);
@ -1064,7 +1064,7 @@ HRESULT WINAPI CFSFolder::GetUIObjectOf(HWND hwndOwner,
DEFCONTEXTMENU dcm; DEFCONTEXTMENU dcm;
dcm.hwnd = hwndOwner; dcm.hwnd = hwndOwner;
dcm.pcmcb = this; dcm.pcmcb = this;
dcm.pidlFolder = pidlRoot; dcm.pidlFolder = m_pidlRoot;
dcm.psf = this; dcm.psf = this;
dcm.cidl = cidl; dcm.cidl = cidl;
dcm.apidl = apidl; dcm.apidl = apidl;
@ -1077,7 +1077,7 @@ HRESULT WINAPI CFSFolder::GetUIObjectOf(HWND hwndOwner,
{ {
if (cidl >= 1) if (cidl >= 1)
{ {
hr = IDataObject_Constructor (hwndOwner, pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj); hr = IDataObject_Constructor (hwndOwner, m_pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
} }
else else
{ {
@ -1096,7 +1096,7 @@ HRESULT WINAPI CFSFolder::GetUIObjectOf(HWND hwndOwner,
/* only interested in attempting to bind to shell folders, not files (except exe), so if we fail, rebind to root */ /* only interested in attempting to bind to shell folders, not files (except exe), so if we fail, rebind to root */
if (cidl != 1 || FAILED(hr = this->_GetDropTarget(apidl[0], (LPVOID*) &pObj))) if (cidl != 1 || FAILED(hr = this->_GetDropTarget(apidl[0], (LPVOID*) &pObj)))
{ {
hr = CFSDropTarget_CreateInstance(sPathTarget, riid, (LPVOID*) &pObj); hr = CFSDropTarget_CreateInstance(m_sPathTarget, riid, (LPVOID*) &pObj);
} }
} }
else else
@ -1198,9 +1198,9 @@ HRESULT WINAPI CFSFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl,
/* If it is an empty pidl return only the path of the folder */ /* If it is an empty pidl return only the path of the folder */
if ((GET_SHGDN_FOR(dwFlags) & SHGDN_FORPARSING) && if ((GET_SHGDN_FOR(dwFlags) & SHGDN_FORPARSING) &&
(GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER) && (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER) &&
sPathTarget) m_sPathTarget)
{ {
return SHSetStrRet(strRet, sPathTarget); return SHSetStrRet(strRet, m_sPathTarget);
} }
return E_INVALIDARG; return E_INVALIDARG;
} }
@ -1212,9 +1212,9 @@ HRESULT WINAPI CFSFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl,
if ((GET_SHGDN_FOR(dwFlags) & SHGDN_FORPARSING) && if ((GET_SHGDN_FOR(dwFlags) & SHGDN_FORPARSING) &&
(GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER) && (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER) &&
sPathTarget) m_sPathTarget)
{ {
lstrcpynW(pszPath, sPathTarget, MAX_PATH); lstrcpynW(pszPath, m_sPathTarget, MAX_PATH);
PathAddBackslashW(pszPath); PathAddBackslashW(pszPath);
len = wcslen(pszPath); len = wcslen(pszPath);
} }
@ -1261,11 +1261,11 @@ HRESULT WINAPI CFSFolder::SetNameOf(
} }
/* build source path */ /* build source path */
PathCombineW(szSrc, sPathTarget, pDataW->wszName); PathCombineW(szSrc, m_sPathTarget, pDataW->wszName);
/* build destination path */ /* build destination path */
if (dwFlags == SHGDN_NORMAL || dwFlags & SHGDN_INFOLDER) if (dwFlags == SHGDN_NORMAL || dwFlags & SHGDN_INFOLDER)
PathCombineW(szDest, sPathTarget, lpName); PathCombineW(szDest, m_sPathTarget, lpName);
else else
lstrcpynW(szDest, lpName, MAX_PATH); lstrcpynW(szDest, lpName, MAX_PATH);
@ -1415,7 +1415,7 @@ HRESULT WINAPI CFSFolder::GetClassID(CLSID * lpClassId)
if (!lpClassId) if (!lpClassId)
return E_POINTER; return E_POINTER;
*lpClassId = *pclsid; *lpClassId = *m_pclsid;
return S_OK; return S_OK;
} }
@ -1424,7 +1424,7 @@ HRESULT WINAPI CFSFolder::GetClassID(CLSID * lpClassId)
* CFSFolder::Initialize * CFSFolder::Initialize
* *
* NOTES * NOTES
* sPathTarget is not set. Don't know how to handle in a non rooted environment. * m_sPathTarget is not set. Don't know how to handle in a non rooted environment.
*/ */
HRESULT WINAPI CFSFolder::Initialize(PCIDLIST_ABSOLUTE pidl) HRESULT WINAPI CFSFolder::Initialize(PCIDLIST_ABSOLUTE pidl)
{ {
@ -1432,23 +1432,23 @@ HRESULT WINAPI CFSFolder::Initialize(PCIDLIST_ABSOLUTE pidl)
TRACE ("(%p)->(%p)\n", this, pidl); TRACE ("(%p)->(%p)\n", this, pidl);
SHFree (pidlRoot); /* free the old pidl */ SHFree(m_pidlRoot); /* free the old pidl */
pidlRoot = ILClone (pidl); /* set my pidl */ m_pidlRoot = ILClone (pidl); /* set my pidl */
SHFree (sPathTarget); SHFree (m_sPathTarget);
sPathTarget = NULL; m_sPathTarget = NULL;
/* set my path */ /* set my path */
if (SHGetPathFromIDListW (pidl, wszTemp)) if (SHGetPathFromIDListW (pidl, wszTemp))
{ {
int len = wcslen(wszTemp); int len = wcslen(wszTemp);
sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR)); m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
if (!sPathTarget) if (!m_sPathTarget)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR)); memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
} }
TRACE ("--(%p)->(%s)\n", this, debugstr_w(sPathTarget)); TRACE ("--(%p)->(%s)\n", this, debugstr_w(m_sPathTarget));
return S_OK; return S_OK;
} }
@ -1462,7 +1462,7 @@ HRESULT WINAPI CFSFolder::GetCurFolder(PIDLIST_ABSOLUTE * pidl)
if (!pidl) if (!pidl)
return E_POINTER; return E_POINTER;
*pidl = ILClone(pidlRoot); *pidl = ILClone(m_pidlRoot);
return S_OK; return S_OK;
} }
@ -1487,15 +1487,15 @@ HRESULT WINAPI CFSFolder::InitializeEx(IBindCtx * pbc, LPCITEMIDLIST pidlRootx,
if (ppfti && ppfti->pidlTargetFolder) if (ppfti && ppfti->pidlTargetFolder)
pdump(ppfti->pidlTargetFolder); pdump(ppfti->pidlTargetFolder);
if (pidlRoot) if (m_pidlRoot)
__SHFreeAndNil(&pidlRoot); /* free the old */ __SHFreeAndNil(&m_pidlRoot); /* free the old */
if (sPathTarget) if (m_sPathTarget)
__SHFreeAndNil(&sPathTarget); __SHFreeAndNil(&m_sPathTarget);
/* /*
* Root path and pidl * Root path and pidl
*/ */
pidlRoot = ILClone(pidlRootx); m_pidlRoot = ILClone(pidlRootx);
/* /*
* the target folder is spezified in csidl OR pidlTargetFolder OR * the target folder is spezified in csidl OR pidlTargetFolder OR
@ -1508,19 +1508,19 @@ HRESULT WINAPI CFSFolder::InitializeEx(IBindCtx * pbc, LPCITEMIDLIST pidlRootx,
if (SHGetSpecialFolderPathW(0, wszTemp, ppfti->csidl, if (SHGetSpecialFolderPathW(0, wszTemp, ppfti->csidl,
ppfti->csidl & CSIDL_FLAG_CREATE)) { ppfti->csidl & CSIDL_FLAG_CREATE)) {
int len = wcslen(wszTemp); int len = wcslen(wszTemp);
sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR)); m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
if (!sPathTarget) if (!m_sPathTarget)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR)); memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
} }
} }
else if (ppfti->szTargetParsingName[0]) else if (ppfti->szTargetParsingName[0])
{ {
int len = wcslen(ppfti->szTargetParsingName); int len = wcslen(ppfti->szTargetParsingName);
sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR)); m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
if (!sPathTarget) if (!m_sPathTarget)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(sPathTarget, ppfti->szTargetParsingName, memcpy(m_sPathTarget, ppfti->szTargetParsingName,
(len + 1) * sizeof(WCHAR)); (len + 1) * sizeof(WCHAR));
} }
else if (ppfti->pidlTargetFolder) else if (ppfti->pidlTargetFolder)
@ -1528,17 +1528,17 @@ HRESULT WINAPI CFSFolder::InitializeEx(IBindCtx * pbc, LPCITEMIDLIST pidlRootx,
if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp)) if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp))
{ {
int len = wcslen(wszTemp); int len = wcslen(wszTemp);
sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR)); m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
if (!sPathTarget) if (!m_sPathTarget)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR)); memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
} }
} }
} }
TRACE("--(%p)->(target=%s)\n", this, debugstr_w(sPathTarget)); TRACE("--(%p)->(target=%s)\n", this, debugstr_w(m_sPathTarget));
pdump(pidlRoot); pdump(m_pidlRoot);
return (sPathTarget) ? S_OK : E_FAIL; return (m_sPathTarget) ? S_OK : E_FAIL;
} }
HRESULT WINAPI CFSFolder::GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO * ppfti) HRESULT WINAPI CFSFolder::GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO * ppfti)
@ -1630,7 +1630,7 @@ HRESULT CFSFolder::_CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pi
return E_INVALIDARG; return E_INVALIDARG;
} }
PathCombineW(wszPath, sPathTarget, pDataW->wszName); PathCombineW(wszPath, m_sPathTarget, pDataW->wszName);
CComPtr<IPersistFile> pp; CComPtr<IPersistFile> pp;
hr = SHCoCreateInstance(NULL, pclsid, NULL, IID_PPV_ARG(IPersistFile, &pp)); hr = SHCoCreateInstance(NULL, pclsid, NULL, IID_PPV_ARG(IPersistFile, &pp));
@ -1658,10 +1658,10 @@ HRESULT WINAPI CFSFolder::CallBack(IShellFolder *psf, HWND hwndOwner, IDataObjec
{ {
if (uMsg == DFM_INVOKECOMMAND && wParam == 0) if (uMsg == DFM_INVOKECOMMAND && wParam == 0)
{ {
PUITEMID_CHILD pidlChild = ILClone(ILFindLastID(pidlRoot)); PUITEMID_CHILD pidlChild = ILClone(ILFindLastID(m_pidlRoot));
LPITEMIDLIST pidlParent = ILClone(pidlRoot); LPITEMIDLIST pidlParent = ILClone(m_pidlRoot);
ILRemoveLastID(pidlParent); ILRemoveLastID(pidlParent);
HRESULT hr = SH_ShowPropertiesDialog(sPathTarget, pidlParent, &pidlChild); HRESULT hr = SH_ShowPropertiesDialog(m_sPathTarget, pidlParent, &pidlChild);
if (FAILED(hr)) if (FAILED(hr))
ERR("SH_ShowPropertiesDialog failed\n"); ERR("SH_ShowPropertiesDialog failed\n");
ILFree(pidlChild); ILFree(pidlChild);
@ -1731,7 +1731,7 @@ HRESULT WINAPI CFSFolder::GetCustomViewInfo(ULONG unknown, SFVM_CUSTOMVIEWINFO_D
WCHAR szPath[MAX_PATH], szIniFile[MAX_PATH]; WCHAR szPath[MAX_PATH], szIniFile[MAX_PATH];
// does the folder exists? // does the folder exists?
if (!SHGetPathFromIDListW(pidlRoot, szPath) || !PathIsDirectoryW(szPath)) if (!SHGetPathFromIDListW(m_pidlRoot, szPath) || !PathIsDirectoryW(szPath))
{ {
return E_INVALIDARG; return E_INVALIDARG;
} }

View file

@ -32,12 +32,12 @@ class CFSFolder :
public IShellFolderViewCB public IShellFolderViewCB
{ {
private: private:
CLSID *pclsid; const CLSID *m_pclsid;
/* both paths are parsible from the desktop */ /* both paths are parsible from the desktop */
LPWSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */ LPWSTR m_sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
LPITEMIDLIST pidlRoot; /* absolute pidl */ LPITEMIDLIST m_pidlRoot; /* absolute pidl */
DWORD m_bGroupPolicyActive; DWORD m_bGroupPolicyActive;
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut); HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut);