winehq.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
2025
February
January
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
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2010
----- 2025 -----
February 2025
January 2025
----- 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
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
892 discussions
Start a n
N
ew thread
David Hedberg : shell32: Implement SHCreateShellItemArrayFromDataObject.
by Alexandre Julliard
26 Jul '10
26 Jul '10
Module: wine Branch: master Commit: fd6d9cd8f211602b680cf438b2c342f5af0998ab URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fd6d9cd8f211602b680cf438b…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Mon Jul 26 11:54:05 2010 +0200 shell32: Implement SHCreateShellItemArrayFromDataObject. --- dlls/shell32/shell32.spec | 1 + dlls/shell32/shellitem.c | 52 ++++++++++++++++++++++++ dlls/shell32/tests/shlfolder.c | 87 ++++++++++++++++++++++++++++++++++++++++ include/shobjidl.idl | 1 + 4 files changed, 141 insertions(+), 0 deletions(-) diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec index 41cfde3..da8944a 100644 --- a/dlls/shell32/shell32.spec +++ b/dlls/shell32/shell32.spec @@ -335,6 +335,7 @@ @ stub SHCreateProcessAsUserW @ stdcall SHCreateShellItem(ptr ptr ptr ptr) @ stdcall SHCreateShellItemArray(ptr ptr long ptr ptr) +@ stdcall SHCreateShellItemArrayFromDataObject(ptr ptr ptr) @ stdcall SHCreateShellItemArrayFromShellItem(ptr ptr ptr) @ stdcall SHEmptyRecycleBinA(long str long) @ stdcall SHEmptyRecycleBinW(long wstr long) diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c index 68cd32e..5b01262 100644 --- a/dlls/shell32/shellitem.c +++ b/dlls/shell32/shellitem.c @@ -857,3 +857,55 @@ HRESULT WINAPI SHCreateShellItemArrayFromShellItem(IShellItem *psi, REFIID riid, return ret; } + +HRESULT WINAPI SHCreateShellItemArrayFromDataObject(IDataObject *pdo, REFIID riid, void **ppv) +{ + IShellItemArray *psia; + FORMATETC fmt; + STGMEDIUM medium; + HRESULT ret; + + TRACE("%p, %s, %p\n", pdo, shdebugstr_guid(riid), ppv); + + if(!pdo) + return E_INVALIDARG; + + *ppv = NULL; + + fmt.cfFormat = RegisterClipboardFormatW(CFSTR_SHELLIDLISTW); + fmt.ptd = NULL; + fmt.dwAspect = DVASPECT_CONTENT; + fmt.lindex = -1; + fmt.tymed = TYMED_HGLOBAL; + + ret = IDataObject_GetData(pdo, &fmt, &medium); + if(SUCCEEDED(ret)) + { + LPIDA pida = GlobalLock(medium.u.hGlobal); + LPCITEMIDLIST parent_pidl; + LPCITEMIDLIST *children; + UINT i; + TRACE("Converting %d objects.\n", pida->cidl); + + parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]); + + children = HeapAlloc(GetProcessHeap(), 0, sizeof(LPCITEMIDLIST)*pida->cidl); + for(i = 0; i < pida->cidl; i++) + children[i] = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i+1]); + + ret = SHCreateShellItemArray(parent_pidl, NULL, pida->cidl, children, (IShellItemArray**)&psia); + + HeapFree(GetProcessHeap(), 0, children); + + GlobalUnlock(medium.u.hGlobal); + GlobalFree(medium.u.hGlobal); + } + + if(SUCCEEDED(ret)) + { + ret = IShellItemArray_QueryInterface(psia, riid, ppv); + IShellItemArray_Release(psia); + } + + return ret; +} diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index b8c5da6..c2305c8 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -59,6 +59,7 @@ static HRESULT (WINAPI *pSHCreateItemFromIDList)(PCIDLIST_ABSOLUTE pidl, REFIID static HRESULT (WINAPI *pSHCreateItemFromParsingName)(PCWSTR,IBindCtx*,REFIID,void**); static HRESULT (WINAPI *pSHCreateShellItem)(LPCITEMIDLIST,IShellFolder*,LPCITEMIDLIST,IShellItem**); static HRESULT (WINAPI *pSHCreateShellItemArray)(LPCITEMIDLIST,IShellFolder*,UINT,LPCITEMIDLIST*,IShellItemArray**); +static HRESULT (WINAPI *pSHCreateShellItemArrayFromDataObject)(IDataObject*, REFIID, void **); static HRESULT (WINAPI *pSHCreateShellItemArrayFromShellItem)(IShellItem*, REFIID, void **); static LPITEMIDLIST (WINAPI *pILCombine)(LPCITEMIDLIST,LPCITEMIDLIST); static HRESULT (WINAPI *pSHParseDisplayName)(LPCWSTR,IBindCtx*,LPITEMIDLIST*,SFGAOF,SFGAOF*); @@ -82,6 +83,7 @@ static void init_function_pointers(void) MAKEFUNC(SHCreateItemFromParsingName); MAKEFUNC(SHCreateShellItem); MAKEFUNC(SHCreateShellItemArray); + MAKEFUNC(SHCreateShellItemArrayFromDataObject); MAKEFUNC(SHCreateShellItemArrayFromShellItem); MAKEFUNC(SHGetFolderPathA); MAKEFUNC(SHGetFolderPathAndSubDirA); @@ -3112,6 +3114,91 @@ static void test_SHCreateShellItemArray(void) else skip("No SHCreateShellItemArrayFromShellItem.\n"); + if(pSHCreateShellItemArrayFromDataObject) + { + IShellView *psv; + + if(0) + { + /* Crashes under Windows 7 */ + hr = pSHCreateShellItemArrayFromDataObject(NULL, &IID_IShellItemArray, NULL); + } + hr = pSHCreateShellItemArrayFromDataObject(NULL, &IID_IShellItemArray, (void**)&psia); + ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); + + hr = IShellFolder_CreateViewObject(psf, NULL, &IID_IShellView, (void**)&psv); + ok(hr == S_OK, "got 0x%08x\n", hr); + if(SUCCEEDED(hr)) + { + IEnumIDList *peidl; + IDataObject *pdo; + SHCONTF enum_flags; + + enum_flags = SHCONTF_NONFOLDERS | SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN; + hr = IShellFolder_EnumObjects(psf, NULL, enum_flags, &peidl); + ok(hr == S_OK, "got 0x%08x\n", hr); + if(SUCCEEDED(hr)) + { + LPITEMIDLIST apidl[5]; + UINT count, i; + + for(count = 0; count < 5; count++) + if(IEnumIDList_Next(peidl, 1, &apidl[count], NULL) != S_OK) + break; + ok(count == 5, "Got %d\n", count); + + if(count) + { + hr = IShellFolder_GetUIObjectOf(psf, NULL, count, (LPCITEMIDLIST*)apidl, + &IID_IDataObject, NULL, (void**)&pdo); + ok(hr == S_OK, "Got 0x%08x\n", hr); + if(SUCCEEDED(hr)) + { + hr = pSHCreateShellItemArrayFromDataObject(pdo, &IID_IShellItemArray, + (void**)&psia); + ok(hr == S_OK, "Got 0x%08x\n", hr); + if(SUCCEEDED(hr)) + { + UINT count_sia, i; + hr = IShellItemArray_GetCount(psia, &count_sia); + ok(count_sia == count, "Counts differ (%d, %d)\n", count, count_sia); + for(i = 0; i < count_sia; i++) + { + LPITEMIDLIST pidl_abs = ILCombine(pidl_testdir, apidl[i]); + IShellItem *psi; + hr = IShellItemArray_GetItemAt(psia, i, &psi); + ok(hr == S_OK, "Got 0x%08x\n", hr); + if(SUCCEEDED(hr)) + { + LPITEMIDLIST pidl; + hr = pSHGetIDListFromObject((IUnknown*)psi, &pidl); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(pidl != NULL, "pidl as NULL.\n"); + ok(ILIsEqual(pidl, pidl_abs), "pidls differ.\n"); + pILFree(pidl); + IShellItem_Release(psi); + } + pILFree(pidl_abs); + } + + IShellItemArray_Release(psia); + } + + IDataObject_Release(pdo); + } + for(i = 0; i < count; i++) + pILFree(apidl[i]); + } + else + skip("No files found - skipping test.\n"); + + IEnumIDList_Release(peidl); + } + IShellView_Release(psv); + } + } + else + skip("No SHCreateShellItemArrayFromDataObject.\n"); IShellFolder_Release(psf); pILFree(pidl_testdir); diff --git a/include/shobjidl.idl b/include/shobjidl.idl index f4defe0..82d8aaf 100644 --- a/include/shobjidl.idl +++ b/include/shobjidl.idl @@ -519,6 +519,7 @@ cpp_quote("HRESULT WINAPI SHGetIDListFromObject(IUnknown *punk, PIDLIST_ABSOLUTE cpp_quote("HRESULT WINAPI SHGetItemFromObject(IUnknown *punk, REFIID riid, void **ppv);") cpp_quote("HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent, IShellFolder* psf, UINT cidl, PCUITEMID_CHILD_ARRAY ppidl, IShellItemArray **ppsiItemArray);") cpp_quote("HRESULT WINAPI SHCreateShellItemArrayFromShellItem(IShellItem *psi, REFIID riid, void **ppv);") +cpp_quote("HRESULT WINAPI SHCreateShellItemArrayFromDataObject(IDataObject *pdo, REFIID riid, void **ppv);") /***************************************************************************** * IShellItemFilter interface
1
0
0
0
David Hedberg : shell32: Implement SHCreateShellItemArrayFromShellItem.
by Alexandre Julliard
26 Jul '10
26 Jul '10
Module: wine Branch: master Commit: bf1b56be101d17fed35d0ca342c3e9a45923484c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bf1b56be101d17fed35d0ca34…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Mon Jul 26 11:54:04 2010 +0200 shell32: Implement SHCreateShellItemArrayFromShellItem. --- dlls/shell32/shell32.spec | 1 + dlls/shell32/shellitem.c | 30 +++++++++++++++++++++ dlls/shell32/tests/shlfolder.c | 57 ++++++++++++++++++++++++++++++++++++++++ include/shobjidl.idl | 1 + 4 files changed, 89 insertions(+), 0 deletions(-) diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec index 426e841..41cfde3 100644 --- a/dlls/shell32/shell32.spec +++ b/dlls/shell32/shell32.spec @@ -335,6 +335,7 @@ @ stub SHCreateProcessAsUserW @ stdcall SHCreateShellItem(ptr ptr ptr ptr) @ stdcall SHCreateShellItemArray(ptr ptr long ptr ptr) +@ stdcall SHCreateShellItemArrayFromShellItem(ptr ptr ptr) @ stdcall SHEmptyRecycleBinA(long str long) @ stdcall SHEmptyRecycleBinW(long wstr long) @ stub SHExtractIconsW diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c index 8dd6239..68cd32e 100644 --- a/dlls/shell32/shellitem.c +++ b/dlls/shell32/shellitem.c @@ -827,3 +827,33 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent, *ppsiItemArray = NULL; return ret; } + +HRESULT WINAPI SHCreateShellItemArrayFromShellItem(IShellItem *psi, REFIID riid, void **ppv) +{ + IShellItemArrayImpl *This; + IShellItem **array; + HRESULT ret; + + TRACE("%p, %s, %p\n", psi, shdebugstr_guid(riid), ppv); + + array = HeapAlloc(GetProcessHeap(), 0, sizeof(IShellItem*)); + if(!array) + return E_OUTOFMEMORY; + + ret = IShellItemArray_Constructor(NULL, riid, (void**)&This); + if(SUCCEEDED(ret)) + { + array[0] = psi; + IShellItem_AddRef(psi); + This->array = array; + This->item_count = 1; + *ppv = This; + } + else + { + HeapFree(GetProcessHeap(), 0, array); + *ppv = NULL; + } + + return ret; +} diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index 491327e..b8c5da6 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -59,6 +59,7 @@ static HRESULT (WINAPI *pSHCreateItemFromIDList)(PCIDLIST_ABSOLUTE pidl, REFIID static HRESULT (WINAPI *pSHCreateItemFromParsingName)(PCWSTR,IBindCtx*,REFIID,void**); static HRESULT (WINAPI *pSHCreateShellItem)(LPCITEMIDLIST,IShellFolder*,LPCITEMIDLIST,IShellItem**); static HRESULT (WINAPI *pSHCreateShellItemArray)(LPCITEMIDLIST,IShellFolder*,UINT,LPCITEMIDLIST*,IShellItemArray**); +static HRESULT (WINAPI *pSHCreateShellItemArrayFromShellItem)(IShellItem*, REFIID, void **); static LPITEMIDLIST (WINAPI *pILCombine)(LPCITEMIDLIST,LPCITEMIDLIST); static HRESULT (WINAPI *pSHParseDisplayName)(LPCWSTR,IBindCtx*,LPITEMIDLIST*,SFGAOF,SFGAOF*); static LPITEMIDLIST (WINAPI *pSHSimpleIDListFromPathAW)(LPCVOID); @@ -81,6 +82,7 @@ static void init_function_pointers(void) MAKEFUNC(SHCreateItemFromParsingName); MAKEFUNC(SHCreateShellItem); MAKEFUNC(SHCreateShellItemArray); + MAKEFUNC(SHCreateShellItemArrayFromShellItem); MAKEFUNC(SHGetFolderPathA); MAKEFUNC(SHGetFolderPathAndSubDirA); MAKEFUNC(SHGetPathFromIDListW); @@ -3056,6 +3058,61 @@ static void test_SHCreateShellItemArray(void) } } + /* SHCreateShellItemArrayFromShellItem */ + if(pSHCreateShellItemArrayFromShellItem) + { + IShellItem *psi; + + if(0) + { + /* Crashes under Windows 7 */ + hr = pSHCreateShellItemArrayFromShellItem(NULL, &IID_IShellItemArray, NULL); + hr = pSHCreateShellItemArrayFromShellItem(NULL, &IID_IShellItemArray, (void**)&psia); + hr = pSHCreateShellItemArrayFromShellItem(psi, &IID_IShellItemArray, NULL); + } + + hr = pSHCreateItemFromIDList(pidl_testdir, &IID_IShellItem, (void**)&psi); + ok(hr == S_OK, "Got 0x%08x\n", hr); + if(SUCCEEDED(hr)) + { + hr = pSHCreateShellItemArrayFromShellItem(psi, &IID_IShellItemArray, (void**)&psia); + ok(hr == S_OK, "Got 0x%08x\n", hr); + if(SUCCEEDED(hr)) + { + IShellItem *psi2; + UINT count; + hr = IShellItemArray_GetCount(psia, &count); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(count == 1, "Got count %d\n", count); + hr = IShellItemArray_GetItemAt(psia, 0, &psi2); + ok(hr == S_OK, "Got 0x%08x\n", hr); + todo_wine + ok(psi != psi2, "ShellItems are of the same instance.\n"); + if(SUCCEEDED(hr)) + { + LPITEMIDLIST pidl1, pidl2; + hr = pSHGetIDListFromObject((IUnknown*)psi, &pidl1); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(pidl1 != NULL, "pidl1 was null.\n"); + hr = pSHGetIDListFromObject((IUnknown*)psi2, &pidl2); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(pidl2 != NULL, "pidl2 was null.\n"); + ok(ILIsEqual(pidl1, pidl2), "pidls not equal.\n"); + pILFree(pidl1); + pILFree(pidl2); + IShellItem_Release(psi2); + } + hr = IShellItemArray_GetItemAt(psia, 1, &psi2); + ok(hr == E_FAIL, "Got 0x%08x\n", hr); + IShellItemArray_Release(psia); + } + IShellItem_Release(psi); + } + } + else + skip("No SHCreateShellItemArrayFromShellItem.\n"); + + IShellFolder_Release(psf); pILFree(pidl_testdir); Cleanup(); diff --git a/include/shobjidl.idl b/include/shobjidl.idl index d982cc1..f4defe0 100644 --- a/include/shobjidl.idl +++ b/include/shobjidl.idl @@ -518,6 +518,7 @@ cpp_quote("HRESULT WINAPI SHGetItemFromDataObject(IDataObject *pdtobj, DATAOBJ_G cpp_quote("HRESULT WINAPI SHGetIDListFromObject(IUnknown *punk, PIDLIST_ABSOLUTE *ppidl);") cpp_quote("HRESULT WINAPI SHGetItemFromObject(IUnknown *punk, REFIID riid, void **ppv);") cpp_quote("HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent, IShellFolder* psf, UINT cidl, PCUITEMID_CHILD_ARRAY ppidl, IShellItemArray **ppsiItemArray);") +cpp_quote("HRESULT WINAPI SHCreateShellItemArrayFromShellItem(IShellItem *psi, REFIID riid, void **ppv);") /***************************************************************************** * IShellItemFilter interface
1
0
0
0
David Hedberg : shell32: Initial implementation of IShellItemArray with SHCreateShellItemArray.
by Alexandre Julliard
26 Jul '10
26 Jul '10
Module: wine Branch: master Commit: 090824feb5560c950f94b3bb1264a8a6af2bff04 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=090824feb5560c950f94b3bb1…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Mon Jul 26 11:54:03 2010 +0200 shell32: Initial implementation of IShellItemArray with SHCreateShellItemArray. --- dlls/shell32/shell32.spec | 1 + dlls/shell32/shellitem.c | 237 +++++++++++++++++++++++++++++++++++++++- dlls/shell32/tests/shlfolder.c | 132 ++++++++++++++++++++++ include/shobjidl.idl | 1 + 4 files changed, 370 insertions(+), 1 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=090824feb5560c950f94b…
1
0
0
0
Damjan Jovanovic : winemenubuilder: Add an option for thumbnailing . lnk files.
by Alexandre Julliard
26 Jul '10
26 Jul '10
Module: wine Branch: master Commit: dcb2ebee785f4feb6461d9d54d056c03e375a399 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=dcb2ebee785f4feb6461d9d54…
Author: Damjan Jovanovic <damjan.jov(a)gmail.com> Date: Mon Jul 26 06:52:38 2010 +0200 winemenubuilder: Add an option for thumbnailing .lnk files. --- programs/winemenubuilder/winemenubuilder.c | 103 ++++++++++++++++++++++++++++ 1 files changed, 103 insertions(+), 0 deletions(-) diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 8e3e0c8..7a77358 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -2742,6 +2742,98 @@ static void cleanup_menus(void) WINE_ERR("error opening registry key, menu cleanup failed\n"); } +static void thumbnail_lnk(LPCWSTR lnkPath, LPCWSTR outputPath) +{ + char *utf8lnkPath = NULL; + char *utf8OutputPath = NULL; + WCHAR *winLnkPath = NULL; + IShellLinkW *shellLink = NULL; + IPersistFile *persistFile = NULL; + WCHAR szTmp[MAX_PATH]; + WCHAR szPath[MAX_PATH]; + WCHAR szArgs[INFOTIPSIZE]; + WCHAR szIconPath[MAX_PATH]; + int iconId; + HRESULT hr; + + utf8lnkPath = wchars_to_utf8_chars(lnkPath); + if (utf8lnkPath == NULL) + { + WINE_ERR("out of memory converting paths\n"); + goto end; + } + + utf8OutputPath = wchars_to_utf8_chars(outputPath); + if (utf8OutputPath == NULL) + { + WINE_ERR("out of memory converting paths\n"); + goto end; + } + + winLnkPath = wine_get_dos_file_name(utf8lnkPath); + if (winLnkPath == NULL) + { + WINE_ERR("could not convert %s to DOS path\n", utf8lnkPath); + goto end; + } + + hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, + &IID_IShellLinkW, (LPVOID*)&shellLink); + if (FAILED(hr)) + { + WINE_ERR("could not create IShellLinkW, error 0x%08X\n", hr); + goto end; + } + + hr = IShellLinkW_QueryInterface(shellLink, &IID_IPersistFile, (LPVOID)&persistFile); + if (FAILED(hr)) + { + WINE_ERR("could not query IPersistFile, error 0x%08X\n", hr); + goto end; + } + + hr = IPersistFile_Load(persistFile, winLnkPath, STGM_READ); + if (FAILED(hr)) + { + WINE_ERR("could not read .lnk, error 0x%08X\n", hr); + goto end; + } + + get_cmdline(shellLink, szTmp, MAX_PATH, szArgs, INFOTIPSIZE); + ExpandEnvironmentStringsW(szTmp, szPath, MAX_PATH); + szTmp[0] = 0; + IShellLinkW_GetIconLocation(shellLink, szTmp, MAX_PATH, &iconId); + ExpandEnvironmentStringsW(szTmp, szIconPath, MAX_PATH); + + if(!szPath[0]) + { + LPITEMIDLIST pidl = NULL; + IShellLinkW_GetIDList(shellLink, &pidl); + if (pidl && SHGetPathFromIDListW(pidl, szPath)) + WINE_TRACE("pidl path : %s\n", wine_dbgstr_w(szPath)); + } + + if (szIconPath[0]) + { + if (!ExtractFromEXEDLL(szIconPath, iconId, utf8OutputPath)) + ExtractFromICO(szIconPath, utf8OutputPath); + } + else + { + if (!ExtractFromEXEDLL(szPath, iconId, utf8OutputPath)) + ExtractFromICO(szPath, utf8OutputPath); + } + +end: + HeapFree(GetProcessHeap(), 0, utf8lnkPath); + HeapFree(GetProcessHeap(), 0, utf8OutputPath); + HeapFree(GetProcessHeap(), 0, winLnkPath); + if (shellLink != NULL) + IShellLinkW_Release(shellLink); + if (persistFile != NULL) + IPersistFile_Release(persistFile); +} + static WCHAR *next_token( LPWSTR *p ) { LPWSTR token = NULL, t = *p; @@ -2827,6 +2919,7 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sh { static const WCHAR dash_aW[] = {'-','a',0}; static const WCHAR dash_rW[] = {'-','r',0}; + static const WCHAR dash_tW[] = {'-','t',0}; static const WCHAR dash_uW[] = {'-','u',0}; static const WCHAR dash_wW[] = {'-','w',0}; @@ -2865,6 +2958,16 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sh bWait = TRUE; else if ( !strcmpW( token, dash_uW ) ) bURL = TRUE; + else if ( !strcmpW( token, dash_tW ) ) + { + WCHAR *lnkFile = next_token( &p ); + if (lnkFile) + { + WCHAR *outputFile = next_token( &p ); + if (outputFile) + thumbnail_lnk(lnkFile, outputFile); + } + } else if( token[0] == '-' ) { WINE_ERR( "unknown option %s\n", wine_dbgstr_w(token) );
1
0
0
0
Andrew Nguyen : propsys/tests: Add tests for PSPropertyKeyFromString.
by Alexandre Julliard
26 Jul '10
26 Jul '10
Module: wine Branch: master Commit: be5fdcd2423c3b5ffd0468d4548e4cc295aeffb2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=be5fdcd2423c3b5ffd0468d45…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Sun Jul 25 21:58:16 2010 -0500 propsys/tests: Add tests for PSPropertyKeyFromString. --- dlls/propsys/tests/Makefile.in | 2 +- dlls/propsys/tests/propsys.c | 251 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 252 insertions(+), 1 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=be5fdcd2423c3b5ffd046…
1
0
0
0
Andrew Nguyen : propsys: Implement PSPropertyKeyFromString.
by Alexandre Julliard
26 Jul '10
26 Jul '10
Module: wine Branch: master Commit: 9d85d46a1a42fa8249d35cbe6f97ca2d0ce35bd2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9d85d46a1a42fa8249d35cbe6…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Sun Jul 25 21:58:07 2010 -0500 propsys: Implement PSPropertyKeyFromString. --- dlls/propsys/propsys.spec | 2 +- dlls/propsys/propsys_main.c | 142 +++++++++++++++++++++++++++++++++++++++++++ include/propsys.idl | 1 + 3 files changed, 144 insertions(+), 1 deletions(-) diff --git a/dlls/propsys/propsys.spec b/dlls/propsys/propsys.spec index cd41d90..10a1cba 100644 --- a/dlls/propsys/propsys.spec +++ b/dlls/propsys/propsys.spec @@ -87,7 +87,7 @@ @ stub PSGetPropertySystem @ stub PSGetPropertyValue @ stub PSLookupPropertyHandlerCLSID -@ stub PSPropertyKeyFromString +@ stdcall PSPropertyKeyFromString(wstr ptr) @ stub PSRefreshPropertySchema @ stdcall PSRegisterPropertySchema(wstr) @ stub PSSetPropertyValue diff --git a/dlls/propsys/propsys_main.c b/dlls/propsys/propsys_main.c index cd180fe..35efda8 100644 --- a/dlls/propsys/propsys_main.c +++ b/dlls/propsys/propsys_main.c @@ -1,6 +1,7 @@ /* * propsys main * + * Copyright 1997, 2002 Alexandre Julliard * Copyright 2008 James Hawkins * * This library is free software; you can redistribute it and/or @@ -130,3 +131,144 @@ HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); } } + +static const BYTE hex2bin[] = +{ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x00 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x10 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x20 */ + 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, /* 0x30 */ + 0,10,11,12,13,14,15,0,0,0,0,0,0,0,0,0, /* 0x40 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x50 */ + 0,10,11,12,13,14,15 /* 0x60 */ +}; + +static BOOL validate_indices(LPCWSTR s, int min, int max) +{ + int i; + + for (i = min; i <= max; i++) + { + if (!s[i]) + return FALSE; + + if (i == 0) + { + if (s[i] != '{') + return FALSE; + } + else if (i == 9 || i == 14 || i == 19 || i == 24) + { + if (s[i] != '-') + return FALSE; + } + else if (i == 37) + { + if (s[i] != '}') + return FALSE; + } + else + { + if (s[i] > 'f' || (!hex2bin[s[i]] && s[i] != '0')) + return FALSE; + } + } + + return TRUE; +} + +/* Adapted from CLSIDFromString helper in dlls/ole32/compobj.c and + * UuidFromString in dlls/rpcrt4/rpcrt4_main.c. */ +static BOOL string_to_guid(LPCWSTR s, LPGUID id) +{ + /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */ + + if (!validate_indices(s, 0, 8)) return FALSE; + id->Data1 = (hex2bin[s[1]] << 28 | hex2bin[s[2]] << 24 | hex2bin[s[3]] << 20 | hex2bin[s[4]] << 16 | + hex2bin[s[5]] << 12 | hex2bin[s[6]] << 8 | hex2bin[s[7]] << 4 | hex2bin[s[8]]); + if (!validate_indices(s, 9, 14)) return FALSE; + id->Data2 = hex2bin[s[10]] << 12 | hex2bin[s[11]] << 8 | hex2bin[s[12]] << 4 | hex2bin[s[13]]; + if (!validate_indices(s, 15, 19)) return FALSE; + id->Data3 = hex2bin[s[15]] << 12 | hex2bin[s[16]] << 8 | hex2bin[s[17]] << 4 | hex2bin[s[18]]; + + /* these are just sequential bytes */ + + if (!validate_indices(s, 20, 21)) return FALSE; + id->Data4[0] = hex2bin[s[20]] << 4 | hex2bin[s[21]]; + if (!validate_indices(s, 22, 24)) return FALSE; + id->Data4[1] = hex2bin[s[22]] << 4 | hex2bin[s[23]]; + + if (!validate_indices(s, 25, 26)) return FALSE; + id->Data4[2] = hex2bin[s[25]] << 4 | hex2bin[s[26]]; + if (!validate_indices(s, 27, 28)) return FALSE; + id->Data4[3] = hex2bin[s[27]] << 4 | hex2bin[s[28]]; + if (!validate_indices(s, 29, 30)) return FALSE; + id->Data4[4] = hex2bin[s[29]] << 4 | hex2bin[s[30]]; + if (!validate_indices(s, 31, 32)) return FALSE; + id->Data4[5] = hex2bin[s[31]] << 4 | hex2bin[s[32]]; + if (!validate_indices(s, 33, 34)) return FALSE; + id->Data4[6] = hex2bin[s[33]] << 4 | hex2bin[s[34]]; + if (!validate_indices(s, 35, 37)) return FALSE; + id->Data4[7] = hex2bin[s[35]] << 4 | hex2bin[s[36]]; + + return TRUE; +} + +HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR pszString, PROPERTYKEY *pkey) +{ + int has_minus = 0; + + TRACE("(%s, %p)\n", debugstr_w(pszString), pkey); + + if (!pszString || !pkey) + return E_POINTER; + + memset(pkey, 0, sizeof(PROPERTYKEY)); + + if (!string_to_guid(pszString, &pkey->fmtid)) + return E_INVALIDARG; + + pszString += GUIDSTRING_MAX - 1; + + if (!*pszString) + return E_INVALIDARG; + + /* Only the space seems to be recognized as whitespace. */ + while (*pszString == ' ') + pszString++; + + if (!*pszString) + return E_INVALIDARG; + + /* Only two minus signs are recognized. The first is ignored, and the + * second is interpreted. */ + if (*pszString == '-') + pszString++; + + /* Skip any intermediate spaces after the first minus sign. */ + while (*pszString == ' ') + pszString++; + + if (*pszString == '-') + { + has_minus = 1; + pszString++; + } + + /* Skip any remaining spaces after minus sign. */ + while (*pszString == ' ') + pszString++; + + /* Overflow is not checked. */ + while (isdigitW(*pszString)) + { + pkey->pid *= 10; + pkey->pid += (*pszString - '0'); + pszString++; + } + + if (has_minus) + pkey->pid = ~pkey->pid + 1; + + return S_OK; +} diff --git a/include/propsys.idl b/include/propsys.idl index c098041..da401c5 100644 --- a/include/propsys.idl +++ b/include/propsys.idl @@ -800,6 +800,7 @@ cpp_quote("#define GUIDSTRING_MAX 39") cpp_quote("#define PKEYSTR_MAX (GUIDSTRING_MAX + 1 + PKEY_PIDSTR_MAX)") cpp_quote("HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY,LPWSTR,UINT);") +cpp_quote("HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR,PROPERTYKEY*);") /* TODO: Add remainder of the C api here */
1
0
0
0
Andrew Nguyen : propsys/tests: Add tests for PSStringFromPropertyKey.
by Alexandre Julliard
26 Jul '10
26 Jul '10
Module: wine Branch: master Commit: c20908bf560035826855a334d93bdc9150aa0eae URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c20908bf560035826855a334d…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Sun Jul 25 21:57:59 2010 -0500 propsys/tests: Add tests for PSStringFromPropertyKey. --- configure | 1 + configure.ac | 1 + dlls/propsys/tests/Makefile.in | 11 +++ dlls/propsys/tests/propsys.c | 140 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 153 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 8f92437..a966b1b 100755 --- a/configure +++ b/configure @@ -14665,6 +14665,7 @@ wine_fn_config_dll pidgen enable_pidgen wine_fn_config_dll powrprof enable_powrprof powrprof wine_fn_config_dll printui enable_printui wine_fn_config_dll propsys enable_propsys propsys +wine_fn_config_test dlls/propsys/tests propsys_test wine_fn_config_dll psapi enable_psapi psapi wine_fn_config_test dlls/psapi/tests psapi_test wine_fn_config_dll pstorec enable_pstorec diff --git a/configure.ac b/configure.ac index 0180928..b7373b2 100644 --- a/configure.ac +++ b/configure.ac @@ -2534,6 +2534,7 @@ WINE_CONFIG_DLL(pidgen) WINE_CONFIG_DLL(powrprof,,[powrprof]) WINE_CONFIG_DLL(printui) WINE_CONFIG_DLL(propsys,,[propsys]) +WINE_CONFIG_TEST(dlls/propsys/tests) WINE_CONFIG_DLL(psapi,,[psapi]) WINE_CONFIG_TEST(dlls/psapi/tests) WINE_CONFIG_DLL(pstorec) diff --git a/dlls/propsys/tests/Makefile.in b/dlls/propsys/tests/Makefile.in new file mode 100644 index 0000000..d30f983 --- /dev/null +++ b/dlls/propsys/tests/Makefile.in @@ -0,0 +1,11 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = propsys.dll +IMPORTS = propsys + +C_SRCS = \ + propsys.c + +@MAKE_TEST_RULES@ diff --git a/dlls/propsys/tests/propsys.c b/dlls/propsys/tests/propsys.c new file mode 100644 index 0000000..cc5585b --- /dev/null +++ b/dlls/propsys/tests/propsys.c @@ -0,0 +1,140 @@ +/* + * Unit tests for Windows property system + * + * Copyright 2010 Andrew Nguyen + * + * 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 + */ + +#define COBJMACROS + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "propsys.h" +#include "initguid.h" +#include "wine/test.h" + +DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); + +static void test_PSStringFromPropertyKey(void) +{ + static const WCHAR fillerW[] = {'X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X', + 'X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X', + 'X','X','X','X','X','X','X','X','X','X'}; + static const WCHAR zero_fillerW[] = {'\0','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X', + 'X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X', + 'X','X','X','X','X','X','X','X','X','X','X','X','X','X'}; + static const WCHAR zero_truncatedW[] = {'\0','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0', + '0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0', + '0','0','0','}',' ','\0','9','X','X','X','X','X','X','X','X','X'}; + static const WCHAR zero_truncated2W[] = {'\0','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0', + '0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0', + '0','0','0','}',' ','\0','9','2','7','6','9','4','9','2','X','X'}; + static const WCHAR zero_truncated3W[] = {'\0','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0', + '0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0', + '0','0','0','}',' ','\0','9','2','7','6','9','4','9','2','4','X'}; + static const WCHAR zero_truncated4W[] = {'\0','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0', + '0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0', + '0','0','0','}',' ','\0','7','X','X','X','X','X','X','X','X','X'}; + static const WCHAR truncatedW[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0', + '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0', + '0','}',' ','\0','9','X','X','X','X','X','X','X','X','X'}; + static const WCHAR truncated2W[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0', + '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0', + '0','}',' ','\0','9','2','7','6','9','4','9','2','X','X'}; + static const WCHAR truncated3W[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0', + '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0', + '0','}',' ','\0','9','2','7','6','9','4','9','2','4','X'}; + static const WCHAR truncated4W[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0', + '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0', + '0','}',' ','\0','7','X','X','X','X','X','X','X','X','X'}; + static const WCHAR expectedW[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0', + '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0', + '0','}',' ','4','2','9','4','9','6','7','2','9','5',0}; + static const WCHAR expected2W[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0', + '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0', + '0','}',' ','1','3','5','7','9','\0','X','X','X','X','X'}; + static const WCHAR expected3W[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0', + '0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0', + '0','}',' ','0','\0','X','X','X','X','X','X','X','X','X'}; + PROPERTYKEY prop = {GUID_NULL, ~0U}; + PROPERTYKEY prop2 = {GUID_NULL, 13579}; + PROPERTYKEY prop3 = {GUID_NULL, 0}; + WCHAR out[PKEYSTR_MAX]; + HRESULT ret; + + const struct + { + REFPROPERTYKEY pkey; + LPWSTR psz; + UINT cch; + HRESULT hr_expect; + const WCHAR *buf_expect; + int hr_broken; + HRESULT hr2; + int buf_broken; + const WCHAR *buf2; + } testcases[] = + { + {NULL, NULL, 0, E_POINTER}, + {&prop, NULL, 0, E_POINTER}, + {&prop, NULL, PKEYSTR_MAX, E_POINTER}, + {NULL, out, 0, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), fillerW}, + {NULL, out, PKEYSTR_MAX, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), zero_fillerW, 0, 0, 1, fillerW}, + {&prop, out, 0, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), fillerW}, + {&prop, out, GUIDSTRING_MAX, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), fillerW}, + {&prop, out, GUIDSTRING_MAX + 1, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), fillerW}, + {&prop, out, GUIDSTRING_MAX + 2, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), zero_truncatedW, 1, S_OK, 1, truncatedW}, + {&prop, out, PKEYSTR_MAX - 2, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), zero_truncated2W, 1, S_OK, 1, truncated2W}, + {&prop, out, PKEYSTR_MAX - 1, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), zero_truncated3W, 1, S_OK, 1, truncated3W}, + {&prop, out, PKEYSTR_MAX, S_OK, expectedW}, + {&prop2, out, GUIDSTRING_MAX + 2, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), zero_truncated4W, 1, S_OK, 1, truncated4W}, + {&prop2, out, GUIDSTRING_MAX + 6, S_OK, expected2W}, + {&prop2, out, PKEYSTR_MAX, S_OK, expected2W}, + {&prop3, out, GUIDSTRING_MAX + 1, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), fillerW}, + {&prop3, out, GUIDSTRING_MAX + 2, S_OK, expected3W}, + {&prop3, out, PKEYSTR_MAX, S_OK, expected3W}, + }; + + int i; + + for (i = 0; i < sizeof(testcases)/sizeof(testcases[0]); i++) + { + if (testcases[i].psz) + memcpy(testcases[i].psz, fillerW, PKEYSTR_MAX * sizeof(WCHAR)); + + ret = PSStringFromPropertyKey(testcases[i].pkey, + testcases[i].psz, + testcases[i].cch); + ok(ret == testcases[i].hr_expect || + broken(testcases[i].hr_broken && ret == testcases[i].hr2), /* Vista/Win2k8 */ + "[%d] Expected PSStringFromPropertyKey to return 0x%08x, got 0x%08x\n", + i, testcases[i].hr_expect, ret); + + if (testcases[i].psz) + ok(!memcmp(testcases[i].psz, testcases[i].buf_expect, PKEYSTR_MAX * sizeof(WCHAR)) || + broken(testcases[i].buf_broken && + !memcmp(testcases[i].psz, testcases[i].buf2, PKEYSTR_MAX * sizeof(WCHAR))), /* Vista/Win2k8 */ + "[%d] Unexpected output contents\n", i); + } +} + +START_TEST(propsys) +{ + test_PSStringFromPropertyKey(); +}
1
0
0
0
Andrew Nguyen : propsys: Implement PSStringFromPropertyKey.
by Alexandre Julliard
26 Jul '10
26 Jul '10
Module: wine Branch: master Commit: c50177b1c1706fb6e9d03ee3f3cbcb93cf9813f5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c50177b1c1706fb6e9d03ee3f…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Sun Jul 25 21:57:37 2010 -0500 propsys: Implement PSStringFromPropertyKey. --- configure | 2 +- configure.ac | 2 +- dlls/propsys/Makefile.in | 1 + dlls/propsys/propsys.spec | 2 +- dlls/propsys/propsys_main.c | 69 +++++++++++++++++++++++++++++++++++++++++++ include/propsys.idl | 6 ++++ 6 files changed, 79 insertions(+), 3 deletions(-) diff --git a/configure b/configure index e6fa900..8f92437 100755 --- a/configure +++ b/configure @@ -14664,7 +14664,7 @@ wine_fn_config_test dlls/pdh/tests pdh_test wine_fn_config_dll pidgen enable_pidgen wine_fn_config_dll powrprof enable_powrprof powrprof wine_fn_config_dll printui enable_printui -wine_fn_config_dll propsys enable_propsys +wine_fn_config_dll propsys enable_propsys propsys wine_fn_config_dll psapi enable_psapi psapi wine_fn_config_test dlls/psapi/tests psapi_test wine_fn_config_dll pstorec enable_pstorec diff --git a/configure.ac b/configure.ac index 68c151f..0180928 100644 --- a/configure.ac +++ b/configure.ac @@ -2533,7 +2533,7 @@ WINE_CONFIG_TEST(dlls/pdh/tests) WINE_CONFIG_DLL(pidgen) WINE_CONFIG_DLL(powrprof,,[powrprof]) WINE_CONFIG_DLL(printui) -WINE_CONFIG_DLL(propsys) +WINE_CONFIG_DLL(propsys,,[propsys]) WINE_CONFIG_DLL(psapi,,[psapi]) WINE_CONFIG_TEST(dlls/psapi/tests) WINE_CONFIG_DLL(pstorec) diff --git a/dlls/propsys/Makefile.in b/dlls/propsys/Makefile.in index 4170751..e217ac4 100644 --- a/dlls/propsys/Makefile.in +++ b/dlls/propsys/Makefile.in @@ -3,6 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = propsys.dll +IMPORTLIB = propsys C_SRCS = \ propsys_main.c \ diff --git a/dlls/propsys/propsys.spec b/dlls/propsys/propsys.spec index 1848b47..cd41d90 100644 --- a/dlls/propsys/propsys.spec +++ b/dlls/propsys/propsys.spec @@ -91,7 +91,7 @@ @ stub PSRefreshPropertySchema @ stdcall PSRegisterPropertySchema(wstr) @ stub PSSetPropertyValue -@ stub PSStringFromPropertyKey +@ stdcall PSStringFromPropertyKey(ptr ptr long) @ stdcall PSUnregisterPropertySchema(wstr) @ stdcall PropVariantChangeType(ptr ptr long long) @ stub PropVariantCompareEx diff --git a/dlls/propsys/propsys_main.c b/dlls/propsys/propsys_main.c index cdda06d..cd180fe 100644 --- a/dlls/propsys/propsys_main.c +++ b/dlls/propsys/propsys_main.c @@ -24,7 +24,10 @@ #include "windef.h" #include "winbase.h" +#include "objbase.h" +#include "propsys.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(propsys); @@ -61,3 +64,69 @@ HRESULT WINAPI PSUnregisterPropertySchema(PCWSTR path) return E_NOTIMPL; } + +HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch) +{ + static const WCHAR guid_fmtW[] = {'{','%','0','8','X','-','%','0','4','X','-', + '%','0','4','X','-','%','0','2','X','%','0','2','X','-', + '%','0','2','X','%','0','2','X','%','0','2','X', + '%','0','2','X','%','0','2','X','%','0','2','X','}',0}; + static const WCHAR pid_fmtW[] = {'%','u',0}; + + WCHAR pidW[PKEY_PIDSTR_MAX + 1]; + LPWSTR p = psz; + int len; + + TRACE("(%p, %p, %u)\n", pkey, psz, cch); + + if (!psz) + return E_POINTER; + + /* GUIDSTRING_MAX accounts for null terminator, +1 for space character. */ + if (cch <= GUIDSTRING_MAX + 1) + return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + + if (!pkey) + { + psz[0] = '\0'; + return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + } + + sprintfW(psz, guid_fmtW, pkey->fmtid.Data1, pkey->fmtid.Data2, + pkey->fmtid.Data3, pkey->fmtid.Data4[0], pkey->fmtid.Data4[1], + pkey->fmtid.Data4[2], pkey->fmtid.Data4[3], pkey->fmtid.Data4[4], + pkey->fmtid.Data4[5], pkey->fmtid.Data4[6], pkey->fmtid.Data4[7]); + + /* Overwrite the null terminator with the space character. */ + p += GUIDSTRING_MAX - 1; + *p++ = ' '; + cch -= GUIDSTRING_MAX - 1 + 1; + + len = sprintfW(pidW, pid_fmtW, pkey->pid); + + if (cch >= len + 1) + { + strcpyW(p, pidW); + return S_OK; + } + else + { + WCHAR *ptr = pidW + len - 1; + + psz[0] = '\0'; + *p++ = '\0'; + cch--; + + /* Replicate a quirk of the native implementation where the contents + * of the property ID string are written backwards to the output + * buffer, skipping the rightmost digit. */ + if (cch) + { + ptr--; + while (cch--) + *p++ = *ptr--; + } + + return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + } +} diff --git a/include/propsys.idl b/include/propsys.idl index cc5770e..c098041 100644 --- a/include/propsys.idl +++ b/include/propsys.idl @@ -795,6 +795,12 @@ interface ICreateObject : IUnknown ); } +cpp_quote("#define PKEY_PIDSTR_MAX 10") +cpp_quote("#define GUIDSTRING_MAX 39") +cpp_quote("#define PKEYSTR_MAX (GUIDSTRING_MAX + 1 + PKEY_PIDSTR_MAX)") + +cpp_quote("HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY,LPWSTR,UINT);") + /* TODO: Add remainder of the C api here */ [
1
0
0
0
Andrew Talbot : advapi32: Constify some variables.
by Alexandre Julliard
26 Jul '10
26 Jul '10
Module: wine Branch: master Commit: 711409447229af71fbb4a03cbebda12e671cd91f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=711409447229af71fbb4a03cb…
Author: Andrew Talbot <andrew.talbot(a)talbotville.com> Date: Sun Jul 25 22:06:07 2010 +0100 advapi32: Constify some variables. --- dlls/advapi32/cred.c | 2 +- dlls/advapi32/security.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/advapi32/cred.c b/dlls/advapi32/cred.c index e4ea26c..03d7622 100644 --- a/dlls/advapi32/cred.c +++ b/dlls/advapi32/cred.c @@ -754,7 +754,7 @@ static BOOL credential_matches_filter(HKEY hkeyCred, LPCWSTR filter) static DWORD registry_enumerate_credentials(HKEY hkeyMgr, LPCWSTR filter, LPWSTR target_name, - DWORD target_name_len, BYTE key_data[KEY_SIZE], + DWORD target_name_len, const BYTE key_data[KEY_SIZE], PCREDENTIALW *credentials, char **buffer, DWORD *len, DWORD *count) { diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index d86bb1b..2338aca 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -2735,7 +2735,7 @@ static void split_domain_account( const LSA_UNICODE_STRING *str, LSA_UNICODE_STR } } -static BOOL match_domain( ULONG idx, LSA_UNICODE_STRING *domain ) +static BOOL match_domain( ULONG idx, const LSA_UNICODE_STRING *domain ) { ULONG len = strlenW( ACCOUNT_SIDS[idx].domain ); @@ -2745,7 +2745,7 @@ static BOOL match_domain( ULONG idx, LSA_UNICODE_STRING *domain ) return FALSE; } -static BOOL match_account( ULONG idx, LSA_UNICODE_STRING *account ) +static BOOL match_account( ULONG idx, const LSA_UNICODE_STRING *account ) { ULONG len = strlenW( ACCOUNT_SIDS[idx].account );
1
0
0
0
Max TenEyck Woodbury : ntdll: Setting FileAllInformation is not allowed.
by Alexandre Julliard
26 Jul '10
26 Jul '10
Module: wine Branch: master Commit: a17c7f0bd016f73989d92ad007c5dce0a156b14b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a17c7f0bd016f73989d92ad00…
Author: Max TenEyck Woodbury <max(a)mtew.isa-geek.net> Date: Sun Jul 25 16:13:37 2010 -0400 ntdll: Setting FileAllInformation is not allowed. --- dlls/ntdll/file.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 0a6ee55..3dc5358 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -2148,6 +2148,10 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io, io->u.Status = STATUS_INVALID_PARAMETER_3; break; + case FileAllInformation: + io->u.Status = STATUS_INVALID_INFO_CLASS; + break; + default: FIXME("Unsupported class (%d)\n", class); io->u.Status = STATUS_NOT_IMPLEMENTED;
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
90
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Results per page:
10
25
50
100
200