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
November 2016
----- 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
317 discussions
Start a n
N
ew thread
[gadamopoulos] 73130: [BROWSEUI] - CAddressEditBox: Implement handling relative paths in the addressbar of explore in addition to absolute paths.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Sat Nov 5 00:09:51 2016 New Revision: 73130 URL:
http://svn.reactos.org/svn/reactos?rev=73130&view=rev
Log: [BROWSEUI] - CAddressEditBox: Implement handling relative paths in the addressbar of explore in addition to absolute paths. Modified: trunk/reactos/dll/win32/browseui/addresseditbox.cpp Modified: trunk/reactos/dll/win32/browseui/addresseditbox.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/address…
============================================================================== --- trunk/reactos/dll/win32/browseui/addresseditbox.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/addresseditbox.cpp [iso-8859-1] Sat Nov 5 00:09:51 2016 @@ -90,16 +90,20 @@ ULONG attributes; HRESULT hr; HWND topLevelWindow; - - CComPtr<IShellBrowser> pisb; - hr = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IShellBrowser, &pisb)); + PIDLIST_ABSOLUTE pidlCurrent= NULL; + PIDLIST_RELATIVE pidlRelative = NULL; + CComPtr<IShellFolder> psfCurrent; + + CComPtr<IBrowserService> pbs; + hr = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &pbs)); if (FAILED_UNEXPECTEDLY(hr)) return hr; - hr = IUnknown_GetWindow(pisb, &topLevelWindow); + hr = IUnknown_GetWindow(pbs, &topLevelWindow); if (FAILED_UNEXPECTEDLY(hr)) return hr; + /* Get the path to browse and expand it if needed */ LPWSTR input; int inputLength = fCombobox.GetWindowTextLength() + 2; @@ -124,13 +128,34 @@ } } + /* Try to parse a relative path and if it fails, try to browse an absolute path */ CComPtr<IShellFolder> psfDesktop; hr = SHGetDesktopFolder(&psfDesktop); + if (FAILED_UNEXPECTEDLY(hr)) + goto cleanup; + + hr = pbs->GetPidl(&pidlCurrent); + if (FAILED_UNEXPECTEDLY(hr)) + goto cleanup; + + hr = psfDesktop->BindToObject(pidlCurrent, NULL, IID_PPV_ARG(IShellFolder, &psfCurrent)); + if (FAILED_UNEXPECTEDLY(hr)) + goto cleanup; + + hr = psfCurrent->ParseDisplayName(topLevelWindow, NULL, address, &eaten, &pidlRelative, &attributes); if (SUCCEEDED(hr)) { - hr = psfDesktop->ParseDisplayName(topLevelWindow, NULL, address, &eaten, &pidlLastParsed, &attributes); - } - + pidlLastParsed = ILCombine(pidlCurrent, pidlRelative); + ILFree(pidlRelative); + goto cleanup; + } + + /* We couldn't parse a relative path, attempt to parse an absolute path */ + hr = psfDesktop->ParseDisplayName(topLevelWindow, NULL, address, &eaten, &pidlLastParsed, &attributes); + +cleanup: + if (pidlCurrent) + ILFree(pidlCurrent); if (address != input) delete [] address; delete [] input;
8 years, 1 month
1
0
0
0
[gadamopoulos] 73129: [BROWSEUI] - CShellBrowser: Add a standard ShellObjectCreatorInit constructor and make its initializer take a pidl and flags. - Move BrowserThreadProc to desktopipc.cpp where ...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Nov 4 23:56:02 2016 New Revision: 73129 URL:
http://svn.reactos.org/svn/reactos?rev=73129&view=rev
Log: [BROWSEUI] - CShellBrowser: Add a standard ShellObjectCreatorInit constructor and make its initializer take a pidl and flags. - Move BrowserThreadProc to desktopipc.cpp where the lifetime of the browser thread will be managed. Modified: trunk/reactos/dll/win32/browseui/browseui.h trunk/reactos/dll/win32/browseui/desktopipc.cpp trunk/reactos/dll/win32/browseui/shellbrowser.cpp Modified: trunk/reactos/dll/win32/browseui/browseui.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/browseu…
============================================================================== --- trunk/reactos/dll/win32/browseui/browseui.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/browseui.h [iso-8859-1] Fri Nov 4 23:56:02 2016 @@ -10,6 +10,7 @@ #define USE_CUSTOM_INTERNETTOOLBAR 1 /* Constructors for the classes that are not exported */ +HRESULT CShellBrowser_CreateInstance(LPITEMIDLIST pidl, DWORD dwFlags, REFIID riid, void **ppv); HRESULT CTravelLog_CreateInstance(REFIID riid, void **ppv); HRESULT CBaseBar_CreateInstance(REFIID riid, void **ppv, BOOL vertical); HRESULT CBaseBarSite_CreateInstance(REFIID riid, void **ppv, BOOL bVertical); Modified: trunk/reactos/dll/win32/browseui/desktopipc.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/desktop…
============================================================================== --- trunk/reactos/dll/win32/browseui/desktopipc.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/desktopipc.cpp [iso-8859-1] Fri Nov 4 23:56:02 2016 @@ -27,8 +27,6 @@ UINT pidlSize80; UINT pathLength; }; - -extern DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter); class CProxyDesktop : public CComObjectRootEx<CComMultiThreadModelNoCS>, @@ -345,6 +343,70 @@ return params; } + +static HRESULT ExplorerMessageLoop(IEThreadParamBlock * parameters) +{ + CComPtr<IBrowserService2> browser; + HRESULT hResult; + MSG Msg; + BOOL Ret; + + // Tell the thread ref we are using it. + if (parameters && parameters->offsetF8) + parameters->offsetF8->AddRef(); + + hResult = CShellBrowser_CreateInstance(parameters->directoryPIDL, parameters->dwFlags, IID_PPV_ARG(IBrowserService2, &browser)); + if (FAILED_UNEXPECTEDLY(hResult)) + return hResult; + + while ((Ret = GetMessage(&Msg, NULL, 0, 0)) != 0) + { + if (Ret == -1) + { + // Error: continue or exit? + break; + } + + if (Msg.message == WM_QUIT) + break; + + if (browser->v_MayTranslateAccelerator(&Msg) != S_OK) + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } + } + + int nrc = browser->Release(); + if (nrc > 0) + { + DbgPrint("WARNING: There are %d references to the CShellBrowser active or leaked.\n", nrc); + } + + browser.Detach(); + + // Tell the thread ref we are not using it anymore. + if (parameters && parameters->offsetF8) + parameters->offsetF8->Release(); + + return hResult; +} + +static DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter) +{ + IEThreadParamBlock * parameters = (IEThreadParamBlock *) lpThreadParameter; + + OleInitialize(NULL); + ExplorerMessageLoop(parameters); + + /* Destroying the parameters releases the thread reference */ + SHDestroyIETHREADPARAM(parameters); + + OleUninitialize(); + + return 0; +} + /************************************************************************* * SHCreateIETHREADPARAM [BROWSEUI.123] */ Modified: trunk/reactos/dll/win32/browseui/shellbrowser.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellbr…
============================================================================== --- trunk/reactos/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Fri Nov 4 23:56:02 2016 @@ -309,7 +309,7 @@ CShellBrowser(); ~CShellBrowser(); - HRESULT Initialize(LPITEMIDLIST pidl, long b, long c, long d); + HRESULT Initialize(LPITEMIDLIST pidl, DWORD dwFlags); public: HRESULT BrowseToPIDL(LPCITEMIDLIST pidl, long flags); HRESULT BrowseToPath(IShellFolder *newShellFolder, LPCITEMIDLIST absolutePIDL, @@ -706,7 +706,7 @@ DSA_Destroy(menuDsa); } -HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, long b, long c, long d) +HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, DWORD dwFlags) { CComPtr<IPersistStreamInit> persistStreamInit; HRESULT hResult; @@ -3697,72 +3697,7 @@ return 0; } -static HRESULT ExplorerMessageLoop(IEThreadParamBlock * parameters) -{ - CComPtr<CShellBrowser> theCabinet; - HRESULT hResult; - MSG Msg; - BOOL Ret; - - // Tell the thread ref we are using it. - if (parameters && parameters->offsetF8) - parameters->offsetF8->AddRef(); - - ATLTRY(theCabinet = new CComObject<CShellBrowser>); - if (theCabinet == NULL) - { - return E_OUTOFMEMORY; - } - - hResult = theCabinet->Initialize(parameters->directoryPIDL, 0, 0, 0); - if (FAILED_UNEXPECTEDLY(hResult)) - return E_OUTOFMEMORY; - - while ((Ret = GetMessage(&Msg, NULL, 0, 0)) != 0) - { - if (Ret == -1) - { - // Error: continue or exit? - break; - } - - if (Msg.message == WM_QUIT) - break; - - if (theCabinet->v_MayTranslateAccelerator(&Msg) != S_OK) - { - TranslateMessage(&Msg); - DispatchMessage(&Msg); - } - } - - int nrc = theCabinet->Release(); - if (nrc > 0) - { - DbgPrint("WARNING: There are %d references to the CShellBrowser active or leaked.\n", nrc); - } - - theCabinet.Detach(); - - // Tell the thread ref we are not using it anymore. - if (parameters && parameters->offsetF8) - parameters->offsetF8->Release(); - - return hResult; -} - -DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter) -{ - HRESULT hr; - IEThreadParamBlock * parameters = (IEThreadParamBlock *) lpThreadParameter; - - OleInitialize(NULL); - - ATLTRY(hr = ExplorerMessageLoop(parameters)); - - OleUninitialize(); - - SHDestroyIETHREADPARAM(parameters); - - return hr; -} +HRESULT CShellBrowser_CreateInstance(LPITEMIDLIST pidl, DWORD dwFlags, REFIID riid, void **ppv) +{ + return ShellObjectCreatorInit<CShellBrowser>(pidl, dwFlags, riid, ppv); +}
8 years, 1 month
1
0
0
0
[gadamopoulos] 73128: [SHELL32] - Implement comparing child items in CompareIDs method of our IShellFolder immplementation in shell32 as this is the expected behaviour according to tests and docume...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Nov 4 23:11:29 2016 New Revision: 73128 URL:
http://svn.reactos.org/svn/reactos?rev=73128&view=rev
Log: [SHELL32] - Implement comparing child items in CompareIDs method of our IShellFolder immplementation in shell32 as this is the expected behaviour according to tests and documentation. - This was removed after each folder got its own implementation (we used a single one from wine that did handle it). May fix CORE-12106. Modified: trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp trunk/reactos/dll/win32/shell32/folders/CRegFolder.cpp trunk/reactos/dll/win32/shell32/shfldr.h trunk/reactos/dll/win32/shell32/shlfolder.cpp Modified: trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp [iso-8859-1] Fri Nov 4 23:11:29 2016 @@ -358,6 +358,8 @@ HRESULT WINAPI CDrivesFolder::CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) { + HRESULT hres; + if (!pidl1 || !pidl2) { ERR("Got null pidl pointer (%Ix %p %p)!\n", lParam, pidl1, pidl2); @@ -365,7 +367,7 @@ } if (_ILIsSpecialFolder(pidl1) || _ILIsSpecialFolder(pidl2)) - m_regFolder->CompareIDs(lParam, pidl1, pidl2); + return m_regFolder->CompareIDs(lParam, pidl1, pidl2); if (!_ILIsDrive(pidl1) || !_ILIsDrive(pidl2) || LOWORD(lParam) >= MYCOMPUTERSHELLVIEWCOLUMNS) return E_INVALIDARG; @@ -379,10 +381,12 @@ case 0: /* name */ { result = stricmp(pszDrive1, pszDrive2); - return MAKE_COMPARE_HRESULT(result); + hres = MAKE_COMPARE_HRESULT(result); + break; } case 1: /* Type */ { + /* We want to return immediately because SHELL32_CompareDetails also compares children. */ return SHELL32_CompareDetails(this, lParam, pidl1, pidl2); } case 2: /* Size */ @@ -406,10 +410,17 @@ else /* Size available */ Diff.QuadPart = Drive1Available.QuadPart - Drive2Available.QuadPart; - return MAKE_COMPARE_HRESULT(Diff.QuadPart); - } - } - return E_INVALIDARG; + hres = MAKE_COMPARE_HRESULT(Diff.QuadPart); + break; + } + default: + return E_INVALIDARG; + } + + if (HRESULT_CODE(hres) == 0) + return SHELL32_CompareChildren(this, lParam, pidl1, pidl2); + + return hres; } /************************************************************************** Modified: trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp [iso-8859-1] Fri Nov 4 23:11:29 2016 @@ -344,6 +344,10 @@ case 4: /* Attributes */ return SHELL32_CompareDetails(this, lParam, pidl1, pidl2); } + + if (result == 0) + return SHELL32_CompareChildren(this, lParam, pidl1, pidl2); + return MAKE_COMPARE_HRESULT(result); } Modified: trunk/reactos/dll/win32/shell32/folders/CRegFolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CRegFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CRegFolder.cpp [iso-8859-1] Fri Nov 4 23:11:29 2016 @@ -282,21 +282,24 @@ return E_INVALIDARG; } - BOOL bIsGuidFolder1 = _ILIsSpecialFolder(pidl1); - BOOL bIsGuidFolder2 = _ILIsSpecialFolder(pidl2); - - if (!bIsGuidFolder1 && !bIsGuidFolder2) + GUID const *clsid1 = _ILGetGUIDPointer (pidl1); + GUID const *clsid2 = _ILGetGUIDPointer (pidl2); + + if (!clsid1 && !clsid2) { ERR("Got no guid pidl!\n"); return E_INVALIDARG; } - else if (bIsGuidFolder1 && bIsGuidFolder2) - { + else if (clsid1 && clsid2) + { + if (memcmp(clsid1, clsid2, sizeof(GUID)) == 0) + return SHELL32_CompareChildren(this, lParam, pidl1, pidl2); + return SHELL32_CompareDetails(this, lParam, pidl1, pidl2); } /* Guid folders come first compared to everything else */ - return MAKE_COMPARE_HRESULT(bIsGuidFolder1 ? -1 : 1); + return MAKE_COMPARE_HRESULT(clsid1 ? -1 : 1); } HRESULT WINAPI CRegFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) Modified: trunk/reactos/dll/win32/shell32/shfldr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shfldr.h…
============================================================================== --- trunk/reactos/dll/win32/shell32/shfldr.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shfldr.h [iso-8859-1] Fri Nov 4 23:11:29 2016 @@ -53,6 +53,8 @@ HRESULT SHELL32_CompareDetails(IShellFolder2* isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2); +HRESULT SHELL32_CompareChildren(IShellFolder2* psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2); + HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, LPCWSTR pathRoot, LPCITEMIDLIST pidlChild, const GUID* clsid, int csidl, REFIID riid, LPVOID *ppvOut); Modified: trunk/reactos/dll/win32/shell32/shlfolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlfolde…
============================================================================== --- trunk/reactos/dll/win32/shell32/shlfolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shlfolder.cpp [iso-8859-1] Fri Nov 4 23:11:29 2016 @@ -435,6 +435,29 @@ return S_OK; } +HRESULT SHELL32_CompareChildren(IShellFolder2* psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) +{ + PUIDLIST_RELATIVE nextpidl1 = ILGetNext (pidl1); + PUIDLIST_RELATIVE nextpidl2 = ILGetNext (pidl2); + + bool isEmpty1 = _ILIsDesktop(nextpidl1); + bool isEmpty2 = _ILIsDesktop(nextpidl2); + if (isEmpty1 || isEmpty2) + return MAKE_COMPARE_HRESULT(isEmpty2 - isEmpty1); + + PITEMID_CHILD firstpidl = ILCloneFirst (pidl1); + if (!firstpidl) + return E_OUTOFMEMORY; + + CComPtr<IShellFolder> psf2; + HRESULT hr = psf->BindToObject(firstpidl, 0, IID_PPV_ARG(IShellFolder, &psf2)); + ILFree(firstpidl); + if (FAILED(hr)) + return MAKE_COMPARE_HRESULT(0); + + return psf2->CompareIDs(lParam, nextpidl1, nextpidl2); +} + HRESULT SHELL32_CompareDetails(IShellFolder2* isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) { SHELLDETAILS sd; @@ -458,6 +481,8 @@ return MAKE_COMPARE_HRESULT(1); int ret = wcsicmp(wszItem1, wszItem2); + if (ret == 0) + return SHELL32_CompareChildren(isf, lParam, pidl1, pidl2); return MAKE_COMPARE_HRESULT(ret); }
8 years, 1 month
1
0
0
0
[janderwald] 73127: [SDK] - fix build - thanks learn_more
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Nov 4 18:38:07 2016 New Revision: 73127 URL:
http://svn.reactos.org/svn/reactos?rev=73127&view=rev
Log: [SDK] - fix build - thanks learn_more Modified: trunk/reactos/sdk/include/psdk/ks.h Modified: trunk/reactos/sdk/include/psdk/ks.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/ks.h?rev=…
============================================================================== --- trunk/reactos/sdk/include/psdk/ks.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/ks.h [iso-8859-1] Fri Nov 4 18:38:07 2016 @@ -4220,7 +4220,7 @@ _In_ PDRIVER_OBJECT DriverObject, _In_ ULONG MajorFunction); -__checkReturn +_Check_return_ _IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS @@ -4256,7 +4256,7 @@ _In_ ULONG OutUsed, _In_ BOOLEAN Eject); -__checkReturn +_Check_return_ _IRQL_requires_max_(DISPATCH_LEVEL) KSDDKAPI NTSTATUS
8 years, 1 month
1
0
0
0
[janderwald] 73126: [SDK] - add newline
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Nov 4 18:14:40 2016 New Revision: 73126 URL:
http://svn.reactos.org/svn/reactos?rev=73126&view=rev
Log: [SDK] - add newline Modified: trunk/reactos/sdk/include/psdk/ks.h Modified: trunk/reactos/sdk/include/psdk/ks.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/ks.h?rev=…
============================================================================== --- trunk/reactos/sdk/include/psdk/ks.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/ks.h [iso-8859-1] Fri Nov 4 18:14:40 2016 @@ -4219,6 +4219,7 @@ KsSetMajorFunctionHandler( _In_ PDRIVER_OBJECT DriverObject, _In_ ULONG MajorFunction); + __checkReturn _IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI
8 years, 1 month
1
0
0
0
[janderwald] 73125: [SDK] - add prototypes
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Nov 4 18:12:00 2016 New Revision: 73125 URL:
http://svn.reactos.org/svn/reactos?rev=73125&view=rev
Log: [SDK] - add prototypes Modified: trunk/reactos/sdk/include/psdk/ks.h Modified: trunk/reactos/sdk/include/psdk/ks.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/ks.h?rev=…
============================================================================== --- trunk/reactos/sdk/include/psdk/ks.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/ks.h [iso-8859-1] Fri Nov 4 18:12:00 2016 @@ -3851,6 +3851,35 @@ _In_ PKSPIN Pin, _In_ KSSTREAM_POINTER_STATE State); +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsStreamPointerSetStatusCode( + _In_ PKSSTREAM_POINTER StreamPointer, + _In_ NTSTATUS Status +); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +void +NTAPI +KsStreamPointerDelete( + _In_ PKSSTREAM_POINTER StreamPointer +); + +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsStreamPointerClone( + _In_ PKSSTREAM_POINTER StreamPointer, + _In_opt_ PFNKSSTREAMPOINTER CancelCallback, + _In_ ULONG ContextSize, + _Out_ PKSSTREAM_POINTER* CloneStreamPointer +); + + /* Does this belong here? */ _IRQL_requires_max_(PASSIVE_LEVEL) @@ -4190,7 +4219,7 @@ KsSetMajorFunctionHandler( _In_ PDRIVER_OBJECT DriverObject, _In_ ULONG MajorFunction); - +__checkReturn _IRQL_requires_max_(PASSIVE_LEVEL) KSDDKAPI NTSTATUS @@ -4225,6 +4254,14 @@ _In_ ULONG InUsed, _In_ ULONG OutUsed, _In_ BOOLEAN Eject); + +__checkReturn +_IRQL_requires_max_(DISPATCH_LEVEL) +KSDDKAPI +NTSTATUS +NTAPI +KsStreamPointerAdvance( + _In_ PKSSTREAM_POINTER StreamPointer); _IRQL_requires_max_(DISPATCH_LEVEL) KSDDKAPI
8 years, 1 month
1
0
0
0
[janderwald] 73124: [USBAUDIO] - fix buffer calculation for usb headsets - usb headsets now partially work with usbaudio in win2k3
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Nov 4 18:07:44 2016 New Revision: 73124 URL:
http://svn.reactos.org/svn/reactos?rev=73124&view=rev
Log: [USBAUDIO] - fix buffer calculation for usb headsets - usb headsets now partially work with usbaudio in win2k3 Modified: trunk/reactos/drivers/usb/usbaudio/pin.c trunk/reactos/drivers/usb/usbaudio/usbaudio.h Modified: trunk/reactos/drivers/usb/usbaudio/pin.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/pin.c…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/pin.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/pin.c [iso-8859-1] Fri Nov 4 18:07:44 2016 @@ -874,6 +874,7 @@ IoSetCompletionRoutine(Irp, UsbAudioRenderComplete, Pin, TRUE, TRUE, TRUE); /* calculate packet count */ + /* FIXME support various sample rates */ WaveFormatEx = (PKSDATAFORMAT_WAVEFORMATEX)Pin->ConnectionFormat; TotalPacketSize = WaveFormatEx->WaveFormatEx.nAvgBytesPerSec / 1000; ASSERT(TotalPacketSize <= PinContext->DeviceExtension->InterfaceInfo->Pipes[0].MaximumPacketSize); @@ -882,8 +883,6 @@ PacketCount = CloneStreamPointer->OffsetIn.Remaining / TotalPacketSize; ASSERT(PacketCount < 255); - - //DPRINT1("PinRenderProcess Irp %p TotalPacketSize %lu MaximumPacketSize %lu PacketCount %lu Count %lu Data %p\n", Irp, TotalPacketSize, PinContext->DeviceExtension->InterfaceInfo->Pipes[0].MaximumPacketSize, PacketCount, CloneStreamPointer->OffsetIn.Count, CloneStreamPointer->OffsetIn.Data); Urb = (PURB)AllocFunction(GET_ISO_URB_SIZE(PacketCount)); ASSERT(Urb); @@ -893,8 +892,8 @@ Urb->UrbIsochronousTransfer.Hdr.Length = GET_ISO_URB_SIZE(PacketCount); Urb->UrbIsochronousTransfer.PipeHandle = PinContext->DeviceExtension->InterfaceInfo->Pipes[0].PipeHandle; Urb->UrbIsochronousTransfer.TransferFlags = USBD_TRANSFER_DIRECTION_OUT | USBD_START_ISO_TRANSFER_ASAP; - Urb->UrbIsochronousTransfer.TransferBufferLength = CloneStreamPointer->OffsetIn.Remaining; - Urb->UrbIsochronousTransfer.TransferBuffer = CloneStreamPointer->OffsetIn.Data; + Urb->UrbIsochronousTransfer.TransferBufferLength = PacketCount * TotalPacketSize; + Urb->UrbIsochronousTransfer.TransferBuffer = CloneStreamPointer->StreamHeader->Data; Urb->UrbIsochronousTransfer.NumberOfPackets = PacketCount; Urb->UrbIsochronousTransfer.StartFrame = 0; Modified: trunk/reactos/drivers/usb/usbaudio/usbaudio.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/usbau…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] Fri Nov 4 18:07:44 2016 @@ -205,6 +205,7 @@ PKSWORKER CaptureWorker; /* capture worker */ WORK_QUEUE_ITEM StarvationWorkItem; /* work item */ PKSWORKER StarvationWorker; /* capture worker */ + ULONG BufferOffset; }PIN_CONTEXT, *PPIN_CONTEXT; /* filter.c */
8 years, 1 month
1
0
0
0
[phater] 73123: [MSAFD] Check params on WSAAceept. CORE-12104
by phater@svn.reactos.org
Author: phater Date: Fri Nov 4 18:03:15 2016 New Revision: 73123 URL:
http://svn.reactos.org/svn/reactos?rev=73123&view=rev
Log: [MSAFD] Check params on WSAAceept. CORE-12104 Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
============================================================================== --- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Fri Nov 4 18:03:15 2016 @@ -1351,6 +1351,13 @@ if (lpErrno) *lpErrno = WSAENOTSOCK; return SOCKET_ERROR; } + if ((SocketAddress && !SocketAddressLength) || + (SocketAddressLength && !SocketAddress) || + (SocketAddressLength && *SocketAddressLength < sizeof(SOCKADDR))) + { + if (lpErrno) *lpErrno = WSAEFAULT; + return INVALID_SOCKET; + } Status = NtCreateEvent(&SockEvent, EVENT_ALL_ACCESS,
8 years, 1 month
1
0
0
0
[hbelusca] 73122: [NTOS] - accesschk.c: Remove redundant SepAccessCheck/SepAccessCheckEx pair of private functions; instead just rename SepAccessCheckEx into SepAccessCheck and use it directly in t...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Fri Nov 4 17:52:32 2016 New Revision: 73122 URL:
http://svn.reactos.org/svn/reactos?rev=73122&view=rev
Log: [NTOS] - accesschk.c: Remove redundant SepAccessCheck/SepAccessCheckEx pair of private functions; instead just rename SepAccessCheckEx into SepAccessCheck and use it directly in the code. NOTE: SepAccessCheck is *incomplete* (in particular it doesn't retrieve the information needed to initialize the 'Privileges' parameter). - sid.c: Comments formatting fix. - token.c: * Finish to implement SeQueryInformationToken . This function is really the same as NtQueryInformationToken but without all the stuff needed for user-mode buffer access protection. * Some code simplifications in NtQueryInformationToken. I need this to fix a "FIXME: Use SeQueryInformationToken" in some code I'm also fixing (& commit later). [NDK]: Fix parameter types and add annotations to RtlCopySidAndAttributesArray. [KMTESTS:NTOS_SE] - Reenable the 'SeQueryInfoToken' test. - Show that SeQueryInformationToken doesn't support 4 token information classes, which are supported only by NtQueryInformationToken. - Fix calling of SeAccessCheck. In particular the 'Privileges' parameter is not allocated by the caller, but instead is allocated by SeAccessCheck *and* returned to the caller (who then must free the buffer using SeFreePrivileges). This fixes the encountered BSODs that leaded to disabling preventively the test in r59178. - Minor code cleaning. Modified: trunk/reactos/ntoskrnl/se/accesschk.c trunk/reactos/ntoskrnl/se/sid.c trunk/reactos/ntoskrnl/se/token.c trunk/reactos/sdk/include/ndk/rtlfuncs.h trunk/reactos/sdk/lib/rtl/sid.c trunk/rostests/kmtests/kmtest_drv/testlist.c trunk/rostests/kmtests/ntos_se/SeQueryInfoToken.c Modified: trunk/reactos/ntoskrnl/se/accesschk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/accesschk.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/se/accesschk.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/accesschk.c [iso-8859-1] Fri Nov 4 17:52:32 2016 @@ -18,8 +18,11 @@ /* PRIVATE FUNCTIONS **********************************************************/ +/* + * FIXME: Incomplete! + */ BOOLEAN NTAPI -SepAccessCheckEx(IN PSECURITY_DESCRIPTOR SecurityDescriptor, +SepAccessCheck(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE_LIST ObjectTypeList, @@ -46,7 +49,7 @@ NTSTATUS Status; PAGED_CODE(); - DPRINT("SepAccessCheckEx()\n"); + DPRINT("SepAccessCheck()\n"); /* Check for no access desired */ if (!DesiredAccess) @@ -281,31 +284,6 @@ } return NT_SUCCESS(Status); -} - -BOOLEAN NTAPI -SepAccessCheck(IN PSECURITY_DESCRIPTOR SecurityDescriptor, - IN PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext, - IN ACCESS_MASK DesiredAccess, - IN ACCESS_MASK PreviouslyGrantedAccess, - OUT PPRIVILEGE_SET* Privileges, - IN PGENERIC_MAPPING GenericMapping, - IN KPROCESSOR_MODE AccessMode, - OUT PACCESS_MASK GrantedAccess, - OUT PNTSTATUS AccessStatus) -{ - return SepAccessCheckEx(SecurityDescriptor, - SubjectSecurityContext, - DesiredAccess, - NULL, - 0, - PreviouslyGrantedAccess, - Privileges, - GenericMapping, - AccessMode, - GrantedAccess, - AccessStatus, - FALSE); } static PSID @@ -443,12 +421,15 @@ ret = SepAccessCheck(SecurityDescriptor, SubjectSecurityContext, DesiredAccess, + NULL, + 0, PreviouslyGrantedAccess, Privileges, GenericMapping, AccessMode, GrantedAccess, - AccessStatus); + AccessStatus, + FALSE); } /* Release the lock if needed */ @@ -687,12 +668,15 @@ SepAccessCheck(SecurityDescriptor, // FIXME: use CapturedSecurityDescriptor &SubjectSecurityContext, DesiredAccess, + NULL, + 0, PreviouslyGrantedAccess, &PrivilegeSet, //FIXME GenericMapping, PreviousMode, GrantedAccess, - AccessStatus); + AccessStatus, + FALSE); } /* Release subject context and unlock the token */ Modified: trunk/reactos/ntoskrnl/se/sid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/sid.c?rev=7312…
============================================================================== --- trunk/reactos/ntoskrnl/se/sid.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/sid.c [iso-8859-1] Fri Nov 4 17:52:32 2016 @@ -297,7 +297,7 @@ } _SEH2_END; - /* allocate a SID and copy it */ + /* Allocate a SID and copy it */ NewSid = ExAllocatePoolWithTag(PoolType, SidSize, TAG_SID); if (!NewSid) return STATUS_INSUFFICIENT_RESOURCES; @@ -324,7 +324,7 @@ { SidSize = RtlLengthRequiredSid(Sid->SubAuthorityCount); - /* allocate a SID and copy it */ + /* Allocate a SID and copy it */ NewSid = ExAllocatePoolWithTag(PoolType, SidSize, TAG_SID); if (NewSid == NULL) return STATUS_INSUFFICIENT_RESOURCES; Modified: trunk/reactos/ntoskrnl/se/token.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/token.c?rev=73…
============================================================================== --- trunk/reactos/ntoskrnl/se/token.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/token.c [iso-8859-1] Fri Nov 4 17:52:32 2016 @@ -232,7 +232,7 @@ PAGED_CODE(); - if (NewToken->TokenType != TokenPrimary) return(STATUS_BAD_TOKEN_TYPE); + if (NewToken->TokenType != TokenPrimary) return STATUS_BAD_TOKEN_TYPE; if (NewToken->TokenInUse) { BOOLEAN IsEqual; @@ -348,12 +348,12 @@ if (Token->DefaultOwnerIndex == Token->UserAndGroupCount) { - return(STATUS_INVALID_OWNER); + return STATUS_INVALID_OWNER; } if (Token->PrimaryGroup == 0) { - return(STATUS_INVALID_PRIMARY_GROUP); + return STATUS_INVALID_PRIMARY_GROUP; } return STATUS_SUCCESS; @@ -1060,16 +1060,26 @@ } /* - * @unimplemented + * @implemented + * + * NOTE: SeQueryInformationToken is just NtQueryInformationToken without all + * the bells and whistles needed for user-mode buffer access protection. */ NTSTATUS NTAPI -SeQueryInformationToken(IN PACCESS_TOKEN Token, +SeQueryInformationToken(IN PACCESS_TOKEN AccessToken, IN TOKEN_INFORMATION_CLASS TokenInformationClass, OUT PVOID *TokenInformation) { NTSTATUS Status; - PSECURITY_IMPERSONATION_LEVEL SeImpersonationLvl; + PTOKEN Token = (PTOKEN)AccessToken; + ULONG RequiredLength; + union + { + PSID PSid; + ULONG Ulong; + } Unused; + PAGED_CODE(); if (TokenInformationClass >= MaxTokenInfoClass) @@ -1080,31 +1090,395 @@ switch (TokenInformationClass) { - case TokenImpersonationLevel: - /* It is mandatory to have an impersonation token */ - if (((PTOKEN)Token)->TokenType != TokenImpersonation) - { - Status = STATUS_INVALID_INFO_CLASS; - break; - } + case TokenUser: + { + PTOKEN_USER tu; + + DPRINT("SeQueryInformationToken(TokenUser)\n"); + RequiredLength = sizeof(TOKEN_USER) + + RtlLengthSid(Token->UserAndGroups[0].Sid); /* Allocate the output buffer */ - SeImpersonationLvl = ExAllocatePoolWithTag(PagedPool, sizeof(SECURITY_IMPERSONATION_LEVEL), TAG_SE); - if (SeImpersonationLvl == NULL) + tu = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (tu == NULL) { Status = STATUS_INSUFFICIENT_RESOURCES; break; } - /* Set impersonation level and return the structure */ - *SeImpersonationLvl = ((PTOKEN)Token)->ImpersonationLevel; - *TokenInformation = SeImpersonationLvl; + Status = RtlCopySidAndAttributesArray(1, + &Token->UserAndGroups[0], + RequiredLength - sizeof(TOKEN_USER), + &tu->User, + (PSID)(tu + 1), + &Unused.PSid, + &Unused.Ulong); + + /* Return the structure */ + *TokenInformation = tu; Status = STATUS_SUCCESS; break; + } + + case TokenGroups: + { + PTOKEN_GROUPS tg; + ULONG SidLen; + PSID Sid; + + DPRINT("SeQueryInformationToken(TokenGroups)\n"); + RequiredLength = sizeof(tg->GroupCount) + + RtlLengthSidAndAttributes(Token->UserAndGroupCount - 1, &Token->UserAndGroups[1]); + + SidLen = RequiredLength - sizeof(tg->GroupCount) - + ((Token->UserAndGroupCount - 1) * sizeof(SID_AND_ATTRIBUTES)); + + /* Allocate the output buffer */ + tg = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (tg == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + Sid = (PSID)((ULONG_PTR)tg + sizeof(tg->GroupCount) + + ((Token->UserAndGroupCount - 1) * sizeof(SID_AND_ATTRIBUTES))); + + tg->GroupCount = Token->UserAndGroupCount - 1; + Status = RtlCopySidAndAttributesArray(Token->UserAndGroupCount - 1, + &Token->UserAndGroups[1], + SidLen, + &tg->Groups[0], + Sid, + &Unused.PSid, + &Unused.Ulong); + + /* Return the structure */ + *TokenInformation = tg; + Status = STATUS_SUCCESS; + break; + } + + case TokenPrivileges: + { + PTOKEN_PRIVILEGES tp; + + DPRINT("SeQueryInformationToken(TokenPrivileges)\n"); + RequiredLength = sizeof(tp->PrivilegeCount) + + (Token->PrivilegeCount * sizeof(LUID_AND_ATTRIBUTES)); + + /* Allocate the output buffer */ + tp = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (tp == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + tp->PrivilegeCount = Token->PrivilegeCount; + RtlCopyLuidAndAttributesArray(Token->PrivilegeCount, + Token->Privileges, + &tp->Privileges[0]); + + /* Return the structure */ + *TokenInformation = tp; + Status = STATUS_SUCCESS; + break; + } + + case TokenOwner: + { + PTOKEN_OWNER to; + ULONG SidLen; + + DPRINT("SeQueryInformationToken(TokenOwner)\n"); + SidLen = RtlLengthSid(Token->UserAndGroups[Token->DefaultOwnerIndex].Sid); + RequiredLength = sizeof(TOKEN_OWNER) + SidLen; + + /* Allocate the output buffer */ + to = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (to == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + to->Owner = (PSID)(to + 1); + Status = RtlCopySid(SidLen, + to->Owner, + Token->UserAndGroups[Token->DefaultOwnerIndex].Sid); + + /* Return the structure */ + *TokenInformation = to; + Status = STATUS_SUCCESS; + break; + } + + case TokenPrimaryGroup: + { + PTOKEN_PRIMARY_GROUP tpg; + ULONG SidLen; + + DPRINT("SeQueryInformationToken(TokenPrimaryGroup)\n"); + SidLen = RtlLengthSid(Token->PrimaryGroup); + RequiredLength = sizeof(TOKEN_PRIMARY_GROUP) + SidLen; + + /* Allocate the output buffer */ + tpg = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (tpg == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + tpg->PrimaryGroup = (PSID)(tpg + 1); + Status = RtlCopySid(SidLen, + tpg->PrimaryGroup, + Token->PrimaryGroup); + + /* Return the structure */ + *TokenInformation = tpg; + Status = STATUS_SUCCESS; + break; + } + + case TokenDefaultDacl: + { + PTOKEN_DEFAULT_DACL tdd; + + DPRINT("SeQueryInformationToken(TokenDefaultDacl)\n"); + RequiredLength = sizeof(TOKEN_DEFAULT_DACL); + + if (Token->DefaultDacl != NULL) + RequiredLength += Token->DefaultDacl->AclSize; + + /* Allocate the output buffer */ + tdd = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (tdd == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + if (Token->DefaultDacl != NULL) + { + tdd->DefaultDacl = (PACL)(tdd + 1); + RtlCopyMemory(tdd->DefaultDacl, + Token->DefaultDacl, + Token->DefaultDacl->AclSize); + } + else + { + tdd->DefaultDacl = NULL; + } + + /* Return the structure */ + *TokenInformation = tdd; + Status = STATUS_SUCCESS; + break; + } + + case TokenSource: + { + PTOKEN_SOURCE ts; + + DPRINT("SeQueryInformationToken(TokenSource)\n"); + RequiredLength = sizeof(TOKEN_SOURCE); + + /* Allocate the output buffer */ + ts = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (ts == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + *ts = Token->TokenSource; + + /* Return the structure */ + *TokenInformation = ts; + Status = STATUS_SUCCESS; + break; + } + + case TokenType: + { + PTOKEN_TYPE tt; + + DPRINT("SeQueryInformationToken(TokenType)\n"); + RequiredLength = sizeof(TOKEN_TYPE); + + /* Allocate the output buffer */ + tt = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (tt == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + *tt = Token->TokenType; + + /* Return the structure */ + *TokenInformation = tt; + Status = STATUS_SUCCESS; + break; + } + + case TokenImpersonationLevel: + { + PSECURITY_IMPERSONATION_LEVEL sil; + + DPRINT("SeQueryInformationToken(TokenImpersonationLevel)\n"); + RequiredLength = sizeof(SECURITY_IMPERSONATION_LEVEL); + + /* Fail if the token is not an impersonation token */ + if (Token->TokenType != TokenImpersonation) + { + Status = STATUS_INVALID_INFO_CLASS; + break; + } + + /* Allocate the output buffer */ + sil = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (sil == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + *sil = Token->ImpersonationLevel; + + /* Return the structure */ + *TokenInformation = sil; + Status = STATUS_SUCCESS; + break; + } + + case TokenStatistics: + { + PTOKEN_STATISTICS ts; + + DPRINT("SeQueryInformationToken(TokenStatistics)\n"); + RequiredLength = sizeof(TOKEN_STATISTICS); + + /* Allocate the output buffer */ + ts = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (ts == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + ts->TokenId = Token->TokenId; + ts->AuthenticationId = Token->AuthenticationId; + ts->ExpirationTime = Token->ExpirationTime; + ts->TokenType = Token->TokenType; + ts->ImpersonationLevel = Token->ImpersonationLevel; + ts->DynamicCharged = Token->DynamicCharged; + ts->DynamicAvailable = Token->DynamicAvailable; + ts->GroupCount = Token->UserAndGroupCount - 1; + ts->PrivilegeCount = Token->PrivilegeCount; + ts->ModifiedId = Token->ModifiedId; + + /* Return the structure */ + *TokenInformation = ts; + Status = STATUS_SUCCESS; + break; + } + +/* + * The following 4 cases are only implemented in NtQueryInformationToken + */ +#if 0 + + case TokenOrigin: + { + PTOKEN_ORIGIN to; + + DPRINT("SeQueryInformationToken(TokenOrigin)\n"); + RequiredLength = sizeof(TOKEN_ORIGIN); + + /* Allocate the output buffer */ + to = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (to == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + RtlCopyLuid(&to->OriginatingLogonSession, + &Token->AuthenticationId); + + /* Return the structure */ + *TokenInformation = to; + Status = STATUS_SUCCESS; + break; + } + + case TokenGroupsAndPrivileges: + DPRINT1("SeQueryInformationToken(TokenGroupsAndPrivileges) not implemented\n"); + Status = STATUS_NOT_IMPLEMENTED; + break; + + case TokenRestrictedSids: + { + PTOKEN_GROUPS tg = (PTOKEN_GROUPS)TokenInformation; + ULONG SidLen; + PSID Sid; + + DPRINT("SeQueryInformationToken(TokenRestrictedSids)\n"); + RequiredLength = sizeof(tg->GroupCount) + + RtlLengthSidAndAttributes(Token->RestrictedSidCount, Token->RestrictedSids); + + SidLen = RequiredLength - sizeof(tg->GroupCount) - + (Token->RestrictedSidCount * sizeof(SID_AND_ATTRIBUTES)); + + /* Allocate the output buffer */ + tg = ExAllocatePoolWithTag(PagedPool, RequiredLength, TAG_SE); + if (tg == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + Sid = (PSID)((ULONG_PTR)tg + sizeof(tg->GroupCount) + + (Token->RestrictedSidCount * sizeof(SID_AND_ATTRIBUTES))); + + tg->GroupCount = Token->RestrictedSidCount; + Status = RtlCopySidAndAttributesArray(Token->RestrictedSidCount, + Token->RestrictedSids, + SidLen, + &tg->Groups[0], + Sid, + &Unused.PSid, + &Unused.Ulong); + + /* Return the structure */ + *TokenInformation = tg; + Status = STATUS_SUCCESS; + break; + } + + case TokenSandBoxInert: + DPRINT1("SeQueryInformationToken(TokenSandboxInert) not implemented\n"); + Status = STATUS_NOT_IMPLEMENTED; + break; + +#endif + + case TokenSessionId: + { + DPRINT("SeQueryInformationToken(TokenSessionId)\n"); + + Status = SeQuerySessionIdToken(Token, (PULONG)TokenInformation); + + // Status = STATUS_SUCCESS; + break; + } default: - UNIMPLEMENTED; - Status = STATUS_NOT_IMPLEMENTED; + DPRINT1("SeQueryInformationToken(%d) invalid information class\n", TokenInformationClass); + Status = STATUS_INVALID_INFO_CLASS; break; } @@ -1212,15 +1586,15 @@ IN ULONG TokenInformationLength, OUT PULONG ReturnLength) { + NTSTATUS Status; + KPROCESSOR_MODE PreviousMode; + PTOKEN Token; + ULONG RequiredLength; union { - PVOID Ptr; + PSID PSid; ULONG Ulong; } Unused; - PTOKEN Token; - ULONG RequiredLength; - KPROCESSOR_MODE PreviousMode; - NTSTATUS Status; PAGED_CODE(); @@ -1229,7 +1603,7 @@ /* Check buffers and class validity */ Status = DefaultQueryInfoBufferCheck(TokenInformationClass, SeTokenInformationClass, - sizeof(SeTokenInformationClass) / sizeof(SeTokenInformationClass[0]), + RTL_NUMBER_OF(SeTokenInformationClass), TokenInformation, TokenInformationLength, ReturnLength, @@ -1257,7 +1631,7 @@ DPRINT("NtQueryInformationToken(TokenUser)\n"); RequiredLength = sizeof(TOKEN_USER) + - RtlLengthSid(Token->UserAndGroups[0].Sid); + RtlLengthSid(Token->UserAndGroups[0].Sid); _SEH2_TRY { @@ -1268,7 +1642,7 @@ RequiredLength - sizeof(TOKEN_USER), &tu->User, (PSID)(tu + 1), - &Unused.Ptr, + &Unused.PSid, &Unused.Ulong); } else @@ -1296,24 +1670,24 @@ DPRINT("NtQueryInformationToken(TokenGroups)\n"); RequiredLength = sizeof(tg->GroupCount) + - RtlLengthSidAndAttributes(Token->UserAndGroupCount - 1, &Token->UserAndGroups[1]); + RtlLengthSidAndAttributes(Token->UserAndGroupCount - 1, &Token->UserAndGroups[1]); _SEH2_TRY { if (TokenInformationLength >= RequiredLength) { ULONG SidLen = RequiredLength - sizeof(tg->GroupCount) - - ((Token->UserAndGroupCount - 1) * sizeof(SID_AND_ATTRIBUTES)); - PSID_AND_ATTRIBUTES Sid = (PSID_AND_ATTRIBUTES)((ULONG_PTR)TokenInformation + sizeof(tg->GroupCount) + - ((Token->UserAndGroupCount - 1) * sizeof(SID_AND_ATTRIBUTES))); + ((Token->UserAndGroupCount - 1) * sizeof(SID_AND_ATTRIBUTES)); + PSID Sid = (PSID_AND_ATTRIBUTES)((ULONG_PTR)tg + sizeof(tg->GroupCount) + + ((Token->UserAndGroupCount - 1) * sizeof(SID_AND_ATTRIBUTES))); tg->GroupCount = Token->UserAndGroupCount - 1; Status = RtlCopySidAndAttributesArray(Token->UserAndGroupCount - 1, &Token->UserAndGroups[1], SidLen, &tg->Groups[0], - (PSID)Sid, - &Unused.Ptr, + Sid, + &Unused.PSid, &Unused.Ulong); } else @@ -1341,7 +1715,7 @@ DPRINT("NtQueryInformationToken(TokenPrivileges)\n"); RequiredLength = sizeof(tp->PrivilegeCount) + - (Token->PrivilegeCount * sizeof(LUID_AND_ATTRIBUTES)); + (Token->PrivilegeCount * sizeof(LUID_AND_ATTRIBUTES)); _SEH2_TRY { @@ -1373,8 +1747,8 @@ case TokenOwner: { + PTOKEN_OWNER to = (PTOKEN_OWNER)TokenInformation; ULONG SidLen; - PTOKEN_OWNER to = (PTOKEN_OWNER)TokenInformation; DPRINT("NtQueryInformationToken(TokenOwner)\n"); SidLen = RtlLengthSid(Token->UserAndGroups[Token->DefaultOwnerIndex].Sid); @@ -1410,8 +1784,8 @@ case TokenPrimaryGroup: { + PTOKEN_PRIMARY_GROUP tpg = (PTOKEN_PRIMARY_GROUP)TokenInformation; ULONG SidLen; - PTOKEN_PRIMARY_GROUP tpg = (PTOKEN_PRIMARY_GROUP)TokenInformation; DPRINT("NtQueryInformationToken(TokenPrimaryGroup)\n"); SidLen = RtlLengthSid(Token->PrimaryGroup); @@ -1453,9 +1827,7 @@ RequiredLength = sizeof(TOKEN_DEFAULT_DACL); if (Token->DefaultDacl != NULL) - { RequiredLength += Token->DefaultDacl->AclSize; - } _SEH2_TRY { @@ -1688,17 +2060,17 @@ if (TokenInformationLength >= RequiredLength) { ULONG SidLen = RequiredLength - sizeof(tg->GroupCount) - - (Token->RestrictedSidCount * sizeof(SID_AND_ATTRIBUTES)); - PSID_AND_ATTRIBUTES Sid = (PSID_AND_ATTRIBUTES)((ULONG_PTR)TokenInformation + sizeof(tg->GroupCount) + - (Token->RestrictedSidCount * sizeof(SID_AND_ATTRIBUTES))); + (Token->RestrictedSidCount * sizeof(SID_AND_ATTRIBUTES)); + PSID Sid = (PSID)((ULONG_PTR)tg + sizeof(tg->GroupCount) + + (Token->RestrictedSidCount * sizeof(SID_AND_ATTRIBUTES))); tg->GroupCount = Token->RestrictedSidCount; Status = RtlCopySidAndAttributesArray(Token->RestrictedSidCount, Token->RestrictedSids, SidLen, &tg->Groups[0], - (PSID)Sid, - &Unused.Ptr, + Sid, + &Unused.PSid, &Unused.Ulong); } else @@ -1731,14 +2103,12 @@ DPRINT("NtQueryInformationToken(TokenSessionId)\n"); - Status = SeQuerySessionIdToken(Token, - &SessionId); - + Status = SeQuerySessionIdToken(Token, &SessionId); if (NT_SUCCESS(Status)) { _SEH2_TRY { - /* buffer size was already verified, no need to check here again */ + /* Buffer size was already verified, no need to check here again */ *(PULONG)TokenInformation = SessionId; if (ReturnLength != NULL) @@ -1792,7 +2162,7 @@ Status = DefaultSetInfoBufferCheck(TokenInformationClass, SeTokenInformationClass, - sizeof(SeTokenInformationClass) / sizeof(SeTokenInformationClass[0]), + RTL_NUMBER_OF(SeTokenInformationClass), TokenInformation, TokenInformationLength, PreviousMode); @@ -2179,14 +2549,16 @@ * @implemented * * NOTE: Some sources claim 4th param is ImpersonationLevel, but on W2K - * this is certainly NOT true, thou i can't say for sure that EffectiveOnly + * this is certainly NOT true, although I can't say for sure that EffectiveOnly * is correct either. -Gunnar * This is true. EffectiveOnly overrides SQOS.EffectiveOnly. - IAI + * NOTE for readers:
http://hex.pp.ua/nt/NtDuplicateToken.php
is therefore + * wrong in that regard. */ NTSTATUS NTAPI NtDuplicateToken(IN HANDLE ExistingTokenHandle, IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN BOOLEAN EffectiveOnly, IN TOKEN_TYPE TokenType, OUT PHANDLE NewTokenHandle) @@ -2330,7 +2702,7 @@ OUT PULONG ReturnLength) { UNIMPLEMENTED; - return(STATUS_NOT_IMPLEMENTED); + return STATUS_NOT_IMPLEMENTED; } Modified: trunk/reactos/sdk/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ndk/rtlfuncs.h…
============================================================================== --- trunk/reactos/sdk/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ndk/rtlfuncs.h [iso-8859-1] Fri Nov 4 17:52:32 2016 @@ -1279,13 +1279,13 @@ NTSTATUS NTAPI RtlCopySidAndAttributesArray( - ULONG Count, - PSID_AND_ATTRIBUTES Src, - ULONG SidAreaSize, - PSID_AND_ATTRIBUTES Dest, - PVOID SidArea, - PVOID* RemainingSidArea, - PULONG RemainingSidAreaSize + _In_ ULONG Count, + _In_ PSID_AND_ATTRIBUTES Src, + _In_ ULONG SidAreaSize, + _In_ PSID_AND_ATTRIBUTES Dest, + _In_ PSID SidArea, + _Out_ PSID* RemainingSidArea, + _Out_ PULONG RemainingSidAreaSize ); _IRQL_requires_max_(APC_LEVEL) Modified: trunk/reactos/sdk/lib/rtl/sid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/sid.c?rev=7312…
============================================================================== --- trunk/reactos/sdk/lib/rtl/sid.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/rtl/sid.c [iso-8859-1] Fri Nov 4 17:52:32 2016 @@ -250,8 +250,8 @@ IN PSID_AND_ATTRIBUTES Src, IN ULONG SidAreaSize, IN PSID_AND_ATTRIBUTES Dest, - IN PVOID SidArea, - OUT PVOID* RemainingSidArea, + IN PSID SidArea, + OUT PSID* RemainingSidArea, OUT PULONG RemainingSidAreaSize) { ULONG SidLength, i; @@ -273,7 +273,7 @@ RtlCopySid(SidLength, SidArea, Src[i].Sid); /* Push the buffer area where the SID will reset */ - SidArea = (PVOID)((ULONG_PTR)SidArea + SidLength); + SidArea = (PSID)((ULONG_PTR)SidArea + SidLength); } /* Return how much space is left, and where the buffer is at now */ Modified: trunk/rostests/kmtests/kmtest_drv/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/testli…
============================================================================== --- trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] Fri Nov 4 17:52:32 2016 @@ -132,8 +132,6 @@ { "-ObTypeNoClean", Test_ObTypeNoClean }, { "ObTypes", Test_ObTypes }, { "PsNotify", Test_PsNotify }, - { "SeInheritance", Test_SeInheritance }, - { "-SeQueryInfoToken", Test_SeQueryInfoToken }, { "RtlAvlTreeKM", Test_RtlAvlTree }, { "RtlExceptionKM", Test_RtlException }, { "RtlIntSafeKM", Test_RtlIntSafe }, @@ -142,6 +140,8 @@ { "RtlRegistryKM", Test_RtlRegistry }, { "RtlSplayTreeKM", Test_RtlSplayTree }, { "RtlUnicodeStringKM", Test_RtlUnicodeString }, + { "SeInheritance", Test_SeInheritance }, + { "SeQueryInfoToken", Test_SeQueryInfoToken }, { "ZwAllocateVirtualMemory", Test_ZwAllocateVirtualMemory }, { "ZwCreateSection", Test_ZwCreateSection }, { "ZwMapViewOfSection", Test_ZwMapViewOfSection }, Modified: trunk/rostests/kmtests/ntos_se/SeQueryInfoToken.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_se/SeQueryIn…
============================================================================== --- trunk/rostests/kmtests/ntos_se/SeQueryInfoToken.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_se/SeQueryInfoToken.c [iso-8859-1] Fri Nov 4 17:52:32 2016 @@ -44,10 +44,10 @@ if (Token == NULL) return; Status = SeQueryInformationToken(Token, TokenOwner, &Buffer); - ok((Status == STATUS_SUCCESS), "SQIT with TokenOwner arg fails with status 0x%X\n", Status); - if (Status == STATUS_SUCCESS) - { - ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenOwner arg. But Buffer = NULL\n"); + ok((Status == STATUS_SUCCESS), "SQIT with TokenOwner arg fails with status 0x%08X\n", Status); + if (Status == STATUS_SUCCESS) + { + ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenOwner arg. But Buffer == NULL\n"); if (Buffer) { @@ -62,10 +62,10 @@ Buffer = NULL; Status = SeQueryInformationToken(Token, TokenDefaultDacl, &Buffer); - ok(Status == STATUS_SUCCESS, "SQIT with TokenDefaultDacl fails with status 0x%X\n", Status); - if (Status == STATUS_SUCCESS) - { - ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenDefaultDacl arg. But Buffer = NULL\n"); + ok(Status == STATUS_SUCCESS, "SQIT with TokenDefaultDacl fails with status 0x%08X\n", Status); + if (Status == STATUS_SUCCESS) + { + ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenDefaultDacl arg. But Buffer == NULL\n"); if (Buffer) { TDefDacl = (PTOKEN_DEFAULT_DACL)Buffer; @@ -79,10 +79,10 @@ Buffer = NULL; Status = SeQueryInformationToken(Token, TokenGroups, &Buffer); - ok(Status == STATUS_SUCCESS, "SQIT with TokenGroups fails with status 0x%X\n", Status); - if (Status == STATUS_SUCCESS) - { - ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenGroups arg. But Buffer = NULL\n"); + ok(Status == STATUS_SUCCESS, "SQIT with TokenGroups fails with status 0x%08X\n", Status); + if (Status == STATUS_SUCCESS) + { + ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenGroups arg. But Buffer == NULL\n"); if (Buffer) { TGroups = (PTOKEN_GROUPS)Buffer; @@ -107,58 +107,88 @@ // Call SQIT with TokenImpersonationLevel argument // // What's up? Why SQIT fails with right arg? + // Because your token has Token->TokenType != TokenImpersonation. -hbelusca Buffer = NULL; Status = SeQueryInformationToken(Token, TokenImpersonationLevel, &Buffer); - ok(Status == STATUS_SUCCESS, "SQIT with TokenImpersonationLevel fails with status 0x%X\n", Status); + ok(Status == STATUS_SUCCESS, "SQIT with TokenImpersonationLevel fails with status 0x%08X\n", Status); + if (Buffer) ExFreePool(Buffer); Buffer = NULL; Status = SeQueryInformationToken(Token, TokenImpersonationLevel, &Buffer); - ok(Status == STATUS_SUCCESS, "and again: SQIT with TokenImpersonationLevel fails with status 0x%X\n", Status); - if (Status == STATUS_SUCCESS) - { - ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenImpersonationLevel arg. But Buffer = NULL\n"); + ok(Status == STATUS_SUCCESS, "and again: SQIT with TokenImpersonationLevel fails with status 0x%08X\n", Status); + if (Status == STATUS_SUCCESS) + { + ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenImpersonationLevel arg. But Buffer == NULL\n"); } else { - ok(Buffer == NULL, "Wrong. SQIT call is't success. But Buffer != NULL\n"); - } + ok(Buffer == NULL, "Wrong. SQIT call failed. But Buffer != NULL\n"); + } + if (Buffer) ExFreePool(Buffer); + + //----------------------------------------------------------------// + + // Call SQIT with the 4 classes (TokenOrigin, TokenGroupsAndPrivileges, + // TokenRestrictedSids and TokenSandBoxInert) are not supported by + // SeQueryInformationToken (only NtQueryInformationToken supports them). + // + + Buffer = NULL; + Status = SeQueryInformationToken(Token, TokenOrigin, &Buffer); + ok(Status == STATUS_INVALID_INFO_CLASS, "SQIT with TokenOrigin failed with Status 0x%08X; expected STATUS_INVALID_INFO_CLASS\n", Status); + ok(Buffer == NULL, "Wrong. SQIT call failed. But Buffer != NULL\n"); + + Buffer = NULL; + Status = SeQueryInformationToken(Token, TokenGroupsAndPrivileges, &Buffer); + ok(Status == STATUS_INVALID_INFO_CLASS, "SQIT with TokenGroupsAndPrivileges failed with Status 0x%08X; expected STATUS_INVALID_INFO_CLASS\n", Status); + ok(Buffer == NULL, "Wrong. SQIT call failed. But Buffer != NULL\n"); + + Buffer = NULL; + Status = SeQueryInformationToken(Token, TokenRestrictedSids, &Buffer); + ok(Status == STATUS_INVALID_INFO_CLASS, "SQIT with TokenRestrictedSids failed with Status 0x%08X; expected STATUS_INVALID_INFO_CLASS\n", Status); + ok(Buffer == NULL, "Wrong. SQIT call failed. But Buffer != NULL\n"); + + Buffer = NULL; + Status = SeQueryInformationToken(Token, TokenSandBoxInert, &Buffer); + ok(Status == STATUS_INVALID_INFO_CLASS, "SQIT with TokenSandBoxInert failed with Status 0x%08X; expected STATUS_INVALID_INFO_CLASS\n", Status); + ok(Buffer == NULL, "Wrong. SQIT call failed. But Buffer != NULL\n"); //----------------------------------------------------------------// Buffer = NULL; Status = SeQueryInformationToken(Token, TokenStatistics, &Buffer); - ok(Status == STATUS_SUCCESS, "SQIT with TokenStatistics fails with status 0x%X\n", Status); - if (Status == STATUS_SUCCESS) - { - ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenStatistics arg. But Buffer = NULL\n"); + ok(Status == STATUS_SUCCESS, "SQIT with TokenStatistics fails with status 0x%08X\n", Status); + if (Status == STATUS_SUCCESS) + { + ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenStatistics arg. But Buffer == NULL\n"); if (Buffer) { TStats = (PTOKEN_STATISTICS)Buffer; - // just put 0 into 1st arg or use trace to print TokenStatistics f + // just put 0 into 1st arg or use trace to print TokenStatistics ok(1, "print statistics:\n\tTokenID = %u_%d\n\tSecurityImperLevel = %d\n\tPrivCount = %d\n\tGroupCount = %d\n\n", TStats->TokenId.LowPart, TStats->TokenId.HighPart, TStats->ImpersonationLevel, TStats->PrivilegeCount, TStats->GroupCount ); - ExFreePool(TStats); + ExFreePool(Buffer); } } else { - ok(Buffer == NULL, "Wrong. SQIT call is't success. But Buffer != NULL\n"); + ok(Buffer == NULL, "Wrong. SQIT call failed. But Buffer != NULL\n"); } //----------------------------------------------------------------// Buffer = NULL; Status = SeQueryInformationToken(Token, TokenType, &Buffer); - ok(Status == STATUS_SUCCESS, "SQIT with TokenType fails with status 0x%X\n", Status); - if (Status == STATUS_SUCCESS) - { - ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenType arg. But Buffer = NULL\n"); + ok(Status == STATUS_SUCCESS, "SQIT with TokenType fails with status 0x%08X\n", Status); + if (Status == STATUS_SUCCESS) + { + ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenType arg. But Buffer == NULL\n"); if (Buffer) { TType = (PTOKEN_TYPE)Buffer; ok((*TType == TokenPrimary || *TType == TokenImpersonation), "TokenType in not a primary nor impersonation. FAILED\n"); - ExFreePool(TType); + ExFreePool(Buffer); } } @@ -169,12 +199,12 @@ ok(Status == STATUS_SUCCESS, "SQIT with TokenUser fails\n"); if (Status == STATUS_SUCCESS) { - ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenUser arg. But Buffer = NULL\n"); + ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenUser arg. But Buffer == NULL\n"); if (Buffer) { TUser = (PTOKEN_USER)Buffer; ok(RtlValidSid(TUser->User.Sid), "TokenUser has an invalid Sid\n"); - ExFreePool(TUser); + ExFreePool(Buffer); } } @@ -237,7 +267,6 @@ SeCaptureSubjectContext(&AccessState->SubjectSecurityContext); SeLockSubjectContext(&AccessState->SubjectSecurityContext); - Token = SeQuerySubjectContextToken(&AccessState->SubjectSecurityContext); // Testing SQIT with AccessState Token @@ -295,8 +324,7 @@ // Testing SeFreePrivileges // //----------------------------------------------------------------// - Privileges = ExAllocatePool(PagedPool, AuxData->PrivilegeSet->PrivilegeCount*sizeof(PRIVILEGE_SET)); - + Privileges = NULL; Checker = SeAccessCheck( AccessState->SecurityDescriptor, &AccessState->SubjectSecurityContext, @@ -311,6 +339,11 @@ ); ok(Checker, "Checker is NULL\n"); ok((Privileges != NULL), "Privileges is NULL\n"); + if (Privileges) + { + trace("AuxData->PrivilegeSet->PrivilegeCount = %d ; Privileges->PrivilegeCount = %d\n", + AuxData->PrivilegeSet->PrivilegeCount, Privileges->PrivilegeCount); + } if (Privileges) SeFreePrivileges(Privileges); @@ -326,7 +359,7 @@ Status = SeQueryInformationToken(Token, TokenPrivileges, &Buffer); if (Status == STATUS_SUCCESS) { - ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenPrivileges arg. But Buffer = NULL\n"); + ok(Buffer != NULL, "Wrong. SQIT call was successful with TokenPrivileges arg. But Buffer == NULL\n"); if (Buffer) { TPrivileges = (PTOKEN_PRIVILEGES)(Buffer); @@ -351,8 +384,7 @@ // Call SeFreePrivileges again - Privileges = ExAllocatePool(PagedPool, 20*sizeof(PRIVILEGE_SET)); - + Privileges = NULL; Checker = SeAccessCheck( AccessState->SecurityDescriptor, &AccessState->SubjectSecurityContext, @@ -367,6 +399,11 @@ ); ok(Checker, "Checker is NULL\n"); ok((Privileges != NULL), "Privileges is NULL\n"); + if (Privileges) + { + trace("AuxData->PrivilegeSet->PrivilegeCount = %d ; Privileges->PrivilegeCount = %d\n", + AuxData->PrivilegeSet->PrivilegeCount, Privileges->PrivilegeCount); + } if (Privileges) SeFreePrivileges(Privileges); //----------------------------------------------------------------//
8 years, 1 month
1
0
0
0
[gadamopoulos] 73121: [SHELL32_APITEST] - Add extensive tests for SHParseDisplayName. I tried to add as many as possible but this list of tests is still incomplete. In the meantime I discovered int...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Nov 4 17:31:53 2016 New Revision: 73121 URL:
http://svn.reactos.org/svn/reactos?rev=73121&view=rev
Log: [SHELL32_APITEST] - Add extensive tests for SHParseDisplayName. I tried to add as many as possible but this list of tests is still incomplete. In the meantime I discovered interesting stuff like the "shell:system" path which if you enter in the run dialog will open the system32 folder. I tried to test parsing protocols like ftp paths but couldn't find wht it should look like yet. Afaik all protocol except for the shell protocol like the one mentioned before should be parsed by CInternet class as noted in the appropriate comment in the tests. Modified: trunk/rostests/apitests/shell32/SHParseDisplayName.cpp Modified: trunk/rostests/apitests/shell32/SHParseDisplayName.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/shell32/SHParseD…
============================================================================== --- trunk/rostests/apitests/shell32/SHParseDisplayName.cpp [iso-8859-1] (original) +++ trunk/rostests/apitests/shell32/SHParseDisplayName.cpp [iso-8859-1] Fri Nov 4 17:31:53 2016 @@ -10,150 +10,186 @@ #include <ndk/umtypes.h> #include <strsafe.h> +/* Version masks */ +#define T_ALL 0x0 +#define T_WIN2K 0x1 +#define T_WINXP 0x2 +#define T_WIN2K3 0x4 +#define T_VISTA 0x8 +#define T_WIN7 0x10 +#define T_WIN8 0x20 +#define T_WIN10 0x40 + +#define T_PRE_VISTA T_WIN2K|T_WINXP|T_WIN2K3 +#define T_VISTA_PLUS T_VISTA|T_WIN7|T_WIN8|T_WIN10 + +struct test_data +{ + int testline; + PCWSTR wszPathToParse; + PCWSTR wszExpectedDisplayName; + INT nExpectedCSIDL; + HRESULT hResult; + UINT ValidForVersion; +}; + +struct test_data Tests[] = +{ + /* Tests for CDesktopFolder */ + {__LINE__, NULL, NULL, 0, E_OUTOFMEMORY, T_PRE_VISTA}, + {__LINE__, NULL, NULL, 0, E_INVALIDARG, T_VISTA_PLUS}, + {__LINE__, L"", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0, S_OK, 0}, + {__LINE__, L" ", NULL, 0, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), T_PRE_VISTA}, + {__LINE__, L" ", NULL, 0, E_INVALIDARG, T_VISTA_PLUS}, + {__LINE__, L":", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L": ", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L" :", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"/", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"//", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"\\", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"\\\\?", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"\\\\?\\", NULL, 0, E_INVALIDARG, 0}, + /* Tests for the shell: protocol */ + {__LINE__, L"shell:", NULL, 0, HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), 0}, + {__LINE__, L"shell::", NULL, 0, HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), 0}, + {__LINE__, L"shell:::", NULL, 0, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), 0}, + {__LINE__, L"shell:::{", NULL, 0, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), 0}, + {__LINE__, L"shell:fail", NULL, 0, HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), 0}, + {__LINE__, L"shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0, S_OK, 0}, + {__LINE__, L"shell:desktop", NULL, CSIDL_DESKTOPDIRECTORY, S_OK, T_PRE_VISTA}, + {__LINE__, L"shell:windows", NULL, CSIDL_WINDOWS, S_OK, T_PRE_VISTA}, + {__LINE__, L"shell:system", NULL, CSIDL_SYSTEM, S_OK, T_PRE_VISTA}, + {__LINE__, L"shell:personal", NULL, CSIDL_MYDOCUMENTS, S_OK, T_PRE_VISTA}, + {__LINE__, L"shell:programs", NULL, CSIDL_PROGRAMS, S_OK, T_PRE_VISTA}, + {__LINE__, L"shell:programfiles", NULL, CSIDL_PROGRAM_FILES, S_OK, T_PRE_VISTA}, + /* The following tests are confusing. They don't work for SHParseDisplayName but work on psfDesktop->ParseDisplayName */ + {__LINE__, L"shell:desktop", NULL, 0, HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), T_VISTA_PLUS}, + {__LINE__, L"shell:windows", NULL, 0, HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), T_VISTA_PLUS}, + {__LINE__, L"shell:system", NULL, 0, HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), T_VISTA_PLUS}, + {__LINE__, L"shell:personal", NULL, 0, HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), T_VISTA_PLUS}, + {__LINE__, L"shell:programs", NULL, 0, HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), T_VISTA_PLUS}, + {__LINE__, L"shell:programfiles", NULL, 0, HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), T_VISTA_PLUS}, + /* Tests for CInternet */ + {__LINE__, L"aa:", NULL, 0, E_INVALIDARG, T_PRE_VISTA}, + {__LINE__, L"garbage:", NULL, 0, E_INVALIDARG, T_PRE_VISTA}, + {__LINE__, L"ftp:", NULL, 0, E_INVALIDARG, T_PRE_VISTA}, + {__LINE__, L"ftp:/", NULL, 0, E_INVALIDARG, T_PRE_VISTA}, + {__LINE__, L"ftp://", NULL, 0, E_INVALIDARG, T_PRE_VISTA}, + {__LINE__, L"ftp://a", NULL, 0, E_INVALIDARG, T_PRE_VISTA}, + {__LINE__, L"
ftp://ftp.gnu.org/gnu/octave/
", NULL, 0, E_INVALIDARG, T_PRE_VISTA}, + {__LINE__, L"aa:", L"aa:", 0, S_OK, T_VISTA_PLUS}, + {__LINE__, L"garbage:", L"garbage:", 0, S_OK, T_VISTA_PLUS}, + {__LINE__, L"ftp:", L"ftp:", 0, S_OK, T_VISTA_PLUS}, + {__LINE__, L"ftp:/", L"ftp:/", 0, S_OK, T_VISTA_PLUS}, + {__LINE__, L"ftp://", L"ftp:///", 0, S_OK, T_VISTA_PLUS}, + {__LINE__, L"ftp://a", L"ftp://a/", 0, S_OK, T_VISTA_PLUS}, + {__LINE__, L"
ftp://ftp.gnu.org/gnu/octave/
", L"
ftp://ftp.gnu.org/gnu/octave/
", 0, S_OK, T_VISTA_PLUS}, + /* Tests for CRegFolder */ + {__LINE__, L"::", NULL, 0, CO_E_CLASSSTRING, 0}, + {__LINE__, L"::{", NULL, 0, CO_E_CLASSSTRING, 0}, + {__LINE__, L"::{ ", NULL, 0, CO_E_CLASSSTRING, 0}, + {__LINE__, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0, S_OK, 0}, + {__LINE__, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D} ", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0, S_OK, 0}, + {__LINE__, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}a", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0, S_OK, 0}, + {__LINE__, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}garbage", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0, S_OK, 0}, + {__LINE__, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D ", NULL, 0, CO_E_CLASSSTRING, 0}, + {__LINE__, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\ ", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}", 0, S_OK, 0}, + /* Tests for CDrivesFolder */ + {__LINE__, L"c:", NULL, 0, E_INVALIDARG, T_PRE_VISTA}, + {__LINE__, L"c:", L"C:\\", 0, S_OK, T_VISTA_PLUS}, + {__LINE__, L"c:\\", L"C:\\", 0, S_OK, 0}, + {__LINE__, L"C:\\", L"C:\\", 0, S_OK, 0}, + {__LINE__, L"y:\\", NULL, 0, HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), T_PRE_VISTA}, + {__LINE__, L"y:\\", NULL, 0, HRESULT_FROM_WIN32(ERROR_INVALID_DRIVE), T_VISTA_PLUS}, + {__LINE__, L"C:\\ ", NULL, 0, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), T_PRE_VISTA}, + {__LINE__, L"C:\\ ", NULL, 0, E_INVALIDARG, T_VISTA_PLUS}, + /* Tests for CFSFolder */ + {__LINE__, L"$", NULL, 0, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), 0}, + {__LINE__, L"c:\\Program Files", L"C:\\Program Files", 0, S_OK, 0}, + {__LINE__, L"c:\\Program Files\\", L"C:\\Program Files", 0, S_OK, 0}, + /* Paths with . are valid for win+r dialog or address bar but not for ParseDisplayName */ + {__LINE__, L"c:\\Program Files\\.", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"c:\\Program Files\\..", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L".", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"..", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"C:\\.", NULL, 0, E_INVALIDARG, 0}, + {__LINE__, L"C:\\..", NULL, 0, E_INVALIDARG, 0} /* C:\.. in the addressbar gives my computer! */ +}; + +UINT get_host_os_flag() +{ + switch (LOWORD(GetVersion())) + { + case 5: return T_WIN2K; + case (5 | (1 << 8)): return T_WINXP; + case (5 | (2 << 8)): return T_WIN2K3; + case 6: return T_VISTA; + case (6 | (1 << 8)): return T_WIN7; + case (6 | (2 << 8)): return T_WIN8; + case 10: return T_WIN10; + } + + return 0; +} + START_TEST(SHParseDisplayName) { HRESULT hr; - PIDLIST_ABSOLUTE pidl; - WCHAR systemDir[MAX_PATH]; - WCHAR path[MAX_PATH]; - WCHAR resultPath[MAX_PATH]; - BOOL winv6 = LOBYTE(LOWORD(GetVersion())) >= 6; + UINT os_flag = get_host_os_flag(); + ok (os_flag != 0, "Incompatible os version %d!", os_flag); + if (os_flag == 0) + return; - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + IShellFolder *psfDesktop; + hr = SHGetDesktopFolder(&psfDesktop); + ok(hr == S_OK, "hr = %lx\n", hr); - GetSystemDirectoryW(systemDir, RTL_NUMBER_OF(systemDir)); - SetCurrentDirectoryW(systemDir); + for (UINT i = 0; i < _countof(Tests); i ++) + { + if (Tests[i].ValidForVersion && !(Tests[i].ValidForVersion & os_flag)) + continue; - /* The code below relies on these properties */ - ok(systemDir[1] == L':', "systemDir = %ls\n", systemDir); - ok(systemDir[2] == L'\\', "systemDir = %ls\n", systemDir); - ok(systemDir[wcslen(systemDir) - 1] != L'\\', "systemDir = %ls\n", systemDir); - ok(wcschr(systemDir + 3, L'\\') != NULL, "systemDir = %ls\n", systemDir); + PIDLIST_ABSOLUTE pidl; + HRESULT hr = SHParseDisplayName(Tests[i].wszPathToParse, NULL, &pidl, 0, NULL); + ok(hr == Tests[i].hResult, "%d: Expected error 0x%lx, got 0x%lx\n", Tests[i].testline, Tests[i].hResult, hr); - /* NULL */ - pidl = NULL; - StartSeh() - hr = SHParseDisplayName(NULL, NULL, &pidl, 0, NULL); - EndSeh(STATUS_SUCCESS); - ok(hr == E_OUTOFMEMORY || hr == E_INVALIDARG, "hr = %lx\n", hr); - ok(pidl == NULL, "pidl = %p\n", pidl); - if (pidl) CoTaskMemFree(pidl); + if (Tests[i].wszExpectedDisplayName == NULL && Tests[i].nExpectedCSIDL == 0) + { + ok(pidl == NULL, "%d: Expected no pidl\n", Tests[i].testline); + continue; + } - /* empty string */ - pidl = NULL; - hr = SHParseDisplayName(L"", NULL, &pidl, 0, NULL); - ok(hr == S_OK, "hr = %lx\n", hr); - ok(pidl != NULL, "pidl = %p\n", pidl); - resultPath[0] = UNICODE_NULL; - SHGetPathFromIDListW(pidl, resultPath); - ok_wstr(resultPath, L""); - if (pidl) CoTaskMemFree(pidl); + ok(pidl != NULL, "%d: Expected pidl on success\n", Tests[i].testline); + if(!pidl) + continue; - /* C: */ - path[0] = systemDir[0]; - path[1] = L':'; - path[2] = UNICODE_NULL; - pidl = NULL; - hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL); - if (winv6) - { - /* Win7 accepts this and returns C:\ */ - ok(hr == S_OK, "hr = %lx\n", hr); - ok(pidl != NULL, "pidl = %p\n", pidl); - resultPath[0] = UNICODE_NULL; - SHGetPathFromIDListW(pidl, resultPath); - path[2] = L'\\'; - path[3] = UNICODE_NULL; - ok(!wcsicmp(resultPath, path), "Got %ls, expected %ls\n", resultPath, path); + STRRET strret; + hr = psfDesktop->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &strret); + ok(hr == S_OK, "%d: hr = %lx\n", Tests[i].testline, hr); + + ok(strret.uType == STRRET_WSTR, "%d: Expected STRRET_WSTR\n", Tests[i].testline); + + if (Tests[i].wszExpectedDisplayName) + { + ok(!wcscmp(strret.pOleStr, Tests[i].wszExpectedDisplayName), "%d: expected %S got %S\n", Tests[i].testline, Tests[i].wszExpectedDisplayName, strret.pOleStr); + } + else + { + PIDLIST_ABSOLUTE pidlSpecial; + hr = SHGetSpecialFolderLocation(NULL, Tests[i].nExpectedCSIDL, &pidlSpecial); + ok(hr == S_OK, "%d: hr = %lx\n", Tests[i].testline, hr); + + STRRET strretSpecial; + hr = psfDesktop->GetDisplayNameOf(pidlSpecial, SHGDN_FORPARSING, &strretSpecial); + ok(hr == S_OK, "%d: hr = %lx\n", Tests[i].testline, hr); + + ok(strret.uType == STRRET_WSTR, "%d: Expected STRRET_WSTR\n", Tests[i].testline); + + ok(!wcscmp(strret.pOleStr, strretSpecial.pOleStr), "%d: expected %S got %S\n", Tests[i].testline, strretSpecial.pOleStr, strret.pOleStr); + } } - else - { - /* Win2003 fails this */ - ok(hr == E_INVALIDARG, "hr = %lx\n", hr); - ok(pidl == NULL, "pidl = %p\n", pidl); - } - if (pidl) CoTaskMemFree(pidl); - - /* C:\ */ - path[0] = systemDir[0]; - path[1] = L':'; - path[2] = L'\\'; - path[3] = UNICODE_NULL; - pidl = NULL; - hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL); - ok(hr == S_OK, "hr = %lx\n", hr); - ok(pidl != NULL, "pidl = %p\n", pidl); - resultPath[0] = UNICODE_NULL; - SHGetPathFromIDListW(pidl, resultPath); - ok(!wcsicmp(resultPath, path), "Got %ls, expected %ls\n", resultPath, path); - if (pidl) CoTaskMemFree(pidl); - - /* C:\\ */ - path[0] = systemDir[0]; - path[1] = L':'; - path[2] = L'\\'; - path[3] = L'\\'; - path[4] = UNICODE_NULL; - pidl = NULL; - hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL); - ok(hr == E_INVALIDARG, "hr = %lx\n", hr); - ok(pidl == NULL, "pidl = %p\n", pidl); - if (pidl) CoTaskMemFree(pidl); - - /* C:\ReactOS */ - StringCbCopyW(path, sizeof(path), systemDir); - wcschr(path + 3, L'\\')[0] = UNICODE_NULL; - pidl = NULL; - hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL); - ok(hr == S_OK, "hr = %lx\n", hr); - ok(pidl != NULL, "pidl = %p\n", pidl); - resultPath[0] = UNICODE_NULL; - SHGetPathFromIDListW(pidl, resultPath); - ok(!wcsicmp(resultPath, path), "Got %ls, expected %ls\n", resultPath, path); - if (pidl) CoTaskMemFree(pidl); - - /* C:\ReactOS\ */ - StringCbCopyW(path, sizeof(path), systemDir); - wcschr(path + 3, L'\\')[1] = UNICODE_NULL; - pidl = NULL; - hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL); - ok(hr == S_OK, "hr = %lx\n", hr); - ok(pidl != NULL, "pidl = %p\n", pidl); - resultPath[0] = UNICODE_NULL; - SHGetPathFromIDListW(pidl, resultPath); - path[wcslen(path) - 1] = UNICODE_NULL; - ok(!wcsicmp(resultPath, path), "Got %ls, expected %ls\n", resultPath, path); - if (pidl) CoTaskMemFree(pidl); - - /* C:\ReactOS\system32 */ - StringCbCopyW(path, sizeof(path), systemDir); - pidl = NULL; - hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL); - ok(hr == S_OK, "hr = %lx\n", hr); - ok(pidl != NULL, "pidl = %p\n", pidl); - resultPath[0] = UNICODE_NULL; - SHGetPathFromIDListW(pidl, resultPath); - ok(!wcsicmp(resultPath, path), "Got %ls, expected %ls\n", resultPath, path); - if (pidl) CoTaskMemFree(pidl); - - /* C:ntoskrnl.exe */ - path[0] = systemDir[0]; - path[1] = L':'; - path[2] = UNICODE_NULL; - StringCbCatW(path, sizeof(path), L"ntoskrnl.exe"); - pidl = NULL; - hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL); - ok(hr == E_INVALIDARG, "hr = %lx\n", hr); - ok(pidl == NULL, "pidl = %p\n", pidl); - if (pidl) CoTaskMemFree(pidl); - - /* ntoskrnl.exe */ - StringCbCopyW(path, sizeof(path), L"ntoskrnl.exe"); - pidl = NULL; - hr = SHParseDisplayName(path, NULL, &pidl, 0, NULL); - ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hr = %lx\n", hr); - ok(pidl == NULL, "pidl = %p\n", pidl); - if (pidl) CoTaskMemFree(pidl); CoUninitialize(); }
8 years, 1 month
1
0
0
0
← Newer
1
...
26
27
28
29
30
31
32
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
32
Results per page:
10
25
50
100
200