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

commit f1bc04d7e604d069ef45657325ad0a731cbf3775
Author:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
AuthorDate: Mon Dec 2 02:26:34 2019 +0900
Commit:     GitHub <nore...@github.com>
CommitDate: Mon Dec 2 02:26:34 2019 +0900

    [SHELL32][ZIPFLDR] Implement SendTo ZIP folder (#2118)
    
    Follow-up of #2114.
    - s/Creater/Creator/
    - Add an empty file in the SendTo folder.
    - Trick.
    CORE-16495
---
 dll/shellext/zipfldr/CMakeLists.txt                  |  2 +-
 dll/shellext/zipfldr/CSendToZip.cpp                  | 12 +++++-------
 dll/shellext/zipfldr/CSendToZip.hpp                  |  9 +++++----
 .../zipfldr/{CZipCreater.cpp => CZipCreator.cpp}     | 10 +++++-----
 .../zipfldr/{CZipCreater.hpp => CZipCreator.hpp}     |  6 +++---
 dll/shellext/zipfldr/precomp.h                       |  2 +-
 dll/win32/shell32/wine/shellpath.c                   | 20 +++++++++++++++++++-
 7 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/dll/shellext/zipfldr/CMakeLists.txt 
b/dll/shellext/zipfldr/CMakeLists.txt
index a0244d642aa..f0339f9a6ff 100644
--- a/dll/shellext/zipfldr/CMakeLists.txt
+++ b/dll/shellext/zipfldr/CMakeLists.txt
@@ -29,7 +29,7 @@ list(APPEND SOURCE
     CEnumZipContents.cpp
     CFolderViewCB.cpp
     CSendToZip.cpp
-    CZipCreater.cpp
+    CZipCreator.cpp
     CZipEnumerator.hpp
     CZipExtract.cpp
     CZipFolder.hpp
diff --git a/dll/shellext/zipfldr/CSendToZip.cpp 
b/dll/shellext/zipfldr/CSendToZip.cpp
index 9ec9bd5dc7a..67f774c141d 100644
--- a/dll/shellext/zipfldr/CSendToZip.cpp
+++ b/dll/shellext/zipfldr/CSendToZip.cpp
@@ -47,12 +47,10 @@ CSendToZip::Drop(IDataObject *pDataObj, DWORD grfKeyState, 
POINTL pt,
                  DWORD *pdwEffect)
 {
     m_pDataObject = pDataObj;
-    *pdwEffect &= DROPEFFECT_COPY;
 
-    if (!pDataObj || !m_fCanDragDrop || !*pdwEffect)
+    if (!pDataObj || !m_fCanDragDrop)
     {
-        DPRINT1("Drop failed: %d %d %d\n",
-                !pDataObj, !m_fCanDragDrop, !*pdwEffect);
+        DPRINT1("Drop failed: %d %d\n", !pDataObj, !m_fCanDragDrop);
         *pdwEffect = 0;
         DragLeave();
         return E_FAIL;
@@ -71,19 +69,19 @@ CSendToZip::Drop(IDataObject *pDataObj, DWORD grfKeyState, 
POINTL pt,
     HDROP hDrop = reinterpret_cast<HDROP>(stg.hGlobal);
     UINT cItems = ::DragQueryFileW(hDrop, -1, NULL, 0);
 
-    CZipCreator *pCreater = CZipCreator::DoCreate();
+    CZipCreator *pCreator = CZipCreator::DoCreate();
 
     for (UINT iItem = 0; iItem < cItems; ++iItem)
     {
         WCHAR szPath[MAX_PATH];
         DragQueryFileW(hDrop, iItem, szPath, _countof(szPath));
 
-        pCreater->DoAddItem(szPath);
+        pCreator->DoAddItem(szPath);
     }
 
     ::ReleaseStgMedium(&stg);
 
-    CZipCreator::runThread(pCreater);   // pCreater is deleted in runThread
+    CZipCreator::runThread(pCreator);   // pCreator is deleted in runThread
 
     DragLeave();
     return hr;
diff --git a/dll/shellext/zipfldr/CSendToZip.hpp 
b/dll/shellext/zipfldr/CSendToZip.hpp
index 1f3eb248a13..b4e8fca325c 100644
--- a/dll/shellext/zipfldr/CSendToZip.hpp
+++ b/dll/shellext/zipfldr/CSendToZip.hpp
@@ -46,21 +46,22 @@ public:
     }
     STDMETHODIMP Save(LPCOLESTR pszFileName, BOOL fRemember)
     {
-        return E_FAIL;
+        return E_NOTIMPL;
     }
     STDMETHODIMP SaveCompleted(LPCOLESTR pszFileName)
     {
-        return E_FAIL;
+        return E_NOTIMPL;
     }
     STDMETHODIMP GetCurFile(LPOLESTR *ppszFileName)
     {
-        return E_FAIL;
+        return E_NOTIMPL;
     }
 
     // *** IPersist methods ***
     STDMETHODIMP GetClassID(CLSID *pclsid)
     {
-        return E_FAIL;
+        *pclsid = CLSID_ZipFolderSendTo;
+        return S_OK;
     }
 
 public:
diff --git a/dll/shellext/zipfldr/CZipCreater.cpp 
b/dll/shellext/zipfldr/CZipCreator.cpp
similarity index 97%
rename from dll/shellext/zipfldr/CZipCreater.cpp
rename to dll/shellext/zipfldr/CZipCreator.cpp
index 694128b6bcb..c0ba8da0b68 100644
--- a/dll/shellext/zipfldr/CZipCreater.cpp
+++ b/dll/shellext/zipfldr/CZipCreator.cpp
@@ -182,15 +182,15 @@ CZipCreator::~CZipCreator()
 static unsigned __stdcall
 create_zip_function(void *arg)
 {
-    CZipCreator *pCreater = reinterpret_cast<CZipCreator *>(arg);
-    return pCreater->m_pimpl->JustDoIt();
+    CZipCreator *pCreator = reinterpret_cast<CZipCreator *>(arg);
+    return pCreator->m_pimpl->JustDoIt();
 }
 
-BOOL CZipCreator::runThread(CZipCreator *pCreater)
+BOOL CZipCreator::runThread(CZipCreator *pCreator)
 {
     unsigned tid = 0;
     HANDLE hThread = reinterpret_cast<HANDLE>(
-        _beginthreadex(NULL, 0, create_zip_function, pCreater, 0, &tid));
+        _beginthreadex(NULL, 0, create_zip_function, pCreator, 0, &tid));
 
     if (hThread)
     {
@@ -204,7 +204,7 @@ BOOL CZipCreator::runThread(CZipCreator *pCreater)
     CStringW strText(MAKEINTRESOURCEW(IDS_CANTSTARTTHREAD));
     MessageBoxW(NULL, strText, strTitle, MB_ICONERROR);
 
-    delete pCreater;
+    delete pCreator;
     return FALSE;
 }
 
diff --git a/dll/shellext/zipfldr/CZipCreater.hpp 
b/dll/shellext/zipfldr/CZipCreator.hpp
similarity index 85%
rename from dll/shellext/zipfldr/CZipCreater.hpp
rename to dll/shellext/zipfldr/CZipCreator.hpp
index 52fb14f9ead..1a77451ea8f 100644
--- a/dll/shellext/zipfldr/CZipCreater.hpp
+++ b/dll/shellext/zipfldr/CZipCreator.hpp
@@ -5,8 +5,8 @@
  * COPYRIGHT:   Copyright 2019 Mark Jansen (mark.jan...@reactos.org)
  *              Copyright 2019 Katayama Hirofumi MZ 
(katayama.hirofumi...@gmail.com)
  */
-#ifndef CZIPCREATER_HPP_
-#define CZIPCREATER_HPP_
+#ifndef CZIPCREATOR_HPP_
+#define CZIPCREATOR_HPP_
 
 struct CZipCreatorImpl;
 
@@ -23,7 +23,7 @@ public:
     }
 
     virtual void DoAddItem(LPCWSTR pszFile);
-    static BOOL runThread(CZipCreator* pCreater);
+    static BOOL runThread(CZipCreator* pCreator);
 
 protected:
     CZipCreator();
diff --git a/dll/shellext/zipfldr/precomp.h b/dll/shellext/zipfldr/precomp.h
index ed61dc75dcc..b228624b8dc 100644
--- a/dll/shellext/zipfldr/precomp.h
+++ b/dll/shellext/zipfldr/precomp.h
@@ -78,7 +78,7 @@ eZipConfirmResponse _CZipAskReplace(HWND hDlg, const char* 
FullPath);
 
 #include "CZipEnumerator.hpp"
 #include "CZipFolder.hpp"
-#include "CZipCreater.hpp"
+#include "CZipCreator.hpp"
 #include "CSendToZip.hpp"
 
 #endif /* ZIPFLDR_PRECOMP_H */
diff --git a/dll/win32/shell32/wine/shellpath.c 
b/dll/win32/shell32/wine/shellpath.c
index 3c1906375fe..984116f8a38 100644
--- a/dll/win32/shell32/wine/shellpath.c
+++ b/dll/win32/shell32/wine/shellpath.c
@@ -2224,6 +2224,7 @@ HRESULT DoCreateSendToFiles(LPCWSTR pszSendTo)
     WCHAR szShell32[MAX_PATH];
     HRESULT hr;
     HANDLE hFile;
+    HINSTANCE hZipFldr;
 
     /* create my documents */
     SHGetSpecialFolderPathW(NULL, szTarget, CSIDL_MYDOCUMENTS, TRUE);
@@ -2248,7 +2249,24 @@ HRESULT DoCreateSendToFiles(LPCWSTR pszSendTo)
                         CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
     CloseHandle(hFile);
 
-    return hr;
+    /* create zipped compressed folder */
+    hZipFldr = LoadLibraryW(L"zipfldr.dll");
+    if (hZipFldr)
+    {
+#define IDS_FRIENDLYNAME 10195
+        LoadStringW(hZipFldr, IDS_FRIENDLYNAME, szTarget, _countof(szTarget));
+#undef IDS_FRIENDLYNAME
+        FreeLibrary(hZipFldr);
+
+        StringCbCopyW(szSendToFile, sizeof(szSendToFile), pszSendTo);
+        PathAppendW(szSendToFile, szTarget);
+        StringCbCatW(szSendToFile, sizeof(szSendToFile), L".ZFSendToTarget");
+        hFile = CreateFileW(szSendToFile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
+                            CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+        CloseHandle(hFile);
+    }
+
+    return S_OK;
 }
 
 /*************************************************************************

Reply via email to