Index: dll/win32/browseui/shellbrowser.cpp =================================================================== --- dll/win32/browseui/shellbrowser.cpp (revision 70695) +++ dll/win32/browseui/shellbrowser.cpp (working copy) @@ -1254,13 +1254,13 @@ if (FAILED_UNEXPECTEDLY(hResult)) return E_FAIL; - if (fCurrentShellView != NULL) - { - hResult = fCurrentShellView->AddPropertySheetPages( - 0, AddFolderOptionsPage, reinterpret_cast(&m_PropSheet)); - if (FAILED_UNEXPECTEDLY(hResult)) - return E_FAIL; - } + //if (fCurrentShellView != NULL) + //{ + // hResult = fCurrentShellView->AddPropertySheetPages( + // 0, AddFolderOptionsPage, reinterpret_cast(&m_PropSheet)); + // if (FAILED_UNEXPECTEDLY(hResult)) + // return E_FAIL; + //} // show sheet m_PropSheet.dwSize = sizeof(PROPSHEETHEADER); @@ -3203,7 +3203,6 @@ SHEnableMenuItem(theMenu, IDM_TOOLS_MAPNETWORKDRIVE, FALSE); SHEnableMenuItem(theMenu, IDM_TOOLS_DISCONNECTNETWORKDRIVE, FALSE); SHEnableMenuItem(theMenu, IDM_TOOLS_SYNCHRONIZE, FALSE); - SHEnableMenuItem(theMenu, IDM_TOOLS_FOLDEROPTIONS, FALSE); menuIndex = 4; } else if (theMenu == SHGetMenuFromID(fCurrentMenuBar, FCIDM_MENU_HELP)) Index: dll/win32/shell32/CFolderOptions.cpp =================================================================== --- dll/win32/shell32/CFolderOptions.cpp (revision 0) +++ dll/win32/shell32/CFolderOptions.cpp (working copy) @@ -0,0 +1,105 @@ +/* + * Folder options. + * + * Copyright (C) 2016 Mark Jansen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + + +WINE_DEFAULT_DEBUG_CHANNEL(fprop); + +CFolderOptions::CFolderOptions() + :m_pSite(NULL) +{ +} + +CFolderOptions::~CFolderOptions() +{ +} + +/************************************************************************* + * FolderOptions IShellPropSheetExt interface + */ + +INT_PTR CALLBACK FolderOptionsGeneralDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK FolderOptionsViewDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK FolderOptionsFileTypesDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); + +HRESULT STDMETHODCALLTYPE CFolderOptions::AddPages(LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) +{ + HPROPSHEETPAGE hPage = SH_CreatePropertySheetPage(IDD_FOLDER_OPTIONS_GENERAL, FolderOptionsGeneralDlg, 0, NULL); + + if (hPage == NULL) + { + ERR("Failed to create property sheet page FolderOptionsGeneral\n"); + return E_FAIL; + } + if (!pfnAddPage(hPage, lParam)) + return E_FAIL; + + hPage = SH_CreatePropertySheetPage(IDD_FOLDER_OPTIONS_VIEW, FolderOptionsViewDlg, 0, NULL); + if (hPage == NULL) + { + ERR("Failed to create property sheet page FolderOptionsView\n"); + return E_FAIL; + } + if (!pfnAddPage(hPage, lParam)) + return E_FAIL; + + hPage = SH_CreatePropertySheetPage(IDD_FOLDER_OPTIONS_FILETYPES, FolderOptionsFileTypesDlg, 0, NULL); + if (hPage == NULL) + { + ERR("Failed to create property sheet page FolderOptionsFileTypes\n"); + return E_FAIL; + } + if (!pfnAddPage(hPage, lParam)) + return E_FAIL; + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CFolderOptions::ReplacePage(EXPPS uPageID, LPFNSVADDPROPSHEETPAGE pfnReplaceWith, LPARAM lParam) +{ + TRACE("(%p) (uPageID %u, pfnReplaceWith %p lParam %p\n", this, uPageID, pfnReplaceWith, lParam); + return E_NOTIMPL; +} + +/************************************************************************* + * FolderOptions IShellExtInit interface + */ + +HRESULT STDMETHODCALLTYPE CFolderOptions::Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) +{ + return S_OK; +} + + +/************************************************************************* + * FolderOptions IShellExtInit interface + */ +HRESULT STDMETHODCALLTYPE CFolderOptions::SetSite(IUnknown *pUnkSite) +{ + m_pSite = pUnkSite; + return S_OK; +} + +HRESULT STDMETHODCALLTYPE CFolderOptions::GetSite(REFIID riid, void **ppvSite) +{ + return m_pSite->QueryInterface(riid, ppvSite); +} + Index: dll/win32/shell32/CFolderOptions.h =================================================================== --- dll/win32/shell32/CFolderOptions.h (revision 0) +++ dll/win32/shell32/CFolderOptions.h (working copy) @@ -0,0 +1,68 @@ +/* + * Folder options. + * + * Copyright (C) 2016 Mark Jansen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _CFOLDEROPTIONS_H_ +#define _CFOLDEROPTIONS_H_ + +class CFolderOptions : + public CComCoClass, + public CComObjectRootEx, + public IShellPropSheetExt, + public IShellExtInit, + public IObjectWithSite +{ + private: + CComPtr m_pSite; + //LPITEMIDLIST pidl; + //INT iIdEmpty; + //UINT cfShellIDList; + //void SF_RegisterClipFmt(); + //BOOL fAcceptFmt; /* flag for pending Drop */ + //BOOL QueryDrop (DWORD dwKeyState, LPDWORD pdwEffect); + //BOOL RecycleBinIsEmpty(); + + public: + CFolderOptions(); + ~CFolderOptions(); + + // IShellPropSheetExt + virtual HRESULT STDMETHODCALLTYPE AddPages(LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam); + virtual HRESULT STDMETHODCALLTYPE ReplacePage(EXPPS uPageID, LPFNSVADDPROPSHEETPAGE pfnReplaceWith, LPARAM lParam); + + // IShellExtInit + virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID); + + // IObjectWithSite + virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite); + virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite); + + DECLARE_REGISTRY_RESOURCEID(IDR_FOLDEROPTIONS) + DECLARE_NOT_AGGREGATABLE(CFolderOptions) + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CFolderOptions) + COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt) + COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) + COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) + END_COM_MAP() +}; + +#endif /* _CFOLDEROPTIONS_H_ */ Index: dll/win32/shell32/CMakeLists.txt =================================================================== --- dll/win32/shell32/CMakeLists.txt (revision 70695) +++ dll/win32/shell32/CMakeLists.txt (working copy) @@ -37,6 +37,7 @@ shell32.cpp CShellItem.cpp CShellLink.cpp + CFolderOptions.cpp folders/CDesktopFolder.cpp folders/CFSFolder.cpp folders/CDrivesFolder.cpp Index: dll/win32/shell32/dialogs/folder_options.cpp =================================================================== --- dll/win32/shell32/dialogs/folder_options.cpp (revision 70695) +++ dll/win32/shell32/dialogs/folder_options.cpp (working copy) @@ -83,7 +83,6 @@ EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj); -static INT_PTR CALLBACK FolderOptionsGeneralDlg( @@ -124,7 +123,6 @@ } -static INT_PTR CALLBACK FolderOptionsViewDlg( @@ -384,7 +382,6 @@ return NULL; } -static INT_PTR CALLBACK FolderOptionsFileTypesDlg( Index: dll/win32/shell32/precomp.h =================================================================== --- dll/win32/shell32/precomp.h (revision 70695) +++ dll/win32/shell32/precomp.h (working copy) @@ -50,6 +50,7 @@ #include "CShellItem.h" #include "CShellLink.h" #include "CDropTargetHelper.h" +#include "CFolderOptions.h" #include "folders/CFSFolder.h" #include "folders/CDrivesFolder.h" #include "folders/CDesktopFolder.h" Index: dll/win32/shell32/res/rgs/folderoptions.rgs =================================================================== --- dll/win32/shell32/res/rgs/folderoptions.rgs (revision 70695) +++ dll/win32/shell32/res/rgs/folderoptions.rgs (working copy) @@ -27,6 +27,13 @@ val Attributes = d '0' } } + ForceRemove {6D5313C0-8C62-11D1-B2CD-006097DF8C11} = s 'Folder Options Property Page Extension' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } } } HKLM Index: dll/win32/shell32/shell32.cpp =================================================================== --- dll/win32/shell32/shell32.cpp (revision 70695) +++ dll/win32/shell32/shell32.cpp (working copy) @@ -203,6 +203,7 @@ OBJECT_ENTRY(CLSID_FontsFolderShortcut, CFontsFolder) OBJECT_ENTRY(CLSID_Printers, CPrinterFolder) OBJECT_ENTRY(CLSID_AdminFolderShortcut, CAdminToolsFolder) + OBJECT_ENTRY(CLSID_ShellFldSetExt, CFolderOptions) OBJECT_ENTRY(CLSID_RecycleBin, CRecycleBin) OBJECT_ENTRY(CLSID_OpenWithMenu, COpenWithMenu) OBJECT_ENTRY(CLSID_NewMenu, CNewMenu)