ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2015
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
15 participants
301 discussions
Start a n
N
ew thread
[gadamopoulos] 68775: [SHELL32] - Move the properties dialog for the recycle bin in its own file. The implementation of the recycle bin is overly complicated and keeping with it a dialog for editin...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Wed Aug 19 18:10:30 2015 New Revision: 68775 URL:
http://svn.reactos.org/svn/reactos?rev=68775&view=rev
Log: [SHELL32] - Move the properties dialog for the recycle bin in its own file. The implementation of the recycle bin is overly complicated and keeping with it a dialog for editing some registry entries makes it worse. Added: trunk/reactos/dll/win32/shell32/dialogs/recycler_prop.cpp - copied, changed from r68772, trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp Modified: trunk/reactos/dll/win32/shell32/CMakeLists.txt trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp Modified: trunk/reactos/dll/win32/shell32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CMakeLis…
============================================================================== --- trunk/reactos/dll/win32/shell32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CMakeLists.txt [iso-8859-1] Wed Aug 19 18:10:30 2015 @@ -28,6 +28,7 @@ dialogs/folder_options.cpp dialogs/filedefext.cpp dialogs/fprop.cpp + dialogs/recycler_prop.cpp CDropTargetHelper.cpp CEnumIDListBase.cpp CExtractIcon.cpp Copied: trunk/reactos/dll/win32/shell32/dialogs/recycler_prop.cpp (from r68772, trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/dialogs/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/dialogs/recycler_prop.cpp [iso-8859-1] Wed Aug 19 18:10:30 2015 @@ -21,95 +21,7 @@ #include <precomp.h> -#include <mmsystem.h> -#include <ntquery.h> - -#define MAX_PROPERTY_SHEET_PAGE 32 - WINE_DEFAULT_DEBUG_CHANNEL(CRecycleBin); - -typedef struct -{ - int column_name_id; - const GUID *fmtId; - DWORD pid; - int pcsFlags; - int fmt; - int cxChars; -} columninfo; - -static const columninfo RecycleBinColumns[] = -{ - {IDS_SHV_COLUMN1, &FMTID_Storage, PID_STG_NAME, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 30}, - {IDS_SHV_COLUMN_DELFROM, &FMTID_Displaced, PID_DISPLACED_FROM, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 30}, - {IDS_SHV_COLUMN_DELDATE, &FMTID_Displaced, PID_DISPLACED_DATE, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 20}, - {IDS_SHV_COLUMN2, &FMTID_Storage, PID_STG_SIZE, SHCOLSTATE_TYPE_INT | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 20}, - {IDS_SHV_COLUMN3, &FMTID_Storage, PID_STG_STORAGETYPE, SHCOLSTATE_TYPE_INT | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 20}, - {IDS_SHV_COLUMN4, &FMTID_Storage, PID_STG_WRITETIME, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 20}, - /* {"creation time", &FMTID_Storage, PID_STG_CREATETIME, SHCOLSTATE_TYPE_DATE, LVCFMT_LEFT, 20}, */ - /* {"attribs", &FMTID_Storage, PID_STG_ATTRIBUTES, SHCOLSTATE_TYPE_STR, LVCFMT_LEFT, 20}, */ -}; - -#define COLUMN_NAME 0 -#define COLUMN_DELFROM 1 -#define COLUMN_DATEDEL 2 -#define COLUMN_SIZE 3 -#define COLUMN_TYPE 4 -#define COLUMN_MTIME 5 - -#define COLUMNS_COUNT 6 - -/* - * Recycle Bin folder - */ - -class CRecycleBinEnum : - public CEnumIDListBase -{ - private: - public: - CRecycleBinEnum(); - ~CRecycleBinEnum(); - HRESULT WINAPI Initialize(DWORD dwFlags); - static BOOL WINAPI CBEnumRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile); - BOOL WINAPI CBEnumRecycleBin(IN HANDLE hDeletedFile); - - BEGIN_COM_MAP(CRecycleBinEnum) - COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList) - END_COM_MAP() -}; - -class CRecycleBinItemContextMenu : - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IContextMenu2 -{ - private: - LPITEMIDLIST apidl; - public: - CRecycleBinItemContextMenu(); - ~CRecycleBinItemContextMenu(); - HRESULT WINAPI Initialize(LPCITEMIDLIST pidl); - - // IContextMenu - virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); - virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi); - virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen); - - // IContextMenu2 - virtual HRESULT WINAPI HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam); - - BEGIN_COM_MAP(CRecycleBinItemContextMenu) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2) - END_COM_MAP() -}; - -typedef struct -{ - PIDLRecycleStruct *pFileDetails; - HANDLE hDeletedFile; - BOOL bFound; -} SEARCH_CONTEXT, *PSEARCH_CONTEXT; typedef struct { @@ -118,758 +30,7 @@ DWORD dwMaxCapacity; } DRIVE_ITEM_CONTEXT, *PDRIVE_ITEM_CONTEXT; -BOOL WINAPI CBSearchRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile) -{ - PSEARCH_CONTEXT pContext = (PSEARCH_CONTEXT)Context; - - PDELETED_FILE_DETAILS_W pFileDetails; - DWORD dwSize; - BOOL ret; - - if (!GetDeletedFileDetailsW(hDeletedFile, - 0, - NULL, - &dwSize) && - GetLastError() != ERROR_INSUFFICIENT_BUFFER) - { - ERR("GetDeletedFileDetailsW failed\n"); - return FALSE; - } - - pFileDetails = (DELETED_FILE_DETAILS_W *)SHAlloc(dwSize); - if (!pFileDetails) - { - ERR("No memory\n"); - return FALSE; - } - - if (!GetDeletedFileDetailsW(hDeletedFile, - dwSize, - pFileDetails, - NULL)) - { - ERR("GetDeletedFileDetailsW failed\n"); - SHFree(pFileDetails); - return FALSE; - } - - ret = memcmp(pFileDetails, pContext->pFileDetails, dwSize); - if (!ret) - { - pContext->hDeletedFile = hDeletedFile; - pContext->bFound = TRUE; - } - else - CloseRecycleBinHandle(hDeletedFile); - - SHFree(pFileDetails); - return ret; -} - -static PIDLRecycleStruct * _ILGetRecycleStruct(LPCITEMIDLIST pidl) -{ - LPPIDLDATA pdata = _ILGetDataPointer(pidl); - - if (pdata && pdata->type == 0x00) - return (PIDLRecycleStruct*) & (pdata->u.crecycle); - - return NULL; -} - -CRecycleBinEnum::CRecycleBinEnum() -{ -} - -CRecycleBinEnum::~CRecycleBinEnum() -{ -} - -HRESULT WINAPI CRecycleBinEnum::Initialize(DWORD dwFlags) -{ - static LPCWSTR szDrive = L"C:\\"; - - if (dwFlags & SHCONTF_NONFOLDERS) - { - TRACE("Starting Enumeration\n"); - - if (!EnumerateRecycleBinW(szDrive /* FIXME */ , CBEnumRecycleBin, (PVOID)this)) - { - WARN("Error: EnumerateCRecycleBinW failed\n"); - return E_FAIL; - } - } - else - { - // do nothing - } - return S_OK; -} - -static LPITEMIDLIST _ILCreateRecycleItem(PDELETED_FILE_DETAILS_W pFileDetails) -{ - PIDLDATA tmp; - LPITEMIDLIST pidl; - PIDLRecycleStruct * p; - int size0 = (char*)&tmp.u.crecycle.szName - (char*)&tmp.u.crecycle; - int size = size0; - - tmp.type = 0x00; - size += (wcslen(pFileDetails->FileName) + 1) * sizeof(WCHAR); - - pidl = (LPITEMIDLIST)SHAlloc(size + 4); - if (!pidl) - return pidl; - - pidl->mkid.cb = size + 2; - memcpy(pidl->mkid.abID, &tmp, 2 + size0); - - p = &((PIDLDATA*)pidl->mkid.abID)->u.crecycle; - RtlCopyMemory(p, pFileDetails, sizeof(DELETED_FILE_DETAILS_W)); - wcscpy(p->szName, pFileDetails->FileName); - *(WORD*)((char*)pidl + (size + 2)) = 0; - return pidl; -} - -BOOL WINAPI CRecycleBinEnum::CBEnumRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile) -{ - return static_cast<CRecycleBinEnum *>(Context)->CBEnumRecycleBin(hDeletedFile); -} - -BOOL WINAPI CRecycleBinEnum::CBEnumRecycleBin(IN HANDLE hDeletedFile) -{ - PDELETED_FILE_DETAILS_W pFileDetails; - DWORD dwSize; - LPITEMIDLIST pidl = NULL; - BOOL ret; - - if (!GetDeletedFileDetailsW(hDeletedFile, - 0, - NULL, - &dwSize) && - GetLastError() != ERROR_INSUFFICIENT_BUFFER) - { - ERR("GetDeletedFileDetailsW failed\n"); - return FALSE; - } - - pFileDetails = (DELETED_FILE_DETAILS_W *)SHAlloc(dwSize); - if (!pFileDetails) - { - ERR("No memory\n"); - return FALSE; - } - - if (!GetDeletedFileDetailsW(hDeletedFile, - dwSize, - pFileDetails, - NULL)) - { - ERR("GetDeletedFileDetailsW failed\n"); - SHFree(pFileDetails); - return FALSE; - } - - pidl = _ILCreateRecycleItem(pFileDetails); - if (!pidl) - { - SHFree(pFileDetails); - return FALSE; - } - - ret = AddToEnumList(pidl); - - if (!ret) - SHFree(pidl); - SHFree(pFileDetails); - TRACE("Returning %d\n", ret); - CloseRecycleBinHandle(hDeletedFile); - return ret; -} - -/************************************************************************** -* IContextMenu2 Bitbucket Item Implementation -*/ - -CRecycleBinItemContextMenu::CRecycleBinItemContextMenu() -{ - apidl = NULL; -} - -CRecycleBinItemContextMenu::~CRecycleBinItemContextMenu() -{ - ILFree(apidl); -} - -HRESULT WINAPI CRecycleBinItemContextMenu::Initialize(LPCITEMIDLIST pidl) -{ - apidl = ILClone(pidl); - if (apidl == NULL) - return E_OUTOFMEMORY; - return S_OK; -} - -HRESULT WINAPI CRecycleBinItemContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) -{ - WCHAR szBuffer[30] = {0}; - ULONG Count = 1; - - TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n", this, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags); - - if (LoadStringW(shell32_hInstance, IDS_RESTORE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR))) - { - szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0'; - _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED); - Count++; - } - - if (LoadStringW(shell32_hInstance, IDS_CUT, szBuffer, sizeof(szBuffer) / sizeof(WCHAR))) - { - _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED); - szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0'; - _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED); - } - - if (LoadStringW(shell32_hInstance, IDS_DELETE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR))) - { - szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0'; - _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED); - _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED); - } - - if (LoadStringW(shell32_hInstance, IDS_PROPERTIES, szBuffer, sizeof(szBuffer) / sizeof(WCHAR))) - { - szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0'; - _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED); - _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT); - } - - return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Count); -} - -HRESULT WINAPI CRecycleBinItemContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) -{ - SEARCH_CONTEXT Context; - static LPCWSTR szDrive = L"C:\\"; - - TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n", this, lpcmi, lpcmi->lpVerb, lpcmi->hwnd); - - if (lpcmi->lpVerb == MAKEINTRESOURCEA(1) || lpcmi->lpVerb == MAKEINTRESOURCEA(5)) - { - Context.pFileDetails = _ILGetRecycleStruct(apidl); - Context.bFound = FALSE; - - EnumerateRecycleBinW(szDrive, CBSearchRecycleBin, (PVOID)&Context); - if (!Context.bFound) - return E_FAIL; - - if (lpcmi->lpVerb == MAKEINTRESOURCEA(1)) - { - /* restore file */ - if (RestoreFile(Context.hDeletedFile)) - return S_OK; - else - return E_FAIL; - } - else - { - DeleteFileHandleToRecycleBin(Context.hDeletedFile); - return E_NOTIMPL; - } - } - else if (lpcmi->lpVerb == MAKEINTRESOURCEA(3)) - { - FIXME("implement cut\n"); - return E_NOTIMPL; - } - else if (lpcmi->lpVerb == MAKEINTRESOURCEA(7)) - { - FIXME("implement properties\n"); - return E_NOTIMPL; - } - - return S_OK; -} - -HRESULT WINAPI CRecycleBinItemContextMenu::GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) -{ - TRACE("(%p)->(idcom=%lx flags=%x %p name=%p len=%x)\n", this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen); - - return E_FAIL; -} - -HRESULT WINAPI CRecycleBinItemContextMenu::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - TRACE("CRecycleBin_IContextMenu2Item_HandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n", this, uMsg, wParam, lParam); - - return E_NOTIMPL; -} - -/************************************************************************** -* registers clipboardformat once -*/ -void CRecycleBin::SF_RegisterClipFmt() -{ - TRACE ("(%p)\n", this); - - if (!cfShellIDList) - cfShellIDList = RegisterClipboardFormatW(CFSTR_SHELLIDLIST); -} - -CRecycleBin::CRecycleBin() -{ - pidl = NULL; - iIdEmpty = 0; - cfShellIDList = 0; - SF_RegisterClipFmt(); - fAcceptFmt = FALSE; -} - -CRecycleBin::~CRecycleBin() -{ - /* InterlockedDecrement(&objCount);*/ - SHFree(pidl); -} - -/************************************************************************* - * RecycleBin IPersistFolder2 interface - */ - -HRESULT WINAPI CRecycleBin::GetClassID(CLSID *pClassID) -{ - TRACE("(%p, %p)\n", this, pClassID); - if (pClassID == NULL) - return E_INVALIDARG; - memcpy(pClassID, &CLSID_RecycleBin, sizeof(CLSID)); - return S_OK; -} - -HRESULT WINAPI CRecycleBin::Initialize(LPCITEMIDLIST pidl) -{ - TRACE("(%p, %p)\n", this, pidl); - - SHFree((LPVOID)this->pidl); - this->pidl = ILClone(pidl); - if (this->pidl == NULL) - return E_OUTOFMEMORY; - return S_OK; -} - -HRESULT WINAPI CRecycleBin::GetCurFolder(LPITEMIDLIST *ppidl) -{ - TRACE("\n"); - *ppidl = ILClone(pidl); - return S_OK; -} - -/************************************************************************* - * RecycleBin IShellFolder2 interface - */ - -HRESULT WINAPI CRecycleBin::ParseDisplayName(HWND hwnd, LPBC pbc, - LPOLESTR pszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, - ULONG *pdwAttributes) -{ - FIXME("stub\n"); - return E_NOTIMPL; -} - - -PDELETED_FILE_DETAILS_W -UnpackDetailsFromPidl(LPCITEMIDLIST pidl) -{ - return (PDELETED_FILE_DETAILS_W)&pidl->mkid.abID; -} - -HRESULT WINAPI CRecycleBin::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) -{ - return ShellObjectCreatorInit<CRecycleBinEnum>(dwFlags, IID_IEnumIDList, ppEnumIDList); -} - -HRESULT WINAPI CRecycleBin::BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbc, REFIID riid, void **ppv) -{ - FIXME("(%p, %p, %p, %s, %p) - stub\n", this, pidl, pbc, debugstr_guid(&riid), ppv); - return E_NOTIMPL; -} - -HRESULT WINAPI CRecycleBin::BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbc, REFIID riid, void **ppv) -{ - FIXME("(%p, %p, %p, %s, %p) - stub\n", this, pidl, pbc, debugstr_guid(&riid), ppv); - return E_NOTIMPL; -} - -HRESULT WINAPI CRecycleBin::CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) -{ - /* TODO */ - TRACE("(%p, %p, %p, %p)\n", this, (void *)lParam, pidl1, pidl2); - if (pidl1->mkid.cb != pidl2->mkid.cb) - return MAKE_HRESULT(SEVERITY_SUCCESS, 0, pidl1->mkid.cb - pidl2->mkid.cb); - return MAKE_HRESULT(SEVERITY_SUCCESS, 0, (unsigned short)memcmp(pidl1->mkid.abID, pidl2->mkid.abID, pidl1->mkid.cb)); -} - -HRESULT WINAPI CRecycleBin::CreateViewObject(HWND hwndOwner, REFIID riid, void **ppv) -{ - CComPtr<IShellView> pShellView; - HRESULT hr = E_NOINTERFACE; - - TRACE("(%p, %p, %s, %p)\n", this, hwndOwner, debugstr_guid(&riid), ppv); - - if (!ppv) - return hr; - - *ppv = NULL; - - if (IsEqualIID (riid, IID_IDropTarget)) - { - hr = this->QueryInterface (IID_IDropTarget, ppv); - } - else if (IsEqualIID (riid, IID_IContextMenu) || IsEqualIID (riid, IID_IContextMenu2)) - { - hr = this->QueryInterface(riid, ppv); - } - else if (IsEqualIID (riid, IID_IShellView)) - { - hr = CDefView_Constructor(this, riid, ppv); - } - else - return hr; - TRACE ("-- (%p)->(interface=%p)\n", this, ppv); - return hr; - -} - -HRESULT WINAPI CRecycleBin::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, - SFGAOF *rgfInOut) -{ - TRACE("(%p, %d, {%p, ...}, {%x})\n", this, cidl, apidl ? apidl[0] : NULL, (unsigned int)*rgfInOut); - *rgfInOut &= SFGAO_FOLDER|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK; - return S_OK; -} - -HRESULT WINAPI CRecycleBin::GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, - REFIID riid, UINT *prgfInOut, void **ppv) -{ - IUnknown *pObj = NULL; - HRESULT hr = E_INVALIDARG; - - TRACE ("(%p)->(%p,%u,apidl=%p, %p %p)\n", this, - hwndOwner, cidl, apidl, prgfInOut, ppv); - - if (!ppv) - return hr; - - *ppv = NULL; - - if ((IsEqualIID (riid, IID_IContextMenu) || IsEqualIID(riid, IID_IContextMenu2)) && (cidl >= 1)) - { - hr = ShellObjectCreatorInit<CRecycleBinItemContextMenu>(apidl[0], riid, &pObj); - } - else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1)) - { - IDropTarget * pDt = NULL; - hr = QueryInterface(IID_PPV_ARG(IDropTarget, &pDt)); - pObj = pDt; - } - else if(IsEqualIID(riid, IID_IExtractIconA) && (cidl == 1)) - { - // FIXME: This is not correct, it does not show the right icons - LPITEMIDLIST pidlItem = ILCombine(pidl, apidl[0]); - pObj = IExtractIconA_Constructor(pidlItem); - SHFree(pidlItem); - hr = S_OK; - } - else if (IsEqualIID(riid, IID_IExtractIconW) && (cidl == 1)) - { - // FIXME: This is not correct, it does not show the right icons - LPITEMIDLIST pidlItem = ILCombine(pidl, apidl[0]); - pObj = IExtractIconW_Constructor(pidlItem); - SHFree(pidlItem); - hr = S_OK; - } - else - hr = E_NOINTERFACE; - - if (SUCCEEDED(hr) && !pObj) - hr = E_OUTOFMEMORY; - - *ppv = pObj; - TRACE ("(%p)->hr=0x%08x\n", this, hr); - return hr; -} - -HRESULT WINAPI CRecycleBin::GetDisplayNameOf(PCUITEMID_CHILD pidl, SHGDNF uFlags, STRRET *pName) -{ - PIDLRecycleStruct *pFileDetails; - LPWSTR pFileName; - - TRACE("(%p, %p, %x, %p)\n", this, pidl, (unsigned int)uFlags, pName); - - - if (_ILIsBitBucket (pidl)) - { - WCHAR pszPath[100]; - - if (HCR_GetClassNameW(CLSID_RecycleBin, pszPath, MAX_PATH)) - { - pName->uType = STRRET_WSTR; - pName->pOleStr = StrDupW(pszPath); - return S_OK; - } - } - - pFileDetails = _ILGetRecycleStruct(pidl); - if (!pFileDetails) - { - pName->cStr[0] = 0; - pName->uType = STRRET_CSTR; - return E_INVALIDARG; - } - - pFileName = wcsrchr(pFileDetails->szName, L'\\'); - if (!pFileName) - { - pName->cStr[0] = 0; - pName->uType = STRRET_CSTR; - return E_UNEXPECTED; - } - - pName->pOleStr = StrDupW(pFileName + 1); - if (pName->pOleStr == NULL) - return E_OUTOFMEMORY; - - pName->uType = STRRET_WSTR; - return S_OK; -} - -HRESULT WINAPI CRecycleBin::SetNameOf(HWND hwnd, PCUITEMID_CHILD pidl, LPCOLESTR pszName, - SHGDNF uFlags, PITEMID_CHILD *ppidlOut) -{ - TRACE("\n"); - return E_FAIL; /* not supported */ -} - -HRESULT WINAPI CRecycleBin::GetDefaultSearchGUID(GUID *pguid) -{ - FIXME("stub\n"); - return E_NOTIMPL; -} - -HRESULT WINAPI CRecycleBin::EnumSearches(IEnumExtraSearch **ppEnum) -{ - FIXME("stub\n"); - *ppEnum = NULL; - return E_NOTIMPL; -} - -HRESULT WINAPI CRecycleBin::GetDefaultColumn(DWORD dwReserved, ULONG *pSort, ULONG *pDisplay) -{ - TRACE("(%p, %x, %p, %p)\n", this, (unsigned int)dwReserved, pSort, pDisplay); - *pSort = 0; - *pDisplay = 0; - return S_OK; -} - -HRESULT WINAPI CRecycleBin::GetDefaultColumnState(UINT iColumn, SHCOLSTATEF *pcsFlags) -{ - TRACE("(%p, %d, %p)\n", this, iColumn, pcsFlags); - if (iColumn >= COLUMNS_COUNT) - return E_INVALIDARG; - *pcsFlags = RecycleBinColumns[iColumn].pcsFlags; - return S_OK; -} - -HRESULT WINAPI CRecycleBin::GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) -{ - FIXME("stub\n"); - return E_NOTIMPL; -} - -static HRESULT FormatDateTime(LPWSTR buffer, int size, FILETIME * ft) -{ - FILETIME lft; - SYSTEMTIME time; - int ret; - - FileTimeToLocalFileTime(ft, &lft); - FileTimeToSystemTime(&lft, &time); - - ret = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, buffer, size); - if (ret > 0 && ret < size) - { - /* Append space + time without seconds */ - buffer[ret-1] = ' '; - GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &time, NULL, &buffer[ret], size - ret); - } - - return (ret != 0 ? E_FAIL : S_OK); -} - -HRESULT WINAPI CRecycleBin::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, LPSHELLDETAILS pDetails) -{ - PIDLRecycleStruct * pFileDetails; - WCHAR buffer[MAX_PATH]; - WCHAR szTypeName[100]; - LPWSTR pszBackslash; - UINT Length; - - TRACE("(%p, %p, %d, %p)\n", this, pidl, iColumn, pDetails); - if (iColumn >= COLUMNS_COUNT) - return E_FAIL; - pDetails->fmt = RecycleBinColumns[iColumn].fmt; - pDetails->cxChar = RecycleBinColumns[iColumn].cxChars; - if (pidl == NULL) - { - pDetails->str.uType = STRRET_WSTR; - LoadStringW(shell32_hInstance, RecycleBinColumns[iColumn].column_name_id, buffer, MAX_PATH); - return SHStrDupW(buffer, &pDetails->str.pOleStr); - } - - if (iColumn == COLUMN_NAME) - return GetDisplayNameOf(pidl, SHGDN_NORMAL, &pDetails->str); - - pFileDetails = _ILGetRecycleStruct(pidl); - switch (iColumn) - { - case COLUMN_DATEDEL: - FormatDateTime(buffer, MAX_PATH, &pFileDetails->DeletionTime); - break; - case COLUMN_DELFROM: - pszBackslash = wcsrchr(pFileDetails->szName, L'\\'); - Length = (pszBackslash - pFileDetails->szName); - memcpy((LPVOID)buffer, pFileDetails->szName, Length * sizeof(WCHAR)); - buffer[Length] = L'\0'; - break; - case COLUMN_SIZE: - StrFormatKBSizeW(pFileDetails->FileSize.QuadPart, buffer, MAX_PATH); - break; - case COLUMN_MTIME: - FormatDateTime(buffer, MAX_PATH, &pFileDetails->LastModification); - break; - case COLUMN_TYPE: - szTypeName[0] = L'\0'; - wcscpy(buffer, PathFindExtensionW(pFileDetails->szName)); - if (!( HCR_MapTypeToValueW(buffer, buffer, sizeof(buffer) / sizeof(WCHAR), TRUE) && - HCR_MapTypeToValueW(buffer, szTypeName, sizeof(szTypeName) / sizeof(WCHAR), FALSE ))) - { - wcscpy (szTypeName, PathFindExtensionW(pFileDetails->szName)); - wcscat(szTypeName, L"-"); - Length = wcslen(szTypeName); - if (LoadStringW(shell32_hInstance, IDS_SHV_COLUMN1, &szTypeName[Length], (sizeof(szTypeName) / sizeof(WCHAR)) - Length)) - szTypeName[(sizeof(szTypeName)/sizeof(WCHAR))-1] = L'\0'; - } - pDetails->str.uType = STRRET_WSTR; - return SHStrDupW(szTypeName, &pDetails->str.pOleStr); - break; - default: - return E_FAIL; - } - - pDetails->str.uType = STRRET_WSTR; - return SHStrDupW(buffer, &pDetails->str.pOleStr); -} - -HRESULT WINAPI CRecycleBin::MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid) -{ - TRACE("(%p, %d, %p)\n", this, iColumn, pscid); - if (iColumn >= COLUMNS_COUNT) - return E_INVALIDARG; - pscid->fmtid = *RecycleBinColumns[iColumn].fmtId; - pscid->pid = RecycleBinColumns[iColumn].pid; - return S_OK; -} - -/************************************************************************* - * RecycleBin IContextMenu interface - */ - -HRESULT WINAPI CRecycleBin::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) -{ - WCHAR szBuffer[100]; - MENUITEMINFOW mii; - int id = 1; - - TRACE("QueryContextMenu %p %p %u %u %u %u\n", this, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags ); - - if (!hMenu) - return E_INVALIDARG; - - memset(&mii, 0, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; - mii.fState = MFS_ENABLED; - szBuffer[0] = L'\0'; - LoadStringW(shell32_hInstance, IDS_EMPTY_BITBUCKET, szBuffer, sizeof(szBuffer) / sizeof(WCHAR)); - mii.dwTypeData = szBuffer; - mii.cch = wcslen(mii.dwTypeData); - mii.wID = idCmdFirst + id++; - mii.fType = MFT_STRING; - iIdEmpty = 1; - - if (!InsertMenuItemW(hMenu, indexMenu, TRUE, &mii)) - return E_FAIL; - - return MAKE_HRESULT(SEVERITY_SUCCESS, 0, id); -} - -HRESULT WINAPI CRecycleBin::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) -{ - HRESULT hr; - LPSHELLBROWSER lpSB; - IShellView * lpSV = NULL; - - TRACE("%p %p verb %p\n", this, lpcmi, lpcmi->lpVerb); - - if (LOWORD(lpcmi->lpVerb) == iIdEmpty) - { - // FIXME - // path & flags - hr = SHEmptyRecycleBinW(lpcmi->hwnd, L"C:\\", 0); - TRACE("result %x\n", hr); - if (hr != S_OK) - return hr; - - lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0); - if (lpSB && SUCCEEDED(lpSB->QueryActiveShellView(&lpSV))) - lpSV->Refresh(); - } - return S_OK; -} - -HRESULT WINAPI CRecycleBin::GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) -{ - FIXME("%p %lu %u %p %p %u\n", this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen); - - return E_NOTIMPL; -} - -/************************************************************************* - * RecycleBin IShellPropSheetExt interface - */ - -HRESULT WINAPI CRecycleBin::AddPages(LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) -{ - FIXME("%p %p %lu\n", this, pfnAddPage, lParam); - - return E_NOTIMPL; -} - -HRESULT WINAPI CRecycleBin::ReplacePage(EXPPS uPageID, LPFNSVADDPROPSHEETPAGE pfnReplaceWith, LPARAM lParam) -{ - FIXME("%p %lu %p %lu\n", this, uPageID, pfnReplaceWith, lParam); - - return E_NOTIMPL; -} - -/************************************************************************* - * RecycleBin IShellExtInit interface - */ - -HRESULT WINAPI CRecycleBin::Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) -{ - TRACE("%p %p %p %p\n", this, pidlFolder, pdtobj, hkeyProgID ); - return S_OK; -} - -void toggleNukeOnDeleteOption(HWND hwndDlg, BOOL bEnable) +static void toggleNukeOnDeleteOption(HWND hwndDlg, BOOL bEnable) { if (bEnable) { @@ -1250,509 +411,3 @@ else return TRUE; } - -BOOL -TRASH_CanTrashFile(LPCWSTR wszPath) -{ - LONG ret; - DWORD dwNukeOnDelete, dwType, VolSerialNumber, MaxComponentLength; - DWORD FileSystemFlags, dwSize, dwDisposition; - HKEY hKey; - WCHAR szBuffer[10]; - WCHAR szKey[150] = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Bitbucket\\Volume\\"; - - if (wszPath[1] != L':') - { - /* path is UNC */ - return FALSE; - } - - if (GetDriveTypeW(wszPath) != DRIVE_FIXED) - { - /* no bitbucket on removable media */ - return FALSE; - } - - if (!GetVolumeInformationW(wszPath, NULL, 0, &VolSerialNumber, &MaxComponentLength, &FileSystemFlags, NULL, 0)) - { - ERR("GetVolumeInformationW failed with %u\n", GetLastError()); - return FALSE; - } - - swprintf(szBuffer, L"%04X-%04X", LOWORD(VolSerialNumber), HIWORD(VolSerialNumber)); - wcscat(szKey, szBuffer); - - if (RegCreateKeyExW(HKEY_CURRENT_USER, szKey, 0, NULL, 0, KEY_WRITE, NULL, &hKey, &dwDisposition) != ERROR_SUCCESS) - { - ERR("RegCreateKeyExW failed\n"); - return FALSE; - } - - if (dwDisposition & REG_CREATED_NEW_KEY) - { - /* per default move to bitbucket */ - dwNukeOnDelete = 0; - RegSetValueExW(hKey, L"NukeOnDelete", 0, REG_DWORD, (LPBYTE)&dwNukeOnDelete, sizeof(DWORD)); - /* per default unlimited size */ - dwSize = -1; - RegSetValueExW(hKey, L"MaxCapacity", 0, REG_DWORD, (LPBYTE)&dwSize, sizeof(DWORD)); - RegCloseKey(hKey); - return TRUE; - } - else - { - dwSize = sizeof(dwNukeOnDelete); - ret = RegQueryValueExW(hKey, L"NukeOnDelete", NULL, &dwType, (LPBYTE)&dwNukeOnDelete, &dwSize); - if (ret != ERROR_SUCCESS) - { - if (ret == ERROR_FILE_NOT_FOUND) - { - /* restore key and enable bitbucket */ - dwNukeOnDelete = 0; - RegSetValueExW(hKey, L"NukeOnDelete", 0, REG_DWORD, (LPBYTE)&dwNukeOnDelete, sizeof(DWORD)); - } - RegCloseKey(hKey); - return TRUE; - } - else if (dwNukeOnDelete) - { - /* do not delete to bitbucket */ - RegCloseKey(hKey); - return FALSE; - } - /* FIXME - * check if bitbucket is full - */ - RegCloseKey(hKey); - return TRUE; - } -} - -BOOL -TRASH_TrashFile(LPCWSTR wszPath) -{ - TRACE("(%s)\n", debugstr_w(wszPath)); - return DeleteFileToRecycleBin(wszPath); -} - -/************************************************************************* - * SHUpdateCRecycleBinIcon [SHELL32.@] - * - * Undocumented - */ -EXTERN_C HRESULT WINAPI SHUpdateRecycleBinIcon(void) -{ - FIXME("stub\n"); - - - - return S_OK; -} - -/**************************************************************************** - * IDropTarget implementation - */ -BOOL CRecycleBin::QueryDrop(DWORD dwKeyState, LPDWORD pdwEffect) -{ - /* TODO on shift we should delete, we should update the cursor manager to show this. */ - - DWORD dwEffect = DROPEFFECT_COPY; - - *pdwEffect = DROPEFFECT_NONE; - - if (fAcceptFmt) { /* Does our interpretation of the keystate ... */ - *pdwEffect = KeyStateToDropEffect (dwKeyState); - - if (*pdwEffect == DROPEFFECT_NONE) - *pdwEffect = dwEffect; - - /* ... matches the desired effect ? */ - if (dwEffect & *pdwEffect) { - return TRUE; - } - } - return FALSE; -} - -HRESULT WINAPI CRecycleBin::DragEnter(IDataObject *pDataObject, - DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) -{ - TRACE("Recycle bin drag over (%p)\n", this); - /* The recycle bin accepts pretty much everything, and sets a CSIDL flag. */ - fAcceptFmt = TRUE; - - QueryDrop(dwKeyState, pdwEffect); - return S_OK; -} - -HRESULT WINAPI CRecycleBin::DragOver(DWORD dwKeyState, POINTL pt, - DWORD *pdwEffect) -{ - TRACE("(%p)\n", this); - - if (!pdwEffect) - return E_INVALIDARG; - - QueryDrop(dwKeyState, pdwEffect); - - return S_OK; -} - -HRESULT WINAPI CRecycleBin::DragLeave() -{ - TRACE("(%p)\n", this); - - fAcceptFmt = FALSE; - - return S_OK; -} - -HRESULT WINAPI CRecycleBin::Drop(IDataObject *pDataObject, - DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) -{ - TRACE("(%p) object dropped on recycle bin, effect %u\n", this, *pdwEffect); - - /* TODO: pdwEffect should be read and make the drop object be permanently deleted in the move case (shift held) */ - - FORMATETC fmt; - TRACE("(%p)->(DataObject=%p)\n", this, pDataObject); - InitFormatEtc (fmt, cfShellIDList, TYMED_HGLOBAL); - - /* Handle cfShellIDList Drop objects here, otherwise send the approriate message to other software */ - if (SUCCEEDED(pDataObject->QueryGetData(&fmt))) { - IStream *s; - CoMarshalInterThreadInterfaceInStream(IID_IDataObject, pDataObject, &s); - SHCreateThread(DoDeleteThreadProc, s, NULL, NULL); - } - else - { - /* - * TODO call SetData on the data object with format CFSTR_TARGETCLSID - * set to the Recycle Bin's class identifier CLSID_RecycleBin. - */ - } - return S_OK; -} - -DWORD WINAPI DoDeleteThreadProc(LPVOID lpParameter) -{ - CoInitialize(NULL); - CComPtr<IDataObject> pDataObject; - HRESULT hr = CoGetInterfaceAndReleaseStream (static_cast<IStream*>(lpParameter), IID_PPV_ARG(IDataObject, &pDataObject)); - if (SUCCEEDED(hr)) - { - DoDeleteDataObject(pDataObject); - } - CoUninitialize(); - return 0; -} - -HRESULT WINAPI DoDeleteDataObject(IDataObject *pda) -{ - TRACE("performing delete"); - HRESULT hr; - - STGMEDIUM medium; - FORMATETC formatetc; - InitFormatEtc(formatetc, RegisterClipboardFormatW(CFSTR_SHELLIDLIST), TYMED_HGLOBAL); - hr = pda->GetData(&formatetc, &medium); - if (FAILED(hr)) - return hr; - - /* lock the handle */ - LPIDA lpcida = (LPIDA)GlobalLock(medium.hGlobal); - if (!lpcida) - { - ReleaseStgMedium(&medium); - return E_FAIL; - } - - /* convert the data into pidl */ - LPITEMIDLIST pidl; - LPITEMIDLIST *apidl = _ILCopyCidaToaPidl(&pidl, lpcida); - if (!apidl) - { - ReleaseStgMedium(&medium); - return E_FAIL; - } - - CComPtr<IShellFolder> psfDesktop; - CComPtr<IShellFolder> psfFrom = NULL; - - /* Grab the desktop shell folder */ - hr = SHGetDesktopFolder(&psfDesktop); - if (FAILED(hr)) - { - ERR("SHGetDesktopFolder failed\n"); - SHFree(pidl); - _ILFreeaPidl(apidl, lpcida->cidl); - ReleaseStgMedium(&medium); - return E_FAIL; - } - - /* Find source folder, this is where the clipboard data was copied from */ - if (_ILIsDesktop(pidl)) - { - psfFrom = psfDesktop; - } - else - { - hr = psfDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &psfFrom)); - if (FAILED(hr)) - { - ERR("no IShellFolder\n"); - SHFree(pidl); - _ILFreeaPidl(apidl, lpcida->cidl); - ReleaseStgMedium(&medium); - return E_FAIL; - } - } - - STRRET strTemp; - hr = psfFrom->GetDisplayNameOf(apidl[0], SHGDN_FORPARSING, &strTemp); - if (FAILED(hr)) - { - ERR("IShellFolder_GetDisplayNameOf failed with %x\n", hr); - SHFree(pidl); - _ILFreeaPidl(apidl, lpcida->cidl); - ReleaseStgMedium(&medium); - return hr; - } - - WCHAR wszPath[MAX_PATH]; - hr = StrRetToBufW(&strTemp, apidl[0], wszPath, _countof(wszPath)); - if (FAILED(hr)) - { - ERR("StrRetToBufW failed with %x\n", hr); - SHFree(pidl); - _ILFreeaPidl(apidl, lpcida->cidl); - ReleaseStgMedium(&medium); - return hr; - } - - /* Only keep the base path */ - LPWSTR pwszFilename = PathFindFileNameW(wszPath); - *pwszFilename = L'\0'; - - /* Build paths list */ - LPWSTR pwszPaths = BuildPathsList(wszPath, lpcida->cidl, (LPCITEMIDLIST*) apidl); - if (!pwszPaths) - { - SHFree(pidl); - _ILFreeaPidl(apidl, lpcida->cidl); - ReleaseStgMedium(&medium); - return E_FAIL; - } - - /* Delete them */ - SHFILEOPSTRUCTW FileOp; - ZeroMemory(&FileOp, sizeof(FileOp)); - FileOp.wFunc = FO_DELETE; - FileOp.pFrom = pwszPaths; - FileOp.fFlags = FOF_ALLOWUNDO; - - if (SHFileOperationW(&FileOp) != 0) - { - ERR("SHFileOperation failed with 0x%x for %s\n", GetLastError(), debugstr_w(pwszPaths)); - hr = E_FAIL; - } - - HeapFree(GetProcessHeap(), 0, pwszPaths); - SHFree(pidl); - _ILFreeaPidl(apidl, lpcida->cidl); - ReleaseStgMedium(&medium); - - return hr; -} - -/************************************************************************* - * SHEmptyRecycleBinA (SHELL32.@) - */ -HRESULT WINAPI SHEmptyRecycleBinA(HWND hwnd, LPCSTR pszRootPath, DWORD dwFlags) -{ - LPWSTR szRootPathW = NULL; - int len; - HRESULT hr; - - TRACE("%p, %s, 0x%08x\n", hwnd, debugstr_a(pszRootPath), dwFlags); - - if (pszRootPath) - { - len = MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, NULL, 0); - if (len == 0) - return HRESULT_FROM_WIN32(GetLastError()); - szRootPathW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!szRootPathW) - return E_OUTOFMEMORY; - if (MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, szRootPathW, len) == 0) - { - HeapFree(GetProcessHeap(), 0, szRootPathW); - return HRESULT_FROM_WIN32(GetLastError()); - } - } - - hr = SHEmptyRecycleBinW(hwnd, szRootPathW, dwFlags); - HeapFree(GetProcessHeap(), 0, szRootPathW); - - return hr; -} - -HRESULT WINAPI SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags) -{ - WCHAR szPath[MAX_PATH] = {0}, szBuffer[MAX_PATH]; - DWORD dwSize, dwType, count; - LONG ret; - IShellFolder *pDesktop, *pRecycleBin; - PIDLIST_ABSOLUTE pidlRecycleBin; - PITEMID_CHILD pidl; - HRESULT hr = S_OK; - LPENUMIDLIST penumFiles; - STRRET StrRet; - - TRACE("%p, %s, 0x%08x\n", hwnd, debugstr_w(pszRootPath), dwFlags); - - if (!(dwFlags & SHERB_NOCONFIRMATION)) - { - hr = SHGetDesktopFolder(&pDesktop); - if (FAILED(hr)) - return hr; - hr = SHGetFolderLocation(NULL, CSIDL_BITBUCKET, NULL, 0, &pidlRecycleBin); - if (FAILED(hr)) - { - pDesktop->Release(); - return hr; - } - hr = pDesktop->BindToObject(pidlRecycleBin, NULL, IID_PPV_ARG(IShellFolder, &pRecycleBin)); - CoTaskMemFree(pidlRecycleBin); - pDesktop->Release(); - if (FAILED(hr)) - return hr; - hr = pRecycleBin->EnumObjects(hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penumFiles); - if (FAILED(hr)) - { - pRecycleBin->Release(); - return hr; - } - - count = 0; - if (hr != S_FALSE) - { - while (penumFiles->Next(1, &pidl, NULL) == S_OK) - { - count++; - pRecycleBin->GetDisplayNameOf(pidl, SHGDN_NORMAL, &StrRet); - StrRetToBuf(&StrRet, pidl, szBuffer, _countof(szBuffer)); - CoTaskMemFree(pidl); - } - penumFiles->Release(); - } - pRecycleBin->Release(); - - switch (count) - { - case 0: - /* no files, don't need confirmation */ - break; - - case 1: - /* we have only one item inside the bin, so show a message box with its name */ - if (ShellMessageBoxW(shell32_hInstance, hwnd, MAKEINTRESOURCEW(IDS_DELETEITEM_TEXT), MAKEINTRESOURCEW(IDS_EMPTY_BITBUCKET), - MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, szBuffer) == IDNO) - { - return S_OK; - } - break; - - default: - /* we have more than one item, so show a message box with the count of the items */ - StringCbPrintfW(szBuffer, sizeof(szBuffer), L"%u", count); - if (ShellMessageBoxW(shell32_hInstance, hwnd, MAKEINTRESOURCEW(IDS_DELETEMULTIPLE_TEXT), MAKEINTRESOURCEW(IDS_EMPTY_BITBUCKET), - MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, szBuffer) == IDNO) - { - return S_OK; - } - break; - } - } - - if (dwFlags & SHERB_NOPROGRESSUI) - { - ret = EmptyRecycleBinW(pszRootPath); - } - else - { - /* FIXME - * show a progress dialog - */ - ret = EmptyRecycleBinW(pszRootPath); - } - - if (!ret) - return HRESULT_FROM_WIN32(GetLastError()); - - if (!(dwFlags & SHERB_NOSOUND)) - { - dwSize = sizeof(szPath); - ret = RegGetValueW(HKEY_CURRENT_USER, - L"AppEvents\\Schemes\\Apps\\Explorer\\EmptyRecycleBin\\.Current", - NULL, - RRF_RT_REG_SZ, - &dwType, - (PVOID)szPath, - &dwSize); - if (ret != ERROR_SUCCESS) - return S_OK; - - if (dwType != REG_EXPAND_SZ) /* type dismatch */ - return S_OK; - - szPath[(sizeof(szPath)/sizeof(WCHAR))-1] = L'\0'; - PlaySoundW(szPath, NULL, SND_FILENAME); - } - return S_OK; -} - -HRESULT WINAPI SHQueryRecycleBinA(LPCSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo) -{ - LPWSTR szRootPathW = NULL; - int len; - HRESULT hr; - - TRACE("%s, %p\n", debugstr_a(pszRootPath), pSHQueryRBInfo); - - if (pszRootPath) - { - len = MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, NULL, 0); - if (len == 0) - return HRESULT_FROM_WIN32(GetLastError()); - szRootPathW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!szRootPathW) - return E_OUTOFMEMORY; - if (MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, szRootPathW, len) == 0) - { - HeapFree(GetProcessHeap(), 0, szRootPathW); - return HRESULT_FROM_WIN32(GetLastError()); - } - } - - hr = SHQueryRecycleBinW(szRootPathW, pSHQueryRBInfo); - HeapFree(GetProcessHeap(), 0, szRootPathW); - - return hr; -} - -HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo) -{ - FIXME("%s, %p - stub\n", debugstr_w(pszRootPath), pSHQueryRBInfo); - - if (!(pszRootPath) || (pszRootPath[0] == 0) || - !(pSHQueryRBInfo) || (pSHQueryRBInfo->cbSize < sizeof(SHQUERYRBINFO))) - { - return E_INVALIDARG; - } - - pSHQueryRBInfo->i64Size = 0; - pSHQueryRBInfo->i64NumItems = 0; - - return S_OK; -} Modified: trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp [iso-8859-1] Wed Aug 19 18:10:30 2015 @@ -110,13 +110,6 @@ HANDLE hDeletedFile; BOOL bFound; } SEARCH_CONTEXT, *PSEARCH_CONTEXT; - -typedef struct -{ - DWORD dwNukeOnDelete; - DWORD dwSerial; - DWORD dwMaxCapacity; -} DRIVE_ITEM_CONTEXT, *PDRIVE_ITEM_CONTEXT; BOOL WINAPI CBSearchRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile) { @@ -869,388 +862,6 @@ return S_OK; } -void toggleNukeOnDeleteOption(HWND hwndDlg, BOOL bEnable) -{ - if (bEnable) - { - SendDlgItemMessage(hwndDlg, 14001, BM_SETCHECK, BST_UNCHECKED, 0); - EnableWindow(GetDlgItem(hwndDlg, 14002), FALSE); - SendDlgItemMessage(hwndDlg, 14003, BM_SETCHECK, BST_CHECKED, 0); - } - else - { - SendDlgItemMessage(hwndDlg, 14001, BM_SETCHECK, BST_CHECKED, 0); - EnableWindow(GetDlgItem(hwndDlg, 14002), TRUE); - SendDlgItemMessage(hwndDlg, 14003, BM_SETCHECK, BST_UNCHECKED, 0); - } -} - - -static VOID -InitializeRecycleBinDlg(HWND hwndDlg, WCHAR DefaultDrive) -{ - WCHAR CurDrive = L'A'; - WCHAR szDrive[] = L"A:\\"; - DWORD dwDrives; - WCHAR szName[100]; - WCHAR szVolume[100]; - DWORD MaxComponent, Flags; - DWORD dwSerial; - LVCOLUMNW lc; - HWND hDlgCtrl; - LVITEMW li; - INT itemCount; - ULARGE_INTEGER TotalNumberOfFreeBytes, TotalNumberOfBytes, FreeBytesAvailable; - RECT rect; - int columnSize; - int defIndex = 0; - DWORD dwSize; - PDRIVE_ITEM_CONTEXT pItem = NULL, pDefault = NULL, pFirst = NULL; - - hDlgCtrl = GetDlgItem(hwndDlg, 14000); - - if (!LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_LOCATION, szVolume, sizeof(szVolume) / sizeof(WCHAR))) - szVolume[0] = 0; - - GetClientRect(hDlgCtrl, &rect); - - memset(&lc, 0, sizeof(LV_COLUMN) ); - lc.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT; - - columnSize = 140; //FIXME - lc.iSubItem = 0; - lc.fmt = LVCFMT_FIXED_WIDTH; - lc.cx = columnSize; - lc.cchTextMax = wcslen(szVolume); - lc.pszText = szVolume; - (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, 0, (LPARAM)&lc); - - if (!LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_DISKSPACE, szVolume, sizeof(szVolume) / sizeof(WCHAR))) - szVolume[0] = 0; - - lc.iSubItem = 1; - lc.cx = rect.right - rect.left - columnSize; - lc.cchTextMax = wcslen(szVolume); - lc.pszText = szVolume; - (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, 1, (LPARAM)&lc); - - dwDrives = GetLogicalDrives(); - itemCount = 0; - do - { - if ((dwDrives & 0x1)) - { - UINT Type = GetDriveTypeW(szDrive); - if (Type == DRIVE_FIXED) //FIXME - { - if (!GetVolumeInformationW(szDrive, szName, sizeof(szName) / sizeof(WCHAR), &dwSerial, &MaxComponent, &Flags, NULL, 0)) - { - szName[0] = 0; - dwSerial = -1; - } - - swprintf(szVolume, L"%s (%c:)", szName, szDrive[0]); - memset(&li, 0x0, sizeof(LVITEMW)); - li.mask = LVIF_TEXT | LVIF_PARAM; - li.iSubItem = 0; - li.pszText = szVolume; - li.iItem = itemCount; - SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li); - if (GetDiskFreeSpaceExW(szDrive, &FreeBytesAvailable , &TotalNumberOfBytes, &TotalNumberOfFreeBytes)) - { - if (StrFormatByteSizeW(TotalNumberOfFreeBytes.QuadPart, szVolume, sizeof(szVolume) / sizeof(WCHAR))) - { - - pItem = (DRIVE_ITEM_CONTEXT *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DRIVE_ITEM_CONTEXT)); - if (pItem) - { - swprintf(szName, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Bitbucket\\Volume\\%04X-%04X", LOWORD(dwSerial), HIWORD(dwSerial)); - dwSize = sizeof(DWORD); - RegGetValueW(HKEY_CURRENT_USER, szName, L"MaxCapacity", RRF_RT_DWORD, NULL, &pItem->dwMaxCapacity, &dwSize); - dwSize = sizeof(DWORD); - RegGetValueW(HKEY_CURRENT_USER, szName, L"NukeOnDelete", RRF_RT_DWORD, NULL, &pItem->dwNukeOnDelete, &dwSize); - pItem->dwSerial = dwSerial; - li.mask = LVIF_PARAM; - li.lParam = (LPARAM)pItem; - (void)SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li); - if (CurDrive == DefaultDrive) - { - defIndex = itemCount; - pDefault = pItem; - } - } - if (!pFirst) - pFirst = pItem; - - li.mask = LVIF_TEXT; - li.iSubItem = 1; - li.pszText = szVolume; - li.iItem = itemCount; - (void)SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li); - } - } - itemCount++; - } - } - CurDrive++; - szDrive[0] = CurDrive; - dwDrives = (dwDrives >> 1); - } while(dwDrives); - - if (!pDefault) - pDefault = pFirst; - if (pDefault) - { - toggleNukeOnDeleteOption(hwndDlg, pDefault->dwNukeOnDelete); - SetDlgItemInt(hwndDlg, 14002, pDefault->dwMaxCapacity, FALSE); - } - ZeroMemory(&li, sizeof(li)); - li.mask = LVIF_STATE; - li.stateMask = (UINT) - 1; - li.state = LVIS_FOCUSED | LVIS_SELECTED; - li.iItem = defIndex; - (void)SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li); - -} - -static BOOL StoreDriveSettings(HWND hwndDlg) -{ - int iCount, iIndex; - HWND hDlgCtrl = GetDlgItem(hwndDlg, 14000); - LVITEMW li; - PDRIVE_ITEM_CONTEXT pItem; - HKEY hKey, hSubKey; - WCHAR szSerial[20]; - DWORD dwSize; - - - if (RegCreateKeyExW(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Bitbucket\\Volume", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS) - return FALSE; - - iCount = ListView_GetItemCount(hDlgCtrl); - - ZeroMemory(&li, sizeof(li)); - li.mask = LVIF_PARAM; - - for(iIndex = 0; iIndex < iCount; iIndex++) - { - li.iItem = iIndex; - if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li)) - { - pItem = (PDRIVE_ITEM_CONTEXT)li.lParam; - swprintf(szSerial, L"%04X-%04X", LOWORD(pItem->dwSerial), HIWORD(pItem->dwSerial)); - if (RegCreateKeyExW(hKey, szSerial, 0, NULL, 0, KEY_WRITE, NULL, &hSubKey, NULL) == ERROR_SUCCESS) - { - dwSize = sizeof(DWORD); - RegSetValueExW(hSubKey, L"NukeOnDelete", 0, REG_DWORD, (LPBYTE)&pItem->dwNukeOnDelete, dwSize); - dwSize = sizeof(DWORD); - RegSetValueExW(hSubKey, L"MaxCapacity", 0, REG_DWORD, (LPBYTE)&pItem->dwMaxCapacity, dwSize); - RegCloseKey(hSubKey); - } - } - } - RegCloseKey(hKey); - return TRUE; - -} - -static VOID FreeDriveItemContext(HWND hwndDlg) -{ - int iCount, iIndex; - HWND hDlgCtrl = GetDlgItem(hwndDlg, 14000); - LVITEMW li; - - iCount = ListView_GetItemCount(hDlgCtrl); - - ZeroMemory(&li, sizeof(li)); - li.mask = LVIF_PARAM; - - for(iIndex = 0; iIndex < iCount; iIndex++) - { - li.iItem = iIndex; - if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li)) - { - HeapFree(GetProcessHeap(), 0, (LPVOID)li.lParam); - } - } -} - -static INT -GetDefaultItem(HWND hwndDlg, LVITEMW * li) -{ - HWND hDlgCtrl; - UINT iItemCount, iIndex; - - hDlgCtrl = GetDlgItem(hwndDlg, 14000); - if (!hDlgCtrl) - return -1; - - iItemCount = ListView_GetItemCount(hDlgCtrl); - if (!iItemCount) - return -1; - - ZeroMemory(li, sizeof(LVITEMW)); - li->mask = LVIF_PARAM | LVIF_STATE; - li->stateMask = (UINT) - 1; - for (iIndex = 0; iIndex < iItemCount; iIndex++) - { - li->iItem = iIndex; - if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)li)) - { - if (li->state & LVIS_SELECTED) - return iIndex; - } - } - return -1; - -} - -static INT_PTR CALLBACK -RecycleBinDlg( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam -) -{ - LPPSHNOTIFY lppsn; - LPNMLISTVIEW lppl; - LVITEMW li; - PDRIVE_ITEM_CONTEXT pItem; - BOOL bSuccess; - UINT uResult; - PROPSHEETPAGE * page; - DWORD dwStyle; - - switch(uMsg) - { - case WM_INITDIALOG: - page = (PROPSHEETPAGE*)lParam; - InitializeRecycleBinDlg(hwndDlg, (WCHAR)page->lParam); - dwStyle = (DWORD) SendDlgItemMessage(hwndDlg, 14000, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); - dwStyle = dwStyle | LVS_EX_FULLROWSELECT; - SendDlgItemMessage(hwndDlg, 14000, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle); - if (GetDlgCtrlID((HWND)wParam) != 14000) - { - SetFocus(GetDlgItem(hwndDlg, 14000)); - return FALSE; - } - return TRUE; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case 14001: - toggleNukeOnDeleteOption(hwndDlg, FALSE); - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - case 14003: - toggleNukeOnDeleteOption(hwndDlg, TRUE); - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - case 14004: - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); - break; - } - break; - case WM_NOTIFY: - lppsn = (LPPSHNOTIFY) lParam; - lppl = (LPNMLISTVIEW) lParam; - if (lppsn->hdr.code == PSN_APPLY) - { - if (GetDefaultItem(hwndDlg, &li) > -1) - { - pItem = (PDRIVE_ITEM_CONTEXT)li.lParam; - if (pItem) - { - uResult = GetDlgItemInt(hwndDlg, 14002, &bSuccess, FALSE); - if (bSuccess) - pItem->dwMaxCapacity = uResult; - if (SendDlgItemMessageW(hwndDlg, 14003, BM_GETCHECK, 0, 0) == BST_CHECKED) - pItem->dwNukeOnDelete = TRUE; - else - pItem->dwNukeOnDelete = FALSE; - } - } - if (StoreDriveSettings(hwndDlg)) - { - SetWindowLongPtr( hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR ); - return TRUE; - } - } - else if (lppl->hdr.code == LVN_ITEMCHANGING) - { - ZeroMemory(&li, sizeof(li)); - li.mask = LVIF_PARAM; - li.iItem = lppl->iItem; - if (!SendMessageW(lppl->hdr.hwndFrom, LVM_GETITEMW, 0, (LPARAM)&li)) - return TRUE; - - pItem = (PDRIVE_ITEM_CONTEXT)li.lParam; - if (!pItem) - return TRUE; - - if (!(lppl->uOldState & LVIS_FOCUSED) && (lppl->uNewState & LVIS_FOCUSED)) - { - /* new focused item */ - toggleNukeOnDeleteOption(lppl->hdr.hwndFrom, pItem->dwNukeOnDelete); - SetDlgItemInt(hwndDlg, 14002, pItem->dwMaxCapacity, FALSE); - } - else if ((lppl->uOldState & LVIS_FOCUSED) && !(lppl->uNewState & LVIS_FOCUSED)) - { - /* kill focus */ - uResult = GetDlgItemInt(hwndDlg, 14002, &bSuccess, FALSE); - if (bSuccess) - pItem->dwMaxCapacity = uResult; - if (SendDlgItemMessageW(hwndDlg, 14003, BM_GETCHECK, 0, 0) == BST_CHECKED) - pItem->dwNukeOnDelete = TRUE; - else - pItem->dwNukeOnDelete = FALSE; - } - return TRUE; - - } - break; - case WM_DESTROY: - FreeDriveItemContext(hwndDlg); - break; - } - return FALSE; -} - -BOOL SH_ShowRecycleBinProperties(WCHAR sDrive) -{ - HPROPSHEETPAGE hpsp[1]; - PROPSHEETHEADERW psh; - HPROPSHEETPAGE hprop; - - BOOL ret; - - - ZeroMemory(&psh, sizeof(PROPSHEETHEADERW)); - psh.dwSize = sizeof(PROPSHEETHEADERW); - psh.dwFlags = PSP_DEFAULT | PSH_PROPTITLE; - psh.pszCaption = MAKEINTRESOURCEW(IDS_RECYCLEBIN_FOLDER_NAME); - psh.hwndParent = NULL; - psh.phpage = hpsp; - psh.hInstance = shell32_hInstance; - - hprop = SH_CreatePropertySheetPage(IDD_RECYCLE_BIN_PROPERTIES, RecycleBinDlg, (LPARAM)sDrive, NULL); - if (!hprop) - { - ERR("Failed to create property sheet\n"); - return FALSE; - } - hpsp[psh.nPages] = hprop; - psh.nPages++; - - - ret = PropertySheetW(&psh); - if (ret < 0) - return FALSE; - else - return TRUE; -} - BOOL TRASH_CanTrashFile(LPCWSTR wszPath) {
9 years, 4 months
1
0
0
0
[ekohl] 68774: [ADVAPI32] Add some well-known SDDL SID strings. This patch has aleady been sent upstream.
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Aug 19 18:04:40 2015 New Revision: 68774 URL:
http://svn.reactos.org/svn/reactos?rev=68774&view=rev
Log: [ADVAPI32] Add some well-known SDDL SID strings. This patch has aleady been sent upstream. Modified: trunk/reactos/dll/win32/advapi32/wine/security.c Modified: trunk/reactos/dll/win32/advapi32/wine/security.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/wine/se…
============================================================================== --- trunk/reactos/dll/win32/advapi32/wine/security.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/wine/security.c [iso-8859-1] Wed Aug 19 18:04:40 2015 @@ -108,16 +108,16 @@ { {'L','A'}, WinAccountAdministratorSid, DOMAIN_USER_RID_ADMIN }, { {'L','G'}, WinAccountGuestSid, DOMAIN_USER_RID_GUEST }, { {0,0}, WinAccountKrbtgtSid, DOMAIN_USER_RID_KRBTGT }, - { {0,0}, WinAccountDomainAdminsSid, DOMAIN_GROUP_RID_ADMINS }, - { {0,0}, WinAccountDomainUsersSid, DOMAIN_GROUP_RID_USERS }, - { {0,0}, WinAccountDomainGuestsSid, DOMAIN_GROUP_RID_GUESTS }, - { {0,0}, WinAccountComputersSid, DOMAIN_GROUP_RID_COMPUTERS }, - { {0,0}, WinAccountControllersSid, DOMAIN_GROUP_RID_CONTROLLERS }, - { {0,0}, WinAccountCertAdminsSid, DOMAIN_GROUP_RID_CERT_ADMINS }, - { {0,0}, WinAccountSchemaAdminsSid, DOMAIN_GROUP_RID_SCHEMA_ADMINS }, - { {0,0}, WinAccountEnterpriseAdminsSid, DOMAIN_GROUP_RID_ENTERPRISE_ADMINS }, - { {0,0}, WinAccountPolicyAdminsSid, DOMAIN_GROUP_RID_POLICY_ADMINS }, - { {0,0}, WinAccountRasAndIasServersSid, DOMAIN_ALIAS_RID_RAS_SERVERS }, + { {'D','A'}, WinAccountDomainAdminsSid, DOMAIN_GROUP_RID_ADMINS }, + { {'D','U'}, WinAccountDomainUsersSid, DOMAIN_GROUP_RID_USERS }, + { {'D','G'}, WinAccountDomainGuestsSid, DOMAIN_GROUP_RID_GUESTS }, + { {'D','C'}, WinAccountComputersSid, DOMAIN_GROUP_RID_COMPUTERS }, + { {'D','D'}, WinAccountControllersSid, DOMAIN_GROUP_RID_CONTROLLERS }, + { {'C','A'}, WinAccountCertAdminsSid, DOMAIN_GROUP_RID_CERT_ADMINS }, + { {'S','A'}, WinAccountSchemaAdminsSid, DOMAIN_GROUP_RID_SCHEMA_ADMINS }, + { {'E','A'}, WinAccountEnterpriseAdminsSid, DOMAIN_GROUP_RID_ENTERPRISE_ADMINS }, + { {'P','A'}, WinAccountPolicyAdminsSid, DOMAIN_GROUP_RID_POLICY_ADMINS }, + { {'R','S'}, WinAccountRasAndIasServersSid, DOMAIN_ALIAS_RID_RAS_SERVERS }, }; static const SID sidWorld = { SID_REVISION, 1, { SECURITY_WORLD_SID_AUTHORITY} , { SECURITY_WORLD_RID } };
9 years, 4 months
1
0
0
0
[gadamopoulos] 68773: [SHELL32] - Move a couple of headers in the dialogs directory.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Wed Aug 19 16:26:16 2015 New Revision: 68773 URL:
http://svn.reactos.org/svn/reactos?rev=68773&view=rev
Log: [SHELL32] - Move a couple of headers in the dialogs directory. Added: trunk/reactos/dll/win32/shell32/dialogs/drvdefext.h - copied unchanged from r68772, trunk/reactos/dll/win32/shell32/drvdefext.h trunk/reactos/dll/win32/shell32/dialogs/filedefext.h - copied unchanged from r68772, trunk/reactos/dll/win32/shell32/filedefext.h Removed: trunk/reactos/dll/win32/shell32/drvdefext.h trunk/reactos/dll/win32/shell32/filedefext.h Modified: trunk/reactos/dll/win32/shell32/precomp.h Removed: trunk/reactos/dll/win32/shell32/drvdefext.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/drvdefex…
============================================================================== --- trunk/reactos/dll/win32/shell32/drvdefext.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/drvdefext.h (removed) @@ -1,75 +0,0 @@ -/* - * Provides default drive shell extension - * - * Copyright 2012 Rafal Harabien - * - * 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 _DRV_DEF_EXT_H_ -#define _DRV_DEF_EXT_H_ - -class CDrvDefExt : - public CComCoClass<CDrvDefExt, &CLSID_ShellDrvDefExt>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IShellExtInit, - public IContextMenu, - public IShellPropSheetExt, - public IObjectWithSite -{ -private: - VOID PaintStaticControls(HWND hwndDlg, LPDRAWITEMSTRUCT pDrawItem); - VOID InitGeneralPage(HWND hwndDlg); - static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - static INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - static INT_PTR CALLBACK HardwarePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - - WCHAR m_wszDrive[MAX_PATH]; - UINT m_FreeSpacePerc; - -public: - CDrvDefExt(); - ~CDrvDefExt(); - - // IShellExtInit - virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pDataObj, HKEY hkeyProgID); - - // IContextMenu - virtual HRESULT WINAPI QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); - virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpici); - virtual HRESULT WINAPI GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax); - - // IShellPropSheetExt - virtual HRESULT WINAPI AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam); - virtual HRESULT WINAPI ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam); - - // IObjectWithSite - virtual HRESULT WINAPI SetSite(IUnknown *punk); - virtual HRESULT WINAPI GetSite(REFIID iid, void **ppvSite); - -DECLARE_REGISTRY_RESOURCEID(IDR_DRVDEFEXT) -DECLARE_NOT_AGGREGATABLE(CDrvDefExt) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CDrvDefExt) - COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) - COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt) - COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) -END_COM_MAP() -}; - -#endif /* _DRV_DEF_EXT_H_ */ Removed: trunk/reactos/dll/win32/shell32/filedefext.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/filedefe…
============================================================================== --- trunk/reactos/dll/win32/shell32/filedefext.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/filedefext.h (removed) @@ -1,128 +0,0 @@ -/* - * Provides default file shell extension - * - * Copyright 2012 Rafal Harabien - * - * 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 _FILE_DEF_EXT_H_ -#define _FILE_DEF_EXT_H_ - -class CFileVersionInfo -{ - private: - PVOID m_pInfo; - WORD m_wLang, m_wCode; - WCHAR m_wszLang[64]; - - typedef struct _LANGANDCODEPAGE_ - { - WORD wLang; - WORD wCode; - } LANGANDCODEPAGE, *LPLANGANDCODEPAGE; - - public: - inline CFileVersionInfo(): - m_pInfo(NULL), m_wLang(0), m_wCode(0) - { - m_wszLang[0] = L'\0'; - } - - inline ~CFileVersionInfo() - { - if (m_pInfo) - HeapFree(GetProcessHeap(), 0, m_pInfo); - } - - BOOL Load(LPCWSTR pwszPath); - LPCWSTR GetString(LPCWSTR pwszName); - VS_FIXEDFILEINFO *GetFixedInfo(); - LPCWSTR GetLangName(); -}; - -class CFileDefExt : - public CComCoClass<CFileDefExt, &CLSID_ShellFileDefExt>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IShellExtInit, - public IContextMenu, - public IShellPropSheetExt, - public IObjectWithSite -{ -private: - VOID InitOpensWithField(HWND hwndDlg); - BOOL InitFileType(HWND hwndDlg); - BOOL InitFilePath(HWND hwndDlg); - static BOOL GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult); - BOOL InitFileAttr(HWND hwndDlg); - BOOL InitGeneralPage(HWND hwndDlg); - BOOL SetVersionLabel(HWND hwndDlg, DWORD idCtrl, LPCWSTR pwszName); - BOOL AddVersionString(HWND hwndDlg, LPCWSTR pwszName); - BOOL InitVersionPage(HWND hwndDlg); - static INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - static INT_PTR CALLBACK VersionPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - BOOL CountFolderAndFiles(HWND hwndDlg, LPWSTR pwszBuf, UINT cchBufMax, LPDWORD ticks); - - WCHAR m_wszPath[MAX_PATH]; - CFileVersionInfo m_VerInfo; - BOOL m_bDir; - - DWORD m_cFiles; - DWORD m_cFolders; - ULARGE_INTEGER m_DirSize; - - static DWORD WINAPI _CountFolderAndFilesThreadProc(LPVOID lpParameter); - -public: - CFileDefExt(); - ~CFileDefExt(); - - // IShellExtInit - virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID); - - // IContextMenu - virtual HRESULT WINAPI QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); - virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpici); - virtual HRESULT WINAPI GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax); - - // IShellPropSheetExt - virtual HRESULT WINAPI AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam); - virtual HRESULT WINAPI ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam); - - // IObjectWithSite - virtual HRESULT WINAPI SetSite(IUnknown *punk); - virtual HRESULT WINAPI GetSite(REFIID iid, void **ppvSite); - -DECLARE_REGISTRY_RESOURCEID(IDR_FILEDEFEXT) -DECLARE_NOT_AGGREGATABLE(CFileDefExt) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CFileDefExt) - COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) - COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt) - COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) -END_COM_MAP() -}; - -struct _CountFolderAndFilesData { - CFileDefExt *This; - HWND hwndDlg; - LPWSTR pwszBuf; - UINT cchBufMax; -}; - -#endif /* _FILE_DEF_EXT_H_ */ Modified: trunk/reactos/dll/win32/shell32/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/precomp.…
============================================================================== --- trunk/reactos/dll/win32/shell32/precomp.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/precomp.h [iso-8859-1] Wed Aug 19 16:26:16 2015 @@ -62,8 +62,8 @@ #include "droptargets/CexeDropHandler.h" #include "COpenWithMenu.h" #include "CNewMenu.h" -#include "filedefext.h" -#include "drvdefext.h" +#include "dialogs/filedefext.h" +#include "dialogs/drvdefext.h" #include "CQueryAssociations.h" #include "shellmenu/CBandSite.h" #include "shellmenu/CMenuBand.h"
9 years, 4 months
1
0
0
0
[tfaber] 68772: [SHELL32][RSHELL] - Fix some extern "C"
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Aug 19 15:43:13 2015 New Revision: 68772 URL:
http://svn.reactos.org/svn/reactos?rev=68772&view=rev
Log: [SHELL32][RSHELL] - Fix some extern "C" Modified: trunk/reactos/base/shell/rshell/misc.cpp trunk/reactos/dll/win32/shell32/shelldesktop/shelldesktop.h trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h Modified: trunk/reactos/base/shell/rshell/misc.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/misc.cpp…
============================================================================== --- trunk/reactos/base/shell/rshell/misc.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/rshell/misc.cpp [iso-8859-1] Wed Aug 19 15:43:13 2015 @@ -20,7 +20,6 @@ #include "shellmenu.h" -extern "C" HINSTANCE shell32_hInstance = NULL; DWORD WINAPI WinList_Init(void) Modified: trunk/reactos/dll/win32/shell32/shelldesktop/shelldesktop.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shelldes…
============================================================================== --- trunk/reactos/dll/win32/shell32/shelldesktop/shelldesktop.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shelldesktop/shelldesktop.h [iso-8859-1] Wed Aug 19 15:43:13 2015 @@ -33,4 +33,7 @@ #include <wine/debug.h> -extern "C" HINSTANCE shell32_hInstance; +extern "C" +{ +extern HINSTANCE shell32_hInstance; +} Modified: trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h [iso-8859-1] Wed Aug 19 15:43:13 2015 @@ -69,9 +69,15 @@ #pragma warning(pop) #endif -extern "C" HRESULT WINAPI CStartMenu_Constructor(REFIID riid, void **ppv); -extern "C" HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv); -extern "C" HRESULT WINAPI CMenuSite_Constructor(REFIID riid, LPVOID *ppv); -extern "C" HRESULT WINAPI CMenuBand_Constructor(REFIID riid, LPVOID *ppv); -extern "C" HRESULT WINAPI CBandSite_Constructor(REFIID riid, LPVOID *ppv); -extern "C" HRESULT WINAPI CMergedFolder_Constructor(REFIID riid, LPVOID *ppv); +extern "C" +{ +extern HINSTANCE shell32_hInstance; + +HRESULT WINAPI CStartMenu_Constructor(REFIID riid, void **ppv); +HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv); +HRESULT WINAPI CMenuSite_Constructor(REFIID riid, LPVOID *ppv); +HRESULT WINAPI CMenuBand_Constructor(REFIID riid, LPVOID *ppv); +HRESULT WINAPI CBandSite_Constructor(REFIID riid, LPVOID *ppv); +HRESULT WINAPI CMergedFolder_Constructor(REFIID riid, LPVOID *ppv); + +}
9 years, 4 months
1
0
0
0
[gadamopoulos] 68771: [SHDOCVW] -Rename some unused stubs to resolve conflicts with shell32
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Wed Aug 19 14:04:53 2015 New Revision: 68771 URL:
http://svn.reactos.org/svn/reactos?rev=68771&view=rev
Log: [SHDOCVW] -Rename some unused stubs to resolve conflicts with shell32 Modified: trunk/reactos/dll/win32/shdocvw/shdocvw.spec Modified: trunk/reactos/dll/win32/shdocvw/shdocvw.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shdocvw/shdocvw.…
============================================================================== --- trunk/reactos/dll/win32/shdocvw/shdocvw.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shdocvw/shdocvw.spec [iso-8859-1] Wed Aug 19 14:04:53 2015 @@ -16,8 +16,8 @@ 116 stub -noname DDECreatePostNotify 117 stub -noname DDEHandleViewFolderNotify 118 stdcall -noname ShellDDEInit(long) -119 stub -noname SHCreateDesktop -120 stub -noname SHDesktopMessageLoop +119 stub -noname SHCreateDesktopDEPRECATED +120 stub -noname SHDesktopMessageLoopDEPRECATED 121 stdcall -noname StopWatchModeFORWARD() 122 stdcall -noname StopWatchFlushFORWARD() 123 stdcall -noname StopWatchWFORWARD(long str long long long)
9 years, 4 months
1
0
0
0
[gadamopoulos] 68770: Add two files that I missed
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Wed Aug 19 13:55:15 2015 New Revision: 68770 URL:
http://svn.reactos.org/svn/reactos?rev=68770&view=rev
Log: Add two files that I missed Added: trunk/reactos/dll/win32/shell32/shelldesktop/CMakeLists.txt (with props) trunk/reactos/dll/win32/shell32/shelldesktop/shelldesktop.h (with props) Added: trunk/reactos/dll/win32/shell32/shelldesktop/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shelldes…
============================================================================== --- trunk/reactos/dll/win32/shell32/shelldesktop/CMakeLists.txt (added) +++ trunk/reactos/dll/win32/shell32/shelldesktop/CMakeLists.txt [iso-8859-1] Wed Aug 19 13:55:15 2015 @@ -0,0 +1,13 @@ +PROJECT(SHELL) + +set_cpp(WITH_RUNTIME) + +add_definitions(-DUNICODE -D_UNICODE) + +include_directories(${REACTOS_SOURCE_DIR}/lib/atl) + +list(APPEND SOURCE + CDesktopBrowser.cpp + dde.cpp) + +add_library(shelldesktop ${SOURCE}) Propchange: trunk/reactos/dll/win32/shell32/shelldesktop/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/win32/shell32/shelldesktop/shelldesktop.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shelldes…
============================================================================== --- trunk/reactos/dll/win32/shell32/shelldesktop/shelldesktop.h (added) +++ trunk/reactos/dll/win32/shell32/shelldesktop/shelldesktop.h [iso-8859-1] Wed Aug 19 13:55:15 2015 @@ -0,0 +1,36 @@ + +#include <stdio.h> +#include <tchar.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include <windef.h> +#include <winbase.h> +#include <winreg.h> +#include <wingdi.h> +#include <winnls.h> +#include <wincon.h> +#include <shellapi.h> +#include <shlobj.h> +#include <shlobj_undoc.h> +#include <shlwapi.h> +#include <shlguid_undoc.h> +#include <strsafe.h> +#include <browseui_undoc.h> + +#include <atlbase.h> +#include <atlcom.h> +#include <atlwin.h> +#include <undocshell.h> +#include <undocuser.h> + +#include <shellutils.h> +#include "../shresdef.h" + +#include <wine/debug.h> + +extern "C" HINSTANCE shell32_hInstance; Propchange: trunk/reactos/dll/win32/shell32/shelldesktop/shelldesktop.h ------------------------------------------------------------------------------ svn:eol-style = native
9 years, 4 months
1
0
0
0
[gadamopoulos] 68769: [SHELLDESKTOP] - Create a new sublibrary for shell32 that will contain the implementation of CDesktopBrowser and desktop dde support. Link it to both shell32 and rshell. Also ...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Wed Aug 19 13:51:20 2015 New Revision: 68769 URL:
http://svn.reactos.org/svn/reactos?rev=68769&view=rev
Log: [SHELLDESKTOP] - Create a new sublibrary for shell32 that will contain the implementation of CDesktopBrowser and desktop dde support. Link it to both shell32 and rshell. Also add a win8+ hack. Added: trunk/reactos/dll/win32/shell32/shelldesktop/ (with props) trunk/reactos/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp - copied, changed from r68767, trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp trunk/reactos/dll/win32/shell32/shelldesktop/dde.cpp - copied, changed from r68767, trunk/reactos/dll/win32/shell32/dde.cpp Removed: trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp trunk/reactos/dll/win32/shell32/dde.cpp trunk/reactos/dll/win32/shell32/shellmenu/CDesktopBrowser.cpp trunk/reactos/dll/win32/shell32/shellmenu/ShellDDE.cpp Modified: trunk/reactos/base/shell/rshell/CMakeLists.txt trunk/reactos/base/shell/rshell/misc.cpp trunk/reactos/base/shell/rshell/rshell.spec trunk/reactos/dll/win32/shell32/CMakeLists.txt trunk/reactos/dll/win32/shell32/shellmenu/CMakeLists.txt trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h Modified: trunk/reactos/base/shell/rshell/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMakeLis…
============================================================================== --- trunk/reactos/base/shell/rshell/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/base/shell/rshell/CMakeLists.txt [iso-8859-1] Wed Aug 19 13:51:20 2015 @@ -18,11 +18,13 @@ target_link_libraries(rshell shellmenu + shelldesktop atlnew uuid wine) add_importlibs(rshell + browseui uxtheme shlwapi advapi32 Modified: trunk/reactos/base/shell/rshell/misc.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/misc.cpp…
============================================================================== --- trunk/reactos/base/shell/rshell/misc.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/rshell/misc.cpp [iso-8859-1] Wed Aug 19 13:51:20 2015 @@ -20,6 +20,7 @@ #include "shellmenu.h" +extern "C" HINSTANCE shell32_hInstance = NULL; DWORD WINAPI WinList_Init(void) Modified: trunk/reactos/base/shell/rshell/rshell.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/rshell.s…
============================================================================== --- trunk/reactos/base/shell/rshell/rshell.spec [iso-8859-1] (original) +++ trunk/reactos/base/shell/rshell/rshell.spec [iso-8859-1] Wed Aug 19 13:51:20 2015 @@ -7,4 +7,6 @@ @ stdcall CMenuSite_Constructor(ptr ptr); @ stdcall CMenuBand_Constructor(ptr ptr); @ stdcall CMergedFolder_Constructor(ptr ptr); -@ stdcall ShellDDEInit(long); +@ stdcall ShellDDEInit(long); +@ stdcall SHCreateDesktop(ptr); +@ stdcall SHDesktopMessageLoop(ptr); Removed: trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CDesktop…
============================================================================== --- trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp (removed) @@ -1,620 +0,0 @@ -/* - * Shell Desktop - * - * Copyright 2008 Thomas Bluemel - * - * 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 "precomp.h" - -WINE_DEFAULT_DEBUG_CHANNEL(desktop); - -#define SHDESK_TAG 'KSED' - -static const WCHAR szProgmanClassName [] = L"Progman"; -static const WCHAR szProgmanWindowName [] = L"Program Manager"; - -class CDesktopBrowser : - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IShellBrowser, - public ICommDlgBrowser, - public IServiceProvider -{ -public: - DWORD Tag; - HACCEL m_hAccel; -private: - HWND hWnd; - HWND hWndShellView; - HWND hWndDesktopListView; - CComPtr<IShellDesktopTray> ShellDesk; - CComPtr<IShellView> DesktopView; - CComPtr<IShellBrowser> DefaultShellBrowser; - LPITEMIDLIST pidlDesktopDirectory; - LPITEMIDLIST pidlDesktop; - - LRESULT _NotifyTray(UINT uMsg, WPARAM wParam, LPARAM lParam); - -public: - CDesktopBrowser(); - ~CDesktopBrowser(); - HRESULT Initialize(HWND hWndx, IShellDesktopTray *ShellDeskx); - HWND FindDesktopListView (); - BOOL CreateDeskWnd(); - HWND DesktopGetWindowControl(IN UINT id); - LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam); - static LRESULT CALLBACK ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam); - BOOL MessageLoop(); - - // *** IOleWindow methods *** - virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd); - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); - - // *** IShellBrowser methods *** - virtual HRESULT STDMETHODCALLTYPE InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths); - virtual HRESULT STDMETHODCALLTYPE SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject); - virtual HRESULT STDMETHODCALLTYPE RemoveMenusSB(HMENU hmenuShared); - virtual HRESULT STDMETHODCALLTYPE SetStatusTextSB(LPCOLESTR pszStatusText); - virtual HRESULT STDMETHODCALLTYPE EnableModelessSB(BOOL fEnable); - virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorSB(MSG *pmsg, WORD wID); - virtual HRESULT STDMETHODCALLTYPE BrowseObject(LPCITEMIDLIST pidl, UINT wFlags); - virtual HRESULT STDMETHODCALLTYPE GetViewStateStream(DWORD grfMode, IStream **ppStrm); - virtual HRESULT STDMETHODCALLTYPE GetControlWindow(UINT id, HWND *lphwnd); - virtual HRESULT STDMETHODCALLTYPE SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret); - virtual HRESULT STDMETHODCALLTYPE QueryActiveShellView(struct IShellView **ppshv); - virtual HRESULT STDMETHODCALLTYPE OnViewWindowActive(struct IShellView *ppshv); - virtual HRESULT STDMETHODCALLTYPE SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags); - - // *** ICommDlgBrowser methods *** - virtual HRESULT STDMETHODCALLTYPE OnDefaultCommand (struct IShellView *ppshv); - virtual HRESULT STDMETHODCALLTYPE OnStateChange (struct IShellView *ppshv, ULONG uChange); - virtual HRESULT STDMETHODCALLTYPE IncludeObject (struct IShellView *ppshv, LPCITEMIDLIST pidl); - - // *** IServiceProvider methods *** - virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); - -BEGIN_COM_MAP(CDesktopBrowser) - COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) - COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser) - COM_INTERFACE_ENTRY_IID(IID_ICommDlgBrowser, ICommDlgBrowser) - COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) -END_COM_MAP() -}; - -CDesktopBrowser::CDesktopBrowser() -{ - Tag = SHDESK_TAG; - hWnd = NULL; - hWndShellView = NULL; - hWndDesktopListView = NULL; - DefaultShellBrowser = NULL; - pidlDesktopDirectory = NULL; - pidlDesktop = NULL; -} - -CDesktopBrowser::~CDesktopBrowser() -{ - if (DesktopView.p != NULL) - { - if (hWndShellView != NULL) - DesktopView->DestroyViewWindow(); - - hWndShellView = NULL; - hWndDesktopListView = NULL; - } - - if (pidlDesktopDirectory != NULL) - { - ILFree(pidlDesktopDirectory); - pidlDesktopDirectory = NULL; - } - - if (pidlDesktop != NULL) - { - ILFree(pidlDesktop); - pidlDesktop = NULL; - } -} - -HRESULT CDesktopBrowser::Initialize(HWND hWndx, IShellDesktopTray *ShellDeskx) -{ - CComPtr<IShellFolder> psfDesktopFolder; - CSFV csfv; - HRESULT hRet; - - hWnd = hWndx; - ShellDesk = ShellDeskx; - ShellDesk->AddRef(); - - pidlDesktopDirectory = SHCloneSpecialIDList(hWnd, CSIDL_DESKTOPDIRECTORY, FALSE); - hRet = SHGetSpecialFolderLocation(hWnd, CSIDL_DESKTOP, &pidlDesktop); - if (FAILED(hRet)) - return hRet; - - hRet = SHGetDesktopFolder(&psfDesktopFolder); - if (FAILED(hRet)) - return hRet; - - ZeroMemory(&csfv, sizeof(csfv)); - csfv.cbSize = sizeof(csfv); - csfv.pshf = psfDesktopFolder; - csfv.psvOuter = NULL; - - hRet = SHCreateShellFolderViewEx(&csfv, &DesktopView); - - return hRet; -} - -static CDesktopBrowser *SHDESK_Create(HWND hWnd, LPCREATESTRUCT lpCreateStruct) -{ - CComPtr<IShellDesktopTray> ShellDesk; - CComObject<CDesktopBrowser> *pThis; - HRESULT hRet; - - ShellDesk = (IShellDesktopTray *)lpCreateStruct->lpCreateParams; - if (ShellDesk == NULL) - { - WARN("No IShellDesk interface provided!"); - return NULL; - } - - pThis = new CComObject<CDesktopBrowser>; - if (pThis == NULL) - return NULL; - pThis->AddRef(); - - hRet = pThis->Initialize(hWnd, ShellDesk); - if (FAILED(hRet)) - { - pThis->Release(); - return NULL; - } - - return pThis; -} - -HWND CDesktopBrowser::FindDesktopListView () -{ - return FindWindowExW(hWndShellView, NULL, WC_LISTVIEW, NULL); -} - -BOOL CDesktopBrowser::CreateDeskWnd() -{ - FOLDERSETTINGS fs; - RECT rcClient; - HRESULT hRet; - - if (!GetClientRect(hWnd, &rcClient)) - { - return FALSE; - } - - fs.ViewMode = FVM_ICON; - fs.fFlags = FWF_DESKTOP | FWF_NOCLIENTEDGE | FWF_NOSCROLL | FWF_TRANSPARENT; - hRet = DesktopView->CreateViewWindow(NULL, &fs, (IShellBrowser *)this, &rcClient, &hWndShellView); - if (!SUCCEEDED(hRet)) - return FALSE; - - SetShellWindowEx(hWnd, FindDesktopListView()); - - return TRUE; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::GetWindow(HWND *phwnd) -{ - if (hWnd != NULL) - { - *phwnd = hWnd; - return S_OK; - } - - *phwnd = NULL; - return E_UNEXPECTED; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::ContextSensitiveHelp(BOOL fEnterMode) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::RemoveMenusSB(HMENU hmenuShared) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::SetStatusTextSB(LPCOLESTR lpszStatusText) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::EnableModelessSB(BOOL fEnable) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::TranslateAcceleratorSB(LPMSG lpmsg, WORD wID) -{ - if (!::TranslateAcceleratorW(hWnd, m_hAccel, lpmsg)) - return S_FALSE; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::BrowseObject(LPCITEMIDLIST pidl, UINT wFlags) -{ - /* - * We should use IShellWindows interface here in order to attempt to - * find an open shell window that shows the requested pidl and activate it - */ - - return SHOpenNewFrame((LPITEMIDLIST)pidl, NULL, 0, 0); -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::GetViewStateStream(DWORD grfMode, IStream **ppStrm) -{ - return E_NOTIMPL; -} - -HWND CDesktopBrowser::DesktopGetWindowControl(IN UINT id) -{ - switch (id) - { - case FCW_TOOLBAR: - case FCW_STATUS: - case FCW_TREE: - case FCW_PROGRESS: - return NULL; - - default: - return NULL; - } - -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::GetControlWindow(UINT id, HWND *lphwnd) -{ - HWND hWnd; - - hWnd = DesktopGetWindowControl(id); - if (hWnd != NULL) - { - *lphwnd = hWnd; - return S_OK; - } - - *lphwnd = NULL; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret) -{ - HWND hWnd; - - if (pret == NULL) - return E_POINTER; - - hWnd = DesktopGetWindowControl(id); - if (hWnd != NULL) - { - *pret = SendMessageW(hWnd, - uMsg, - wParam, - lParam); - return S_OK; - } - - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::QueryActiveShellView(IShellView **ppshv) -{ - *ppshv = DesktopView; - if (DesktopView != NULL) - DesktopView->AddRef(); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::OnViewWindowActive(IShellView *ppshv) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::OnDefaultCommand(IShellView *ppshv) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::OnStateChange(IShellView *ppshv, ULONG uChange) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::IncludeObject(IShellView *ppshv, LPCITEMIDLIST pidl) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::QueryService(REFGUID guidService, REFIID riid, PVOID *ppv) -{ - /* FIXME - handle guidService */ - return QueryInterface(riid, ppv); -} - -BOOL CDesktopBrowser::MessageLoop() -{ - MSG Msg; - BOOL bRet; - - while ((bRet = GetMessageW(&Msg, NULL, 0, 0)) != 0) - { - if (bRet != -1) - { - if (DesktopView->TranslateAcceleratorW(&Msg) != S_OK) - { - TranslateMessage(&Msg); - DispatchMessage(&Msg); - } - } - } - - return TRUE; -} - -LRESULT CDesktopBrowser::_NotifyTray(UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - HWND hwndTray; - HRESULT hres; - - hres = this->ShellDesk->GetTrayWindow(&hwndTray); - - if (SUCCEEDED(hres)) - PostMessageW(hwndTray, uMsg, wParam, lParam); - - return 0; -} - -LRESULT CDesktopBrowser::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch (LOWORD(wParam)) - { - case FCIDM_DESKBROWSER_CLOSE: - return _NotifyTray(TWM_DOEXITWINDOWS, 0, 0); - case FCIDM_DESKBROWSER_FOCUS: - if (GetKeyState(VK_SHIFT)) - return _NotifyTray(TWM_CYCLEFOCUS, 1, 0xFFFFFFFF); - else - return _NotifyTray(TWM_CYCLEFOCUS, 1, 1); - case FCIDM_DESKBROWSER_SEARCH: - SHFindFiles(NULL, NULL); - break; - case FCIDM_DESKBROWSER_REFRESH: - break; - } - - return 0; -} - -LRESULT CALLBACK CDesktopBrowser::ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam) -{ - CDesktopBrowser *pThis = NULL; - LRESULT Ret = FALSE; - - if (uMsg != WM_NCCREATE) - { - pThis = reinterpret_cast<CDesktopBrowser *>(GetWindowLongPtrW(hwnd, 0)); - if (pThis == NULL) - goto DefMsgHandler; - } - - if (pThis != NULL || uMsg == WM_NCCREATE) - { - switch (uMsg) - { - case WM_ERASEBKGND: - return (LRESULT)PaintDesktop((HDC)wParam); - - case WM_GETISHELLBROWSER: - Ret = (LRESULT)((IShellBrowser *)pThis); - break; - - case WM_SIZE: - if (wParam == SIZE_MINIMIZED) - { - /* Hey, we're the desktop!!! */ - ShowWindow(hwnd, - SW_RESTORE); - } - else - { - RECT rcDesktop; - - rcDesktop.left = GetSystemMetrics(SM_XVIRTUALSCREEN); - rcDesktop.top = GetSystemMetrics(SM_YVIRTUALSCREEN); - rcDesktop.right = GetSystemMetrics(SM_CXVIRTUALSCREEN); - rcDesktop.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN); - - /* FIXME: Update work area */ - DBG_UNREFERENCED_LOCAL_VARIABLE(rcDesktop); - } - break; - - case WM_SYSCOLORCHANGE: - case WM_SETTINGCHANGE: - { - if (uMsg == WM_SYSCOLORCHANGE || wParam == SPI_SETDESKWALLPAPER || wParam == 0) - { - if (pThis->hWndShellView != NULL) - { - /* Forward the message */ - SendMessageW(pThis->hWndShellView, - uMsg, - wParam, - lParam); - } - } - break; - } - - case WM_CREATE: - { - pThis->ShellDesk->RegisterDesktopWindow(pThis->hWnd); - - if (!pThis->CreateDeskWnd()) - WARN("Could not create the desktop view control!\n"); - - pThis->m_hAccel = LoadAcceleratorsW(shell32_hInstance, MAKEINTRESOURCEW(3)); - - break; - } - - case WM_NCCREATE: - { - LPCREATESTRUCT CreateStruct = (LPCREATESTRUCT)lParam; - pThis = SHDESK_Create(hwnd, CreateStruct); - if (pThis == NULL) - { - WARN("Failed to create desktop structure\n"); - break; - } - - SetWindowLongPtrW(hwnd, - 0, - (LONG_PTR)pThis); - Ret = TRUE; - break; - } - - case WM_NCDESTROY: - { - pThis->Release(); - break; - } - - case WM_EXPLORER_OPEN_NEW_WINDOW: - TRACE("Proxy Desktop message 1035 received.\n"); - SHOnCWMCommandLine((HANDLE)lParam); - break; - - case WM_COMMAND: - return pThis->OnCommand(uMsg, wParam, lParam); - - case WM_SETFOCUS: - SetFocus(pThis->hWndShellView); - break; - default: -DefMsgHandler: - Ret = DefWindowProcW(hwnd, uMsg, wParam, lParam); - break; - } - } - - return Ret; -} - -static BOOL -RegisterProgmanWindowClass(VOID) -{ - WNDCLASSW wcProgman; - - wcProgman.style = CS_DBLCLKS; - wcProgman.lpfnWndProc = CDesktopBrowser::ProgmanWindowProc; - wcProgman.cbClsExtra = 0; - wcProgman.cbWndExtra = sizeof(CDesktopBrowser *); - wcProgman.hInstance = shell32_hInstance; - wcProgman.hIcon = NULL; - wcProgman.hCursor = LoadCursorW(NULL, IDC_ARROW); - wcProgman.hbrBackground = NULL; - wcProgman.lpszMenuName = NULL; - wcProgman.lpszClassName = szProgmanClassName; - - return RegisterClassW(&wcProgman) != 0; -} - - -/************************************************************************* - * SHCreateDesktop [SHELL32.200] - * - */ -HANDLE WINAPI SHCreateDesktop(IShellDesktopTray *ShellDesk) -{ - HWND hWndDesk; - RECT rcDesk; - - if (ShellDesk == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - if (RegisterProgmanWindowClass() == 0) - { - WARN("Failed to register the Progman window class!\n"); - return NULL; - } - - rcDesk.left = GetSystemMetrics(SM_XVIRTUALSCREEN); - rcDesk.top = GetSystemMetrics(SM_YVIRTUALSCREEN); - rcDesk.right = rcDesk.left + GetSystemMetrics(SM_CXVIRTUALSCREEN); - rcDesk.bottom = rcDesk.top + GetSystemMetrics(SM_CYVIRTUALSCREEN); - - if (IsRectEmpty(&rcDesk)) - { - rcDesk.left = rcDesk.top = 0; - rcDesk.right = GetSystemMetrics(SM_CXSCREEN); - rcDesk.bottom = GetSystemMetrics(SM_CYSCREEN); - } - - hWndDesk = CreateWindowExW(WS_EX_TOOLWINDOW, szProgmanClassName, szProgmanWindowName, - WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - rcDesk.left, rcDesk.top, rcDesk.right, rcDesk.bottom, - NULL, NULL, shell32_hInstance, (LPVOID)ShellDesk); - if (hWndDesk != NULL) - return (HANDLE)GetWindowLongPtrW(hWndDesk, 0); - - return NULL; -} - -/************************************************************************* - * SHCreateDesktop [SHELL32.201] - * - */ -BOOL WINAPI SHDesktopMessageLoop(HANDLE hDesktop) -{ - CDesktopBrowser *Desk = static_cast<CDesktopBrowser *>(hDesktop); - - if (Desk == NULL || Desk->Tag != SHDESK_TAG) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - return Desk->MessageLoop(); -} Modified: trunk/reactos/dll/win32/shell32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CMakeLis…
============================================================================== --- trunk/reactos/dll/win32/shell32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CMakeLists.txt [iso-8859-1] Wed Aug 19 13:51:20 2015 @@ -1,5 +1,6 @@ PROJECT(SHELL) +add_subdirectory(shelldesktop) add_subdirectory(shellmenu) set_cpp(WITH_RUNTIME) @@ -20,9 +21,7 @@ list(APPEND SOURCE CIDLDataObj.cpp CQueryAssociations.cpp - dde.cpp debughlp.cpp - CDesktopBrowser.cpp dialogs/dialogs.cpp dialogs/drive.cpp dialogs/drvdefext.cpp @@ -82,7 +81,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/shell32.def) set_module_type(shell32 win32dll UNICODE HOTPATCHABLE) -target_link_libraries(shell32 shellmenu atlnew wine uuid recyclebin) +target_link_libraries(shell32 shellmenu shelldesktop atlnew wine uuid recyclebin) add_delay_importlibs(shell32 uxtheme ole32 userenv version fmifs) add_importlibs(shell32 advapi32 browseui gdi32 user32 powrprof comctl32 comdlg32 shdocvw shlwapi devmgr winspool winmm msvcrt kernel32 ntdll) add_pch(shell32 precomp.h SOURCE) Removed: trunk/reactos/dll/win32/shell32/dde.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/dde.cpp?…
============================================================================== --- trunk/reactos/dll/win32/shell32/dde.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/dde.cpp (removed) @@ -1,423 +0,0 @@ -/* - * Shell DDE Handling - * - * Copyright 2004 Robert Shearman - * - * 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 "precomp.h" -#include <ddeml.h> -#include <strsafe.h> - -WINE_DEFAULT_DEBUG_CHANNEL(shelldde); - -typedef DWORD(CALLBACK * pfnCommandHandler)(PWSTR strCommand, PWSTR strPath, LPITEMIDLIST pidl, INT unkS); - -struct DDECommandHandler -{ - WCHAR Command[32]; - pfnCommandHandler Handler; -}; - -extern DDECommandHandler HandlerList []; -extern const int HandlerListLength; - -/* DDE Instance ID */ -static DWORD dwDDEInst; - -/* String handles */ -static HSZ hszProgmanTopic; -static HSZ hszProgmanService; -static HSZ hszShell; -static HSZ hszAppProperties; -static HSZ hszFolders; - -static BOOL bInitialized; - -static BOOL Dde_OnConnect(HSZ hszTopic, HSZ hszService) -{ - WCHAR szTopic[MAX_PATH]; - WCHAR szService[MAX_PATH]; - - DdeQueryStringW(dwDDEInst, hszTopic, szTopic, _countof(szTopic), CP_WINUNICODE); - DdeQueryStringW(dwDDEInst, hszService, szService, _countof(szService), CP_WINUNICODE); - - TRACE("Dde_OnConnect: topic=%S, service=%S\n", szTopic, szService); - - return TRUE; -} - -static void Dde_OnConnectConfirm(HCONV hconv, HSZ hszTopic, HSZ hszService) -{ - WCHAR szTopic[MAX_PATH]; - WCHAR szService[MAX_PATH]; - - DdeQueryStringW(dwDDEInst, hszTopic, szTopic, _countof(szTopic), CP_WINUNICODE); - DdeQueryStringW(dwDDEInst, hszService, szService, _countof(szService), CP_WINUNICODE); - - TRACE("Dde_OnConnectConfirm: hconv=%p, topic=%S, service=%S\n", hconv, szTopic, szService); -} - -static BOOL Dde_OnWildConnect(HSZ hszTopic, HSZ hszService) -{ - WCHAR szTopic[MAX_PATH]; - WCHAR szService[MAX_PATH]; - - DdeQueryStringW(dwDDEInst, hszTopic, szTopic, _countof(szTopic), CP_WINUNICODE); - DdeQueryStringW(dwDDEInst, hszService, szService, _countof(szService), CP_WINUNICODE); - - TRACE("Dde_OnWildConnect: topic=%S, service=%S\n", szTopic, szService); - - return FALSE; -} - -static HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, HSZ hszItem) -{ - WCHAR szTopic[MAX_PATH]; - WCHAR szItem[MAX_PATH]; - - DdeQueryStringW(dwDDEInst, hszTopic, szTopic, _countof(szTopic), CP_WINUNICODE); - DdeQueryStringW(dwDDEInst, hszItem, szItem, _countof(szItem), CP_WINUNICODE); - - TRACE("Dde_OnRequest: uFmt=%d, hconv=%p, topic=%S, item=%S\n", hconv, szTopic, szItem); - - return NULL; -} - -static LPITEMIDLIST _ILReadFromSharedMemory(PCWSTR strField) -{ - LPITEMIDLIST ret = NULL; - - // Ensure it really is an IDLIST-formatted parameter - // Format for IDLIST params: ":pid:shared" - if (*strField != L':') - return NULL; - - HANDLE hData = (HANDLE) StrToIntW(strField + 1); - PWSTR strSecond = StrChrW(strField + 1, L':'); - - if (strSecond) - { - int pid = StrToIntW(strSecond + 1); - void* pvShared = SHLockShared(hData, pid); - if (pvShared) - { - ret = ILClone((LPCITEMIDLIST) pvShared); - SHUnlockShared(pvShared); - SHFreeShared(hData, pid); - } - } - return ret; -} - -static DWORD Dde_OnExecute(HCONV hconv, HSZ hszTopic, HDDEDATA hdata) -{ - WCHAR szTopic[MAX_PATH]; - WCHAR szCommand[MAX_PATH]; - WCHAR *pszCommand; - - DdeQueryStringW(dwDDEInst, hszTopic, szTopic, _countof(szTopic), CP_WINUNICODE); - - pszCommand = (WCHAR*) DdeAccessData(hdata, NULL); - if (!pszCommand) - return DDE_FNOTPROCESSED; - - StringCchCopyW(szCommand, _countof(szCommand), pszCommand); - - DdeUnaccessData(hdata); - - TRACE("Dde_OnExecute: hconv=%p, topic=%S, command=%S\n", hconv, szTopic, pszCommand); - - /* - [ViewFolder("%l", %I, %S)] -- Open a folder in standard mode - [ExploreFolder("%l", %I, %S)] -- Open a folder in "explore" mode (file tree is shown to the left by default) - [FindFolder("%l", %I)] -- Open a folder in "find" mode (search panel is shown to the left by default) - [ShellFile("%1","%1",%S)] -- Execute the contents of the specified .SCF file - - Approximate grammar (Upper names define rules, <lower> names define terminals, single-quotes are literals): - - Rules - Command = ('[' Function ']') | Function - Function = <identifier> '(' Parameters ')' - Parameters = (<quoted-string> (',' <idlist> (',' <number>)?)?)? - - Terminals - <identifier> = [a-zA-Z]+ - <quoted-string> = \"([^\"]|\\.)\" - <idlist> = \:[0-9]+\:[0-9]+ - <number> = [0-9]+ - */ - - WCHAR Command[MAX_PATH] = L""; - WCHAR Path[MAX_PATH] = L""; - LPITEMIDLIST IdList = NULL; - INT UnknownParameter = 0; - - // Simplified parsing (assumes the command will not be TOO broken): - - PWSTR cmd = szCommand; - // 1. if starts with [, skip first char - if (*cmd == L'[') - cmd++; - - if (*cmd == L']') - { - ERR("Empty command. Nothing to run.\n"); - return DDE_FNOTPROCESSED; - } - - // Read until first (, and take text before ( as command name - { - PWSTR cmdEnd = StrChrW(cmd, L'('); - - if (!cmdEnd) - { - ERR("Could not find '('. Invalid command.\n"); - return DDE_FNOTPROCESSED; - } - - *cmdEnd = 0; - - StringCchCopy(Command, _countof(Command), cmd); - - cmd = cmdEnd + 1; - } - - // Read first param after (, expecting quoted string - if (*cmd != L')') - { - // Copy unescaped string - PWSTR dst = Path; - BOOL isQuote = FALSE; - - PWSTR arg = cmd; - - while (*arg && (isQuote || *arg != L',')) - { - if (*arg == L'"') - { - isQuote = !isQuote; - if (isQuote && arg != cmd) // do not copy the " at the beginning of the string - { - *(dst++) = L'"'; - } - } - else - { - *(dst++) = *arg; - } - - arg++; - } - - cmd = arg + 1; - - while (*cmd == L' ') - cmd++; - } - - // Read second param, expecting an idlist in shared memory - if (*cmd != L')') - { - if (*cmd != ':') - { - ERR("Expected ':'. Invalid command.\n"); - return DDE_FNOTPROCESSED; - } - - PWSTR idlistEnd = StrChrW(cmd, L','); - - if (!idlistEnd) - idlistEnd = StrChrW(cmd, L')'); - - if (!idlistEnd) - { - ERR("Expected ',' or ')'. Invalid command.\n"); - return DDE_FNOTPROCESSED; - } - - IdList = _ILReadFromSharedMemory(cmd); - - cmd = idlistEnd + 1; - } - - // Read third param, expecting an integer - if (*cmd != L')') - { - UnknownParameter = StrToIntW(cmd); - } - - TRACE("Parse end: cmd=%S, S=%d, pidl=%p, path=%S\n", Command, UnknownParameter, IdList, Path); - - // Find handler in list - for (int i = 0; i < HandlerListLength; i++) - { - DDECommandHandler & handler = HandlerList[i]; - if (StrCmpW(handler.Command, Command) == 0) - { - return handler.Handler(Command, Path, IdList, UnknownParameter); - } - } - - // No handler found - ERR("Unknown command %S\n", Command); - return DDE_FNOTPROCESSED; -} - -static void Dde_OnDisconnect(HCONV hconv) -{ - TRACE("Dde_OnDisconnect: hconv=%p\n", hconv); -} - -static HDDEDATA CALLBACK DdeCallback( - UINT uType, - UINT uFmt, - HCONV hconv, - HSZ hsz1, - HSZ hsz2, - HDDEDATA hdata, - ULONG_PTR dwData1, - ULONG_PTR dwData2) -{ - switch (uType) - { - case XTYP_CONNECT: - return (HDDEDATA) (DWORD_PTR) Dde_OnConnect(hsz1, hsz2); - case XTYP_CONNECT_CONFIRM: - Dde_OnConnectConfirm(hconv, hsz1, hsz2); - return NULL; - case XTYP_WILDCONNECT: - return (HDDEDATA) (DWORD_PTR) Dde_OnWildConnect(hsz1, hsz2); - case XTYP_REQUEST: - return Dde_OnRequest(uFmt, hconv, hsz1, hsz2); - case XTYP_EXECUTE: - return (HDDEDATA) (DWORD_PTR) Dde_OnExecute(hconv, hsz1, hdata); - case XTYP_DISCONNECT: - Dde_OnDisconnect(hconv); - return NULL; - case XTYP_REGISTER: - return NULL; - default: - WARN("DdeCallback: unknown uType=%d\n", uType); - return NULL; - } -} -/************************************************************************* - * ShellDDEInit (SHELL32.@) - * - * Registers the Shell DDE services with the system so that applications - * can use them. - * - * PARAMS - * bInit [I] TRUE to initialize the services, FALSE to uninitialize. - * - * RETURNS - * Nothing. - */ -EXTERN_C void WINAPI ShellDDEInit(BOOL bInit) -{ - TRACE("ShellDDEInit bInit = %s\n", bInit ? "TRUE" : "FALSE"); - - if (bInit && !bInitialized) - { - DdeInitializeW(&dwDDEInst, DdeCallback, CBF_FAIL_ADVISES | CBF_FAIL_POKES, 0); - - hszProgmanTopic = DdeCreateStringHandleW(dwDDEInst, L"Progman", CP_WINUNICODE); - hszProgmanService = DdeCreateStringHandleW(dwDDEInst, L"Progman", CP_WINUNICODE); - hszShell = DdeCreateStringHandleW(dwDDEInst, L"Shell", CP_WINUNICODE); - hszAppProperties = DdeCreateStringHandleW(dwDDEInst, L"AppProperties", CP_WINUNICODE); - hszFolders = DdeCreateStringHandleW(dwDDEInst, L"Folders", CP_WINUNICODE); - - if (hszProgmanTopic && hszProgmanService && - hszShell && hszAppProperties && hszFolders && - DdeNameService(dwDDEInst, hszFolders, 0, DNS_REGISTER) && - DdeNameService(dwDDEInst, hszProgmanService, 0, DNS_REGISTER) && - DdeNameService(dwDDEInst, hszShell, 0, DNS_REGISTER)) - { - bInitialized = TRUE; - } - } - else if (!bInit && bInitialized) - { - /* unregister all services */ - DdeNameService(dwDDEInst, 0, 0, DNS_UNREGISTER); - - if (hszFolders) - DdeFreeStringHandle(dwDDEInst, hszFolders); - if (hszAppProperties) - DdeFreeStringHandle(dwDDEInst, hszAppProperties); - if (hszShell) - DdeFreeStringHandle(dwDDEInst, hszShell); - if (hszProgmanService) - DdeFreeStringHandle(dwDDEInst, hszProgmanService); - if (hszProgmanTopic) - DdeFreeStringHandle(dwDDEInst, hszProgmanTopic); - - DdeUninitialize(dwDDEInst); - - bInitialized = FALSE; - } -} - -static DWORD CALLBACK DDE_OnViewFolder(PWSTR strCommand, PWSTR strPath, LPITEMIDLIST pidl, INT unkS) -{ - if (!pidl) - pidl = ILCreateFromPathW(strPath); - - if (!pidl) - return DDE_FNOTPROCESSED; - - if (FAILED(SHOpenNewFrame(pidl, NULL, 0, 0))) - return DDE_FNOTPROCESSED; - - return DDE_FACK; -} - -static DWORD CALLBACK DDW_OnExploreFolder(PWSTR strCommand, PWSTR strPath, LPITEMIDLIST pidl, INT unkS) -{ - if (!pidl) - pidl = ILCreateFromPathW(strPath); - - if (!pidl) - return DDE_FNOTPROCESSED; - - if (FAILED(SHOpenNewFrame(pidl, NULL, 0, SH_EXPLORER_CMDLINE_FLAG_E))) - return DDE_FNOTPROCESSED; - - return DDE_FACK; -} - -static DWORD CALLBACK DDE_OnFindFolder(PWSTR strCommand, PWSTR strPath, LPITEMIDLIST pidl, INT unkS) -{ - UNIMPLEMENTED; - return DDE_FNOTPROCESSED; -} - -static DWORD CALLBACK DDE_OnShellFile(PWSTR strCommand, PWSTR strPath, LPITEMIDLIST pidl, INT unkS) -{ - UNIMPLEMENTED; - return DDE_FNOTPROCESSED; -} - -DDECommandHandler HandlerList [] = { - - { L"ViewFolder", DDE_OnViewFolder }, - { L"ExploreFolder", DDW_OnExploreFolder }, - { L"FindFolder", DDE_OnFindFolder }, - { L"ShellFile", DDE_OnShellFile } -}; - -const int HandlerListLength = _countof(HandlerList); Propchange: trunk/reactos/dll/win32/shell32/shelldesktop/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Wed Aug 19 13:51:20 2015 @@ -0,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: trunk/reactos/dll/win32/shell32/shelldesktop/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: trunk/reactos/dll/win32/shell32/shelldesktop/ ------------------------------------------------------------------------------ bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/dll/win32/shell32/shelldesktop/ ------------------------------------------------------------------------------ tsvn:logminsize = 10 Copied: trunk/reactos/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp (from r68767, trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shelldes…
============================================================================== --- trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp [iso-8859-1] Wed Aug 19 13:51:20 2015 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "shelldesktop.h" WINE_DEFAULT_DEBUG_CHANNEL(desktop); @@ -210,6 +210,12 @@ SetShellWindowEx(hWnd, FindDesktopListView()); +#if 1 + /* A Windows8+ specific hack */ + ::ShowWindow(hWndShellView, SW_SHOW); + ::ShowWindow(FindDesktopListView(), SW_SHOW); +#endif + return TRUE; } Copied: trunk/reactos/dll/win32/shell32/shelldesktop/dde.cpp (from r68767, trunk/reactos/dll/win32/shell32/dde.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shelldes…
============================================================================== --- trunk/reactos/dll/win32/shell32/dde.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shelldesktop/dde.cpp [iso-8859-1] Wed Aug 19 13:51:20 2015 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "shelldesktop.h" #include <ddeml.h> #include <strsafe.h> Removed: trunk/reactos/dll/win32/shell32/shellmenu/CDesktopBrowser.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CDesktopBrowser.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CDesktopBrowser.cpp (removed) @@ -1,566 +0,0 @@ -/* - * Shell Desktop - * - * Copyright 2008 Thomas Bluemel - * - * 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 "shellmenu.h" - -WINE_DEFAULT_DEBUG_CHANNEL(desktop); - -#define SHDESK_TAG 'KSED' - -static const WCHAR szProgmanClassName [] = L"Progman"; -static const WCHAR szProgmanWindowName [] = L"Program Manager"; - -class CDesktopBrowser : - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IShellBrowser, - public ICommDlgBrowser, - public IServiceProvider -{ -public: - DWORD Tag; -private: - HWND hWnd; - HWND hWndShellView; - HWND hWndDesktopListView; - CComPtr<IShellDesktopTray> ShellDesk; - CComPtr<IShellView> DesktopView; - IShellBrowser *DefaultShellBrowser; - LPITEMIDLIST pidlDesktopDirectory; - LPITEMIDLIST pidlDesktop; -public: - CDesktopBrowser(); - ~CDesktopBrowser(); - HRESULT Initialize(HWND hWndx, IShellDesktopTray *ShellDeskx); - HWND FindDesktopListView(); - BOOL CreateDeskWnd(); - HWND DesktopGetWindowControl(IN UINT id); - static LRESULT CALLBACK ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam); - static BOOL MessageLoop(); - - // *** IOleWindow methods *** - virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd); - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); - - // *** IShellBrowser methods *** - virtual HRESULT STDMETHODCALLTYPE InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths); - virtual HRESULT STDMETHODCALLTYPE SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject); - virtual HRESULT STDMETHODCALLTYPE RemoveMenusSB(HMENU hmenuShared); - virtual HRESULT STDMETHODCALLTYPE SetStatusTextSB(LPCOLESTR pszStatusText); - virtual HRESULT STDMETHODCALLTYPE EnableModelessSB(BOOL fEnable); - virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorSB(MSG *pmsg, WORD wID); - virtual HRESULT STDMETHODCALLTYPE BrowseObject(LPCITEMIDLIST pidl, UINT wFlags); - virtual HRESULT STDMETHODCALLTYPE GetViewStateStream(DWORD grfMode, IStream **ppStrm); - virtual HRESULT STDMETHODCALLTYPE GetControlWindow(UINT id, HWND *lphwnd); - virtual HRESULT STDMETHODCALLTYPE SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret); - virtual HRESULT STDMETHODCALLTYPE QueryActiveShellView(struct IShellView **ppshv); - virtual HRESULT STDMETHODCALLTYPE OnViewWindowActive(struct IShellView *ppshv); - virtual HRESULT STDMETHODCALLTYPE SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags); - - // *** ICommDlgBrowser methods *** - virtual HRESULT STDMETHODCALLTYPE OnDefaultCommand(struct IShellView *ppshv); - virtual HRESULT STDMETHODCALLTYPE OnStateChange(struct IShellView *ppshv, ULONG uChange); - virtual HRESULT STDMETHODCALLTYPE IncludeObject(struct IShellView *ppshv, LPCITEMIDLIST pidl); - - // *** IServiceProvider methods *** - virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); - - BEGIN_COM_MAP(CDesktopBrowser) - COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) - COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser) - COM_INTERFACE_ENTRY_IID(IID_ICommDlgBrowser, ICommDlgBrowser) - COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) - END_COM_MAP() -}; - -CDesktopBrowser::CDesktopBrowser() -{ - Tag = SHDESK_TAG; - hWnd = NULL; - hWndShellView = NULL; - hWndDesktopListView = NULL; - DefaultShellBrowser = NULL; - pidlDesktopDirectory = NULL; - pidlDesktop = NULL; -} - -CDesktopBrowser::~CDesktopBrowser() -{ - if (DesktopView.p != NULL) - { - if (hWndShellView != NULL) - DesktopView->DestroyViewWindow(); - - hWndShellView = NULL; - hWndDesktopListView = NULL; - } - - if (pidlDesktopDirectory != NULL) - { - ILFree(pidlDesktopDirectory); - pidlDesktopDirectory = NULL; - } - - if (pidlDesktop != NULL) - { - ILFree(pidlDesktop); - pidlDesktop = NULL; - } -} - -HRESULT CDesktopBrowser::Initialize(HWND hWndx, IShellDesktopTray *ShellDeskx) -{ - CComPtr<IShellFolder> psfDesktopFolder; - CSFV csfv; - HRESULT hRet; - - hWnd = hWndx; - ShellDesk = ShellDeskx; - ShellDesk->AddRef(); - - pidlDesktopDirectory = SHCloneSpecialIDList(hWnd, CSIDL_DESKTOPDIRECTORY, FALSE); - hRet = SHGetSpecialFolderLocation(hWnd, CSIDL_DESKTOP, &pidlDesktop); - if (FAILED(hRet)) - return hRet; - - hRet = SHGetDesktopFolder(&psfDesktopFolder); - if (FAILED(hRet)) - return hRet; - - ZeroMemory(&csfv, sizeof(csfv)); - csfv.cbSize = sizeof(csfv); - csfv.pshf = psfDesktopFolder; - csfv.psvOuter = NULL; - - hRet = SHCreateShellFolderViewEx(&csfv, &DesktopView); - - return hRet; -} - -static CDesktopBrowser *SHDESK_Create(HWND hWnd, LPCREATESTRUCT lpCreateStruct) -{ - IShellDesktopTray *ShellDesk; - CComObject<CDesktopBrowser> *pThis; - HRESULT hRet; - - ShellDesk = static_cast<IShellDesktopTray *>(lpCreateStruct->lpCreateParams); - if (ShellDesk == NULL) - { - WARN("No IShellDesk interface provided!"); - return NULL; - } - - pThis = new CComObject<CDesktopBrowser>; - if (pThis == NULL) - return NULL; - pThis->AddRef(); - - hRet = pThis->Initialize(hWnd, ShellDesk); - if (FAILED(hRet)) - { - pThis->Release(); - return NULL; - } - - return pThis; -} - -HWND CDesktopBrowser::FindDesktopListView() -{ - return FindWindowExW(hWndShellView, NULL, WC_LISTVIEW, NULL); -} - -BOOL CDesktopBrowser::CreateDeskWnd() -{ - FOLDERSETTINGS fs; - RECT rcClient; - HRESULT hRet; - - if (!GetClientRect(hWnd, &rcClient)) - { - return FALSE; - } - - fs.ViewMode = FVM_ICON; - fs.fFlags = FWF_DESKTOP | FWF_NOCLIENTEDGE | FWF_NOSCROLL | FWF_TRANSPARENT; - hRet = DesktopView->CreateViewWindow(NULL, &fs, static_cast<IShellBrowser *>(this), &rcClient, &hWndShellView); - if (!SUCCEEDED(hRet)) - return FALSE; - - SetShellWindowEx(hWnd, FindDesktopListView()); - -#if 1 - /* A windows 8 specific hack */ - ::ShowWindow(hWndShellView, SW_SHOW); - ::ShowWindow(FindDesktopListView(), SW_SHOW); -#endif - - return TRUE; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::GetWindow(HWND *phwnd) -{ - if (hWnd != NULL) - { - *phwnd = hWnd; - return S_OK; - } - - *phwnd = NULL; - return E_UNEXPECTED; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::ContextSensitiveHelp(BOOL fEnterMode) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::RemoveMenusSB(HMENU hmenuShared) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::SetStatusTextSB(LPCOLESTR lpszStatusText) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::EnableModelessSB(BOOL fEnable) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::TranslateAcceleratorSB(LPMSG lpmsg, WORD wID) -{ - return S_FALSE; -} - -typedef HRESULT(WINAPI *SH_OPEN_NEW_FRAME)(LPITEMIDLIST pidl, IUnknown *paramC, long param10, long param14); - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::BrowseObject(LPCITEMIDLIST pidl, UINT wFlags) -{ - /* FIXME: Implement executing filebrowser.exe and somehow pass the pidl to it */ - - /* Returning failure here will make windows 7 and 8 to use the default file browser */ - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::GetViewStateStream(DWORD grfMode, IStream **ppStrm) -{ - return E_NOTIMPL; -} - -HWND CDesktopBrowser::DesktopGetWindowControl(IN UINT id) -{ - switch (id) - { - case FCW_TOOLBAR: - case FCW_STATUS: - case FCW_TREE: - case FCW_PROGRESS: - return NULL; - - default: - return NULL; - } - -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::GetControlWindow(UINT id, HWND *lphwnd) -{ - HWND hWnd; - - hWnd = DesktopGetWindowControl(id); - if (hWnd != NULL) - { - *lphwnd = hWnd; - return S_OK; - } - - *lphwnd = NULL; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret) -{ - HWND hWnd; - - if (pret == NULL) - return E_POINTER; - - hWnd = DesktopGetWindowControl(id); - if (hWnd != NULL) - { - *pret = SendMessageW(hWnd, uMsg, wParam, lParam); - return S_OK; - } - - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::QueryActiveShellView(IShellView **ppshv) -{ - *ppshv = DesktopView; - if (DesktopView != NULL) - DesktopView->AddRef(); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::OnViewWindowActive(IShellView *ppshv) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::OnDefaultCommand(IShellView *ppshv) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::OnStateChange(IShellView *ppshv, ULONG uChange) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::IncludeObject(IShellView *ppshv, LPCITEMIDLIST pidl) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CDesktopBrowser::QueryService(REFGUID guidService, REFIID riid, PVOID *ppv) -{ - /* FIXME - handle guidService */ - return QueryInterface(riid, ppv); -} - -BOOL CDesktopBrowser::MessageLoop() -{ - MSG Msg; - BOOL bRet; - - while ((bRet = GetMessageW(&Msg, NULL, 0, 0)) != 0) - { - if (bRet != -1) - { - TranslateMessage(&Msg); - DispatchMessageW(&Msg); - } - } - - return TRUE; -} - -LRESULT CALLBACK CDesktopBrowser::ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam) -{ - CDesktopBrowser *pThis = NULL; - LRESULT Ret = FALSE; - - if (uMsg != WM_NCCREATE) - { - pThis = reinterpret_cast<CDesktopBrowser*>(GetWindowLongPtrW(hwnd, 0)); - if (pThis == NULL) - goto DefMsgHandler; - } - - if (pThis != NULL || uMsg == WM_NCCREATE) - { - switch (uMsg) - { - case WM_ERASEBKGND: - return (LRESULT) PaintDesktop(reinterpret_cast<HDC>(wParam)); - - case WM_GETISHELLBROWSER: - Ret = reinterpret_cast<LRESULT>(static_cast<IShellBrowser *>(pThis)); - break; - - case WM_SIZE: - if (wParam == SIZE_MINIMIZED) - { - /* Hey, we're the desktop!!! */ - ShowWindow(hwnd, - SW_RESTORE); - } - else - { - - /* FIXME: Update work area */ -#if 0 - RECT rcDesktop; - - rcDesktop.left = GetSystemMetrics(SM_XVIRTUALSCREEN); - rcDesktop.top = GetSystemMetrics(SM_YVIRTUALSCREEN); - rcDesktop.right = GetSystemMetrics(SM_CXVIRTUALSCREEN); - rcDesktop.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN); -#endif - } - break; - - case WM_SYSCOLORCHANGE: - case WM_SETTINGCHANGE: - { - if (uMsg == WM_SYSCOLORCHANGE || wParam == SPI_SETDESKWALLPAPER || wParam == 0) - { - if (pThis->hWndShellView != NULL) - { - /* Forward the message */ - SendMessageW(pThis->hWndShellView, - uMsg, - wParam, - lParam); - } - } - break; - } - - case WM_CREATE: - { - pThis->ShellDesk->RegisterDesktopWindow(pThis->hWnd); - - if (!pThis->CreateDeskWnd()) - WARN("Could not create the desktop view control!\n"); - break; - } - - case WM_NCCREATE: - { - LPCREATESTRUCT CreateStruct = reinterpret_cast<LPCREATESTRUCT>(lParam); - pThis = SHDESK_Create(hwnd, CreateStruct); - if (pThis == NULL) - { - WARN("Failed to create desktop structure\n"); - break; - } - - SetWindowLongPtrW(hwnd, - 0, - reinterpret_cast<LONG_PTR>(pThis)); - Ret = TRUE; - break; - } - - case WM_NCDESTROY: - { - pThis->Release(); - break; - } - - default: - DefMsgHandler : - Ret = DefWindowProcW(hwnd, uMsg, wParam, lParam); - break; - } - } - - return Ret; -} - -static BOOL -RegisterProgmanWindowClass(VOID) -{ - WNDCLASSW wcProgman; - - wcProgman.style = CS_DBLCLKS; - wcProgman.lpfnWndProc = CDesktopBrowser::ProgmanWindowProc; - wcProgman.cbClsExtra = 0; - wcProgman.cbWndExtra = sizeof(CDesktopBrowser *); - wcProgman.hInstance = shell32_hInstance; - wcProgman.hIcon = NULL; - wcProgman.hCursor = LoadCursorW(NULL, IDC_ARROW); - wcProgman.hbrBackground = NULL; - wcProgman.lpszMenuName = NULL; - wcProgman.lpszClassName = szProgmanClassName; - - return RegisterClassW(&wcProgman) != 0; -} - - -/************************************************************************* - * SHCreateDesktop [SHELL32.200] - * - */ -HANDLE WINAPI SHCreateDesktop(IShellDesktopTray *ShellDesk) -{ - HWND hWndDesk; - RECT rcDesk; - - if (ShellDesk == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - if (RegisterProgmanWindowClass() == 0) - { - WARN("Failed to register the Progman window class!\n"); - return NULL; - } - - rcDesk.left = GetSystemMetrics(SM_XVIRTUALSCREEN); - rcDesk.top = GetSystemMetrics(SM_YVIRTUALSCREEN); - rcDesk.right = rcDesk.left + GetSystemMetrics(SM_CXVIRTUALSCREEN); - rcDesk.bottom = rcDesk.top + GetSystemMetrics(SM_CYVIRTUALSCREEN); - - if (IsRectEmpty(&rcDesk)) - { - rcDesk.left = rcDesk.top = 0; - rcDesk.right = GetSystemMetrics(SM_CXSCREEN); - rcDesk.bottom = GetSystemMetrics(SM_CYSCREEN); - } - - hWndDesk = CreateWindowExW(WS_EX_TOOLWINDOW, szProgmanClassName, szProgmanWindowName, - WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - rcDesk.left, rcDesk.top, rcDesk.right, rcDesk.bottom, - NULL, NULL, shell32_hInstance, reinterpret_cast<LPVOID>(ShellDesk)); - if (hWndDesk != NULL) - return (HANDLE) GetWindowLongPtrW(hWndDesk, 0); - - return NULL; -} - -/************************************************************************* - * SHCreateDesktop [SHELL32.201] - * - */ -BOOL WINAPI SHDesktopMessageLoop(HANDLE hDesktop) -{ - CDesktopBrowser *Desk = reinterpret_cast<CDesktopBrowser *>(hDesktop); - - if (Desk == NULL || Desk->Tag != SHDESK_TAG) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - return Desk->MessageLoop(); -} Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMakeLists.txt [iso-8859-1] Wed Aug 19 13:51:20 2015 @@ -8,14 +8,12 @@ list(APPEND SOURCE CBandSite.cpp - CDesktopBrowser.cpp CMenuBand.cpp CMenuDeskBar.cpp CMenuFocusManager.cpp CMenuSite.cpp CMenuToolbars.cpp CMergedFolder.cpp - CStartMenu.cpp - ShellDDE.cpp) + CStartMenu.cpp) add_library(shellmenu ${SOURCE}) Removed: trunk/reactos/dll/win32/shell32/shellmenu/ShellDDE.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/ShellDDE.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/ShellDDE.cpp (removed) @@ -1,411 +0,0 @@ -/* - * Shell DDE Handling - * - * Copyright 2004 Robert Shearman - * - * 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 "shellmenu.h" -#include <ddeml.h> -#include <strsafe.h> -#include <shlwapi_undoc.h> - -/* WARNING: Although this is a functional implementation of the DDE parsing, the handlers are not implemented here. -The actual working implementation is in shell32 instead. */ - -WINE_DEFAULT_DEBUG_CHANNEL(shelldde); - -typedef DWORD(CALLBACK * pfnCommandHandler)(PWSTR strCommand, PWSTR strPath, LPITEMIDLIST pidl, INT unkS); - -struct DDECommandHandler -{ - WCHAR Command[32]; - pfnCommandHandler Handler; -}; - -extern DDECommandHandler HandlerList []; -extern const int HandlerListLength; - -/* DDE Instance ID */ -static DWORD dwDDEInst; - -/* String handles */ -static HSZ hszProgmanTopic; -static HSZ hszProgmanService; -static HSZ hszShell; -static HSZ hszAppProperties; -static HSZ hszFolders; - -static BOOL bInitialized; - -static BOOL Dde_OnConnect(HSZ hszTopic, HSZ hszService) -{ - WCHAR szTopic[MAX_PATH]; - WCHAR szService[MAX_PATH]; - - DdeQueryStringW(dwDDEInst, hszTopic, szTopic, _countof(szTopic), CP_WINUNICODE); - DdeQueryStringW(dwDDEInst, hszService, szService, _countof(szService), CP_WINUNICODE); - - TRACE("Dde_OnConnect: topic=%S, service=%S\n", szTopic, szService); - - return TRUE; -} - -static void Dde_OnConnectConfirm(HCONV hconv, HSZ hszTopic, HSZ hszService) -{ - WCHAR szTopic[MAX_PATH]; - WCHAR szService[MAX_PATH]; - - DdeQueryStringW(dwDDEInst, hszTopic, szTopic, _countof(szTopic), CP_WINUNICODE); - DdeQueryStringW(dwDDEInst, hszService, szService, _countof(szService), CP_WINUNICODE); - - TRACE("Dde_OnConnectConfirm: hconv=%p, topic=%S, service=%S\n", hconv, szTopic, szService); -} - -static BOOL Dde_OnWildConnect(HSZ hszTopic, HSZ hszService) -{ - WCHAR szTopic[MAX_PATH]; - WCHAR szService[MAX_PATH]; - - DdeQueryStringW(dwDDEInst, hszTopic, szTopic, _countof(szTopic), CP_WINUNICODE); - DdeQueryStringW(dwDDEInst, hszService, szService, _countof(szService), CP_WINUNICODE); - - TRACE("Dde_OnWildConnect: topic=%S, service=%S\n", szTopic, szService); - - return FALSE; -} - -static HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, HSZ hszItem) -{ - WCHAR szTopic[MAX_PATH]; - WCHAR szItem[MAX_PATH]; - - DdeQueryStringW(dwDDEInst, hszTopic, szTopic, _countof(szTopic), CP_WINUNICODE); - DdeQueryStringW(dwDDEInst, hszItem, szItem, _countof(szItem), CP_WINUNICODE); - - TRACE("Dde_OnRequest: uFmt=%d, hconv=%p, topic=%S, item=%S\n", hconv, szTopic, szItem); - - return NULL; -} - -static LPITEMIDLIST _ILReadFromSharedMemory(PCWSTR strField) -{ - LPITEMIDLIST ret = NULL; - - // Ensure it really is an IDLIST-formatted parameter - // Format for IDLIST params: ":pid:shared" - if (*strField != L':') - return NULL; - - HANDLE hData = (HANDLE) StrToIntW(strField + 1); - PWSTR strSecond = StrChrW(strField + 1, L':'); - - if (strSecond) - { - int pid = StrToIntW(strSecond + 1); - void* pvShared = SHLockShared(hData, pid); - if (pvShared) - { - ret = ILClone((LPCITEMIDLIST) pvShared); - SHUnlockShared(pvShared); - SHFreeShared(hData, pid); - } - } - return ret; -} - -static DWORD Dde_OnExecute(HCONV hconv, HSZ hszTopic, HDDEDATA hdata) -{ - WCHAR szTopic[MAX_PATH]; - WCHAR szCommand[MAX_PATH]; - WCHAR *pszCommand; - - DdeQueryStringW(dwDDEInst, hszTopic, szTopic, _countof(szTopic), CP_WINUNICODE); - - pszCommand = (WCHAR*) DdeAccessData(hdata, NULL); - if (!pszCommand) - return DDE_FNOTPROCESSED; - - StringCchCopyW(szCommand, _countof(szCommand), pszCommand); - - DdeUnaccessData(hdata); - - TRACE("Dde_OnExecute: hconv=%p, topic=%S, command=%S\n", hconv, szTopic, pszCommand); - - /* - [ViewFolder("%l", %I, %S)] -- Open a folder in standard mode - [ExploreFolder("%l", %I, %S)] -- Open a folder in "explore" mode (file tree is shown to the left by default) - [FindFolder("%l", %I)] -- Open a folder in "find" mode (search panel is shown to the left by default) - [ShellFile("%1","%1",%S)] -- Execute the contents of the specified .SCF file - - Approximate grammar (Upper names define rules, <lower> names define terminals, single-quotes are literals): - - Rules - Command = ('[' Function ']') | Function - Function = <identifier> '(' Parameters ')' - Parameters = (<quoted-string> (',' <idlist> (',' <number>)?)?)? - - Terminals - <identifier> = [a-zA-Z]+ - <quoted-string> = \"([^\"]|\\.)\" - <idlist> = \:[0-9]+\:[0-9]+ - <number> = [0-9]+ - */ - - WCHAR Command[MAX_PATH] = L""; - WCHAR Path[MAX_PATH] = L""; - LPITEMIDLIST IdList = NULL; - INT UnknownParameter = 0; - - // Simplified parsing (assumes the command will not be TOO broken): - - PWSTR cmd = szCommand; - // 1. if starts with [, skip first char - if (*cmd == L'[') - cmd++; - - if (*cmd == L']') - { - ERR("Empty command. Nothing to run.\n"); - return DDE_FNOTPROCESSED; - } - - // Read until first (, and take text before ( as command name - { - PWSTR cmdEnd = StrChrW(cmd, L'('); - - if (!cmdEnd) - { - ERR("Could not find '('. Invalid command.\n"); - return DDE_FNOTPROCESSED; - } - - *cmdEnd = 0; - - StringCchCopy(Command, _countof(Command), cmd); - - cmd = cmdEnd + 1; - } - - // Read first param after (, expecting quoted string - if (*cmd != L')') - { - // Copy unescaped string - PWSTR dst = Path; - BOOL isQuote = FALSE; - - PWSTR arg = cmd; - - while (*arg && (isQuote || *arg != L',')) - { - if (*arg == L'"') - { - isQuote = !isQuote; - if (isQuote && arg != cmd) // do not copy the " at the beginning of the string - { - *(dst++) = L'"'; - } - } - else - { - *(dst++) = *arg; - } - - arg++; - } - - cmd = arg + 1; - - while (*cmd == L' ') - cmd++; - } - - // Read second param, expecting an idlist in shared memory - if (*cmd != L')') - { - if (*cmd != ':') - { - ERR("Expected ':'. Invalid command.\n"); - return DDE_FNOTPROCESSED; - } - - PWSTR idlistEnd = StrChrW(cmd, L','); - - if (!idlistEnd) - idlistEnd = StrChrW(cmd, L')'); - - if (!idlistEnd) - { - ERR("Expected ',' or ')'. Invalid command.\n"); - return DDE_FNOTPROCESSED; - } - - IdList = _ILReadFromSharedMemory(cmd); - - cmd = idlistEnd + 1; - } - - // Read third param, expecting an integer - if (*cmd != L')') - { - UnknownParameter = StrToIntW(cmd); - } - - TRACE("Parse end: cmd=%S, S=%d, pidl=%p, path=%S\n", Command, UnknownParameter, IdList, Path); - - // Find handler in list - for (int i = 0; i < HandlerListLength; i++) - { - DDECommandHandler & handler = HandlerList[i]; - if (StrCmpW(handler.Command, Command) == 0) - { - return handler.Handler(Command, Path, IdList, UnknownParameter); - } - } - - // No handler found - ERR("Unknown command %S\n", Command); - return DDE_FNOTPROCESSED; -} - -static void Dde_OnDisconnect(HCONV hconv) -{ - TRACE("Dde_OnDisconnect: hconv=%p\n", hconv); -} - -static HDDEDATA CALLBACK DdeCallback( - UINT uType, - UINT uFmt, - HCONV hconv, - HSZ hsz1, - HSZ hsz2, - HDDEDATA hdata, - ULONG_PTR dwData1, - ULONG_PTR dwData2) -{ - switch (uType) - { - case XTYP_CONNECT: - return (HDDEDATA) (DWORD_PTR) Dde_OnConnect(hsz1, hsz2); - case XTYP_CONNECT_CONFIRM: - Dde_OnConnectConfirm(hconv, hsz1, hsz2); - return NULL; - case XTYP_WILDCONNECT: - return (HDDEDATA) (DWORD_PTR) Dde_OnWildConnect(hsz1, hsz2); - case XTYP_REQUEST: - return Dde_OnRequest(uFmt, hconv, hsz1, hsz2); - case XTYP_EXECUTE: - return (HDDEDATA) (DWORD_PTR) Dde_OnExecute(hconv, hsz1, hdata); - case XTYP_DISCONNECT: - Dde_OnDisconnect(hconv); - return NULL; - case XTYP_REGISTER: - return NULL; - default: - TRACE("DdeCallback: unknown uType=%d\n", uType); - return NULL; - } -} -/************************************************************************* - * ShellDDEInit (SHELL32.@) - * - * Registers the Shell DDE services with the system so that applications - * can use them. - * - * PARAMS - * bInit [I] TRUE to initialize the services, FALSE to uninitialize. - * - * RETURNS - * Nothing. - */ -EXTERN_C void WINAPI ShellDDEInit(BOOL bInit) -{ - TRACE("ShellDDEInit bInit = %s\n", bInit ? "TRUE" : "FALSE"); - - if (bInit && !bInitialized) - { - DdeInitializeW(&dwDDEInst, DdeCallback, CBF_FAIL_ADVISES | CBF_FAIL_POKES, 0); - - hszProgmanTopic = DdeCreateStringHandleW(dwDDEInst, L"Progman", CP_WINUNICODE); - hszProgmanService = DdeCreateStringHandleW(dwDDEInst, L"Progman", CP_WINUNICODE); - hszShell = DdeCreateStringHandleW(dwDDEInst, L"Shell", CP_WINUNICODE); - hszAppProperties = DdeCreateStringHandleW(dwDDEInst, L"AppProperties", CP_WINUNICODE); - hszFolders = DdeCreateStringHandleW(dwDDEInst, L"Folders", CP_WINUNICODE); - - if (hszProgmanTopic && hszProgmanService && - hszShell && hszAppProperties && hszFolders && - DdeNameService(dwDDEInst, hszFolders, 0, DNS_REGISTER) && - DdeNameService(dwDDEInst, hszProgmanService, 0, DNS_REGISTER) && - DdeNameService(dwDDEInst, hszShell, 0, DNS_REGISTER)) - { - bInitialized = TRUE; - } - } - else if (!bInit && bInitialized) - { - /* unregister all services */ - DdeNameService(dwDDEInst, 0, 0, DNS_UNREGISTER); - - if (hszFolders) - DdeFreeStringHandle(dwDDEInst, hszFolders); - if (hszAppProperties) - DdeFreeStringHandle(dwDDEInst, hszAppProperties); - if (hszShell) - DdeFreeStringHandle(dwDDEInst, hszShell); - if (hszProgmanService) - DdeFreeStringHandle(dwDDEInst, hszProgmanService); - if (hszProgmanTopic) - DdeFreeStringHandle(dwDDEInst, hszProgmanTopic); - - DdeUninitialize(dwDDEInst); - - bInitialized = FALSE; - } -} - -static DWORD CALLBACK DDE_OnViewFolder(PWSTR strCommand, PWSTR strPath, LPITEMIDLIST pidl, INT unkS) -{ - UNIMPLEMENTED; - return DDE_FACK; -} - -static DWORD CALLBACK DDW_OnExploreFolder(PWSTR strCommand, PWSTR strPath, LPITEMIDLIST pidl, INT unkS) -{ - UNIMPLEMENTED; - return DDE_FACK; -} - -static DWORD CALLBACK DDE_OnFindFolder(PWSTR strCommand, PWSTR strPath, LPITEMIDLIST pidl, INT unkS) -{ - UNIMPLEMENTED; - return DDE_FNOTPROCESSED; -} - -static DWORD CALLBACK DDE_OnShellFile(PWSTR strCommand, PWSTR strPath, LPITEMIDLIST pidl, INT unkS) -{ - UNIMPLEMENTED; - return DDE_FNOTPROCESSED; -} - -DDECommandHandler HandlerList [] = { - - { L"ViewFolder", DDE_OnViewFolder }, - { L"ExploreFolder", DDW_OnExploreFolder }, - { L"FindFolder", DDE_OnFindFolder }, - { L"ShellFile", DDE_OnShellFile } -}; - -const int HandlerListLength = _countof(HandlerList); Modified: trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h [iso-8859-1] Wed Aug 19 13:51:20 2015 @@ -69,8 +69,6 @@ #pragma warning(pop) #endif -extern HINSTANCE shell32_hInstance; - extern "C" HRESULT WINAPI CStartMenu_Constructor(REFIID riid, void **ppv); extern "C" HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv); extern "C" HRESULT WINAPI CMenuSite_Constructor(REFIID riid, LPVOID *ppv);
9 years, 4 months
1
0
0
0
[gadamopoulos] 68768: [SHELL32] - Add a CDefView_Constructor that lets us keep the code simple for the shell folders.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Wed Aug 19 12:09:21 2015 New Revision: 68768 URL:
http://svn.reactos.org/svn/reactos?rev=68768&view=rev
Log: [SHELL32] - Add a CDefView_Constructor that lets us keep the code simple for the shell folders. Modified: trunk/reactos/dll/win32/shell32/CDefView.cpp trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp trunk/reactos/dll/win32/shell32/folders/CNetFolder.cpp trunk/reactos/dll/win32/shell32/folders/CPrinterFolder.cpp trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp trunk/reactos/dll/win32/shell32/wine/shell32_main.h Modified: trunk/reactos/dll/win32/shell32/CDefView.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CDefView…
============================================================================== --- trunk/reactos/dll/win32/shell32/CDefView.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CDefView.cpp [iso-8859-1] Wed Aug 19 12:09:21 2015 @@ -3110,3 +3110,8 @@ { return ShellObjectCreatorInit<CDefView>(pFolder, IID_IShellView, newView); } + +HRESULT WINAPI CDefView_Constructor(IShellFolder *pFolder, REFIID riid, LPVOID * ppvOut) +{ + return ShellObjectCreatorInit<CDefView>(pFolder, riid, ppvOut); +} Modified: trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp [iso-8859-1] Wed Aug 19 12:09:21 2015 @@ -440,10 +440,7 @@ WARN("IContextMenu not implemented\n"); hr = E_NOTIMPL; } else if (IsEqualIID(riid, IID_IShellView)) { - hr = IShellView_Constructor((IShellFolder *)this, &pShellView); - if (pShellView) { - hr = pShellView->QueryInterface(riid, ppvOut); - } + hr = CDefView_Constructor(this, riid, ppvOut); } } TRACE("--(%p)->(interface=%p)\n", this, ppvOut); Modified: trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp [iso-8859-1] Wed Aug 19 12:09:21 2015 @@ -323,11 +323,7 @@ } else if (IsEqualIID(riid, IID_IShellView)) { - hr = IShellView_Constructor ((IShellFolder *)this, &pShellView); - if (pShellView) - { - hr = pShellView->QueryInterface(riid, ppvOut); - } + hr = CDefView_Constructor(this, riid, ppvOut); } TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut); return hr; Modified: trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp [iso-8859-1] Wed Aug 19 12:09:21 2015 @@ -345,11 +345,7 @@ } else if (IsEqualIID (riid, IID_IShellView)) { - hr = IShellView_Constructor ((IShellFolder *)this, &pShellView); - if (pShellView) - { - hr = pShellView->QueryInterface(riid, ppvOut); - } + hr = CDefView_Constructor(this, riid, ppvOut); } } TRACE("-- (%p)->(interface=%p)\n", this, ppvOut); Modified: trunk/reactos/dll/win32/shell32/folders/CNetFolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CNetFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CNetFolder.cpp [iso-8859-1] Wed Aug 19 12:09:21 2015 @@ -158,11 +158,7 @@ } else if (IsEqualIID(riid, IID_IShellView)) { - hr = IShellView_Constructor((IShellFolder *)this, &pShellView); - if (pShellView) - { - hr = pShellView->QueryInterface(riid, ppvOut); - } + hr = CDefView_Constructor(this, riid, ppvOut); } TRACE("-- (%p)->(interface=%p)\n", this, ppvOut); return hr; Modified: trunk/reactos/dll/win32/shell32/folders/CPrinterFolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CPrinterFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CPrinterFolder.cpp [iso-8859-1] Wed Aug 19 12:09:21 2015 @@ -426,11 +426,7 @@ } else if(IsEqualIID(riid, IID_IShellView)) { - hr = IShellView_Constructor((IShellFolder *)this, &pShellView); - if (pShellView) - { - hr = pShellView->QueryInterface(riid, ppvOut); - } + hr = CDefView_Constructor(this, riid, ppvOut); } TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut); return hr; Modified: trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CRecycleBin.cpp [iso-8859-1] Wed Aug 19 12:09:21 2015 @@ -528,11 +528,7 @@ } else if (IsEqualIID (riid, IID_IShellView)) { - hr = IShellView_Constructor ((IShellFolder *)this, &pShellView); - if (pShellView) - { - hr = pShellView->QueryInterface(riid, ppv); - } + hr = CDefView_Constructor(this, riid, ppv); } else return hr; Modified: trunk/reactos/dll/win32/shell32/wine/shell32_main.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/wine/she…
============================================================================== --- trunk/reactos/dll/win32/shell32/wine/shell32_main.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/wine/shell32_main.h [iso-8859-1] Wed Aug 19 12:09:21 2015 @@ -70,6 +70,7 @@ IContextMenu2 * ISvStaticItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *apidl, UINT cidl, HKEY hKey); IContextMenu2 * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent, BOOL bDesktop); HRESULT WINAPI IShellView_Constructor(IShellFolder *pFolder, IShellView **newView); +HRESULT WINAPI CDefView_Constructor(IShellFolder *pFolder, REFIID riid, LPVOID * ppvOut); HRESULT WINAPI IShellLink_ConstructFromFile(IUnknown * pUnkOuter, REFIID riid, LPCITEMIDLIST pidl, LPVOID * ppv); HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC *ppV);
9 years, 4 months
1
0
0
0
[tfaber] 68767: [SHELL32] - Correctly handle NULL callback in CMenuBand::GetMenuInfo - Add missing error handling in CMenuFocusManager::UpdateFocus Fixes crashes in shell32_apitest:menu CORE-9932 #...
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Aug 19 11:45:21 2015 New Revision: 68767 URL:
http://svn.reactos.org/svn/reactos?rev=68767&view=rev
Log: [SHELL32] - Correctly handle NULL callback in CMenuBand::GetMenuInfo - Add missing error handling in CMenuFocusManager::UpdateFocus Fixes crashes in shell32_apitest:menu CORE-9932 #resolve Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp [iso-8859-1] Wed Aug 19 11:45:21 2015 @@ -108,7 +108,8 @@ if (ppsmc) { - m_psmc->AddRef(); + if (m_psmc) + m_psmc->AddRef(); *ppsmc = m_psmc; } Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp [iso-8859-1] Wed Aug 19 11:45:21 2015 @@ -814,14 +814,22 @@ CComPtr<IServiceProvider> bandSite; CComPtr<IOleWindow> deskBar; hr = topMenu->mb->GetSite(IID_PPV_ARG(IServiceProvider, &bandSite)); + if (FAILED(hr)) + goto NoCapture; hr = bandSite->QueryService(SID_SMenuPopup, IID_PPV_ARG(IOleWindow, &deskBar)); + if (FAILED(hr)) + goto NoCapture; CComPtr<IOleWindow> deskBarSite; hr = IUnknown_GetSite(deskBar, IID_PPV_ARG(IOleWindow, &deskBarSite)); + if (FAILED(hr)) + goto NoCapture; // FIXME: Find the correct place for this HWND hWndOwner; - deskBarSite->GetWindow(&hWndOwner); + hr = deskBarSite->GetWindow(&hWndOwner); + if (FAILED(hr)) + goto NoCapture; m_PreviousForeground = ::GetForegroundWindow(); if (m_PreviousForeground != hWndOwner) @@ -832,9 +840,11 @@ // Get the HWND of the top-level window HWND hWndSite; hr = deskBar->GetWindow(&hWndSite); + if (FAILED(hr)) + goto NoCapture; SetMenuCapture(hWndSite); - - } + } +NoCapture: if (!m_parent || m_parent->type == MenuBarEntry) {
9 years, 4 months
1
0
0
0
[tfaber] 68766: [RSHELL] - Remove from CD images. Explorer can use shell32 now. CORE-9892 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Aug 19 11:24:20 2015 New Revision: 68766 URL:
http://svn.reactos.org/svn/reactos?rev=68766&view=rev
Log: [RSHELL] - Remove from CD images. Explorer can use shell32 now. CORE-9892 #resolve Modified: trunk/reactos/base/shell/rshell/CMakeLists.txt Modified: trunk/reactos/base/shell/rshell/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMakeLis…
============================================================================== --- trunk/reactos/base/shell/rshell/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/base/shell/rshell/CMakeLists.txt [iso-8859-1] Wed Aug 19 11:24:20 2015 @@ -35,8 +35,6 @@ kernel32 ntdll) -add_cd_file(TARGET rshell DESTINATION reactos FOR all) - add_custom_command(TARGET rshell POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:rshell>"
9 years, 4 months
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
31
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Results per page:
10
25
50
100
200