https://git.reactos.org/?p=reactos.git;a=commitdiff;h=73e795656379a0519b9bc93d4ba035b12e221d5b

commit 73e795656379a0519b9bc93d4ba035b12e221d5b
Author:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
AuthorDate: Mon Jul 29 20:37:42 2024 +0900
Commit:     GitHub <nore...@github.com>
CommitDate: Mon Jul 29 20:37:42 2024 +0900

    [SHELL32] Follow-up of #7169 (#7175)
    
    Follow-up of #7169
    JIRA issue: CORE-19595
    - Revert some code in
      RecycleBinGeneric::DeleteFile.
---
 dll/win32/shell32/shellrecyclebin/recyclebin_generic.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/dll/win32/shell32/shellrecyclebin/recyclebin_generic.cpp 
b/dll/win32/shell32/shellrecyclebin/recyclebin_generic.cpp
index c9a010e12b0..a7ad1b00de0 100644
--- a/dll/win32/shell32/shellrecyclebin/recyclebin_generic.cpp
+++ b/dll/win32/shell32/shellrecyclebin/recyclebin_generic.cpp
@@ -97,7 +97,15 @@ STDMETHODIMP RecycleBinGeneric::DeleteFile(LPCWSTR 
szFileName)
 
     /* Get associated volume path */
     WCHAR szVolume[MAX_PATH];
+#ifndef __REACTOS__
+    if (!GetVolumePathNameW(szFullName, szVolume, _countof(szVolume)))
+    {
+        CoTaskMemFree(szFullName);
+        return HRESULT_FROM_WIN32(GetLastError());
+    }
+#else
     swprintf(szVolume, L"%c:\\", szFullName[0]);
+#endif
 
     /* Skip namespace (if any): "\\.\" or "\\?\" */
     if (szVolume[0] == '\\' &&
@@ -130,7 +138,7 @@ STDMETHODIMP RecycleBinGeneric::EmptyRecycleBin()
     if (dwLogicalDrives == 0)
         return HRESULT_FROM_WIN32(GetLastError());
 
-    for (DWORD i = 0; i < L'Z' - L'A' + 1; i++)
+    for (DWORD i = 0; i < 'Z' - 'A' + 1; i++)
     {
         if (!(dwLogicalDrives & (1 << i)))
             continue;

Reply via email to