[SHELL32] Add 'm_' prefix to CFSFolder members (#2129)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Wed, 4 Dec 2019 20:35:25 +0000 (05:35 +0900)
committerGitHub <noreply@github.com>
Wed, 4 Dec 2019 20:35:25 +0000 (05:35 +0900)
CORE-7585

dll/win32/shell32/folders/CFSFolder.cpp
dll/win32/shell32/folders/CFSFolder.h

index d0aee2f..cfba27e 100644 (file)
@@ -437,9 +437,9 @@ HRESULT WINAPI CFileSysEnum::Initialize(LPWSTR lpszPath, DWORD dwFlags)
 
 CFSFolder::CFSFolder()
 {
-    pclsid = (CLSID *)&CLSID_ShellFSFolder;
-    sPathTarget = NULL;
-    pidlRoot = NULL;
+    m_pclsid = &CLSID_ShellFSFolder;
+    m_sPathTarget = NULL;
+    m_pidlRoot = NULL;
     m_bGroupPolicyActive = 0;
 }
 
@@ -447,8 +447,8 @@ CFSFolder::~CFSFolder()
 {
     TRACE("-- destroying IShellFolder(%p)\n", this);
 
-    SHFree(pidlRoot);
-    SHFree(sPathTarget);
+    SHFree(m_pidlRoot);
+    SHFree(m_sPathTarget);
 }
 
 
@@ -654,7 +654,7 @@ HRESULT WINAPI CFSFolder::ParseDisplayName(HWND hwndOwner,
         else
         {
             /* build the full pathname to the element */
-            lstrcpynW(szPath, sPathTarget, MAX_PATH - 1);
+            lstrcpynW(szPath, m_sPathTarget, MAX_PATH - 1);
             PathAddBackslashW(szPath);
             len = wcslen(szPath);
             lstrcpynW(szPath + len, szElement, MAX_PATH - len);
@@ -702,7 +702,7 @@ HRESULT WINAPI CFSFolder::EnumObjects(
     DWORD dwFlags,
     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;
     HRESULT hr;
 
-    if (!pidlRoot || !ppvOut || !pidl || !pidl->mkid.cb)
+    if (!m_pidlRoot || !ppvOut || !pidl || !pidl->mkid.cb)
     {
         ERR("CFSFolder::BindToObject: Invalid parameters\n");
         return E_INVALIDARG;
@@ -747,7 +747,7 @@ HRESULT WINAPI CFSFolder::BindToObject(
     PERSIST_FOLDER_TARGET_INFO pfti = {0};
     pfti.dwAttributes = -1;
     pfti.csidl = -1;
-    PathCombineW(pfti.szTargetParsingName, sPathTarget, pDataW->wszName);
+    PathCombineW(pfti.szTargetParsingName, m_sPathTarget, pDataW->wszName);
 
     /* Get the CLSID to bind to */
     CLSID clsidFolder;
@@ -767,7 +767,7 @@ HRESULT WINAPI CFSFolder::BindToObject(
             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))
         return hr;
 
@@ -876,19 +876,19 @@ HRESULT WINAPI CFSFolder::CreateViewObject(HWND hwndOwner,
 
         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)
             {
                 CLSID clsidFolder;
-                hr = SHELL32_GetCLSIDForDirectory(sPathTarget, L"UICLSID", &clsidFolder);
+                hr = SHELL32_GetCLSIDForDirectory(m_sPathTarget, L"UICLSID", &clsidFolder);
                 if (SUCCEEDED(hr))
                 {
                     CComPtr<IPersistFolder> spFolder;
                     hr = SHCoCreateInstance(NULL, &clsidFolder, NULL, IID_PPV_ARG(IPersistFolder, &spFolder));
                     if (!FAILED_UNEXPECTEDLY(hr))
                     {
-                        hr = spFolder->Initialize(pidlRoot);
+                        hr = spFolder->Initialize(m_pidlRoot);
 
                         if (!FAILED_UNEXPECTEDLY(hr))
                         {
@@ -909,7 +909,7 @@ HRESULT WINAPI CFSFolder::CreateViewObject(HWND hwndOwner,
             // No UICLSID handler found, continue to the default handlers
             if (bIsDropTarget)
             {
-                hr = CFSDropTarget_CreateInstance(sPathTarget, riid, ppvOut);
+                hr = CFSDropTarget_CreateInstance(m_sPathTarget, riid, ppvOut);
             }
             else if (IsEqualIID (riid, IID_IContextMenu))
             {
@@ -920,7 +920,7 @@ HRESULT WINAPI CFSFolder::CreateViewObject(HWND hwndOwner,
                 DEFCONTEXTMENU dcm;
                 dcm.hwnd = hwndOwner;
                 dcm.pcmcb = this;
-                dcm.pidlFolder = pidlRoot;
+                dcm.pidlFolder = m_pidlRoot;
                 dcm.psf = this;
                 dcm.cidl = 0;
                 dcm.apidl = NULL;
@@ -968,7 +968,7 @@ HRESULT WINAPI CFSFolder::GetAttributesOf(UINT cidl,
 
     if(cidl == 0)
     {
-        LPCITEMIDLIST rpidl = ILFindLastID(pidlRoot);
+        LPCITEMIDLIST rpidl = ILFindLastID(m_pidlRoot);
 
         if (_ILIsFolder(rpidl) || _ILIsValue(rpidl))
         {
@@ -977,7 +977,7 @@ HRESULT WINAPI CFSFolder::GetAttributesOf(UINT cidl,
         else if (_ILIsDrive(rpidl))
         {
             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))
             {
                 hr = psfParent->GetAttributesOf(1, &rpidl, (SFGAOF*)rgfInOut);
@@ -1064,7 +1064,7 @@ HRESULT WINAPI CFSFolder::GetUIObjectOf(HWND hwndOwner,
             DEFCONTEXTMENU dcm;
             dcm.hwnd = hwndOwner;
             dcm.pcmcb = this;
-            dcm.pidlFolder = pidlRoot;
+            dcm.pidlFolder = m_pidlRoot;
             dcm.psf = this;
             dcm.cidl = cidl;
             dcm.apidl = apidl;
@@ -1077,7 +1077,7 @@ HRESULT WINAPI CFSFolder::GetUIObjectOf(HWND hwndOwner,
         {
             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
             {
@@ -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 */
             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
@@ -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 ((GET_SHGDN_FOR(dwFlags) & SHGDN_FORPARSING) && 
             (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER) &&
-            sPathTarget)
+            m_sPathTarget)
         {
-            return SHSetStrRet(strRet, sPathTarget);
+            return SHSetStrRet(strRet, m_sPathTarget);
         }
         return E_INVALIDARG;
     }
@@ -1212,9 +1212,9 @@ HRESULT WINAPI CFSFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl,
 
     if ((GET_SHGDN_FOR(dwFlags) & SHGDN_FORPARSING) &&
         (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER) &&
-        sPathTarget)
+        m_sPathTarget)
     {
-        lstrcpynW(pszPath, sPathTarget, MAX_PATH);
+        lstrcpynW(pszPath, m_sPathTarget, MAX_PATH);
         PathAddBackslashW(pszPath);
         len = wcslen(pszPath);
     }
@@ -1261,11 +1261,11 @@ HRESULT WINAPI CFSFolder::SetNameOf(
     }
 
     /* build source path */
-    PathCombineW(szSrc, sPathTarget, pDataW->wszName);
+    PathCombineW(szSrc, m_sPathTarget, pDataW->wszName);
 
     /* build destination path */
     if (dwFlags == SHGDN_NORMAL || dwFlags & SHGDN_INFOLDER)
-        PathCombineW(szDest, sPathTarget, lpName);
+        PathCombineW(szDest, m_sPathTarget, lpName);
     else
         lstrcpynW(szDest, lpName, MAX_PATH);
 
@@ -1415,7 +1415,7 @@ HRESULT WINAPI CFSFolder::GetClassID(CLSID * lpClassId)
     if (!lpClassId)
         return E_POINTER;
 
-    *lpClassId = *pclsid;
+    *lpClassId = *m_pclsid;
 
     return S_OK;
 }
@@ -1424,7 +1424,7 @@ HRESULT WINAPI CFSFolder::GetClassID(CLSID * lpClassId)
  * CFSFolder::Initialize
  *
  * 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)
 {
@@ -1432,23 +1432,23 @@ HRESULT WINAPI CFSFolder::Initialize(PCIDLIST_ABSOLUTE pidl)
 
     TRACE ("(%p)->(%p)\n", this, pidl);
 
-    SHFree (pidlRoot);     /* free the old pidl */
-    pidlRoot = ILClone (pidl); /* set my pidl */
+    SHFree(m_pidlRoot);     /* free the old pidl */
+    m_pidlRoot = ILClone (pidl); /* set my pidl */
 
-    SHFree (sPathTarget);
-    sPathTarget = NULL;
+    SHFree (m_sPathTarget);
+    m_sPathTarget = NULL;
 
     /* set my path */
     if (SHGetPathFromIDListW (pidl, wszTemp))
     {
         int len = wcslen(wszTemp);
-        sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
-        if (!sPathTarget)
+        m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
+        if (!m_sPathTarget)
             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;
 }
 
@@ -1462,7 +1462,7 @@ HRESULT WINAPI CFSFolder::GetCurFolder(PIDLIST_ABSOLUTE * pidl)
     if (!pidl)
         return E_POINTER;
 
-    *pidl = ILClone(pidlRoot);
+    *pidl = ILClone(m_pidlRoot);
     return S_OK;
 }
 
@@ -1487,15 +1487,15 @@ HRESULT WINAPI CFSFolder::InitializeEx(IBindCtx * pbc, LPCITEMIDLIST pidlRootx,
     if (ppfti && ppfti->pidlTargetFolder)
         pdump(ppfti->pidlTargetFolder);
 
-    if (pidlRoot)
-        __SHFreeAndNil(&pidlRoot);    /* free the old */
-    if (sPathTarget)
-        __SHFreeAndNil(&sPathTarget);
+    if (m_pidlRoot)
+        __SHFreeAndNil(&m_pidlRoot);    /* free the old */
+    if (m_sPathTarget)
+        __SHFreeAndNil(&m_sPathTarget);
 
     /*
      * Root path and pidl
      */
-    pidlRoot = ILClone(pidlRootx);
+    m_pidlRoot = ILClone(pidlRootx);
 
     /*
      *  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,
                                         ppfti->csidl & CSIDL_FLAG_CREATE)) {
                 int len = wcslen(wszTemp);
-                sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
-                if (!sPathTarget)
+                m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
+                if (!m_sPathTarget)
                     return E_OUTOFMEMORY;
-                memcpy(sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
+                memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
             }
         }
         else if (ppfti->szTargetParsingName[0])
         {
             int len = wcslen(ppfti->szTargetParsingName);
-            sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
-            if (!sPathTarget)
+            m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
+            if (!m_sPathTarget)
                 return E_OUTOFMEMORY;
-            memcpy(sPathTarget, ppfti->szTargetParsingName,
+            memcpy(m_sPathTarget, ppfti->szTargetParsingName,
                    (len + 1) * sizeof(WCHAR));
         }
         else if (ppfti->pidlTargetFolder)
@@ -1528,17 +1528,17 @@ HRESULT WINAPI CFSFolder::InitializeEx(IBindCtx * pbc, LPCITEMIDLIST pidlRootx,
             if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp))
             {
                 int len = wcslen(wszTemp);
-                sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
-                if (!sPathTarget)
+                m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
+                if (!m_sPathTarget)
                     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));
-    pdump(pidlRoot);
-    return (sPathTarget) ? S_OK : E_FAIL;
+    TRACE("--(%p)->(target=%s)\n", this, debugstr_w(m_sPathTarget));
+    pdump(m_pidlRoot);
+    return (m_sPathTarget) ? S_OK : E_FAIL;
 }
 
 HRESULT WINAPI CFSFolder::GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO * ppfti)
@@ -1630,7 +1630,7 @@ HRESULT CFSFolder::_CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pi
         return E_INVALIDARG;
     }
 
-    PathCombineW(wszPath, sPathTarget, pDataW->wszName);
+    PathCombineW(wszPath, m_sPathTarget, pDataW->wszName);
 
     CComPtr<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)
         {
-            PUITEMID_CHILD pidlChild = ILClone(ILFindLastID(pidlRoot));
-            LPITEMIDLIST pidlParent = ILClone(pidlRoot);
+            PUITEMID_CHILD pidlChild = ILClone(ILFindLastID(m_pidlRoot));
+            LPITEMIDLIST pidlParent = ILClone(m_pidlRoot);
             ILRemoveLastID(pidlParent);
-            HRESULT hr = SH_ShowPropertiesDialog(sPathTarget, pidlParent, &pidlChild);
+            HRESULT hr = SH_ShowPropertiesDialog(m_sPathTarget, pidlParent, &pidlChild);
             if (FAILED(hr))
                 ERR("SH_ShowPropertiesDialog failed\n");
             ILFree(pidlChild);
@@ -1731,7 +1731,7 @@ HRESULT WINAPI CFSFolder::GetCustomViewInfo(ULONG unknown, SFVM_CUSTOMVIEWINFO_D
     WCHAR szPath[MAX_PATH], szIniFile[MAX_PATH];
 
     // does the folder exists?
-    if (!SHGetPathFromIDListW(pidlRoot, szPath) || !PathIsDirectoryW(szPath))
+    if (!SHGetPathFromIDListW(m_pidlRoot, szPath) || !PathIsDirectoryW(szPath))
     {
         return E_INVALIDARG;
     }
index 39b5c09..6c6f055 100644 (file)
@@ -32,12 +32,12 @@ class CFSFolder :
     public IShellFolderViewCB
 {
     private:
-        CLSID *pclsid;
+        const CLSID *m_pclsid;
 
         /* 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;
         HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut);