[NTOBJSHEX] StringCbCopy*() need sizeof(), not _countof() (#2066)
authorSerge Gautherie <32623169+SergeGautherie@users.noreply.github.com>
Wed, 20 Nov 2019 14:41:08 +0000 (15:41 +0100)
committerHermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
Wed, 20 Nov 2019 14:41:08 +0000 (15:41 +0100)
And use explicit StringCbCopyW().

dll/shellext/ntobjshex/foldercommon.h
dll/shellext/ntobjshex/ntobjfolder.cpp
dll/shellext/ntobjshex/regfolder.cpp

index ae04fd4..23c2fed 100644 (file)
@@ -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;
     }
index 38a4cab..fa0526d 100644 (file)
@@ -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;
 }
index c75c79c..420091e 100644 (file)
@@ -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;
 }