https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f5ab9cb723cb38e6227f80...
commit f5ab9cb723cb38e6227f80c9fb7b05d611d32de6 Author: Serge Gautherie 32623169+SergeGautherie@users.noreply.github.com AuthorDate: Wed Nov 20 15:41:08 2019 +0100 Commit: Hermès BÉLUSCA - MAÏTO hermes.belusca-maito@reactos.org CommitDate: Wed Nov 20 15:41:08 2019 +0100
[NTOBJSHEX] StringCbCopy*() need sizeof(), not _countof() (#2066)
And use explicit StringCbCopyW(). --- dll/shellext/ntobjshex/foldercommon.h | 4 ++-- dll/shellext/ntobjshex/ntobjfolder.cpp | 8 ++++---- dll/shellext/ntobjshex/regfolder.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dll/shellext/ntobjshex/foldercommon.h b/dll/shellext/ntobjshex/foldercommon.h index ae04fd40d85..23c2fed3a1a 100644 --- a/dll/shellext/ntobjshex/foldercommon.h +++ b/dll/shellext/ntobjshex/foldercommon.h @@ -179,7 +179,7 @@ public:
WCHAR path[MAX_PATH];
- StringCbCopyW(path, _countof(path), m_NtPath); + StringCbCopyW(path, sizeof(path), m_NtPath); PathAppendW(path, info->entryName);
LPITEMIDLIST first = ILCloneFirst(pidl); @@ -635,7 +635,7 @@ public: { m_shellPidl = ILClone(pidl);
- StringCbCopy(m_NtPath, _countof(m_NtPath), L"\"); + StringCbCopyW(m_NtPath, sizeof(m_NtPath), L"\");
return S_OK; } diff --git a/dll/shellext/ntobjshex/ntobjfolder.cpp b/dll/shellext/ntobjshex/ntobjfolder.cpp index 38a4cabadd7..fa0526dd2bb 100644 --- a/dll/shellext/ntobjshex/ntobjfolder.cpp +++ b/dll/shellext/ntobjshex/ntobjfolder.cpp @@ -148,7 +148,7 @@ HRESULT STDMETHODCALLTYPE CNtObjectFolder::ResolveSymLink(
if (link.Buffer[1] == L':' && isalphaW(link.Buffer[0])) { - StringCbCopyNW(path, _countof(path), link.Buffer, link.Length); + StringCbCopyNW(path, sizeof(path), link.Buffer, link.Length);
CComPtr<IShellFolder> psfDesktop; hr = SHGetDesktopFolder(&psfDesktop); @@ -158,7 +158,7 @@ HRESULT STDMETHODCALLTYPE CNtObjectFolder::ResolveSymLink( return psfDesktop->ParseDisplayName(NULL, NULL, path, NULL, fullPidl, NULL); }
- StringCbCopyW(path, _countof(path), L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{845B0FB2-66E0-416B-8F91-314E23F7C12D}"); + StringCbCopyW(path, sizeof(path), L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{845B0FB2-66E0-416B-8F91-314E23F7C12D}"); PathAppend(path, link.Buffer);
CComPtr<IShellFolder> psfDesktop; @@ -202,7 +202,7 @@ HRESULT STDMETHODCALLTYPE CNtObjectFolder::Initialize(PCIDLIST_ABSOLUTE pidl) { m_shellPidl = ILClone(pidl);
- StringCbCopy(m_NtPath, _countof(m_NtPath), L"\"); + StringCbCopyW(m_NtPath, sizeof(m_NtPath), L"\");
return S_OK; } @@ -212,7 +212,7 @@ HRESULT STDMETHODCALLTYPE CNtObjectFolder::Initialize(PCIDLIST_ABSOLUTE pidl, PC { m_shellPidl = ILClone(pidl);
- StringCbCopy(m_NtPath, _countof(m_NtPath), ntPath); + StringCbCopyW(m_NtPath, sizeof(m_NtPath), ntPath);
return S_OK; } diff --git a/dll/shellext/ntobjshex/regfolder.cpp b/dll/shellext/ntobjshex/regfolder.cpp index c75c79cb158..420091edb3d 100644 --- a/dll/shellext/ntobjshex/regfolder.cpp +++ b/dll/shellext/ntobjshex/regfolder.cpp @@ -141,7 +141,7 @@ HRESULT STDMETHODCALLTYPE CRegistryFolder::Initialize(PCIDLIST_ABSOLUTE pidl) m_shellPidl = ILClone(pidl); m_hRoot = NULL;
- StringCbCopy(m_NtPath, _countof(m_NtPath), L""); + StringCbCopyW(m_NtPath, sizeof(m_NtPath), L""); return S_OK; }
@@ -150,7 +150,7 @@ HRESULT STDMETHODCALLTYPE CRegistryFolder::Initialize(PCIDLIST_ABSOLUTE pidl, PC m_shellPidl = ILClone(pidl); m_hRoot = hRoot;
- StringCbCopy(m_NtPath, _countof(m_NtPath), ntPath); + StringCbCopyW(m_NtPath, sizeof(m_NtPath), ntPath); return S_OK; }