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
[tfaber] 68765: [RSHELL] - Addendum to r68764 CORE-9892
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Aug 19 11:18:13 2015 New Revision: 68765 URL:
http://svn.reactos.org/svn/reactos?rev=68765&view=rev
Log: [RSHELL] - Addendum to r68764 CORE-9892 Modified: trunk/reactos/base/shell/rshell/misc.cpp 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 11:18:13 2015 @@ -19,6 +19,8 @@ */ #include "shellmenu.h" + +HINSTANCE shell32_hInstance = NULL; DWORD WINAPI WinList_Init(void) {
9 years, 4 months
1
0
0
0
[tfaber] 68764: [SHELL32] - Use and register the shellmenu (former rshell) classes instead of the outdated copies in shell32 CORE-9892
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Aug 19 11:17:08 2015 New Revision: 68764 URL:
http://svn.reactos.org/svn/reactos?rev=68764&view=rev
Log: [SHELL32] - Use and register the shellmenu (former rshell) classes instead of the outdated copies in shell32 CORE-9892 Added: trunk/reactos/dll/win32/shell32/res/rgs/mergedfolder.rgs (with props) trunk/reactos/dll/win32/shell32/res/rgs/rebarbandsite.rgs (with props) Removed: trunk/reactos/dll/win32/shell32/CMenuBand.cpp trunk/reactos/dll/win32/shell32/CMenuBand.h trunk/reactos/dll/win32/shell32/CMenuDeskBar.cpp trunk/reactos/dll/win32/shell32/CMenuDeskBar.h trunk/reactos/dll/win32/shell32/CStartMenu.cpp trunk/reactos/dll/win32/shell32/CStartMenu.h Modified: trunk/reactos/dll/win32/shell32/CMakeLists.txt trunk/reactos/dll/win32/shell32/iconcache.cpp trunk/reactos/dll/win32/shell32/precomp.h trunk/reactos/dll/win32/shell32/rgs_res.rc trunk/reactos/dll/win32/shell32/shell32.cpp trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.h trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.h trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.h trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.h trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.h trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h trunk/reactos/dll/win32/shell32/shresdef.h 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 11:17:08 2015 @@ -18,8 +18,6 @@ ${REACTOS_SOURCE_DIR}) list(APPEND SOURCE - CMenuBand.cpp - CMenuDeskBar.cpp CIDLDataObj.cpp CQueryAssociations.cpp dde.cpp @@ -60,7 +58,6 @@ CDefaultContextMenu.cpp COpenWithMenu.cpp CNewMenu.cpp - CStartMenu.cpp precomp.h) add_library(shell32 SHARED @@ -85,8 +82,8 @@ ${CMAKE_CURRENT_BINARY_DIR}/shell32.def) set_module_type(shell32 win32dll UNICODE HOTPATCHABLE) -target_link_libraries(shell32 atlnew wine uuid recyclebin) -add_delay_importlibs(shell32 ole32 userenv version fmifs) +target_link_libraries(shell32 shellmenu 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) add_cd_file(TARGET shell32 DESTINATION reactos/system32 FOR all) Removed: trunk/reactos/dll/win32/shell32/CMenuBand.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CMenuBan…
============================================================================== --- trunk/reactos/dll/win32/shell32/CMenuBand.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CMenuBand.cpp (removed) @@ -1,600 +0,0 @@ -/* - * PROJECT: shell32 - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/shell32/CMenuBand.c - * PURPOSE: menu band implementation - * PROGRAMMERS: Giannis Adamopoulos (gadamopoulos(a)reactos.org) - */ - -#include "precomp.h" - -#include <windowsx.h> - -WINE_DEFAULT_DEBUG_CHANNEL(CMenuBand); - - -BOOL -AllocAndGetMenuString(HMENU hMenu, UINT ItemIDByPosition, WCHAR** String) -{ - int Length; - - Length = GetMenuStringW(hMenu, ItemIDByPosition, NULL, 0, MF_BYPOSITION); - - if(!Length) - return FALSE; - - /* Also allocate space for the terminating NULL character */ - ++Length; - *String = (PWSTR)HeapAlloc(GetProcessHeap(), 0, Length * sizeof(WCHAR)); - - GetMenuStringW(hMenu, ItemIDByPosition, *String, Length, MF_BYPOSITION); - - return TRUE; -} - -CMenuStaticToolbar::CMenuStaticToolbar(CMenuBand *menuBand) -{ - m_menuBand = menuBand; - - - m_menuBand = NULL; - m_hwnd = NULL; - m_hmenu = NULL; - m_hwndOwner = NULL; - m_dwMenuFlags = NULL; -} - -HRESULT CMenuStaticToolbar::GetMenu( - HMENU *phmenu, - HWND *phwnd, - DWORD *pdwFlags) -{ - *phmenu = m_hmenu; - *phwnd = m_hwndOwner; - *pdwFlags = m_dwMenuFlags; - - return S_OK; -} - -HRESULT CMenuStaticToolbar::SetMenu( - HMENU hmenu, - HWND hwnd, - DWORD dwFlags) -{ - if (!hwnd) - return E_FAIL; - - m_hmenu = hmenu; - m_hwndOwner = hwnd; - m_dwMenuFlags = dwFlags; - - return S_OK; -} - -HRESULT CMenuStaticToolbar::ShowWindow(BOOL fShow) -{ - ::ShowWindow(m_hwnd, fShow ? SW_SHOW : SW_HIDE); - - return S_OK; -} - -HRESULT CMenuStaticToolbar::Close() -{ - DestroyWindow(m_hwnd); - m_hwnd = NULL; - return S_OK; -} - -HRESULT CMenuStaticToolbar::CreateToolbar(HWND hwndParent, DWORD dwFlags) -{ - HWND hwndToolbar; - hwndToolbar = CreateWindowEx(TBSTYLE_EX_DOUBLEBUFFER, TOOLBARCLASSNAMEW, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | - WS_CLIPCHILDREN | TBSTYLE_TOOLTIPS | TBSTYLE_TRANSPARENT | TBSTYLE_REGISTERDROP | TBSTYLE_LIST | TBSTYLE_FLAT | - CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_TOP, 0, 0, 500, 20, m_hwndOwner, NULL, - _AtlBaseModule.GetModuleInstance(), 0); - if (hwndToolbar == NULL) - return E_FAIL; - - ::SetParent(hwndToolbar, hwndParent); - - m_hwnd = hwndToolbar; - - /* Identify the version of the used Common Controls DLL by sending the size of the TBBUTTON structure */ - SendMessageW(m_hwnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); - - if (dwFlags & SMINIT_TOPLEVEL) - { - /* Hide the placeholders for the button images */ - SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, 0); - } - - return S_OK; -} - -HRESULT CMenuStaticToolbar::FillToolbar() -{ - TBBUTTON tbb = {0}; - int i; - PWSTR MenuString; - - tbb.fsState = TBSTATE_ENABLED; - tbb.fsStyle = BTNS_DROPDOWN | BTNS_AUTOSIZE; - - for(i = 0; i < GetMenuItemCount(m_hmenu); i++) - { - if(!AllocAndGetMenuString(m_hmenu, i, &MenuString)) - return E_OUTOFMEMORY; - - tbb.idCommand = i; - tbb.iString = (INT_PTR)MenuString; - - SendMessageW(m_hwnd, TB_ADDBUTTONS, 1, (LPARAM)(LPTBBUTTON)&tbb); - HeapFree(GetProcessHeap(), 0, MenuString); - } - - return S_OK; -} - -HRESULT CMenuStaticToolbar::GetWindow(HWND *phwnd) -{ - if (!phwnd) - return E_FAIL; - - *phwnd = m_hwnd; - - return S_OK; -} - -CMenuBand::CMenuBand() -{ - m_site = NULL; - m_psmc = NULL; - m_staticToolbar = NULL; -} - -CMenuBand::~CMenuBand() -{ - if (m_site) - m_site->Release(); - - if (m_psmc) - m_psmc->Release(); - - if (m_staticToolbar) - delete m_staticToolbar; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::Initialize( - IShellMenuCallback *psmc, - UINT uId, - UINT uIdAncestor, - DWORD dwFlags) -{ - if(m_psmc) - m_psmc->Release(); - - m_psmc = psmc; - m_uId = uId; - m_uIdAncestor = uIdAncestor; - m_dwFlags = dwFlags; - - if (m_psmc) - m_psmc->AddRef(); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetMenuInfo( - IShellMenuCallback **ppsmc, - UINT *puId, - UINT *puIdAncestor, - DWORD *pdwFlags) -{ - *ppsmc = m_psmc; - *puId = m_uId; - *puIdAncestor = m_uIdAncestor; - *pdwFlags = m_dwFlags; - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetMenu( - HMENU hmenu, - HWND hwnd, - DWORD dwFlags) -{ - if (m_staticToolbar == NULL) - m_staticToolbar = new CMenuStaticToolbar(this); - - HRESULT hResult = m_staticToolbar->SetMenu(hmenu, hwnd, dwFlags); - if (FAILED(hResult)) - return hResult; - - if (m_site) - { - HWND hwndParent; - - hResult = m_site->GetWindow(&hwndParent); - if (FAILED(hResult)) - return hResult; - - hResult = m_staticToolbar->CreateToolbar(hwndParent, m_dwFlags); - if (FAILED(hResult)) - return hResult; - - hResult = m_staticToolbar->FillToolbar(); - } - - return hResult; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetMenu( - HMENU *phmenu, - HWND *phwnd, - DWORD *pdwFlags) -{ - if (m_staticToolbar == NULL) - return E_FAIL; - - return m_staticToolbar->GetMenu(phmenu, phwnd, pdwFlags); -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetSite(IUnknown *pUnkSite) -{ - HWND hwndParent; - HRESULT hResult; - - if (m_site != NULL) - m_site->Release(); - - if (pUnkSite == NULL) - return S_OK; - - hwndParent = NULL; - hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &m_site)); - if (SUCCEEDED(hResult)) - { - m_site->GetWindow(&hwndParent); - m_site->Release(); - } - if (!::IsWindow(hwndParent)) - return E_FAIL; - - if (m_staticToolbar != NULL) - { - m_staticToolbar->CreateToolbar(hwndParent, m_dwFlags); - m_staticToolbar->FillToolbar(); - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetSite(REFIID riid, PVOID *ppvSite) -{ - if (m_site == NULL) - return E_FAIL; - - return m_site->QueryInterface(riid, ppvSite); -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetWindow( - HWND *phwnd) -{ - if (m_staticToolbar != NULL) - return m_staticToolbar->GetWindow(phwnd); - - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetBandInfo( - DWORD dwBandID, - DWORD dwViewMode, - DESKBANDINFO *pdbi) -{ - SIZE size; - HWND hwnd; - HRESULT hResult; - - /* FIXME */ - if (m_staticToolbar == NULL) - return E_FAIL; - hResult = m_staticToolbar->GetWindow(&hwnd); - if (FAILED(hResult)) - return hResult; - if (hwnd == NULL) - return E_FAIL; - - if (pdbi->dwMask & DBIM_MINSIZE) - { - SendMessageW( hwnd, TB_GETIDEALSIZE, TRUE, (LPARAM)&size); - - pdbi->ptMinSize.x = 0; - pdbi->ptMinSize.y = size.cy; - } - if (pdbi->dwMask & DBIM_MAXSIZE) - { - SendMessageW( hwnd, TB_GETMAXSIZE, 0, (LPARAM)&size); - - pdbi->ptMaxSize.x = size.cx; - pdbi->ptMaxSize.y = size.cy; - } - if (pdbi->dwMask & DBIM_INTEGRAL) - { - pdbi->ptIntegral.x = 0; - pdbi->ptIntegral.y = 0; - } - if (pdbi->dwMask & DBIM_ACTUAL) - { - SendMessageW( hwnd, TB_GETIDEALSIZE, TRUE, (LPARAM)&size); - SendMessageW( hwnd, TB_GETIDEALSIZE, FALSE, (LPARAM)&size); - - pdbi->ptActual.x = size.cx; - pdbi->ptActual.y = size.cy; - } - if (pdbi->dwMask & DBIM_TITLE) - wcscpy(pdbi->wszTitle, L""); - if (pdbi->dwMask & DBIM_MODEFLAGS) - pdbi->dwModeFlags = DBIMF_UNDELETEABLE; - if (pdbi->dwMask & DBIM_BKCOLOR) - pdbi->crBkgnd = 0; - return S_OK; -} - -/* IDockingWindow */ -HRESULT STDMETHODCALLTYPE CMenuBand::ShowDW(BOOL fShow) -{ - if (m_staticToolbar != NULL) - return m_staticToolbar->ShowWindow(fShow); - - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::CloseDW(DWORD dwReserved) -{ - ShowDW(FALSE); - - if (m_staticToolbar != NULL) - return m_staticToolbar->Close(); - - return S_OK; -} -HRESULT STDMETHODCALLTYPE CMenuBand::ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::ContextSensitiveHelp(BOOL fEnterMode) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::UIActivateIO(BOOL fActivate, LPMSG lpMsg) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::HasFocusIO() -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::TranslateAcceleratorIO(LPMSG lpMsg) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::IsDirty() -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::Load(IStream *pStm) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::Save(IStream *pStm, BOOL fClearDirty) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetSizeMax(ULARGE_INTEGER *pcbSize) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetClassID(CLSID *pClassID) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::OnSelect(DWORD dwSelectType) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetSubMenu(IMenuPopup *pmp, BOOL fSet) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetClient(IUnknown *punkClient) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetClient(IUnknown **ppunkClient) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::OnPosRectChangeDB(RECT *prc) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::IsMenuMessage(MSG *pmsg) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::TranslateMenuMessage(MSG *pmsg, LRESULT *plRet) -{ - UNIMPLEMENTED; - return S_FALSE; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::InvalidateItem(LPSMDATA psmd, DWORD dwFlags) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetState(LPSMDATA psmd) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetMenuToolbar(IUnknown *punk, DWORD dwFlags) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::IsWindowOwner(HWND hWnd) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetSubMenu(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetToolbar(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetMinWidth(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetNoBorder(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::SetTheme(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetTop(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetBottom(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetTracked(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetParentSite(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::GetState(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::DoDefaultAction(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBand::IsEmpty(THIS) -{ - UNIMPLEMENTED; - return S_OK; -} - Removed: trunk/reactos/dll/win32/shell32/CMenuBand.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CMenuBan…
============================================================================== --- trunk/reactos/dll/win32/shell32/CMenuBand.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CMenuBand.h (removed) @@ -1,164 +0,0 @@ -#pragma once - -class CMenuBand; - -class CMenuStaticToolbar -{ -public: - CMenuStaticToolbar(CMenuBand *menuBand); - - HRESULT CreateToolbar(HWND hwndParent, DWORD dwFlags); - HRESULT FillToolbar(); - HRESULT GetWindow(HWND *phwnd); - HRESULT SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags); - HRESULT GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags); - HRESULT ShowWindow(BOOL fShow); - HRESULT Close(); - -private: - - static const UINT WM_USER_SHOWPOPUPMENU = WM_USER + 1; - - CMenuBand *m_menuBand; - HWND m_hwnd; - HMENU m_hmenu; - HWND m_hwndOwner; - DWORD m_dwMenuFlags; -}; - -class CMenuBand : - public CComCoClass<CMenuBand, &CLSID_MenuBand>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IDeskBand, - public IObjectWithSite, - public IInputObject, - public IPersistStream, - public IOleCommandTarget, - public IServiceProvider, - public IMenuPopup, - public IMenuBand, - public IShellMenu2, - public IWinEventHandler, - public IShellMenuAcc -{ -public: - CMenuBand(); - ~CMenuBand(); - -private: - - IOleWindow *m_site; - CMenuStaticToolbar *m_staticToolbar; - - IShellMenuCallback *m_psmc; - UINT m_uId; - UINT m_uIdAncestor; - DWORD m_dwFlags; -public : - - // *** IDeskBand methods *** - virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi); - - // *** IDockingWindow methods *** - virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow); - virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved); - virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved); - - // *** IOleWindow methods *** - virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd); - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); - - // *** IObjectWithSite methods *** - virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite); - virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite); - - // *** IInputObject methods *** - virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg); - virtual HRESULT STDMETHODCALLTYPE HasFocusIO(); - virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg); - - // *** IPersistStream methods *** - virtual HRESULT STDMETHODCALLTYPE IsDirty(); - virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm); - virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty); - virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize); - - // *** IPersist methods *** - virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID); - - // *** IOleCommandTarget methods *** - virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); - virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); - - // *** IServiceProvider methods *** - virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); - - // *** IMenuPopup methods *** - virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags); - virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType); - virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet); - - // *** IDeskBar methods *** - virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient); - virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient); - virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(RECT *prc); - - // *** IMenuBand methods *** - virtual HRESULT STDMETHODCALLTYPE IsMenuMessage(MSG *pmsg); - virtual HRESULT STDMETHODCALLTYPE TranslateMenuMessage(MSG *pmsg, LRESULT *plRet); - - // *** IShellMenu methods *** - virtual HRESULT STDMETHODCALLTYPE Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor,DWORD dwFlags); - virtual HRESULT STDMETHODCALLTYPE GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags); - virtual HRESULT STDMETHODCALLTYPE SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags); - virtual HRESULT STDMETHODCALLTYPE GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv); - virtual HRESULT STDMETHODCALLTYPE SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags); - virtual HRESULT STDMETHODCALLTYPE GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags); - virtual HRESULT STDMETHODCALLTYPE InvalidateItem(LPSMDATA psmd, DWORD dwFlags); - virtual HRESULT STDMETHODCALLTYPE GetState(LPSMDATA psmd); - virtual HRESULT STDMETHODCALLTYPE SetMenuToolbar(IUnknown *punk, DWORD dwFlags); - - // *** IWinEventHandler methods *** - virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult); - virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd); - - // *** IShellMenu2 methods *** - virtual HRESULT STDMETHODCALLTYPE GetSubMenu(THIS); - virtual HRESULT STDMETHODCALLTYPE SetToolbar(THIS); - virtual HRESULT STDMETHODCALLTYPE SetMinWidth(THIS); - virtual HRESULT STDMETHODCALLTYPE SetNoBorder(THIS); - virtual HRESULT STDMETHODCALLTYPE SetTheme(THIS); - - // *** IShellMenuAcc methods *** - virtual HRESULT STDMETHODCALLTYPE GetTop(THIS); - virtual HRESULT STDMETHODCALLTYPE GetBottom(THIS); - virtual HRESULT STDMETHODCALLTYPE GetTracked(THIS); - virtual HRESULT STDMETHODCALLTYPE GetParentSite(THIS); - virtual HRESULT STDMETHODCALLTYPE GetState(THIS); - virtual HRESULT STDMETHODCALLTYPE DoDefaultAction(THIS); - virtual HRESULT STDMETHODCALLTYPE IsEmpty(THIS); - -DECLARE_REGISTRY_RESOURCEID(IDR_MENUBAND) -DECLARE_NOT_AGGREGATABLE(CMenuBand) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CMenuBand) - COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup) - COM_INTERFACE_ENTRY_IID(IID_IShellMenu, IShellMenu) - COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) - COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IDeskBand) - COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow) - COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand) - COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) - COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject) - COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) - COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersistStream) - COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) - COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup) - COM_INTERFACE_ENTRY_IID(IID_IMenuBand, IMenuBand) - COM_INTERFACE_ENTRY_IID(IID_IShellMenu2, IShellMenu2) - COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler) - COM_INTERFACE_ENTRY_IID(IID_IShellMenuAcc, IShellMenuAcc) -END_COM_MAP() - -}; Removed: trunk/reactos/dll/win32/shell32/CMenuDeskBar.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CMenuDes…
============================================================================== --- trunk/reactos/dll/win32/shell32/CMenuDeskBar.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CMenuDeskBar.cpp (removed) @@ -1,137 +0,0 @@ -#include "precomp.h" - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup( - POINTL *ppt, - RECTL *prcExclude, - MP_POPUPFLAGS dwFlags) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnSelect( - DWORD dwSelectType) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetSubMenu( - IMenuPopup *pmp, - BOOL fSet) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetClient( - IUnknown *punkClient) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetClient( - IUnknown **ppunkClient) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnPosRectChangeDB( - RECT *prc) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetWindow( - HWND *phwnd) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::ContextSensitiveHelp( - BOOL fEnterMode) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetSite( - IUnknown *pUnkSite) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetSite( - REFIID riid, - PVOID *ppvSite) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetIconSize(THIS_ DWORD iIcon) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetIconSize(THIS_ DWORD* piIcon) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetBitmap(THIS_ HBITMAP hBitmap) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetBitmap(THIS_ HBITMAP* phBitmap) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::Initialize(THIS) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::QueryStatus( - const GUID *pguidCmdGroup, - ULONG cCmds, - OLECMD prgCmds[], - OLECMDTEXT *pCmdText) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::Exec( - const GUID *pguidCmdGroup, - DWORD nCmdID, - DWORD nCmdexecopt, - VARIANT *pvaIn, - VARIANT *pvaOut) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::QueryService( - REFGUID guidService, - REFIID riid, - void **ppvObject) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnFocusChangeIS(THIS_ IUnknown * lpUnknown, BOOL bFocus) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::UIActivateIO(THIS_ BOOL bActivating, LPMSG lpMsg) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::HasFocusIO(THIS) -{ - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuDeskBar::TranslateAcceleratorIO(THIS_ LPMSG lpMsg) -{ - return S_OK; -} Removed: trunk/reactos/dll/win32/shell32/CMenuDeskBar.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CMenuDes…
============================================================================== --- trunk/reactos/dll/win32/shell32/CMenuDeskBar.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CMenuDeskBar.h (removed) @@ -1,76 +0,0 @@ -#pragma once - -class CMenuDeskBar: - public CComCoClass<CMenuDeskBar, &CLSID_MenuDeskBar>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IOleCommandTarget, - public IServiceProvider, - public IInputObjectSite, - public IInputObject, - public IMenuPopup, - public IObjectWithSite, - public IBanneredBar, - public IInitializeObject -{ -public: - - // *** IMenuPopup methods *** - virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags); - virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType); - virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp,BOOL fSet); - - // *** IDeskBar methods *** - virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient); - virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient); - virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(RECT *prc); - - // *** IOleWindow methods *** - virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd); - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); - - // *** IObjectWithSite methods *** - virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite); - virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid,PVOID *ppvSite); - - // *** IBanneredBar methods *** - virtual HRESULT STDMETHODCALLTYPE SetIconSize(THIS_ DWORD iIcon); - virtual HRESULT STDMETHODCALLTYPE GetIconSize(THIS_ DWORD* piIcon); - virtual HRESULT STDMETHODCALLTYPE SetBitmap(THIS_ HBITMAP hBitmap); - virtual HRESULT STDMETHODCALLTYPE GetBitmap(THIS_ HBITMAP* phBitmap); - - // *** IInitializeObject methods *** - virtual HRESULT STDMETHODCALLTYPE Initialize(THIS); - - // *** IOleCommandTarget methods *** - virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText); - virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); - - // *** IServiceProvider methods *** - virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); - - // *** IInputObjectSite methods *** - virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(THIS_ LPUNKNOWN lpUnknown, BOOL bFocus); - - // *** IInputObject methods *** - virtual HRESULT STDMETHODCALLTYPE UIActivateIO(THIS_ BOOL bActivating, LPMSG lpMsg); - virtual HRESULT STDMETHODCALLTYPE HasFocusIO(THIS); - virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(THIS_ LPMSG lpMsg); - -DECLARE_REGISTRY_RESOURCEID(IDR_MENUDESKBAR) -DECLARE_NOT_AGGREGATABLE(CMenuDeskBar) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CMenuDeskBar) - COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup) - COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) - COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) - COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite) - COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject) - COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup) - COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IMenuPopup) - COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) - COM_INTERFACE_ENTRY_IID(IID_IBanneredBar, IBanneredBar) - COM_INTERFACE_ENTRY_IID(IID_IInitializeObject, IInitializeObject) -END_COM_MAP() - -}; Removed: trunk/reactos/dll/win32/shell32/CStartMenu.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CStartMe…
============================================================================== --- trunk/reactos/dll/win32/shell32/CStartMenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CStartMenu.cpp (removed) @@ -1,345 +0,0 @@ -/* - * Start menu object - * - * Copyright 2009 Andrew Hill - * - * 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(shell32start); - -CStartMenu::CStartMenu() : - m_pBandSite(NULL), - m_pUnkSite(NULL) -{ -} - -CStartMenu::~CStartMenu() -{ -} - -HRESULT STDMETHODCALLTYPE CStartMenu::ContextSensitiveHelp(BOOL fEnterMode) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CStartMenu::GetWindow(HWND *phwnd) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CStartMenu::GetClient(IUnknown **ppunkClient) -{ - TRACE("(%p, %p)\n", this, ppunkClient); - - *ppunkClient = (IUnknown*)m_pBandSite; - (*ppunkClient)->AddRef(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CStartMenu::OnPosRectChangeDB(LPRECT prc) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CStartMenu::SetClient(IUnknown *punkClient) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CStartMenu::OnSelect(DWORD dwSelectType) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CStartMenu::Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CStartMenu::SetSubMenu(IMenuPopup *pmp, BOOL fSet) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CStartMenu::SetSite(IUnknown *pUnkSite) -{ - TRACE("(%p, %p)\n", this, pUnkSite); - - if (m_pUnkSite) - m_pUnkSite->Release(); - m_pUnkSite = pUnkSite; - if (m_pUnkSite) - m_pUnkSite->AddRef(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CStartMenu::GetSite(REFIID riid, void **ppvSite) -{ - TRACE("(%p, %s, %p)\n", this, debugstr_guid(&riid), ppvSite); - - if (!m_pUnkSite) - return E_FAIL; - - return m_pUnkSite->QueryInterface(riid, ppvSite); -} - -HRESULT STDMETHODCALLTYPE CStartMenu::Initialize() -{ - HRESULT hr; - CComObject<CMenuBandSite> *pBandSiteObj; - - TRACE("(%p)\n", this); - - //pBandSiteObj = new CComObject<CMenuBandSite>(); - ATLTRY (pBandSiteObj = new CComObject<CMenuBandSite>); - if (pBandSiteObj == NULL) - return E_OUTOFMEMORY; - - hr = pBandSiteObj->QueryInterface(IID_PPV_ARG(IBandSite, &m_pBandSite)); - if (FAILED(hr)) - return NULL; - - return m_pBandSite->AddBand((IMenuBand*)this); -} - -HRESULT STDMETHODCALLTYPE CStartMenu::IsMenuMessage(MSG *pmsg) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CStartMenu::TranslateMenuMessage(MSG *pmsg, LRESULT *plRet) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -CMenuBandSite::CMenuBandSite() : - m_pObjects(NULL), - m_cObjects(0) -{ -} - -CMenuBandSite::~CMenuBandSite() -{ -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::AddBand(IUnknown *punk) -{ - IUnknown **pObjects; - - TRACE("punk %p\n", punk); - - if (!punk) - return E_FAIL; - - pObjects = (IUnknown**)CoTaskMemAlloc(sizeof(IUnknown*) * (m_cObjects + 1)); - if (!pObjects) - return E_FAIL; - - RtlMoveMemory(pObjects, m_pObjects, sizeof(IUnknown*) * m_cObjects); - - CoTaskMemFree(m_pObjects); - - m_pObjects = pObjects; - - m_pObjects[m_cObjects] = punk; - punk->AddRef(); - - m_cObjects++; - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::EnumBands(UINT uBand, DWORD *pdwBandID) -{ - ULONG Index, ObjectCount; - - TRACE("uBand %uu pdwBandID %p\n", uBand, pdwBandID); - - if (uBand == (UINT)-1) - return m_cObjects; - - ObjectCount = 0; - - for (Index = 0; Index < m_cObjects; Index++) - { - if (m_pObjects[Index] != NULL) - { - if (uBand == ObjectCount) - { - *pdwBandID = Index; - return S_OK; - } - ObjectCount++; - } - } - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::RemoveBand(DWORD dwBandID) -{ - TRACE("dwBandID %u\n", dwBandID); - - if (m_cObjects <= dwBandID) - return E_FAIL; - - if (m_pObjects[dwBandID]) - { - m_pObjects[dwBandID]->Release(); - m_pObjects[dwBandID] = NULL; - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv) -{ - TRACE("dwBandID %u riid %p ppv %p\n", dwBandID, riid, ppv); - - if (m_cObjects <= dwBandID) - return E_FAIL; - - if (m_pObjects[dwBandID]) - { - return m_pObjects[dwBandID]->QueryInterface(riid, ppv); - } - - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::SetBandSiteInfo(const BANDSITEINFO *pbsinfo) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::GetBandSiteInfo(BANDSITEINFO *pbsinfo) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::GetWindow(HWND *phwnd) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::ContextSensitiveHelp(BOOL fEnterMode) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::SetDeskBarSite(IUnknown *punkSite) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::SetModeDBC(DWORD dwMode) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::UIActivateDBC(DWORD dwState) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::GetSize(DWORD dwWhich, LPRECT prc) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::UIActivateIO(BOOL fActivate, LPMSG lpMsg) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::HasFocusIO() -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::TranslateAcceleratorIO(LPMSG lpMsg) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::OnWinEvent(HWND paramC, UINT param10, WPARAM param14, LPARAM param18, LRESULT *param1C) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::IsWindowOwner(HWND paramC) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CMenuBandSite::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) -{ - UNIMPLEMENTED; - return E_NOTIMPL; -} Removed: trunk/reactos/dll/win32/shell32/CStartMenu.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CStartMe…
============================================================================== --- trunk/reactos/dll/win32/shell32/CStartMenu.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CStartMenu.h (removed) @@ -1,155 +0,0 @@ -/* - * Start menu object - * - * Copyright 2009 Andrew Hill - * - * 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 _STARTMENU_H_ -#define _STARTMENU_H_ - -class CStartMenu : - public CComCoClass<CStartMenu, &CLSID_StartMenu>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IMenuPopup, - public IObjectWithSite, - public IInitializeObject, - public IMenuBand // FIXME -{ -private: - IBandSite *m_pBandSite; - IUnknown *m_pUnkSite; - -public: - CStartMenu(); - ~CStartMenu(); - - // *** IOleWindow methods *** - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); - virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd); - - // *** IDeskBar methods *** - virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient); - virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(LPRECT prc); - virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient); - - // *** IMenuPopup methods *** - virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType); - virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags); - virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet); - - // *** IObjectWithSite methods *** - virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite); - virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite); - - // *** IInitializeObject methods *** - virtual HRESULT STDMETHODCALLTYPE Initialize(); - - // *** IMenuBand methods *** FIXME - virtual HRESULT STDMETHODCALLTYPE IsMenuMessage(MSG *pmsg); - virtual HRESULT STDMETHODCALLTYPE TranslateMenuMessage(MSG *pmsg, LRESULT *plRet); - -DECLARE_REGISTRY_RESOURCEID(IDR_STARTMENU) -DECLARE_NOT_AGGREGATABLE(CStartMenu) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CStartMenu) - COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) - COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IDeskBar) - COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup) - COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) - COM_INTERFACE_ENTRY_IID(IID_IInitializeObject, IInitializeObject) - COM_INTERFACE_ENTRY_IID(IID_IMenuBand, IMenuBand) // FIXME: Win does not export it -END_COM_MAP() -}; - -class CMenuBandSite : - public CComCoClass<CMenuBandSite, &CLSID_MenuBandSite>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IBandSite, - public IDeskBarClient, - public IOleCommandTarget, - public IInputObject, - public IInputObjectSite, - public IWinEventHandler, - public IServiceProvider -{ -private: - IUnknown **m_pObjects; - ULONG m_cObjects; - -public: - CMenuBandSite(); - ~CMenuBandSite(); - - // *** IBandSite methods *** - virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown *punk); - virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD *pdwBandID); - virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName); - virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState); - virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID); - virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv); - virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo(const BANDSITEINFO *pbsinfo); - virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo(BANDSITEINFO *pbsinfo); - - // *** IOleWindow methods *** - virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd); - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); - - // *** IDeskBarClient methods *** - virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite); - virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode); - virtual HRESULT STDMETHODCALLTYPE UIActivateDBC(DWORD dwState); - virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc); - - // *** IOleCommandTarget methods *** - virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); - virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); - - // *** IInputObject methods *** - virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg); - virtual HRESULT STDMETHODCALLTYPE HasFocusIO(); - virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg); - - // *** IInputObjectSite methods *** - virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus); - - // *** IWinEventHandler methods *** - virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND paramC, UINT param10, WPARAM param14, LPARAM param18, LRESULT *param1C); - virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND paramC); - - // *** IServiceProvider methods *** - virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); - -DECLARE_REGISTRY_RESOURCEID(IDR_MENUBANDSITE) -DECLARE_NOT_AGGREGATABLE(CMenuBandSite) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CMenuBandSite) - COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite) - COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) - COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient) - COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) - COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject) - COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite) - COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler) - COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) -END_COM_MAP() -}; - -#endif /* _STARTMENU_H_ */ Modified: trunk/reactos/dll/win32/shell32/iconcache.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/iconcach…
============================================================================== --- trunk/reactos/dll/win32/shell32/iconcache.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/iconcache.cpp [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -845,6 +845,11 @@ return Shell_GetCachedImageIndexA((LPCSTR)szPath, nIndex, bSimulateDoc); } +EXTERN_C INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateDoc) +{ + return Shell_GetCachedImageIndexAW(szPath, nIndex, bSimulateDoc); +} + /************************************************************************* * ExtractIconExW [SHELL32.@] * RETURNS 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 11:17:08 2015 @@ -26,6 +26,7 @@ #include <strsafe.h> #include <atlbase.h> #include <atlcom.h> +#include <atlwin.h> #include <powrprof.h> #include <comctl32_undoc.h> @@ -61,12 +62,15 @@ #include "droptargets/CexeDropHandler.h" #include "COpenWithMenu.h" #include "CNewMenu.h" -#include "CStartMenu.h" #include "filedefext.h" #include "drvdefext.h" -#include "CMenuBand.h" -#include "CMenuDeskBar.h" #include "CQueryAssociations.h" +#include "shellmenu/CBandSite.h" +#include "shellmenu/CMenuBand.h" +#include "shellmenu/CMenuDeskBar.h" +#include "shellmenu/CMenuSite.h" +#include "shellmenu/CMergedFolder.h" +#include "shellmenu/shellmenu.h" #include <wine/debug.h> #include <wine/unicode.h> Added: trunk/reactos/dll/win32/shell32/res/rgs/mergedfolder.rgs URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/res/rgs/…
============================================================================== --- trunk/reactos/dll/win32/shell32/res/rgs/mergedfolder.rgs (added) +++ trunk/reactos/dll/win32/shell32/res/rgs/mergedfolder.rgs [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -0,0 +1,13 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {26FDC864-BE88-46E7-9235-032D8EA5162E} = s 'Merged Shell Folder' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} Propchange: trunk/reactos/dll/win32/shell32/res/rgs/mergedfolder.rgs ------------------------------------------------------------------------------ svn:eol-style = CRLF Added: trunk/reactos/dll/win32/shell32/res/rgs/rebarbandsite.rgs URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/res/rgs/…
============================================================================== --- trunk/reactos/dll/win32/shell32/res/rgs/rebarbandsite.rgs (added) +++ trunk/reactos/dll/win32/shell32/res/rgs/rebarbandsite.rgs [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -0,0 +1,13 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {ECD4FC4D-521C-11D0-B792-00A0C90312E1} = s 'Shell Rebar Band Site' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} Propchange: trunk/reactos/dll/win32/shell32/res/rgs/rebarbandsite.rgs ------------------------------------------------------------------------------ svn:eol-style = CRLF Modified: trunk/reactos/dll/win32/shell32/rgs_res.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/rgs_res.…
============================================================================== --- trunk/reactos/dll/win32/shell32/rgs_res.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/rgs_res.rc [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -23,4 +23,6 @@ IDR_OPENWITHMENU REGISTRY "res/rgs/openwithmenu.rgs" IDR_FILEDEFEXT REGISTRY "res/rgs/shellfiledefext.rgs" IDR_DRVDEFEXT REGISTRY "res/rgs/shelldrvdefext.rgs" -IDR_EXEDROPHANDLER REGISTRY "res/rgs/exedrophandler.rgs" +IDR_EXEDROPHANDLER REGISTRY "res/rgs/exedrophandler.rgs" +IDR_MERGEDFOLDER REGISTRY "res/rgs/mergedfolder.rgs" +IDR_REBARBANDSITE REGISTRY "res/rgs/rebarbandsite.rgs" Modified: trunk/reactos/dll/win32/shell32/shell32.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32.…
============================================================================== --- trunk/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -146,6 +146,38 @@ return S_OK; } +/************************************************************************** + * CStartMenuDummy + */ +class CStartMenuDummy : + public CComCoClass<CStartMenuDummy, &CLSID_StartMenu>, + public CComObjectRootEx<CComMultiThreadModelNoCS> +{ +private: + CStartMenuDummy(); + virtual ~CStartMenuDummy(); + +public: + DECLARE_REGISTRY_RESOURCEID(IDR_STARTMENU) + + class _CreatorClass + { + public: + static STDMETHODIMP CreateInstance(void *pv, REFIID riid, LPVOID *ppv) + { + if (ppv == NULL) + return E_POINTER; + *ppv = NULL; + if (pv != NULL) + return CLASS_E_NOAGGREGATION; + return CStartMenu_Constructor(riid, ppv); + } + }; +}; + +/************************************************************************** + * CShell32Module + */ class CShell32Module : public CComModule { public: @@ -174,10 +206,12 @@ OBJECT_ENTRY(CLSID_RecycleBin, CRecycleBin) OBJECT_ENTRY(CLSID_OpenWithMenu, COpenWithMenu) OBJECT_ENTRY(CLSID_NewMenu, CNewMenu) - OBJECT_ENTRY(CLSID_StartMenu, CStartMenu) - OBJECT_ENTRY(CLSID_MenuBandSite, CMenuBandSite) + OBJECT_ENTRY(CLSID_StartMenu, CStartMenuDummy) + OBJECT_ENTRY(CLSID_MenuBandSite, CMenuSite) OBJECT_ENTRY(CLSID_MenuBand, CMenuBand) OBJECT_ENTRY(CLSID_MenuDeskBar, CMenuDeskBar) + OBJECT_ENTRY(CLSID_MergedFolder, CMergedFolder) + OBJECT_ENTRY(CLSID_RebarBandSite, CBandSite) OBJECT_ENTRY(CLSID_ExeDropHandler, CExeDropHandler) OBJECT_ENTRY(CLSID_QueryAssociations, CQueryAssociations) END_OBJECT_MAP() Modified: trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.h [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -142,6 +142,7 @@ public CBandSiteBase { public: + DECLARE_REGISTRY_RESOURCEID(IDR_REBARBANDSITE) DECLARE_AGGREGATABLE(CBandSite) DECLARE_PROTECT_FINAL_CONSTRUCT() Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.h [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -25,6 +25,7 @@ class CMenuFocusManager; class CMenuBand : + public CComCoClass<CMenuBand, &CLSID_MenuBand>, public CComObjectRootEx<CComMultiThreadModelNoCS>, public IDeskBand, public IObjectWithSite, @@ -75,6 +76,7 @@ CMenuBand(); virtual ~CMenuBand(); + DECLARE_REGISTRY_RESOURCEID(IDR_MENUBAND) DECLARE_NOT_AGGREGATABLE(CMenuBand) DECLARE_PROTECT_FINAL_CONSTRUCT() Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.h [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -25,6 +25,7 @@ > CMenuWinTraits; class CMenuDeskBar : + public CComCoClass<CMenuDeskBar, &CLSID_MenuDeskBar>, public CComObjectRootEx<CComMultiThreadModelNoCS>, public CWindowImpl<CMenuDeskBar, CWindow, CMenuWinTraits>, public IOleCommandTarget, @@ -57,6 +58,7 @@ CMenuDeskBar(); virtual ~CMenuDeskBar(); + DECLARE_REGISTRY_RESOURCEID(IDR_MENUDESKBAR) DECLARE_NOT_AGGREGATABLE(CMenuDeskBar) DECLARE_PROTECT_FINAL_CONSTRUCT() Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.h [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -20,6 +20,7 @@ #pragma once class CMenuSite : + public CComCoClass<CMenuSite, &CLSID_MenuBandSite>, public CComObjectRootEx<CComMultiThreadModelNoCS>, public CWindowImpl<CMenuSite, CWindow, CControlWinTraits>, public IBandSite, @@ -43,6 +44,7 @@ DECLARE_WND_CLASS_EX(_T("MenuSite"), 0, COLOR_MENU) + DECLARE_REGISTRY_RESOURCEID(IDR_MENUBANDSITE) DECLARE_NOT_AGGREGATABLE(CMenuSite) DECLARE_PROTECT_FINAL_CONSTRUCT() BEGIN_COM_MAP(CMenuSite) Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.h [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -46,6 +46,7 @@ class CEnumMergedFolder; class CMergedFolder : + public CComCoClass<CMergedFolder, &CLSID_MergedFolder>, public CComObjectRootEx<CComMultiThreadModelNoCS>, public IShellFolder2, public IPersistFolder2, @@ -73,6 +74,7 @@ HRESULT _SetSources(IShellFolder* userLocal, IShellFolder* allUSers); + DECLARE_REGISTRY_RESOURCEID(IDR_MERGEDFOLDER) DECLARE_NOT_AGGREGATABLE(CMergedFolder) DECLARE_PROTECT_FINAL_CONSTRUCT() 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 11:17:08 2015 @@ -60,6 +60,7 @@ #include <shellutils.h> #include <rosctrls.h> +#include "../shresdef.h" #include <wine/debug.h> @@ -68,7 +69,7 @@ #pragma warning(pop) #endif -#define shell32_hInstance 0 +extern HINSTANCE shell32_hInstance; extern "C" HRESULT WINAPI CStartMenu_Constructor(REFIID riid, void **ppv); extern "C" HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv); Modified: trunk/reactos/dll/win32/shell32/shresdef.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shresdef…
============================================================================== --- trunk/reactos/dll/win32/shell32/shresdef.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shresdef.h [iso-8859-1] Wed Aug 19 11:17:08 2015 @@ -580,3 +580,5 @@ #define IDR_MENUDESKBAR 150 #define IDR_EXEDROPHANDLER 151 #define IDR_QUERYASSOCIATIONS 152 +#define IDR_MERGEDFOLDER 153 +#define IDR_REBARBANDSITE 154
9 years, 4 months
1
0
0
0
[tfaber] 68763: [RSHELL][SHELL32] - Move rshell source files to a "shellmenu" static library under shell32 CORE-9892
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Aug 19 09:05:54 2015 New Revision: 68763 URL:
http://svn.reactos.org/svn/reactos?rev=68763&view=rev
Log: [RSHELL][SHELL32] - Move rshell source files to a "shellmenu" static library under shell32 CORE-9892 Added: trunk/reactos/dll/win32/shell32/shellmenu/ (with props) trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.cpp - copied, changed from r68754, trunk/reactos/base/shell/rshell/CBandSite.cpp trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.h - copied unchanged from r68754, trunk/reactos/base/shell/rshell/CBandSite.h trunk/reactos/dll/win32/shell32/shellmenu/CDesktopBrowser.cpp - copied, changed from r68754, trunk/reactos/base/shell/rshell/CDesktopBrowser.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMakeLists.txt - copied, changed from r68754, trunk/reactos/base/shell/rshell/CMakeLists.txt trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp - copied, changed from r68754, trunk/reactos/base/shell/rshell/CMenuBand.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.h - copied unchanged from r68754, trunk/reactos/base/shell/rshell/CMenuBand.h trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp - copied, changed from r68754, trunk/reactos/base/shell/rshell/CMenuDeskBar.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.h - copied unchanged from r68754, trunk/reactos/base/shell/rshell/CMenuDeskBar.h trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp - copied, changed from r68754, trunk/reactos/base/shell/rshell/CMenuFocusManager.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.h - copied unchanged from r68754, trunk/reactos/base/shell/rshell/CMenuFocusManager.h trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.cpp - copied, changed from r68754, trunk/reactos/base/shell/rshell/CMenuSite.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.h - copied unchanged from r68754, trunk/reactos/base/shell/rshell/CMenuSite.h trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp - copied, changed from r68754, trunk/reactos/base/shell/rshell/CMenuToolbars.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.h - copied unchanged from r68754, trunk/reactos/base/shell/rshell/CMenuToolbars.h trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.cpp - copied, changed from r68754, trunk/reactos/base/shell/rshell/CMergedFolder.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.h - copied unchanged from r68754, trunk/reactos/base/shell/rshell/CMergedFolder.h trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp - copied, changed from r68754, trunk/reactos/base/shell/rshell/CStartMenu.cpp trunk/reactos/dll/win32/shell32/shellmenu/ShellDDE.cpp - copied, changed from r68754, trunk/reactos/base/shell/rshell/ShellDDE.cpp trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h - copied unchanged from r68754, trunk/reactos/base/shell/rshell/precomp.h Removed: trunk/reactos/base/shell/rshell/CBandSite.cpp trunk/reactos/base/shell/rshell/CBandSite.h trunk/reactos/base/shell/rshell/CDesktopBrowser.cpp trunk/reactos/base/shell/rshell/CMenuBand.cpp trunk/reactos/base/shell/rshell/CMenuBand.h trunk/reactos/base/shell/rshell/CMenuDeskBar.cpp trunk/reactos/base/shell/rshell/CMenuDeskBar.h trunk/reactos/base/shell/rshell/CMenuFocusManager.cpp trunk/reactos/base/shell/rshell/CMenuFocusManager.h trunk/reactos/base/shell/rshell/CMenuSite.cpp trunk/reactos/base/shell/rshell/CMenuSite.h trunk/reactos/base/shell/rshell/CMenuToolbars.cpp trunk/reactos/base/shell/rshell/CMenuToolbars.h trunk/reactos/base/shell/rshell/CMergedFolder.cpp trunk/reactos/base/shell/rshell/CMergedFolder.h trunk/reactos/base/shell/rshell/CStartMenu.cpp trunk/reactos/base/shell/rshell/ShellDDE.cpp trunk/reactos/base/shell/rshell/precomp.h Modified: trunk/reactos/base/shell/rshell/CMakeLists.txt trunk/reactos/base/shell/rshell/misc.cpp trunk/reactos/dll/win32/shell32/CMakeLists.txt [This mail would be too long, it was shortened to contain the URLs only.] Removed: trunk/reactos/base/shell/rshell/CBandSite.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CBandSit…
Removed: trunk/reactos/base/shell/rshell/CBandSite.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CBandSit…
Removed: trunk/reactos/base/shell/rshell/CDesktopBrowser.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CDesktop…
Modified: trunk/reactos/base/shell/rshell/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMakeLis…
Removed: trunk/reactos/base/shell/rshell/CMenuBand.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMenuBan…
Removed: trunk/reactos/base/shell/rshell/CMenuBand.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMenuBan…
Removed: trunk/reactos/base/shell/rshell/CMenuDeskBar.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMenuDes…
Removed: trunk/reactos/base/shell/rshell/CMenuDeskBar.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMenuDes…
Removed: trunk/reactos/base/shell/rshell/CMenuFocusManager.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMenuFoc…
Removed: trunk/reactos/base/shell/rshell/CMenuFocusManager.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMenuFoc…
Removed: trunk/reactos/base/shell/rshell/CMenuSite.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMenuSit…
Removed: trunk/reactos/base/shell/rshell/CMenuSite.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMenuSit…
Removed: trunk/reactos/base/shell/rshell/CMenuToolbars.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMenuToo…
Removed: trunk/reactos/base/shell/rshell/CMenuToolbars.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMenuToo…
Removed: trunk/reactos/base/shell/rshell/CMergedFolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMergedF…
Removed: trunk/reactos/base/shell/rshell/CMergedFolder.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMergedF…
Removed: trunk/reactos/base/shell/rshell/CStartMenu.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CStartMe…
Removed: trunk/reactos/base/shell/rshell/ShellDDE.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/ShellDDE…
Modified: trunk/reactos/base/shell/rshell/misc.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/misc.cpp…
Removed: trunk/reactos/base/shell/rshell/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/precomp.…
Modified: trunk/reactos/dll/win32/shell32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CMakeLis…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.cpp (from r68754, trunk/reactos/base/shell/rshell/CBandSite.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/CDesktopBrowser.cpp (from r68754, trunk/reactos/base/shell/rshell/CDesktopBrowser.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/CMakeLists.txt (from r68754, trunk/reactos/base/shell/rshell/CMakeLists.txt) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp (from r68754, trunk/reactos/base/shell/rshell/CMenuBand.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp (from r68754, trunk/reactos/base/shell/rshell/CMenuDeskBar.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp (from r68754, trunk/reactos/base/shell/rshell/CMenuFocusManager.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.cpp (from r68754, trunk/reactos/base/shell/rshell/CMenuSite.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp (from r68754, trunk/reactos/base/shell/rshell/CMenuToolbars.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.cpp (from r68754, trunk/reactos/base/shell/rshell/CMergedFolder.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp (from r68754, trunk/reactos/base/shell/rshell/CStartMenu.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
Copied: trunk/reactos/dll/win32/shell32/shellmenu/ShellDDE.cpp (from r68754, trunk/reactos/base/shell/rshell/ShellDDE.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
9 years, 4 months
1
0
0
0
[tfaber] 68762: [SHELL32] - Fail CDefView::CreateViewWindow if a window already exists - Don't return IOleWindow from CDefView::QueryInterface Fixes reference leaks during shell32_winetest:shlview ...
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Aug 19 08:28:24 2015 New Revision: 68762 URL:
http://svn.reactos.org/svn/reactos?rev=68762&view=rev
Log: [SHELL32] - Fail CDefView::CreateViewWindow if a window already exists - Don't return IOleWindow from CDefView::QueryInterface Fixes reference leaks during shell32_winetest:shlview CORE-9867 Modified: trunk/reactos/dll/win32/shell32/CDefView.cpp 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 08:28:24 2015 @@ -320,7 +320,8 @@ END_MSG_MAP() BEGIN_COM_MAP(CDefView) - COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) + // Windows returns E_NOINTERFACE for IOleWindow + // COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) COM_INTERFACE_ENTRY_IID(IID_IShellView, IShellView) COM_INTERFACE_ENTRY_IID(IID_IFolderView, IFolderView) COM_INTERFACE_ENTRY_IID(IID_IShellFolderView, IShellFolderView) @@ -2193,7 +2194,7 @@ TRACE("-- left=%i top=%i right=%i bottom=%i\n", prcView->left, prcView->top, prcView->right, prcView->bottom); /* Validate the Shell Browser */ - if (psb == NULL) + if (psb == NULL || m_hWnd) return E_UNEXPECTED; /*set up the member variables*/
9 years, 4 months
1
0
0
0
[tfaber] 68761: [SHELL32] - Take an extra reference on CDefView during the lifetime of the view window, and correctly handle recursive WM_DESTROY messages CORE-9932
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Aug 19 08:23:59 2015 New Revision: 68761 URL:
http://svn.reactos.org/svn/reactos?rev=68761&view=rev
Log: [SHELL32] - Take an extra reference on CDefView during the lifetime of the view window, and correctly handle recursive WM_DESTROY messages CORE-9932 Modified: trunk/reactos/dll/win32/shell32/CDefView.cpp 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 08:23:59 2015 @@ -113,6 +113,7 @@ CLSID m_Category; HMENU m_hView; + BOOL m_Destroyed; private: HRESULT _MergeToolbar(); @@ -248,6 +249,8 @@ LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnGetShellBrowser(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); + LRESULT OnNCCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); + LRESULT OnNCDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); @@ -296,6 +299,8 @@ MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus) + MESSAGE_HANDLER(WM_NCCREATE, OnNCCreate) + MESSAGE_HANDLER(WM_NCDESTROY, OnNCDestroy) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) MESSAGE_HANDLER(WM_NOTIFY, OnNotify) @@ -364,7 +369,8 @@ m_iDragOverItem(0), m_cScrollDelay(0), m_isEditing(FALSE), - m_hView(NULL) + m_hView(NULL), + m_Destroyed(FALSE) { ZeroMemory(&m_FolderSettings, sizeof(m_FolderSettings)); ZeroMemory(&m_sortInfo, sizeof(m_sortInfo)); @@ -971,11 +977,20 @@ LRESULT CDefView::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { - if (m_hMenu) - DestroyMenu(m_hMenu); - RevokeDragDrop(m_hWnd); - SHChangeNotifyDeregister(m_hNotify); - SHFree(m_pidlParent); + if (!m_Destroyed) + { + m_Destroyed = TRUE; + if (m_hMenu) + { + DestroyMenu(m_hMenu); + m_hMenu = NULL; + } + RevokeDragDrop(m_hWnd); + SHChangeNotifyDeregister(m_hNotify); + m_hNotify = NULL; + SHFree(m_pidlParent); + m_pidlParent = NULL; + } bHandled = FALSE; return 0; } @@ -1002,6 +1017,20 @@ LRESULT CDefView::OnGetShellBrowser(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { return reinterpret_cast<LRESULT>(m_pShellBrowser.p); +} + +LRESULT CDefView::OnNCCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) +{ + this->AddRef(); + bHandled = FALSE; + return 0; +} + +LRESULT CDefView::OnNCDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) +{ + this->Release(); + bHandled = FALSE; + return 0; } /********************************************************** @@ -2229,7 +2258,7 @@ if (m_hMenu) { DestroyMenu(m_hMenu); - m_hView = NULL; + m_hMenu = NULL; } if (m_ListView)
9 years, 4 months
1
0
0
0
[pschweitzer] 68760: [NTOSKRNL] Addendum to r68759
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Tue Aug 18 20:40:17 2015 New Revision: 68760 URL:
http://svn.reactos.org/svn/reactos?rev=68760&view=rev
Log: [NTOSKRNL] Addendum to r68759 Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/ntoskrnl.…
============================================================================== --- trunk/reactos/ntoskrnl/include/ntoskrnl.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/ntoskrnl.h [iso-8859-1] Tue Aug 18 20:40:17 2015 @@ -50,6 +50,7 @@ #include <ndk/ldrfuncs.h> #include <ndk/lpcfuncs.h> #include <ndk/mmfuncs.h> +#include <ndk/muptypes.h> #include <ndk/obfuncs.h> #include <ndk/pofuncs.h> #include <ndk/psfuncs.h>
9 years, 4 months
1
0
0
0
[pschweitzer] 68759: [FSRTL] Rewrite FsRtlRegisterUncProvider() and FsRtlDeregisterUncProvider() so that they can support MUP in case it's required They also support DFS
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Tue Aug 18 20:17:28 2015 New Revision: 68759 URL:
http://svn.reactos.org/svn/reactos?rev=68759&view=rev
Log: [FSRTL] Rewrite FsRtlRegisterUncProvider() and FsRtlDeregisterUncProvider() so that they can support MUP in case it's required They also support DFS Modified: trunk/reactos/ntoskrnl/fsrtl/unc.c Modified: trunk/reactos/ntoskrnl/fsrtl/unc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/unc.c?rev=6…
============================================================================== --- trunk/reactos/ntoskrnl/fsrtl/unc.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/fsrtl/unc.c [iso-8859-1] Tue Aug 18 20:17:28 2015 @@ -3,7 +3,7 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fsrtl/unc.c * PURPOSE: Manages UNC support routines for file system drivers. - * PROGRAMMERS: None. + * PROGRAMMERS: Pierre Schweitzer (pierre(a)reactos.org) */ /* INCLUDES ******************************************************************/ @@ -12,11 +12,182 @@ #define NDEBUG #include <debug.h> +#define TAG_UNC 'nuSF' + +KSEMAPHORE FsRtlpUncSemaphore; + +ULONG FsRtlpRedirs = 0; + +struct +{ + HANDLE MupHandle; + HANDLE NullHandle; + UNICODE_STRING RedirectorDeviceName; + BOOLEAN MailslotsSupported; +} FsRtlpDRD; + +BOOLEAN +FsRtlpIsDfsEnabled(VOID) +{ + HANDLE Key; + ULONG Length; + NTSTATUS Status; + UNICODE_STRING KeyName; + OBJECT_ATTRIBUTES ObjectAttributes; + struct + { + KEY_VALUE_PARTIAL_INFORMATION KeyInfo; + ULONG KeyValue; + } KeyQueryOutput; + + /* You recognize MuppIsDfsEnabled()! Congratz :-) */ + KeyName.Buffer = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Mup"; + KeyName.Length = sizeof(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Mup") - sizeof(UNICODE_NULL); + KeyName.MaximumLength = sizeof(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Mup"); + + /* Simply query registry to get whether DFS is disabled. + * If DFS isn't disabled from registry side, assume it is enabled + * and go through MUP. + * MUP itself might disable it, but that's not our concern + * any longer + */ + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = ZwOpenKey(&Key, KEY_READ, &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + return TRUE; + } + + KeyName.Buffer = L"DisableDfs"; + KeyName.Length = sizeof(L"DisableDfs") - sizeof(UNICODE_NULL); + KeyName.MaximumLength = sizeof(L"DisableDfs"); + + Status = ZwQueryValueKey(Key, &KeyName, KeyValuePartialInformation, &KeyQueryOutput, sizeof(KeyQueryOutput), &Length); + ZwClose(Key); + if (!NT_SUCCESS(Status) || KeyQueryOutput.KeyInfo.Type != REG_DWORD) + { + return TRUE; + } + + return ((ULONG)KeyQueryOutput.KeyInfo.Data != 1); +} + +NTSTATUS +FsRtlpOpenDev(OUT PHANDLE DeviceHandle, + IN PCWSTR DeviceName) +{ + NTSTATUS Status; + UNICODE_STRING StrDeviceName; + IO_STATUS_BLOCK IoStatusBlock; + OBJECT_ATTRIBUTES ObjectAttributes; + + PAGED_CODE(); + + /* Just open the device and return the obtained handle */ + RtlInitUnicodeString(&StrDeviceName, DeviceName); + InitializeObjectAttributes(&ObjectAttributes, + &StrDeviceName, + 0, + NULL, + NULL); + Status = ZwCreateFile(DeviceHandle, + GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_OPEN, 0, NULL, 0); + if (NT_SUCCESS(Status)) + { + Status = IoStatusBlock.Status; + } + + if (!NT_SUCCESS(Status)) + { + *DeviceHandle = INVALID_HANDLE_VALUE; + } + + return Status; +} + +VOID +FsRtlpSetSymbolicLink(IN PUNICODE_STRING DeviceName) +{ + NTSTATUS Status; + UNICODE_STRING UncDevice; + + PAGED_CODE(); + + /* Delete the old link, and set the new one if we have a name */ + RtlInitUnicodeString(&UncDevice, L"\\DosDevices\\UNC"); + IoDeleteSymbolicLink(&UncDevice); + if (DeviceName != NULL) + { + Status = IoCreateSymbolicLink(&UncDevice, DeviceName); + ASSERT(NT_SUCCESS(Status)); + } +} + +NTSTATUS +FsRtlpRegisterProviderWithMUP(IN HANDLE MupHandle, + IN PUNICODE_STRING RedirectorDeviceName, + IN BOOLEAN MailslotsSupported) +{ + NTSTATUS Status; + ULONG BufferSize; + IO_STATUS_BLOCK IoStatusBlock; + PMUP_PROVIDER_REGISTRATION_INFO RegistrationInfo; + + PAGED_CODE(); + + DPRINT1("FsRtlpRegisterProviderWithMUP(%p, %wZ, %u)\n", (PVOID)MupHandle, RedirectorDeviceName, MailslotsSupported); + + /* We have to be able to store the name and the registration information */ + BufferSize = RedirectorDeviceName->Length + sizeof(MUP_PROVIDER_REGISTRATION_INFO); + RegistrationInfo = ExAllocatePoolWithTag(NonPagedPool, BufferSize, TAG_UNC); + if (RegistrationInfo == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Set the information about the provider (including its name) */ + RegistrationInfo->RedirectorDeviceNameOffset = sizeof(MUP_PROVIDER_REGISTRATION_INFO); + RegistrationInfo->RedirectorDeviceNameLength = RedirectorDeviceName->Length; + RegistrationInfo->MailslotsSupported = MailslotsSupported; + RtlCopyMemory((PWSTR)((ULONG_PTR)RegistrationInfo + RegistrationInfo->RedirectorDeviceNameOffset), + RedirectorDeviceName->Buffer, RedirectorDeviceName->Length); + + /* Call MUP with the registration FSCTL */ + Status = NtFsControlFile(MupHandle, NULL, NULL, NULL, + &IoStatusBlock, FSCTL_MUP_REGISTER_PROVIDER, + RegistrationInfo, BufferSize, NULL, 0); + if (Status == STATUS_PENDING) + { + Status = NtWaitForSingleObject(MupHandle, TRUE, NULL); + } + + if (NT_SUCCESS(Status)) + { + Status = IoStatusBlock.Status; + } + + /* And we're done! */ + ASSERT(NT_SUCCESS(Status)); + ExFreePoolWithTag(RegistrationInfo, TAG_UNC); + + return Status; +} + /* PUBLIC FUNCTIONS **********************************************************/ /*++ * @name FsRtlDeregisterUncProvider - * @unimplemented + * @implemented * * FILLME * @@ -32,23 +203,63 @@ NTAPI FsRtlDeregisterUncProvider(IN HANDLE Handle) { - UNICODE_STRING DosDevicesUNC = RTL_CONSTANT_STRING(L"\\DosDevices\\UNC"); - - DPRINT("FsRtlDeregisterUncProvider: Handle=%p\n", Handle); - // - // Normal implementation should look like: - // - notify mup.sys? - // - at last deregistration, destroy \DosDevices\UNC symbolic link - // - - ZwClose(Handle); - - IoDeleteSymbolicLink(&DosDevicesUNC); + PAGED_CODE(); + + /* We won't work on invalid input */ + if (Handle == INVALID_HANDLE_VALUE || Handle == 0) + { + return; + } + + KeWaitForSingleObject(&FsRtlpUncSemaphore, Executive, KernelMode, FALSE, NULL); + + /* Sanity check: we need to have providers */ + ASSERT(FsRtlpRedirs > 0); + + /* At that point, we had only one provider at a time */ + if (Handle == (HANDLE)FsRtlpDRD.NullHandle) + { + /* Free its name if possible (it might have been overtaken in case of + * registration of other UNC provider */ + if (FsRtlpDRD.RedirectorDeviceName.Buffer != NULL) + { + ExFreePoolWithTag(FsRtlpDRD.RedirectorDeviceName.Buffer, TAG_UNC); + FsRtlpDRD.RedirectorDeviceName.Buffer = NULL; + } + + /* Close the handle to MUP */ + if (FsRtlpDRD.MupHandle != INVALID_HANDLE_VALUE) + { + ZwClose(FsRtlpDRD.MupHandle); + FsRtlpDRD.MupHandle = INVALID_HANDLE_VALUE; + } + + /* Last handle isn't required anymore */ + FsRtlpDRD.NullHandle = INVALID_HANDLE_VALUE; + } + + /* One less provider */ + --FsRtlpRedirs; + + /* In case we reach no provider anylonger, reset the symbolic link */ + if (FsRtlpRedirs == 0) + { + FsRtlpSetSymbolicLink(NULL); + } + + KeReleaseSemaphore(&FsRtlpUncSemaphore, IO_NO_INCREMENT, 1, FALSE); + + /* Final note: + * NULL device handle and 'normal' MUP device handle are not closed by + * FsRtl. It's up to the user to close them afterwards. + * If the handle is leaked, MUP will never be notified about the + * unregistration. + */ } /*++ * @name FsRtlRegisterUncProvider - * @unimplemented + * @implemented * * FILLME * @@ -59,6 +270,7 @@ * FILLME * * @param MailslotsSupported + * FILLME * * @return None * @@ -67,68 +279,143 @@ *--*/ NTSTATUS NTAPI -FsRtlRegisterUncProvider(IN OUT PHANDLE Handle, +FsRtlRegisterUncProvider(OUT PHANDLE Handle, IN PUNICODE_STRING RedirectorDeviceName, IN BOOLEAN MailslotsSupported) { - UNICODE_STRING DevNull = RTL_CONSTANT_STRING(L"\\Device\\Null"); - UNICODE_STRING DosDevicesUNC = RTL_CONSTANT_STRING(L"\\DosDevices\\UNC"); - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK Iosb; - HANDLE FileHandle; NTSTATUS Status; - - DPRINT("FsRtlRegisterUncProvider: Redirector=%wZ MailslotsSupported=%d\n", - RedirectorDeviceName, MailslotsSupported); - - // - // Current implementation is a hack, as it only supports one UNC provider. - // However, it doesn't require to have a functional mup.sys driver. - // - - // - // Normal implementation should look like: - // - at registration 1, creates symlink \DosDevices\UNC to new provider; - // returns handle to \Device\Null - // - at registration 2, load mup.sys, register both providers to mup.sys - // and change \DosDevices\UNC to DD_MUP_DEVICE_NAME; - // returns handle to new provider - // - at next registrations, register provider to mup.sys; - // returns handle to new provider - // - - *Handle = (HANDLE)-1; - InitializeObjectAttributes(&ObjectAttributes, - &DevNull, - OBJ_KERNEL_HANDLE, - NULL, - NULL); - Status = ZwCreateFile(&FileHandle, - GENERIC_WRITE, - &ObjectAttributes, - &Iosb, - NULL, - FILE_ATTRIBUTE_NORMAL, - FILE_SHARE_READ | FILE_SHARE_WRITE, - FILE_OPEN, - 0, - NULL, - 0); - if (!NT_SUCCESS(Status)) - { - DPRINT("Failed to open %wZ\n", &DevNull); - return Status; - } - - Status = IoCreateSymbolicLink(&DosDevicesUNC, RedirectorDeviceName); - if (!NT_SUCCESS(Status)) - { - DPRINT("Failed to create symbolic link %wZ -> %wZ\n", &DosDevicesUNC, RedirectorDeviceName); - DPRINT1("FIXME: multiple unc provider registered?\n"); - ZwClose(FileHandle); - return Status; - } - - *Handle = FileHandle; - return STATUS_SUCCESS; -} + HANDLE DeviceHandle; + UNICODE_STRING MupString; + + PAGED_CODE(); + + DPRINT1("FsRtlRegisterUncProvider(%p, %wZ, %u)\n", Handle, RedirectorDeviceName, MailslotsSupported); + + KeWaitForSingleObject(&FsRtlpUncSemaphore, Executive, KernelMode, FALSE, NULL); + + /* In case no provider was registered yet, check for DFS present. + * If DFS is present, we need to go with MUP, whatever the case + */ + if (FsRtlpRedirs == 0) + { + if (FsRtlpIsDfsEnabled()) + { + DPRINT1("DFS is not disabled. Going through MUP\n"); + + /* We've to go with MUP, make sure our internal structure doesn't + * contain any leftover data and raise redirs to one, to make sure + * we use MUP. + */ + RtlZeroMemory(&FsRtlpDRD, sizeof(FsRtlpDRD)); + FsRtlpRedirs = 1; + } + } + + /* In case no UNC provider was already registered, + * We'll proceed without MUP and directly redirect + * UNC to the provider. + */ + if (FsRtlpRedirs == 0) + { + /* As we don't provide MUP, just give a handle to NULL device */ + Status = FsRtlpOpenDev(&DeviceHandle, L"\\Device\\Null"); + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + /* Allocate a buffer big enough to keep a local copy of UNC provider device */ + FsRtlpDRD.RedirectorDeviceName.Buffer = ExAllocatePoolWithTag(NonPagedPool, RedirectorDeviceName->MaximumLength, TAG_UNC); + if (FsRtlpDRD.RedirectorDeviceName.Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto Cleanup; + } + + FsRtlpDRD.RedirectorDeviceName.Length = RedirectorDeviceName->Length; + FsRtlpDRD.RedirectorDeviceName.MaximumLength = RedirectorDeviceName->MaximumLength; + RtlCopyMemory(FsRtlpDRD.RedirectorDeviceName.Buffer, RedirectorDeviceName->Buffer, RedirectorDeviceName->MaximumLength); + + /* We don't have MUP, and copy provider information */ + FsRtlpDRD.MupHandle = INVALID_HANDLE_VALUE; + FsRtlpDRD.MailslotsSupported = MailslotsSupported; + FsRtlpDRD.NullHandle = DeviceHandle; + + /* Set DOS device UNC to use provider device */ + FsRtlpSetSymbolicLink(RedirectorDeviceName); + } + else + { + /* We (will) have several providers, MUP is required */ + Status = FsRtlpOpenDev(&DeviceHandle, L"\\Device\\Mup"); + if (!NT_SUCCESS(Status)) + { + /* Opening MUP may have failed because the driver was not loaded, so load it and retry */ + RtlInitUnicodeString(&MupString, L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Mup"); + ZwLoadDriver(&MupString); + Status = FsRtlpOpenDev(&DeviceHandle, L"\\Device\\Mup"); + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + } + + /* In case we had a single provider till now, we have to forward the old provider to MUP + * And then, register the new one to MUP as well + */ + if (FsRtlpDRD.RedirectorDeviceName.Buffer != NULL) + { + /* We will only continue if we can register previous provider in MUP */ + Status = FsRtlpRegisterProviderWithMUP(DeviceHandle, &FsRtlpDRD.RedirectorDeviceName, FsRtlpDRD.MailslotsSupported); + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + /* Save our Mup handle for later usage */ + FsRtlpDRD.MupHandle = DeviceHandle; + + /* Release information about previous provider */ + ExFreePoolWithTag(FsRtlpDRD.RedirectorDeviceName.Buffer, TAG_UNC); + FsRtlpDRD.RedirectorDeviceName.Buffer = NULL; + + /* Re-open MUP to have a handle to give back to the user */ + Status = FsRtlpOpenDev(&DeviceHandle, L"\\Device\\Mup"); + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + } + + /* Redirect UNC DOS device to MUP */ + RtlInitUnicodeString(&MupString, L"\\Device\\Mup"); + FsRtlpSetSymbolicLink(&MupString); + + /* Register new provider */ + Status = FsRtlpRegisterProviderWithMUP(DeviceHandle, RedirectorDeviceName, MailslotsSupported); + } + +Cleanup: + + /* In case of success, increment number of providers and return handle + * to the device pointed by UNC DOS device + */ + if (NT_SUCCESS(Status)) + { + ++FsRtlpRedirs; + *Handle = DeviceHandle; + } + else + { + /* Cleanup in case of failure */ + if (DeviceHandle != INVALID_HANDLE_VALUE && DeviceHandle != 0) + { + ZwClose(DeviceHandle); + } + + *Handle = INVALID_HANDLE_VALUE; + } + + KeReleaseSemaphore(&FsRtlpUncSemaphore, IO_NO_INCREMENT, 1, FALSE); + return Status; +}
9 years, 4 months
1
0
0
0
[pschweitzer] 68758: [BOOTDATA] Enable MUP driver on boot
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Tue Aug 18 20:17:25 2015 New Revision: 68758 URL:
http://svn.reactos.org/svn/reactos?rev=68758&view=rev
Log: [BOOTDATA] Enable MUP driver on boot Modified: trunk/reactos/boot/bootdata/hivesys.inf Modified: trunk/reactos/boot/bootdata/hivesys.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] Tue Aug 18 20:17:25 2015 @@ -1466,13 +1466,13 @@ HKLM,"SYSTEM\CurrentControlSet\Services\mpu401","ImagePath",0x00020000,"system32\drivers\mpu401.sys" ; Multiple UNC provider driver -;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Description",0x00000000,"Multiple UNC Provider (MUP)" -;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","ErrorControl",0x00010001,0x00000001 -;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Group",0x00000000,"Network" -;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Group",0x00000000,"File System" -;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","ImagePath",0x00020000,"system32\drivers\mup.sys" -;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Start",0x00010001,0x00000000 -;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Type",0x00010001,0x00000002 +HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Description",0x00000000,"Multiple UNC Provider (MUP)" +HKLM,"SYSTEM\CurrentControlSet\Services\Mup","ErrorControl",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Group",0x00000000,"Network" +HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Group",0x00000000,"File System" +HKLM,"SYSTEM\CurrentControlSet\Services\Mup","ImagePath",0x00020000,"system32\drivers\mup.sys" +HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Start",0x00010001,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Type",0x00010001,0x00000002 ; NDIS driver - the only boot-start network driver HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","ErrorControl",0x00010001,0x00000001
9 years, 4 months
1
0
0
0
[pschweitzer] 68757: [MUP] Implement the MUP driver for ReactOS. It only supports Multiple UNC Providers so far Stub support for DFS
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Tue Aug 18 20:17:22 2015 New Revision: 68757 URL:
http://svn.reactos.org/svn/reactos?rev=68757&view=rev
Log: [MUP] Implement the MUP driver for ReactOS. It only supports Multiple UNC Providers so far Stub support for DFS Removed: trunk/reactos/drivers/filesystems/mup/create.c Modified: trunk/reactos/drivers/filesystems/mup/CMakeLists.txt trunk/reactos/drivers/filesystems/mup/mup.c trunk/reactos/drivers/filesystems/mup/mup.h Modified: trunk/reactos/drivers/filesystems/mup/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/mup/CM…
============================================================================== --- trunk/reactos/drivers/filesystems/mup/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/mup/CMakeLists.txt [iso-8859-1] Tue Aug 18 20:17:22 2015 @@ -1,11 +1,11 @@ list(APPEND SOURCE - create.c - mup.c - mup.h) + mup.c + mup.h) add_library(mup SHARED ${SOURCE} mup.rc) set_module_type(mup kernelmodedriver) +target_link_libraries(mup ${PSEH_LIB}) add_importlibs(mup ntoskrnl hal) add_pch(mup mup.h SOURCE) add_cd_file(TARGET mup DESTINATION reactos/system32/drivers FOR all) Removed: trunk/reactos/drivers/filesystems/mup/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/mup/cr…
============================================================================== --- trunk/reactos/drivers/filesystems/mup/create.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/mup/create.c (removed) @@ -1,66 +0,0 @@ -/* - * ReactOS kernel - * Copyright (C) 2002 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: drivers/fs/mup/create.c - * PURPOSE: Multi UNC Provider - * PROGRAMMER: Eric Kohl - */ - -/* INCLUDES *****************************************************************/ - -#include "mup.h" - -#define NDEBUG -#include <debug.h> - -/* FUNCTIONS ****************************************************************/ - -NTSTATUS NTAPI -MupCreate(PDEVICE_OBJECT DeviceObject, - PIRP Irp) -{ - PDEVICE_EXTENSION DeviceExt; - PIO_STACK_LOCATION Stack; - PFILE_OBJECT FileObject; - NTSTATUS Status; - - DPRINT("MupCreate() called\n"); - - DeviceExt = DeviceObject->DeviceExtension; - ASSERT(DeviceExt); - Stack = IoGetCurrentIrpStackLocation (Irp); - ASSERT(Stack); - - FileObject = Stack->FileObject; - - DPRINT1("MUP - Unimplemented (FileName: '%wZ')\n", &FileObject->FileName); - Status = STATUS_OBJECT_NAME_INVALID; // STATUS_BAD_NETWORK_PATH; - - Irp->IoStatus.Information = (NT_SUCCESS(Status)) ? FILE_OPENED : 0; - Irp->IoStatus.Status = Status; - - IoCompleteRequest(Irp, - IO_NO_INCREMENT); - - return Status; -} - -/* EOF */ Modified: trunk/reactos/drivers/filesystems/mup/mup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/mup/mu…
============================================================================== --- trunk/reactos/drivers/filesystems/mup/mup.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/mup/mup.c [iso-8859-1] Tue Aug 18 20:17:22 2015 @@ -19,9 +19,10 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: drivers/fs/mup/mup.c + * FILE: drivers/filesystems/mup/mup.c * PURPOSE: Multi UNC Provider * PROGRAMMER: Eric Kohl + * Pierre Schweitzer (pierre(a)reactos.org) */ /* INCLUDES *****************************************************************/ @@ -31,7 +32,2496 @@ #define NDEBUG #include <debug.h> +ERESOURCE MupGlobalLock; +ERESOURCE MupPrefixTableLock; +ERESOURCE MupCcbListLock; +ERESOURCE MupVcbLock; +LIST_ENTRY MupProviderList; +LIST_ENTRY MupPrefixList; +LIST_ENTRY MupMasterQueryList; +UNICODE_PREFIX_TABLE MupPrefixTable; +LARGE_INTEGER MupKnownPrefixTimeout; +ULONG MupProviderCount; +BOOLEAN MupOrderInitialized; +BOOLEAN MupEnableDfs; +PDEVICE_OBJECT mupDeviceObject; +NTSTATUS MupOrderedErrorList[] = { STATUS_UNSUCCESSFUL, + STATUS_INVALID_PARAMETER, + STATUS_REDIRECTOR_NOT_STARTED, + STATUS_BAD_NETWORK_NAME, + STATUS_BAD_NETWORK_PATH, 0 }; + /* FUNCTIONS ****************************************************************/ + +VOID +MupInitializeData() +{ + ExInitializeResourceLite(&MupGlobalLock); + ExInitializeResourceLite(&MupPrefixTableLock); + ExInitializeResourceLite(&MupCcbListLock); + ExInitializeResourceLite(&MupVcbLock); + MupProviderCount = 0; + InitializeListHead(&MupProviderList); + InitializeListHead(&MupPrefixList); + InitializeListHead(&MupMasterQueryList); + RtlInitializeUnicodePrefix(&MupPrefixTable); + MupKnownPrefixTimeout.QuadPart = 9000000000LL; + MupOrderInitialized = FALSE; +} + +VOID +MupUninitializeData() +{ + ExDeleteResourceLite(&MupGlobalLock); + ExDeleteResourceLite(&MupPrefixTableLock); + ExDeleteResourceLite(&MupCcbListLock); + ExDeleteResourceLite(&MupVcbLock); +} + +VOID +MupInitializeVcb(PMUP_VCB Vcb) +{ + RtlZeroMemory(Vcb, sizeof(MUP_VCB)); + Vcb->NodeType = NODE_TYPE_VCB; + Vcb->NodeStatus = NODE_STATUS_HEALTHY; + Vcb->NodeReferences = 1; + Vcb->NodeSize = sizeof(MUP_VCB); +} + +BOOLEAN +MuppIsDfsEnabled(VOID) +{ + HANDLE Key; + ULONG Length; + NTSTATUS Status; + UNICODE_STRING KeyName; + OBJECT_ATTRIBUTES ObjectAttributes; + struct + { + KEY_VALUE_PARTIAL_INFORMATION KeyInfo; + ULONG KeyValue; + } KeyQueryOutput; + + /* You recognize FsRtlpIsDfsEnabled()! Congratz :-) */ + KeyName.Buffer = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Mup"; + KeyName.Length = sizeof(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Mup") - sizeof(UNICODE_NULL); + KeyName.MaximumLength = sizeof(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Mup"); + + /* Simply query registry to know whether we have to disable DFS. + * Unless explicitely stated in registry, we will try to enable DFS. + */ + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = ZwOpenKey(&Key, KEY_READ, &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + return TRUE; + } + + KeyName.Buffer = L"DisableDfs"; + KeyName.Length = sizeof(L"DisableDfs") - sizeof(UNICODE_NULL); + KeyName.MaximumLength = sizeof(L"DisableDfs"); + + Status = ZwQueryValueKey(Key, &KeyName, KeyValuePartialInformation, &KeyQueryOutput, sizeof(KeyQueryOutput), &Length); + ZwClose(Key); + if (!NT_SUCCESS(Status) || KeyQueryOutput.KeyInfo.Type != REG_DWORD) + { + return TRUE; + } + + return ((ULONG)KeyQueryOutput.KeyInfo.Data != 1); +} + +VOID +MupCalculateTimeout(PLARGE_INTEGER EntryTime) +{ + LARGE_INTEGER CurrentTime; + + /* Just get now + our allowed timeout */ + KeQuerySystemTime(&CurrentTime); + EntryTime->QuadPart = CurrentTime.QuadPart + MupKnownPrefixTimeout.QuadPart; +} + +PMUP_CCB +MupCreateCcb(VOID) +{ + PMUP_CCB Ccb; + + Ccb = ExAllocatePoolWithTag(PagedPool, sizeof(MUP_CCB), TAG_MUP); + if (Ccb == NULL) + { + return NULL; + } + + Ccb->NodeStatus = NODE_STATUS_HEALTHY; + Ccb->NodeReferences = 1; + Ccb->NodeType = NODE_TYPE_CCB; + Ccb->NodeSize = sizeof(MUP_CCB); + + return Ccb; +} + +PMUP_FCB +MupCreateFcb(VOID) +{ + PMUP_FCB Fcb; + + Fcb = ExAllocatePoolWithTag(PagedPool, sizeof(MUP_FCB), TAG_MUP); + if (Fcb == NULL) + { + return NULL; + } + + Fcb->NodeStatus = NODE_STATUS_HEALTHY; + Fcb->NodeReferences = 1; + Fcb->NodeType = NODE_TYPE_FCB; + Fcb->NodeSize = sizeof(MUP_FCB); + InitializeListHead(&Fcb->CcbList); + + return Fcb; +} + +PMUP_MIC +MupAllocateMasterIoContext(VOID) +{ + PMUP_MIC MasterIoContext; + + MasterIoContext = ExAllocatePoolWithTag(NonPagedPool, sizeof(MUP_MIC), TAG_MUP); + if (MasterIoContext == NULL) + { + return NULL; + } + + MasterIoContext->NodeStatus = NODE_STATUS_HEALTHY; + MasterIoContext->NodeReferences = 1; + MasterIoContext->NodeType = NODE_TYPE_MIC; + MasterIoContext->NodeSize = sizeof(MUP_MIC); + + return MasterIoContext; +} + +PMUP_UNC +MupAllocateUncProvider(ULONG RedirectorDeviceNameLength) +{ + PMUP_UNC UncProvider; + + UncProvider = ExAllocatePoolWithTag(PagedPool, sizeof(MUP_UNC) + RedirectorDeviceNameLength, TAG_MUP); + if (UncProvider == NULL) + { + return NULL; + } + + UncProvider->NodeReferences = 0; + UncProvider->NodeType = NODE_TYPE_UNC; + UncProvider->NodeStatus = NODE_STATUS_HEALTHY; + UncProvider->NodeSize = sizeof(MUP_UNC) + RedirectorDeviceNameLength; + UncProvider->Registered = FALSE; + + return UncProvider; +} + +PMUP_PFX +MupAllocatePrefixEntry(ULONG PrefixLength) +{ + PMUP_PFX Prefix; + ULONG PrefixSize; + + PrefixSize = sizeof(MUP_PFX) + PrefixLength; + Prefix = ExAllocatePoolWithTag(PagedPool, PrefixSize, TAG_MUP); + if (Prefix == NULL) + { + return NULL; + } + + RtlZeroMemory(Prefix, PrefixSize); + Prefix->NodeType = NODE_TYPE_PFX; + Prefix->NodeStatus = NODE_STATUS_HEALTHY; + Prefix->NodeReferences = 1; + Prefix->NodeSize = PrefixSize; + + /* If we got a prefix, initialize the string */ + if (PrefixLength != 0) + { + Prefix->AcceptedPrefix.Buffer = (PVOID)((ULONG_PTR)Prefix + sizeof(MUP_PFX)); + Prefix->AcceptedPrefix.Length = PrefixLength; + Prefix->AcceptedPrefix.MaximumLength = PrefixLength; + } + /* Otherwise, mark the fact that the allocation will be external */ + else + { + Prefix->ExternalAlloc = TRUE; + } + + Prefix->KeepExtraRef = FALSE; + /* Already init timeout to have one */ + MupCalculateTimeout(&Prefix->ValidityTimeout); + + return Prefix; +} + +PMUP_MQC +MupAllocateMasterQueryContext(VOID) +{ + PMUP_MQC MasterQueryContext; + + MasterQueryContext = ExAllocatePoolWithTag(NonPagedPool, sizeof(MUP_MQC), TAG_MUP); + if (MasterQueryContext == NULL) + { + return NULL; + } + + MasterQueryContext->NodeStatus = NODE_STATUS_HEALTHY; + MasterQueryContext->NodeReferences = 1; + MasterQueryContext->NodeType = NODE_TYPE_MQC; + MasterQueryContext->NodeSize = sizeof(MUP_MQC); + InitializeListHead(&MasterQueryContext->QueryPathList); + InitializeListHead(&MasterQueryContext->MQCListEntry); + ExInitializeResourceLite(&MasterQueryContext->QueryPathListLock); + + return MasterQueryContext; +} + +ULONG +MupDecodeFileObject(PFILE_OBJECT FileObject, PMUP_FCB * pFcb, PMUP_CCB * pCcb) +{ + ULONG Type; + PMUP_FCB Fcb; + + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + *pFcb = FileObject->FsContext; + *pCcb = FileObject->FsContext2; + Fcb = *pFcb; + + if (Fcb == NULL) + { + ExReleaseResourceLite(&MupGlobalLock); + return 0; + } + + Type = Fcb->NodeType; + if ((Type != NODE_TYPE_VCB && Type != NODE_TYPE_FCB) || (Fcb->NodeStatus != NODE_STATUS_HEALTHY && Fcb->NodeStatus != NODE_STATUS_CLEANUP)) + { + *pFcb = 0; + ExReleaseResourceLite(&MupGlobalLock); + return 0; + } + + ++Fcb->NodeReferences; + ExReleaseResourceLite(&MupGlobalLock); + + return Type; +} + +VOID +MupFreeNode(PVOID Node) +{ + ExFreePoolWithTag(Node, TAG_MUP); +} + +VOID +MupDereferenceFcb(PMUP_FCB Fcb) +{ + /* Just dereference and delete if no references left */ + if (InterlockedDecrement(&Fcb->NodeReferences) == 0) + { + MupFreeNode(Fcb); + } +} + +VOID +MupDereferenceCcb(PMUP_CCB Ccb) +{ + /* Just dereference and delete (and clean) if no references left */ + if (InterlockedDecrement(&Ccb->NodeReferences) == 0) + { + ExAcquireResourceExclusiveLite(&MupCcbListLock, TRUE); + RemoveEntryList(&Ccb->CcbListEntry); + ExReleaseResourceLite(&MupCcbListLock); + ObDereferenceObject(Ccb->FileObject); + MupDereferenceFcb(Ccb->Fcb); + MupFreeNode(Ccb); + } +} + +VOID +MupDereferenceVcb(PMUP_VCB Vcb) +{ + /* We cannot reach the point where no references are left */ + if (InterlockedDecrement(&Vcb->NodeReferences) == 0) + { + KeBugCheckEx(FILE_SYSTEM, 3, 0, 0, 0); + } +} + +NTSTATUS +MupDereferenceMasterIoContext(PMUP_MIC MasterIoContext, + PNTSTATUS NewStatus) +{ + PIRP Irp; + NTSTATUS Status; + PIO_STACK_LOCATION Stack; + + Status = STATUS_SUCCESS; + + if (NewStatus != NULL) + { + /* Save last status, depending on whether it failed or not */ + if (!NT_SUCCESS(*NewStatus)) + { + MasterIoContext->LastFailed = *NewStatus; + } + else + { + MasterIoContext->LastSuccess = STATUS_SUCCESS; + } + } + + if (InterlockedDecrement(&MasterIoContext->NodeReferences) != 0) + { + return STATUS_PENDING; + } + + Irp = MasterIoContext->Irp; + Stack = IoGetCurrentIrpStackLocation(Irp); + if (Stack->MajorFunction == IRP_MJ_WRITE) + { + Irp->IoStatus.Information = Stack->Parameters.Write.Length; + } + else + { + Irp->IoStatus.Information = 0; + } + + /* In case we never had any success (init is a failure), get the last failed status */ + if (!NT_SUCCESS(MasterIoContext->LastSuccess)) + { + Status = MasterIoContext->LastFailed; + } + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + MupDereferenceFcb(MasterIoContext->Fcb); + MupFreeNode(MasterIoContext); + + return Status; +} + +VOID +MupDereferenceUncProvider(PMUP_UNC UncProvider) +{ + InterlockedExchangeAdd(&UncProvider->NodeReferences, -1); +} + +VOID +MupDereferenceKnownPrefix(PMUP_PFX Prefix) +{ + /* Just dereference and delete (and clean) if no references left */ + if (InterlockedDecrement(&Prefix->NodeReferences) == 0) + { + if (Prefix->InTable) + { + RtlRemoveUnicodePrefix(&MupPrefixTable, &Prefix->PrefixTableEntry); + RemoveEntryList(&Prefix->PrefixListEntry); + } + + if (Prefix->ExternalAlloc && Prefix->AcceptedPrefix.Buffer != NULL) + { + ExFreePoolWithTag(Prefix->AcceptedPrefix.Buffer, TAG_MUP); + } + + if (Prefix->UncProvider) + { + MupDereferenceUncProvider(Prefix->UncProvider); + } + + MupFreeNode(Prefix); + } +} + +VOID +MupRemoveKnownPrefixEntry(PMUP_PFX Prefix) +{ + RtlRemoveUnicodePrefix(&MupPrefixTable, &Prefix->PrefixTableEntry); + RemoveEntryList(&Prefix->PrefixListEntry); + Prefix->InTable = FALSE; + MupDereferenceKnownPrefix(Prefix); +} + +VOID +MupInvalidatePrefixTable(VOID) +{ + PMUP_PFX Prefix; + PLIST_ENTRY Entry; + + /* Browse the prefix table */ + ExAcquireResourceExclusiveLite(&MupPrefixTableLock, TRUE); + for (Entry = MupPrefixList.Flink; + Entry != &MupPrefixList; + Entry = Entry->Flink) + { + Prefix = CONTAINING_RECORD(Entry, MUP_PFX, PrefixListEntry); + + /* And remove any entry in it */ + if (Prefix->InTable) + { + MupRemoveKnownPrefixEntry(Prefix); + } + } + ExReleaseResourceLite(&MupPrefixTableLock); +} + +VOID +MupCleanupVcb(PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PMUP_VCB Vcb) +{ + ExAcquireResourceExclusiveLite(&MupVcbLock, TRUE); + + /* Check we're not doing anything wrong first */ + if (Vcb->NodeStatus != NODE_STATUS_HEALTHY || Vcb->NodeType != NODE_TYPE_VCB) + { + ExRaiseStatus(STATUS_INVALID_HANDLE); + } + + /* Remove share access */ + IoRemoveShareAccess(IoGetCurrentIrpStackLocation(Irp)->FileObject, &Vcb->ShareAccess); + + ExReleaseResourceLite(&MupVcbLock); +} + +VOID +MupCleanupFcb(PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PMUP_FCB Fcb) +{ + PLIST_ENTRY Entry; + PMUP_CCB Ccb; + + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + /* Check we're not doing anything wrong first */ + if (Fcb->NodeStatus != NODE_STATUS_HEALTHY || Fcb->NodeType != NODE_TYPE_FCB) + { + ExRaiseStatus(STATUS_INVALID_HANDLE); + } + Fcb->NodeStatus = NODE_STATUS_CLEANUP; + ExReleaseResourceLite(&MupGlobalLock); + + /* Dereference any CCB associated with the FCB */ + ExAcquireResourceExclusiveLite(&MupCcbListLock, TRUE); + for (Entry = Fcb->CcbList.Flink; + Entry != &Fcb->CcbList; + Entry = Entry->Flink) + { + Ccb = CONTAINING_RECORD(Entry, MUP_CCB, CcbListEntry); + ExReleaseResourceLite(&MupCcbListLock); + MupDereferenceCcb(Ccb); + ExAcquireResourceExclusiveLite(&MupCcbListLock, TRUE); + } + ExReleaseResourceLite(&MupCcbListLock); +} + +NTSTATUS +CommonForwardedIoCompletionRoutine(PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PFORWARDED_IO_CONTEXT FwdCtxt) +{ + NTSTATUS Status; + + Status = Irp->IoStatus.Status; + + /* Just free everything we had allocated */ + if (Irp->MdlAddress != NULL) + { + MmUnlockPages(Irp->MdlAddress); + IoFreeMdl(Irp->MdlAddress); + } + + if (Irp->Flags & IRP_DEALLOCATE_BUFFER) + { + ExFreePoolWithTag(Irp->AssociatedIrp.SystemBuffer, TAG_MUP); + } + + IoFreeIrp(Irp); + + /* Dereference the master context + * The upper IRP will be completed once all the lower IRPs are done + * (and thus, references count reaches 0) + */ + MupDereferenceCcb(FwdCtxt->Ccb); + MupDereferenceMasterIoContext(FwdCtxt->MasterIoContext, &Status); + ExFreePoolWithTag(FwdCtxt, TAG_MUP); + + return STATUS_MORE_PROCESSING_REQUIRED; +} + +VOID +NTAPI +DeferredForwardedIoCompletionRoutine(PVOID Context) +{ + PFORWARDED_IO_CONTEXT FwdCtxt = (PFORWARDED_IO_CONTEXT)Context; + + CommonForwardedIoCompletionRoutine(FwdCtxt->DeviceObject, FwdCtxt->Irp, Context); +} + +NTSTATUS +NTAPI +ForwardedIoCompletionRoutine(PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PVOID Context) +{ + PFORWARDED_IO_CONTEXT FwdCtxt; + + /* If we're at DISPATCH_LEVEL, we cannot complete, defer completion */ + if (KeGetCurrentIrql() < DISPATCH_LEVEL) + { + CommonForwardedIoCompletionRoutine(DeviceObject, Irp, Context); + } + else + { + FwdCtxt = (PFORWARDED_IO_CONTEXT)Context; + + ExInitializeWorkItem(&FwdCtxt->WorkQueueItem, DeferredForwardedIoCompletionRoutine, Context); + ExQueueWorkItem(&FwdCtxt->WorkQueueItem, CriticalWorkQueue); + } + + return STATUS_MORE_PROCESSING_REQUIRED; +} + +NTSTATUS +BuildAndSubmitIrp(PIRP Irp, + PMUP_CCB Ccb, + PMUP_MIC MasterIoContext) +{ + PMDL Mdl; + PIRP LowerIrp; + NTSTATUS Status; + PIO_STACK_LOCATION Stack; + PDEVICE_OBJECT DeviceObject; + PFORWARDED_IO_CONTEXT FwdCtxt; + + Status = STATUS_SUCCESS; + LowerIrp = NULL; + Mdl = NULL; + + /* Allocate a context for the completion routine */ + FwdCtxt = ExAllocatePoolWithTag(NonPagedPool, sizeof(FORWARDED_IO_CONTEXT), TAG_MUP); + if (FwdCtxt == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto Cleanup; + } + + /* Init it */ + FwdCtxt->DeviceObject = NULL; + FwdCtxt->Irp = NULL; + + /* Allocate the IRP */ + DeviceObject = IoGetRelatedDeviceObject(Ccb->FileObject); + LowerIrp = IoAllocateIrp(DeviceObject->StackSize, TRUE); + if (LowerIrp == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto Cleanup; + } + + /* Initialize it */ + LowerIrp->Tail.Overlay.OriginalFileObject = Ccb->FileObject; + LowerIrp->Tail.Overlay.Thread = Irp->Tail.Overlay.Thread; + LowerIrp->RequestorMode = KernelMode; + + /* Copy the stack of the request we received to the IRP we'll pass below */ + Stack = IoGetNextIrpStackLocation(LowerIrp); + RtlMoveMemory(Stack, IoGetCurrentIrpStackLocation(Irp), sizeof(IO_STACK_LOCATION)); + Stack->FileObject = Ccb->FileObject; + /* Setup flags according to the FO */ + if (Ccb->FileObject->Flags & FO_WRITE_THROUGH) + { + Stack->Flags = SL_WRITE_THROUGH; + } + + _SEH2_TRY + { + /* Does the device requires we do buffered IOs? */ + if (DeviceObject->Flags & DO_BUFFERED_IO) + { + LowerIrp->AssociatedIrp.SystemBuffer = NULL; + + if (Stack->Parameters.Write.Length == 0) + { + LowerIrp->Flags = IRP_BUFFERED_IO; + } + /* If we have data to pass */ + else + { + /* If it's coming from usermode, probe first */ + if (Irp->RequestorMode == UserMode) + { + ProbeForRead(Irp->UserBuffer, Stack->Parameters.Write.Length, sizeof(UCHAR)); + } + + /* Allocate the buffer */ + LowerIrp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithQuotaTag(PagedPoolCacheAligned, + Stack->Parameters.Write.Length, + TAG_MUP); + if (LowerIrp->AssociatedIrp.SystemBuffer == NULL) + { + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + } + + /* And copy input (remember, we've to free!) */ + RtlMoveMemory(LowerIrp->AssociatedIrp.SystemBuffer, Irp->UserBuffer, Stack->Parameters.Write.Length); + LowerIrp->Flags = IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER; + } + } + else + { + if (!(DeviceObject->Flags & DO_DIRECT_IO)) + { + LowerIrp->UserBuffer = Irp->UserBuffer; + } + else + { + /* For direct IOs, allocate an MDL and pass it */ + if (Stack->Parameters.Write.Length != 0) + { + Mdl = IoAllocateMdl(Irp->UserBuffer, Stack->Parameters.Write.Length, FALSE, TRUE, LowerIrp); + if (Mdl == NULL) + { + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + } + + MmProbeAndLockPages(Mdl, Irp->RequestorMode, IoReadAccess); + } + } + } + + /* Fix flags in the IRP */ + if (Ccb->FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING) + { + LowerIrp->Flags |= IRP_WRITE_OPERATION | IRP_NOCACHE; + } + else + { + LowerIrp->Flags |= IRP_WRITE_OPERATION; + } + + FwdCtxt->Ccb = Ccb; + FwdCtxt->MasterIoContext = MasterIoContext; + + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + ++MasterIoContext->NodeReferences; + ExReleaseResourceLite(&MupGlobalLock); + + /* Set out completion routine */ + IoSetCompletionRoutine(LowerIrp, ForwardedIoCompletionRoutine, FwdCtxt, TRUE, TRUE, TRUE); + /* And call the device with our brand new IRP */ + Status = IoCallDriver(Ccb->DeviceObject, LowerIrp); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + +Cleanup: + if (!NT_SUCCESS(Status)) + { + if (FwdCtxt != NULL) + { + ExFreePoolWithTag(FwdCtxt, TAG_MUP); + } + + if (LowerIrp != NULL) + { + if (LowerIrp->AssociatedIrp.SystemBuffer == NULL) + { + ExFreePoolWithTag(LowerIrp->AssociatedIrp.SystemBuffer, TAG_MUP); + } + + IoFreeIrp(LowerIrp); + } + + if (Mdl != NULL) + { + IoFreeMdl(Mdl); + } + } + + return Status; +} + +NTSTATUS +NTAPI +DfsVolumePassThrough(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +NTAPI +MupForwardIoRequest(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PMUP_FCB Fcb; + PMUP_CCB Ccb; + NTSTATUS Status; + PLIST_ENTRY Entry; + PMUP_CCB FcbListCcb; + BOOLEAN CcbLockAcquired; + PMUP_MIC MasterIoContext; + PIO_STACK_LOCATION Stack; + + /* If DFS is enabled, check if that's for DFS and is so relay */ + if (MupEnableDfs && DeviceObject->DeviceType == FILE_DEVICE_DFS) + { + return DfsVolumePassThrough(DeviceObject, Irp); + } + + Stack = IoGetCurrentIrpStackLocation(Irp); + + FsRtlEnterFileSystem(); + + /* Write request is only possible for a mailslot, we need a FCB */ + MupDecodeFileObject(Stack->FileObject, &Fcb, &Ccb); + if (Fcb == NULL || Fcb->NodeType != NODE_TYPE_FCB) + { + FsRtlExitFileSystem(); + Status = STATUS_INVALID_DEVICE_REQUEST; + goto Complete; + } + + /* Allocate a context */ + MasterIoContext = MupAllocateMasterIoContext(); + if (MasterIoContext == NULL) + { + FsRtlExitFileSystem(); + Status = STATUS_INSUFFICIENT_RESOURCES; + goto Complete; + } + + /* Mark the IRP pending and init the context */ + IoMarkIrpPending(Irp); + MasterIoContext->Irp = Irp; + /* Init with a failure to catch if we ever succeed */ + MasterIoContext->LastSuccess = STATUS_UNSUCCESSFUL; + /* Init with the worth failure possible */ + MasterIoContext->LastFailed = STATUS_BAD_NETWORK_PATH; + MasterIoContext->Fcb = Fcb; + + _SEH2_TRY + { + ExAcquireResourceExclusiveLite(&MupCcbListLock, TRUE); + CcbLockAcquired = TRUE; + + /* For all the CCB (ie, the mailslots) we have */ + for (Entry = Fcb->CcbList.Flink; + Entry != &Fcb->CcbList; + Entry = Entry->Flink) + { + FcbListCcb = CONTAINING_RECORD(Entry, MUP_CCB, CcbListEntry); + ExReleaseResourceLite(&MupCcbListLock); + CcbLockAcquired = FALSE; + + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + ++FcbListCcb->NodeReferences; + ExReleaseResourceLite(&MupGlobalLock); + + /* Forward the write request */ + BuildAndSubmitIrp(Irp, FcbListCcb, MasterIoContext); + ExAcquireResourceExclusiveLite(&MupCcbListLock, TRUE); + CcbLockAcquired = TRUE; + } + + ExReleaseResourceLite(&MupCcbListLock); + CcbLockAcquired = FALSE; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + if (CcbLockAcquired) + { + ExReleaseResourceLite(&MupCcbListLock); + } + } + _SEH2_END; + + /* And done */ + MupDereferenceMasterIoContext(MasterIoContext, NULL); + FsRtlExitFileSystem(); + + return STATUS_PENDING; + +Complete: + /* Failure case */ + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + return Status; +} + +PMUP_UNC +AddUnregisteredProvider(PCWSTR DeviceName, + ULONG ProviderOrder) +{ + PMUP_UNC UncProvider; + ULONG StrLen, NameLen; + + /* Just allocate the node */ + NameLen = wcslen(DeviceName); + StrLen = NameLen * sizeof(WCHAR); + UncProvider = MupAllocateUncProvider(StrLen); + if (UncProvider == NULL) + { + return NULL; + } + + /* And init it */ + UncProvider->DeviceName.MaximumLength = StrLen; + UncProvider->DeviceName.Length = StrLen; + UncProvider->DeviceName.Buffer = (PWSTR)((ULONG_PTR)UncProvider + sizeof(MUP_UNC)); + UncProvider->ProviderOrder = ProviderOrder; + RtlMoveMemory(UncProvider->DeviceName.Buffer, DeviceName, StrLen); + + /* And add it to the global list + * We're using tail here so that when called from registry init, + * the providers with highest priority will be in the head of + * the list + */ + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + InsertTailList(&MupProviderList, &UncProvider->ProviderListEntry); + ExReleaseResourceLite(&MupGlobalLock); + + return UncProvider; +} + +VOID +InitializeProvider(PCWSTR ProviderName, + ULONG ProviderOrder) +{ + NTSTATUS Status; + HANDLE KeyHandle; + UNICODE_STRING Key, Value; + PKEY_VALUE_FULL_INFORMATION Info; + OBJECT_ATTRIBUTES ObjectAttributes; + ULONG NameLen, StrLen, ResultLength; + + /* Get the information about the provider from registry */ + NameLen = wcslen(ProviderName); + StrLen = NameLen * sizeof(WCHAR) + sizeof(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\") + sizeof(L"\\NetworkProvider"); + Key.Buffer = ExAllocatePoolWithTag(PagedPool, StrLen, TAG_MUP); + if (Key.Buffer == NULL) + { + return; + } + + RtlMoveMemory(Key.Buffer, L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\", sizeof(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\")); + Key.MaximumLength = StrLen; + Key.Length = sizeof(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\") - sizeof(UNICODE_NULL); + RtlAppendUnicodeToString(&Key, ProviderName); + RtlAppendUnicodeToString(&Key, L"\\NetworkProvider"); + + InitializeObjectAttributes(&ObjectAttributes, + &Key, + OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = ZwOpenKey(&KeyHandle, KEY_QUERY_VALUE, &ObjectAttributes); + ExFreePoolWithTag(Key.Buffer, TAG_MUP); + if (!NT_SUCCESS(Status)) + { + return; + } + + RtlInitUnicodeString(&Value, L"DeviceName"); + Status = ZwQueryValueKey(KeyHandle, &Value, KeyValueFullInformation, NULL, 0, &ResultLength); + if (Status == STATUS_BUFFER_TOO_SMALL) + { + Info = ExAllocatePoolWithTag(PagedPool, ResultLength + sizeof(UNICODE_NULL), TAG_MUP); + if (Info == NULL) + { + ZwClose(KeyHandle); + return; + } + + Status = ZwQueryValueKey(KeyHandle, &Value, KeyValueFullInformation, Info, ResultLength, &ResultLength); + } + + ZwClose(KeyHandle); + + /* And create the provider + * It will remain unregistered until FsRTL receives a registration request and forwards + * it to MUP + */ + if (NT_SUCCESS(Status)) + { + AddUnregisteredProvider((PWSTR)((ULONG_PTR)Info + Info->DataOffset), ProviderOrder); + } + + if (Info != NULL) + { + ExFreePoolWithTag(Info, TAG_MUP); + } +} + +VOID +MupGetProviderInformation(VOID) +{ + BOOLEAN End; + NTSTATUS Status; + HANDLE KeyHandle; + PWSTR Providers, Coma; + PKEY_VALUE_FULL_INFORMATION Info; + ULONG ResultLength, ProviderCount; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING NetworkProvider, ProviderOrder; + + /* Open the registry to get the order of the providers */ + RtlInitUnicodeString(&NetworkProvider, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\NetworkProvider\\Order"); + InitializeObjectAttributes(&ObjectAttributes, + &NetworkProvider, + OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = ZwOpenKey(&KeyHandle, KEY_QUERY_VALUE, &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + return; + } + + RtlInitUnicodeString(&ProviderOrder, L"ProviderOrder"); + Status = ZwQueryValueKey(KeyHandle, &ProviderOrder, KeyValueFullInformation, NULL, 0, &ResultLength); + if (Status == STATUS_BUFFER_TOO_SMALL) + { + Info = ExAllocatePoolWithTag(PagedPool, ResultLength + sizeof(UNICODE_NULL), TAG_MUP); + if (Info == NULL) + { + ZwClose(KeyHandle); + return; + } + + Status = ZwQueryValueKey(KeyHandle, &ProviderOrder, KeyValueFullInformation, Info, ResultLength, &ResultLength); + } + + ZwClose(KeyHandle); + + if (NT_SUCCESS(Status)) + { + Providers = (PWSTR)((ULONG_PTR)Info + Info->DataOffset); + End = FALSE; + ProviderCount = 0; + + /* For all the providers we got (coma-separated list), just create a provider node with the right order + * The order is just the order of the list + * First has highest priority (0) and then, get lower and lower priority + * The highest number is the lowest priority + */ + do + { + Coma = wcschr(Providers, L','); + if (Coma != NULL) + { + *Coma = UNICODE_NULL; + } + else + { + End = TRUE; + } + + InitializeProvider(Providers, ProviderCount); + ++ProviderCount; + + Providers = Coma + 1; + } while (!End); + } + + if (Info != NULL) + { + ExFreePoolWithTag(Info, TAG_MUP); + } +} + +PMUP_UNC +MupCheckForUnregisteredProvider(PUNICODE_STRING RedirectorDeviceName) +{ + PLIST_ENTRY Entry; + PMUP_UNC UncProvider; + + /* Browse the list of all the providers nodes we have */ + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + for (Entry = MupProviderList.Flink; Entry != &MupProviderList; Entry = Entry->Flink) + { + UncProvider = CONTAINING_RECORD(Entry, MUP_UNC, ProviderListEntry); + + /* If one matches the device and is not registered, that's ours! */ + if (!UncProvider->Registered && RtlEqualUnicodeString(RedirectorDeviceName, &UncProvider->DeviceName, TRUE)) + { + UncProvider->NodeStatus = NODE_STATUS_HEALTHY; + break; + } + } + + if (Entry == &MupProviderList) + { + UncProvider = NULL; + } + ExReleaseResourceLite(&MupGlobalLock); + + return UncProvider; +} + +NTSTATUS +RegisterUncProvider(PDEVICE_OBJECT DeviceObject, + PIRP Irp) + +{ + BOOLEAN New; + PMUP_FCB Fcb; + PMUP_CCB Ccb; + NTSTATUS Status; + PLIST_ENTRY Entry; + PIO_STACK_LOCATION Stack; + IO_STATUS_BLOCK IoStatusBlock; + PMUP_UNC UncProvider, ListEntry; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING RedirectorDeviceName; + OBJECT_HANDLE_INFORMATION HandleInfo; + PMUP_PROVIDER_REGISTRATION_INFO RegInfo; + + DPRINT1("RegisterUncProvider(%p, %p)\n", DeviceObject, Irp); + New = FALSE; + + /* Check whether providers order was already initialized */ + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + if (MupOrderInitialized) + { + ExReleaseResourceLite(&MupGlobalLock); + } + else + { + /* They weren't, so do it */ + MupOrderInitialized = TRUE; + ExReleaseResourceLite(&MupGlobalLock); + MupGetProviderInformation(); + } + + Stack = IoGetCurrentIrpStackLocation(Irp); + + /* This can only happen with a volume open */ + if (MupDecodeFileObject(Stack->FileObject, &Fcb, &Ccb) != NODE_TYPE_VCB) + { + Irp->IoStatus.Status = STATUS_INVALID_HANDLE; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + return STATUS_INVALID_HANDLE; + } + + /* Get the registration information */ + RegInfo = (PMUP_PROVIDER_REGISTRATION_INFO)Irp->AssociatedIrp.SystemBuffer; + _SEH2_TRY + { + RedirectorDeviceName.Length = RegInfo->RedirectorDeviceNameLength; + RedirectorDeviceName.MaximumLength = RedirectorDeviceName.Length; + RedirectorDeviceName.Buffer = (PWSTR)((ULONG_PTR)RegInfo + RegInfo->RedirectorDeviceNameOffset); + + /* Have we got already a node for it? (Like from previous init) */ + UncProvider = MupCheckForUnregisteredProvider(&RedirectorDeviceName); + if (UncProvider == NULL) + { + /* If we don't, allocate a new one */ + New = TRUE; + UncProvider = MupAllocateUncProvider(RegInfo->RedirectorDeviceNameLength); + if (UncProvider == NULL) + { + Status = STATUS_INVALID_USER_BUFFER; + _SEH2_LEAVE; + } + + /* Set it up */ + UncProvider->DeviceName.Length = RedirectorDeviceName.Length; + UncProvider->DeviceName.MaximumLength = RedirectorDeviceName.MaximumLength; + UncProvider->DeviceName.Buffer = (PWSTR)((ULONG_PTR)UncProvider + sizeof(MUP_UNC)); + + /* As it wasn't in registry for order, give the lowest priority possible */ + UncProvider->ProviderOrder = MAXLONG; + RtlMoveMemory(UncProvider->DeviceName.Buffer, (PWSTR)((ULONG_PTR)RegInfo + RegInfo->RedirectorDeviceNameOffset), RegInfo->RedirectorDeviceNameLength); + } + + /* Continue registration */ + UncProvider->MailslotsSupported = RegInfo->MailslotsSupported; + ++UncProvider->NodeReferences; + + /* Open a handle to the device */ + InitializeObjectAttributes(&ObjectAttributes, + &UncProvider->DeviceName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenFile(&UncProvider->DeviceHandle, + FILE_TRAVERSE, + &ObjectAttributes, + &IoStatusBlock, + FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_DIRECTORY_FILE); + if (NT_SUCCESS(Status)) + { + Status = IoStatusBlock.Status; + } + + /* And return the provider (as CCB) */ + if (NT_SUCCESS(Status)) + { + Stack->FileObject->FsContext2 = UncProvider; + Status = ObReferenceObjectByHandle(UncProvider->DeviceHandle, 0, NULL, KernelMode, (PVOID *)&UncProvider->FileObject, &HandleInfo); + if (!NT_SUCCESS(Status)) + { + NtClose(UncProvider->DeviceHandle); + } + } + + if (!NT_SUCCESS(Status)) + { + MupDereferenceUncProvider(UncProvider); + } + else + { + UncProvider->DeviceObject = IoGetRelatedDeviceObject(UncProvider->FileObject); + + /* Now, insert the provider in our global list + * They are sorted by order + */ + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + ++MupProviderCount; + if (New) + { + for (Entry = MupProviderList.Flink; Entry != &MupProviderList; Entry = Entry->Flink) + { + ListEntry = CONTAINING_RECORD(Entry, MUP_UNC, ProviderListEntry); + + if (UncProvider->ProviderOrder < ListEntry->ProviderOrder) + { + break; + } + } + + InsertTailList(Entry, &UncProvider->ProviderListEntry); + } + UncProvider->Registered = TRUE; + ExReleaseResourceLite(&MupGlobalLock); + Status = STATUS_SUCCESS; + + DPRINT1("UNC provider %wZ registered\n", &UncProvider->DeviceName); + } + } + _SEH2_FINALLY + { + if (_abnormal_termination()) + { + Status = STATUS_INVALID_USER_BUFFER; + } + + MupDereferenceVcb((PMUP_VCB)Fcb); + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + } + _SEH2_END; + + return Status; +} + +NTSTATUS +DfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +NTAPI +MupFsControl(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + NTSTATUS Status; + PIO_STACK_LOCATION Stack; + + Stack = IoGetCurrentIrpStackLocation(Irp); + + _SEH2_TRY + { + /* MUP only understands a single FSCTL code: registering UNC provider */ + if (Stack->Parameters.FileSystemControl.FsControlCode == FSCTL_MUP_REGISTER_PROVIDER) + { + /* It obviously has to come from a driver/kernelmode thread */ + if (Irp->RequestorMode == UserMode) + { + Status = STATUS_ACCESS_DENIED; + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + _SEH2_LEAVE; + } + + Status = RegisterUncProvider(DeviceObject, Irp); + } + else + { + /* If that's an unknown FSCTL code, maybe it's for DFS, pass it */ + if (!MupEnableDfs) + { + Status = STATUS_INVALID_PARAMETER; + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + _SEH2_LEAVE; + } + + Status = DfsFsdFileSystemControl(DeviceObject, Irp); + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + return Status; +} + +VOID +MupSetFileObject(PFILE_OBJECT FileObject, + PMUP_FCB Fcb, + PMUP_CCB Ccb) +{ + FileObject->FsContext = Fcb; + FileObject->FsContext2 = Ccb; +} + +NTSTATUS +MupRerouteOpen(PFILE_OBJECT FileObject, + PMUP_UNC UncProvider) +{ + PWSTR FullPath; + ULONG TotalLength; + + DPRINT1("Rerouting %wZ with %wZ\n", &FileObject->FileName, &UncProvider->DeviceName); + + /* Get the full path name (device name first, and requested file name appended) */ + TotalLength = UncProvider->DeviceName.Length + FileObject->FileName.Length; + if (TotalLength > MAXUSHORT) + { + return STATUS_NAME_TOO_LONG; + } + + /* Allocate a buffer big enough */ + FullPath = ExAllocatePoolWithTag(PagedPool, TotalLength, TAG_MUP); + if (FullPath == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Create the full path */ + RtlMoveMemory(FullPath, UncProvider->DeviceName.Buffer, UncProvider->DeviceName.Length); + RtlMoveMemory((PWSTR)((ULONG_PTR)FullPath + UncProvider->DeviceName.Length), FileObject->FileName.Buffer, FileObject->FileName.Length); + + /* And redo the path in the file oject */ + ExFreePoolWithTag(FileObject->FileName.Buffer, 0); + FileObject->FileName.Buffer = FullPath; + FileObject->FileName.MaximumLength = TotalLength; + FileObject->FileName.Length = FileObject->FileName.MaximumLength; + + /* Ob, please reparse to open the correct file at the right place, thanks! :-) */ + return STATUS_REPARSE; +} + +NTSTATUS +BroadcastOpen(PIRP Irp) +{ + PMUP_FCB Fcb; + PMUP_CCB Ccb; + HANDLE Handle; + PLIST_ENTRY Entry; + PMUP_UNC UncProvider; + UNICODE_STRING FullPath; + PFILE_OBJECT FileObject; + PIO_STACK_LOCATION Stack; + NTSTATUS Status, LastFailed; + ULONG TotalLength, LastOrder; + IO_STATUS_BLOCK IoStatusBlock; + OBJECT_ATTRIBUTES ObjectAttributes; + OBJECT_HANDLE_INFORMATION HandleInfo; + BOOLEAN Locked, Referenced, CcbInitialized; + + Fcb = MupCreateFcb(); + if (Fcb == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + Stack = IoGetCurrentIrpStackLocation(Irp); + FileObject = Stack->FileObject; + Locked = FALSE; + Referenced = FALSE; + CcbInitialized = FALSE; + LastFailed = STATUS_NO_SUCH_FILE; + LastOrder = (ULONG)-1; + + _SEH2_TRY + { + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + Locked = TRUE; + + /* Associate our FCB with the FO */ + MupSetFileObject(FileObject, Fcb, NULL); + Fcb->FileObject = FileObject; + + /* Now, broadcast the open to any UNC provider that supports mailslots */ + for (Entry = MupProviderList.Flink; Entry != &MupProviderList; Entry = Entry->Flink) + { + UncProvider = CONTAINING_RECORD(Entry, MUP_UNC, ProviderListEntry); + ++UncProvider->NodeReferences; + Referenced = TRUE; + + ExReleaseResourceLite(&MupGlobalLock); + Locked = FALSE; + + TotalLength = UncProvider->DeviceName.Length + FileObject->FileName.Length; + if (UncProvider->MailslotsSupported && TotalLength <= MAXUSHORT) + { + /* Provide the correct name for the mailslot (ie, happened the device name of the provider) */ + FullPath.Buffer = ExAllocatePoolWithTag(PagedPool, TotalLength, TAG_MUP); + if (FullPath.Buffer == NULL) + { + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + } + + FullPath.Length = TotalLength; + FullPath.MaximumLength = TotalLength; + RtlMoveMemory(FullPath.Buffer, UncProvider->DeviceName.Buffer, UncProvider->DeviceName.Length); + RtlMoveMemory((PWSTR)((ULONG_PTR)FullPath.Buffer + UncProvider->DeviceName.Length), + FileObject->FileName.Buffer, + FileObject->FileName.Length); + + /* And just forward the creation request */ + InitializeObjectAttributes(&ObjectAttributes, + &FullPath, + OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = IoCreateFile(&Handle, + Stack->Parameters.Create.SecurityContext->DesiredAccess & FILE_SIMPLE_RIGHTS_MASK, + &ObjectAttributes, + &IoStatusBlock, + NULL, + Stack->Parameters.Create.FileAttributes & FILE_ATTRIBUTE_VALID_FLAGS, + Stack->Parameters.Create.ShareAccess & FILE_SHARE_VALID_FLAGS, + FILE_OPEN, + Stack->Parameters.Create.Options & FILE_VALID_SET_FLAGS, + NULL, + 0, + CreateFileTypeNone, + NULL, + IO_NO_PARAMETER_CHECKING); + + ExFreePoolWithTag(FullPath.Buffer, TAG_MUP); + + /* If opening succeed */ + if (NT_SUCCESS(Status)) + { + Status = IoStatusBlock.Status; + + /* Create a CCB */ + Ccb = MupCreateCcb(); + if (Ccb == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + } + + /* And associated a FO to it */ + if (NT_SUCCESS(Status)) + { + Status = ObReferenceObjectByHandle(Handle, 0, 0, 0, (PVOID *)&Ccb->FileObject, &HandleInfo); + ZwClose(Handle); + } + } + + /* If we failed, remember the last failed status of the higher priority provider */ + if (!NT_SUCCESS(Status)) + { + if (UncProvider->ProviderOrder <= LastOrder) + { + LastOrder = UncProvider->ProviderOrder; + LastFailed = Status; + } + } + /* Otherwise, properly attach our CCB to the mailslot */ + else + { + Ccb->DeviceObject = IoGetRelatedDeviceObject(Ccb->FileObject); + Ccb->Fcb = Fcb; + + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + Locked = TRUE; + ++Fcb->NodeReferences; + ExReleaseResourceLite(&MupGlobalLock); + Locked = FALSE; + CcbInitialized = TRUE; + + InsertTailList(&Fcb->CcbList, &Ccb->CcbListEntry); + } + } + + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + Locked = TRUE; + MupDereferenceUncProvider(UncProvider); + Referenced = FALSE; + } + + ExReleaseResourceLite(&MupGlobalLock); + Locked = FALSE; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + /* If we at least opened one mailslot, return success */ + Status = (CcbInitialized ? STATUS_SUCCESS : LastFailed); + + if (Referenced) + { + MupDereferenceUncProvider(UncProvider); + } + + if (Locked) + { + ExReleaseResourceLite(&MupGlobalLock); + } + + /* In case of failure, don't leak CCB */ + if (!NT_SUCCESS(Status) && Ccb != NULL) + { + MupFreeNode(Ccb); + } + + return Status; +} + +PIRP +MupBuildIoControlRequest(PFILE_OBJECT FileObject, + PVOID Context, + ULONG MajorFunction, + ULONG IoctlCode, + PVOID InputBuffer, + ULONG InputBufferSize, + PVOID OutputBuffer, + ULONG OutputBufferSize, + PIO_COMPLETION_ROUTINE CompletionRoutine) +{ + PIRP Irp; + PIO_STACK_LOCATION Stack; + PDEVICE_OBJECT DeviceObject; + + if (InputBuffer == NULL) + { + return NULL; + } + + /* Get the device object */ + DeviceObject = IoGetRelatedDeviceObject(FileObject); + /* Allocate the IRP (with one more location for us */ + Irp = IoAllocateIrp(DeviceObject->StackSize + 1, FALSE); + if (Irp == NULL) + { + return NULL; + } + + /* Skip our location */ + IoSetNextIrpStackLocation(Irp); + /* Setup the IRP */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + IoSetCompletionRoutine(Irp, CompletionRoutine, Context, TRUE, TRUE, TRUE); + + /* Setup the stack */ + Stack = IoGetNextIrpStackLocation(Irp); + Stack->MajorFunction = MajorFunction; + Stack->Parameters.DeviceIoControl.OutputBufferLength = OutputBufferSize; + Stack->Parameters.DeviceIoControl.InputBufferLength = InputBufferSize; + Stack->Parameters.DeviceIoControl.IoControlCode = IoctlCode; + Stack->MinorFunction = 0; + Stack->FileObject = FileObject; + Stack->DeviceObject = DeviceObject; + + switch (IO_METHOD_FROM_CTL_CODE(IoctlCode)) + { + case METHOD_BUFFERED: + /* If it's buffered, just pass the buffers we got */ + Irp->MdlAddress = NULL; + Irp->AssociatedIrp.SystemBuffer = InputBuffer; + Irp->UserBuffer = OutputBuffer; + Irp->Flags = IRP_BUFFERED_IO; + + if (OutputBuffer != NULL) + { + Irp->Flags |= IRP_INPUT_OPERATION; + } + break; + + case METHOD_IN_DIRECT: + case METHOD_OUT_DIRECT: + /* Otherwise, allocate an MDL */ + if (IoAllocateMdl(InputBuffer, InputBufferSize, FALSE, FALSE, Irp) == NULL) + { + IoFreeIrp(Irp); + return NULL; + } + + Irp->AssociatedIrp.SystemBuffer = InputBuffer; + Irp->Flags = IRP_BUFFERED_IO; + MmProbeAndLockPages(Irp->MdlAddress, KernelMode, IoReadAccess); + break; + + case METHOD_NEITHER: + /* Or pass the buffers */ + Irp->UserBuffer = OutputBuffer; + Irp->MdlAddress = NULL; + Irp->AssociatedIrp.SystemBuffer = NULL; + Stack->Parameters.DeviceIoControl.Type3InputBuffer = InputBuffer; + break; + } + + return Irp; +} + +VOID +MupFreeMasterQueryContext(PMUP_MQC MasterQueryContext) +{ + ExDeleteResourceLite(&MasterQueryContext->QueryPathListLock); + ExFreePoolWithTag(MasterQueryContext, TAG_MUP); +} + +NTSTATUS +MupDereferenceMasterQueryContext(PMUP_MQC MasterQueryContext) +{ + LONG References; + NTSTATUS Status; + BOOLEAN KeepExtraRef; + + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + --MasterQueryContext->NodeReferences; + References = MasterQueryContext->NodeReferences; + ExReleaseResourceLite(&MupGlobalLock); + + if (References != 0) + { + DPRINT1("Still having refs (%ld)\n", References); + return STATUS_PENDING; + } + + /* We HAVE an IRP to complete. It cannot be NULL + * Please, help preserving kittens, don't provide NULL IRPs. + */ + if (MasterQueryContext->Irp == NULL) + { + KeBugCheck(FILE_SYSTEM); + } + + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + RemoveEntryList(&MasterQueryContext->MQCListEntry); + ExReleaseResourceLite(&MupGlobalLock); + + ExAcquireResourceExclusiveLite(&MupPrefixTableLock, TRUE); + KeepExtraRef = MasterQueryContext->Prefix->KeepExtraRef; + MupDereferenceKnownPrefix(MasterQueryContext->Prefix); + + /* We found a provider? */ + if (MasterQueryContext->LatestProvider != NULL) + { + /* With a successful status? */ + if (MasterQueryContext->LatestStatus == STATUS_SUCCESS) + { + /* Then, it's time to reroute, someone accepted to handle the file creation request! */ + if (!KeepExtraRef) + { + MupDereferenceKnownPrefix(MasterQueryContext->Prefix); + } + + ExReleaseResourceLite(&MupPrefixTableLock); + /* Reroute & complete :-) */ + Status = MupRerouteOpen(MasterQueryContext->FileObject, MasterQueryContext->LatestProvider); + goto Complete; + } + else + { + MupDereferenceUncProvider(MasterQueryContext->LatestProvider); + } + } + + MupDereferenceKnownPrefix(MasterQueryContext->Prefix); + ExReleaseResourceLite(&MupPrefixTableLock); + + /* Return the highest failed status we had */ + Status = MasterQueryContext->LatestStatus; + +Complete: + /* In finally, complete the IRP for real! */ + MasterQueryContext->Irp->IoStatus.Status = Status; + IofCompleteRequest(MasterQueryContext->Irp, IO_DISK_INCREMENT); + + MasterQueryContext->Irp = NULL; + MupFreeMasterQueryContext(MasterQueryContext); + + return Status; +} + +NTSTATUS +NTAPI +QueryPathCompletionRoutine(PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PVOID Context) +{ + PMUP_PFX Prefix; + ULONG LatestPos, Pos; + PWSTR AcceptedPrefix; + PMUP_MQC MasterQueryContext; + NTSTATUS Status, TableStatus; + PQUERY_PATH_CONTEXT QueryContext; + PQUERY_PATH_RESPONSE QueryResponse; + + /* Get all the data from our query to the provider */ + QueryContext = (PQUERY_PATH_CONTEXT)Context; + QueryResponse = (PQUERY_PATH_RESPONSE)QueryContext->QueryPathRequest; + MasterQueryContext = QueryContext->MasterQueryContext; + Status = Irp->IoStatus.Status; + + DPRINT1("Reply from %wZ: %u (Status: %lx)\n", &QueryContext->UncProvider->DeviceName, QueryResponse->LengthAccepted, Status); + + ExAcquireResourceExclusiveLite(&MasterQueryContext->QueryPathListLock, TRUE); + RemoveEntryList(&QueryContext->QueryPathListEntry); + + /* If the driver returned a success, and an acceptance length */ + if (NT_SUCCESS(Status) && QueryResponse->LengthAccepted > 0) + { + Prefix = MasterQueryContext->Prefix; + + /* Check if we already found a provider from a previous iteration */ + if (MasterQueryContext->LatestProvider != NULL) + { + /* If the current provider has a lower priority (ie, a greater order), then, bailout and keep previous one */ + if (QueryContext->UncProvider->ProviderOrder >= MasterQueryContext->LatestProvider->ProviderOrder) + { + MupDereferenceUncProvider(QueryContext->UncProvider); + goto Cleanup; + } + + /* Otherwise, if the prefix was in the prefix table, just drop it: + * we have a provider which superseeds the accepted prefix, so leave + * room for the new prefix/provider + */ + ExAcquireResourceExclusiveLite(&MupPrefixTableLock, TRUE); + if (Prefix->InTable) + { + RtlRemoveUnicodePrefix(&MupPrefixTable, &Prefix->PrefixTableEntry); + RemoveEntryList(&Prefix->PrefixListEntry); + Prefix->InTable = FALSE; + } + ExReleaseResourceLite(&MupPrefixTableLock); + + Prefix->KeepExtraRef = FALSE; + + /* Release data associated with the current prefix, if any + * We'll renew them with the new accepted prefix + */ + if (Prefix->AcceptedPrefix.Length != 0 && Prefix->AcceptedPrefix.Buffer != NULL) + { + ExFreePoolWithTag(Prefix->AcceptedPrefix.Buffer, TAG_MUP); + Prefix->AcceptedPrefix.MaximumLength = 0; + Prefix->AcceptedPrefix.Length = 0; + Prefix->AcceptedPrefix.Buffer = NULL; + Prefix->ExternalAlloc = FALSE; + } + + /* If there was also a provider, drop it, the new one + * is different + */ + if (Prefix->UncProvider != NULL) + { + MupDereferenceUncProvider(Prefix->UncProvider); + Prefix->UncProvider = NULL; + } + } + + /* Now, set our information about the provider that accepted the prefix */ + MasterQueryContext->LatestProvider = QueryContext->UncProvider; + MasterQueryContext->LatestStatus = Status; + + if (MasterQueryContext->FileObject->FsContext2 != DFS_MAGIC_CCB) + { + /* Allocate a buffer for the prefix */ + AcceptedPrefix = ExAllocatePoolWithTag(PagedPool, QueryResponse->LengthAccepted, TAG_MUP); + if (AcceptedPrefix == NULL) + { + Prefix->InTable = FALSE; + } + else + { + /* Set it up to the accepted length */ + RtlMoveMemory(AcceptedPrefix, MasterQueryContext->FileObject->FileName.Buffer, QueryResponse->LengthAccepted); + Prefix->UncProvider = MasterQueryContext->LatestProvider; + Prefix->AcceptedPrefix.Buffer = AcceptedPrefix; + Prefix->AcceptedPrefix.Length = QueryResponse->LengthAccepted; + Prefix->AcceptedPrefix.MaximumLength = QueryResponse->LengthAccepted; + Prefix->ExternalAlloc = TRUE; + + /* Insert the accepted prefix in the table of known prefixes */ + DPRINT1("%wZ accepted %wZ\n", &Prefix->UncProvider->DeviceName, &Prefix->AcceptedPrefix); + ExAcquireResourceExclusiveLite(&MupPrefixTableLock, TRUE); + if (RtlInsertUnicodePrefix(&MupPrefixTable, &Prefix->AcceptedPrefix, &Prefix->PrefixTableEntry)) + { + InsertHeadList(&MupPrefixList, &Prefix->PrefixListEntry); + Prefix->InTable = TRUE; + Prefix->KeepExtraRef = TRUE; + } + else + { + Prefix->InTable = FALSE; + } + ExReleaseResourceLite(&MupPrefixTableLock); + } + } + } + else + { + MupDereferenceUncProvider(QueryContext->UncProvider); + + /* We failed and didn't find any provider over the latest iterations */ + if (MasterQueryContext->LatestProvider == NULL) + { + /* If we had a success though (broken provider?) set our failed status */ + if (NT_SUCCESS(MasterQueryContext->LatestStatus)) + { + MasterQueryContext->LatestStatus = Status; + } + else + { + TableStatus = MupOrderedErrorList[0]; + LatestPos = 0; + + /* Otherwise, time to compare statuteses, between the latest failed + * and the current failure. + * We have an order table of failed status: the deeper you go in the + * table, the more the error is critical. + * Our goal is to return the most critical status that was returned by + * any of the providers + */ + + /* Look for latest status position */ + while (TableStatus != 0 && TableStatus != MasterQueryContext->LatestStatus) + { + ++LatestPos; + TableStatus = MupOrderedErrorList[LatestPos]; + } + + /* If at pos 0, the new status is likely more critical */ + if (LatestPos == 0) + { + MasterQueryContext->LatestStatus = Status; + } + else + { + /* Otherwise, find position of the new status in the table */ + Pos = 0; + do + { + if (Status == MupOrderedErrorList[Pos]) + { + break; + } + + ++Pos; + } + while (Pos < LatestPos); + + /* If it has a higher position (more critical), return it */ + if (Pos >= LatestPos) + { + MasterQueryContext->LatestStatus = Status; + } + } + } + } + } + +Cleanup: + ExFreePoolWithTag(QueryResponse, TAG_MUP); + ExFreePoolWithTag(QueryContext, TAG_MUP); + IoFreeIrp(Irp); + + ExReleaseResourceLite(&MasterQueryContext->QueryPathListLock); + MupDereferenceMasterQueryContext(MasterQueryContext); + + return STATUS_MORE_PROCESSING_REQUIRED; +} + +NTSTATUS +DfsFsdCreate(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +CreateRedirectedFile(PIRP Irp, + PFILE_OBJECT FileObject, + PIO_SECURITY_CONTEXT SecurityContext) +{ + LONG Len; + WCHAR Cur; + PWSTR Name; + PIRP QueryIrp; + NTSTATUS Status; + PMUP_PFX Prefix; + PLIST_ENTRY Entry; + PMUP_UNC UncProvider; + PIO_STACK_LOCATION Stack; + LARGE_INTEGER CurrentTime; + PMUP_MQC MasterQueryContext; + PQUERY_PATH_CONTEXT QueryContext; + PQUERY_PATH_REQUEST QueryPathRequest; + PUNICODE_PREFIX_TABLE_ENTRY TableEntry; + BOOLEAN Locked, Referenced, BreakOnFirst; + + /* We cannot open a file without a name */ + if (FileObject->FileName.Length == 0) + { + Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + return STATUS_INVALID_DEVICE_REQUEST; + } + + DPRINT1("Request for opening: %wZ\n", &FileObject->FileName); + + Referenced = FALSE; + BreakOnFirst = TRUE; + Status = STATUS_BAD_NETWORK_PATH; + + ExAcquireResourceExclusiveLite(&MupPrefixTableLock, TRUE); + /* First, try to see if that's a prefix we already know */ + TableEntry = RtlFindUnicodePrefix(&MupPrefixTable, &FileObject->FileName, 1); + if (TableEntry != NULL) + { + Prefix = CONTAINING_RECORD(TableEntry, MUP_PFX, PrefixTableEntry); + + DPRINT1("Matching prefix found: %wZ\n", &Prefix->AcceptedPrefix); + + /* If so, check whether the prefix is still valid */ + KeQuerySystemTime(&CurrentTime); + if (Prefix->ValidityTimeout.QuadPart < CurrentTime.QuadPart) + { + /* It is: so, update its validity period and reroute file opening */ + MupCalculateTimeout(&Prefix->ValidityTimeout); + Status = MupRerouteOpen(FileObject, Prefix->UncProvider); + ExReleaseResourceLite(&MupPrefixTableLock); + + if (Status == STATUS_REPARSE) + { + Irp->IoStatus.Information = FILE_SUPERSEDED; + } + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + return Status; + } + + /* When here, we found a matching prefix, but expired, remove it from the table + * We'll redo a full search + */ + if (Prefix->InTable) + { + MupRemoveKnownPrefixEntry(Prefix); + } + } + ExReleaseResourceLite(&MupPrefixTableLock); + + Stack = IoGetCurrentIrpStackLocation(Irp); + /* First of all, start looking for a mailslot */ + if (FileObject->FileName.Buffer[0] == L'\\' && Stack->MajorFunction != IRP_MJ_CREATE) + { + Name = &FileObject->FileName.Buffer[1]; + Len = FileObject->FileName.Length; + + /* Skip the remote destination name */ + do + { + Len -= sizeof(WCHAR); + if (Len <= 0) + { + break; + } + + Cur = *Name; + ++Name; + } while (Cur != L'\\'); + Len -= sizeof(WCHAR); + + /* If we still have room for "Mailslot" to fit */ + if (Len >= (sizeof(L"Mailslot") - sizeof(UNICODE_NULL))) + { + /* Get the len in terms of chars count */ + Len /= sizeof(WCHAR); + if (Len > ((sizeof(L"Mailslot") - sizeof(UNICODE_NULL)) / sizeof(WCHAR))) + { + Len = (sizeof(L"Mailslot") - sizeof(UNICODE_NULL)) / sizeof(WCHAR); + } + + /* It's indeed a mailslot opening! */ + if (_wcsnicmp(Name, L"Mailslot", Len) == 0) + { + /* Broadcast open */ + Status = BroadcastOpen(Irp); + if (Status == STATUS_REPARSE) + { + Irp->IoStatus.Information = FILE_SUPERSEDED; + } + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + return Status; + } + } + } + + /* Ok, at that point, that's a regular MUP opening (if no DFS) */ + if (!MupEnableDfs || FileObject->FsContext2 == DFS_MAGIC_CCB) + { + /* We won't complete immediately */ + IoMarkIrpPending(Irp); + + /* Allocate a new prefix for our search */ + Prefix = MupAllocatePrefixEntry(0); + if (Prefix == NULL) + { + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + return STATUS_PENDING; + } + + /* Allocate a context for our search */ + MasterQueryContext = MupAllocateMasterQueryContext(); + if (MasterQueryContext == NULL) + { + MupFreeNode(Prefix); + + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + return STATUS_PENDING; + } + + MasterQueryContext->Irp = Irp; + MasterQueryContext->FileObject = FileObject; + MasterQueryContext->LatestProvider = NULL; + MasterQueryContext->Prefix = Prefix; + MasterQueryContext->LatestStatus = STATUS_BAD_NETWORK_PATH; + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + InsertTailList(&MupMasterQueryList, &MasterQueryContext->MQCListEntry); + ++Prefix->NodeReferences; + ExReleaseResourceLite(&MupGlobalLock); + + _SEH2_TRY + { + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + Locked = TRUE; + + /* Now, we will browse all the providers we know, to ask for their accepted prefix regarding the path */ + for (Entry = MupProviderList.Flink; Entry != &MupProviderList; Entry = Entry->Flink) + { + UncProvider = CONTAINING_RECORD(Entry, MUP_UNC, ProviderListEntry); + + ++UncProvider->NodeReferences; + Referenced = TRUE; + + ExReleaseResourceLite(&MupGlobalLock); + Locked = FALSE; + + /* We will obviously only query registered providers */ + if (UncProvider->Registered) + { + /* We will issue an IOCTL_REDIR_QUERY_PATH, so allocate input buffer */ + QueryPathRequest = ExAllocatePoolWithTag(PagedPool, FileObject->FileName.Length + sizeof(QUERY_PATH_REQUEST), TAG_MUP); + if (QueryPathRequest == NULL) + { + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + } + + /* Allocate a context for IRP completion routine + * In case a prefix matches the path, the reroute will happen + * in the completion routine, when we have return from the provider + */ + QueryContext = ExAllocatePoolWithTag(PagedPool, sizeof(QUERY_PATH_CONTEXT), TAG_MUP); + if (QueryContext == NULL) + { + ExFreePoolWithTag(QueryPathRequest, TAG_MUP); + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + } + + InitializeListHead(&QueryContext->QueryPathListEntry); + QueryContext->MasterQueryContext = MasterQueryContext; + QueryContext->QueryPathRequest = QueryPathRequest; + QueryPathRequest->PathNameLength = FileObject->FileName.Length; + QueryPathRequest->SecurityContext = SecurityContext; + RtlMoveMemory(QueryPathRequest->FilePathName, FileObject->FileName.Buffer, FileObject->FileName.Length); + + /* Build our IRP for the query */ + QueryIrp = MupBuildIoControlRequest(UncProvider->FileObject, + QueryContext, + IRP_MJ_DEVICE_CONTROL, + IOCTL_REDIR_QUERY_PATH, + QueryPathRequest, + FileObject->FileName.Length + sizeof(QUERY_PATH_REQUEST), + QueryPathRequest, + sizeof(QUERY_PATH_RESPONSE), + QueryPathCompletionRoutine); + if (QueryIrp == NULL) + { + ExFreePoolWithTag(QueryContext, TAG_MUP); + ExFreePoolWithTag(QueryPathRequest, TAG_MUP); + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + } + + QueryIrp->RequestorMode = KernelMode; + QueryContext->UncProvider = UncProvider; + QueryContext->Irp = QueryIrp; + + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + ++UncProvider->NodeReferences; + ++MasterQueryContext->NodeReferences; + ExReleaseResourceLite(&MupGlobalLock); + + ExAcquireResourceExclusiveLite(&MasterQueryContext->QueryPathListLock, TRUE); + InsertTailList(&MasterQueryContext->QueryPathList, &QueryContext->QueryPathListEntry); + ExReleaseResourceLite(&MasterQueryContext->QueryPathListLock); + + /* Query the provider !*/ + DPRINT1("Requeting UNC provider: %wZ\n", &UncProvider->DeviceName); + DPRINT1("Calling: %wZ\n", &UncProvider->DeviceObject->DriverObject->DriverName); + Status = IoCallDriver(UncProvider->DeviceObject, QueryIrp); + } + + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + Locked = TRUE; + + /* We're done with that provider */ + MupDereferenceUncProvider(UncProvider); + Referenced = FALSE; + + /* If query went fine on the first request, just break and leave */ + if (BreakOnFirst && Status == STATUS_SUCCESS) + { + break; + } + + BreakOnFirst = FALSE; + } + } + _SEH2_FINALLY + { + if (_abnormal_termination()) + { + MasterQueryContext->LatestStatus = STATUS_INSUFFICIENT_RESOURCES; + } + + if (Referenced) + { + MupDereferenceUncProvider(UncProvider); + } + + if (Locked) + { + ExReleaseResourceLite(&MupGlobalLock); + } + + MupDereferenceMasterQueryContext(MasterQueryContext); + + Status = STATUS_PENDING; + } + _SEH2_END; + } + else + { + UNIMPLEMENTED; + Status = STATUS_NOT_IMPLEMENTED; + } + + return Status; +} + +NTSTATUS +OpenMupFileSystem(PMUP_VCB Vcb, + PFILE_OBJECT FileObject, + ACCESS_MASK DesiredAccess, + USHORT ShareAccess) +{ + NTSTATUS Status; + + DPRINT1("Opening MUP\n"); + + ExAcquireResourceExclusiveLite(&MupVcbLock, TRUE); + _SEH2_TRY + { + /* Update share access, increase reference count, and associated VCB to the FO, that's it! */ + Status = IoCheckShareAccess(DesiredAccess, ShareAccess, FileObject, &Vcb->ShareAccess, TRUE); + if (NT_SUCCESS(Status)) + { + ++Vcb->NodeReferences; + MupSetFileObject(FileObject, (PMUP_FCB)Vcb, NULL); + Status = STATUS_SUCCESS; + } + } + _SEH2_FINALLY + { + ExReleaseResourceLite(&MupVcbLock); + } + _SEH2_END; + + return Status; +} + +NTSTATUS +NTAPI +MupCreate(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + NTSTATUS Status; + PIO_STACK_LOCATION Stack; + PFILE_OBJECT FileObject, RelatedFileObject; + + FsRtlEnterFileSystem(); + + _SEH2_TRY + { + /* If DFS is enabled, check if that's for DFS and is so relay */ + if (MupEnableDfs) + { + if (DeviceObject->DeviceType == FILE_DEVICE_DFS || DeviceObject->DeviceType == FILE_DEVICE_DFS_FILE_SYSTEM) + { + Status = DfsFsdCreate(DeviceObject, Irp); + } + } + else + { + Stack = IoGetCurrentIrpStackLocation(Irp); + FileObject = Stack->FileObject; + RelatedFileObject = FileObject->RelatedFileObject; + + /* If we have a file name or if the associated FCB of the related FO isn't the VCB, then, it's a regular opening */ + if (FileObject->FileName.Length != 0 || (RelatedFileObject != NULL && ((PMUP_FCB)(RelatedFileObject->FsContext))->NodeType != NODE_TYPE_VCB)) + { + Status = CreateRedirectedFile(Irp, FileObject, Stack->Parameters.Create.SecurityContext); + } + /* Otherwise, it's just a volume open */ + else + { + Status = OpenMupFileSystem(DeviceObject->DeviceExtension, + FileObject, + Stack->Parameters.Create.SecurityContext->DesiredAccess, + Stack->Parameters.Create.ShareAccess); + + Irp->IoStatus.Information = FILE_OPENED; + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + } + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + } + _SEH2_END; + + FsRtlExitFileSystem(); + + return Status; +} + +VOID +MupCloseUncProvider(PMUP_UNC UncProvider) +{ + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + + /* If the node was still valid, reregister the UNC provider */ + if (UncProvider->NodeStatus == NODE_STATUS_HEALTHY) + { + UncProvider->NodeStatus = NODE_STATUS_CLEANUP; + UncProvider->Registered = FALSE; + ExReleaseResourceLite(&MupGlobalLock); + + if (UncProvider->FileObject != NULL) + { + ZwClose(UncProvider->DeviceHandle); + ObDereferenceObject(UncProvider->FileObject); + } + } + else + { + ExReleaseResourceLite(&MupGlobalLock); + } +} + +NTSTATUS +DfsFsdCleanup(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +NTAPI +MupCleanup(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + ULONG Type; + PMUP_FCB Fcb; + PMUP_CCB Ccb; + NTSTATUS Status; + PIO_STACK_LOCATION Stack; + + /* If DFS is enabled, check if that's for DFS and is so relay */ + if (MupEnableDfs) + { + if (DeviceObject->DeviceType == FILE_DEVICE_DFS || DeviceObject->DeviceType == FILE_DEVICE_DFS_FILE_SYSTEM) + { + return DfsFsdCleanup(DeviceObject, Irp); + } + } + + FsRtlEnterFileSystem(); + + _SEH2_TRY + { + Stack = IoGetCurrentIrpStackLocation(Irp); + Type = MupDecodeFileObject(Stack->FileObject, &Fcb, &Ccb); + switch (Type) + { + case NODE_TYPE_VCB: + /* If we got a VCB, clean it up */ + MupCleanupVcb(DeviceObject, Irp, (PMUP_VCB)Fcb); + + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + MupDereferenceVcb((PMUP_VCB)Fcb); + + /* If Ccb is not null, then, it's a UNC provider node */ + if (Ccb) + { + /* Close it, and dereference */ + MupCloseUncProvider((PMUP_UNC)Ccb); + MupDereferenceUncProvider((PMUP_UNC)Ccb); + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + --MupProviderCount; + ExReleaseResourceLite(&MupGlobalLock); + } + + Status = STATUS_SUCCESS; + break; + + case NODE_TYPE_FCB: + /* If the node wasn't already cleaned, do it */ + if (Fcb->NodeStatus == NODE_STATUS_HEALTHY) + { + MupCleanupFcb(DeviceObject, Irp, Fcb); + Status = STATUS_SUCCESS; + } + else + { + Status = STATUS_INVALID_HANDLE; + } + + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + MupDereferenceFcb(Fcb); + break; + + default: + Status = STATUS_INVALID_HANDLE; + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + break; + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + FsRtlExitFileSystem(); + + return Status; +} + +NTSTATUS +MupCloseVcb(PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PMUP_VCB Vcb, + PFILE_OBJECT FileObject) +{ + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + + /* Remove FCB, UNC from FO */ + MupSetFileObject(FileObject, NULL, NULL); + MupDereferenceVcb(Vcb); + + ExReleaseResourceLite(&MupGlobalLock); + + return STATUS_SUCCESS; +} + +NTSTATUS +MupCloseFcb(PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PMUP_FCB Fcb, + PFILE_OBJECT FileObject) +{ + ExAcquireResourceExclusiveLite(&MupGlobalLock, TRUE); + + /* Remove FCB, CCB from FO */ + MupSetFileObject(FileObject, NULL, NULL); + MupDereferenceFcb(Fcb); + + ExReleaseResourceLite(&MupGlobalLock); + + return STATUS_SUCCESS; +} + +NTSTATUS +DfsFsdClose(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +NTAPI +MupClose(PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PMUP_FCB Fcb; + PMUP_CCB Ccb; + NTSTATUS Status; + PIO_STACK_LOCATION Stack; + + /* If DFS is enabled, check if that's for DFS and is so relay */ + if (MupEnableDfs) + { + if (DeviceObject->DeviceType == FILE_DEVICE_DFS || DeviceObject->DeviceType == FILE_DEVICE_DFS_FILE_SYSTEM) + { + return DfsFsdClose(DeviceObject, Irp); + } + } + + FsRtlEnterFileSystem(); + + _SEH2_TRY + { + /* Get our internal structures from FO */ + Stack = IoGetCurrentIrpStackLocation(Irp); + MupDecodeFileObject(Stack->FileObject, &Fcb, &Ccb); + if (Fcb == NULL) + { + Status = STATUS_INVALID_HANDLE; + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + _SEH2_LEAVE; + } + + /* If we got the VCB, that's a volume close */ + if (Fcb->NodeType == NODE_TYPE_VCB) + { + Status = MupCloseVcb(DeviceObject, Irp, (PMUP_VCB)Fcb, Stack->FileObject); + } + /* Otherwise close the FCB */ + else if (Fcb->NodeType == NODE_TYPE_FCB) + { + MupDereferenceFcb(Fcb); + Status = MupCloseFcb(DeviceObject, Irp, Fcb, Stack->FileObject); + } + else + { + Status = STATUS_INVALID_HANDLE; + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + + _SEH2_LEAVE; + } + + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_DISK_INCREMENT); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + FsRtlExitFileSystem(); + + return Status; +} + +VOID +DfsUnload(PDRIVER_OBJECT DriverObject) +{ + UNIMPLEMENTED; +} + +VOID +NTAPI +MupUnload(PDRIVER_OBJECT DriverObject) +{ + IoDeleteDevice(mupDeviceObject); + + if (MupEnableDfs) + { + DfsUnload(DriverObject); + } + + MupUninitializeData(); +} + +NTSTATUS +DfsDriverEntry(PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath) +{ + /* We don't support DFS yet, so + * fail to make sure it remains disabled + */ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} /* * FUNCTION: Called by the system to initialize the driver @@ -40,60 +2530,56 @@ * RegistryPath = path to our configuration entries * RETURNS: Success or failure */ -NTSTATUS NTAPI +NTSTATUS +NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) { + NTSTATUS Status; + UNICODE_STRING MupString; PDEVICE_OBJECT DeviceObject; - NTSTATUS Status; - UNICODE_STRING DeviceName; - - UNREFERENCED_PARAMETER(RegistryPath); - - DPRINT("MUP 0.0.1\n"); - - RtlInitUnicodeString(&DeviceName, - L"\\Device\\Mup"); - Status = IoCreateDevice(DriverObject, - sizeof(DEVICE_EXTENSION), - &DeviceName, - FILE_DEVICE_MULTI_UNC_PROVIDER, - 0, - FALSE, - &DeviceObject); + + /* Only initialize global state of the driver + * Other inits will happen when required + */ + MupInitializeData(); + + /* Check if DFS is disabled */ + MupEnableDfs = MuppIsDfsEnabled(); + /* If it's not disabled but when cannot init, disable it */ + if (MupEnableDfs && !NT_SUCCESS(DfsDriverEntry(DriverObject, RegistryPath))) + { + MupEnableDfs = FALSE; + } + + /* Create the MUP device */ + RtlInitUnicodeString(&MupString, L"\\Device\\Mup"); + Status = IoCreateDevice(DriverObject, sizeof(MUP_VCB), &MupString, FILE_DEVICE_MULTI_UNC_PROVIDER, 0, FALSE, &DeviceObject); if (!NT_SUCCESS(Status)) { + if (MupEnableDfs) + { + DfsUnload(DriverObject); + } + + MupUninitializeData(); + return Status; } - /* Initialize driver data */ - DeviceObject->Flags |= DO_DIRECT_IO; -// DriverObject->MajorFunction[IRP_MJ_CLOSE] = NtfsClose; + /* Set our MJ */ + DriverObject->DriverUnload = MupUnload; DriverObject->MajorFunction[IRP_MJ_CREATE] = MupCreate; DriverObject->MajorFunction[IRP_MJ_CREATE_NAMED_PIPE] = MupCreate; DriverObject->MajorFunction[IRP_MJ_CREATE_MAILSLOT] = MupCreate; -// DriverObject->MajorFunction[IRP_MJ_READ] = NtfsRead; -// DriverObject->MajorFunction[IRP_MJ_WRITE] = NtfsWrite; -// DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = -// NtfsFileSystemControl; -// DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = -// NtfsDirectoryControl; -// DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = -// NtfsQueryInformation; -// DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = -// NtfsQueryVolumeInformation; -// DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] = -// NtfsSetVolumeInformation; - - DriverObject->DriverUnload = NULL; - - - /* Initialize global data */ -// DeviceExtensionNtfsGlobalData = DeviceObject->DeviceExtension; -// RtlZeroMemory(NtfsGlobalData, -// sizeof(NTFS_GLOBAL_DATA)); -// NtfsGlobalData->DriverObject = DriverObject; -// NtfsGlobalData->DeviceObject = DeviceObject; + DriverObject->MajorFunction[IRP_MJ_WRITE] = MupForwardIoRequest; + DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = MupFsControl; + DriverObject->MajorFunction[IRP_MJ_CLEANUP] = MupCleanup; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = MupClose; + + /* And finish init */ + mupDeviceObject = DeviceObject; + MupInitializeVcb(DeviceObject->DeviceExtension); return STATUS_SUCCESS; } Modified: trunk/reactos/drivers/filesystems/mup/mup.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/mup/mu…
============================================================================== --- trunk/reactos/drivers/filesystems/mup/mup.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/mup/mup.h [iso-8859-1] Tue Aug 18 20:17:22 2015 @@ -2,24 +2,138 @@ #define _MUP_PCH_ #include <wdm.h> +#include <ntifs.h> +#include <pseh/pseh2.h> +#include <ndk/muptypes.h> #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S)) +#define IO_METHOD_FROM_CTL_CODE(C) (C & 0x00000003) -typedef struct +#define TAG_MUP ' puM' + +#define DFS_MAGIC_CCB (PVOID)0x11444653 +#define FILE_SIMPLE_RIGHTS_MASK (FILE_ALL_ACCESS & ~STANDARD_RIGHTS_REQUIRED &~ SYNCHRONIZE) + +#define NODE_TYPE_VCB 0x1 +#define NODE_TYPE_UNC 0x2 +#define NODE_TYPE_PFX 0x3 +#define NODE_TYPE_FCB 0x4 +#define NODE_TYPE_CCB 0x5 +#define NODE_TYPE_MIC 0x6 +#define NODE_TYPE_MQC 0x8 + +#define NODE_STATUS_HEALTHY 0x1 +#define NODE_STATUS_CLEANUP 0x2 + +typedef struct _MUP_VCB { - ULONG Dummy; + ULONG NodeType; + ULONG NodeStatus; + LONG NodeReferences; + ULONG NodeSize; + SHARE_ACCESS ShareAccess; +} MUP_VCB, *PMUP_VCB; -} DEVICE_EXTENSION, *PDEVICE_EXTENSION, VCB, *PVCB; +typedef struct _MUP_FCB +{ + ULONG NodeType; + ULONG NodeStatus; + LONG NodeReferences; + ULONG NodeSize; + PFILE_OBJECT FileObject; + LIST_ENTRY CcbList; +} MUP_FCB, *PMUP_FCB; -/* create.c */ -DRIVER_DISPATCH MupCreate; -NTSTATUS NTAPI -MupCreate(PDEVICE_OBJECT DeviceObject, - PIRP Irp); +typedef struct _MUP_CCB +{ + ULONG NodeType; + ULONG NodeStatus; + LONG NodeReferences; + ULONG NodeSize; + PMUP_FCB Fcb; + LIST_ENTRY CcbListEntry; + PDEVICE_OBJECT DeviceObject; + PFILE_OBJECT FileObject; +} MUP_CCB, *PMUP_CCB; -/* mup.c */ -NTSTATUS NTAPI -DriverEntry(PDRIVER_OBJECT DriverObject, - PUNICODE_STRING RegistryPath); +typedef struct _MUP_MIC +{ + ULONG NodeType; + ULONG NodeStatus; + LONG NodeReferences; + ULONG NodeSize; + PIRP Irp; + NTSTATUS LastSuccess; + NTSTATUS LastFailed; + PMUP_FCB Fcb; +} MUP_MIC, *PMUP_MIC; + +typedef struct _MUP_UNC +{ + ULONG NodeType; + ULONG NodeStatus; + LONG NodeReferences; + ULONG NodeSize; + LIST_ENTRY ProviderListEntry; + UNICODE_STRING DeviceName; + HANDLE DeviceHandle; + PDEVICE_OBJECT DeviceObject; + PFILE_OBJECT FileObject; + ULONG ProviderOrder; + BOOLEAN MailslotsSupported; + BOOLEAN Registered; +} MUP_UNC, *PMUP_UNC; + +typedef struct _MUP_PFX +{ + ULONG NodeType; + ULONG NodeStatus; + LONG NodeReferences; + ULONG NodeSize; + UNICODE_PREFIX_TABLE_ENTRY PrefixTableEntry; + UNICODE_STRING AcceptedPrefix; + ULONG Reserved; + LARGE_INTEGER ValidityTimeout; + PMUP_UNC UncProvider; + BOOLEAN ExternalAlloc; + BOOLEAN InTable; + BOOLEAN KeepExtraRef; + BOOLEAN Padding; + LIST_ENTRY PrefixListEntry; +} MUP_PFX, *PMUP_PFX; + +typedef struct _MUP_MQC +{ + ULONG NodeType; + ULONG NodeStatus; + LONG NodeReferences; + ULONG NodeSize; + PIRP Irp; + PFILE_OBJECT FileObject; + PMUP_UNC LatestProvider; + ERESOURCE QueryPathListLock; + PMUP_PFX Prefix; + NTSTATUS LatestStatus; + LIST_ENTRY QueryPathList; + LIST_ENTRY MQCListEntry; +} MUP_MQC, *PMUP_MQC; + +typedef struct _FORWARDED_IO_CONTEXT +{ + PMUP_CCB Ccb; + PMUP_MIC MasterIoContext; + WORK_QUEUE_ITEM WorkQueueItem; + PDEVICE_OBJECT DeviceObject; + PIRP Irp; +} FORWARDED_IO_CONTEXT, *PFORWARDED_IO_CONTEXT; + +typedef struct _QUERY_PATH_CONTEXT +{ + PMUP_MQC MasterQueryContext; + PMUP_UNC UncProvider; + PQUERY_PATH_REQUEST QueryPathRequest; + LIST_ENTRY QueryPathListEntry; + PIRP Irp; +} QUERY_PATH_CONTEXT, *PQUERY_PATH_CONTEXT; #endif /* _MUP_PCH_ */
9 years, 4 months
1
0
0
0
[pschweitzer] 68756: [NTOSKRNL] Don't enforce IO tag when freeing file object name, it might have been reallocated by a driver for an Ob reparse
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Tue Aug 18 20:17:19 2015 New Revision: 68756 URL:
http://svn.reactos.org/svn/reactos?rev=68756&view=rev
Log: [NTOSKRNL] Don't enforce IO tag when freeing file object name, it might have been reallocated by a driver for an Ob reparse Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/file.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/file.c [iso-8859-1] Tue Aug 18 20:17:19 2015 @@ -1002,7 +1002,7 @@ if (FileObject->FileName.Length) { /* Free it */ - ExFreePoolWithTag(FileObject->FileName.Buffer, TAG_IO_NAME); + ExFreePoolWithTag(FileObject->FileName.Buffer, 0); FileObject->FileName.Length = 0; }
9 years, 4 months
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
...
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