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 2014
----- 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
18 participants
373 discussions
Start a n
N
ew thread
[akhaldi] 65235: [SHELL32] * Another partial sync of pidl.c and pidl.h with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Nov 3 20:15:17 2014 New Revision: 65235 URL:
http://svn.reactos.org/svn/reactos?rev=65235&view=rev
Log: [SHELL32] * Another partial sync of pidl.c and pidl.h with Wine 1.7.27. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/wine/pidl.c branches/shell-experiments/dll/win32/shell32/wine/pidl.h Modified: branches/shell-experiments/dll/win32/shell32/wine/pidl.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/pidl.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/pidl.c [iso-8859-1] Mon Nov 3 20:15:17 2014 @@ -37,6 +37,7 @@ #include <shlwapi.h> #include <shlguid_undoc.h> #include <wine/debug.h> +#include <wine/unicode.h> #include "pidl.h" #include "shell32_main.h" @@ -69,7 +70,7 @@ * RETURNS * True if the display name could be retrieved successfully, False otherwise */ -static BOOL ILGetDisplayNameExA(IShellFolder * psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type) +static BOOL ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type) { BOOL ret = FALSE; WCHAR wPath[MAX_PATH]; @@ -86,7 +87,7 @@ return ret; } -BOOL WINAPI ILGetDisplayNameExW(IShellFolder * psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type) +BOOL ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type) { LPSHELLFOLDER psfParent, lsf = psf; HRESULT ret = NO_ERROR; @@ -94,7 +95,7 @@ STRRET strret; DWORD flag; - TRACE("%p %p %p %d\n", psf, pidl, path, type); + TRACE("%p %p %p %x\n", psf, pidl, path, type); if (!pidl || !path) return FALSE; @@ -156,13 +157,13 @@ /************************************************************************* * ILGetDisplayNameEx [SHELL32.186] */ -BOOL WINAPI ILGetDisplayNameEx(IShellFolder * psf, LPCITEMIDLIST pidl, LPVOID path, DWORD type) +BOOL WINAPI ILGetDisplayNameEx(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPVOID path, DWORD type) { TRACE_(shell)("%p %p %p %d\n", psf, pidl, path, type); if (SHELL_OsIsUnicode()) - return ILGetDisplayNameExW(psf, pidl, (LPWSTR)path, type); - return ILGetDisplayNameExA(psf, pidl, (LPSTR)path, type); + return ILGetDisplayNameExW(psf, pidl, path, type); + return ILGetDisplayNameExA(psf, pidl, path, type); } /************************************************************************* @@ -173,8 +174,8 @@ TRACE_(shell)("%p %p\n", pidl, path); if (SHELL_OsIsUnicode()) - return ILGetDisplayNameExW(NULL, pidl, (LPWSTR)path, ILGDN_FORPARSING); - return ILGetDisplayNameExA(NULL, pidl, (LPSTR)path, ILGDN_FORPARSING); + return ILGetDisplayNameExW(NULL, pidl, path, ILGDN_FORPARSING); + return ILGetDisplayNameExA(NULL, pidl, path, ILGDN_FORPARSING); } /************************************************************************* @@ -211,9 +212,9 @@ TRACE_(shell)("pidl=%p\n",pidl); if (!pidl || !pidl->mkid.cb) - return 0; + return FALSE; ILFindLastID(pidl)->mkid.cb = 0; - return 1; + return TRUE; } /************************************************************************* @@ -231,7 +232,7 @@ return NULL; len = ILGetSize(pidl); - newpidl = (LPITEMIDLIST)SHAlloc(len); + newpidl = SHAlloc(len); if (newpidl) memcpy(newpidl,pidl,len); @@ -258,7 +259,7 @@ if (pidl) { len = pidl->mkid.cb; - pidlNew = (LPITEMIDLIST)SHAlloc(len + 2); + pidlNew = SHAlloc(len+2); if (pidlNew) { memcpy(pidlNew,pidl,len+2); /* 2 -> mind a desktop pidl */ @@ -395,15 +396,18 @@ TRACE_(shell)("%s %p 0x%08x\n", debugstr_w(path), ppidl, attributes ? *attributes : 0); if (SUCCEEDED (SHGetDesktopFolder(&sf))) + { ret = IShellFolder_ParseDisplayName(sf, 0, NULL, (LPWSTR)path, &pchEaten, ppidl, attributes); + IShellFolder_Release(sf); + } return ret; } -EXTERN_C HRESULT WINAPI SHILCreateFromPathAW (LPCVOID path, LPITEMIDLIST * ppidl, DWORD * attributes) +HRESULT WINAPI SHILCreateFromPathAW (LPCVOID path, LPITEMIDLIST * ppidl, DWORD * attributes) { if ( SHELL_OsIsUnicode()) - return SHILCreateFromPathW ((LPCWSTR)path, ppidl, attributes); - return SHILCreateFromPathA ((LPCSTR)path, ppidl, attributes); + return SHILCreateFromPathW (path, ppidl, attributes); + return SHILCreateFromPathA (path, ppidl, attributes); } /************************************************************************* @@ -460,7 +464,7 @@ return NULL; len = ILGetSize(pidl); - newpidl = (LPITEMIDLIST)Alloc(len); + newpidl = Alloc(len); if (newpidl) memcpy(newpidl,pidl,len); @@ -502,7 +506,7 @@ _ILSimpleGetText(pidltemp1, szData1, MAX_PATH); _ILSimpleGetText(pidltemp2, szData2, MAX_PATH); - if (strcmp( szData1, szData2 )) + if (strcasecmp( szData1, szData2 )) return FALSE; pidltemp1 = ILGetNext(pidltemp1); @@ -554,7 +558,7 @@ _ILSimpleGetText(pParent, szData1, MAX_PATH); _ILSimpleGetText(pChild, szData2, MAX_PATH); - if (strcmp( szData1, szData2 )) + if (strcasecmp( szData1, szData2 )) return FALSE; pParent = ILGetNext(pParent); @@ -621,7 +625,7 @@ _ILSimpleGetText(pidltemp1, szData1, MAX_PATH); _ILSimpleGetText(pidltemp2, szData2, MAX_PATH); - if (strcmp(szData1, szData2)) + if (strcasecmp(szData1,szData2)) break; pidltemp1 = ILGetNext(pidltemp1); @@ -681,7 +685,7 @@ len1 = ILGetSize(pidl1)-2; len2 = ILGetSize(pidl2); - pidlNew = (LPITEMIDLIST)SHAlloc(len1 + len2); + pidlNew = SHAlloc(len1+len2); if (pidlNew) { @@ -698,7 +702,7 @@ * * NOTES */ -HRESULT WINAPI SHGetRealIDL(IShellFolder * lpsf, LPCITEMIDLIST pidlSimple, LPITEMIDLIST *pidlReal) +HRESULT WINAPI SHGetRealIDL(LPSHELLFOLDER lpsf, LPCITEMIDLIST pidlSimple, LPITEMIDLIST *pidlReal) { IDataObject* pDataObj; HRESULT hr; @@ -710,7 +714,7 @@ STGMEDIUM medium; FORMATETC fmt; - fmt.cfFormat = RegisterClipboardFormatW(CFSTR_SHELLIDLIST); + fmt.cfFormat = RegisterClipboardFormatW(CFSTR_SHELLIDLISTW); fmt.ptd = NULL; fmt.dwAspect = DVASPECT_CONTENT; fmt.lindex = -1; @@ -718,10 +722,12 @@ hr = IDataObject_GetData(pDataObj, &fmt, &medium); + IDataObject_Release(pDataObj); + if (SUCCEEDED(hr)) { /*assert(pida->cidl==1);*/ - LPIDA pida = (LPIDA)GlobalLock(medium.u.hGlobal); + LPIDA pida = GlobalLock(medium.u.hGlobal); LPCITEMIDLIST pidl_folder = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]); LPCITEMIDLIST pidl_child = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[1]); @@ -746,7 +752,7 @@ * pild = CSIDL_DESKTOP ret = 0 * pild = CSIDL_DRIVES ret = 0 */ -EXTERN_C LPITEMIDLIST WINAPI SHLogILFromFSIL(LPITEMIDLIST pidl) +LPITEMIDLIST WINAPI SHLogILFromFSIL(LPITEMIDLIST pidl) { FIXME("(pidl=%p)\n",pidl); @@ -839,7 +845,7 @@ * NOTES * Destroys the passed in idlist! (???) */ -EXTERN_C LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl, LPCITEMIDLIST item, BOOL bEnd) +LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl, LPCITEMIDLIST item, BOOL bEnd) { LPITEMIDLIST idlRet; @@ -949,11 +955,11 @@ /************************************************************************* * ILCreateFromPath [SHELL32.157] */ -EXTERN_C LPITEMIDLIST WINAPI ILCreateFromPathAW (LPCVOID path) +LPITEMIDLIST WINAPI ILCreateFromPathAW (LPCVOID path) { if ( SHELL_OsIsUnicode()) - return ILCreateFromPathW ((LPCWSTR)path); - return ILCreateFromPathA ((LPCSTR)path); + return ILCreateFromPathW (path); + return ILCreateFromPathA (path); } /************************************************************************* @@ -1006,6 +1012,14 @@ ret = IShellFolder_ParseDisplayName(pSF, 0, pBC, (LPOLESTR)path, NULL, ppidl, prgfInOut); } + if (pBC) + { + IBindCtx_Release(pBC); + pBC = NULL; + } + + IShellFolder_Release(pSF); + if (FAILED(ret) && ppidl) *ppidl = NULL; @@ -1045,7 +1059,7 @@ if (lpszPath) { len = MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, NULL, 0); - wPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + wPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, wPath, len); } @@ -1067,11 +1081,11 @@ return pidl; } -EXTERN_C LPITEMIDLIST WINAPI SHSimpleIDListFromPathAW(LPCVOID lpszPath) +LPITEMIDLIST WINAPI SHSimpleIDListFromPathAW(LPCVOID lpszPath) { if ( SHELL_OsIsUnicode()) - return SHSimpleIDListFromPathW ((LPCWSTR)lpszPath); - return SHSimpleIDListFromPathA ((LPCSTR)lpszPath); + return SHSimpleIDListFromPathW (lpszPath); + return SHSimpleIDListFromPathA (lpszPath); } /************************************************************************* @@ -1139,7 +1153,7 @@ * SHGetDataFromIDListW [SHELL32.248] * */ -HRESULT WINAPI SHGetDataFromIDListW(IShellFolder * psf, LPCITEMIDLIST pidl, +HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len) { LPSTR filename, shortname; @@ -1252,10 +1266,12 @@ if (FAILED(hr) || !(dwAttributes & SFGAO_FILESYSTEM)) { WARN("Wrong dwAttributes or GetAttributesOf failed: %x\n", hr); + IShellFolder_Release(psfFolder); return FALSE; } hr = IShellFolder_GetDisplayNameOf(psfFolder, pidlLast, SHGDN_FORPARSING, &strret); + IShellFolder_Release(psfFolder); if (FAILED(hr)) return FALSE; hr = StrRetToBufW(&strret, pidlLast, pszPath, MAX_PATH); @@ -1299,6 +1315,8 @@ SHFree (pidlParent); } + IShellFolder_Release(psfDesktop); + if (SUCCEEDED(hr) && ppidlLast) *ppidlLast = ILFindLastID(pidl); @@ -1325,7 +1343,7 @@ { LPITEMIDLIST pidlOut = NULL; - pidlOut = (LPITEMIDLIST)SHAlloc(size + 5); + pidlOut = SHAlloc(size + 5); if(pidlOut) { LPPIDLDATA pData; @@ -1352,7 +1370,7 @@ LPITEMIDLIST ret; TRACE("()\n"); - ret = (LPITEMIDLIST)SHAlloc(2); + ret = SHAlloc(2); if (ret) ret->mkid.cb = 0; return ret; @@ -1472,7 +1490,7 @@ { IID iid; - if (FAILED(CLSIDFromString((LPOLESTR)szGUID, &iid))) + if (FAILED(SHCLSIDFromStringW(szGUID, &iid))) { ERR("%s is not a GUID\n", debugstr_w(szGUID)); return NULL; @@ -1483,7 +1501,7 @@ LPITEMIDLIST _ILCreateFromFindDataW( const WIN32_FIND_DATAW *wfd ) { char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */ - DWORD len, len1, wlen, alen, cbData; + DWORD len, len1, wlen, alen; LPITEMIDLIST pidl; PIDLTYPE type; @@ -1499,11 +1517,9 @@ type = (wfd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? PT_FOLDER : PT_VALUE; - wlen = wcslen(wfd->cFileName) + 1; - cbData = sizeof(FileStruct) - 1 + (alen + (alen & 1)); // Note: szNames field is initially 1 byte long - cbData += sizeof(FileStructW) - 1 + wlen * sizeof(WCHAR); // Note: wszName field is initially 1 byte long - cbData += sizeof(WORD); // offset to FileStructW - pidl = _ILAlloc(type, cbData); + wlen = lstrlenW(wfd->cFileName) + 1; + pidl = _ILAlloc(type, FIELD_OFFSET(FileStruct, szNames[alen + (alen & 1)]) + + FIELD_OFFSET(FileStructW, wszName[wlen]) + sizeof(WORD)); if (pidl) { LPPIDLDATA pData = _ILGetDataPointer(pidl); @@ -1517,7 +1533,7 @@ memcpy(fs->szNames, buff, alen); fsw = (FileStructW*)(pData->u.file.szNames + alen + (alen & 0x1)); - fsw->cbLen = sizeof(FileStructW) - 1 + wlen * sizeof(WCHAR) + sizeof(WORD); + fsw->cbLen = FIELD_OFFSET(FileStructW, wszName[wlen]) + sizeof(WORD); FileTimeToDosDateTime( &wfd->ftCreationTime, &fsw->uCreationDate, &fsw->uCreationTime); FileTimeToDosDateTime( &wfd->ftLastAccessTime, &fsw->uLastAccessDate, &fsw->uLastAccessTime); memcpy(fsw->wszName, wfd->cFileName, wlen * sizeof(WCHAR)); @@ -1564,7 +1580,7 @@ if (pszDest) { strcpy(pszDest, "x:\\"); - pszDest[0] = towupper(lpszNew[0]); + pszDest[0]=toupperW(lpszNew[0]); TRACE("-- create Drive: %s\n", debugstr_a(pszDest)); } } @@ -1668,7 +1684,7 @@ BOOL _ILIsMyComputer(LPCITEMIDLIST pidl) { - IID *iid = _ILGetGUIDPointer(pidl); + REFIID iid = _ILGetGUIDPointer(pidl); TRACE("(%p)\n",pidl); @@ -1874,7 +1890,7 @@ if (pFileStructW) { lstrcpynW(szOut, pFileStructW->wszName, uOutSize); - dwReturn = wcslen(pFileStructW->wszName); + dwReturn = lstrlenW(pFileStructW->wszName); } else { GUID const * riid; WCHAR szTemp[MAX_PATH]; @@ -1896,7 +1912,7 @@ if (szOut) lstrcpynW(szOut, szTemp, uOutSize); - dwReturn = wcslen (szTemp); + dwReturn = lstrlenW (szTemp); } } else if (( szSrcW = _ILGetTextPointerW(pidl) )) @@ -1905,7 +1921,7 @@ if (szOut) lstrcpynW(szOut, szSrcW, uOutSize); - dwReturn = wcslen(szSrcW); + dwReturn = lstrlenW(szSrcW); } else if (( szSrc = _ILGetTextPointer(pidl) )) { @@ -1915,7 +1931,7 @@ if (szOut) lstrcpynW(szOut, szTemp, uOutSize); - dwReturn = wcslen (szTemp); + dwReturn = lstrlenW (szTemp); } else if (( riid = _ILGetGUIDPointer(pidl) )) { @@ -1925,7 +1941,7 @@ if (szOut) lstrcpynW(szOut, szTemp, uOutSize); - dwReturn = wcslen (szTemp); + dwReturn = lstrlenW (szTemp); } } else @@ -2129,14 +2145,14 @@ /* Currently I don't see a fool prove way to figure out if a pidl is for sure of WinXP * style with a FileStructW member. If we switch all our shellfolder-implementations to * the new format, this won't be a problem. For now, we do as many sanity checks as possible. */ - if (cbOffset & 0x1 || /* FileStructW member is word aligned in the pidl */ + if ((cbOffset & 0x1) || /* FileStructW member is word aligned in the pidl */ /* FileStructW is positioned after FileStruct */ cbOffset < sizeof(pidl->mkid.cb) + sizeof(PIDLTYPE) + sizeof(FileStruct) || /* There has to be enough space at cbOffset in the pidl to hold FileStructW and cbOffset */ cbOffset > pidl->mkid.cb - sizeof(cbOffset) - sizeof(FileStructW) || pidl->mkid.cb != cbOffset + pFileStructW->cbLen) { - ERR("Invalid pidl format (cbOffset = %d)!\n", cbOffset); + WARN("Invalid pidl format (cbOffset = %d)!\n", cbOffset); return NULL; } @@ -2407,10 +2423,11 @@ UINT i; LPITEMIDLIST *apidldest; - apidldest = (LPITEMIDLIST *)SHAlloc(cidl * sizeof(LPITEMIDLIST)); if (!apidlsrc) return NULL; + apidldest = SHAlloc(cidl * sizeof(LPITEMIDLIST)); + for (i = 0; i < cidl; i++) apidldest[i] = ILClone(apidlsrc[i]); @@ -2427,7 +2444,7 @@ UINT i; LPITEMIDLIST *dst; - dst = (LPITEMIDLIST *)SHAlloc(cida->cidl * sizeof(LPITEMIDLIST)); + dst = SHAlloc(cida->cidl * sizeof(LPITEMIDLIST)); if (!dst) return NULL; Modified: branches/shell-experiments/dll/win32/shell32/wine/pidl.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/pidl.h [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/pidl.h [iso-8859-1] Mon Nov 3 20:15:17 2014 @@ -94,13 +94,13 @@ #define PT_FOLDER 0x31 #define PT_VALUE 0x32 #define PT_VALUEW 0x34 +#define PT_FOLDERW 0x35 #define PT_WORKGRP 0x41 #define PT_COMP 0x42 #define PT_NETPROVIDER 0x46 #define PT_NETWORK 0x47 #define PT_IESPECIAL1 0x61 #define PT_YAGUID 0x70 /* yet another guid.. */ -#define PT_CPEXT 0x71 #define PT_IESPECIAL2 0xb1 #define PT_SHARE 0xc3 @@ -116,6 +116,8 @@ CHAR szName[1]; /*10*/ /* terminated by 0x00, followed by display name and comment string */ } PIDLCPanelStruct; +#ifdef __REACTOS__ + typedef struct tagPIDLFontStruct { BYTE dummy; @@ -140,6 +142,8 @@ DWORD Attributes; WCHAR szName[1]; } PIDLRecycleStruct; + +#endif /* !__REACTOS__ */ typedef struct tagGUIDStruct { @@ -202,9 +206,11 @@ } htmlhelp; struct tagPIDLCPanelStruct cpanel; struct tagValueW valueW; - struct tagPIDLFontStruct cfont; - struct tagPIDLPrinterStruct cprinter; - struct tagPIDLRecycleStruct crecycle; +#ifdef __REACTOS__ + struct tagPIDLFontStruct cfont; + struct tagPIDLPrinterStruct cprinter; + struct tagPIDLRecycleStruct crecycle; +#endif }u; } PIDLDATA, *LPPIDLDATA; #include "poppack.h" @@ -212,42 +218,44 @@ /* * getting special values from simple pidls */ -DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); -DWORD _ILSimpleGetTextW (LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize); -BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); -DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); -BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); -void _ILGetFileType (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); -DWORD _ILGetFileAttributes (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); - -BOOL _ILGetFileDateTime (LPCITEMIDLIST pidl, FILETIME *ft); -DWORD _ILGetDrive (LPCITEMIDLIST, LPSTR, UINT); +DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN; +DWORD _ILSimpleGetTextW (LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN; +BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN; +DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN; +BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN; +void _ILGetFileType (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN; +DWORD _ILGetFileAttributes (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) DECLSPEC_HIDDEN; + +BOOL _ILGetFileDateTime (LPCITEMIDLIST pidl, FILETIME *ft) DECLSPEC_HIDDEN; +DWORD _ILGetDrive (LPCITEMIDLIST, LPSTR, UINT) DECLSPEC_HIDDEN; /* * testing simple pidls */ -BOOL _ILIsUnicode (LPCITEMIDLIST pidl); -BOOL _ILIsDesktop (LPCITEMIDLIST pidl); -BOOL _ILIsMyComputer (LPCITEMIDLIST pidl); -BOOL _ILIsPrinter (LPCITEMIDLIST pidl); -BOOL _ILIsMyDocuments (LPCITEMIDLIST pidl); -BOOL _ILIsControlPanel (LPCITEMIDLIST pidl); -BOOL _ILIsBitBucket (LPCITEMIDLIST pidl); -BOOL _ILIsAdminTools (LPCITEMIDLIST pidl); -BOOL _ILIsNetHood (LPCITEMIDLIST pidl); -BOOL _ILIsDrive (LPCITEMIDLIST pidl); -BOOL _ILIsFolder (LPCITEMIDLIST pidl); -BOOL _ILIsValue (LPCITEMIDLIST pidl); -BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl); -BOOL _ILIsPidlSimple (LPCITEMIDLIST pidl); -BOOL _ILIsCPanelStruct (LPCITEMIDLIST pidl); -static __inline +BOOL _ILIsUnicode (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +BOOL _ILIsDesktop (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +BOOL _ILIsMyComputer (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +#ifdef __REACTOS__ +BOOL _ILIsPrinter (LPCITEMIDLIST pidl); +BOOL _ILIsMyDocuments (LPCITEMIDLIST pidl); +BOOL _ILIsControlPanel (LPCITEMIDLIST pidl); +BOOL _ILIsBitBucket (LPCITEMIDLIST pidl); +BOOL _ILIsAdminTools (LPCITEMIDLIST pidl); +BOOL _ILIsNetHood (LPCITEMIDLIST pidl); +#endif +BOOL _ILIsDrive (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +BOOL _ILIsFolder (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +BOOL _ILIsValue (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +BOOL _ILIsPidlSimple (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +BOOL _ILIsCPanelStruct (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +static inline BOOL _ILIsEqualSimple (LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB) { return (pidlA->mkid.cb > 0 && !memcmp(pidlA, pidlB, pidlA->mkid.cb)) || (!pidlA->mkid.cb && !pidlB->mkid.cb); } -static __inline +static inline BOOL _ILIsEmpty (LPCITEMIDLIST pidl) { return _ILIsDesktop(pidl); } /* @@ -257,52 +265,55 @@ /* Creates a PIDL with guid format and type type, which must be one of PT_GUID, * PT_SHELLEXT, or PT_YAGUID. */ -LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid); +LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid) DECLSPEC_HIDDEN; /* Like _ILCreateGuid, but using the string szGUID. */ -LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID); -LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID); +LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID) DECLSPEC_HIDDEN; +LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID) DECLSPEC_HIDDEN; /* Commonly used PIDLs representing file system objects. */ -LPITEMIDLIST _ILCreateDesktop (void); -LPITEMIDLIST _ILCreateFromFindDataW(const WIN32_FIND_DATAW *stffile); -HRESULT _ILCreateFromPathW (LPCWSTR szPath, LPITEMIDLIST* ppidl); +LPITEMIDLIST _ILCreateDesktop (void) DECLSPEC_HIDDEN; +LPITEMIDLIST _ILCreateFromFindDataW(const WIN32_FIND_DATAW *stffile) DECLSPEC_HIDDEN; +HRESULT _ILCreateFromPathW (LPCWSTR szPath, LPITEMIDLIST* ppidl) DECLSPEC_HIDDEN; /* Other helpers */ -LPITEMIDLIST _ILCreateMyComputer (void); -LPITEMIDLIST _ILCreateMyDocuments (void); -LPITEMIDLIST _ILCreateIExplore (void); -LPITEMIDLIST _ILCreateControlPanel (void); -LPITEMIDLIST _ILCreatePrinters (void); -LPITEMIDLIST _ILCreateNetwork (void); -LPITEMIDLIST _ILCreateNetHood (void); -LPITEMIDLIST _ILCreateAdminTools (void); -LPITEMIDLIST _ILCreateFont (void); -LPITEMIDLIST _ILCreateBitBucket (void); -LPITEMIDLIST _ILCreateDrive (LPCWSTR); +LPITEMIDLIST _ILCreateMyComputer (void) DECLSPEC_HIDDEN; +LPITEMIDLIST _ILCreateMyDocuments (void) DECLSPEC_HIDDEN; +LPITEMIDLIST _ILCreateIExplore (void) DECLSPEC_HIDDEN; +LPITEMIDLIST _ILCreateControlPanel (void) DECLSPEC_HIDDEN; +LPITEMIDLIST _ILCreatePrinters (void) DECLSPEC_HIDDEN; +LPITEMIDLIST _ILCreateNetwork (void) DECLSPEC_HIDDEN; +LPITEMIDLIST _ILCreateNetHood (void) DECLSPEC_HIDDEN; +#ifdef __REACTOS__ +LPITEMIDLIST _ILCreateAdminTools (void); +LPITEMIDLIST _ILCreateFont (void); +#endif +LPITEMIDLIST _ILCreateBitBucket (void) DECLSPEC_HIDDEN; +LPITEMIDLIST _ILCreateDrive (LPCWSTR) DECLSPEC_HIDDEN; +LPITEMIDLIST _ILCreateEntireNetwork (void) DECLSPEC_HIDDEN; /* * helper functions (getting struct-pointer) */ -LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST); -LPSTR _ILGetTextPointer (LPCITEMIDLIST); -IID *_ILGetGUIDPointer (LPCITEMIDLIST pidl); -FileStructW *_ILGetFileStructW (LPCITEMIDLIST pidl); +LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST) DECLSPEC_HIDDEN; +LPSTR _ILGetTextPointer (LPCITEMIDLIST) DECLSPEC_HIDDEN; +IID *_ILGetGUIDPointer (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +FileStructW *_ILGetFileStructW (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; /* * debug helper */ -void pdump (LPCITEMIDLIST pidl); -BOOL pcheck (LPCITEMIDLIST pidl); +void pdump (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; +BOOL pcheck (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN; /* * aPidl helper */ -void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl); -LPITEMIDLIST * _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl); -LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, const CIDA * cida); - -BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type); +void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl) DECLSPEC_HIDDEN; +LPITEMIDLIST * _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl) DECLSPEC_HIDDEN; +LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, const CIDA * cida) DECLSPEC_HIDDEN; + +BOOL ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type) DECLSPEC_HIDDEN; #ifdef __cplusplus } /* extern "C" */
10 years, 1 month
1
0
0
0
[akhaldi] 65234: [SHELL32] * Partial sync of pidl.c and pidl.h with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Nov 3 19:58:55 2014 New Revision: 65234 URL:
http://svn.reactos.org/svn/reactos?rev=65234&view=rev
Log: [SHELL32] * Partial sync of pidl.c and pidl.h with Wine 1.7.27. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/wine/pidl.c branches/shell-experiments/dll/win32/shell32/wine/pidl.h Modified: branches/shell-experiments/dll/win32/shell32/wine/pidl.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/pidl.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/pidl.c [iso-8859-1] Mon Nov 3 19:58:55 2014 @@ -53,7 +53,7 @@ static LPWSTR _ILGetTextPointerW(LPCITEMIDLIST pidl); /************************************************************************* - * ILGetDisplayNameExA [SHELL32.186] + * ILGetDisplayNameExA * * Retrieves the display name of an ItemIDList * @@ -187,7 +187,7 @@ { LPCITEMIDLIST pidlLast = pidl; - TRACE("(pidl=%p)\n", pidl); + TRACE("(pidl=%p)\n",pidl); if (!pidl) return NULL; @@ -208,7 +208,7 @@ */ BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl) { - TRACE_(shell)("pidl=%p\n", pidl); + TRACE_(shell)("pidl=%p\n",pidl); if (!pidl || !pidl->mkid.cb) return 0; @@ -233,9 +233,9 @@ len = ILGetSize(pidl); newpidl = (LPITEMIDLIST)SHAlloc(len); if (newpidl) - memcpy(newpidl, pidl, len); - - TRACE("pidl=%p newpidl=%p\n", pidl, newpidl); + memcpy(newpidl,pidl,len); + + TRACE("pidl=%p newpidl=%p\n",pidl, newpidl); pdump(pidl); return newpidl; @@ -261,13 +261,13 @@ pidlNew = (LPITEMIDLIST)SHAlloc(len + 2); if (pidlNew) { - memcpy(pidlNew, pidl, len + 2); /* 2 -> mind a desktop pidl */ + memcpy(pidlNew,pidl,len+2); /* 2 -> mind a desktop pidl */ if (len) ILGetNext(pidlNew)->mkid.cb = 0x00; } } - TRACE("-- newpidl=%p\n", pidlNew); + TRACE("-- newpidl=%p\n",pidlNew); return pidlNew; } @@ -462,9 +462,9 @@ len = ILGetSize(pidl); newpidl = (LPITEMIDLIST)Alloc(len); if (newpidl) - memcpy(newpidl, pidl, len); - - TRACE("pidl=%p newpidl=%p\n", pidl, newpidl); + memcpy(newpidl,pidl,len); + + TRACE("pidl=%p newpidl=%p\n",pidl, newpidl); pdump(pidl); return newpidl; @@ -482,7 +482,7 @@ LPCITEMIDLIST pidltemp1 = pidl1; LPCITEMIDLIST pidltemp2 = pidl2; - TRACE("pidl1=%p pidl2=%p\n", pidl1, pidl2); + TRACE("pidl1=%p pidl2=%p\n",pidl1, pidl2); /* * Explorer reads from registry directly (StreamMRU), @@ -534,6 +534,8 @@ * parent = a/b, child = a/b/c -> true, c is in folder a/b * child = a/b/c/d -> false if bImmediate is true, d is not in folder a/b * child = a/b/c/d -> true if bImmediate is false, d is in a subfolder of a/b + * child = a/b -> false if bImmediate is true + * child = a/b -> true if bImmediate is false */ BOOL WINAPI ILIsParent(LPCITEMIDLIST pidlParent, LPCITEMIDLIST pidlChild, BOOL bImmediate) { @@ -559,7 +561,7 @@ pChild = ILGetNext(pChild); } - /* child shorter or has equal length to parent */ + /* child has shorter name than parent */ if (pParent->mkid.cb || !pChild->mkid.cb) return FALSE; @@ -596,9 +598,9 @@ LPCITEMIDLIST pidltemp1 = pidl1; LPCITEMIDLIST pidltemp2 = pidl2; - LPCITEMIDLIST ret = NULL; - - TRACE("pidl1=%p pidl2=%p\n", pidl1, pidl2); + LPCITEMIDLIST ret=NULL; + + TRACE("pidl1=%p pidl2=%p\n",pidl1, pidl2); /* explorer reads from registry directly (StreamMRU), so we can only check here */ @@ -655,10 +657,10 @@ */ LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) { - DWORD len1, len2; + DWORD len1,len2; LPITEMIDLIST pidlNew; - TRACE("pidl=%p pidl=%p\n", pidl1, pidl2); + TRACE("pidl=%p pidl=%p\n",pidl1,pidl2); if (!pidl1 && !pidl2) return NULL; @@ -677,14 +679,14 @@ return pidlNew; } - len1 = ILGetSize(pidl1) - 2; + len1 = ILGetSize(pidl1)-2; len2 = ILGetSize(pidl2); pidlNew = (LPITEMIDLIST)SHAlloc(len1 + len2); if (pidlNew) { - memcpy(pidlNew, pidl1, len1); - memcpy(((BYTE *)pidlNew) + len1, pidl2, len2); + memcpy(pidlNew,pidl1,len1); + memcpy(((BYTE *)pidlNew)+len1,pidl2,len2); } /* TRACE(pidl,"--new pidl=%p\n",pidlNew);*/ @@ -721,8 +723,8 @@ /*assert(pida->cidl==1);*/ LPIDA pida = (LPIDA)GlobalLock(medium.u.hGlobal); - LPCITEMIDLIST pidl_folder = (LPCITEMIDLIST) ((LPBYTE)pida + pida->aoffset[0]); - LPCITEMIDLIST pidl_child = (LPCITEMIDLIST) ((LPBYTE)pida + pida->aoffset[1]); + LPCITEMIDLIST pidl_folder = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]); + LPCITEMIDLIST pidl_child = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[1]); *pidlReal = ILCombine(pidl_folder, pidl_child); @@ -746,7 +748,7 @@ */ EXTERN_C LPITEMIDLIST WINAPI SHLogILFromFSIL(LPITEMIDLIST pidl) { - FIXME("(pidl=%p)\n", pidl); + FIXME("(pidl=%p)\n",pidl); pdump(pidl); @@ -770,7 +772,7 @@ UINT WINAPI ILGetSize(LPCITEMIDLIST pidl) { LPCSHITEMID si; - UINT len = 0; + UINT len=0; if (pidl) { @@ -779,11 +781,11 @@ while (si->cb) { len += si->cb; - si = (LPCSHITEMID)(((const BYTE*)si) + si->cb); + si = (LPCSHITEMID)(((const BYTE*)si)+si->cb); } len += 2; } - TRACE("pidl=%p size=%u\n", pidl, len); + TRACE("pidl=%p size=%u\n",pidl, len); return len; } @@ -814,7 +816,7 @@ len = pidl->mkid.cb; if (len) { - pidl = (LPCITEMIDLIST) (((const BYTE*)pidl) + len); + pidl = (LPCITEMIDLIST) (((const BYTE*)pidl)+len); TRACE("-- %p\n", pidl); return (LPITEMIDLIST)pidl; } @@ -878,7 +880,7 @@ */ void WINAPI ILFree(LPITEMIDLIST pidl) { - TRACE("(pidl=%p)\n", pidl); + TRACE("(pidl=%p)\n",pidl); SHFree(pidl); } @@ -989,8 +991,8 @@ HRESULT ret; TRACE("%s %p %d (%p)->%p (%p)->0x%x\n", debugstr_w(path), lpFindFile, bBindCtx, - ppidl, ppidl ? *ppidl : NULL, - prgfInOut, prgfInOut ? *prgfInOut : 0); + ppidl, ppidl ? *ppidl : NULL, + prgfInOut, prgfInOut ? *prgfInOut : 0); ret = SHGetDesktopFolder(&pSF); if (FAILED(ret)) @@ -1085,7 +1087,7 @@ LPSTR filename, shortname; WIN32_FIND_DATAA * pfd; - TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n", psf, pidl, nFormat, dest, len); + TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len); pdump(pidl); if (!psf || !dest) @@ -1093,41 +1095,41 @@ switch (nFormat) { - case SHGDFIL_FINDDATA: + case SHGDFIL_FINDDATA: pfd = (WIN32_FIND_DATAA *)dest; - if (_ILIsDrive(pidl) || _ILIsSpecialFolder(pidl)) - return E_INVALIDARG; + if (_ILIsDrive(pidl) || _ILIsSpecialFolder(pidl)) + return E_INVALIDARG; if (len < (int)sizeof(WIN32_FIND_DATAA)) - return E_INVALIDARG; - - ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA)); - _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); - pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); - pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0); - - filename = _ILGetTextPointer(pidl); - shortname = _ILGetSTextPointer(pidl); - - if (filename) - lstrcpynA(pfd->cFileName, filename, sizeof(pfd->cFileName)); - else - pfd->cFileName[0] = '\0'; - - if (shortname) - lstrcpynA(pfd->cAlternateFileName, shortname, sizeof(pfd->cAlternateFileName)); - else - pfd->cAlternateFileName[0] = '\0'; - return S_OK; - - case SHGDFIL_NETRESOURCE: - case SHGDFIL_DESCRIPTIONID: - FIXME_(shell)("SHGDFIL %i stub\n", nFormat); - break; - - default: - ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat); + return E_INVALIDARG; + + ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA)); + _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); + pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); + pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0); + + filename = _ILGetTextPointer(pidl); + shortname = _ILGetSTextPointer(pidl); + + if (filename) + lstrcpynA(pfd->cFileName, filename, sizeof(pfd->cFileName)); + else + pfd->cFileName[0] = '\0'; + + if (shortname) + lstrcpynA(pfd->cAlternateFileName, shortname, sizeof(pfd->cAlternateFileName)); + else + pfd->cAlternateFileName[0] = '\0'; + return S_OK; + + case SHGDFIL_NETRESOURCE: + case SHGDFIL_DESCRIPTIONID: + FIXME_(shell)("SHGDFIL %i stub\n", nFormat); + break; + + default: + ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat); } return E_INVALIDARG; @@ -1143,7 +1145,7 @@ LPSTR filename, shortname; WIN32_FIND_DATAW * pfd = (WIN32_FIND_DATAW *)dest; - TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n", psf, pidl, nFormat, dest, len); + TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len); pdump(pidl); @@ -1152,41 +1154,41 @@ switch (nFormat) { - case SHGDFIL_FINDDATA: + case SHGDFIL_FINDDATA: pfd = (WIN32_FIND_DATAW *)dest; - if (_ILIsDrive(pidl)) - return E_INVALIDARG; + if (_ILIsDrive(pidl)) + return E_INVALIDARG; if (len < (int)sizeof(WIN32_FIND_DATAW)) - return E_INVALIDARG; - - ZeroMemory(pfd, sizeof (WIN32_FIND_DATAW)); - _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); - pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); - pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0); - - filename = _ILGetTextPointer(pidl); - shortname = _ILGetSTextPointer(pidl); - - if (!filename) - pfd->cFileName[0] = '\0'; - else if (!MultiByteToWideChar(CP_ACP, 0, filename, -1, pfd->cFileName, MAX_PATH)) - pfd->cFileName[MAX_PATH-1] = 0; - - if (!shortname) - pfd->cAlternateFileName[0] = '\0'; - else if (!MultiByteToWideChar(CP_ACP, 0, shortname, -1, pfd->cAlternateFileName, 14)) - pfd->cAlternateFileName[13] = 0; - return S_OK; - - case SHGDFIL_NETRESOURCE: - case SHGDFIL_DESCRIPTIONID: - FIXME_(shell)("SHGDFIL %i stub\n", nFormat); - break; - - default: - ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat); + return E_INVALIDARG; + + ZeroMemory(pfd, sizeof (WIN32_FIND_DATAW)); + _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); + pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); + pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0); + + filename = _ILGetTextPointer(pidl); + shortname = _ILGetSTextPointer(pidl); + + if (!filename) + pfd->cFileName[0] = '\0'; + else if (!MultiByteToWideChar(CP_ACP, 0, filename, -1, pfd->cFileName, MAX_PATH)) + pfd->cFileName[MAX_PATH-1] = 0; + + if (!shortname) + pfd->cAlternateFileName[0] = '\0'; + else if (!MultiByteToWideChar(CP_ACP, 0, shortname, -1, pfd->cAlternateFileName, 14)) + pfd->cAlternateFileName[13] = 0; + return S_OK; + + case SHGDFIL_NETRESOURCE: + case SHGDFIL_DESCRIPTIONID: + FIXME_(shell)("SHGDFIL %i stub\n", nFormat); + break; + + default: + ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat); } return E_INVALIDARG; @@ -1252,13 +1254,13 @@ WARN("Wrong dwAttributes or GetAttributesOf failed: %x\n", hr); return FALSE; } - + hr = IShellFolder_GetDisplayNameOf(psfFolder, pidlLast, SHGDN_FORPARSING, &strret); if (FAILED(hr)) return FALSE; hr = StrRetToBufW(&strret, pidlLast, pszPath, MAX_PATH); - TRACE_(shell)("-- %s, 0x%08x\n", debugstr_w(pszPath), hr); + TRACE_(shell)("-- %s, 0x%08x\n",debugstr_w(pszPath), hr); return SUCCEEDED(hr); } @@ -1272,10 +1274,10 @@ TRACE_(shell)("pidl=%p\n", pidl); pdump(pidl); - + if (!pidl || !ppv) return E_INVALIDARG; - + *ppv = NULL; if (ppidlLast) *ppidlLast = NULL; @@ -1300,7 +1302,7 @@ if (SUCCEEDED(hr) && ppidlLast) *ppidlLast = ILFindLastID(pidl); - TRACE_(shell)("-- psf=%p pidl=%p ret=0x%08x\n", *ppv, (ppidlLast) ? *ppidlLast : NULL, hr); + TRACE_(shell)("-- psf=%p pidl=%p ret=0x%08x\n", *ppv, (ppidlLast)?*ppidlLast:NULL, hr); return hr; } @@ -1480,7 +1482,7 @@ LPITEMIDLIST _ILCreateFromFindDataW( const WIN32_FIND_DATAW *wfd ) { - char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */ + char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */ DWORD len, len1, wlen, alen, cbData; LPITEMIDLIST pidl; PIDLTYPE type; @@ -1488,11 +1490,11 @@ if (!wfd) return NULL; - TRACE("(%s, %s)\n", debugstr_w(wfd->cAlternateFileName), debugstr_w(wfd->cFileName)); + TRACE("(%s, %s)\n",debugstr_w(wfd->cAlternateFileName), debugstr_w(wfd->cFileName)); /* prepare buffer with both names */ - len = WideCharToMultiByte(CP_ACP, 0, wfd->cFileName, -1, buff, MAX_PATH, NULL, NULL); - len1 = WideCharToMultiByte(CP_ACP, 0, wfd->cAlternateFileName, -1, buff + len, sizeof(buff) - len, NULL, NULL); + len = WideCharToMultiByte(CP_ACP,0,wfd->cFileName,-1,buff,MAX_PATH,NULL,NULL); + len1 = WideCharToMultiByte(CP_ACP,0,wfd->cAlternateFileName,-1, buff+len, sizeof(buff)-len, NULL, NULL); alen = len + len1; type = (wfd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? PT_FOLDER : PT_VALUE; @@ -1522,7 +1524,7 @@ pOffsetW = (WORD*)((LPBYTE)pidl + pidl->mkid.cb - sizeof(WORD)); *pOffsetW = (LPBYTE)fsw - (LPBYTE)pidl; - TRACE("-- Set Value: %s\n", debugstr_w(fsw->wszName)); + TRACE("-- Set Value: %s\n",debugstr_w(fsw->wszName)); } return pidl; @@ -1551,7 +1553,7 @@ { LPITEMIDLIST pidlOut; - TRACE("(%s)\n", debugstr_w(lpszNew)); + TRACE("(%s)\n",debugstr_w(lpszNew)); pidlOut = _ILAlloc(PT_DRIVE, sizeof(DriveStruct)); if (pidlOut) @@ -1577,9 +1579,9 @@ * RETURNS * strlen (lpszText) */ -DWORD _ILGetDrive(LPCITEMIDLIST pidl, LPSTR pOut, UINT uSize) -{ - TRACE("(%p,%p,%u)\n", pidl, pOut, uSize); +DWORD _ILGetDrive(LPCITEMIDLIST pidl,LPSTR pOut, UINT uSize) +{ + TRACE("(%p,%p,%u)\n",pidl,pOut,uSize); if(_ILIsMyComputer(pidl)) pidl = ILGetNext(pidl); @@ -1608,14 +1610,14 @@ { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - TRACE("(%p)\n", pidl); + TRACE("(%p)\n",pidl); return (pidl && lpPData && PT_VALUEW == lpPData->type); } BOOL _ILIsDesktop(LPCITEMIDLIST pidl) { - TRACE("(%p)\n", pidl); + TRACE("(%p)\n",pidl); return pidl && pidl->mkid.cb ? 0 : 1; } @@ -1668,7 +1670,7 @@ { IID *iid = _ILGetGUIDPointer(pidl); - TRACE("(%p)\n", pidl); + TRACE("(%p)\n",pidl); if (iid) return IsEqualIID(iid, &CLSID_MyComputer); @@ -1713,30 +1715,30 @@ { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - TRACE("(%p)\n", pidl); - - return (pidl && ( (lpPData && (PT_GUID == lpPData->type || PT_SHELLEXT == lpPData->type || PT_YAGUID == lpPData->type)) || - (pidl && pidl->mkid.cb == 0x00) - )); + TRACE("(%p)\n",pidl); + + return (pidl && ( (lpPData && (PT_GUID== lpPData->type || PT_SHELLEXT== lpPData->type || PT_YAGUID == lpPData->type)) || + (pidl && pidl->mkid.cb == 0x00) + )); } BOOL _ILIsDrive(LPCITEMIDLIST pidl) { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - TRACE("(%p)\n", pidl); + TRACE("(%p)\n",pidl); return (pidl && lpPData && (PT_DRIVE == lpPData->type || - PT_DRIVE1 == lpPData->type || - PT_DRIVE2 == lpPData->type || - PT_DRIVE3 == lpPData->type)); + PT_DRIVE1 == lpPData->type || + PT_DRIVE2 == lpPData->type || + PT_DRIVE3 == lpPData->type)); } BOOL _ILIsFolder(LPCITEMIDLIST pidl) { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - TRACE("(%p)\n", pidl); + TRACE("(%p)\n",pidl); return (pidl && lpPData && (PT_FOLDER == lpPData->type || PT_FOLDER1 == lpPData->type)); } @@ -1745,7 +1747,7 @@ { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - TRACE("(%p)\n", pidl); + TRACE("(%p)\n",pidl); return (pidl && lpPData && PT_VALUE == lpPData->type); } @@ -1754,7 +1756,7 @@ { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - TRACE("(%p)\n", pidl); + TRACE("(%p)\n",pidl); return (pidl && lpPData && (lpPData->type == 0)); } @@ -1784,22 +1786,22 @@ * ### 3. section getting values from pidls ### */ -/************************************************************************** -* _ILSimpleGetText -* -* gets the text for the first item in the pidl (eg. simple pidl) -* -* returns the length of the string -*/ + /************************************************************************** + * _ILSimpleGetText + * + * gets the text for the first item in the pidl (eg. simple pidl) + * + * returns the length of the string + */ DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize) { - DWORD dwReturn = 0; + DWORD dwReturn=0; LPSTR szSrc; LPWSTR szSrcW; GUID const * riid; char szTemp[MAX_PATH]; - TRACE("(%p %p %x)\n", pidl, szOut, uOutSize); + TRACE("(%p %p %x)\n",pidl,szOut,uOutSize); if (!pidl) return 0; @@ -1829,7 +1831,7 @@ else if (( szSrcW = _ILGetTextPointerW(pidl) )) { /* unicode filesystem */ - WideCharToMultiByte(CP_ACP, 0, szSrcW, -1, szTemp, MAX_PATH, NULL, NULL); + WideCharToMultiByte(CP_ACP,0,szSrcW, -1, szTemp, MAX_PATH, NULL, NULL); if (szOut) lstrcpynA(szOut, szTemp, uOutSize); @@ -1839,7 +1841,7 @@ else if (( riid = _ILGetGUIDPointer(pidl) )) { /* special folder */ - if (HCR_GetClassNameA(riid, szTemp, MAX_PATH) ) + if ( HCR_GetClassNameA(riid, szTemp, MAX_PATH) ) { if (szOut) lstrcpynA(szOut, szTemp, uOutSize); @@ -1852,23 +1854,23 @@ ERR("-- no text\n"); } - TRACE("-- (%p=%s 0x%08x)\n", szOut, debugstr_a(szOut), dwReturn); + TRACE("-- (%p=%s 0x%08x)\n",szOut,debugstr_a(szOut),dwReturn); return dwReturn; } -/************************************************************************** -* _ILSimpleGetTextW -* -* gets the text for the first item in the pidl (eg. simple pidl) -* -* returns the length of the string -*/ + /************************************************************************** + * _ILSimpleGetTextW + * + * gets the text for the first item in the pidl (eg. simple pidl) + * + * returns the length of the string + */ DWORD _ILSimpleGetTextW (LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize) { DWORD dwReturn; FileStructW *pFileStructW = _ILGetFileStructW(pidl); - TRACE("(%p %p %x)\n", pidl, szOut, uOutSize); + TRACE("(%p %p %x)\n",pidl,szOut,uOutSize); if (pFileStructW) { lstrcpynW(szOut, pFileStructW->wszName, uOutSize); @@ -1878,7 +1880,7 @@ WCHAR szTemp[MAX_PATH]; LPSTR szSrc; LPWSTR szSrcW; - dwReturn = 0; + dwReturn=0; if (!pidl) return 0; @@ -1932,7 +1934,7 @@ } } - TRACE("-- (%p=%s 0x%08x)\n", szOut, debugstr_w(szOut), dwReturn); + TRACE("-- (%p=%s 0x%08x)\n",szOut,debugstr_w(szOut),dwReturn); return dwReturn; } @@ -1965,36 +1967,36 @@ switch (pdata->type) { - case PT_GUID: - case PT_SHELLEXT: - case PT_YAGUID: - return NULL; - - case PT_DRIVE: - case PT_DRIVE1: - case PT_DRIVE2: - case PT_DRIVE3: - /*return (LPSTR)&(pdata->u.drive.szDriveName);*/ - return NULL; - - case PT_FOLDER: - case PT_FOLDER1: - case PT_VALUE: - case PT_IESPECIAL1: - case PT_IESPECIAL2: - /*return (LPSTR)&(pdata->u.file.szNames);*/ - return NULL; - - case PT_WORKGRP: - case PT_COMP: - case PT_NETWORK: - case PT_NETPROVIDER: - case PT_SHARE: - /*return (LPSTR)&(pdata->u.network.szNames);*/ - return NULL; - - case PT_VALUEW: - return (LPWSTR)pdata->u.file.szNames; + case PT_GUID: + case PT_SHELLEXT: + case PT_YAGUID: + return NULL; + + case PT_DRIVE: + case PT_DRIVE1: + case PT_DRIVE2: + case PT_DRIVE3: + /*return (LPSTR)&(pdata->u.drive.szDriveName);*/ + return NULL; + + case PT_FOLDER: + case PT_FOLDER1: + case PT_VALUE: + case PT_IESPECIAL1: + case PT_IESPECIAL2: + /*return (LPSTR)&(pdata->u.file.szNames);*/ + return NULL; + + case PT_WORKGRP: + case PT_COMP: + case PT_NETWORK: + case PT_NETPROVIDER: + case PT_SHARE: + /*return (LPSTR)&(pdata->u.network.szNames);*/ + return NULL; + + case PT_VALUEW: + return (LPWSTR)pdata->u.file.szNames; } return NULL; } @@ -2015,30 +2017,30 @@ switch (pdata->type) { - case PT_GUID: - case PT_SHELLEXT: - case PT_YAGUID: - return NULL; - - case PT_DRIVE: - case PT_DRIVE1: - case PT_DRIVE2: - case PT_DRIVE3: - return pdata->u.drive.szDriveName; - - case PT_FOLDER: - case PT_FOLDER1: - case PT_VALUE: - case PT_IESPECIAL1: - case PT_IESPECIAL2: - return pdata->u.file.szNames; - - case PT_WORKGRP: - case PT_COMP: - case PT_NETWORK: - case PT_NETPROVIDER: - case PT_SHARE: - return pdata->u.network.szNames; + case PT_GUID: + case PT_SHELLEXT: + case PT_YAGUID: + return NULL; + + case PT_DRIVE: + case PT_DRIVE1: + case PT_DRIVE2: + case PT_DRIVE3: + return pdata->u.drive.szDriveName; + + case PT_FOLDER: + case PT_FOLDER1: + case PT_VALUE: + case PT_IESPECIAL1: + case PT_IESPECIAL2: + return pdata->u.file.szNames; + + case PT_WORKGRP: + case PT_COMP: + case PT_NETWORK: + case PT_NETPROVIDER: + case PT_SHARE: + return pdata->u.network.szNames; case PT_CPLAPPLET: return pdata->u.cpanel.szName; @@ -2054,21 +2056,21 @@ { /* TRACE(pidl,"(pidl%p)\n", pidl); */ - LPPIDLDATA pdata = _ILGetDataPointer(pidl); + LPPIDLDATA pdata =_ILGetDataPointer(pidl); if (!pdata) return NULL; switch (pdata->type) { - case PT_FOLDER: - case PT_VALUE: - case PT_IESPECIAL1: - case PT_IESPECIAL2: - return pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1; - - case PT_WORKGRP: - return pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1; + case PT_FOLDER: + case PT_VALUE: + case PT_IESPECIAL1: + case PT_IESPECIAL2: + return pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1; + + case PT_WORKGRP: + return pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1; } return NULL; } @@ -2080,7 +2082,7 @@ */ IID* _ILGetGUIDPointer(LPCITEMIDLIST pidl) { - LPPIDLDATA pdata = _ILGetDataPointer(pidl); + LPPIDLDATA pdata =_ILGetDataPointer(pidl); TRACE("%p\n", pidl); @@ -2090,14 +2092,14 @@ TRACE("pdata->type 0x%04x\n", pdata->type); switch (pdata->type) { - case PT_SHELLEXT: - case PT_GUID: - case PT_YAGUID: - return &(pdata->u.guid.guid); - - default: - TRACE("Unknown pidl type 0x%04x\n", pdata->type); - break; + case PT_SHELLEXT: + case PT_GUID: + case PT_YAGUID: + return &(pdata->u.guid.guid); + + default: + TRACE("Unknown pidl type 0x%04x\n", pdata->type); + break; } return NULL; } @@ -2117,7 +2119,7 @@ FileStructW* _ILGetFileStructW(LPCITEMIDLIST pidl) { FileStructW *pFileStructW; WORD cbOffset; - + if (!(_ILIsValue(pidl) || _ILIsFolder(pidl))) return NULL; @@ -2128,11 +2130,11 @@ * style with a FileStructW member. If we switch all our shellfolder-implementations to * the new format, this won't be a problem. For now, we do as many sanity checks as possible. */ if (cbOffset & 0x1 || /* FileStructW member is word aligned in the pidl */ - /* FileStructW is positioned after FileStruct */ - cbOffset < sizeof(pidl->mkid.cb) + sizeof(PIDLTYPE) + sizeof(FileStruct) || - /* There has to be enough space at cbOffset in the pidl to hold FileStructW and cbOffset */ - cbOffset > pidl->mkid.cb - sizeof(cbOffset) - sizeof(FileStructW) || - pidl->mkid.cb != cbOffset + pFileStructW->cbLen) + /* FileStructW is positioned after FileStruct */ + cbOffset < sizeof(pidl->mkid.cb) + sizeof(PIDLTYPE) + sizeof(FileStruct) || + /* There has to be enough space at cbOffset in the pidl to hold FileStructW and cbOffset */ + cbOffset > pidl->mkid.cb - sizeof(cbOffset) - sizeof(FileStructW) || + pidl->mkid.cb != cbOffset + pFileStructW->cbLen) { ERR("Invalid pidl format (cbOffset = %d)!\n", cbOffset); return NULL; @@ -2165,19 +2167,19 @@ switch (pdata->type) { - case PT_FOLDER: - case PT_VALUE: - DosDateTimeToFileTime(pdata->u.file.uFileDate, pdata->u.file.uFileTime, pFt); - break; - default: - return FALSE; + case PT_FOLDER: + case PT_VALUE: + DosDateTimeToFileTime(pdata->u.file.uFileDate, pdata->u.file.uFileTime, pFt); + break; + default: + return FALSE; } return TRUE; } BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) { - FILETIME ft, lft; + FILETIME ft,lft; SYSTEMTIME time; BOOL ret; @@ -2186,8 +2188,8 @@ FileTimeToLocalFileTime(&ft, &lft); FileTimeToSystemTime (&lft, &time); - ret = GetDateFormatA(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, pOut, uOutSize); - if (ret) + ret = GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&time, NULL, pOut, uOutSize); + if (ret) { /* Append space + time without seconds */ pOut[ret-1] = ' '; @@ -2229,11 +2231,11 @@ switch (pdata->type) { - case PT_VALUE: - dwSize = pdata->u.file.dwFileSize; - if (pOut) - StrFormatKBSizeA(dwSize, pOut, uOutSize); - return dwSize; + case PT_VALUE: + dwSize = pdata->u.file.dwFileSize; + if (pOut) + StrFormatKBSizeA(dwSize, pOut, uOutSize); + return dwSize; } if (pOut) *pOut = 0x00; @@ -2244,9 +2246,9 @@ { char szTemp[MAX_PATH]; const char * pPoint; - LPCITEMIDLIST pidlTemp = pidl; - - TRACE("pidl=%p\n", pidl); + LPCITEMIDLIST pidlTemp=pidl; + + TRACE("pidl=%p\n",pidl); if (!pidl) return FALSE; @@ -2265,7 +2267,7 @@ pPoint++; lstrcpynA(pOut, pPoint, uOutSize); - TRACE("%s\n", pOut); + TRACE("%s\n",pOut); return TRUE; } @@ -2354,15 +2356,15 @@ switch(pData->type) { - case PT_FOLDER: - case PT_VALUE: - wAttrib = pData->u.file.uFileAttribs; - break; + case PT_FOLDER: + case PT_VALUE: + wAttrib = pData->u.file.uFileAttribs; + break; } if(uOutSize >= 6) { - i = 0; + i=0; if(wAttrib & FILE_ATTRIBUTE_READONLY) pOut[i++] = 'R'; if(wAttrib & FILE_ATTRIBUTE_HIDDEN) @@ -2381,7 +2383,7 @@ /************************************************************************* * ILFreeaPidl * - * free a aPidl struct + * frees an aPidl struct */ void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl) { Modified: branches/shell-experiments/dll/win32/shell32/wine/pidl.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/pidl.h [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/pidl.h [iso-8859-1] Mon Nov 3 19:58:55 2014 @@ -20,10 +20,9 @@ * * NOTES: * - * DO NOT use this definitions outside the shell32.dll ! - * - * The contents of a pidl should never used from a application - * directly. + * DO NOT use these definitions outside the shell32.dll! + * + * The contents of a pidl should never be used directly from an application. * * Undocumented: * MS says: the abID of SHITEMID should be treated as binary data and not @@ -48,73 +47,73 @@ * The structure of the pidl seems to be a union. The first byte of the * PIDLDATA describes the type of pidl. * -* object ! first byte / ! format ! living space -* ! size -* ---------------------------------------------------------------- -* my computer 0x1F/20 guid (2) (usual) -* network 0x1F guid -* bitbucket 0x1F guid -* drive 0x23/25 drive (usual) -* drive 0x25/25 drive (lnk/persistent) -* drive 0x29/25 drive -* shell extension 0x2E guid -* drive 0x2F drive (lnk/persistent) -* folder/file 0x30 folder/file (1) (lnk/persistent) -* folder 0x31 folder (usual) -* valueA 0x32 file (ANSI file name) -* valueW 0x34 file (Unicode file name) -* workgroup 0x41 network (3) -* computer 0x42 network (4) -* net provider 0x46 network -* whole network 0x47 network (5) -* MSITStore 0x61 htmlhlp (7) -* printers/ras connections 0x70 guid -* history/favorites 0xb1 file -* share 0xc3 network (6) +* object ! first byte / ! format ! living space +* ! size +* ---------------------------------------------------------------- +* my computer 0x1F/20 guid (2) (usual) +* network 0x1F guid +* bitbucket 0x1F guid +* drive 0x23/25 drive (usual) +* drive 0x25/25 drive (lnk/persistent) +* drive 0x29/25 drive +* shell extension 0x2E guid +* drive 0x2F drive (lnk/persistent) +* folder/file 0x30 folder/file (1) (lnk/persistent) +* folder 0x31 folder (usual) +* valueA 0x32 file (ANSI file name) +* valueW 0x34 file (Unicode file name) +* workgroup 0x41 network (3) +* computer 0x42 network (4) +* net provider 0x46 network +* whole network 0x47 network (5) +* MSITStore 0x61 htmlhlp (7) +* printers/ras connections 0x70 guid +* history/favorites 0xb1 file +* share 0xc3 network (6) * * guess: the persistent elements are non tracking * * (1) dummy byte is used, attributes are empty * (2) IID_MyComputer = 20D04FE0L-3AEA-1069-A2D8-08002B30309D -* (3) two strings "workgroup" "Microsoft Network" -* (4) two strings "\\sirius" "Microsoft Network" -* (5) one string "Entire Network" -* (6) two strings "\\sirius\c" "Microsoft Network" +* (3) two strings "workgroup" "Microsoft Network" +* (4) two strings "\\sirius" "Microsoft Network" +* (5) one string "Entire Network" +* (6) two strings "\\sirius\c" "Microsoft Network" * (7) contains string "mk:@MSITStore:C:\path\file.chm::/path/filename.htm" -* GUID 871C5380-42A0-1069-A2EA-08002B30309D +* GUID 871C5380-42A0-1069-A2EA-08002B30309D */ -#define PT_CPLAPPLET 0x00 -#define PT_GUID 0x1F -#define PT_DRIVE 0x23 -#define PT_DRIVE2 0x25 -#define PT_DRIVE3 0x29 -#define PT_SHELLEXT 0x2E -#define PT_DRIVE1 0x2F -#define PT_FOLDER1 0x30 -#define PT_FOLDER 0x31 -#define PT_VALUE 0x32 -#define PT_VALUEW 0x34 -#define PT_WORKGRP 0x41 -#define PT_COMP 0x42 -#define PT_NETPROVIDER 0x46 -#define PT_NETWORK 0x47 -#define PT_IESPECIAL1 0x61 -#define PT_YAGUID 0x70 /* yet another guid.. */ +#define PT_CPLAPPLET 0x00 +#define PT_GUID 0x1F +#define PT_DRIVE 0x23 +#define PT_DRIVE2 0x25 +#define PT_DRIVE3 0x29 +#define PT_SHELLEXT 0x2E +#define PT_DRIVE1 0x2F +#define PT_FOLDER1 0x30 +#define PT_FOLDER 0x31 +#define PT_VALUE 0x32 +#define PT_VALUEW 0x34 +#define PT_WORKGRP 0x41 +#define PT_COMP 0x42 +#define PT_NETPROVIDER 0x46 +#define PT_NETWORK 0x47 +#define PT_IESPECIAL1 0x61 +#define PT_YAGUID 0x70 /* yet another guid.. */ #define PT_CPEXT 0x71 -#define PT_IESPECIAL2 0xb1 -#define PT_SHARE 0xc3 +#define PT_IESPECIAL2 0xb1 +#define PT_SHARE 0xc3 #include "pshpack1.h" typedef BYTE PIDLTYPE; typedef struct tagPIDLCPanelStruct -{ - BYTE dummy; /*01 is 0x00 */ - DWORD iconIdx; /*02 negative icon ID */ - WORD offsDispName; /*06*/ - WORD offsComment; /*08*/ - CHAR szName[1]; /*10*/ /* terminated by 0x00, followed by display name and comment string */ +{ + BYTE dummy; /*01 is 0x00 */ + DWORD iconIdx; /*02 negative icon ID */ + WORD offsDispName; /*06*/ + WORD offsComment; /*08*/ + CHAR szName[1]; /*10*/ /* terminated by 0x00, followed by display name and comment string */ } PIDLCPanelStruct; typedef struct tagPIDLFontStruct @@ -150,24 +149,24 @@ typedef struct tagDriveStruct { - CHAR szDriveName[20]; /*01*/ - WORD unknown; /*21*/ + CHAR szDriveName[20]; /*01*/ + WORD unknown; /*21*/ } DriveStruct; typedef struct tagFileStruct { - BYTE dummy; /*01 is 0x00 for files or dirs */ - DWORD dwFileSize; /*02*/ - WORD uFileDate; /*06*/ - WORD uFileTime; /*08*/ - WORD uFileAttribs; /*10*/ - CHAR szNames[1]; /*12*/ + BYTE dummy; /*01 is 0x00 for files or dirs */ + DWORD dwFileSize; /*02*/ + WORD uFileDate; /*06*/ + WORD uFileTime; /*08*/ + WORD uFileAttribs; /*10*/ + CHAR szNames[1]; /*12*/ /* Here are coming two strings. The first is the long name. The second the dos name when needed or just 0x00 */ } FileStruct; -/* At least on WinXP, this struct is appended with 2-byte-alignment to FileStruct. There follows - * a WORD member after the wszName string, which gives the offset from the beginning of the PIDL +/* At least on WinXP, this struct is appended with 2-byte-alignment to FileStruct. There follows + * a WORD member after the wszName string, which gives the offset from the beginning of the PIDL * to the FileStructW member. */ typedef struct tagFileStructW { WORD cbLen; @@ -186,27 +185,27 @@ } ValueWStruct; typedef struct tagPIDLDATA -{ PIDLTYPE type; /*00*/ - union - { - struct tagGUIDStruct guid; - struct tagDriveStruct drive; - struct tagFileStruct file; - struct - { WORD dummy; /*01*/ - CHAR szNames[1]; /*03*/ - } network; - struct - { WORD dummy; /*01*/ - DWORD dummy1; /*02*/ - CHAR szName[1]; /*06*/ /* terminated by 0x00 0x00 */ - } htmlhelp; - struct tagPIDLCPanelStruct cpanel; - struct tagValueW valueW; +{ PIDLTYPE type; /*00*/ + union + { + struct tagGUIDStruct guid; + struct tagDriveStruct drive; + struct tagFileStruct file; + struct + { WORD dummy; /*01*/ + CHAR szNames[1]; /*03*/ + } network; + struct + { WORD dummy; /*01*/ + DWORD dummy1; /*02*/ + CHAR szName[1]; /*06*/ /* terminated by 0x00 0x00 */ + } htmlhelp; + struct tagPIDLCPanelStruct cpanel; + struct tagValueW valueW; struct tagPIDLFontStruct cfont; struct tagPIDLPrinterStruct cprinter; struct tagPIDLRecycleStruct crecycle; - } u; + }u; } PIDLDATA, *LPPIDLDATA; #include "poppack.h"
10 years, 1 month
1
0
0
0
[akhaldi] 65233: [SHELL32] * Move pidl.cpp and pidl.h to the wine folder. * Convert pidl.cpp into pidl.c. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Nov 3 19:50:36 2014 New Revision: 65233 URL:
http://svn.reactos.org/svn/reactos?rev=65233&view=rev
Log: [SHELL32] * Move pidl.cpp and pidl.h to the wine folder. * Convert pidl.cpp into pidl.c. CORE-8540 Added: branches/shell-experiments/dll/win32/shell32/wine/pidl.c - copied, changed from r65228, branches/shell-experiments/dll/win32/shell32/pidl.cpp branches/shell-experiments/dll/win32/shell32/wine/pidl.h - copied unchanged from r65228, branches/shell-experiments/dll/win32/shell32/pidl.h Removed: branches/shell-experiments/dll/win32/shell32/pidl.cpp branches/shell-experiments/dll/win32/shell32/pidl.h Modified: branches/shell-experiments/dll/win32/shell32/CMakeLists.txt branches/shell-experiments/dll/win32/shell32/precomp.h Modified: branches/shell-experiments/dll/win32/shell32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/CMakeLists.txt [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/CMakeLists.txt [iso-8859-1] Mon Nov 3 19:50:36 2014 @@ -39,7 +39,6 @@ extracticon.cpp folders.cpp iconcache.cpp - pidl.cpp shell32.cpp shellitem.cpp shelllink.cpp @@ -71,6 +70,7 @@ add_library(shell32 SHARED ${SOURCE} wine/control.c + wine/pidl.c wine/shell32_main.c wine/shellole.c wine/shellord.c Removed: branches/shell-experiments/dll/win32/shell32/pidl.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/pidl.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/pidl.cpp (removed) @@ -1,2421 +0,0 @@ -/* - * pidl Handling - * - * Copyright 1998 Juergen Schmied - * - * 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 - * - * NOTES - * a pidl == NULL means desktop and is legal - * - */ - -#include "precomp.h" - -WINE_DEFAULT_DEBUG_CHANNEL(pidl); -WINE_DECLARE_DEBUG_CHANNEL(shell); - -/* from comctl32.dll */ -EXTERN_C LPVOID WINAPI Alloc(INT); -EXTERN_C BOOL WINAPI Free(LPVOID); - -static LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl); -static LPWSTR _ILGetTextPointerW(LPCITEMIDLIST pidl); - -/************************************************************************* - * ILGetDisplayNameExA [SHELL32.186] - * - * Retrieves the display name of an ItemIDList - * - * PARAMS - * psf [I] Shell Folder to start with, if NULL the desktop is used - * pidl [I] ItemIDList relative to the psf to get the display name for - * path [O] Filled in with the display name, assumed to be at least MAX_PATH long - * type [I] Type of display name to retrieve - * 0 = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR uses always the desktop as root - * 1 = SHGDN_NORMAL relative to the root folder - * 2 = SHGDN_INFOLDER relative to the root folder, only the last name - * - * RETURNS - * True if the display name could be retrieved successfully, False otherwise - */ -static BOOL ILGetDisplayNameExA(IShellFolder * psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type) -{ - BOOL ret = FALSE; - WCHAR wPath[MAX_PATH]; - - TRACE("%p %p %p %d\n", psf, pidl, path, type); - - if (!pidl || !path) - return FALSE; - - ret = ILGetDisplayNameExW(psf, pidl, wPath, type); - WideCharToMultiByte(CP_ACP, 0, wPath, -1, path, MAX_PATH, NULL, NULL); - TRACE("%p %p %s\n", psf, pidl, debugstr_a(path)); - - return ret; -} - -BOOL WINAPI ILGetDisplayNameExW(IShellFolder * psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type) -{ - CComPtr<IShellFolder> psfParent; - CComPtr<IShellFolder> lsf = psf; - HRESULT ret = NO_ERROR; - LPCITEMIDLIST pidllast; - STRRET strret; - DWORD flag; - - TRACE("%p %p %p %d\n", psf, pidl, path, type); - - if (!pidl || !path) - return FALSE; - - if (!lsf) - { - ret = SHGetDesktopFolder(&lsf); - if (FAILED(ret)) - return FALSE; - } - - if (type <= 2) - { - switch (type) - { - case ILGDN_FORPARSING: - flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR; - break; - case ILGDN_NORMAL: - flag = SHGDN_NORMAL; - break; - case ILGDN_INFOLDER: - flag = SHGDN_INFOLDER; - break; - default: - FIXME("Unknown type parameter = %x\n", type); - flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR; - break; - } - if (!*(const WORD*)pidl || type == ILGDN_FORPARSING) - { - ret = lsf->GetDisplayNameOf(pidl, flag, &strret); - if (SUCCEEDED(ret)) - { - if(!StrRetToStrNW(path, MAX_PATH, &strret, pidl)) - ret = E_FAIL; - } - } - else - { - ret = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psfParent), &pidllast); - if (SUCCEEDED(ret)) - { - ret = psfParent->GetDisplayNameOf(pidllast, flag, &strret); - if (SUCCEEDED(ret)) - { - if(!StrRetToStrNW(path, MAX_PATH, &strret, pidllast)) - ret = E_FAIL; - } - } - } - } - - TRACE("%p %p %s\n", psf, pidl, debugstr_w(path)); - - return SUCCEEDED(ret); -} - -/************************************************************************* - * ILGetDisplayNameEx [SHELL32.186] - */ -BOOL WINAPI ILGetDisplayNameEx(IShellFolder * psf, LPCITEMIDLIST pidl, LPVOID path, DWORD type) -{ - TRACE_(shell)("%p %p %p %d\n", psf, pidl, path, type); - - if (SHELL_OsIsUnicode()) - return ILGetDisplayNameExW(psf, pidl, (LPWSTR)path, type); - return ILGetDisplayNameExA(psf, pidl, (LPSTR)path, type); -} - -/************************************************************************* - * ILGetDisplayName [SHELL32.15] - */ -BOOL WINAPI ILGetDisplayName(LPCITEMIDLIST pidl, LPVOID path) -{ - TRACE_(shell)("%p %p\n", pidl, path); - - if (SHELL_OsIsUnicode()) - return ILGetDisplayNameExW(NULL, pidl, (LPWSTR)path, ILGDN_FORPARSING); - return ILGetDisplayNameExA(NULL, pidl, (LPSTR)path, ILGDN_FORPARSING); -} - -/************************************************************************* - * ILFindLastID [SHELL32.16] - * - * NOTES - * observed: pidl=Desktop return=pidl - */ -LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl) -{ - LPCITEMIDLIST pidlLast = pidl; - - TRACE("(pidl=%p)\n", pidl); - - if (!pidl) - return NULL; - - while (pidl->mkid.cb) - { - pidlLast = pidl; - pidl = ILGetNext(pidl); - } - return (LPITEMIDLIST)pidlLast; -} - -/************************************************************************* - * ILRemoveLastID [SHELL32.17] - * - * NOTES - * when pidl=Desktop return=FALSE - */ -BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl) -{ - TRACE_(shell)("pidl=%p\n", pidl); - - if (!pidl || !pidl->mkid.cb) - return 0; - ILFindLastID(pidl)->mkid.cb = 0; - return 1; -} - -/************************************************************************* - * ILClone [SHELL32.18] - * - * NOTES - * duplicate an idlist - */ -LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl) -{ - DWORD len; - LPITEMIDLIST newpidl; - - if (!pidl) - return NULL; - - len = ILGetSize(pidl); - newpidl = (LPITEMIDLIST)SHAlloc(len); - if (newpidl) - memcpy(newpidl, pidl, len); - - TRACE("pidl=%p newpidl=%p\n", pidl, newpidl); - pdump(pidl); - - return newpidl; -} - -/************************************************************************* - * ILCloneFirst [SHELL32.19] - * - * NOTES - * duplicates the first idlist of a complex pidl - */ -LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl) -{ - DWORD len; - LPITEMIDLIST pidlNew = NULL; - - TRACE("pidl=%p\n", pidl); - pdump(pidl); - - if (pidl) - { - len = pidl->mkid.cb; - pidlNew = (LPITEMIDLIST)SHAlloc(len + 2); - if (pidlNew) - { - memcpy(pidlNew, pidl, len + 2); /* 2 -> mind a desktop pidl */ - - if (len) - ILGetNext(pidlNew)->mkid.cb = 0x00; - } - } - TRACE("-- newpidl=%p\n", pidlNew); - - return pidlNew; -} - -/************************************************************************* - * ILLoadFromStream (SHELL32.26) - * - * NOTES - * the first two bytes are the len, the pidl is following then - */ -HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST * ppPidl) -{ - WORD wLen = 0; - DWORD dwBytesRead; - HRESULT ret = E_FAIL; - - - TRACE_(shell)("%p %p\n", pStream , ppPidl); - - SHFree(*ppPidl); - *ppPidl = NULL; - - pStream->AddRef (); - - if (SUCCEEDED(pStream->Read(&wLen, 2, &dwBytesRead))) - { - TRACE("PIDL length is %d\n", wLen); - if (wLen != 0) - { - *ppPidl = (LPITEMIDLIST)SHAlloc(wLen); - if (SUCCEEDED(pStream->Read(*ppPidl , wLen, &dwBytesRead))) - { - TRACE("Stream read OK\n"); - ret = S_OK; - } - else - { - WARN("reading pidl failed\n"); - SHFree(*ppPidl); - *ppPidl = NULL; - } - } - else - { - *ppPidl = NULL; - ret = S_OK; - } - } - - /* we are not yet fully compatible */ - if (*ppPidl && !pcheck(*ppPidl)) - { - WARN("Check failed\n"); - SHFree(*ppPidl); - *ppPidl = NULL; - } - - pStream->Release (); - TRACE("done\n"); - return ret; -} - -/************************************************************************* - * ILSaveToStream (SHELL32.27) - * - * NOTES - * the first two bytes are the len, the pidl is following then - */ -HRESULT WINAPI ILSaveToStream (IStream * pStream, LPCITEMIDLIST pPidl) -{ - WORD wLen = 0; - HRESULT ret = E_FAIL; - - TRACE_(shell)("%p %p\n", pStream, pPidl); - - pStream->AddRef (); - - wLen = ILGetSize(pPidl); - - if (SUCCEEDED(pStream->Write(&wLen, 2, NULL))) - { - if (SUCCEEDED(pStream->Write(pPidl, wLen, NULL))) - ret = S_OK; - } - pStream->Release (); - - return ret; -} - -/************************************************************************* - * SHILCreateFromPath [SHELL32.28] - * - * Create an ItemIDList from a path - * - * PARAMS - * path [I] - * ppidl [O] - * attributes [I/O] requested attributes on call and actual attributes when - * the function returns - * - * RETURNS - * NO_ERROR if successful, or an OLE errer code otherwise - * - * NOTES - * Wrapper for IShellFolder_ParseDisplayName(). - */ -HRESULT WINAPI SHILCreateFromPathA(LPCSTR path, LPITEMIDLIST * ppidl, DWORD * attributes) -{ - WCHAR lpszDisplayName[MAX_PATH]; - - TRACE_(shell)("%s %p 0x%08x\n", path, ppidl, attributes ? *attributes : 0); - - if (!MultiByteToWideChar(CP_ACP, 0, path, -1, lpszDisplayName, MAX_PATH)) - lpszDisplayName[MAX_PATH-1] = 0; - - return SHILCreateFromPathW(lpszDisplayName, ppidl, attributes); -} - -HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST * ppidl, DWORD * attributes) -{ - CComPtr<IShellFolder> sf; - DWORD pchEaten; - HRESULT ret = E_FAIL; - - TRACE_(shell)("%s %p 0x%08x\n", debugstr_w(path), ppidl, attributes ? *attributes : 0); - - if (SUCCEEDED (SHGetDesktopFolder(&sf))) - ret = sf->ParseDisplayName(0, NULL, (LPWSTR)path, &pchEaten, ppidl, attributes); - return ret; -} - -EXTERN_C HRESULT WINAPI SHILCreateFromPathAW (LPCVOID path, LPITEMIDLIST * ppidl, DWORD * attributes) -{ - if ( SHELL_OsIsUnicode()) - return SHILCreateFromPathW ((LPCWSTR)path, ppidl, attributes); - return SHILCreateFromPathA ((LPCSTR)path, ppidl, attributes); -} - -/************************************************************************* - * SHCloneSpecialIDList [SHELL32.89] - * - * Create an ItemIDList to one of the special folders. - - * PARAMS - * hwndOwner [in] - * nFolder [in] CSIDL_xxxxx - * fCreate [in] Create folder if it does not exist - * - * RETURNS - * Success: The newly created pidl - * Failure: NULL, if inputs are invalid. - * - * NOTES - * exported by ordinal. - * Caller is responsible for deallocating the returned ItemIDList with the - * shells IMalloc interface, aka ILFree. - */ -LPITEMIDLIST WINAPI SHCloneSpecialIDList(HWND hwndOwner, int nFolder, BOOL fCreate) -{ - LPITEMIDLIST ppidl; - TRACE_(shell)("(hwnd=%p,csidl=0x%x,%s).\n", hwndOwner, nFolder, fCreate ? "T" : "F"); - - if (fCreate) - nFolder |= CSIDL_FLAG_CREATE; - - SHGetSpecialFolderLocation(hwndOwner, nFolder, &ppidl); - return ppidl; -} - -/************************************************************************* - * ILGlobalClone [SHELL32.20] - * - * Clones an ItemIDList using Alloc. - * - * PARAMS - * pidl [I] ItemIDList to clone - * - * RETURNS - * Newly allocated ItemIDList. - * - * NOTES - * exported by ordinal. - */ -LPITEMIDLIST WINAPI ILGlobalClone(LPCITEMIDLIST pidl) -{ - DWORD len; - LPITEMIDLIST newpidl; - - if (!pidl) - return NULL; - - len = ILGetSize(pidl); - newpidl = (LPITEMIDLIST)Alloc(len); - if (newpidl) - memcpy(newpidl, pidl, len); - - TRACE("pidl=%p newpidl=%p\n", pidl, newpidl); - pdump(pidl); - - return newpidl; -} - -/************************************************************************* - * ILIsEqual [SHELL32.21] - * - */ -BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) -{ - char szData1[MAX_PATH]; - char szData2[MAX_PATH]; - - LPCITEMIDLIST pidltemp1 = pidl1; - LPCITEMIDLIST pidltemp2 = pidl2; - - TRACE("pidl1=%p pidl2=%p\n", pidl1, pidl2); - - /* - * Explorer reads from registry directly (StreamMRU), - * so we can only check here - */ - if (!pcheck(pidl1) || !pcheck (pidl2)) - return FALSE; - - pdump (pidl1); - pdump (pidl2); - - if (!pidl1 || !pidl2) - return FALSE; - - while (pidltemp1->mkid.cb && pidltemp2->mkid.cb) - { - _ILSimpleGetText(pidltemp1, szData1, MAX_PATH); - _ILSimpleGetText(pidltemp2, szData2, MAX_PATH); - - if (strcmp( szData1, szData2 )) - return FALSE; - - pidltemp1 = ILGetNext(pidltemp1); - pidltemp2 = ILGetNext(pidltemp2); - } - - if (!pidltemp1->mkid.cb && !pidltemp2->mkid.cb) - return TRUE; - - return FALSE; -} - -/************************************************************************* - * ILIsParent [SHELL32.23] - * - * Verifies that pidlParent is indeed the (immediate) parent of pidlChild. - * - * PARAMS - * pidlParent [I] - * pidlChild [I] - * bImmediate [I] only return true if the parent is the direct parent - * of the child - * - * RETURNS - * True if the parent ItemIDlist is a complete part of the child ItemIdList, - * False otherwise. - * - * NOTES - * parent = a/b, child = a/b/c -> true, c is in folder a/b - * child = a/b/c/d -> false if bImmediate is true, d is not in folder a/b - * child = a/b/c/d -> true if bImmediate is false, d is in a subfolder of a/b - */ -BOOL WINAPI ILIsParent(LPCITEMIDLIST pidlParent, LPCITEMIDLIST pidlChild, BOOL bImmediate) -{ - char szData1[MAX_PATH]; - char szData2[MAX_PATH]; - LPCITEMIDLIST pParent = pidlParent; - LPCITEMIDLIST pChild = pidlChild; - - TRACE("%p %p %x\n", pidlParent, pidlChild, bImmediate); - - if (!pParent || !pChild) - return FALSE; - - while (pParent->mkid.cb && pChild->mkid.cb) - { - _ILSimpleGetText(pParent, szData1, MAX_PATH); - _ILSimpleGetText(pChild, szData2, MAX_PATH); - - if (strcmp( szData1, szData2 )) - return FALSE; - - pParent = ILGetNext(pParent); - pChild = ILGetNext(pChild); - } - - /* child shorter or has equal length to parent */ - if (pParent->mkid.cb || !pChild->mkid.cb) - return FALSE; - - /* not immediate descent */ - if ( ILGetNext(pChild)->mkid.cb && bImmediate) - return FALSE; - - return TRUE; -} - -/************************************************************************* - * ILFindChild [SHELL32.24] - * - * Compares elements from pidl1 and pidl2. - * - * PARAMS - * pidl1 [I] - * pidl2 [I] - * - * RETURNS - * pidl1 is desktop pidl2 - * pidl1 shorter pidl2 pointer to first different element of pidl2 - * if there was at least one equal element - * pidl2 shorter pidl1 0 - * pidl2 equal pidl1 pointer to last 0x00-element of pidl2 - * - * NOTES - * exported by ordinal. - */ -LPITEMIDLIST WINAPI ILFindChild(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) -{ - char szData1[MAX_PATH]; - char szData2[MAX_PATH]; - - LPCITEMIDLIST pidltemp1 = pidl1; - LPCITEMIDLIST pidltemp2 = pidl2; - LPCITEMIDLIST ret = NULL; - - TRACE("pidl1=%p pidl2=%p\n", pidl1, pidl2); - - /* explorer reads from registry directly (StreamMRU), - so we can only check here */ - if ((!pcheck (pidl1)) || (!pcheck (pidl2))) - return FALSE; - - pdump (pidl1); - pdump (pidl2); - - if (_ILIsDesktop(pidl1)) - { - ret = pidl2; - } - else - { - while (pidltemp1->mkid.cb && pidltemp2->mkid.cb) - { - _ILSimpleGetText(pidltemp1, szData1, MAX_PATH); - _ILSimpleGetText(pidltemp2, szData2, MAX_PATH); - - if (strcmp(szData1, szData2)) - break; - - pidltemp1 = ILGetNext(pidltemp1); - pidltemp2 = ILGetNext(pidltemp2); - ret = pidltemp2; - } - - if (pidltemp1->mkid.cb) - ret = NULL; /* elements of pidl1 left*/ - } - TRACE_(shell)("--- %p\n", ret); - return (LPITEMIDLIST)ret; /* pidl 1 is shorter */ -} - -/************************************************************************* - * ILCombine [SHELL32.25] - * - * Concatenates two complex ItemIDLists. - * - * PARAMS - * pidl1 [I] first complex ItemIDLists - * pidl2 [I] complex ItemIDLists to append - * - * RETURNS - * if both pidl's == NULL NULL - * if pidl1 == NULL cloned pidl2 - * if pidl2 == NULL cloned pidl1 - * otherwise new pidl with pidl2 appended to pidl1 - * - * NOTES - * exported by ordinal. - * Does not destroy the passed in ItemIDLists! - */ -LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) -{ - DWORD len1, len2; - LPITEMIDLIST pidlNew; - - TRACE("pidl=%p pidl=%p\n", pidl1, pidl2); - - if (!pidl1 && !pidl2) return NULL; - - pdump (pidl1); - pdump (pidl2); - - if (!pidl1) - { - pidlNew = ILClone(pidl2); - return pidlNew; - } - - if (!pidl2) - { - pidlNew = ILClone(pidl1); - return pidlNew; - } - - len1 = ILGetSize(pidl1) - 2; - len2 = ILGetSize(pidl2); - pidlNew = (LPITEMIDLIST)SHAlloc(len1 + len2); - - if (pidlNew) - { - memcpy(pidlNew, pidl1, len1); - memcpy(((BYTE *)pidlNew) + len1, pidl2, len2); - } - - /* TRACE(pidl,"--new pidl=%p\n",pidlNew);*/ - return pidlNew; -} - -/************************************************************************* - * SHGetRealIDL [SHELL32.98] - * - * NOTES - */ -HRESULT WINAPI SHGetRealIDL(IShellFolder * lpsf, LPCITEMIDLIST pidlSimple, LPITEMIDLIST *pidlReal) -{ - CComPtr<IDataObject> pDataObj; - HRESULT hr; - - hr = lpsf->GetUIObjectOf(0, 1, &pidlSimple, IID_NULL_PPV_ARG(IDataObject, &pDataObj)); - if (SUCCEEDED(hr)) - { - STGMEDIUM medium; - FORMATETC fmt; - - fmt.cfFormat = RegisterClipboardFormatW(CFSTR_SHELLIDLIST); - fmt.ptd = NULL; - fmt.dwAspect = DVASPECT_CONTENT; - fmt.lindex = -1; - fmt.tymed = TYMED_HGLOBAL; - - hr = pDataObj->GetData(&fmt, &medium); - - if (SUCCEEDED(hr)) - { - /*assert(pida->cidl==1);*/ - LPIDA pida = (LPIDA)GlobalLock(medium.hGlobal); - - LPCITEMIDLIST pidl_folder = (LPCITEMIDLIST) ((LPBYTE)pida + pida->aoffset[0]); - LPCITEMIDLIST pidl_child = (LPCITEMIDLIST) ((LPBYTE)pida + pida->aoffset[1]); - - *pidlReal = ILCombine(pidl_folder, pidl_child); - - if (!*pidlReal) - hr = E_OUTOFMEMORY; - - GlobalUnlock(medium.hGlobal); - GlobalFree(medium.hGlobal); - } - } - - return hr; -} - -/************************************************************************* - * SHLogILFromFSIL [SHELL32.95] - * - * NOTES - * pild = CSIDL_DESKTOP ret = 0 - * pild = CSIDL_DRIVES ret = 0 - */ -EXTERN_C LPITEMIDLIST WINAPI SHLogILFromFSIL(LPITEMIDLIST pidl) -{ - FIXME("(pidl=%p)\n", pidl); - - pdump(pidl); - - return 0; -} - -/************************************************************************* - * ILGetSize [SHELL32.152] - * - * Gets the byte size of an ItemIDList including zero terminator - * - * PARAMS - * pidl [I] ItemIDList - * - * RETURNS - * size of pidl in bytes - * - * NOTES - * exported by ordinal - */ -UINT WINAPI ILGetSize(LPCITEMIDLIST pidl) -{ - LPCSHITEMID si; - UINT len = 0; - - if (pidl) - { - si = &(pidl->mkid); - - while (si->cb) - { - len += si->cb; - si = (LPCSHITEMID)(((const BYTE*)si) + si->cb); - } - len += 2; - } - TRACE("pidl=%p size=%u\n", pidl, len); - return len; -} - -/************************************************************************* - * ILGetNext [SHELL32.153] - * - * Gets the next ItemID of an ItemIDList - * - * PARAMS - * pidl [I] ItemIDList - * - * RETURNS - * null -> null - * desktop -> null - * simple pidl -> pointer to 0x0000 element - * - * NOTES - * exported by ordinal. - */ -LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl) -{ - WORD len; - - TRACE("%p\n", pidl); - - if (pidl) - { - len = pidl->mkid.cb; - if (len) - { - pidl = (LPCITEMIDLIST) (((const BYTE*)pidl) + len); - TRACE("-- %p\n", pidl); - return (LPITEMIDLIST)pidl; - } - } - return NULL; -} - -/************************************************************************* - * ILAppend [SHELL32.154] - * - * Adds the single ItemID item to the ItemIDList indicated by pidl. - * If bEnd is FALSE, inserts the item in the front of the list, - * otherwise it adds the item to the end. (???) - * - * PARAMS - * pidl [I] ItemIDList to extend - * item [I] ItemID to prepend/append - * bEnd [I] Indicates if the item should be appended - * - * NOTES - * Destroys the passed in idlist! (???) - */ -EXTERN_C LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl, LPCITEMIDLIST item, BOOL bEnd) -{ - LPITEMIDLIST idlRet; - - WARN("(pidl=%p,pidl=%p,%08u)semi-stub\n", pidl, item, bEnd); - - pdump (pidl); - pdump (item); - - if (_ILIsDesktop(pidl)) - { - idlRet = ILClone(item); - SHFree (pidl); - return idlRet; - } - - if (bEnd) - idlRet = ILCombine(pidl, item); - else - idlRet = ILCombine(item, pidl); - - SHFree(pidl); - return idlRet; -} - -/************************************************************************* - * ILFree [SHELL32.155] - * - * Frees memory (if not NULL) allocated by SHMalloc allocator - * - * PARAMS - * pidl [I] - * - * RETURNS - * Nothing - * - * NOTES - * exported by ordinal - */ -void WINAPI ILFree(LPITEMIDLIST pidl) -{ - TRACE("(pidl=%p)\n", pidl); - SHFree(pidl); -} - -/************************************************************************* - * ILGlobalFree [SHELL32.156] - * - * Frees memory (if not NULL) allocated by Alloc allocator - * - * PARAMS - * pidl [I] - * - * RETURNS - * Nothing - * - * NOTES - * exported by ordinal. - */ -void WINAPI ILGlobalFree( LPITEMIDLIST pidl) -{ - TRACE("%p\n", pidl); - - Free(pidl); -} - -/************************************************************************* - * ILCreateFromPathA [SHELL32.189] - * - * Creates a complex ItemIDList from a path and returns it. - * - * PARAMS - * path [I] - * - * RETURNS - * the newly created complex ItemIDList or NULL if failed - * - * NOTES - * exported by ordinal. - */ -LPITEMIDLIST WINAPI ILCreateFromPathA (LPCSTR path) -{ - LPITEMIDLIST pidlnew = NULL; - - TRACE_(shell)("%s\n", debugstr_a(path)); - - if (SUCCEEDED(SHILCreateFromPathA(path, &pidlnew, NULL))) - return pidlnew; - return NULL; -} - -/************************************************************************* - * ILCreateFromPathW [SHELL32.190] - * - * See ILCreateFromPathA. - */ -LPITEMIDLIST WINAPI ILCreateFromPathW (LPCWSTR path) -{ - LPITEMIDLIST pidlnew = NULL; - - TRACE_(shell)("%s\n", debugstr_w(path)); - - if (SUCCEEDED(SHILCreateFromPathW(path, &pidlnew, NULL))) - return pidlnew; - return NULL; -} - -/************************************************************************* - * ILCreateFromPath [SHELL32.157] - */ -EXTERN_C LPITEMIDLIST WINAPI ILCreateFromPathAW (LPCVOID path) -{ - if ( SHELL_OsIsUnicode()) - return ILCreateFromPathW ((LPCWSTR)path); - return ILCreateFromPathA ((LPCSTR)path); -} - -/************************************************************************* - * _ILParsePathW [internal] - * - * Creates an ItemIDList from a path and returns it. - * - * PARAMS - * path [I] path to parse and convert into an ItemIDList - * lpFindFile [I] pointer to buffer to initialize the FileSystem - * Bind Data object with - * bBindCtx [I] indicates to create a BindContext and assign a - * FileSystem Bind Data object - * ppidl [O] the newly create ItemIDList - * prgfInOut [I/O] requested attributes on input and actual - * attributes on return - * - * RETURNS - * NO_ERROR on success or an OLE error code - * - * NOTES - * If either lpFindFile is non-NULL or bBindCtx is TRUE, this function - * creates a BindContext object and assigns a FileSystem Bind Data object - * to it, passing the BindContext to IShellFolder_ParseDisplayName. Each - * IShellFolder uses that FileSystem Bind Data object of the BindContext - * to pass data about the current path element to the next object. This - * is used to avoid having to verify the current path element on disk, so - * that creating an ItemIDList from a nonexistent path still can work. - */ -static HRESULT _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile, - BOOL bBindCtx, LPITEMIDLIST *ppidl, LPDWORD prgfInOut) -{ - CComPtr<IShellFolder> pSF; - CComPtr<IBindCtx> pBC; - HRESULT ret; - - TRACE("%s %p %d (%p)->%p (%p)->0x%x\n", debugstr_w(path), lpFindFile, bBindCtx, - ppidl, ppidl ? *ppidl : NULL, - prgfInOut, prgfInOut ? *prgfInOut : 0); - - ret = SHGetDesktopFolder(&pSF); - if (FAILED(ret)) - return ret; - - if (lpFindFile || bBindCtx) - ret = IFileSystemBindData_Constructor(lpFindFile, &pBC); - - if (SUCCEEDED(ret)) - { - ret = pSF->ParseDisplayName(0, pBC, (LPOLESTR)path, NULL, ppidl, prgfInOut); - } - - if (FAILED(ret) && ppidl) - *ppidl = NULL; - - TRACE("%s %p 0x%x\n", debugstr_w(path), ppidl ? *ppidl : NULL, prgfInOut ? *prgfInOut : 0); - - return ret; -} - -/************************************************************************* - * SHSimpleIDListFromPath [SHELL32.162] - * - * Creates a simple ItemIDList from a path and returns it. This function - * does not fail on nonexistent paths. - * - * PARAMS - * path [I] path to parse and convert into an ItemIDList - * - * RETURNS - * the newly created simple ItemIDList - * - * NOTES - * Simple in the name does not mean a relative ItemIDList but rather a - * fully qualified list, where only the file name is filled in and the - * directory flag for those ItemID elements this is known about, eg. - * it is not the last element in the ItemIDList or the actual directory - * exists on disk. - * exported by ordinal. - */ -LPITEMIDLIST WINAPI SHSimpleIDListFromPathA(LPCSTR lpszPath) -{ - LPITEMIDLIST pidl = NULL; - LPWSTR wPath = NULL; - int len; - - TRACE("%s\n", debugstr_a(lpszPath)); - - if (lpszPath) - { - len = MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, NULL, 0); - wPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, wPath, len); - } - - _ILParsePathW(wPath, NULL, TRUE, &pidl, NULL); - - HeapFree(GetProcessHeap(), 0, wPath); - TRACE("%s %p\n", debugstr_a(lpszPath), pidl); - return pidl; -} - -LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath) -{ - LPITEMIDLIST pidl = NULL; - - TRACE("%s\n", debugstr_w(lpszPath)); - - _ILParsePathW(lpszPath, NULL, TRUE, &pidl, NULL); - TRACE("%s %p\n", debugstr_w(lpszPath), pidl); - return pidl; -} - -EXTERN_C LPITEMIDLIST WINAPI SHSimpleIDListFromPathAW(LPCVOID lpszPath) -{ - if ( SHELL_OsIsUnicode()) - return SHSimpleIDListFromPathW ((LPCWSTR)lpszPath); - return SHSimpleIDListFromPathA ((LPCSTR)lpszPath); -} - -/************************************************************************* - * SHGetDataFromIDListA [SHELL32.247] - * - * NOTES - * the pidl can be a simple one. since we can't get the path out of the pidl - * we have to take all data from the pidl - */ -HRESULT WINAPI SHGetDataFromIDListA(IShellFolder * psf, LPCITEMIDLIST pidl, - int nFormat, LPVOID dest, int len) -{ - LPSTR filename, shortname; - WIN32_FIND_DATAA * pfd; - - TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n", psf, pidl, nFormat, dest, len); - - pdump(pidl); - if (!psf || !dest) - return E_INVALIDARG; - - switch (nFormat) - { - case SHGDFIL_FINDDATA: - pfd = (WIN32_FIND_DATAA *)dest; - - if (_ILIsDrive(pidl) || _ILIsSpecialFolder(pidl)) - return E_INVALIDARG; - - if (len < (int)sizeof(WIN32_FIND_DATAA)) - return E_INVALIDARG; - - ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA)); - _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); - pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); - pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0); - - filename = _ILGetTextPointer(pidl); - shortname = _ILGetSTextPointer(pidl); - - if (filename) - lstrcpynA(pfd->cFileName, filename, sizeof(pfd->cFileName)); - else - pfd->cFileName[0] = '\0'; - - if (shortname) - lstrcpynA(pfd->cAlternateFileName, shortname, sizeof(pfd->cAlternateFileName)); - else - pfd->cAlternateFileName[0] = '\0'; - return S_OK; - - case SHGDFIL_NETRESOURCE: - case SHGDFIL_DESCRIPTIONID: - FIXME_(shell)("SHGDFIL %i stub\n", nFormat); - break; - - default: - ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat); - } - - return E_INVALIDARG; -} - -/************************************************************************* - * SHGetDataFromIDListW [SHELL32.248] - * - */ -HRESULT WINAPI SHGetDataFromIDListW(IShellFolder * psf, LPCITEMIDLIST pidl, - int nFormat, LPVOID dest, int len) -{ - LPSTR filename, shortname; - WIN32_FIND_DATAW * pfd = (WIN32_FIND_DATAW *)dest; - - TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n", psf, pidl, nFormat, dest, len); - - pdump(pidl); - - if (!psf || !dest) - return E_INVALIDARG; - - switch (nFormat) - { - case SHGDFIL_FINDDATA: - pfd = (WIN32_FIND_DATAW *)dest; - - if (_ILIsDrive(pidl)) - return E_INVALIDARG; - - if (len < (int)sizeof(WIN32_FIND_DATAW)) - return E_INVALIDARG; - - ZeroMemory(pfd, sizeof (WIN32_FIND_DATAW)); - _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); - pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); - pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0); - - filename = _ILGetTextPointer(pidl); - shortname = _ILGetSTextPointer(pidl); - - if (!filename) - pfd->cFileName[0] = '\0'; - else if (!MultiByteToWideChar(CP_ACP, 0, filename, -1, pfd->cFileName, MAX_PATH)) - pfd->cFileName[MAX_PATH-1] = 0; - - if (!shortname) - pfd->cAlternateFileName[0] = '\0'; - else if (!MultiByteToWideChar(CP_ACP, 0, shortname, -1, pfd->cAlternateFileName, 14)) - pfd->cAlternateFileName[13] = 0; - return S_OK; - - case SHGDFIL_NETRESOURCE: - case SHGDFIL_DESCRIPTIONID: - FIXME_(shell)("SHGDFIL %i stub\n", nFormat); - break; - - default: - ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat); - } - - return E_INVALIDARG; -} - -/************************************************************************* - * SHGetPathFromIDListA [SHELL32.@][NT 4.0: SHELL32.220] - * - * PARAMETERS - * pidl, [IN] pidl - * pszPath [OUT] path - * - * RETURNS - * path from a passed PIDL. - * - * NOTES - * NULL returns FALSE - * desktop pidl gives path to desktop directory back - * special pidls returning FALSE - */ -BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath) -{ - WCHAR wszPath[MAX_PATH]; - BOOL bSuccess; - - bSuccess = SHGetPathFromIDListW(pidl, wszPath); - WideCharToMultiByte(CP_ACP, 0, wszPath, -1, pszPath, MAX_PATH, NULL, NULL); - - return bSuccess; -} - -/************************************************************************* - * SHGetPathFromIDListW [SHELL32.@] - * - * See SHGetPathFromIDListA. - */ -BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath) -{ - HRESULT hr; - LPCITEMIDLIST pidlLast; - CComPtr<IShellFolder> psfFolder; - DWORD dwAttributes; - STRRET strret; - - TRACE_(shell)("(pidl=%p,%p)\n", pidl, pszPath); - pdump(pidl); - - *pszPath = '\0'; - if (!pidl) - return FALSE; - - hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psfFolder), &pidlLast); - if (FAILED(hr)) - { - ERR("SHBindToParent failed: %x\n", hr); - return FALSE; - } - - dwAttributes = SFGAO_FILESYSTEM; - hr = psfFolder->GetAttributesOf(1, &pidlLast, &dwAttributes); - if (FAILED(hr) || !(dwAttributes & SFGAO_FILESYSTEM)) - { - WARN("Wrong dwAttributes or GetAttributesOf failed: %x\n", hr); - return FALSE; - } - - hr = psfFolder->GetDisplayNameOf(pidlLast, SHGDN_FORPARSING, &strret); - if (FAILED(hr)) return FALSE; - - hr = StrRetToBufW(&strret, pidlLast, pszPath, MAX_PATH); - - TRACE_(shell)("-- %s, 0x%08x\n", debugstr_w(pszPath), hr); - return SUCCEEDED(hr); -} - -/************************************************************************* - * SHBindToParent [shell version 5.0] - */ -HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast) -{ - CComPtr<IShellFolder> psfDesktop; - HRESULT hr = E_FAIL; - - TRACE_(shell)("pidl=%p\n", pidl); - pdump(pidl); - - if (!pidl || !ppv) - return E_INVALIDARG; - - *ppv = NULL; - if (ppidlLast) - *ppidlLast = NULL; - - hr = SHGetDesktopFolder(&psfDesktop); - if (FAILED(hr)) - return hr; - - if (_ILIsPidlSimple(pidl)) - { - /* we are on desktop level */ - hr = psfDesktop->QueryInterface(riid, ppv); - } - else - { - LPITEMIDLIST pidlParent = ILClone(pidl); - ILRemoveLastID(pidlParent); - hr = psfDesktop->BindToObject(pidlParent, NULL, riid, ppv); - SHFree (pidlParent); - } - - if (SUCCEEDED(hr) && ppidlLast) - *ppidlLast = ILFindLastID(pidl); - - TRACE_(shell)("-- psf=%p pidl=%p ret=0x%08x\n", *ppv, (ppidlLast) ? *ppidlLast : NULL, hr); - return hr; -} - -/************************************************************************** - * - * internal functions - * - * ### 1. section creating pidls ### - * - ************************************************************************* - */ - -/* Basic PIDL constructor. Allocates size + 5 bytes, where: - * - two bytes are SHITEMID.cb - * - one byte is PIDLDATA.type - * - two bytes are the NULL PIDL terminator - * Sets type of the returned PIDL to type. - */ -static LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size) -{ - LPITEMIDLIST pidlOut = NULL; - - pidlOut = (LPITEMIDLIST)SHAlloc(size + 5); - if(pidlOut) - { - LPPIDLDATA pData; - LPITEMIDLIST pidlNext; - - ZeroMemory(pidlOut, size + 5); - pidlOut->mkid.cb = size + 3; - - pData = _ILGetDataPointer(pidlOut); - if (pData) - pData->type = type; - - pidlNext = ILGetNext(pidlOut); - if (pidlNext) - pidlNext->mkid.cb = 0x00; - TRACE("-- (pidl=%p, size=%u)\n", pidlOut, size); - } - - return pidlOut; -} - -LPITEMIDLIST _ILCreateDesktop(void) -{ - LPITEMIDLIST ret; - - TRACE("()\n"); - ret = (LPITEMIDLIST)SHAlloc(2); - if (ret) - ret->mkid.cb = 0; - return ret; -} - -LPITEMIDLIST _ILCreateMyComputer(void) -{ - TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_MyComputer); -} - -LPITEMIDLIST _ILCreateMyDocuments(void) -{ - TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_MyDocuments); -} - -LPITEMIDLIST _ILCreateIExplore(void) -{ - TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_Internet); -} - -LPITEMIDLIST _ILCreateControlPanel(void) -{ - LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, CLSID_MyComputer), ret = NULL; - - TRACE("()\n"); - if (parent) - { - LPITEMIDLIST cpl = _ILCreateGuid(PT_SHELLEXT, CLSID_ControlPanel); - - if (cpl) - { - ret = ILCombine(parent, cpl); - SHFree(cpl); - } - SHFree(parent); - } - return ret; -} - -LPITEMIDLIST _ILCreatePrinters(void) -{ - LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, CLSID_MyComputer), ret = NULL; - - TRACE("()\n"); - if (parent) - { - LPITEMIDLIST printers = _ILCreateGuid(PT_YAGUID, CLSID_Printers); - - if (printers) - { - ret = ILCombine(parent, printers); - SHFree(printers); - } - SHFree(parent); - } - return ret; -} - -LPITEMIDLIST _ILCreateNetwork(void) -{ - TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_NetworkPlaces); -} - -LPITEMIDLIST _ILCreateBitBucket(void) -{ - TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_RecycleBin); -} - -LPITEMIDLIST _ILCreateAdminTools(void) -{ - TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_AdminFolderShortcut); //FIXME -} - -LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid) -{ - LPITEMIDLIST pidlOut; - - if (type == PT_SHELLEXT || type == PT_GUID || type == PT_YAGUID) - { - pidlOut = _ILAlloc(type, sizeof(GUIDStruct)); - if (pidlOut) - { - LPPIDLDATA pData = _ILGetDataPointer(pidlOut); - - pData->u.guid.guid = guid; - TRACE("-- create GUID-pidl %s\n", - debugstr_guid(&(pData->u.guid.guid))); - } - } - else - { - WARN("%d: invalid type for GUID\n", type); - pidlOut = NULL; - } - return pidlOut; -} - -LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID) -{ - IID iid; - - if (FAILED(SHCLSIDFromStringA(szGUID, &iid))) - { - ERR("%s is not a GUID\n", szGUID); - return NULL; - } - return _ILCreateGuid(PT_GUID, iid); -} - -LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID) -{ - IID iid; - - if (FAILED(CLSIDFromString((LPOLESTR)szGUID, &iid))) - { - ERR("%s is not a GUID\n", debugstr_w(szGUID)); - return NULL; - } - return _ILCreateGuid(PT_GUID, iid); -} - -LPITEMIDLIST _ILCreateFromFindDataW( const WIN32_FIND_DATAW *wfd ) -{ - char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */ - DWORD len, len1, wlen, alen, cbData; - LPITEMIDLIST pidl; - PIDLTYPE type; - - if (!wfd) - return NULL; - - TRACE("(%s, %s)\n", debugstr_w(wfd->cAlternateFileName), debugstr_w(wfd->cFileName)); - - /* prepare buffer with both names */ - len = WideCharToMultiByte(CP_ACP, 0, wfd->cFileName, -1, buff, MAX_PATH, NULL, NULL); - len1 = WideCharToMultiByte(CP_ACP, 0, wfd->cAlternateFileName, -1, buff + len, sizeof(buff) - len, NULL, NULL); - alen = len + len1; - - type = (wfd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? PT_FOLDER : PT_VALUE; - - wlen = wcslen(wfd->cFileName) + 1; - cbData = sizeof(FileStruct) - 1 + (alen + (alen & 1)); // Note: szNames field is initially 1 byte long - cbData += sizeof(FileStructW) - 1 + wlen * sizeof(WCHAR); // Note: wszName field is initially 1 byte long - cbData += sizeof(WORD); // offset to FileStructW - pidl = _ILAlloc(type, cbData); - if (pidl) - { - LPPIDLDATA pData = _ILGetDataPointer(pidl); - FileStruct *fs = &pData->u.file; - FileStructW *fsw; - WORD *pOffsetW; - - FileTimeToDosDateTime( &wfd->ftLastWriteTime, &fs->uFileDate, &fs->uFileTime); - fs->dwFileSize = wfd->nFileSizeLow; - fs->uFileAttribs = wfd->dwFileAttributes; - memcpy(fs->szNames, buff, alen); - - fsw = (FileStructW*)(pData->u.file.szNames + alen + (alen & 0x1)); - fsw->cbLen = sizeof(FileStructW) - 1 + wlen * sizeof(WCHAR) + sizeof(WORD); - FileTimeToDosDateTime( &wfd->ftCreationTime, &fsw->uCreationDate, &fsw->uCreationTime); - FileTimeToDosDateTime( &wfd->ftLastAccessTime, &fsw->uLastAccessDate, &fsw->uLastAccessTime); - memcpy(fsw->wszName, wfd->cFileName, wlen * sizeof(WCHAR)); - - pOffsetW = (WORD*)((LPBYTE)pidl + pidl->mkid.cb - sizeof(WORD)); - *pOffsetW = (LPBYTE)fsw - (LPBYTE)pidl; - TRACE("-- Set Value: %s\n", debugstr_w(fsw->wszName)); - } - return pidl; - -} - -HRESULT _ILCreateFromPathW(LPCWSTR szPath, LPITEMIDLIST* ppidl) -{ - HANDLE hFile; - WIN32_FIND_DATAW stffile; - - if (!ppidl) - return E_INVALIDARG; - - hFile = FindFirstFileW(szPath, &stffile); - if (hFile == INVALID_HANDLE_VALUE) - return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - - FindClose(hFile); - - *ppidl = _ILCreateFromFindDataW(&stffile); - - return *ppidl ? S_OK : E_OUTOFMEMORY; -} - -LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew) -{ - LPITEMIDLIST pidlOut; - - TRACE("(%s)\n", debugstr_w(lpszNew)); - - pidlOut = _ILAlloc(PT_DRIVE, sizeof(DriveStruct)); - if (pidlOut) - { - LPSTR pszDest; - - pszDest = _ILGetTextPointer(pidlOut); - if (pszDest) - { - strcpy(pszDest, "x:\\"); - pszDest[0] = towupper(lpszNew[0]); - TRACE("-- create Drive: %s\n", debugstr_a(pszDest)); - } - } - return pidlOut; -} - -/************************************************************************** - * _ILGetDrive() - * - * Gets the text for the drive eg. 'c:\' - * - * RETURNS - * strlen (lpszText) - */ -DWORD _ILGetDrive(LPCITEMIDLIST pidl, LPSTR pOut, UINT uSize) -{ - TRACE("(%p,%p,%u)\n", pidl, pOut, uSize); - - if(_ILIsMyComputer(pidl)) - pidl = ILGetNext(pidl); - - if (pidl && _ILIsDrive(pidl)) - return _ILSimpleGetText(pidl, pOut, uSize); - - return 0; -} - -/************************************************************************** - * - * ### 2. section testing pidls ### - * - ************************************************************************** - * _ILIsUnicode() - * _ILIsDesktop() - * _ILIsMyComputer() - * _ILIsSpecialFolder() - * _ILIsDrive() - * _ILIsFolder() - * _ILIsValue() - * _ILIsPidlSimple() - */ -BOOL _ILIsUnicode(LPCITEMIDLIST pidl) -{ - LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - - TRACE("(%p)\n", pidl); - - return (pidl && lpPData && PT_VALUEW == lpPData->type); -} - -BOOL _ILIsDesktop(LPCITEMIDLIST pidl) -{ - TRACE("(%p)\n", pidl); - - return pidl && pidl->mkid.cb ? 0 : 1; -} - -BOOL _ILIsMyDocuments(LPCITEMIDLIST pidl) -{ - IID *iid = _ILGetGUIDPointer(pidl); - - TRACE("(%p)\n", pidl); - - if (iid) - return IsEqualIID(*iid, CLSID_MyDocuments); - return FALSE; -} - -BOOL _ILIsControlPanel(LPCITEMIDLIST pidl) -{ - IID *iid = _ILGetGUIDPointer(pidl); - - TRACE("(%p)\n", pidl); - - if (iid) - return IsEqualIID(*iid, CLSID_ControlPanel); - return FALSE; -} - -BOOL _ILIsNetHood(LPCITEMIDLIST pidl) -{ - IID *iid = _ILGetGUIDPointer(pidl); - - TRACE("(%p)\n", pidl); - - if (iid) - return IsEqualIID(*iid, CLSID_NetworkPlaces); - return FALSE; -} - - -LPITEMIDLIST _ILCreateNetHood(void) -{ - return _ILCreateGuid(PT_GUID, CLSID_NetworkPlaces); -} - -LPITEMIDLIST _ILCreateFont(void) -{ - return _ILCreateGuid(PT_GUID, CLSID_FontsFolderShortcut); -} - -BOOL _ILIsMyComputer(LPCITEMIDLIST pidl) -{ - IID *iid = _ILGetGUIDPointer(pidl); - - TRACE("(%p)\n", pidl); - - if (iid) - return IsEqualIID(*iid, CLSID_MyComputer); - return FALSE; -} - -BOOL _ILIsPrinter(LPCITEMIDLIST pidl) -{ - IID *iid = _ILGetGUIDPointer(pidl); - - TRACE("(%p)\n", pidl); - - if (iid) - return IsEqualIID(*iid, CLSID_Printers); - return FALSE; -} - -BOOL _ILIsBitBucket(LPCITEMIDLIST pidl) -{ - IID *iid = _ILGetGUIDPointer(pidl); - - TRACE("(%p)\n", pidl); - - if (iid) - return IsEqualIID(*iid, CLSID_RecycleBin); - return FALSE; -} - -BOOL _ILIsAdminTools(LPCITEMIDLIST pidl) -{ - IID *iid = _ILGetGUIDPointer(pidl); - - TRACE("(%p)\n", pidl); - - if (iid) - return IsEqualIID(*iid, CLSID_AdminFolderShortcut); - else - return FALSE; -} - -BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl) -{ - LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - - TRACE("(%p)\n", pidl); - - return (pidl && ( (lpPData && (PT_GUID == lpPData->type || PT_SHELLEXT == lpPData->type || PT_YAGUID == lpPData->type)) || - (pidl && pidl->mkid.cb == 0x00) - )); -} - -BOOL _ILIsDrive(LPCITEMIDLIST pidl) -{ - LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - - TRACE("(%p)\n", pidl); - - return (pidl && lpPData && (PT_DRIVE == lpPData->type || - PT_DRIVE1 == lpPData->type || - PT_DRIVE2 == lpPData->type || - PT_DRIVE3 == lpPData->type)); -} - -BOOL _ILIsFolder(LPCITEMIDLIST pidl) -{ - LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - - TRACE("(%p)\n", pidl); - - return (pidl && lpPData && (PT_FOLDER == lpPData->type || PT_FOLDER1 == lpPData->type)); -} - -BOOL _ILIsValue(LPCITEMIDLIST pidl) -{ - LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - - TRACE("(%p)\n", pidl); - - return (pidl && lpPData && PT_VALUE == lpPData->type); -} - -BOOL _ILIsCPanelStruct(LPCITEMIDLIST pidl) -{ - LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - - TRACE("(%p)\n", pidl); - - return (pidl && lpPData && (lpPData->type == 0)); -} - -/************************************************************************** - * _ILIsPidlSimple - */ -BOOL _ILIsPidlSimple(LPCITEMIDLIST pidl) -{ - BOOL ret = TRUE; - - if(! _ILIsDesktop(pidl)) /* pidl=NULL or mkid.cb=0 */ - { - WORD len = pidl->mkid.cb; - LPCITEMIDLIST pidlnext = (LPCITEMIDLIST) (((const BYTE*)pidl) + len ); - - if (pidlnext->mkid.cb) - ret = FALSE; - } - - TRACE("%s\n", ret ? "Yes" : "No"); - return ret; -} - -/************************************************************************** - * - * ### 3. section getting values from pidls ### - */ - -/************************************************************************** -* _ILSimpleGetText -* -* gets the text for the first item in the pidl (eg. simple pidl) -* -* returns the length of the string -*/ -DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize) -{ - DWORD dwReturn = 0; - LPSTR szSrc; - LPWSTR szSrcW; - GUID const * riid; - char szTemp[MAX_PATH]; - - TRACE("(%p %p %x)\n", pidl, szOut, uOutSize); - - if (!pidl) - return 0; - - if (szOut) - *szOut = 0; - - if (_ILIsDesktop(pidl)) - { - /* desktop */ - if (HCR_GetClassNameA(CLSID_ShellDesktop, szTemp, MAX_PATH)) - { - if (szOut) - lstrcpynA(szOut, szTemp, uOutSize); - - dwReturn = strlen (szTemp); - } - } - else if (( szSrc = _ILGetTextPointer(pidl) )) - { - /* filesystem */ - if (szOut) - lstrcpynA(szOut, szSrc, uOutSize); - - dwReturn = strlen(szSrc); - } - else if (( szSrcW = _ILGetTextPointerW(pidl) )) - { - /* unicode filesystem */ - WideCharToMultiByte(CP_ACP, 0, szSrcW, -1, szTemp, MAX_PATH, NULL, NULL); - - if (szOut) - lstrcpynA(szOut, szTemp, uOutSize); - - dwReturn = strlen (szTemp); - } - else if (( riid = _ILGetGUIDPointer(pidl) )) - { - /* special folder */ - if (HCR_GetClassNameA(*riid, szTemp, MAX_PATH) ) - { - if (szOut) - lstrcpynA(szOut, szTemp, uOutSize); - - dwReturn = strlen (szTemp); - } - } - else - { - ERR("-- no text\n"); - } - - TRACE("-- (%p=%s 0x%08x)\n", szOut, debugstr_a(szOut), dwReturn); - return dwReturn; -} - -/************************************************************************** -* _ILSimpleGetTextW -* -* gets the text for the first item in the pidl (eg. simple pidl) -* -* returns the length of the string -*/ -DWORD _ILSimpleGetTextW (LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize) -{ - DWORD dwReturn; - FileStructW *pFileStructW = _ILGetFileStructW(pidl); - - TRACE("(%p %p %x)\n", pidl, szOut, uOutSize); - - if (pFileStructW) { - lstrcpynW(szOut, pFileStructW->wszName, uOutSize); - dwReturn = wcslen(pFileStructW->wszName); - } else { - GUID const * riid; - WCHAR szTemp[MAX_PATH]; - LPSTR szSrc; - LPWSTR szSrcW; - dwReturn = 0; - - if (!pidl) - return 0; - - if (szOut) - *szOut = 0; - - if (_ILIsDesktop(pidl)) - { - /* desktop */ - if (HCR_GetClassNameW(CLSID_ShellDesktop, szTemp, MAX_PATH)) - { - if (szOut) - lstrcpynW(szOut, szTemp, uOutSize); - - dwReturn = wcslen (szTemp); - } - } - else if (( szSrcW = _ILGetTextPointerW(pidl) )) - { - /* unicode filesystem */ - if (szOut) - lstrcpynW(szOut, szSrcW, uOutSize); - - dwReturn = wcslen(szSrcW); - } - else if (( szSrc = _ILGetTextPointer(pidl) )) - { - /* filesystem */ - MultiByteToWideChar(CP_ACP, 0, szSrc, -1, szTemp, MAX_PATH); - - if (szOut) - lstrcpynW(szOut, szTemp, uOutSize); - - dwReturn = wcslen (szTemp); - } - else if (( riid = _ILGetGUIDPointer(pidl) )) - { - /* special folder */ - if ( HCR_GetClassNameW(*riid, szTemp, MAX_PATH) ) - { - if (szOut) - lstrcpynW(szOut, szTemp, uOutSize); - - dwReturn = wcslen (szTemp); - } - } - else - { - ERR("-- no text\n"); - } - } - - TRACE("-- (%p=%s 0x%08x)\n", szOut, debugstr_w(szOut), dwReturn); - return dwReturn; -} - -/************************************************************************** - * - * ### 4. getting pointers to parts of pidls ### - * - ************************************************************************** - * _ILGetDataPointer() - */ -LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl) -{ - if(pidl && pidl->mkid.cb != 0x00) - return (LPPIDLDATA)pidl->mkid.abID; - return NULL; -} - -/************************************************************************** - * _ILGetTextPointerW() - * gets a pointer to the unicode long filename string stored in the pidl - */ -static LPWSTR _ILGetTextPointerW(LPCITEMIDLIST pidl) -{ - /* TRACE(pidl,"(pidl%p)\n", pidl);*/ - - LPPIDLDATA pdata = _ILGetDataPointer(pidl); - - if (!pdata) - return NULL; - - switch (pdata->type) - { - case PT_GUID: - case PT_SHELLEXT: - case PT_YAGUID: - return NULL; - - case PT_DRIVE: - case PT_DRIVE1: - case PT_DRIVE2: - case PT_DRIVE3: - /*return (LPSTR)&(pdata->u.drive.szDriveName);*/ - return NULL; - - case PT_FOLDER: - case PT_FOLDER1: - case PT_VALUE: - case PT_IESPECIAL1: - case PT_IESPECIAL2: - /*return (LPSTR)&(pdata->u.file.szNames);*/ - return NULL; - - case PT_WORKGRP: - case PT_COMP: - case PT_NETWORK: - case PT_NETPROVIDER: - case PT_SHARE: - /*return (LPSTR)&(pdata->u.network.szNames);*/ - return NULL; - - case PT_VALUEW: - return (LPWSTR)pdata->u.file.szNames; - } - return NULL; -} - - -/************************************************************************** - * _ILGetTextPointer() - * gets a pointer to the long filename string stored in the pidl - */ -LPSTR _ILGetTextPointer(LPCITEMIDLIST pidl) -{ - /* TRACE(pidl,"(pidl%p)\n", pidl);*/ - - LPPIDLDATA pdata = _ILGetDataPointer(pidl); - - if (!pdata) - return NULL; - - switch (pdata->type) - { - case PT_GUID: - case PT_SHELLEXT: - case PT_YAGUID: - return NULL; - - case PT_DRIVE: - case PT_DRIVE1: - case PT_DRIVE2: - case PT_DRIVE3: - return pdata->u.drive.szDriveName; - - case PT_FOLDER: - case PT_FOLDER1: - case PT_VALUE: - case PT_IESPECIAL1: - case PT_IESPECIAL2: - return pdata->u.file.szNames; - - case PT_WORKGRP: - case PT_COMP: - case PT_NETWORK: - case PT_NETPROVIDER: - case PT_SHARE: - return pdata->u.network.szNames; - - case PT_CPLAPPLET: - return pdata->u.cpanel.szName; - } - return NULL; -} - -/************************************************************************** - * _ILGetSTextPointer() - * gets a pointer to the short filename string stored in the pidl - */ -static LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl) -{ - /* TRACE(pidl,"(pidl%p)\n", pidl); */ - - LPPIDLDATA pdata = _ILGetDataPointer(pidl); - - if (!pdata) - return NULL; - - switch (pdata->type) - { - case PT_FOLDER: - case PT_VALUE: - case PT_IESPECIAL1: - case PT_IESPECIAL2: - return pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1; - - case PT_WORKGRP: - return pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1; - } - return NULL; -} - -/************************************************************************** - * _ILGetGUIDPointer() - * - * returns reference to guid stored in some pidls - */ -IID* _ILGetGUIDPointer(LPCITEMIDLIST pidl) -{ - LPPIDLDATA pdata = _ILGetDataPointer(pidl); - - TRACE("%p\n", pidl); - - if (!pdata) - return NULL; - - TRACE("pdata->type 0x%04x\n", pdata->type); - switch (pdata->type) - { - case PT_SHELLEXT: - case PT_GUID: - case PT_YAGUID: - return &(pdata->u.guid.guid); - - default: - TRACE("Unknown pidl type 0x%04x\n", pdata->type); - break; - } - return NULL; -} - -/****************************************************************************** - * _ILGetFileStructW [Internal] - * - * Get pointer the a SHITEMID's FileStructW field if present - * - * PARAMS - * pidl [I] The SHITEMID - * - * RETURNS - * Success: Pointer to pidl's FileStructW field. - * Failure: NULL - */ -FileStructW* _ILGetFileStructW(LPCITEMIDLIST pidl) { - FileStructW *pFileStructW; - WORD cbOffset; - - if (!(_ILIsValue(pidl) || _ILIsFolder(pidl))) - return NULL; - - cbOffset = *(const WORD *)((const BYTE *)pidl + pidl->mkid.cb - sizeof(WORD)); - pFileStructW = (FileStructW*)((LPBYTE)pidl + cbOffset); - - /* Currently I don't see a fool prove way to figure out if a pidl is for sure of WinXP - * style with a FileStructW member. If we switch all our shellfolder-implementations to - * the new format, this won't be a problem. For now, we do as many sanity checks as possible. */ - if (cbOffset & 0x1 || /* FileStructW member is word aligned in the pidl */ - /* FileStructW is positioned after FileStruct */ - cbOffset < sizeof(pidl->mkid.cb) + sizeof(PIDLTYPE) + sizeof(FileStruct) || - /* There has to be enough space at cbOffset in the pidl to hold FileStructW and cbOffset */ - cbOffset > pidl->mkid.cb - sizeof(cbOffset) - sizeof(FileStructW) || - pidl->mkid.cb != cbOffset + pFileStructW->cbLen) - { - ERR("Invalid pidl format (cbOffset = %d)!\n", cbOffset); - return NULL; - } - - return pFileStructW; -} - -/************************************************************************* - * _ILGetFileDateTime - * - * Given the ItemIdList, get the FileTime - * - * PARAMS - * pidl [I] The ItemIDList - * pFt [I] the resulted FILETIME of the file - * - * RETURNS - * True if Successful - * - * NOTES - * - */ -BOOL _ILGetFileDateTime(LPCITEMIDLIST pidl, FILETIME *pFt) -{ - LPPIDLDATA pdata = _ILGetDataPointer(pidl); - - if (!pdata) - return FALSE; - - switch (pdata->type) - { - case PT_FOLDER: - case PT_VALUE: - DosDateTimeToFileTime(pdata->u.file.uFileDate, pdata->u.file.uFileTime, pFt); - break; - default: - return FALSE; - } - return TRUE; -} - -BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) -{ - FILETIME ft, lft; - SYSTEMTIME time; - BOOL ret; - - if (_ILGetFileDateTime( pidl, &ft )) - { - FileTimeToLocalFileTime(&ft, &lft); - FileTimeToSystemTime (&lft, &time); - - ret = GetDateFormatA(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, pOut, uOutSize); - if (ret) - { - /* Append space + time without seconds */ - pOut[ret-1] = ' '; - GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &time, NULL, &pOut[ret], uOutSize - ret); - } - } - else - { - pOut[0] = '\0'; - ret = FALSE; - } - return ret; -} - -/************************************************************************* - * _ILGetFileSize - * - * Given the ItemIdList, get the FileSize - * - * PARAMS - * pidl [I] The ItemIDList - * pOut [I] The buffer to save the result - * uOutsize [I] The size of the buffer - * - * RETURNS - * The FileSize - * - * NOTES - * pOut can be null when no string is needed - * - */ -DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) -{ - LPPIDLDATA pdata = _ILGetDataPointer(pidl); - DWORD dwSize; - - if (!pdata) - return 0; - - switch (pdata->type) - { - case PT_VALUE: - dwSize = pdata->u.file.dwFileSize; - if (pOut) - StrFormatKBSizeA(dwSize, pOut, uOutSize); - return dwSize; - } - if (pOut) - *pOut = 0x00; - return 0; -} - -BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) -{ - char szTemp[MAX_PATH]; - const char * pPoint; - LPCITEMIDLIST pidlTemp = pidl; - - TRACE("pidl=%p\n", pidl); - - if (!pidl) - return FALSE; - - pidlTemp = ILFindLastID(pidl); - - if (!_ILIsValue(pidlTemp)) - return FALSE; - if (!_ILSimpleGetText(pidlTemp, szTemp, MAX_PATH)) - return FALSE; - - pPoint = PathFindExtensionA(szTemp); - - if (!*pPoint) - return FALSE; - - pPoint++; - lstrcpynA(pOut, pPoint, uOutSize); - TRACE("%s\n", pOut); - - return TRUE; -} - -/************************************************************************* - * _ILGetFileType - * - * Given the ItemIdList, get the file type description - * - * PARAMS - * pidl [I] The ItemIDList (simple) - * pOut [I] The buffer to save the result - * uOutsize [I] The size of the buffer - * - * RETURNS - * nothing - * - * NOTES - * This function copies as much as possible into the buffer. - */ -void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) -{ - char sType[64]; - - if(_ILIsValue(pidl)) - { - char sTemp[64]; - - if(uOutSize > 0) - pOut[0] = 0; - if (_ILGetExtension (pidl, sType, 64)) - { - if (HCR_MapTypeToValueA(sType, sTemp, 64, TRUE)) - { - /* retrieve description */ - if(HCR_MapTypeToValueA(sTemp, pOut, uOutSize, FALSE )) - return; - } - /* display Ext-file as description */ - strcpy(pOut, sType); - _strupr(pOut); - /* load localized file string */ - sTemp[0] = '\0'; - if(LoadStringA(shell32_hInstance, IDS_SHV_COLUMN1, sTemp, 64)) - { - sTemp[63] = '\0'; - strcat(pOut, "-"); - strcat(pOut, sTemp); - } - } - } - else - { - pOut[0] = '\0'; - LoadStringA(shell32_hInstance, IDS_DIRECTORY, pOut, uOutSize); - /* make sure its null terminated */ - pOut[uOutSize-1] = '\0'; - } -} - -/************************************************************************* - * _ILGetFileAttributes - * - * Given the ItemIdList, get the Attrib string format - * - * PARAMS - * pidl [I] The ItemIDList - * pOut [I] The buffer to save the result - * uOutsize [I] The size of the Buffer - * - * RETURNS - * Attributes - * - * FIXME - * return value 0 in case of error is a valid return value - * - */ -DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) -{ - LPPIDLDATA pData = _ILGetDataPointer(pidl); - WORD wAttrib = 0; - int i; - - if (!pData) - return 0; - - switch(pData->type) - { - case PT_FOLDER: - case PT_VALUE: - wAttrib = pData->u.file.uFileAttribs; - break; - } - - if(uOutSize >= 6) - { - i = 0; - if(wAttrib & FILE_ATTRIBUTE_READONLY) - pOut[i++] = 'R'; - if(wAttrib & FILE_ATTRIBUTE_HIDDEN) - pOut[i++] = 'H'; - if(wAttrib & FILE_ATTRIBUTE_SYSTEM) - pOut[i++] = 'S'; - if(wAttrib & FILE_ATTRIBUTE_ARCHIVE) - pOut[i++] = 'A'; - if(wAttrib & FILE_ATTRIBUTE_COMPRESSED) - pOut[i++] = 'C'; - pOut[i] = 0x00; - } - return wAttrib; -} - -/************************************************************************* - * ILFreeaPidl - * - * free a aPidl struct - */ -void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl) -{ - UINT i; - - if (apidl) - { - for (i = 0; i < cidl; i++) - SHFree(apidl[i]); - SHFree(apidl); - } -} - -/************************************************************************* - * ILCopyaPidl - * - * copies an aPidl struct - */ -LPITEMIDLIST* _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl) -{ - UINT i; - LPITEMIDLIST *apidldest; - - apidldest = (LPITEMIDLIST *)SHAlloc(cidl * sizeof(LPITEMIDLIST)); - if (!apidlsrc) - return NULL; - - for (i = 0; i < cidl; i++) - apidldest[i] = ILClone(apidlsrc[i]); - - return apidldest; -} - -/************************************************************************* - * _ILCopyCidaToaPidl - * - * creates aPidl from CIDA - */ -LPITEMIDLIST* _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, const CIDA * cida) -{ - UINT i; - LPITEMIDLIST *dst; - - dst = (LPITEMIDLIST *)SHAlloc(cida->cidl * sizeof(LPITEMIDLIST)); - if (!dst) - return NULL; - - if (pidl) - *pidl = ILClone((LPCITEMIDLIST)(&((const BYTE*)cida)[cida->aoffset[0]])); - - for (i = 0; i < cida->cidl; i++) - dst[i] = ILClone((LPCITEMIDLIST)(&((const BYTE*)cida)[cida->aoffset[i + 1]])); - - return dst; -} Removed: branches/shell-experiments/dll/win32/shell32/pidl.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/pidl.h [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/pidl.h (removed) @@ -1,312 +0,0 @@ -/* - * internal pidl functions - * - * Copyright 1998 Juergen Schmied - * Copyright 2004 Juan Lang - * - * 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 - * - * NOTES: - * - * DO NOT use this definitions outside the shell32.dll ! - * - * The contents of a pidl should never used from a application - * directly. - * - * Undocumented: - * MS says: the abID of SHITEMID should be treated as binary data and not - * be interpreted by applications. Applies to everyone but MS itself. - * Word95 interprets the contents of abID (Filesize/Date) so we have to go - * for binary compatibility here. - */ - -#ifndef __WINE_PIDL_H -#define __WINE_PIDL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* -* the pidl does cache fileattributes to speed up SHGetAttributes when -* displaying a big number of files. -* -* a pidl of NULL means the desktop -* -* The structure of the pidl seems to be a union. The first byte of the -* PIDLDATA describes the type of pidl. -* -* object ! first byte / ! format ! living space -* ! size -* ---------------------------------------------------------------- -* my computer 0x1F/20 guid (2) (usual) -* network 0x1F guid -* bitbucket 0x1F guid -* drive 0x23/25 drive (usual) -* drive 0x25/25 drive (lnk/persistent) -* drive 0x29/25 drive -* shell extension 0x2E guid -* drive 0x2F drive (lnk/persistent) -* folder/file 0x30 folder/file (1) (lnk/persistent) -* folder 0x31 folder (usual) -* valueA 0x32 file (ANSI file name) -* valueW 0x34 file (Unicode file name) -* workgroup 0x41 network (3) -* computer 0x42 network (4) -* net provider 0x46 network -* whole network 0x47 network (5) -* MSITStore 0x61 htmlhlp (7) -* printers/ras connections 0x70 guid -* history/favorites 0xb1 file -* share 0xc3 network (6) -* -* guess: the persistent elements are non tracking -* -* (1) dummy byte is used, attributes are empty -* (2) IID_MyComputer = 20D04FE0L-3AEA-1069-A2D8-08002B30309D -* (3) two strings "workgroup" "Microsoft Network" -* (4) two strings "\\sirius" "Microsoft Network" -* (5) one string "Entire Network" -* (6) two strings "\\sirius\c" "Microsoft Network" -* (7) contains string "mk:@MSITStore:C:\path\file.chm::/path/filename.htm" -* GUID 871C5380-42A0-1069-A2EA-08002B30309D -*/ - -#define PT_CPLAPPLET 0x00 -#define PT_GUID 0x1F -#define PT_DRIVE 0x23 -#define PT_DRIVE2 0x25 -#define PT_DRIVE3 0x29 -#define PT_SHELLEXT 0x2E -#define PT_DRIVE1 0x2F -#define PT_FOLDER1 0x30 -#define PT_FOLDER 0x31 -#define PT_VALUE 0x32 -#define PT_VALUEW 0x34 -#define PT_WORKGRP 0x41 -#define PT_COMP 0x42 -#define PT_NETPROVIDER 0x46 -#define PT_NETWORK 0x47 -#define PT_IESPECIAL1 0x61 -#define PT_YAGUID 0x70 /* yet another guid.. */ -#define PT_CPEXT 0x71 -#define PT_IESPECIAL2 0xb1 -#define PT_SHARE 0xc3 - -#include "pshpack1.h" -typedef BYTE PIDLTYPE; - -typedef struct tagPIDLCPanelStruct -{ - BYTE dummy; /*01 is 0x00 */ - DWORD iconIdx; /*02 negative icon ID */ - WORD offsDispName; /*06*/ - WORD offsComment; /*08*/ - CHAR szName[1]; /*10*/ /* terminated by 0x00, followed by display name and comment string */ -} PIDLCPanelStruct; - -typedef struct tagPIDLFontStruct -{ - BYTE dummy; - WORD offsFile; - WCHAR szName[1]; -} PIDLFontStruct; - -typedef struct tagPIDLPrinterStruct -{ - BYTE dummy; - DWORD Attributes; - WORD offsServer; - WCHAR szName[1]; -} PIDLPrinterStruct; - -typedef struct tagPIDLRecycleStruct -{ - FILETIME LastModification; - FILETIME DeletionTime; - ULARGE_INTEGER FileSize; - ULARGE_INTEGER PhysicalFileSize; - DWORD Attributes; - WCHAR szName[1]; -} PIDLRecycleStruct; - -typedef struct tagGUIDStruct -{ - BYTE dummy; /* offset 01 is unknown */ - GUID guid; /* offset 02 */ -} GUIDStruct; - -typedef struct tagDriveStruct -{ - CHAR szDriveName[20]; /*01*/ - WORD unknown; /*21*/ -} DriveStruct; - -typedef struct tagFileStruct -{ - BYTE dummy; /*01 is 0x00 for files or dirs */ - DWORD dwFileSize; /*02*/ - WORD uFileDate; /*06*/ - WORD uFileTime; /*08*/ - WORD uFileAttribs; /*10*/ - CHAR szNames[1]; /*12*/ - /* Here are coming two strings. The first is the long name. - The second the dos name when needed or just 0x00 */ -} FileStruct; - -/* At least on WinXP, this struct is appended with 2-byte-alignment to FileStruct. There follows - * a WORD member after the wszName string, which gives the offset from the beginning of the PIDL - * to the FileStructW member. */ -typedef struct tagFileStructW { - WORD cbLen; - BYTE dummy1[6]; - WORD uCreationDate; - WORD uCreationTime; - WORD uLastAccessDate; - WORD uLastAccessTime; - BYTE dummy2[4]; - WCHAR wszName[1]; -} FileStructW; - -typedef struct tagValueW -{ - WCHAR name[1]; -} ValueWStruct; - -typedef struct tagPIDLDATA -{ PIDLTYPE type; /*00*/ - union - { - struct tagGUIDStruct guid; - struct tagDriveStruct drive; - struct tagFileStruct file; - struct - { WORD dummy; /*01*/ - CHAR szNames[1]; /*03*/ - } network; - struct - { WORD dummy; /*01*/ - DWORD dummy1; /*02*/ - CHAR szName[1]; /*06*/ /* terminated by 0x00 0x00 */ - } htmlhelp; - struct tagPIDLCPanelStruct cpanel; - struct tagValueW valueW; - struct tagPIDLFontStruct cfont; - struct tagPIDLPrinterStruct cprinter; - struct tagPIDLRecycleStruct crecycle; - } u; -} PIDLDATA, *LPPIDLDATA; -#include "poppack.h" - -/* - * getting special values from simple pidls - */ -DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); -DWORD _ILSimpleGetTextW (LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize); -BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); -DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); -BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); -void _ILGetFileType (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); -DWORD _ILGetFileAttributes (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize); - -BOOL _ILGetFileDateTime (LPCITEMIDLIST pidl, FILETIME *ft); -DWORD _ILGetDrive (LPCITEMIDLIST, LPSTR, UINT); - -/* - * testing simple pidls - */ -BOOL _ILIsUnicode (LPCITEMIDLIST pidl); -BOOL _ILIsDesktop (LPCITEMIDLIST pidl); -BOOL _ILIsMyComputer (LPCITEMIDLIST pidl); -BOOL _ILIsPrinter (LPCITEMIDLIST pidl); -BOOL _ILIsMyDocuments (LPCITEMIDLIST pidl); -BOOL _ILIsControlPanel (LPCITEMIDLIST pidl); -BOOL _ILIsBitBucket (LPCITEMIDLIST pidl); -BOOL _ILIsAdminTools (LPCITEMIDLIST pidl); -BOOL _ILIsNetHood (LPCITEMIDLIST pidl); -BOOL _ILIsDrive (LPCITEMIDLIST pidl); -BOOL _ILIsFolder (LPCITEMIDLIST pidl); -BOOL _ILIsValue (LPCITEMIDLIST pidl); -BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl); -BOOL _ILIsPidlSimple (LPCITEMIDLIST pidl); -BOOL _ILIsCPanelStruct (LPCITEMIDLIST pidl); -static __inline -BOOL _ILIsEqualSimple (LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB) -{ - return (pidlA->mkid.cb > 0 && !memcmp(pidlA, pidlB, pidlA->mkid.cb)) || - (!pidlA->mkid.cb && !pidlB->mkid.cb); -} -static __inline -BOOL _ILIsEmpty (LPCITEMIDLIST pidl) { return _ILIsDesktop(pidl); } - -/* - * simple pidls - */ - -/* Creates a PIDL with guid format and type type, which must be one of PT_GUID, - * PT_SHELLEXT, or PT_YAGUID. - */ -LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid); - -/* Like _ILCreateGuid, but using the string szGUID. */ -LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID); -LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID); - -/* Commonly used PIDLs representing file system objects. */ -LPITEMIDLIST _ILCreateDesktop (void); -LPITEMIDLIST _ILCreateFromFindDataW(const WIN32_FIND_DATAW *stffile); -HRESULT _ILCreateFromPathW (LPCWSTR szPath, LPITEMIDLIST* ppidl); - -/* Other helpers */ -LPITEMIDLIST _ILCreateMyComputer (void); -LPITEMIDLIST _ILCreateMyDocuments (void); -LPITEMIDLIST _ILCreateIExplore (void); -LPITEMIDLIST _ILCreateControlPanel (void); -LPITEMIDLIST _ILCreatePrinters (void); -LPITEMIDLIST _ILCreateNetwork (void); -LPITEMIDLIST _ILCreateNetHood (void); -LPITEMIDLIST _ILCreateAdminTools (void); -LPITEMIDLIST _ILCreateFont (void); -LPITEMIDLIST _ILCreateBitBucket (void); -LPITEMIDLIST _ILCreateDrive (LPCWSTR); - -/* - * helper functions (getting struct-pointer) - */ -LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST); -LPSTR _ILGetTextPointer (LPCITEMIDLIST); -IID *_ILGetGUIDPointer (LPCITEMIDLIST pidl); -FileStructW *_ILGetFileStructW (LPCITEMIDLIST pidl); - -/* - * debug helper - */ -void pdump (LPCITEMIDLIST pidl); -BOOL pcheck (LPCITEMIDLIST pidl); - -/* - * aPidl helper - */ -void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl); -LPITEMIDLIST * _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl); -LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, const CIDA * cida); - -BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* __WINE_PIDL_H */ Modified: branches/shell-experiments/dll/win32/shell32/precomp.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/precomp.h [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/precomp.h [iso-8859-1] Mon Nov 3 19:50:36 2014 @@ -34,7 +34,7 @@ //#include "base/shell/explorer-new/todo.h" //#include "dlgs.h" -#include "pidl.h" +#include "wine/pidl.h" #include "debughlp.h" #include "undocshell.h" #include "wine/shell32_main.h" Copied: branches/shell-experiments/dll/win32/shell32/wine/pidl.c (from r65228, branches/shell-experiments/dll/win32/shell32/pidl.cpp) URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/pidl.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/pidl.c [iso-8859-1] Mon Nov 3 19:50:36 2014 @@ -22,7 +22,25 @@ * */ -#include "precomp.h" +#include <wine/config.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COBJMACROS +#define NONAMELESSUNION +#define NONAMELESSSTRUCT + +#include <windef.h> +#include <winbase.h> +#include <shlobj.h> +#include <undocshell.h> +#include <shlwapi.h> +#include <shlguid_undoc.h> +#include <wine/debug.h> + +#include "pidl.h" +#include "shell32_main.h" +#include "shresdef.h" WINE_DEFAULT_DEBUG_CHANNEL(pidl); WINE_DECLARE_DEBUG_CHANNEL(shell); @@ -70,8 +88,7 @@ BOOL WINAPI ILGetDisplayNameExW(IShellFolder * psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type) { - CComPtr<IShellFolder> psfParent; - CComPtr<IShellFolder> lsf = psf; + LPSHELLFOLDER psfParent, lsf = psf; HRESULT ret = NO_ERROR; LPCITEMIDLIST pidllast; STRRET strret; @@ -109,7 +126,7 @@ } if (!*(const WORD*)pidl || type == ILGDN_FORPARSING) { - ret = lsf->GetDisplayNameOf(pidl, flag, &strret); + ret = IShellFolder_GetDisplayNameOf(lsf, pidl, flag, &strret); if (SUCCEEDED(ret)) { if(!StrRetToStrNW(path, MAX_PATH, &strret, pidl)) @@ -118,10 +135,10 @@ } else { - ret = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psfParent), &pidllast); + ret = SHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidllast); if (SUCCEEDED(ret)) { - ret = psfParent->GetDisplayNameOf(pidllast, flag, &strret); + ret = IShellFolder_GetDisplayNameOf(psfParent, pidllast, flag, &strret); if (SUCCEEDED(ret)) { if(!StrRetToStrNW(path, MAX_PATH, &strret, pidllast)) @@ -273,15 +290,15 @@ SHFree(*ppPidl); *ppPidl = NULL; - pStream->AddRef (); - - if (SUCCEEDED(pStream->Read(&wLen, 2, &dwBytesRead))) + IStream_AddRef (pStream); + + if (SUCCEEDED(IStream_Read(pStream, &wLen, 2, &dwBytesRead))) { TRACE("PIDL length is %d\n", wLen); if (wLen != 0) { - *ppPidl = (LPITEMIDLIST)SHAlloc(wLen); - if (SUCCEEDED(pStream->Read(*ppPidl , wLen, &dwBytesRead))) + *ppPidl = SHAlloc (wLen); + if (SUCCEEDED(IStream_Read(pStream, *ppPidl , wLen, &dwBytesRead))) { TRACE("Stream read OK\n"); ret = S_OK; @@ -308,7 +325,7 @@ *ppPidl = NULL; } - pStream->Release (); + IStream_Release (pStream); TRACE("done\n"); return ret; } @@ -326,16 +343,16 @@ TRACE_(shell)("%p %p\n", pStream, pPidl); - pStream->AddRef (); + IStream_AddRef (pStream); wLen = ILGetSize(pPidl); - if (SUCCEEDED(pStream->Write(&wLen, 2, NULL))) - { - if (SUCCEEDED(pStream->Write(pPidl, wLen, NULL))) + if (SUCCEEDED(IStream_Write(pStream, &wLen, 2, NULL))) + { + if (SUCCEEDED(IStream_Write(pStream, pPidl, wLen, NULL))) ret = S_OK; } - pStream->Release (); + IStream_Release (pStream); return ret; } @@ -371,14 +388,14 @@ HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST * ppidl, DWORD * attributes) { - CComPtr<IShellFolder> sf; + LPSHELLFOLDER sf; DWORD pchEaten; HRESULT ret = E_FAIL; TRACE_(shell)("%s %p 0x%08x\n", debugstr_w(path), ppidl, attributes ? *attributes : 0); if (SUCCEEDED (SHGetDesktopFolder(&sf))) - ret = sf->ParseDisplayName(0, NULL, (LPWSTR)path, &pchEaten, ppidl, attributes); + ret = IShellFolder_ParseDisplayName(sf, 0, NULL, (LPWSTR)path, &pchEaten, ppidl, attributes); return ret; } @@ -681,10 +698,11 @@ */ HRESULT WINAPI SHGetRealIDL(IShellFolder * lpsf, LPCITEMIDLIST pidlSimple, LPITEMIDLIST *pidlReal) { - CComPtr<IDataObject> pDataObj; + IDataObject* pDataObj; HRESULT hr; - hr = lpsf->GetUIObjectOf(0, 1, &pidlSimple, IID_NULL_PPV_ARG(IDataObject, &pDataObj)); + hr = IShellFolder_GetUIObjectOf(lpsf, 0, 1, &pidlSimple, + &IID_IDataObject, 0, (LPVOID*)&pDataObj); if (SUCCEEDED(hr)) { STGMEDIUM medium; @@ -696,12 +714,12 @@ fmt.lindex = -1; fmt.tymed = TYMED_HGLOBAL; - hr = pDataObj->GetData(&fmt, &medium); + hr = IDataObject_GetData(pDataObj, &fmt, &medium); if (SUCCEEDED(hr)) { /*assert(pida->cidl==1);*/ - LPIDA pida = (LPIDA)GlobalLock(medium.hGlobal); + LPIDA pida = (LPIDA)GlobalLock(medium.u.hGlobal); LPCITEMIDLIST pidl_folder = (LPCITEMIDLIST) ((LPBYTE)pida + pida->aoffset[0]); LPCITEMIDLIST pidl_child = (LPCITEMIDLIST) ((LPBYTE)pida + pida->aoffset[1]); @@ -711,8 +729,8 @@ if (!*pidlReal) hr = E_OUTOFMEMORY; - GlobalUnlock(medium.hGlobal); - GlobalFree(medium.hGlobal); + GlobalUnlock(medium.u.hGlobal); + GlobalFree(medium.u.hGlobal); } } @@ -966,8 +984,8 @@ static HRESULT _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile, BOOL bBindCtx, LPITEMIDLIST *ppidl, LPDWORD prgfInOut) { - CComPtr<IShellFolder> pSF; - CComPtr<IBindCtx> pBC; + LPSHELLFOLDER pSF = NULL; + LPBC pBC = NULL; HRESULT ret; TRACE("%s %p %d (%p)->%p (%p)->0x%x\n", debugstr_w(path), lpFindFile, bBindCtx, @@ -983,7 +1001,7 @@ if (SUCCEEDED(ret)) { - ret = pSF->ParseDisplayName(0, pBC, (LPOLESTR)path, NULL, ppidl, prgfInOut); + ret = IShellFolder_ParseDisplayName(pSF, 0, pBC, (LPOLESTR)path, NULL, ppidl, prgfInOut); } if (FAILED(ret) && ppidl) @@ -1209,7 +1227,7 @@ { HRESULT hr; LPCITEMIDLIST pidlLast; - CComPtr<IShellFolder> psfFolder; + LPSHELLFOLDER psfFolder; DWORD dwAttributes; STRRET strret; @@ -1220,7 +1238,7 @@ if (!pidl) return FALSE; - hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psfFolder), &pidlLast); + hr = SHBindToParent(pidl, &IID_IShellFolder, (VOID**)&psfFolder, &pidlLast); if (FAILED(hr)) { ERR("SHBindToParent failed: %x\n", hr); @@ -1228,14 +1246,14 @@ } dwAttributes = SFGAO_FILESYSTEM; - hr = psfFolder->GetAttributesOf(1, &pidlLast, &dwAttributes); + hr = IShellFolder_GetAttributesOf(psfFolder, 1, &pidlLast, &dwAttributes); if (FAILED(hr) || !(dwAttributes & SFGAO_FILESYSTEM)) { WARN("Wrong dwAttributes or GetAttributesOf failed: %x\n", hr); return FALSE; } - hr = psfFolder->GetDisplayNameOf(pidlLast, SHGDN_FORPARSING, &strret); + hr = IShellFolder_GetDisplayNameOf(psfFolder, pidlLast, SHGDN_FORPARSING, &strret); if (FAILED(hr)) return FALSE; hr = StrRetToBufW(&strret, pidlLast, pszPath, MAX_PATH); @@ -1249,8 +1267,8 @@ */ HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast) { - CComPtr<IShellFolder> psfDesktop; - HRESULT hr = E_FAIL; + IShellFolder * psfDesktop; + HRESULT hr=E_FAIL; TRACE_(shell)("pidl=%p\n", pidl); pdump(pidl); @@ -1269,13 +1287,13 @@ if (_ILIsPidlSimple(pidl)) { /* we are on desktop level */ - hr = psfDesktop->QueryInterface(riid, ppv); + hr = IShellFolder_QueryInterface(psfDesktop, riid, ppv); } else { LPITEMIDLIST pidlParent = ILClone(pidl); ILRemoveLastID(pidlParent); - hr = psfDesktop->BindToObject(pidlParent, NULL, riid, ppv); + hr = IShellFolder_BindToObject(psfDesktop, pidlParent, NULL, riid, ppv); SHFree (pidlParent); } @@ -1341,29 +1359,29 @@ LPITEMIDLIST _ILCreateMyComputer(void) { TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_MyComputer); + return _ILCreateGuid(PT_GUID, &CLSID_MyComputer); } LPITEMIDLIST _ILCreateMyDocuments(void) { TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_MyDocuments); + return _ILCreateGuid(PT_GUID, &CLSID_MyDocuments); } LPITEMIDLIST _ILCreateIExplore(void) { TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_Internet); + return _ILCreateGuid(PT_GUID, &CLSID_Internet); } LPITEMIDLIST _ILCreateControlPanel(void) { - LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, CLSID_MyComputer), ret = NULL; + LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, &CLSID_MyComputer), ret = NULL; TRACE("()\n"); if (parent) { - LPITEMIDLIST cpl = _ILCreateGuid(PT_SHELLEXT, CLSID_ControlPanel); + LPITEMIDLIST cpl = _ILCreateGuid(PT_SHELLEXT, &CLSID_ControlPanel); if (cpl) { @@ -1377,12 +1395,12 @@ LPITEMIDLIST _ILCreatePrinters(void) { - LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, CLSID_MyComputer), ret = NULL; + LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, &CLSID_MyComputer), ret = NULL; TRACE("()\n"); if (parent) { - LPITEMIDLIST printers = _ILCreateGuid(PT_YAGUID, CLSID_Printers); + LPITEMIDLIST printers = _ILCreateGuid(PT_YAGUID, &CLSID_Printers); if (printers) { @@ -1397,19 +1415,19 @@ LPITEMIDLIST _ILCreateNetwork(void) { TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_NetworkPlaces); + return _ILCreateGuid(PT_GUID, &CLSID_NetworkPlaces); } LPITEMIDLIST _ILCreateBitBucket(void) { TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_RecycleBin); + return _ILCreateGuid(PT_GUID, &CLSID_RecycleBin); } LPITEMIDLIST _ILCreateAdminTools(void) { TRACE("()\n"); - return _ILCreateGuid(PT_GUID, CLSID_AdminFolderShortcut); //FIXME + return _ILCreateGuid(PT_GUID, &CLSID_AdminFolderShortcut); //FIXME } LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid) @@ -1423,7 +1441,7 @@ { LPPIDLDATA pData = _ILGetDataPointer(pidlOut); - pData->u.guid.guid = guid; + pData->u.guid.guid = *guid; TRACE("-- create GUID-pidl %s\n", debugstr_guid(&(pData->u.guid.guid))); } @@ -1445,7 +1463,7 @@ ERR("%s is not a GUID\n", szGUID); return NULL; } - return _ILCreateGuid(PT_GUID, iid); + return _ILCreateGuid(PT_GUID, &iid); } LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID) @@ -1457,7 +1475,7 @@ ERR("%s is not a GUID\n", debugstr_w(szGUID)); return NULL; } - return _ILCreateGuid(PT_GUID, iid); + return _ILCreateGuid(PT_GUID, &iid); } LPITEMIDLIST _ILCreateFromFindDataW( const WIN32_FIND_DATAW *wfd ) @@ -1609,7 +1627,7 @@ TRACE("(%p)\n", pidl); if (iid) - return IsEqualIID(*iid, CLSID_MyDocuments); + return IsEqualIID(iid, &CLSID_MyDocuments); return FALSE; } @@ -1620,7 +1638,7 @@ TRACE("(%p)\n", pidl); if (iid) - return IsEqualIID(*iid, CLSID_ControlPanel); + return IsEqualIID(iid, &CLSID_ControlPanel); return FALSE; } @@ -1631,19 +1649,19 @@ TRACE("(%p)\n", pidl); if (iid) - return IsEqualIID(*iid, CLSID_NetworkPlaces); + return IsEqualIID(iid, &CLSID_NetworkPlaces); return FALSE; } LPITEMIDLIST _ILCreateNetHood(void) { - return _ILCreateGuid(PT_GUID, CLSID_NetworkPlaces); + return _ILCreateGuid(PT_GUID, &CLSID_NetworkPlaces); } LPITEMIDLIST _ILCreateFont(void) { - return _ILCreateGuid(PT_GUID, CLSID_FontsFolderShortcut); + return _ILCreateGuid(PT_GUID, &CLSID_FontsFolderShortcut); } BOOL _ILIsMyComputer(LPCITEMIDLIST pidl) @@ -1653,7 +1671,7 @@ TRACE("(%p)\n", pidl); if (iid) - return IsEqualIID(*iid, CLSID_MyComputer); + return IsEqualIID(iid, &CLSID_MyComputer); return FALSE; } @@ -1664,7 +1682,7 @@ TRACE("(%p)\n", pidl); if (iid) - return IsEqualIID(*iid, CLSID_Printers); + return IsEqualIID(iid, &CLSID_Printers); return FALSE; } @@ -1675,7 +1693,7 @@ TRACE("(%p)\n", pidl); if (iid) - return IsEqualIID(*iid, CLSID_RecycleBin); + return IsEqualIID(iid, &CLSID_RecycleBin); return FALSE; } @@ -1686,7 +1704,7 @@ TRACE("(%p)\n", pidl); if (iid) - return IsEqualIID(*iid, CLSID_AdminFolderShortcut); + return IsEqualIID(iid, &CLSID_AdminFolderShortcut); else return FALSE; } @@ -1792,7 +1810,7 @@ if (_ILIsDesktop(pidl)) { /* desktop */ - if (HCR_GetClassNameA(CLSID_ShellDesktop, szTemp, MAX_PATH)) + if (HCR_GetClassNameA(&CLSID_ShellDesktop, szTemp, MAX_PATH)) { if (szOut) lstrcpynA(szOut, szTemp, uOutSize); @@ -1821,7 +1839,7 @@ else if (( riid = _ILGetGUIDPointer(pidl) )) { /* special folder */ - if (HCR_GetClassNameA(*riid, szTemp, MAX_PATH) ) + if (HCR_GetClassNameA(riid, szTemp, MAX_PATH) ) { if (szOut) lstrcpynA(szOut, szTemp, uOutSize); @@ -1871,7 +1889,7 @@ if (_ILIsDesktop(pidl)) { /* desktop */ - if (HCR_GetClassNameW(CLSID_ShellDesktop, szTemp, MAX_PATH)) + if (HCR_GetClassNameW(&CLSID_ShellDesktop, szTemp, MAX_PATH)) { if (szOut) lstrcpynW(szOut, szTemp, uOutSize); @@ -1900,7 +1918,7 @@ else if (( riid = _ILGetGUIDPointer(pidl) )) { /* special folder */ - if ( HCR_GetClassNameW(*riid, szTemp, MAX_PATH) ) + if ( HCR_GetClassNameW(riid, szTemp, MAX_PATH) ) { if (szOut) lstrcpynW(szOut, szTemp, uOutSize);
10 years, 1 month
1
0
0
0
[akhaldi] 65232: [SHELL32] * Move shellreg.cpp to the wine folder. * Rename shellreg.cpp to shellreg.c. * Sync shellreg.c with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Nov 3 19:05:48 2014 New Revision: 65232 URL:
http://svn.reactos.org/svn/reactos?rev=65232&view=rev
Log: [SHELL32] * Move shellreg.cpp to the wine folder. * Rename shellreg.cpp to shellreg.c. * Sync shellreg.c with Wine 1.7.27. CORE-8540 Added: branches/shell-experiments/dll/win32/shell32/wine/shellreg.c - copied, changed from r65228, branches/shell-experiments/dll/win32/shell32/shellreg.cpp Removed: branches/shell-experiments/dll/win32/shell32/shellreg.cpp Modified: branches/shell-experiments/dll/win32/shell32/CMakeLists.txt Modified: branches/shell-experiments/dll/win32/shell32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/CMakeLists.txt [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/CMakeLists.txt [iso-8859-1] Mon Nov 3 19:05:48 2014 @@ -43,7 +43,6 @@ shell32.cpp shellitem.cpp shelllink.cpp - shellreg.cpp folders/desktop.cpp folders/fs.cpp folders/mycomp.cpp @@ -76,6 +75,7 @@ wine/shellole.c wine/shellord.c wine/shellpath.c + wine/shellreg.c wine/shellstring.c wine/shpolicy.c vista.c Removed: branches/shell-experiments/dll/win32/shell32/shellreg.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/shellreg.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/shellreg.cpp (removed) @@ -1,189 +0,0 @@ -/* - * Shell Registry Access - * - * Copyright 2000 Juergen Schmied - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "precomp.h" - -WINE_DEFAULT_DEBUG_CHANNEL(shell); - -/************************************************************************* - * SHRegOpenKeyA [SHELL32.506] - * - */ -EXTERN_C HRESULT WINAPI SHRegOpenKeyA( - HKEY hKey, - LPSTR lpSubKey, - PHKEY phkResult) -{ - TRACE("(%p, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult); - return RegOpenKeyA(hKey, lpSubKey, phkResult); -} - -/************************************************************************* - * SHRegOpenKeyW [SHELL32.507] NT 4.0 - * - */ -EXTERN_C HRESULT WINAPI SHRegOpenKeyW ( - HKEY hkey, - LPCWSTR lpszSubKey, - PHKEY retkey) -{ - WARN("%p %s %p\n",hkey,debugstr_w(lpszSubKey),retkey); - return RegOpenKeyW( hkey, lpszSubKey, retkey ); -} - -/************************************************************************* - * SHRegQueryValueA [SHELL32.508] - * - */ -EXTERN_C HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWORD lpcbValue) -{ - TRACE("(%p %s %p %p)\n", hkey, debugstr_a(lpSubKey), lpValue, lpcbValue); - return RegQueryValueA(hkey, lpSubKey, lpValue, (LONG*)lpcbValue); -} - -/************************************************************************* - * SHRegQueryValueExA [SHELL32.509] - * - */ -EXTERN_C HRESULT WINAPI SHRegQueryValueExA( - HKEY hkey, - LPSTR lpValueName, - LPDWORD lpReserved, - LPDWORD lpType, - LPBYTE lpData, - LPDWORD lpcbData) -{ - TRACE("%p %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); - return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); -} - -/************************************************************************* - * SHRegQueryValueW [SHELL32.510] NT4.0 - * - */ -EXTERN_C HRESULT WINAPI SHRegQueryValueW( - HKEY hkey, - LPWSTR lpszSubKey, - LPWSTR lpszData, - LPDWORD lpcbData ) -{ - WARN("%p %s %p %p semi-stub\n", - hkey, debugstr_w(lpszSubKey), lpszData, lpcbData); - return RegQueryValueW( hkey, lpszSubKey, lpszData, (LONG*)lpcbData ); -} - -/************************************************************************* - * SHRegQueryValueExW [SHELL32.511] NT4.0 - * - * FIXME - * if the datatype REG_EXPAND_SZ then expand the string and change - * *pdwType to REG_SZ. - */ -EXTERN_C HRESULT WINAPI SHRegQueryValueExW ( - HKEY hkey, - LPWSTR pszValue, - LPDWORD pdwReserved, - LPDWORD pdwType, - LPVOID pvData, - LPDWORD pcbData) -{ - DWORD ret; - WARN("%p %s %p %p %p %p semi-stub\n", - hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData); - ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, (LPBYTE)pvData, pcbData); - return ret; -} - -/************************************************************************* - * SHRegDeleteKeyA [SHELL32.?] - */ -HRESULT WINAPI SHRegDeleteKeyA( - HKEY hkey, - LPCSTR pszSubKey) -{ - FIXME("hkey=%p, %s\n", hkey, debugstr_a(pszSubKey)); - return 0; -} - -/************************************************************************* - * SHRegDeleteKeyW [SHELL32.512] - */ -EXTERN_C HRESULT WINAPI SHRegDeleteKeyW( - HKEY hkey, - LPCWSTR pszSubKey) -{ - FIXME("hkey=%p, %s\n", hkey, debugstr_w(pszSubKey)); - return 0; -} - -/************************************************************************* - * SHRegCloseKey [SHELL32.505] NT 4.0 - */ -EXTERN_C HRESULT WINAPI SHRegCloseKey (HKEY hkey) -{ - TRACE("%p\n",hkey); - return RegCloseKey( hkey ); -} - -/************************************************************************* - * SHCreateSessionKey [SHELL32.723] - */ -EXTERN_C HRESULT -WINAPI -SHCreateSessionKey(REGSAM samDesired, PHKEY phKey) -{ - HRESULT hr = S_OK; - static WCHAR wszSessionKey[256]; - LONG Error; - - if (!wszSessionKey[0]) // FIXME: Critical Section - { - HANDLE hToken; - - if (OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken)) - { - TOKEN_STATISTICS Stats; - DWORD ReturnLength; - - if (GetTokenInformation(hToken, TokenStatistics, &Stats, sizeof(Stats), &ReturnLength)) - { - swprintf(wszSessionKey, - L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\%08x%08x", - Stats.AuthenticationId.HighPart, Stats.AuthenticationId.LowPart); - } - else - hr = HRESULT_FROM_WIN32(GetLastError()); - - CloseHandle(hToken); - } - else - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - if(SUCCEEDED(hr)) - { - Error = RegCreateKeyExW(HKEY_LOCAL_MACHINE, wszSessionKey, 0, NULL, - REG_OPTION_VOLATILE, samDesired, NULL, phKey, NULL); - if (Error != ERROR_SUCCESS) - hr = HRESULT_FROM_WIN32(Error); - } - - return hr; -} Copied: branches/shell-experiments/dll/win32/shell32/wine/shellreg.c (from r65228, branches/shell-experiments/dll/win32/shell32/shellreg.cpp) URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/shellreg.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/shellreg.c [iso-8859-1] Mon Nov 3 19:05:48 2014 @@ -18,128 +18,129 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include <wine/config.h> + +#include <stdio.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS + +#include <windef.h> +#include <winbase.h> +#include <shlobj.h> + +#include <wine/debug.h> WINE_DEFAULT_DEBUG_CHANNEL(shell); /************************************************************************* - * SHRegOpenKeyA [SHELL32.506] + * SHRegOpenKeyA [SHELL32.506] * */ -EXTERN_C HRESULT WINAPI SHRegOpenKeyA( - HKEY hKey, - LPSTR lpSubKey, - PHKEY phkResult) +HRESULT WINAPI SHRegOpenKeyA( + HKEY hKey, + LPSTR lpSubKey, + PHKEY phkResult) { - TRACE("(%p, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult); - return RegOpenKeyA(hKey, lpSubKey, phkResult); + TRACE("(%p, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult); + return RegOpenKeyA(hKey, lpSubKey, phkResult); } /************************************************************************* - * SHRegOpenKeyW [SHELL32.507] NT 4.0 + * SHRegOpenKeyW [SHELL32.507] NT 4.0 * */ -EXTERN_C HRESULT WINAPI SHRegOpenKeyW ( - HKEY hkey, - LPCWSTR lpszSubKey, - PHKEY retkey) +HRESULT WINAPI SHRegOpenKeyW ( + HKEY hkey, + LPCWSTR lpszSubKey, + PHKEY retkey) { - WARN("%p %s %p\n",hkey,debugstr_w(lpszSubKey),retkey); - return RegOpenKeyW( hkey, lpszSubKey, retkey ); + WARN("%p %s %p\n",hkey,debugstr_w(lpszSubKey),retkey); + return RegOpenKeyW( hkey, lpszSubKey, retkey ); } /************************************************************************* * SHRegQueryValueA [SHELL32.508] * */ -EXTERN_C HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWORD lpcbValue) +HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWORD lpcbValue) { - TRACE("(%p %s %p %p)\n", hkey, debugstr_a(lpSubKey), lpValue, lpcbValue); - return RegQueryValueA(hkey, lpSubKey, lpValue, (LONG*)lpcbValue); + TRACE("(%p %s %p %p)\n", hkey, debugstr_a(lpSubKey), lpValue, lpcbValue); + return RegQueryValueA(hkey, lpSubKey, lpValue, (LONG*)lpcbValue); } /************************************************************************* * SHRegQueryValueExA [SHELL32.509] * */ -EXTERN_C HRESULT WINAPI SHRegQueryValueExA( - HKEY hkey, - LPSTR lpValueName, - LPDWORD lpReserved, - LPDWORD lpType, - LPBYTE lpData, - LPDWORD lpcbData) +HRESULT WINAPI SHRegQueryValueExA( + HKEY hkey, + LPSTR lpValueName, + LPDWORD lpReserved, + LPDWORD lpType, + LPBYTE lpData, + LPDWORD lpcbData) { - TRACE("%p %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); - return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); + TRACE("%p %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); + return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); } /************************************************************************* - * SHRegQueryValueW [SHELL32.510] NT4.0 + * SHRegQueryValueW [SHELL32.510] NT4.0 * */ -EXTERN_C HRESULT WINAPI SHRegQueryValueW( - HKEY hkey, - LPWSTR lpszSubKey, - LPWSTR lpszData, - LPDWORD lpcbData ) +HRESULT WINAPI SHRegQueryValueW( + HKEY hkey, + LPWSTR lpszSubKey, + LPWSTR lpszData, + LPDWORD lpcbData ) { - WARN("%p %s %p %p semi-stub\n", - hkey, debugstr_w(lpszSubKey), lpszData, lpcbData); - return RegQueryValueW( hkey, lpszSubKey, lpszData, (LONG*)lpcbData ); + WARN("%p %s %p %p semi-stub\n", + hkey, debugstr_w(lpszSubKey), lpszData, lpcbData); + return RegQueryValueW( hkey, lpszSubKey, lpszData, (LONG*)lpcbData ); } /************************************************************************* - * SHRegQueryValueExW [SHELL32.511] NT4.0 + * SHRegQueryValueExW [SHELL32.511] NT4.0 * * FIXME * if the datatype REG_EXPAND_SZ then expand the string and change * *pdwType to REG_SZ. */ -EXTERN_C HRESULT WINAPI SHRegQueryValueExW ( - HKEY hkey, - LPWSTR pszValue, - LPDWORD pdwReserved, - LPDWORD pdwType, - LPVOID pvData, - LPDWORD pcbData) +HRESULT WINAPI SHRegQueryValueExW ( + HKEY hkey, + LPWSTR pszValue, + LPDWORD pdwReserved, + LPDWORD pdwType, + LPVOID pvData, + LPDWORD pcbData) { - DWORD ret; - WARN("%p %s %p %p %p %p semi-stub\n", - hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData); - ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, (LPBYTE)pvData, pcbData); - return ret; -} - -/************************************************************************* - * SHRegDeleteKeyA [SHELL32.?] - */ -HRESULT WINAPI SHRegDeleteKeyA( - HKEY hkey, - LPCSTR pszSubKey) -{ - FIXME("hkey=%p, %s\n", hkey, debugstr_a(pszSubKey)); - return 0; + DWORD ret; + WARN("%p %s %p %p %p %p semi-stub\n", + hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData); + ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData); + return ret; } /************************************************************************* * SHRegDeleteKeyW [SHELL32.512] */ -EXTERN_C HRESULT WINAPI SHRegDeleteKeyW( - HKEY hkey, - LPCWSTR pszSubKey) +HRESULT WINAPI SHRegDeleteKeyW( + HKEY hkey, + LPCWSTR pszSubKey) { - FIXME("hkey=%p, %s\n", hkey, debugstr_w(pszSubKey)); - return 0; + FIXME("hkey=%p, %s\n", hkey, debugstr_w(pszSubKey)); + return 0; } /************************************************************************* - * SHRegCloseKey [SHELL32.505] NT 4.0 + * SHRegCloseKey [SHELL32.505] NT 4.0 + * */ -EXTERN_C HRESULT WINAPI SHRegCloseKey (HKEY hkey) +HRESULT WINAPI SHRegCloseKey (HKEY hkey) { - TRACE("%p\n",hkey); - return RegCloseKey( hkey ); + TRACE("%p\n",hkey); + return RegCloseKey( hkey ); } /*************************************************************************
10 years, 1 month
1
0
0
0
[akhaldi] 65231: [SHELL32] * Another partial sync of shellord.c with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Nov 3 18:53:50 2014 New Revision: 65231 URL:
http://svn.reactos.org/svn/reactos?rev=65231&view=rev
Log: [SHELL32] * Another partial sync of shellord.c with Wine 1.7.27. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/wine/shellord.c Modified: branches/shell-experiments/dll/win32/shell32/wine/shellord.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/shellord.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/shellord.c [iso-8859-1] Mon Nov 3 18:53:50 2014 @@ -63,12 +63,11 @@ #define MRUF_BINARY_LIST 1 /* list will contain binary data */ #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */ -VOID WINAPI FreeMRUList(HANDLE); - -EXTERN_C HANDLE WINAPI CreateMRUListA(LPCREATEMRULISTA lpcml); -EXTERN_C INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData); -EXTERN_C INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum); -EXTERN_C INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize); +extern HANDLE WINAPI CreateMRUListA(LPCREATEMRULISTA lpcml); +extern VOID WINAPI FreeMRUList(HANDLE hMRUList); +extern INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData); +extern INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum); +extern INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize); /* Get a function pointer from a DLL handle */ @@ -152,11 +151,11 @@ /************************************************************************* * ParseField [SHELL32.58] */ -EXTERN_C DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len) +DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len) { if (SHELL_OsIsUnicode()) - return ParseFieldW((LPCWSTR)src, nField, (LPWSTR)dst, len); - return ParseFieldA((LPCSTR)src, nField, (LPSTR)dst, len); + return ParseFieldW(src, nField, dst, len); + return ParseFieldA(src, nField, dst, len); } /************************************************************************* @@ -211,7 +210,7 @@ /************************************************************************* * SHGetSetSettings [SHELL32.68] */ -EXTERN_C VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet) +VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet) { if(bSet) { @@ -231,7 +230,7 @@ * and possibly are the same in nt40 * */ -EXTERN_C VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask) +VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask) { HKEY hKey; DWORD dwData; @@ -345,7 +344,7 @@ * ordinal. If you change the implementation here please update the code in * shlwapi as well. */ -EXTERN_C int ShellMessageBoxW( +int ShellMessageBoxW( HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText, @@ -356,10 +355,10 @@ WCHAR szText[100],szTitle[100]; LPCWSTR pszText = szText, pszTitle = szTitle; LPWSTR pszTemp; - va_list args; + __ms_va_list args; int ret; - va_start(args, uType); + __ms_va_start(args, uType); /* wvsprintfA(buf,fmt, args); */ TRACE("(%p,%p,%p,%p,%08x)\n", @@ -378,7 +377,7 @@ FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args); - va_end(args); + __ms_va_end(args); ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType); LocalFree(pszTemp); @@ -403,7 +402,7 @@ * NOTES * Exported by ordinal */ -EXTERN_C int ShellMessageBoxA( +int ShellMessageBoxA( HINSTANCE hInstance, HWND hWnd, LPCSTR lpText, @@ -414,10 +413,10 @@ char szText[100],szTitle[100]; LPCSTR pszText = szText, pszTitle = szTitle; LPSTR pszTemp; - va_list args; + __ms_va_list args; int ret; - va_start(args, uType); + __ms_va_start(args, uType); /* wvsprintfA(buf,fmt, args); */ TRACE("(%p,%p,%p,%p,%08x)\n", @@ -436,7 +435,7 @@ FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, pszText, 0, 0, (LPSTR)&pszTemp, 0, &args); - va_end(args); + __ms_va_end(args); ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType); LocalFree(pszTemp); @@ -515,7 +514,7 @@ */ HRESULT WINAPI SHDoDragDrop( HWND hWnd, - IDataObject * lpDataObject, + LPDATAOBJECT lpDataObject, LPDROPSOURCE lpDropSource, DWORD dwOKEffect, LPDWORD pdwEffect) @@ -529,12 +528,8 @@ * ArrangeWindows [SHELL32.184] * */ -WORD WINAPI ArrangeWindows( - HWND hwndParent, - DWORD dwReserved, - LPCRECT lpRect, - WORD cKids, - CONST HWND * lpKids) +WORD WINAPI ArrangeWindows(HWND hwndParent, DWORD dwReserved, const RECT *lpRect, + WORD cKids, const HWND *lpKids) { /* Unimplemented in WinXP SP3 */ TRACE("(%p 0x%08x %p 0x%04x %p):stub.\n", @@ -548,12 +543,12 @@ * NOTES * exported by ordinal */ -EXTERN_C BOOL WINAPI -SignalFileOpen (LPCITEMIDLIST pidl) -{ - FIXME("(0x%08x):stub.\n", pidl); - - return 0; +BOOL WINAPI +SignalFileOpen (PCIDLIST_ABSOLUTE pidl) +{ + FIXME("(%p):stub.\n", pidl); + + return FALSE; } /************************************************************************* @@ -611,7 +606,7 @@ */ static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData) { - return lstrcmpiA((LPCSTR)data1, (LPCSTR)data2); + return lstrcmpiA(data1, data2); } /************************************************************************* @@ -765,6 +760,7 @@ link_dir[0] = 0; ERR("serious issues 1\n"); } + IMalloc_Release(ppM); } else { /* serious issues */ @@ -814,15 +810,15 @@ switch (uFlags) { case SHARD_PIDL: - SHGetPathFromIDListA((LPCITEMIDLIST)pv, doc_name); + SHGetPathFromIDListA(pv, doc_name); break; case SHARD_PATHA: - lstrcpynA(doc_name, (LPCSTR)pv, MAX_PATH); + lstrcpynA(doc_name, pv, MAX_PATH); break; case SHARD_PATHW: - WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)pv, -1, doc_name, MAX_PATH, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, pv, -1, doc_name, MAX_PATH, NULL, NULL); break; default: @@ -832,6 +828,7 @@ TRACE("full document name %s\n", debugstr_a(doc_name)); +#ifdef __REACTOS__ /* check if file is a shortcut */ ext = strrchr(doc_name, '.'); if (!lstrcmpiA(ext, ".lnk")) @@ -848,6 +845,7 @@ /* executables are not added */ return; } +#endif PathStripPathA(doc_name); TRACE("stripped document name %s\n", debugstr_a(doc_name)); @@ -978,7 +976,8 @@ (LPVOID )&psl); if(SUCCEEDED(hres)) { - hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile, (LPVOID *)&pPf); + hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile, + (LPVOID *)&pPf); if(FAILED(hres)) { /* bombed */ ERR("failed QueryInterface for IPersistFile %08x\n", hres); @@ -1013,9 +1012,13 @@ if(FAILED(hres)) { /* bombed */ ERR("failed IPersistFile::Save %08x\n", hres); + IPersistFile_Release(pPf); + IShellLinkA_Release(psl); goto fail; } hres = IPersistFile_SaveCompleted(pPf, widelink); + IPersistFile_Release(pPf); + IShellLinkA_Release(psl); TRACE("shortcut %s has been created, result=%08x\n", new_lnk_filepath, hres); } @@ -1062,6 +1065,7 @@ return hRes; hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv); + IShellView_Release(psf); return hRes; } @@ -1069,7 +1073,7 @@ * SHWinHelp [SHELL32.127] * */ -EXTERN_C HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z) +HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z) { FIXME("0x%08x 0x%08x 0x%08x 0x%08x stub\n",v,w,x,z); return 0; } @@ -1077,20 +1081,20 @@ * SHRunControlPanel [SHELL32.161] * */ -EXTERN_C BOOL WINAPI SHRunControlPanel (LPCWSTR lpcszCmdLine, HWND hwndMsgParent) -{ - FIXME("0x%08x 0x%08x stub\n",lpcszCmdLine,hwndMsgParent); - return 0; -} - -static IUnknown * SHELL32_IExplorerInterface=0; +BOOL WINAPI SHRunControlPanel (LPCWSTR commandLine, HWND parent) +{ + FIXME("(%s, %p): stub\n", debugstr_w(commandLine), parent); + return FALSE; +} + +static LPUNKNOWN SHELL32_IExplorerInterface=0; /************************************************************************* * SHSetInstanceExplorer [SHELL32.176] * * NOTES * Sets the interface */ -VOID WINAPI SHSetInstanceExplorer (IUnknown * lpUnknown) +VOID WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown) { TRACE("%p\n", lpUnknown); SHELL32_IExplorerInterface = lpUnknown; } @@ -1289,8 +1293,7 @@ * */ BOOL WINAPI FileIconInit(BOOL bFullInit) -{ - FIXME("(%s)\n", bFullInit ? "true" : "false"); +{ FIXME("(%s)\n", bFullInit ? "true" : "false"); return FALSE; } @@ -1331,7 +1334,7 @@ } } - lpGroups = (PTOKEN_GROUPS)HeapAlloc(GetProcessHeap(), 0, dwSize); + lpGroups = HeapAlloc(GetProcessHeap(), 0, dwSize); if (lpGroups == NULL) { CloseHandle(hToken); @@ -1427,7 +1430,7 @@ /************************************************************************* * SetAppStartingCursor [SHELL32.99] */ -EXTERN_C HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v) +HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v) { FIXME("hwnd=%p 0x%04x stub\n",u,v ); return 0; } @@ -1459,7 +1462,7 @@ * DriveType [SHELL32.64] * */ -EXTERN_C int WINAPI DriveType(int DriveType) +int WINAPI DriveType(int DriveType) { WCHAR root[] = L"A:\\"; root[0] = L'A' + DriveType; @@ -1469,7 +1472,7 @@ * InvalidateDriveType [SHELL32.65] * Unimplemented in XP SP3 */ -EXTERN_C int WINAPI InvalidateDriveType(int u) +int WINAPI InvalidateDriveType(int u) { TRACE("0x%08x stub\n",u); return 0; @@ -1478,7 +1481,7 @@ * SHAbortInvokeCommand [SHELL32.198] * */ -EXTERN_C HRESULT WINAPI SHAbortInvokeCommand(void) +HRESULT WINAPI SHAbortInvokeCommand(void) { FIXME("stub\n"); return 1; } @@ -1498,7 +1501,7 @@ * SHFlushClipboard [SHELL32.121] * */ -EXTERN_C HRESULT WINAPI SHFlushClipboard(void) +HRESULT WINAPI SHFlushClipboard(void) { return OleFlushClipboard(); } @@ -1513,7 +1516,7 @@ DWORD dwTimeout) { FIXME("%p 0x%08x 0x%08x stub\n", pidl, dwFlags, dwTimeout); - return 0; + return FALSE; } /************************************************************************ @@ -1522,19 +1525,18 @@ * NOTES * builds a DPA */ -EXTERN_C DWORD WINAPI RLBuildListOfPaths (void) +DWORD WINAPI RLBuildListOfPaths (void) { FIXME("stub\n"); return 0; } - /************************************************************************ * SHValidateUNC [SHELL32.173] * */ -EXTERN_C BOOL WINAPI SHValidateUNC (HWND hwndOwner, LPWSTR pszFile, UINT fConnect) -{ - FIXME("0x%08x 0x%08x 0x%08x stub\n",hwndOwner,pszFile,fConnect); - return 0; +BOOL WINAPI SHValidateUNC (HWND hwndOwner, PWSTR pszFile, UINT fConnect) +{ + FIXME("(%p, %s, 0x%08x): stub\n", hwndOwner, debugstr_w(pszFile), fConnect); + return FALSE; } /************************************************************************ @@ -1542,7 +1544,7 @@ * * See DoEnvironmentSubstW. */ -EXTERN_C DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString) +DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString) { LPSTR dst; BOOL res = FALSE; @@ -1587,7 +1589,7 @@ * HIWORD: FALSE * LOWORD: provided size of the buffer in characters */ -EXTERN_C DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT cchString) +DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT cchString) { LPWSTR dst; BOOL res = FALSE; @@ -1595,7 +1597,7 @@ TRACE("(%s, %d)\n", debugstr_w(pszString), cchString); - if ((cchString < MAXLONG) && (dst = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(WCHAR)))) + if ((cchString < MAXLONG) && (dst = HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(WCHAR)))) { len = ExpandEnvironmentStringsW(pszString, dst, cchString); /* len includes the terminating 0 */ @@ -1620,8 +1622,8 @@ DWORD WINAPI DoEnvironmentSubstAW(LPVOID x, UINT y) { if (SHELL_OsIsUnicode()) - return DoEnvironmentSubstW((LPWSTR)x, y); - return DoEnvironmentSubstA((LPSTR)x, y); + return DoEnvironmentSubstW(x, y); + return DoEnvironmentSubstA(x, y); } /************************************************************************* @@ -1647,18 +1649,9 @@ /************************************************************************* * PathIsTemporaryW [SHELL32.714] */ -EXTERN_C BOOL WINAPI PathIsTemporaryW(LPWSTR Str) -{ - FIXME("(%s)stub\n", debugstr_w(Str)); - return FALSE; -} - -/************************************************************************* - * PathIsTemporaryA [SHELL32.713] - */ -EXTERN_C BOOL WINAPI PathIsTemporaryA(LPSTR Str) -{ - FIXME("(%s)stub\n", debugstr_a(Str)); +BOOL WINAPI PathIsTemporaryW(LPWSTR Str) +{ + FIXME("(%s)stub\n", debugstr_w(Str)); return FALSE; } @@ -1666,7 +1659,7 @@ { UINT uiCount; UINT uiAllocated; - IShellPropSheetExt *pspsx[0]; + IShellPropSheetExt *pspsx[1]; } PSXA, *PPSXA; typedef struct _PSXA_CALL @@ -1737,7 +1730,7 @@ /************************************************************************* * SHCreatePropSheetExtArrayEx [SHELL32.194] */ -EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj) +HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, LPDATAOBJECT pDataObj) { static const WCHAR szPropSheetSubKey[] = {'s','h','e','l','l','e','x','\\','P','r','o','p','e','r','t','y','S','h','e','e','t','H','a','n','d','l','e','r','s',0}; WCHAR szHandler[64]; @@ -1747,9 +1740,10 @@ CLSID clsid; LONG lRet; DWORD dwIndex; + IShellExtInit *psxi; + IShellPropSheetExt *pspsx; HKEY hkBase, hkPropSheetHandlers; PPSXA psxa = NULL; - HRESULT hr; TRACE("(%p,%s,%u)\n", hKey, debugstr_w(pszSubKey), max_iface); @@ -1766,9 +1760,10 @@ if (lRet == ERROR_SUCCESS) { /* Create and initialize the Property Sheet Extensions Array */ - psxa = (PPSXA)LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, sizeof(PSXA) + max_iface * sizeof(IShellPropSheetExt *)); + psxa = LocalAlloc(LMEM_FIXED, FIELD_OFFSET(PSXA, pspsx[max_iface])); if (psxa) { + ZeroMemory(psxa, FIELD_OFFSET(PSXA, pspsx[max_iface])); psxa->uiAllocated = max_iface; /* Enumerate all subkeys and attempt to load the shell extensions */ @@ -1786,23 +1781,22 @@ lRet = ERROR_SUCCESS; break; } - szHandler[(sizeof(szHandler) / sizeof(szHandler[0])) - 1] = 0; - hr = CLSIDFromString(szHandler, &clsid); - if (FAILED(hr)) + + /* The CLSID is stored either in the key itself or in its default value. */ + if (FAILED(lRet = SHCLSIDFromStringW(szHandler, &clsid))) { dwClsidSize = sizeof(szClsidHandler); if (SHGetValueW(hkPropSheetHandlers, szHandler, NULL, NULL, szClsidHandler, &dwClsidSize) == ERROR_SUCCESS) { + /* Force a NULL-termination and convert the string */ szClsidHandler[(sizeof(szClsidHandler) / sizeof(szClsidHandler[0])) - 1] = 0; - hr = CLSIDFromString(szClsidHandler, &clsid); + lRet = SHCLSIDFromStringW(szClsidHandler, &clsid); } } - if (SUCCEEDED(hr)) + + if (SUCCEEDED(lRet)) { - IShellExtInit *psxi; - IShellPropSheetExt *pspsx; - - /* Attempt to get an IShellPropSheetExt and an IShellExtInit instance. + /* Attempt to get an IShellPropSheetExt and an IShellExtInit instance. Only if both interfaces are supported it's a real shell extension. Then call IShellExtInit's Initialize method. */ if (SUCCEEDED(CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER/* | CLSCTX_NO_CODE_DOWNLOAD */, &IID_IShellPropSheetExt, (LPVOID *)&pspsx))) @@ -1814,7 +1808,14 @@ /* Add the IShellPropSheetExt instance to the array */ psxa->pspsx[psxa->uiCount++] = pspsx; } + else + { + psxi->lpVtbl->Release(psxi); + pspsx->lpVtbl->Release(pspsx); + } } + else + pspsx->lpVtbl->Release(pspsx); } } @@ -1883,7 +1884,7 @@ psxa->pspsx[i]->lpVtbl->Release(psxa->pspsx[i]); } - LocalFree((HLOCAL)psxa); + LocalFree(psxa); } } @@ -1896,7 +1897,7 @@ LPCITEMIDLIST pidlFolder, UINT cpidlFiles, LPCITEMIDLIST *lppidlFiles, - IDataObject **ppdataObject) + LPDATAOBJECT *ppdataObject) { UINT i; HWND hwnd = 0; /*FIXME: who should be hwnd of owner? set to desktop */ @@ -1906,8 +1907,7 @@ if (TRACE_ON(pidl)) { pdump (pidlFolder); - for (i = 0; i < cpidlFiles; i++) - pdump(lppidlFiles[i]); + for (i=0; i<cpidlFiles; i++) pdump (lppidlFiles[i]); } hResult = IDataObject_Constructor(hwnd, pidlFolder, lppidlFiles, cpidlFiles, ppdataObject); return hResult; @@ -1934,33 +1934,9 @@ IEnumFORMATETC_AddRef(pef); hRes = IEnumFORMATETC_QueryInterface(pef, &IID_IEnumFORMATETC, (LPVOID*)ppenumFormatetc); - - return hRes; -} - - -/************************************************************************* - * SHCreateShellFolderView (SHELL32.256) - */ -HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv) -{ - IShellView *psf; - HRESULT hRes; - - *ppsv = NULL; - if (!pcsfv || pcsfv->cbSize != sizeof(*pcsfv)) - return E_INVALIDARG; - - TRACE("sf=%p outer=%p callback=%p\n", - pcsfv->pshf, pcsfv->psvOuter, pcsfv->psfvcb); - - hRes = IShellView_Constructor(pcsfv->pshf, &psf); - if (FAILED(hRes)) - return hRes; - - hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppsv); - - return hRes; + IEnumFORMATETC_Release(pef); + + return hRes; } /************************************************************************* @@ -2095,6 +2071,173 @@ return S_OK; } +/************************************************************************* + * SHSetLocalizedName (SHELL32.@) + */ +HRESULT WINAPI SHSetLocalizedName(LPCWSTR pszPath, LPCWSTR pszResModule, int idsRes) +{ + FIXME("%p, %s, %d - stub\n", pszPath, debugstr_w(pszResModule), idsRes); + + return S_OK; +} + +/************************************************************************* + * LinkWindow_RegisterClass (SHELL32.258) + */ +BOOL WINAPI LinkWindow_RegisterClass(void) +{ + FIXME("()\n"); + return TRUE; +} + +/************************************************************************* + * LinkWindow_UnregisterClass (SHELL32.259) + */ +BOOL WINAPI LinkWindow_UnregisterClass(void) +{ + FIXME("()\n"); + return TRUE; +} + +/************************************************************************* + * SHFlushSFCache (SHELL32.526) + * + * Notifies the shell that a user-specified special folder location has changed. + * + * NOTES + * In Wine, the shell folder registry values are not cached, so this function + * has no effect. + */ +void WINAPI SHFlushSFCache(void) +{ +} + +/************************************************************************* + * SHGetImageList (SHELL32.727) + * + * Returns a copy of a shell image list. + * + * NOTES + * Windows XP features 4 sizes of image list, and Vista 5. Wine currently + * only supports the traditional small and large image lists, so requests + * for the others will currently fail. + */ +HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv) +{ + HIMAGELIST hLarge, hSmall; + HIMAGELIST hNew; + HRESULT ret = E_FAIL; + + /* Wine currently only maintains large and small image lists */ + if ((iImageList != SHIL_LARGE) && (iImageList != SHIL_SMALL) && (iImageList != SHIL_SYSSMALL)) + { + FIXME("Unsupported image list %i requested\n", iImageList); + return E_FAIL; + } + + Shell_GetImageLists(&hLarge, &hSmall); +#ifndef __REACTOS__ + hNew = ImageList_Duplicate(iImageList == SHIL_LARGE ? hLarge : hSmall); + + /* Get the interface for the new image list */ + if (hNew) + { + ret = HIMAGELIST_QueryInterface(hNew, riid, ppv); + ImageList_Destroy(hNew); + } +#else + /* Duplicating the imagelist causes the start menu items not to draw on + * the first show. Was the Duplicate necessary for some reason? I believe + * Windows returns the raw pointer here. */ + hNew = (iImageList == SHIL_LARGE ? hLarge : hSmall); + ret = IImageList2_QueryInterface((IImageList2 *) hNew, riid, ppv); +#endif + + return ret; +} + +/************************************************************************* + * SHCreateShellFolderView [SHELL32.256] + * + * Create a new instance of the default Shell folder view object. + * + * RETURNS + * Success: S_OK + * Failure: error value + * + * NOTES + * see IShellFolder::CreateViewObject + */ +HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, + IShellView **ppsv) +{ + IShellView * psf; + HRESULT hRes; + + *ppsv = NULL; + if (!pcsfv || pcsfv->cbSize != sizeof(*pcsfv)) + return E_INVALIDARG; + + TRACE("sf=%p outer=%p callback=%p\n", + pcsfv->pshf, pcsfv->psvOuter, pcsfv->psfvcb); + + hRes = IShellView_Constructor(pcsfv->pshf, &psf); + if (FAILED(hRes)) + return hRes; + + hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppsv); + IShellView_Release(psf); + + return hRes; +} + +/************************************************************************* + * PathIsTemporaryA [SHELL32.713] + */ +BOOL WINAPI PathIsTemporaryA(LPSTR Str) +{ + FIXME("(%s)stub\n", debugstr_a(Str)); + return FALSE; +} + +/************************************************************************* + * SHParseDisplayName [shell version 6.0] + */ +HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, + LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut) +{ + IShellFolder *psfDesktop; + HRESULT hr=E_FAIL; + ULONG dwAttr=sfgaoIn; + + if(!ppidl) + return E_INVALIDARG; + + if (!pszName || !psfgaoOut) + { + *ppidl = NULL; + return E_INVALIDARG; + } + + hr = SHGetDesktopFolder(&psfDesktop); + if (FAILED(hr)) + { + *ppidl = NULL; + return hr; + } + + hr = IShellFolder_ParseDisplayName(psfDesktop, (HWND)NULL, pbc, (LPOLESTR)pszName, (ULONG *)NULL, ppidl, &dwAttr); + + IShellFolder_Release(psfDesktop); + + if (SUCCEEDED(hr)) + *psfgaoOut = dwAttr; + else + *ppidl = NULL; + + return hr; +} + /************************************************************************* * SHEmptyRecycleBinA (SHELL32.@) */ @@ -2225,126 +2368,3 @@ return S_OK; } - -/************************************************************************* - * SHSetLocalizedName (SHELL32.@) - */ -EXTERN_C HRESULT WINAPI SHSetLocalizedName(LPCWSTR pszPath, LPCWSTR pszResModule, int idsRes) -{ - FIXME("%p, %s, %d - stub\n", pszPath, debugstr_w(pszResModule), idsRes); - - return S_OK; -} - -/************************************************************************* - * LinkWindow_RegisterClass (SHELL32.258) - */ -EXTERN_C BOOL WINAPI LinkWindow_RegisterClass(void) -{ - FIXME("()\n"); - return TRUE; -} - -/************************************************************************* - * LinkWindow_UnregisterClass (SHELL32.259) - */ -EXTERN_C BOOL WINAPI LinkWindow_UnregisterClass(void) -{ - FIXME("()\n"); - return TRUE; -} - -/************************************************************************* - * SHFlushSFCache (SHELL32.526) - * - * Notifies the shell that a user-specified special folder location has changed. - * - * NOTES - * In Wine, the shell folder registry values are not cached, so this function - * has no effect. - */ -EXTERN_C void WINAPI SHFlushSFCache(void) -{ -} - -/************************************************************************* - * SHGetImageList (SHELL32.727) - * - * Returns a copy of a shell image list. - * - * NOTES - * Windows XP features 4 sizes of image list, and Vista 5. Wine currently - * only supports the traditional small and large image lists, so requests - * for the others will currently fail. - */ -EXTERN_C HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv) -{ - HIMAGELIST hLarge, hSmall; - HIMAGELIST hNew; - HRESULT ret = E_FAIL; - - /* Wine currently only maintains large and small image lists */ - if ((iImageList != SHIL_LARGE) && (iImageList != SHIL_SMALL) && (iImageList != SHIL_SYSSMALL)) - { - FIXME("Unsupported image list %i requested\n", iImageList); - return E_FAIL; - } - - Shell_GetImageLists(&hLarge, &hSmall); -#ifndef __REACTOS__ - hNew = ImageList_Duplicate(iImageList == SHIL_LARGE ? hLarge : hSmall); - - /* Get the interface for the new image list */ - if (hNew) - { - ret = HIMAGELIST_QueryInterface(hNew, riid, ppv); - ImageList_Destroy(hNew); - } -#else - /* Duplicating the imagelist causes the start menu items not to draw on - * the first show. Was the Duplicate necessary for some reason? I believe - * Windows returns the raw pointer here. */ - hNew = (iImageList == SHIL_LARGE ? hLarge : hSmall); - ret = IImageList2_QueryInterface((IImageList2 *) hNew, riid, ppv); -#endif - - return ret; -} - -/************************************************************************* - * SHParseDisplayName [shell version 6.0] - */ -EXTERN_C HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, - LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut) -{ - IShellFolder *psfDesktop; - HRESULT hr=E_FAIL; - ULONG dwAttr=sfgaoIn; - - if(!ppidl) - return E_INVALIDARG; - - if (!pszName || !psfgaoOut) - { - *ppidl = NULL; - return E_INVALIDARG; - } - - hr = SHGetDesktopFolder(&psfDesktop); - if (FAILED(hr)) - { - *ppidl = NULL; - return hr; - } - - hr = IShellFolder_ParseDisplayName(psfDesktop, (HWND)NULL, pbc, (LPOLESTR)pszName, (ULONG *)NULL, ppidl, &dwAttr); - - IShellFolder_Release(psfDesktop); - - if (SUCCEEDED(hr)) - *psfgaoOut = dwAttr; - else - *ppidl = NULL; - - return hr; -}
10 years, 1 month
1
0
0
0
[akhaldi] 65230: [SHELL32] * Partial sync of shellord.c with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Nov 3 18:21:49 2014 New Revision: 65230 URL:
http://svn.reactos.org/svn/reactos?rev=65230&view=rev
Log: [SHELL32] * Partial sync of shellord.c with Wine 1.7.27. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/wine/shellord.c Modified: branches/shell-experiments/dll/win32/shell32/wine/shellord.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/shellord.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/shellord.c [iso-8859-1] Mon Nov 3 18:21:49 2014 @@ -84,42 +84,43 @@ /* Function pointers for GET_FUNC macro */ static HMODULE SHELL32_hshlwapi=NULL; -/************************************************************************* - * ParseFieldA [internal] + +/************************************************************************* + * ParseFieldA [internal] * * copies a field from a ',' delimited string * * first field is nField = 1 */ DWORD WINAPI ParseFieldA( - LPCSTR src, - DWORD nField, - LPSTR dst, - DWORD len) -{ - WARN("(%s,0x%08x,%p,%d) semi-stub.\n",debugstr_a(src),nField,dst,len); - - if (!src || !src[0] || !dst || !len) - return 0; - - /* skip n fields delimited by ',' */ - while (nField > 1) - { - if (*src=='\0') return FALSE; - if (*(src++)==',') nField--; - } - - /* copy part till the next ',' to dst */ - while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++); - - /* finalize the string */ - *dst=0x0; - - return TRUE; -} - -/************************************************************************* - * ParseFieldW [internal] + LPCSTR src, + DWORD nField, + LPSTR dst, + DWORD len) +{ + WARN("(%s,0x%08x,%p,%d) semi-stub.\n",debugstr_a(src),nField,dst,len); + + if (!src || !src[0] || !dst || !len) + return 0; + + /* skip n fields delimited by ',' */ + while (nField > 1) + { + if (*src=='\0') return FALSE; + if (*(src++)==',') nField--; + } + + /* copy part till the next ',' to dst */ + while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++); + + /* finalize the string */ + *dst=0x0; + + return TRUE; +} + +/************************************************************************* + * ParseFieldW [internal] * * copies a field from a ',' delimited string * @@ -127,33 +128,33 @@ */ DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) { - WARN("(%s,0x%08x,%p,%d) semi-stub.\n", debugstr_w(src), nField, dst, len); - - if (!src || !src[0] || !dst || !len) - return 0; - - /* skip n fields delimited by ',' */ - while (nField > 1) - { - if (*src == 0x0) return FALSE; - if (*src++ == ',') nField--; - } - - /* copy part till the next ',' to dst */ - while ( *src != 0x0 && *src != ',' && (len--)>0 ) *(dst++) = *(src++); - - /* finalize the string */ - *dst = 0x0; - - return TRUE; -} - -/************************************************************************* - * ParseField [SHELL32.58] + WARN("(%s,0x%08x,%p,%d) semi-stub.\n", debugstr_w(src), nField, dst, len); + + if (!src || !src[0] || !dst || !len) + return 0; + + /* skip n fields delimited by ',' */ + while (nField > 1) + { + if (*src == 0x0) return FALSE; + if (*src++ == ',') nField--; + } + + /* copy part till the next ',' to dst */ + while ( *src != 0x0 && *src != ',' && (len--)>0 ) *(dst++) = *(src++); + + /* finalize the string */ + *dst = 0x0; + + return TRUE; +} + +/************************************************************************* + * ParseField [SHELL32.58] */ EXTERN_C DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len) { - if (SHELL_OsIsUnicode()) + if (SHELL_OsIsUnicode()) return ParseFieldW((LPCWSTR)src, nField, (LPWSTR)dst, len); return ParseFieldA((LPCSTR)src, nField, (LPSTR)dst, len); } @@ -208,7 +209,7 @@ } /************************************************************************* - * SHGetSetSettings [SHELL32.68] + * SHGetSetSettings [SHELL32.68] */ EXTERN_C VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet) { @@ -223,7 +224,7 @@ } /************************************************************************* - * SHGetSettings [SHELL32.@] + * SHGetSettings [SHELL32.@] * * NOTES * the registry path are for win98 (tested) @@ -232,55 +233,55 @@ */ EXTERN_C VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask) { - HKEY hKey; - DWORD dwData; - DWORD dwDataSize = sizeof (DWORD); - - TRACE("(%p 0x%08x)\n",lpsfs,dwMask); - - if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", - 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) - return; - - if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1); - - if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1); - - if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1); - - if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1); - - if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1); - - if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1); - - if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - { if (dwData == 0) - { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0; - if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0; - } - else if (dwData == 1) - { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1; - if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0; - } - else if (dwData == 2) - { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0; - if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1; - } - } - RegCloseKey (hKey); - - TRACE("-- 0x%04x\n", *(WORD*)lpsfs); -} - -/************************************************************************* - * SHShellFolderView_Message [SHELL32.73] + HKEY hKey; + DWORD dwData; + DWORD dwDataSize = sizeof (DWORD); + + TRACE("(%p 0x%08x)\n",lpsfs,dwMask); + + if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", + 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) + return; + + if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize)) + lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1); + + if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize)) + lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1); + + if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize)) + lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1); + + if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize)) + lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1); + + if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize)) + lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1); + + if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize)) + lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1); + + if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize)) + { if (dwData == 0) + { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0; + if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0; + } + else if (dwData == 1) + { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1; + if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0; + } + else if (dwData == 2) + { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0; + if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1; + } + } + RegCloseKey (hKey); + + TRACE("-- 0x%04x\n", *(WORD*)lpsfs); +} + +/************************************************************************* + * SHShellFolderView_Message [SHELL32.73] * * Send a message to an explorer cabinet window. * @@ -300,16 +301,16 @@ * that was clicked. */ LRESULT WINAPI SHShellFolderView_Message( - HWND hwndCabinet, - UINT uMessage, - LPARAM lParam) -{ - FIXME("%p %08x %08lx stub\n",hwndCabinet, uMessage, lParam); - return 0; -} - -/************************************************************************* - * RegisterShellHook [SHELL32.181] + HWND hwndCabinet, + UINT uMessage, + LPARAM lParam) +{ + FIXME("%p %08x %08lx stub\n",hwndCabinet, uMessage, lParam); + return 0; +} + +/************************************************************************* + * RegisterShellHook [SHELL32.181] * * Register a shell hook. * @@ -321,8 +322,8 @@ * Exported by ordinal */ BOOL WINAPI RegisterShellHook( - HWND hWnd, - DWORD dwType) + HWND hWnd, + DWORD dwType) { if (dwType == 3) return RegisterShellHookWindow(hWnd); @@ -334,7 +335,7 @@ } /************************************************************************* - * ShellMessageBoxW [SHELL32.182] + * ShellMessageBoxW [SHELL32.182] * * See ShellMessageBoxA. * @@ -345,47 +346,47 @@ * shlwapi as well. */ EXTERN_C int ShellMessageBoxW( - HINSTANCE hInstance, - HWND hWnd, - LPCWSTR lpText, - LPCWSTR lpCaption, - UINT uType, - ...) -{ - WCHAR szText[100],szTitle[100]; - LPCWSTR pszText = szText, pszTitle = szTitle; - LPWSTR pszTemp; + HINSTANCE hInstance, + HWND hWnd, + LPCWSTR lpText, + LPCWSTR lpCaption, + UINT uType, + ...) +{ + WCHAR szText[100],szTitle[100]; + LPCWSTR pszText = szText, pszTitle = szTitle; + LPWSTR pszTemp; va_list args; - int ret; + int ret; va_start(args, uType); - /* wvsprintfA(buf,fmt, args); */ - - TRACE("(%p,%p,%p,%p,%08x)\n", - hInstance,hWnd,lpText,lpCaption,uType); - - if (IS_INTRESOURCE(lpCaption)) - LoadStringW(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)/sizeof(szTitle[0])); - else - pszTitle = lpCaption; - - if (IS_INTRESOURCE(lpText)) - LoadStringW(hInstance, LOWORD(lpText), szText, sizeof(szText)/sizeof(szText[0])); - else - pszText = lpText; - - FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, - pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args); + /* wvsprintfA(buf,fmt, args); */ + + TRACE("(%p,%p,%p,%p,%08x)\n", + hInstance,hWnd,lpText,lpCaption,uType); + + if (IS_INTRESOURCE(lpCaption)) + LoadStringW(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)/sizeof(szTitle[0])); + else + pszTitle = lpCaption; + + if (IS_INTRESOURCE(lpText)) + LoadStringW(hInstance, LOWORD(lpText), szText, sizeof(szText)/sizeof(szText[0])); + else + pszText = lpText; + + FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, + pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args); va_end(args); - ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType); - LocalFree(pszTemp); - return ret; -} - -/************************************************************************* - * ShellMessageBoxA [SHELL32.183] + ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType); + LocalFree(pszTemp); + return ret; +} + +/************************************************************************* + * ShellMessageBoxA [SHELL32.183] * * Format and output an error message. * @@ -403,43 +404,43 @@ * Exported by ordinal */ EXTERN_C int ShellMessageBoxA( - HINSTANCE hInstance, - HWND hWnd, - LPCSTR lpText, - LPCSTR lpCaption, - UINT uType, - ...) -{ - char szText[100],szTitle[100]; - LPCSTR pszText = szText, pszTitle = szTitle; - LPSTR pszTemp; + HINSTANCE hInstance, + HWND hWnd, + LPCSTR lpText, + LPCSTR lpCaption, + UINT uType, + ...) +{ + char szText[100],szTitle[100]; + LPCSTR pszText = szText, pszTitle = szTitle; + LPSTR pszTemp; va_list args; - int ret; + int ret; va_start(args, uType); - /* wvsprintfA(buf,fmt, args); */ - - TRACE("(%p,%p,%p,%p,%08x)\n", - hInstance,hWnd,lpText,lpCaption,uType); - - if (IS_INTRESOURCE(lpCaption)) - LoadStringA(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)); - else - pszTitle = lpCaption; - - if (IS_INTRESOURCE(lpText)) - LoadStringA(hInstance, LOWORD(lpText), szText, sizeof(szText)); - else - pszText = lpText; - - FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, - pszText, 0, 0, (LPSTR)&pszTemp, 0, &args); + /* wvsprintfA(buf,fmt, args); */ + + TRACE("(%p,%p,%p,%p,%08x)\n", + hInstance,hWnd,lpText,lpCaption,uType); + + if (IS_INTRESOURCE(lpCaption)) + LoadStringA(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)); + else + pszTitle = lpCaption; + + if (IS_INTRESOURCE(lpText)) + LoadStringA(hInstance, LOWORD(lpText), szText, sizeof(szText)); + else + pszText = lpText; + + FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, + pszText, 0, 0, (LPSTR)&pszTemp, 0, &args); va_end(args); - ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType); - LocalFree(pszTemp); - return ret; + ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType); + LocalFree(pszTemp); + return ret; } /************************************************************************* @@ -500,7 +501,7 @@ } /************************************************************************* - * SHDoDragDrop [SHELL32.88] + * SHDoDragDrop [SHELL32.88] * * Probably equivalent to DoDragDrop but under Windows 9x it could use the * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE @@ -513,19 +514,19 @@ * DoDragDrop, SHLoadOLE */ HRESULT WINAPI SHDoDragDrop( - HWND hWnd, + HWND hWnd, IDataObject * lpDataObject, - LPDROPSOURCE lpDropSource, - DWORD dwOKEffect, - LPDWORD pdwEffect) + LPDROPSOURCE lpDropSource, + DWORD dwOKEffect, + LPDWORD pdwEffect) { FIXME("(%p %p %p 0x%08x %p):stub.\n", - hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect); - return DoDragDrop(lpDataObject, lpDropSource, dwOKEffect, pdwEffect); -} - -/************************************************************************* - * ArrangeWindows [SHELL32.184] + hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect); + return DoDragDrop(lpDataObject, lpDropSource, dwOKEffect, pdwEffect); +} + +/************************************************************************* + * ArrangeWindows [SHELL32.184] * */ WORD WINAPI ArrangeWindows( @@ -537,12 +538,12 @@ { /* Unimplemented in WinXP SP3 */ TRACE("(%p 0x%08x %p 0x%04x %p):stub.\n", - hwndParent, dwReserved, lpRect, cKids, lpKids); + hwndParent, dwReserved, lpRect, cKids, lpKids); return 0; } /************************************************************************* - * SignalFileOpen [SHELL32.103] + * SignalFileOpen [SHELL32.103] * * NOTES * exported by ordinal @@ -576,17 +577,17 @@ /* Get the key for the policies location in the registry */ if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, - "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", - 0, KEY_READ, &Policy_basekey)) { - - if (RegOpenKeyExA(HKEY_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", - 0, KEY_READ, &Policy_basekey)) { - TRACE("No Explorer Policies location exists. Policy wanted=%s\n", - policy); - *len = 0; - return ERROR_FILE_NOT_FOUND; - } + "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", + 0, KEY_READ, &Policy_basekey)) { + + if (RegOpenKeyExA(HKEY_CURRENT_USER, + "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", + 0, KEY_READ, &Policy_basekey)) { + TRACE("No Explorer Policies location exists. Policy wanted=%s\n", + policy); + *len = 0; + return ERROR_FILE_NOT_FOUND; + } } /* Retrieve the data if it exists @@ -643,7 +644,7 @@ */ /* Create the MRU data structure for "RecentDocs" - */ + */ ptr = buffer; lstrcpyA(ptr, doc_name); ptr += (lstrlenA(buffer) + 1); @@ -666,7 +667,7 @@ } /************************************************************************* - * SHAddToRecentDocs [SHELL32.@] + * SHAddToRecentDocs [SHELL32.@] * * Modify (add/clear) Shell's list of recently used documents. * @@ -721,21 +722,21 @@ datalen = 64; ret=SHADD_get_policy( "NoRecentDocsHistory", &type, data, &datalen); if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) { - ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret); - return; + ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret); + return; } if (ret == ERROR_SUCCESS) { - if (!( (type == REG_DWORD) || - ((type == REG_BINARY) && (datalen == 4)) )) { - ERR("Error policy data for \"NoRecentDocsHistory\" not formatted correctly, type=%d, len=%d\n", - type, datalen); - return; - } - - TRACE("policy value for NoRecentDocsHistory = %08x\n", data[0]); - /* now test the actual policy value */ - if ( data[0] != 0) - return; + if (!( (type == REG_DWORD) || + ((type == REG_BINARY) && (datalen == 4)) )) { + ERR("Error policy data for \"NoRecentDocsHistory\" not formatted correctly, type=%d, len=%d\n", + type, datalen); + return; + } + + TRACE("policy value for NoRecentDocsHistory = %08x\n", data[0]); + /* now test the actual policy value */ + if ( data[0] != 0) + return; } /* Open key to where the necessary info is @@ -745,59 +746,59 @@ * key is stored in the DLL global data. */ if (RegCreateKeyExA(HKEY_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer", - 0, 0, 0, KEY_READ, 0, &HCUbasekey, 0)) { - ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n"); - return; + "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer", + 0, 0, 0, KEY_READ, 0, &HCUbasekey, 0)) { + ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n"); + return; } /* Get path to user's "Recent" directory */ if(SUCCEEDED(SHGetMalloc(&ppM))) { - if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT, - &pidl))) { - SHGetPathFromIDListA(pidl, link_dir); - IMalloc_Free(ppM, pidl); + if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT, + &pidl))) { + SHGetPathFromIDListA(pidl, link_dir); + IMalloc_Free(ppM, pidl); + } + else { + /* serious issues */ + link_dir[0] = 0; + ERR("serious issues 1\n"); + } } else { - /* serious issues */ - link_dir[0] = 0; - ERR("serious issues 1\n"); - } - } - else { - /* serious issues */ - link_dir[0] = 0; - ERR("serious issues 2\n"); + /* serious issues */ + link_dir[0] = 0; + ERR("serious issues 2\n"); } TRACE("Users Recent dir %s\n", link_dir); /* If no input, then go clear the lists */ if (!pv) { - /* clear user's Recent dir - */ - - /* FIXME: delete all files in "link_dir" - * - * while( more files ) { - * lstrcpyA(old_lnk_name, link_dir); - * PathAppendA(old_lnk_name, filenam); - * DeleteFileA(old_lnk_name); - * } - */ - FIXME("should delete all files in %s\\\n", link_dir); - - /* clear MRU list - */ - /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against - * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer - * and naturally it fails w/ rc=2. It should do it against - * HKEY_CURRENT_USER which is where it is stored, and where - * the MRU routines expect it!!!! - */ - RegDeleteKeyA(HCUbasekey, "RecentDocs"); - RegCloseKey(HCUbasekey); - return; + /* clear user's Recent dir + */ + + /* FIXME: delete all files in "link_dir" + * + * while( more files ) { + * lstrcpyA(old_lnk_name, link_dir); + * PathAppendA(old_lnk_name, filenam); + * DeleteFileA(old_lnk_name); + * } + */ + FIXME("should delete all files in %s\\\n", link_dir); + + /* clear MRU list + */ + /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against + * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer + * and naturally it fails w/ rc=2. It should do it against + * HKEY_CURRENT_USER which is where it is stored, and where + * the MRU routines expect it!!!! + */ + RegDeleteKeyA(HCUbasekey, "RecentDocs"); + RegCloseKey(HCUbasekey); + return; } /* Have data to add, the jobs to be done: @@ -855,172 +856,172 @@ /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */ { /* on input needs: - * doc_name - pure file-spec, no path - * link_dir - path to the user's Recent directory - * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node - * creates: - * new_lnk_name- pure file-spec, no path for new .lnk file - * new_lnk_filepath - * - path and file name of new .lnk file - */ - CREATEMRULISTA mymru; - HANDLE mruhandle; - INT len, pos, bufused, err; - INT i; - DWORD attr; - CHAR buffer[2048]; - CHAR *ptr; - CHAR old_lnk_name[MAX_PATH]; - short int slen; - - mymru.cbSize = sizeof(CREATEMRULISTA); - mymru.nMaxItems = 15; - mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE; - mymru.hKey = HCUbasekey; - mymru.lpszSubKey = "RecentDocs"; - mymru.lpfnCompare = SHADD_compare_mru; - mruhandle = CreateMRUListA(&mymru); - if (!mruhandle) { - /* MRU failed */ - ERR("MRU processing failed, handle zero\n"); - RegCloseKey(HCUbasekey); - return; - } - len = lstrlenA(doc_name); - pos = FindMRUData(mruhandle, doc_name, len, 0); - - /* Now get the MRU entry that will be replaced - * and delete the .lnk file for it - */ - if ((bufused = EnumMRUListA(mruhandle, (pos == -1) ? 14 : pos, + * doc_name - pure file-spec, no path + * link_dir - path to the user's Recent directory + * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node + * creates: + * new_lnk_name- pure file-spec, no path for new .lnk file + * new_lnk_filepath + * - path and file name of new .lnk file + */ + CREATEMRULISTA mymru; + HANDLE mruhandle; + INT len, pos, bufused, err; + INT i; + DWORD attr; + CHAR buffer[2048]; + CHAR *ptr; + CHAR old_lnk_name[MAX_PATH]; + short int slen; + + mymru.cbSize = sizeof(CREATEMRULISTA); + mymru.nMaxItems = 15; + mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE; + mymru.hKey = HCUbasekey; + mymru.lpszSubKey = "RecentDocs"; + mymru.lpfnCompare = SHADD_compare_mru; + mruhandle = CreateMRUListA(&mymru); + if (!mruhandle) { + /* MRU failed */ + ERR("MRU processing failed, handle zero\n"); + RegCloseKey(HCUbasekey); + return; + } + len = lstrlenA(doc_name); + pos = FindMRUData(mruhandle, doc_name, len, 0); + + /* Now get the MRU entry that will be replaced + * and delete the .lnk file for it + */ + if ((bufused = EnumMRUListA(mruhandle, (pos == -1) ? 14 : pos, buffer, 2048)) != -1) { - ptr = buffer; - ptr += (lstrlenA(buffer) + 1); - slen = *((short int*)ptr); - ptr += 2; /* skip the length area */ - if (bufused >= slen + (ptr-buffer)) { - /* buffer size looks good */ - ptr += 12; /* get to string */ - len = bufused - (ptr-buffer); /* get length of buf remaining */ - if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) { - /* appears to be good string */ - lstrcpyA(old_lnk_name, link_dir); - PathAppendA(old_lnk_name, ptr); - if (!DeleteFileA(old_lnk_name)) { - if ((attr = GetFileAttributesA(old_lnk_name)) == INVALID_FILE_ATTRIBUTES) { - if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) { - ERR("Delete for %s failed, err=%d, attr=%08x\n", - old_lnk_name, err, attr); - } - else { - TRACE("old .lnk file %s did not exist\n", - old_lnk_name); - } - } - else { - ERR("Delete for %s failed, attr=%08x\n", - old_lnk_name, attr); - } - } - else { - TRACE("deleted old .lnk file %s\n", old_lnk_name); - } - } - } - } - - /* Create usable .lnk file name for the "Recent" directory - */ - wsprintfA(new_lnk_name, "%s.lnk", doc_name); - lstrcpyA(new_lnk_filepath, link_dir); - PathAppendA(new_lnk_filepath, new_lnk_name); - i = 1; - olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS); - while (GetFileAttributesA(new_lnk_filepath) != INVALID_FILE_ATTRIBUTES) { - i++; - wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i); - lstrcpyA(new_lnk_filepath, link_dir); - PathAppendA(new_lnk_filepath, new_lnk_name); - } - SetErrorMode(olderrormode); - TRACE("new shortcut will be %s\n", new_lnk_filepath); - - /* Now add the new MRU entry and data - */ - pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name, - buffer, &len); - FreeMRUList(mruhandle); - TRACE("Updated MRU list, new doc is position %d\n", pos); + ptr = buffer; + ptr += (lstrlenA(buffer) + 1); + slen = *((short int*)ptr); + ptr += 2; /* skip the length area */ + if (bufused >= slen + (ptr-buffer)) { + /* buffer size looks good */ + ptr += 12; /* get to string */ + len = bufused - (ptr-buffer); /* get length of buf remaining */ + if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) { + /* appears to be good string */ + lstrcpyA(old_lnk_name, link_dir); + PathAppendA(old_lnk_name, ptr); + if (!DeleteFileA(old_lnk_name)) { + if ((attr = GetFileAttributesA(old_lnk_name)) == INVALID_FILE_ATTRIBUTES) { + if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) { + ERR("Delete for %s failed, err=%d, attr=%08x\n", + old_lnk_name, err, attr); + } + else { + TRACE("old .lnk file %s did not exist\n", + old_lnk_name); + } + } + else { + ERR("Delete for %s failed, attr=%08x\n", + old_lnk_name, attr); + } + } + else { + TRACE("deleted old .lnk file %s\n", old_lnk_name); + } + } + } + } + + /* Create usable .lnk file name for the "Recent" directory + */ + wsprintfA(new_lnk_name, "%s.lnk", doc_name); + lstrcpyA(new_lnk_filepath, link_dir); + PathAppendA(new_lnk_filepath, new_lnk_name); + i = 1; + olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS); + while (GetFileAttributesA(new_lnk_filepath) != INVALID_FILE_ATTRIBUTES) { + i++; + wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i); + lstrcpyA(new_lnk_filepath, link_dir); + PathAppendA(new_lnk_filepath, new_lnk_name); + } + SetErrorMode(olderrormode); + TRACE("new shortcut will be %s\n", new_lnk_filepath); + + /* Now add the new MRU entry and data + */ + pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name, + buffer, &len); + FreeMRUList(mruhandle); + TRACE("Updated MRU list, new doc is position %d\n", pos); } /* *** JOB 2: Create shortcut in user's "Recent" directory *** */ { /* on input needs: - * doc_name - pure file-spec, no path - * new_lnk_filepath - * - path and file name of new .lnk file - * uFlags[in] - flags on call to SHAddToRecentDocs - * pv[in] - document path/pidl on call to SHAddToRecentDocs - */ - IShellLinkA *psl = NULL; - IPersistFile *pPf = NULL; - HRESULT hres; - CHAR desc[MAX_PATH]; - WCHAR widelink[MAX_PATH]; - - CoInitialize(0); - - hres = CoCreateInstance(&CLSID_ShellLink, - NULL, - CLSCTX_INPROC_SERVER, - &IID_IShellLinkA, - (LPVOID )&psl); - if(SUCCEEDED(hres)) { + * doc_name - pure file-spec, no path + * new_lnk_filepath + * - path and file name of new .lnk file + * uFlags[in] - flags on call to SHAddToRecentDocs + * pv[in] - document path/pidl on call to SHAddToRecentDocs + */ + IShellLinkA *psl = NULL; + IPersistFile *pPf = NULL; + HRESULT hres; + CHAR desc[MAX_PATH]; + WCHAR widelink[MAX_PATH]; + + CoInitialize(0); + + hres = CoCreateInstance( &CLSID_ShellLink, + NULL, + CLSCTX_INPROC_SERVER, + &IID_IShellLinkA, + (LPVOID )&psl); + if(SUCCEEDED(hres)) { hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile, (LPVOID *)&pPf); - if(FAILED(hres)) { - /* bombed */ - ERR("failed QueryInterface for IPersistFile %08x\n", hres); - goto fail; - } - - /* Set the document path or pidl */ - if (uFlags == SHARD_PIDL) { - hres = IShellLinkA_SetIDList(psl, pv); - } else { - hres = IShellLinkA_SetPath(psl, pv); - } - if(FAILED(hres)) { - /* bombed */ - ERR("failed Set{IDList|Path} %08x\n", hres); - goto fail; - } - - lstrcpyA(desc, "Shortcut to "); - lstrcatA(desc, doc_name); - hres = IShellLinkA_SetDescription(psl, desc); - if(FAILED(hres)) { - /* bombed */ - ERR("failed SetDescription %08x\n", hres); - goto fail; - } - - MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1, - widelink, MAX_PATH); - /* create the short cut */ - hres = IPersistFile_Save(pPf, widelink, TRUE); - if(FAILED(hres)) { - /* bombed */ - ERR("failed IPersistFile::Save %08x\n", hres); - goto fail; - } - hres = IPersistFile_SaveCompleted(pPf, widelink); - TRACE("shortcut %s has been created, result=%08x\n", - new_lnk_filepath, hres); - } - else { - ERR("CoCreateInstance failed, hres=%08x\n", hres); - } + if(FAILED(hres)) { + /* bombed */ + ERR("failed QueryInterface for IPersistFile %08x\n", hres); + goto fail; + } + + /* Set the document path or pidl */ + if (uFlags == SHARD_PIDL) { + hres = IShellLinkA_SetIDList(psl, pv); + } else { + hres = IShellLinkA_SetPath(psl, pv); + } + if(FAILED(hres)) { + /* bombed */ + ERR("failed Set{IDList|Path} %08x\n", hres); + goto fail; + } + + lstrcpyA(desc, "Shortcut to "); + lstrcatA(desc, doc_name); + hres = IShellLinkA_SetDescription(psl, desc); + if(FAILED(hres)) { + /* bombed */ + ERR("failed SetDescription %08x\n", hres); + goto fail; + } + + MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1, + widelink, MAX_PATH); + /* create the short cut */ + hres = IPersistFile_Save(pPf, widelink, TRUE); + if(FAILED(hres)) { + /* bombed */ + ERR("failed IPersistFile::Save %08x\n", hres); + goto fail; + } + hres = IPersistFile_SaveCompleted(pPf, widelink); + TRACE("shortcut %s has been created, result=%08x\n", + new_lnk_filepath, hres); + } + else { + ERR("CoCreateInstance failed, hres=%08x\n", hres); + } } fail: @@ -1032,7 +1033,7 @@ } /************************************************************************* - * SHCreateShellFolderViewEx [SHELL32.174] + * SHCreateShellFolderViewEx [SHELL32.174] * * Create a new instance of the default Shell folder view object. * @@ -1044,32 +1045,33 @@ * see IShellFolder::CreateViewObject */ HRESULT WINAPI SHCreateShellFolderViewEx( - LPCSFV psvcbi, /* [in] shelltemplate struct */ - IShellView **ppv) /* [out] IShellView pointer */ -{ - IShellView * psf; - HRESULT hRes; - - TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n", - psvcbi->pshf, psvcbi->pidl, psvcbi->pfnCallback, - psvcbi->fvm, psvcbi->psvOuter); - - *ppv = NULL; + LPCSFV psvcbi, /* [in] shelltemplate struct */ + IShellView **ppv) /* [out] IShellView pointer */ +{ + IShellView * psf; + HRESULT hRes; + + TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n", + psvcbi->pshf, psvcbi->pidl, psvcbi->pfnCallback, + psvcbi->fvm, psvcbi->psvOuter); + + *ppv = NULL; hRes = IShellView_Constructor(psvcbi->pshf, &psf); + if (FAILED(hRes)) return hRes; - hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv); - - return hRes; -} -/************************************************************************* - * SHWinHelp [SHELL32.127] + hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv); + + return hRes; +} +/************************************************************************* + * SHWinHelp [SHELL32.127] * */ EXTERN_C HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z) -{ FIXME("0x%08x 0x%08x 0x%08x 0x%08x stub\n",v,w,x,z); - return 0; +{ FIXME("0x%08x 0x%08x 0x%08x 0x%08x stub\n",v,w,x,z); + return 0; } /************************************************************************* * SHRunControlPanel [SHELL32.161] @@ -1083,34 +1085,34 @@ static IUnknown * SHELL32_IExplorerInterface=0; /************************************************************************* - * SHSetInstanceExplorer [SHELL32.176] + * SHSetInstanceExplorer [SHELL32.176] * * NOTES * Sets the interface */ VOID WINAPI SHSetInstanceExplorer (IUnknown * lpUnknown) -{ TRACE("%p\n", lpUnknown); - SHELL32_IExplorerInterface = lpUnknown; -} -/************************************************************************* - * SHGetInstanceExplorer [SHELL32.@] +{ TRACE("%p\n", lpUnknown); + SHELL32_IExplorerInterface = lpUnknown; +} +/************************************************************************* + * SHGetInstanceExplorer [SHELL32.@] * * NOTES * gets the interface pointer of the explorer and a reference */ HRESULT WINAPI SHGetInstanceExplorer (IUnknown **lpUnknown) -{ TRACE("%p\n", lpUnknown); - - *lpUnknown = SHELL32_IExplorerInterface; - - if (!SHELL32_IExplorerInterface) - return E_FAIL; - - IUnknown_AddRef(SHELL32_IExplorerInterface); - return S_OK; -} -/************************************************************************* - * SHFreeUnusedLibraries [SHELL32.123] +{ TRACE("%p\n", lpUnknown); + + *lpUnknown = SHELL32_IExplorerInterface; + + if (!SHELL32_IExplorerInterface) + return E_FAIL; + + IUnknown_AddRef(SHELL32_IExplorerInterface); + return S_OK; +} +/************************************************************************* + * SHFreeUnusedLibraries [SHELL32.123] * * Probably equivalent to CoFreeUnusedLibraries but under Windows 9x it could use * the shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE @@ -1124,11 +1126,11 @@ */ void WINAPI SHFreeUnusedLibraries (void) { - FIXME("stub\n"); - CoFreeUnusedLibraries(); -} -/************************************************************************* - * DAD_AutoScroll [SHELL32.129] + FIXME("stub\n"); + CoFreeUnusedLibraries(); +} +/************************************************************************* + * DAD_AutoScroll [SHELL32.129] * */ BOOL WINAPI DAD_AutoScroll(HWND hwnd, AUTO_SCROLL_DATA *samples, const POINT * pt) @@ -1137,7 +1139,7 @@ return FALSE; } /************************************************************************* - * DAD_DragEnter [SHELL32.130] + * DAD_DragEnter [SHELL32.130] * */ BOOL WINAPI DAD_DragEnter(HWND hwnd) @@ -1146,7 +1148,7 @@ return FALSE; } /************************************************************************* - * DAD_DragEnterEx [SHELL32.131] + * DAD_DragEnterEx [SHELL32.131] * */ BOOL WINAPI DAD_DragEnterEx(HWND hwnd, POINT p) @@ -1155,7 +1157,7 @@ return FALSE; } /************************************************************************* - * DAD_DragMove [SHELL32.134] + * DAD_DragMove [SHELL32.134] * */ BOOL WINAPI DAD_DragMove(POINT p) @@ -1164,7 +1166,7 @@ return FALSE; } /************************************************************************* - * DAD_DragLeave [SHELL32.132] + * DAD_DragLeave [SHELL32.132] * */ BOOL WINAPI DAD_DragLeave(VOID) @@ -1173,20 +1175,20 @@ return FALSE; } /************************************************************************* - * DAD_SetDragImage [SHELL32.136] + * DAD_SetDragImage [SHELL32.136] * * NOTES * exported by name */ BOOL WINAPI DAD_SetDragImage( - HIMAGELIST himlTrack, - LPPOINT lppt) + HIMAGELIST himlTrack, + LPPOINT lppt) { FIXME("%p %p stub\n",himlTrack, lppt); - return FALSE; -} -/************************************************************************* - * DAD_ShowDragImage [SHELL32.137] + return FALSE; +} +/************************************************************************* + * DAD_ShowDragImage [SHELL32.137] * * NOTES * exported by name @@ -1209,87 +1211,87 @@ static const WCHAR szwSettings[] = { 'S','e','t','t','i','n','g','s',0 }; /************************************************************************* - * ReadCabinetState [SHELL32.651] NT 4.0 + * ReadCabinetState [SHELL32.651] NT 4.0 * */ BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length) { - HKEY hkey = 0; - DWORD type, r; - - TRACE("%p %d\n", cs, length); - - if( (cs == NULL) || (length < (int)sizeof(*cs)) ) - return FALSE; - - r = RegOpenKeyW( HKEY_CURRENT_USER, szwCabLocation, &hkey ); - if( r == ERROR_SUCCESS ) - { - type = REG_BINARY; - r = RegQueryValueExW( hkey, szwSettings, - NULL, &type, (LPBYTE)cs, (LPDWORD)&length ); - RegCloseKey( hkey ); - - } - - /* if we can't read from the registry, create default values */ - if ( (r != ERROR_SUCCESS) || (cs->cLength < sizeof(*cs)) || - (cs->cLength != length) ) - { - ERR("Initializing shell cabinet settings\n"); - memset(cs, 0, sizeof(*cs)); - cs->cLength = sizeof(*cs); - cs->nVersion = 2; - cs->fFullPathTitle = FALSE; - cs->fSaveLocalView = TRUE; - cs->fNotShell = FALSE; - cs->fSimpleDefault = TRUE; - cs->fDontShowDescBar = FALSE; - cs->fNewWindowMode = FALSE; - cs->fShowCompColor = FALSE; - cs->fDontPrettyNames = FALSE; - cs->fAdminsCreateCommonGroups = TRUE; - cs->fMenuEnumFilter = 96; - } - - return TRUE; -} - -/************************************************************************* - * WriteCabinetState [SHELL32.652] NT 4.0 + HKEY hkey = 0; + DWORD type, r; + + TRACE("%p %d\n", cs, length); + + if( (cs == NULL) || (length < (int)sizeof(*cs)) ) + return FALSE; + + r = RegOpenKeyW( HKEY_CURRENT_USER, szwCabLocation, &hkey ); + if( r == ERROR_SUCCESS ) + { + type = REG_BINARY; + r = RegQueryValueExW( hkey, szwSettings, + NULL, &type, (LPBYTE)cs, (LPDWORD)&length ); + RegCloseKey( hkey ); + + } + + /* if we can't read from the registry, create default values */ + if ( (r != ERROR_SUCCESS) || (cs->cLength < sizeof(*cs)) || + (cs->cLength != length) ) + { + ERR("Initializing shell cabinet settings\n"); + memset(cs, 0, sizeof(*cs)); + cs->cLength = sizeof(*cs); + cs->nVersion = 2; + cs->fFullPathTitle = FALSE; + cs->fSaveLocalView = TRUE; + cs->fNotShell = FALSE; + cs->fSimpleDefault = TRUE; + cs->fDontShowDescBar = FALSE; + cs->fNewWindowMode = FALSE; + cs->fShowCompColor = FALSE; + cs->fDontPrettyNames = FALSE; + cs->fAdminsCreateCommonGroups = TRUE; + cs->fMenuEnumFilter = 96; + } + + return TRUE; +} + +/************************************************************************* + * WriteCabinetState [SHELL32.652] NT 4.0 * */ BOOL WINAPI WriteCabinetState(CABINETSTATE *cs) { - DWORD r; - HKEY hkey = 0; - - TRACE("%p\n",cs); - - if( cs == NULL ) - return FALSE; - - r = RegCreateKeyExW( HKEY_CURRENT_USER, szwCabLocation, 0, - NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL); - if( r == ERROR_SUCCESS ) - { - r = RegSetValueExW( hkey, szwSettings, 0, - REG_BINARY, (LPBYTE) cs, cs->cLength); - - RegCloseKey( hkey ); - } - - return (r==ERROR_SUCCESS); -} - -/************************************************************************* - * FileIconInit [SHELL32.660] + DWORD r; + HKEY hkey = 0; + + TRACE("%p\n",cs); + + if( cs == NULL ) + return FALSE; + + r = RegCreateKeyExW( HKEY_CURRENT_USER, szwCabLocation, 0, + NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL); + if( r == ERROR_SUCCESS ) + { + r = RegSetValueExW( hkey, szwSettings, 0, + REG_BINARY, (LPBYTE) cs, cs->cLength); + + RegCloseKey( hkey ); + } + + return (r==ERROR_SUCCESS); +} + +/************************************************************************* + * FileIconInit [SHELL32.660] * */ BOOL WINAPI FileIconInit(BOOL bFullInit) { FIXME("(%s)\n", bFullInit ? "true" : "false"); - return FALSE; + return FALSE; } /************************************************************************* @@ -1315,7 +1317,6 @@ BOOL bResult = FALSE; TRACE("\n"); - if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) { return FALSE; @@ -1345,7 +1346,6 @@ } CloseHandle(hToken); - if (!AllocateAndInitializeSid(&Authority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &lpSid)) @@ -1369,7 +1369,7 @@ } /************************************************************************* - * SHAllocShared [SHELL32.520] + * SHAllocShared [SHELL32.520] * * See shlwapi.SHAllocShared */ @@ -1383,7 +1383,7 @@ } /************************************************************************* - * SHLockShared [SHELL32.521] + * SHLockShared [SHELL32.521] * * See shlwapi.SHLockShared */ @@ -1397,7 +1397,7 @@ } /************************************************************************* - * SHUnlockShared [SHELL32.522] + * SHUnlockShared [SHELL32.522] * * See shlwapi.SHUnlockShared */ @@ -1411,7 +1411,7 @@ } /************************************************************************* - * SHFreeShared [SHELL32.523] + * SHFreeShared [SHELL32.523] * * See shlwapi.SHFreeShared */ @@ -1425,15 +1425,15 @@ } /************************************************************************* - * SetAppStartingCursor [SHELL32.99] + * SetAppStartingCursor [SHELL32.99] */ EXTERN_C HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v) -{ FIXME("hwnd=%p 0x%04x stub\n",u,v ); - return 0; -} - -/************************************************************************* - * SHLoadOLE [SHELL32.151] +{ FIXME("hwnd=%p 0x%04x stub\n",u,v ); + return 0; +} + +/************************************************************************* + * SHLoadOLE [SHELL32.151] * * To reduce the memory usage of Windows 95, its shell32 contained an * internal implementation of a part of COM (see e.g. SHGetMalloc, SHCoCreateInstance, @@ -1452,11 +1452,11 @@ * hack in SHCoCreateInstance) */ HRESULT WINAPI SHLoadOLE(LPARAM lParam) -{ FIXME("0x%08lx stub\n",lParam); - return S_OK; -} -/************************************************************************* - * DriveType [SHELL32.64] +{ FIXME("0x%08lx stub\n",lParam); + return S_OK; +} +/************************************************************************* + * DriveType [SHELL32.64] * */ EXTERN_C int WINAPI DriveType(int DriveType) @@ -1465,7 +1465,6 @@ root[0] = L'A' + DriveType; return GetDriveTypeW(root); } - /************************************************************************* * InvalidateDriveType [SHELL32.65] * Unimplemented in XP SP3 @@ -1475,64 +1474,61 @@ TRACE("0x%08x stub\n",u); return 0; } - -/************************************************************************* - * SHAbortInvokeCommand [SHELL32.198] +/************************************************************************* + * SHAbortInvokeCommand [SHELL32.198] * */ EXTERN_C HRESULT WINAPI SHAbortInvokeCommand(void) -{ FIXME("stub\n"); - return 1; -} - -/************************************************************************* - * SHOutOfMemoryMessageBox [SHELL32.126] +{ FIXME("stub\n"); + return 1; +} +/************************************************************************* + * SHOutOfMemoryMessageBox [SHELL32.126] * */ int WINAPI SHOutOfMemoryMessageBox( - HWND hwndOwner, - LPCSTR lpCaption, - UINT uType) -{ - FIXME("%p %s 0x%08x stub\n",hwndOwner, lpCaption, uType); + HWND hwndOwner, + LPCSTR lpCaption, + UINT uType) +{ + FIXME("%p %s 0x%08x stub\n",hwndOwner, lpCaption, uType); + return 0; +} +/************************************************************************* + * SHFlushClipboard [SHELL32.121] + * + */ +EXTERN_C HRESULT WINAPI SHFlushClipboard(void) +{ + return OleFlushClipboard(); +} + +/************************************************************************* + * SHWaitForFileToOpen [SHELL32.97] + * + */ +BOOL WINAPI SHWaitForFileToOpen( + LPCITEMIDLIST pidl, + DWORD dwFlags, + DWORD dwTimeout) +{ + FIXME("%p 0x%08x 0x%08x stub\n", pidl, dwFlags, dwTimeout); return 0; } -/************************************************************************* - * SHFlushClipboard [SHELL32.121] - * - */ -EXTERN_C HRESULT WINAPI SHFlushClipboard(void) -{ - return OleFlushClipboard(); -} - -/************************************************************************* - * SHWaitForFileToOpen [SHELL32.97] - * - */ -BOOL WINAPI SHWaitForFileToOpen( - LPCITEMIDLIST pidl, - DWORD dwFlags, - DWORD dwTimeout) -{ - FIXME("%p 0x%08x 0x%08x stub\n", pidl, dwFlags, dwTimeout); - return 0; -} - /************************************************************************ - * RLBuildListOfPaths [SHELL32.146] + * RLBuildListOfPaths [SHELL32.146] * * NOTES * builds a DPA */ EXTERN_C DWORD WINAPI RLBuildListOfPaths (void) -{ FIXME("stub\n"); - return 0; +{ FIXME("stub\n"); + return 0; } /************************************************************************ - * SHValidateUNC [SHELL32.173] + * SHValidateUNC [SHELL32.173] * */ EXTERN_C BOOL WINAPI SHValidateUNC (HWND hwndOwner, LPWSTR pszFile, UINT fConnect) @@ -1617,9 +1613,9 @@ } /************************************************************************ - * DoEnvironmentSubst [SHELL32.53] - * - * See DoEnvironmentSubstA. + * DoEnvironmentSubst [SHELL32.53] + * + * See DoEnvironmentSubstA. */ DWORD WINAPI DoEnvironmentSubstAW(LPVOID x, UINT y) { @@ -1701,7 +1697,7 @@ } /************************************************************************* - * SHAddFromPropSheetExtArray [SHELL32.167] + * SHAddFromPropSheetExtArray [SHELL32.167] */ UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) { @@ -1731,16 +1727,15 @@ } /************************************************************************* - * SHCreatePropSheetExtArray [SHELL32.168] + * SHCreatePropSheetExtArray [SHELL32.168] */ HPSXA WINAPI SHCreatePropSheetExtArray(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface) { return SHCreatePropSheetExtArrayEx(hKey, pszSubKey, max_iface, NULL); } - -/************************************************************************* - * SHCreatePropSheetExtArrayEx [SHELL32.194] +/************************************************************************* + * SHCreatePropSheetExtArrayEx [SHELL32.194] */ EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj) { @@ -1822,6 +1817,7 @@ } } } + } while (psxa->uiCount != psxa->uiAllocated); } else @@ -1840,7 +1836,7 @@ } /************************************************************************* - * SHReplaceFromPropSheetExtArray [SHELL32.170] + * SHReplaceFromPropSheetExtArray [SHELL32.170] */ UINT WINAPI SHReplaceFromPropSheetExtArray(HPSXA hpsxa, UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam) { @@ -1871,7 +1867,7 @@ } /************************************************************************* - * SHDestroyPropSheetExtArray [SHELL32.169] + * SHDestroyPropSheetExtArray [SHELL32.169] */ void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa) { @@ -1892,14 +1888,14 @@ } /************************************************************************* - * CIDLData_CreateFromIDArray [SHELL32.83] + * CIDLData_CreateFromIDArray [SHELL32.83] * * Create IDataObject from PIDLs?? */ HRESULT WINAPI CIDLData_CreateFromIDArray( - LPCITEMIDLIST pidlFolder, + LPCITEMIDLIST pidlFolder, UINT cpidlFiles, - LPCITEMIDLIST *lppidlFiles, + LPCITEMIDLIST *lppidlFiles, IDataObject **ppdataObject) { UINT i; @@ -1909,7 +1905,7 @@ TRACE("(%p, %d, %p, %p)\n", pidlFolder, cpidlFiles, lppidlFiles, ppdataObject); if (TRACE_ON(pidl)) { - pdump (pidlFolder); + pdump (pidlFolder); for (i = 0; i < cpidlFiles; i++) pdump(lppidlFiles[i]); } @@ -1918,26 +1914,26 @@ } /************************************************************************* - * SHCreateStdEnumFmtEtc [SHELL32.74] + * SHCreateStdEnumFmtEtc [SHELL32.74] * * NOTES * */ HRESULT WINAPI SHCreateStdEnumFmtEtc( UINT cFormats, - const FORMATETC *lpFormats, - LPENUMFORMATETC *ppenumFormatetc) -{ - IEnumFORMATETC *pef; - HRESULT hRes; - TRACE("cf=%d fe=%p pef=%p\n", cFormats, lpFormats, ppenumFormatetc); + const FORMATETC *lpFormats, + LPENUMFORMATETC *ppenumFormatetc) +{ + IEnumFORMATETC *pef; + HRESULT hRes; + TRACE("cf=%d fe=%p pef=%p\n", cFormats, lpFormats, ppenumFormatetc); hRes = IEnumFORMATETC_Constructor(cFormats, lpFormats, &pef); if (FAILED(hRes)) return hRes; - IEnumFORMATETC_AddRef(pef); - hRes = IEnumFORMATETC_QueryInterface(pef, &IID_IEnumFORMATETC, (LPVOID*)ppenumFormatetc); + IEnumFORMATETC_AddRef(pef); + hRes = IEnumFORMATETC_QueryInterface(pef, &IID_IEnumFORMATETC, (LPVOID*)ppenumFormatetc); return hRes; } @@ -1968,7 +1964,7 @@ } /************************************************************************* - * SHFindFiles (SHELL32.90) + * SHFindFiles (SHELL32.90) */ BOOL WINAPI SHFindFiles( LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlSaveFile ) { @@ -1977,7 +1973,7 @@ } /************************************************************************* - * SHUpdateImageW (SHELL32.192) + * SHUpdateImageW (SHELL32.192) * * Notifies the shell that an icon in the system image list has been changed. * @@ -2001,7 +1997,7 @@ } /************************************************************************* - * SHUpdateImageA (SHELL32.191) + * SHUpdateImageA (SHELL32.191) * * See SHUpdateImageW. */ @@ -2093,9 +2089,6 @@ return TRUE; } -/************************************************************************* - * SHStartNetConnectionDialog (SHELL32.@) - */ HRESULT WINAPI SHStartNetConnectionDialog(HWND hwnd, LPCSTR pszRemoteName, DWORD dwType) { FIXME("%p, %s, 0x%08x - stub\n", hwnd, debugstr_a(pszRemoteName), dwType); @@ -2259,7 +2252,6 @@ { FIXME("()\n"); return TRUE; - } /*************************************************************************
10 years, 1 month
1
0
0
0
[akhaldi] 65229: [SHELL32] * Move shellord.cpp to the wine folder. * Convert shellord.cpp into shellord.c. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Nov 3 18:09:50 2014 New Revision: 65229 URL:
http://svn.reactos.org/svn/reactos?rev=65229&view=rev
Log: [SHELL32] * Move shellord.cpp to the wine folder. * Convert shellord.cpp into shellord.c. CORE-8540 Added: branches/shell-experiments/dll/win32/shell32/wine/shellord.c - copied, changed from r65228, branches/shell-experiments/dll/win32/shell32/shellord.cpp Removed: branches/shell-experiments/dll/win32/shell32/shellord.cpp Modified: branches/shell-experiments/dll/win32/shell32/CMakeLists.txt Modified: branches/shell-experiments/dll/win32/shell32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/CMakeLists.txt [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/CMakeLists.txt [iso-8859-1] Mon Nov 3 18:09:50 2014 @@ -43,7 +43,6 @@ shell32.cpp shellitem.cpp shelllink.cpp - shellord.cpp shellreg.cpp folders/desktop.cpp folders/fs.cpp @@ -75,6 +74,7 @@ wine/control.c wine/shell32_main.c wine/shellole.c + wine/shellord.c wine/shellpath.c wine/shellstring.c wine/shpolicy.c Removed: branches/shell-experiments/dll/win32/shell32/shellord.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/shellord.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/shellord.cpp (removed) @@ -1,2324 +0,0 @@ -/* - * The parameters of many functions changes between different OS versions - * (NT uses Unicode strings, 95 uses ASCII strings) - * - * Copyright 1997 Marcus Meissner - * 1998 Jürgen Schmied - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "precomp.h" - -#include <mmsystem.h> -#include <commoncontrols.h> - -WINE_DEFAULT_DEBUG_CHANNEL(shell); -WINE_DECLARE_DEBUG_CHANNEL(pidl); - -/* FIXME: !!! move flags to header file !!! */ -/* dwFlags */ -#define MRUF_STRING_LIST 0 /* list will contain strings */ -#define MRUF_BINARY_LIST 1 /* list will contain binary data */ -#define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */ - -EXTERN_C HANDLE WINAPI CreateMRUListA(LPCREATEMRULISTA lpcml); -EXTERN_C INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData); -EXTERN_C INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum); -EXTERN_C INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize); - - -/* Get a function pointer from a DLL handle */ -#define GET_FUNC(func, funcType, module, name, fail) \ - do { \ - if (!func) { \ - if (!SHELL32_h##module && !(SHELL32_h##module = LoadLibraryA(#module ".dll"))) return fail; \ - func = (funcType)GetProcAddress(SHELL32_h##module, name); \ - if (!func) return fail; \ - } \ - } while (0) - -/* Function pointers for GET_FUNC macro */ -static HMODULE SHELL32_hshlwapi=NULL; - - -/************************************************************************* - * ParseFieldA [internal] - * - * copies a field from a ',' delimited string - * - * first field is nField = 1 - */ -DWORD WINAPI ParseFieldA( - LPCSTR src, - DWORD nField, - LPSTR dst, - DWORD len) -{ - WARN("(%s,0x%08x,%p,%d) semi-stub.\n",debugstr_a(src),nField,dst,len); - - if (!src || !src[0] || !dst || !len) - return 0; - - /* skip n fields delimited by ',' */ - while (nField > 1) - { - if (*src=='\0') return FALSE; - if (*(src++)==',') nField--; - } - - /* copy part till the next ',' to dst */ - while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++); - - /* finalize the string */ - *dst=0x0; - - return TRUE; -} - -/************************************************************************* - * ParseFieldW [internal] - * - * copies a field from a ',' delimited string - * - * first field is nField = 1 - */ -DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) -{ - WARN("(%s,0x%08x,%p,%d) semi-stub.\n", debugstr_w(src), nField, dst, len); - - if (!src || !src[0] || !dst || !len) - return 0; - - /* skip n fields delimited by ',' */ - while (nField > 1) - { - if (*src == 0x0) return FALSE; - if (*src++ == ',') nField--; - } - - /* copy part till the next ',' to dst */ - while ( *src != 0x0 && *src != ',' && (len--)>0 ) *(dst++) = *(src++); - - /* finalize the string */ - *dst = 0x0; - - return TRUE; -} - -/************************************************************************* - * ParseField [SHELL32.58] - */ -EXTERN_C DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len) -{ - if (SHELL_OsIsUnicode()) - return ParseFieldW((LPCWSTR)src, nField, (LPWSTR)dst, len); - return ParseFieldA((LPCSTR)src, nField, (LPSTR)dst, len); -} - -/************************************************************************* - * GetFileNameFromBrowse [SHELL32.63] - * - */ -BOOL WINAPI GetFileNameFromBrowse( - HWND hwndOwner, - LPWSTR lpstrFile, - UINT nMaxFile, - LPCWSTR lpstrInitialDir, - LPCWSTR lpstrDefExt, - LPCWSTR lpstrFilter, - LPCWSTR lpstrTitle) -{ -typedef BOOL (WINAPI *GetOpenFileNameProc)(OPENFILENAMEW *ofn); - HMODULE hmodule; - GetOpenFileNameProc pGetOpenFileNameW; - OPENFILENAMEW ofn; - BOOL ret; - - TRACE("%p, %s, %d, %s, %s, %s, %s)\n", - hwndOwner, debugstr_w(lpstrFile), nMaxFile, lpstrInitialDir, lpstrDefExt, - lpstrFilter, lpstrTitle); - - hmodule = LoadLibraryW(L"comdlg32.dll"); - if(!hmodule) return FALSE; - pGetOpenFileNameW = (GetOpenFileNameProc)GetProcAddress(hmodule, "GetOpenFileNameW"); - if(!pGetOpenFileNameW) - { - FreeLibrary(hmodule); - return FALSE; - } - - memset(&ofn, 0, sizeof(ofn)); - - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = hwndOwner; - ofn.lpstrFilter = lpstrFilter; - ofn.lpstrFile = lpstrFile; - ofn.nMaxFile = nMaxFile; - ofn.lpstrInitialDir = lpstrInitialDir; - ofn.lpstrTitle = lpstrTitle; - ofn.lpstrDefExt = lpstrDefExt; - ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST; - ret = pGetOpenFileNameW(&ofn); - - FreeLibrary(hmodule); - return ret; -} - -/************************************************************************* - * SHGetSetSettings [SHELL32.68] - */ -EXTERN_C VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet) -{ - if(bSet) - { - FIXME("%p 0x%08x TRUE\n", lpss, dwMask); - } - else - { - SHGetSettings((LPSHELLFLAGSTATE)lpss,dwMask); - } -} - -/************************************************************************* - * SHGetSettings [SHELL32.@] - * - * NOTES - * the registry path are for win98 (tested) - * and possibly are the same in nt40 - * - */ -EXTERN_C VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask) -{ - HKEY hKey; - DWORD dwData; - DWORD dwDataSize = sizeof (DWORD); - - TRACE("(%p 0x%08x)\n",lpsfs,dwMask); - - if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", - 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) - return; - - if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1); - - if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1); - - if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1); - - if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1); - - if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1); - - if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1); - - if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize)) - { if (dwData == 0) - { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0; - if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0; - } - else if (dwData == 1) - { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1; - if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0; - } - else if (dwData == 2) - { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0; - if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1; - } - } - RegCloseKey (hKey); - - TRACE("-- 0x%04x\n", *(WORD*)lpsfs); -} - -/************************************************************************* - * SHShellFolderView_Message [SHELL32.73] - * - * Send a message to an explorer cabinet window. - * - * PARAMS - * hwndCabinet [I] The window containing the shellview to communicate with - * dwMessage [I] The SFVM message to send - * dwParam [I] Message parameter - * - * RETURNS - * fixme. - * - * NOTES - * Message SFVM_REARRANGE = 1 - * - * This message gets sent when a column gets clicked to instruct the - * shell view to re-sort the item list. dwParam identifies the column - * that was clicked. - */ -LRESULT WINAPI SHShellFolderView_Message( - HWND hwndCabinet, - UINT uMessage, - LPARAM lParam) -{ - FIXME("%p %08x %08lx stub\n",hwndCabinet, uMessage, lParam); - return 0; -} - -/************************************************************************* - * RegisterShellHook [SHELL32.181] - * - * Register a shell hook. - * - * PARAMS - * hwnd [I] Window handle - * dwType [I] Type of hook. - * - * NOTES - * Exported by ordinal - */ -BOOL WINAPI RegisterShellHook( - HWND hWnd, - DWORD dwType) -{ - if (dwType == 3) - return RegisterShellHookWindow(hWnd); - else if (dwType == 0) - return DeregisterShellHookWindow(hWnd); - - ERR("Unsupported argument"); - return FALSE; -} - -/************************************************************************* - * ShellMessageBoxW [SHELL32.182] - * - * See ShellMessageBoxA. - * - * NOTE: - * shlwapi.ShellMessageBoxWrapW is a duplicate of shell32.ShellMessageBoxW - * because we can't forward to it in the .spec file since it's exported by - * ordinal. If you change the implementation here please update the code in - * shlwapi as well. - */ -EXTERN_C int ShellMessageBoxW( - HINSTANCE hInstance, - HWND hWnd, - LPCWSTR lpText, - LPCWSTR lpCaption, - UINT uType, - ...) -{ - WCHAR szText[100],szTitle[100]; - LPCWSTR pszText = szText, pszTitle = szTitle; - LPWSTR pszTemp; - va_list args; - int ret; - - va_start(args, uType); - /* wvsprintfA(buf,fmt, args); */ - - TRACE("(%p,%p,%p,%p,%08x)\n", - hInstance,hWnd,lpText,lpCaption,uType); - - if (IS_INTRESOURCE(lpCaption)) - LoadStringW(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)/sizeof(szTitle[0])); - else - pszTitle = lpCaption; - - if (IS_INTRESOURCE(lpText)) - LoadStringW(hInstance, LOWORD(lpText), szText, sizeof(szText)/sizeof(szText[0])); - else - pszText = lpText; - - FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, - pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args); - - va_end(args); - - ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType); - LocalFree(pszTemp); - return ret; -} - -/************************************************************************* - * ShellMessageBoxA [SHELL32.183] - * - * Format and output an error message. - * - * PARAMS - * hInstance [I] Instance handle of message creator - * hWnd [I] Window handle of message creator - * lpText [I] Resource Id of title or LPSTR - * lpCaption [I] Resource Id of title or LPSTR - * uType [I] Type of error message - * - * RETURNS - * A return value from MessageBoxA(). - * - * NOTES - * Exported by ordinal - */ -EXTERN_C int ShellMessageBoxA( - HINSTANCE hInstance, - HWND hWnd, - LPCSTR lpText, - LPCSTR lpCaption, - UINT uType, - ...) -{ - char szText[100],szTitle[100]; - LPCSTR pszText = szText, pszTitle = szTitle; - LPSTR pszTemp; - va_list args; - int ret; - - va_start(args, uType); - /* wvsprintfA(buf,fmt, args); */ - - TRACE("(%p,%p,%p,%p,%08x)\n", - hInstance,hWnd,lpText,lpCaption,uType); - - if (IS_INTRESOURCE(lpCaption)) - LoadStringA(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)); - else - pszTitle = lpCaption; - - if (IS_INTRESOURCE(lpText)) - LoadStringA(hInstance, LOWORD(lpText), szText, sizeof(szText)); - else - pszText = lpText; - - FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, - pszText, 0, 0, (LPSTR)&pszTemp, 0, &args); - - va_end(args); - - ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType); - LocalFree(pszTemp); - return ret; -} - -/************************************************************************* - * SHRegisterDragDrop [SHELL32.86] - * - * Probably equivalent to RegisterDragDrop but under Windows 95 it could use the - * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE - * for details. Under Windows 98 this function initializes the true OLE when called - * the first time, on XP always returns E_OUTOFMEMORY and it got removed from Vista. - * - * We follow Windows 98 behaviour. - * - * NOTES - * exported by ordinal - * - * SEE ALSO - * RegisterDragDrop, SHLoadOLE - */ -HRESULT WINAPI SHRegisterDragDrop( - HWND hWnd, - LPDROPTARGET pDropTarget) -{ - static BOOL ole_initialized = FALSE; - HRESULT hr; - - TRACE("(%p,%p)\n", hWnd, pDropTarget); - - if (!ole_initialized) - { - hr = OleInitialize(NULL); - if (FAILED(hr)) - return hr; - ole_initialized = TRUE; - } - return RegisterDragDrop(hWnd, pDropTarget); -} - -/************************************************************************* - * SHRevokeDragDrop [SHELL32.87] - * - * Probably equivalent to RevokeDragDrop but under Windows 95 it could use the - * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE - * for details. Function removed from Windows Vista. - * - * We call ole32 RevokeDragDrop which seems to work even if OleInitialize was - * not called. - * - * NOTES - * exported by ordinal - * - * SEE ALSO - * RevokeDragDrop, SHLoadOLE - */ -HRESULT WINAPI SHRevokeDragDrop(HWND hWnd) -{ - TRACE("(%p)\n", hWnd); - return RevokeDragDrop(hWnd); -} - -/************************************************************************* - * SHDoDragDrop [SHELL32.88] - * - * Probably equivalent to DoDragDrop but under Windows 9x it could use the - * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE - * for details - * - * NOTES - * exported by ordinal - * - * SEE ALSO - * DoDragDrop, SHLoadOLE - */ -HRESULT WINAPI SHDoDragDrop( - HWND hWnd, - IDataObject * lpDataObject, - LPDROPSOURCE lpDropSource, - DWORD dwOKEffect, - LPDWORD pdwEffect) -{ - FIXME("(%p %p %p 0x%08x %p):stub.\n", - hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect); - return DoDragDrop(lpDataObject, lpDropSource, dwOKEffect, pdwEffect); -} - -/************************************************************************* - * ArrangeWindows [SHELL32.184] - * - */ -WORD WINAPI ArrangeWindows( - HWND hwndParent, - DWORD dwReserved, - LPCRECT lpRect, - WORD cKids, - CONST HWND * lpKids) -{ - /* Unimplemented in WinXP SP3 */ - TRACE("(%p 0x%08x %p 0x%04x %p):stub.\n", - hwndParent, dwReserved, lpRect, cKids, lpKids); - return 0; -} - -/************************************************************************* - * SignalFileOpen [SHELL32.103] - * - * NOTES - * exported by ordinal - */ -EXTERN_C BOOL WINAPI -SignalFileOpen (LPCITEMIDLIST pidl) -{ - FIXME("(0x%08x):stub.\n", pidl); - - return 0; -} - -/************************************************************************* - * SHADD_get_policy - helper function for SHAddToRecentDocs - * - * PARAMETERS - * policy [IN] policy name (null termed string) to find - * type [OUT] ptr to DWORD to receive type - * buffer [OUT] ptr to area to hold data retrieved - * len [IN/OUT] ptr to DWORD holding size of buffer and getting - * length filled - * - * RETURNS - * result of the SHQueryValueEx call - */ -static INT SHADD_get_policy(LPCSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len) -{ - HKEY Policy_basekey; - INT ret; - - /* Get the key for the policies location in the registry - */ - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, - "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", - 0, KEY_READ, &Policy_basekey)) { - - if (RegOpenKeyExA(HKEY_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", - 0, KEY_READ, &Policy_basekey)) { - TRACE("No Explorer Policies location exists. Policy wanted=%s\n", - policy); - *len = 0; - return ERROR_FILE_NOT_FOUND; - } - } - - /* Retrieve the data if it exists - */ - ret = SHQueryValueExA(Policy_basekey, policy, 0, type, buffer, len); - RegCloseKey(Policy_basekey); - return ret; -} - - -/************************************************************************* - * SHADD_compare_mru - helper function for SHAddToRecentDocs - * - * PARAMETERS - * data1 [IN] data being looked for - * data2 [IN] data in MRU - * cbdata [IN] length from FindMRUData call (not used) - * - * RETURNS - * position within MRU list that data was added. - */ -static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData) -{ - return lstrcmpiA((LPCSTR)data1, (LPCSTR)data2); -} - -/************************************************************************* - * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs - * - * PARAMETERS - * mruhandle [IN] handle for created MRU list - * doc_name [IN] null termed pure doc name - * new_lnk_name [IN] null termed path and file name for .lnk file - * buffer [IN/OUT] 2048 byte area to construct MRU data - * len [OUT] ptr to int to receive space used in buffer - * - * RETURNS - * position within MRU list that data was added. - */ -static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPCSTR doc_name, LPCSTR new_lnk_name, - LPSTR buffer, INT *len) -{ - LPSTR ptr; - INT wlen; - - /*FIXME: Document: - * RecentDocs MRU data structure seems to be: - * +0h document file name w/ terminating 0h - * +nh short int w/ size of remaining - * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown - * +n+4h 10 bytes zeros - unknown - * +n+eh shortcut file name w/ terminating 0h - * +n+e+nh 3 zero bytes - unknown - */ - - /* Create the MRU data structure for "RecentDocs" - */ - ptr = buffer; - lstrcpyA(ptr, doc_name); - ptr += (lstrlenA(buffer) + 1); - wlen= lstrlenA(new_lnk_name) + 1 + 12; - *((short int*)ptr) = wlen; - ptr += 2; /* step past the length */ - *(ptr++) = 0x30; /* unknown reason */ - *(ptr++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */ - memset(ptr, 0, 10); - ptr += 10; - lstrcpyA(ptr, new_lnk_name); - ptr += (lstrlenA(new_lnk_name) + 1); - memset(ptr, 0, 3); - ptr += 3; - *len = ptr - buffer; - - /* Add the new entry into the MRU list - */ - return AddMRUData(mruhandle, buffer, *len); -} - -/************************************************************************* - * SHAddToRecentDocs [SHELL32.@] - * - * Modify (add/clear) Shell's list of recently used documents. - * - * PARAMETERS - * uFlags [IN] SHARD_PATHA, SHARD_PATHW or SHARD_PIDL - * pv [IN] string or pidl, NULL clears the list - * - * NOTES - * exported by name - * - * FIXME - * convert to unicode - */ -void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) -{ -/* If list is a string list lpfnCompare has the following prototype - * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2) - * for binary lists the prototype is - * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData) - * where cbData is the no. of bytes to compare. - * Need to check what return value means identical - 0? - */ - - - UINT olderrormode; - HKEY HCUbasekey; - CHAR doc_name[MAX_PATH]; - CHAR link_dir[MAX_PATH]; - CHAR new_lnk_filepath[MAX_PATH]; - CHAR new_lnk_name[MAX_PATH]; - CHAR * ext; - CComPtr<IMalloc> ppM; - LPITEMIDLIST pidl; - HWND hwnd = 0; /* FIXME: get real window handle */ - INT ret; - DWORD data[64], datalen, type; - - TRACE("%04x %p\n", uFlags, pv); - - /*FIXME: Document: - * RecentDocs MRU data structure seems to be: - * +0h document file name w/ terminating 0h - * +nh short int w/ size of remaining - * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown - * +n+4h 10 bytes zeros - unknown - * +n+eh shortcut file name w/ terminating 0h - * +n+e+nh 3 zero bytes - unknown - */ - - /* See if we need to do anything. - */ - datalen = 64; - ret=SHADD_get_policy( "NoRecentDocsHistory", &type, data, &datalen); - if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) { - ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret); - return; - } - if (ret == ERROR_SUCCESS) { - if (!( (type == REG_DWORD) || - ((type == REG_BINARY) && (datalen == 4)) )) { - ERR("Error policy data for \"NoRecentDocsHistory\" not formatted correctly, type=%d, len=%d\n", - type, datalen); - return; - } - - TRACE("policy value for NoRecentDocsHistory = %08x\n", data[0]); - /* now test the actual policy value */ - if ( data[0] != 0) - return; - } - - /* Open key to where the necessary info is - */ - /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH) - * and the close should be done during the _DETACH. The resulting - * key is stored in the DLL global data. - */ - if (RegCreateKeyExA(HKEY_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer", - 0, 0, 0, KEY_READ, 0, &HCUbasekey, 0)) { - ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n"); - return; - } - - /* Get path to user's "Recent" directory - */ - if(SUCCEEDED(SHGetMalloc(&ppM))) { - if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT, - &pidl))) { - SHGetPathFromIDListA(pidl, link_dir); - ppM->Free(pidl); - } - else { - /* serious issues */ - link_dir[0] = 0; - ERR("serious issues 1\n"); - } - } - else { - /* serious issues */ - link_dir[0] = 0; - ERR("serious issues 2\n"); - } - TRACE("Users Recent dir %s\n", link_dir); - - /* If no input, then go clear the lists */ - if (!pv) { - /* clear user's Recent dir - */ - - /* FIXME: delete all files in "link_dir" - * - * while( more files ) { - * lstrcpyA(old_lnk_name, link_dir); - * PathAppendA(old_lnk_name, filenam); - * DeleteFileA(old_lnk_name); - * } - */ - FIXME("should delete all files in %s\\\n", link_dir); - - /* clear MRU list - */ - /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against - * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer - * and naturally it fails w/ rc=2. It should do it against - * HKEY_CURRENT_USER which is where it is stored, and where - * the MRU routines expect it!!!! - */ - RegDeleteKeyA(HCUbasekey, "RecentDocs"); - RegCloseKey(HCUbasekey); - return; - } - - /* Have data to add, the jobs to be done: - * 1. Add document to MRU list in registry "HKCU\Software\ - * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs". - * 2. Add shortcut to document in the user's Recent directory - * (CSIDL_RECENT). - * 3. Add shortcut to Start menu's Documents submenu. - */ - - /* Get the pure document name from the input - */ - switch (uFlags) - { - case SHARD_PIDL: - SHGetPathFromIDListA((LPCITEMIDLIST)pv, doc_name); - break; - - case SHARD_PATHA: - lstrcpynA(doc_name, (LPCSTR)pv, MAX_PATH); - break; - - case SHARD_PATHW: - WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)pv, -1, doc_name, MAX_PATH, NULL, NULL); - break; - - default: - FIXME("Unsupported flags: %u\n", uFlags); - return; - } - - TRACE("full document name %s\n", debugstr_a(doc_name)); - - /* check if file is a shortcut */ - ext = strrchr(doc_name, '.'); - if (!lstrcmpiA(ext, ".lnk")) - { - CComPtr<IShellLinkA> ShellLink; - IShellLink_ConstructFromFile(NULL, IID_IShellLinkA, (LPCITEMIDLIST)SHSimpleIDListFromPathA(doc_name), (LPVOID*)&ShellLink); - ShellLink->GetPath(doc_name, MAX_PATH, NULL, 0); - } - - ext = strrchr(doc_name, '.'); - if (!lstrcmpiA(ext, ".exe")) - { - /* executables are not added */ - return; - } - - PathStripPathA(doc_name); - TRACE("stripped document name %s\n", debugstr_a(doc_name)); - - - /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */ - - { /* on input needs: - * doc_name - pure file-spec, no path - * link_dir - path to the user's Recent directory - * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node - * creates: - * new_lnk_name- pure file-spec, no path for new .lnk file - * new_lnk_filepath - * - path and file name of new .lnk file - */ - CREATEMRULISTA mymru; - HANDLE mruhandle; - INT len, pos, bufused, err; - INT i; - DWORD attr; - CHAR buffer[2048]; - CHAR *ptr; - CHAR old_lnk_name[MAX_PATH]; - short int slen; - - mymru.cbSize = sizeof(CREATEMRULISTA); - mymru.nMaxItems = 15; - mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE; - mymru.hKey = HCUbasekey; - mymru.lpszSubKey = "RecentDocs"; - mymru.lpfnCompare = (PROC)SHADD_compare_mru; - mruhandle = CreateMRUListA(&mymru); - if (!mruhandle) { - /* MRU failed */ - ERR("MRU processing failed, handle zero\n"); - RegCloseKey(HCUbasekey); - return; - } - len = lstrlenA(doc_name); - pos = FindMRUData(mruhandle, doc_name, len, 0); - - /* Now get the MRU entry that will be replaced - * and delete the .lnk file for it - */ - if ((bufused = EnumMRUListA(mruhandle, (pos == -1) ? 14 : pos, - buffer, 2048)) != -1) { - ptr = buffer; - ptr += (lstrlenA(buffer) + 1); - slen = *((short int*)ptr); - ptr += 2; /* skip the length area */ - if (bufused >= slen + (ptr-buffer)) { - /* buffer size looks good */ - ptr += 12; /* get to string */ - len = bufused - (ptr-buffer); /* get length of buf remaining */ - if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) { - /* appears to be good string */ - lstrcpyA(old_lnk_name, link_dir); - PathAppendA(old_lnk_name, ptr); - if (!DeleteFileA(old_lnk_name)) { - if ((attr = GetFileAttributesA(old_lnk_name)) == INVALID_FILE_ATTRIBUTES) { - if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) { - ERR("Delete for %s failed, err=%d, attr=%08x\n", - old_lnk_name, err, attr); - } - else { - TRACE("old .lnk file %s did not exist\n", - old_lnk_name); - } - } - else { - ERR("Delete for %s failed, attr=%08x\n", - old_lnk_name, attr); - } - } - else { - TRACE("deleted old .lnk file %s\n", old_lnk_name); - } - } - } - } - - /* Create usable .lnk file name for the "Recent" directory - */ - wsprintfA(new_lnk_name, "%s.lnk", doc_name); - lstrcpyA(new_lnk_filepath, link_dir); - PathAppendA(new_lnk_filepath, new_lnk_name); - i = 1; - olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS); - while (GetFileAttributesA(new_lnk_filepath) != INVALID_FILE_ATTRIBUTES) { - i++; - wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i); - lstrcpyA(new_lnk_filepath, link_dir); - PathAppendA(new_lnk_filepath, new_lnk_name); - } - SetErrorMode(olderrormode); - TRACE("new shortcut will be %s\n", new_lnk_filepath); - - /* Now add the new MRU entry and data - */ - pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name, - buffer, &len); - FreeMRUList(mruhandle); - TRACE("Updated MRU list, new doc is position %d\n", pos); - } - - /* *** JOB 2: Create shortcut in user's "Recent" directory *** */ - - { /* on input needs: - * doc_name - pure file-spec, no path - * new_lnk_filepath - * - path and file name of new .lnk file - * uFlags[in] - flags on call to SHAddToRecentDocs - * pv[in] - document path/pidl on call to SHAddToRecentDocs - */ - CComPtr<IShellLinkA> psl; - CComPtr<IPersistFile> pPf; - HRESULT hres; - CHAR desc[MAX_PATH]; - WCHAR widelink[MAX_PATH]; - - CoInitialize(0); - - hres = CoCreateInstance(CLSID_ShellLink, - NULL, - CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IShellLinkA,&psl)); - if(SUCCEEDED(hres)) { - - hres = psl->QueryInterface(IID_PPV_ARG(IPersistFile,&pPf)); - if(FAILED(hres)) { - /* bombed */ - ERR("failed QueryInterface for IPersistFile %08x\n", hres); - goto fail; - } - - /* Set the document path or pidl */ - if (uFlags == SHARD_PIDL) { - hres = psl->SetIDList((LPCITEMIDLIST) pv); - } else { - hres = psl->SetPath((LPCSTR) pv); - } - if(FAILED(hres)) { - /* bombed */ - ERR("failed Set{IDList|Path} %08x\n", hres); - goto fail; - } - - lstrcpyA(desc, "Shortcut to "); - lstrcatA(desc, doc_name); - hres = psl->SetDescription(desc); - if(FAILED(hres)) { - /* bombed */ - ERR("failed SetDescription %08x\n", hres); - goto fail; - } - - MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1, - widelink, MAX_PATH); - /* create the short cut */ - hres = pPf->Save(widelink, TRUE); - if(FAILED(hres)) { - /* bombed */ - ERR("failed IPersistFile::Save %08x\n", hres); - goto fail; - } - hres = pPf->SaveCompleted(widelink); - TRACE("shortcut %s has been created, result=%08x\n", - new_lnk_filepath, hres); - } - else { - ERR("CoCreateInstance failed, hres=%08x\n", hres); - } - } - - fail: - CoUninitialize(); - - /* all done */ - RegCloseKey(HCUbasekey); - return; -} - -/************************************************************************* - * SHCreateShellFolderViewEx [SHELL32.174] - * - * Create a new instance of the default Shell folder view object. - * - * RETURNS - * Success: S_OK - * Failure: error value - * - * NOTES - * see IShellFolder::CreateViewObject - */ -HRESULT WINAPI SHCreateShellFolderViewEx( - LPCSFV psvcbi, /* [in] shelltemplate struct */ - IShellView **ppv) /* [out] IShellView pointer */ -{ - CComPtr<IShellView> psf; - HRESULT hRes; - - TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n", - psvcbi->pshf, psvcbi->pidl, psvcbi->pfnCallback, - psvcbi->fvm, psvcbi->psvOuter); - - *ppv = NULL; - hRes = IShellView_Constructor(psvcbi->pshf, &psf); - if (FAILED(hRes)) - return hRes; - - hRes = psf->QueryInterface(IID_PPV_ARG(IShellView, ppv)); - - return hRes; -} -/************************************************************************* - * SHWinHelp [SHELL32.127] - * - */ -EXTERN_C HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z) -{ FIXME("0x%08x 0x%08x 0x%08x 0x%08x stub\n",v,w,x,z); - return 0; -} -/************************************************************************* - * SHRunControlPanel [SHELL32.161] - * - */ -EXTERN_C BOOL WINAPI SHRunControlPanel (LPCWSTR lpcszCmdLine, HWND hwndMsgParent) -{ - FIXME("0x%08x 0x%08x stub\n",lpcszCmdLine,hwndMsgParent); - return 0; -} - -static IUnknown * SHELL32_IExplorerInterface=0; -/************************************************************************* - * SHSetInstanceExplorer [SHELL32.176] - * - * NOTES - * Sets the interface - */ -VOID WINAPI SHSetInstanceExplorer (IUnknown * lpUnknown) -{ TRACE("%p\n", lpUnknown); - SHELL32_IExplorerInterface = lpUnknown; -} -/************************************************************************* - * SHGetInstanceExplorer [SHELL32.@] - * - * NOTES - * gets the interface pointer of the explorer and a reference - */ -HRESULT WINAPI SHGetInstanceExplorer (IUnknown **lpUnknown) -{ TRACE("%p\n", lpUnknown); - - *lpUnknown = SHELL32_IExplorerInterface; - - if (!SHELL32_IExplorerInterface) - return E_FAIL; - - SHELL32_IExplorerInterface->AddRef(); - return S_OK; -} -/************************************************************************* - * SHFreeUnusedLibraries [SHELL32.123] - * - * Probably equivalent to CoFreeUnusedLibraries but under Windows 9x it could use - * the shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE - * for details - * - * NOTES - * exported by ordinal - * - * SEE ALSO - * CoFreeUnusedLibraries, SHLoadOLE - */ -void WINAPI SHFreeUnusedLibraries (void) -{ - FIXME("stub\n"); - CoFreeUnusedLibraries(); -} -/************************************************************************* - * DAD_AutoScroll [SHELL32.129] - * - */ -BOOL WINAPI DAD_AutoScroll(HWND hwnd, AUTO_SCROLL_DATA *samples, const POINT * pt) -{ - FIXME("hwnd = %p %p %p\n",hwnd,samples,pt); - return FALSE; -} -/************************************************************************* - * DAD_DragEnter [SHELL32.130] - * - */ -BOOL WINAPI DAD_DragEnter(HWND hwnd) -{ - FIXME("hwnd = %p\n",hwnd); - return FALSE; -} -/************************************************************************* - * DAD_DragEnterEx [SHELL32.131] - * - */ -BOOL WINAPI DAD_DragEnterEx(HWND hwnd, POINT p) -{ - FIXME("hwnd = %p (%d,%d)\n",hwnd,p.x,p.y); - return FALSE; -} -/************************************************************************* - * DAD_DragMove [SHELL32.134] - * - */ -BOOL WINAPI DAD_DragMove(POINT p) -{ - FIXME("(%d,%d)\n",p.x,p.y); - return FALSE; -} -/************************************************************************* - * DAD_DragLeave [SHELL32.132] - * - */ -BOOL WINAPI DAD_DragLeave(VOID) -{ - FIXME("\n"); - return FALSE; -} -/************************************************************************* - * DAD_SetDragImage [SHELL32.136] - * - * NOTES - * exported by name - */ -BOOL WINAPI DAD_SetDragImage( - HIMAGELIST himlTrack, - LPPOINT lppt) -{ - FIXME("%p %p stub\n",himlTrack, lppt); - return FALSE; -} -/************************************************************************* - * DAD_ShowDragImage [SHELL32.137] - * - * NOTES - * exported by name - */ -BOOL WINAPI DAD_ShowDragImage(BOOL bShow) -{ - FIXME("0x%08x stub\n",bShow); - return FALSE; -} - -static const WCHAR szwCabLocation[] = { - 'S','o','f','t','w','a','r','e','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\', - 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'E','x','p','l','o','r','e','r','\\', - 'C','a','b','i','n','e','t','S','t','a','t','e',0 -}; - -static const WCHAR szwSettings[] = { 'S','e','t','t','i','n','g','s',0 }; - -/************************************************************************* - * ReadCabinetState [SHELL32.651] NT 4.0 - * - */ -BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length) -{ - HKEY hkey = 0; - DWORD type, r; - - TRACE("%p %d\n", cs, length); - - if( (cs == NULL) || (length < (int)sizeof(*cs)) ) - return FALSE; - - r = RegOpenKeyW( HKEY_CURRENT_USER, szwCabLocation, &hkey ); - if( r == ERROR_SUCCESS ) - { - type = REG_BINARY; - r = RegQueryValueExW( hkey, szwSettings, - NULL, &type, (LPBYTE)cs, (LPDWORD)&length ); - RegCloseKey( hkey ); - - } - - /* if we can't read from the registry, create default values */ - if ( (r != ERROR_SUCCESS) || (cs->cLength < sizeof(*cs)) || - (cs->cLength != length) ) - { - ERR("Initializing shell cabinet settings\n"); - memset(cs, 0, sizeof(*cs)); - cs->cLength = sizeof(*cs); - cs->nVersion = 2; - cs->fFullPathTitle = FALSE; - cs->fSaveLocalView = TRUE; - cs->fNotShell = FALSE; - cs->fSimpleDefault = TRUE; - cs->fDontShowDescBar = FALSE; - cs->fNewWindowMode = FALSE; - cs->fShowCompColor = FALSE; - cs->fDontPrettyNames = FALSE; - cs->fAdminsCreateCommonGroups = TRUE; - cs->fMenuEnumFilter = 96; - } - - return TRUE; -} - -/************************************************************************* - * WriteCabinetState [SHELL32.652] NT 4.0 - * - */ -BOOL WINAPI WriteCabinetState(CABINETSTATE *cs) -{ - DWORD r; - HKEY hkey = 0; - - TRACE("%p\n",cs); - - if( cs == NULL ) - return FALSE; - - r = RegCreateKeyExW( HKEY_CURRENT_USER, szwCabLocation, 0, - NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL); - if( r == ERROR_SUCCESS ) - { - r = RegSetValueExW( hkey, szwSettings, 0, - REG_BINARY, (LPBYTE) cs, cs->cLength); - - RegCloseKey( hkey ); - } - - return (r==ERROR_SUCCESS); -} - -/************************************************************************* - * FileIconInit [SHELL32.660] - * - */ -BOOL WINAPI FileIconInit(BOOL bFullInit) -{ - FIXME("(%s)\n", bFullInit ? "true" : "false"); - return FALSE; -} - -/************************************************************************* - * IsUserAnAdmin [SHELL32.680] NT 4.0 - * - * Checks whether the current user is a member of the Administrators group. - * - * PARAMS - * None - * - * RETURNS - * Success: TRUE - * Failure: FALSE - */ -BOOL WINAPI IsUserAnAdmin(VOID) -{ - SID_IDENTIFIER_AUTHORITY Authority = {SECURITY_NT_AUTHORITY}; - HANDLE hToken; - DWORD dwSize; - PTOKEN_GROUPS lpGroups; - PSID lpSid; - DWORD i; - BOOL bResult = FALSE; - - TRACE("\n"); - - if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) - { - return FALSE; - } - - if (!GetTokenInformation(hToken, TokenGroups, NULL, 0, &dwSize)) - { - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) - { - CloseHandle(hToken); - return FALSE; - } - } - - lpGroups = (PTOKEN_GROUPS)HeapAlloc(GetProcessHeap(), 0, dwSize); - if (lpGroups == NULL) - { - CloseHandle(hToken); - return FALSE; - } - - if (!GetTokenInformation(hToken, TokenGroups, lpGroups, dwSize, &dwSize)) - { - HeapFree(GetProcessHeap(), 0, lpGroups); - CloseHandle(hToken); - return FALSE; - } - - CloseHandle(hToken); - - if (!AllocateAndInitializeSid(&Authority, 2, SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, - &lpSid)) - { - HeapFree(GetProcessHeap(), 0, lpGroups); - return FALSE; - } - - for (i = 0; i < lpGroups->GroupCount; i++) - { - if (EqualSid(lpSid, lpGroups->Groups[i].Sid)) - { - bResult = TRUE; - break; - } - } - - FreeSid(lpSid); - HeapFree(GetProcessHeap(), 0, lpGroups); - return bResult; -} - -/************************************************************************* - * SHAllocShared [SHELL32.520] - * - * See shlwapi.SHAllocShared - */ -HANDLE WINAPI SHAllocShared(LPVOID lpvData, DWORD dwSize, DWORD dwProcId) -{ - typedef HANDLE (WINAPI *SHAllocSharedProc)(LPCVOID, DWORD, DWORD); - static SHAllocSharedProc pSHAllocShared; - - GET_FUNC(pSHAllocShared, SHAllocSharedProc, shlwapi, (char*)7, NULL); - return pSHAllocShared(lpvData, dwSize, dwProcId); -} - -/************************************************************************* - * SHLockShared [SHELL32.521] - * - * See shlwapi.SHLockShared - */ -LPVOID WINAPI SHLockShared(HANDLE hShared, DWORD dwProcId) -{ - typedef HANDLE (WINAPI *SHLockSharedProc)(HANDLE, DWORD); - static SHLockSharedProc pSHLockShared; - - GET_FUNC(pSHLockShared, SHLockSharedProc, shlwapi, (char*)8, NULL); - return pSHLockShared(hShared, dwProcId); -} - -/************************************************************************* - * SHUnlockShared [SHELL32.522] - * - * See shlwapi.SHUnlockShared - */ -BOOL WINAPI SHUnlockShared(LPVOID lpView) -{ - typedef HANDLE (WINAPI *SHUnlockSharedProc)(LPCVOID); - static SHUnlockSharedProc pSHUnlockShared; - - GET_FUNC(pSHUnlockShared, SHUnlockSharedProc, shlwapi, (char*)9, FALSE); - return pSHUnlockShared(lpView) != NULL; -} - -/************************************************************************* - * SHFreeShared [SHELL32.523] - * - * See shlwapi.SHFreeShared - */ -BOOL WINAPI SHFreeShared(HANDLE hShared, DWORD dwProcId) -{ - typedef HANDLE (WINAPI *SHFreeSharedProc)(HANDLE, DWORD); - static SHFreeSharedProc pSHFreeShared; - - GET_FUNC(pSHFreeShared, SHFreeSharedProc, shlwapi, (char*)10, FALSE); - return pSHFreeShared(hShared, dwProcId) != NULL; -} - -/************************************************************************* - * SetAppStartingCursor [SHELL32.99] - */ -EXTERN_C HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v) -{ FIXME("hwnd=%p 0x%04x stub\n",u,v ); - return 0; -} - -/************************************************************************* - * SHLoadOLE [SHELL32.151] - * - * To reduce the memory usage of Windows 95, its shell32 contained an - * internal implementation of a part of COM (see e.g. SHGetMalloc, SHCoCreateInstance, - * SHRegisterDragDrop etc.) that allowed to use in-process STA objects without - * the need to load OLE32.DLL. If OLE32.DLL was already loaded, the SH* function - * would just call the Co* functions. - * - * The SHLoadOLE was called when OLE32.DLL was being loaded to transfer all the - * information from the shell32 "mini-COM" to ole32.dll. - * - * See
http://blogs.msdn.com/oldnewthing/archive/2004/07/05/173226.aspx
for a - * detailed description. - * - * Under wine ole32.dll is always loaded as it is imported by shlwapi.dll which is - * imported by shell32 and no "mini-COM" is used (except for the "LoadWithoutCOM" - * hack in SHCoCreateInstance) - */ -HRESULT WINAPI SHLoadOLE(LPARAM lParam) -{ FIXME("0x%08lx stub\n",lParam); - return S_OK; -} -/************************************************************************* - * DriveType [SHELL32.64] - * - */ -EXTERN_C int WINAPI DriveType(int DriveType) -{ - WCHAR root[] = L"A:\\"; - root[0] = L'A' + DriveType; - return GetDriveTypeW(root); -} - -/************************************************************************* - * InvalidateDriveType [SHELL32.65] - * Unimplemented in XP SP3 - */ -EXTERN_C int WINAPI InvalidateDriveType(int u) -{ - TRACE("0x%08x stub\n",u); - return 0; -} - -/************************************************************************* - * SHAbortInvokeCommand [SHELL32.198] - * - */ -EXTERN_C HRESULT WINAPI SHAbortInvokeCommand(void) -{ FIXME("stub\n"); - return 1; -} - -/************************************************************************* - * SHOutOfMemoryMessageBox [SHELL32.126] - * - */ -int WINAPI SHOutOfMemoryMessageBox( - HWND hwndOwner, - LPCSTR lpCaption, - UINT uType) -{ - FIXME("%p %s 0x%08x stub\n",hwndOwner, lpCaption, uType); - return 0; -} - -/************************************************************************* - * SHFlushClipboard [SHELL32.121] - * - */ -EXTERN_C HRESULT WINAPI SHFlushClipboard(void) -{ - return OleFlushClipboard(); -} - -/************************************************************************* - * SHWaitForFileToOpen [SHELL32.97] - * - */ -BOOL WINAPI SHWaitForFileToOpen( - LPCITEMIDLIST pidl, - DWORD dwFlags, - DWORD dwTimeout) -{ - FIXME("%p 0x%08x 0x%08x stub\n", pidl, dwFlags, dwTimeout); - return 0; -} - -/************************************************************************ - * RLBuildListOfPaths [SHELL32.146] - * - * NOTES - * builds a DPA - */ -EXTERN_C DWORD WINAPI RLBuildListOfPaths (void) -{ FIXME("stub\n"); - return 0; -} - -/************************************************************************ - * SHValidateUNC [SHELL32.173] - * - */ -EXTERN_C BOOL WINAPI SHValidateUNC (HWND hwndOwner, LPWSTR pszFile, UINT fConnect) -{ - FIXME("0x%08x 0x%08x 0x%08x stub\n",hwndOwner,pszFile,fConnect); - return 0; -} - -/************************************************************************ - * DoEnvironmentSubstA [SHELL32.@] - * - * See DoEnvironmentSubstW. - */ -EXTERN_C DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString) -{ - LPSTR dst; - BOOL res = FALSE; - DWORD len = cchString; - - TRACE("(%s, %d)\n", debugstr_a(pszString), cchString); - if (pszString == NULL) /* Really return 0? */ - return 0; - if ((dst = (LPSTR)HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(CHAR)))) - { - len = ExpandEnvironmentStringsA(pszString, dst, cchString); - /* len includes the terminating 0 */ - if (len && len < cchString) - { - res = TRUE; - memcpy(pszString, dst, len); - } - else - len = cchString; - - HeapFree(GetProcessHeap(), 0, dst); - } - return MAKELONG(len, res); -} - -/************************************************************************ - * DoEnvironmentSubstW [SHELL32.@] - * - * Replace all %KEYWORD% in the string with the value of the named - * environment variable. If the buffer is too small, the string is not modified. - * - * PARAMS - * pszString [I] '\0' terminated string with %keyword%. - * [O] '\0' terminated string with %keyword% substituted. - * cchString [I] size of str. - * - * RETURNS - * Success: The string in the buffer is updated - * HIWORD: TRUE - * LOWORD: characters used in the buffer, including space for the terminating 0 - * Failure: buffer too small. The string is not modified. - * HIWORD: FALSE - * LOWORD: provided size of the buffer in characters - */ -EXTERN_C DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT cchString) -{ - LPWSTR dst; - BOOL res = FALSE; - DWORD len = cchString; - - TRACE("(%s, %d)\n", debugstr_w(pszString), cchString); - - if ((cchString < MAXLONG) && (dst = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(WCHAR)))) - { - len = ExpandEnvironmentStringsW(pszString, dst, cchString); - /* len includes the terminating 0 */ - if (len && len <= cchString) - { - res = TRUE; - memcpy(pszString, dst, len * sizeof(WCHAR)); - } - else - len = cchString; - - HeapFree(GetProcessHeap(), 0, dst); - } - return MAKELONG(len, res); -} - -/************************************************************************ - * DoEnvironmentSubst [SHELL32.53] - * - * See DoEnvironmentSubstA. - */ -DWORD WINAPI DoEnvironmentSubstAW(LPVOID x, UINT y) -{ - if (SHELL_OsIsUnicode()) - return DoEnvironmentSubstW((LPWSTR)x, y); - return DoEnvironmentSubstA((LPSTR)x, y); -} - -/************************************************************************* - * GUIDFromStringA [SHELL32.703] - */ -BOOL WINAPI GUIDFromStringA(LPCSTR str, LPGUID guid) -{ - TRACE("GUIDFromStringA() stub\n"); - return FALSE; -} - -/************************************************************************* - * GUIDFromStringW [SHELL32.704] - */ -BOOL WINAPI GUIDFromStringW(LPCWSTR str, LPGUID guid) -{ - UNICODE_STRING guid_str; - - RtlInitUnicodeString(&guid_str, str); - return !RtlGUIDFromString(&guid_str, guid); -} - -/************************************************************************* - * PathIsTemporaryW [SHELL32.714] - */ -EXTERN_C BOOL WINAPI PathIsTemporaryW(LPWSTR Str) -{ - FIXME("(%s)stub\n", debugstr_w(Str)); - return FALSE; -} - -/************************************************************************* - * PathIsTemporaryA [SHELL32.713] - */ -EXTERN_C BOOL WINAPI PathIsTemporaryA(LPSTR Str) -{ - FIXME("(%s)stub\n", debugstr_a(Str)); - return FALSE; -} - -typedef struct _PSXA -{ - UINT uiCount; - UINT uiAllocated; - IShellPropSheetExt *pspsx[0]; -} PSXA, *PPSXA; - -typedef struct _PSXA_CALL -{ - LPFNADDPROPSHEETPAGE lpfnAddReplaceWith; - LPARAM lParam; - BOOL bCalled; - BOOL bMultiple; - UINT uiCount; -} PSXA_CALL, *PPSXA_CALL; - -static BOOL CALLBACK PsxaCall(HPROPSHEETPAGE hpage, LPARAM lParam) -{ - PPSXA_CALL Call = (PPSXA_CALL)lParam; - - if (Call != NULL) - { - if ((Call->bMultiple || !Call->bCalled) && - Call->lpfnAddReplaceWith(hpage, Call->lParam)) - { - Call->bCalled = TRUE; - Call->uiCount++; - return TRUE; - } - } - - return FALSE; -} - -/************************************************************************* - * SHAddFromPropSheetExtArray [SHELL32.167] - */ -UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) -{ - PSXA_CALL Call; - UINT i; - PPSXA psxa = (PPSXA)hpsxa; - - TRACE("(%p,%p,%08lx)\n", hpsxa, lpfnAddPage, lParam); - - if (psxa) - { - ZeroMemory(&Call, sizeof(Call)); - Call.lpfnAddReplaceWith = lpfnAddPage; - Call.lParam = lParam; - Call.bMultiple = TRUE; - - /* Call the AddPage method of all registered IShellPropSheetExt interfaces */ - for (i = 0; i != psxa->uiCount; i++) - { - psxa->pspsx[i]->AddPages(PsxaCall, (LPARAM)&Call); - } - - return Call.uiCount; - } - - return 0; -} - -/************************************************************************* - * SHCreatePropSheetExtArray [SHELL32.168] - */ -HPSXA WINAPI SHCreatePropSheetExtArray(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface) -{ - return SHCreatePropSheetExtArrayEx(hKey, pszSubKey, max_iface, NULL); -} - - -/************************************************************************* - * SHCreatePropSheetExtArrayEx [SHELL32.194] - */ -EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj) -{ - static const WCHAR szPropSheetSubKey[] = {'s','h','e','l','l','e','x','\\','P','r','o','p','e','r','t','y','S','h','e','e','t','H','a','n','d','l','e','r','s',0}; - WCHAR szHandler[64]; - DWORD dwHandlerLen; - WCHAR szClsidHandler[39]; - DWORD dwClsidSize; - CLSID clsid; - LONG lRet; - DWORD dwIndex; - HKEY hkBase, hkPropSheetHandlers; - PPSXA psxa = NULL; - HRESULT hr; - - TRACE("(%p,%s,%u)\n", hKey, debugstr_w(pszSubKey), max_iface); - - if (max_iface == 0) - return NULL; - - /* Open the registry key */ - lRet = RegOpenKeyW(hKey, pszSubKey, &hkBase); - if (lRet != ERROR_SUCCESS) - return NULL; - - lRet = RegOpenKeyExW(hkBase, szPropSheetSubKey, 0, KEY_ENUMERATE_SUB_KEYS, &hkPropSheetHandlers); - RegCloseKey(hkBase); - if (lRet == ERROR_SUCCESS) - { - /* Create and initialize the Property Sheet Extensions Array */ - psxa = (PPSXA)LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, sizeof(PSXA) + max_iface * sizeof(IShellPropSheetExt *)); - if (psxa) - { - psxa->uiAllocated = max_iface; - - /* Enumerate all subkeys and attempt to load the shell extensions */ - dwIndex = 0; - do - { - dwHandlerLen = sizeof(szHandler) / sizeof(szHandler[0]); - lRet = RegEnumKeyExW(hkPropSheetHandlers, dwIndex++, szHandler, &dwHandlerLen, NULL, NULL, NULL, NULL); - if (lRet != ERROR_SUCCESS) - { - if (lRet == ERROR_MORE_DATA) - continue; - - if (lRet == ERROR_NO_MORE_ITEMS) - lRet = ERROR_SUCCESS; - break; - } - szHandler[(sizeof(szHandler) / sizeof(szHandler[0])) - 1] = 0; - hr = CLSIDFromString(szHandler, &clsid); - if (FAILED(hr)) - { - dwClsidSize = sizeof(szClsidHandler); - if (SHGetValueW(hkPropSheetHandlers, szHandler, NULL, NULL, szClsidHandler, &dwClsidSize) == ERROR_SUCCESS) - { - szClsidHandler[(sizeof(szClsidHandler) / sizeof(szClsidHandler[0])) - 1] = 0; - hr = CLSIDFromString(szClsidHandler, &clsid); - } - } - if (SUCCEEDED(hr)) - { - CComPtr<IShellExtInit> psxi; - CComPtr<IShellPropSheetExt> pspsx; - - /* Attempt to get an IShellPropSheetExt and an IShellExtInit instance. - Only if both interfaces are supported it's a real shell extension. - Then call IShellExtInit's Initialize method. */ - if (SUCCEEDED(CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER/* | CLSCTX_NO_CODE_DOWNLOAD */, IID_PPV_ARG(IShellPropSheetExt, &pspsx)))) - { - if (SUCCEEDED(pspsx->QueryInterface(IID_PPV_ARG(IShellExtInit, &psxi)))) - { - if (SUCCEEDED(psxi->Initialize(NULL, pDataObj, hKey))) - { - /* Add the IShellPropSheetExt instance to the array */ - psxa->pspsx[psxa->uiCount++] = pspsx.Detach(); - } - } - } - } - } while (psxa->uiCount != psxa->uiAllocated); - } - else - lRet = ERROR_NOT_ENOUGH_MEMORY; - - RegCloseKey(hkPropSheetHandlers); - } - - if (lRet != ERROR_SUCCESS && psxa) - { - SHDestroyPropSheetExtArray((HPSXA)psxa); - psxa = NULL; - } - - return (HPSXA)psxa; -} - -/************************************************************************* - * SHReplaceFromPropSheetExtArray [SHELL32.170] - */ -UINT WINAPI SHReplaceFromPropSheetExtArray(HPSXA hpsxa, UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam) -{ - PSXA_CALL Call; - UINT i; - PPSXA psxa = (PPSXA)hpsxa; - - TRACE("(%p,%u,%p,%08lx)\n", hpsxa, uPageID, lpfnReplaceWith, lParam); - - if (psxa) - { - ZeroMemory(&Call, sizeof(Call)); - Call.lpfnAddReplaceWith = lpfnReplaceWith; - Call.lParam = lParam; - - /* Call the ReplacePage method of all registered IShellPropSheetExt interfaces. - Each shell extension is only allowed to call the callback once during the callback. */ - for (i = 0; i != psxa->uiCount; i++) - { - Call.bCalled = FALSE; - psxa->pspsx[i]->ReplacePage(uPageID, PsxaCall, (LPARAM)&Call); - } - - return Call.uiCount; - } - - return 0; -} - -/************************************************************************* - * SHDestroyPropSheetExtArray [SHELL32.169] - */ -void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa) -{ - UINT i; - PPSXA psxa = (PPSXA)hpsxa; - - TRACE("(%p)\n", hpsxa); - - if (psxa) - { - for (i = 0; i != psxa->uiCount; i++) - { - psxa->pspsx[i]->Release(); - } - - LocalFree((HLOCAL)psxa); - } -} - -/************************************************************************* - * CIDLData_CreateFromIDArray [SHELL32.83] - * - * Create IDataObject from PIDLs?? - */ -HRESULT WINAPI CIDLData_CreateFromIDArray( - LPCITEMIDLIST pidlFolder, - UINT cpidlFiles, - LPCITEMIDLIST *lppidlFiles, - IDataObject **ppdataObject) -{ - UINT i; - HWND hwnd = 0; /*FIXME: who should be hwnd of owner? set to desktop */ - HRESULT hResult; - - TRACE("(%p, %d, %p, %p)\n", pidlFolder, cpidlFiles, lppidlFiles, ppdataObject); - if (TRACE_ON(pidl)) - { - pdump (pidlFolder); - for (i = 0; i < cpidlFiles; i++) - pdump(lppidlFiles[i]); - } - hResult = IDataObject_Constructor(hwnd, pidlFolder, lppidlFiles, cpidlFiles, ppdataObject); - return hResult; -} - -/************************************************************************* - * SHCreateStdEnumFmtEtc [SHELL32.74] - * - * NOTES - * - */ -HRESULT WINAPI SHCreateStdEnumFmtEtc( - UINT cFormats, - const FORMATETC *lpFormats, - LPENUMFORMATETC *ppenumFormatetc) -{ - CComPtr<IEnumFORMATETC> pef; - HRESULT hRes; - TRACE("cf=%d fe=%p pef=%p\n", cFormats, lpFormats, ppenumFormatetc); - - hRes = IEnumFORMATETC_Constructor(cFormats, lpFormats, &pef); - if (FAILED(hRes)) - return hRes; - - pef->AddRef(); - hRes = pef->QueryInterface(IID_PPV_ARG(IEnumFORMATETC, ppenumFormatetc)); - - return hRes; -} - - -/************************************************************************* - * SHCreateShellFolderView (SHELL32.256) - */ -HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv) -{ - CComPtr<IShellView> psf; - HRESULT hRes; - - *ppsv = NULL; - if (!pcsfv || pcsfv->cbSize != sizeof(*pcsfv)) - return E_INVALIDARG; - - TRACE("sf=%p outer=%p callback=%p\n", - pcsfv->pshf, pcsfv->psvOuter, pcsfv->psfvcb); - - hRes = IShellView_Constructor(pcsfv->pshf, &psf); - if (FAILED(hRes)) - return hRes; - - hRes = psf->QueryInterface(IID_PPV_ARG(IShellView, ppsv)); - - return hRes; -} - -/************************************************************************* - * SHFindFiles (SHELL32.90) - */ -BOOL WINAPI SHFindFiles( LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlSaveFile ) -{ - FIXME("%p %p\n", pidlFolder, pidlSaveFile ); - return FALSE; -} - -/************************************************************************* - * SHUpdateImageW (SHELL32.192) - * - * Notifies the shell that an icon in the system image list has been changed. - * - * PARAMS - * pszHashItem [I] Path to file that contains the icon. - * iIndex [I] Zero-based index of the icon in the file. - * uFlags [I] Flags determining the icon attributes. See notes. - * iImageIndex [I] Index of the icon in the system image list. - * - * RETURNS - * Nothing - * - * NOTES - * uFlags can be one or more of the following flags: - * GIL_NOTFILENAME - pszHashItem is not a file name. - * GIL_SIMULATEDOC - Create a document icon using the specified icon. - */ -void WINAPI SHUpdateImageW(LPCWSTR pszHashItem, int iIndex, UINT uFlags, int iImageIndex) -{ - FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_w(pszHashItem), iIndex, uFlags, iImageIndex); -} - -/************************************************************************* - * SHUpdateImageA (SHELL32.191) - * - * See SHUpdateImageW. - */ -VOID WINAPI SHUpdateImageA(LPCSTR pszHashItem, INT iIndex, UINT uFlags, INT iImageIndex) -{ - FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_a(pszHashItem), iIndex, uFlags, iImageIndex); -} - -INT WINAPI SHHandleUpdateImage(LPCITEMIDLIST pidlExtra) -{ - FIXME("%p - stub\n", pidlExtra); - - return -1; -} - -BOOL WINAPI SHObjectProperties(HWND hwnd, DWORD dwType, LPCWSTR szObject, LPCWSTR szPage) -{ - FIXME("%p, 0x%08x, %s, %s - stub\n", hwnd, dwType, debugstr_w(szObject), debugstr_w(szPage)); - - return TRUE; -} - -BOOL WINAPI SHGetNewLinkInfoA(LPCSTR pszLinkTo, LPCSTR pszDir, LPSTR pszName, BOOL *pfMustCopy, - UINT uFlags) -{ - WCHAR wszLinkTo[MAX_PATH]; - WCHAR wszDir[MAX_PATH]; - WCHAR wszName[MAX_PATH]; - BOOL res; - - MultiByteToWideChar(CP_ACP, 0, pszLinkTo, -1, wszLinkTo, MAX_PATH); - MultiByteToWideChar(CP_ACP, 0, pszDir, -1, wszDir, MAX_PATH); - - res = SHGetNewLinkInfoW(wszLinkTo, wszDir, wszName, pfMustCopy, uFlags); - - if (res) - WideCharToMultiByte(CP_ACP, 0, wszName, -1, pszName, MAX_PATH, NULL, NULL); - - return res; -} - -BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, BOOL *pfMustCopy, - UINT uFlags) -{ - const WCHAR *basename; - WCHAR *dst_basename; - int i=2; - static const WCHAR lnkformat[] = {'%','s','.','l','n','k',0}; - static const WCHAR lnkformatnum[] = {'%','s',' ','(','%','d',')','.','l','n','k',0}; - - TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_w(pszLinkTo), debugstr_w(pszDir), - pszName, pfMustCopy, uFlags); - - *pfMustCopy = FALSE; - - if (uFlags & SHGNLI_PIDL) - { - FIXME("SHGNLI_PIDL flag unsupported\n"); - return FALSE; - } - - if (uFlags) - FIXME("ignoring flags: 0x%08x\n", uFlags); - - /* FIXME: should test if the file is a shortcut or DOS program */ - if (GetFileAttributesW(pszLinkTo) == INVALID_FILE_ATTRIBUTES) - return FALSE; - - basename = strrchrW(pszLinkTo, '\\'); - if (basename) - basename = basename+1; - else - basename = pszLinkTo; - - lstrcpynW(pszName, pszDir, MAX_PATH); - if (!PathAddBackslashW(pszName)) - return FALSE; - - dst_basename = pszName + strlenW(pszName); - - snprintfW(dst_basename, pszName + MAX_PATH - dst_basename, lnkformat, basename); - - while (GetFileAttributesW(pszName) != INVALID_FILE_ATTRIBUTES) - { - snprintfW(dst_basename, pszName + MAX_PATH - dst_basename, lnkformatnum, basename, i); - i++; - } - - return TRUE; -} - -/************************************************************************* - * SHStartNetConnectionDialog (SHELL32.@) - */ -HRESULT WINAPI SHStartNetConnectionDialog(HWND hwnd, LPCSTR pszRemoteName, DWORD dwType) -{ - FIXME("%p, %s, 0x%08x - stub\n", hwnd, debugstr_a(pszRemoteName), dwType); - - return S_OK; -} -/************************************************************************* - * SHEmptyRecycleBinA (SHELL32.@) - */ -HRESULT WINAPI SHEmptyRecycleBinA(HWND hwnd, LPCSTR pszRootPath, DWORD dwFlags) -{ - LPWSTR szRootPathW = NULL; - int len; - HRESULT hr; - - TRACE("%p, %s, 0x%08x\n", hwnd, debugstr_a(pszRootPath), dwFlags); - - if (pszRootPath) - { - len = MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, NULL, 0); - if (len == 0) - return HRESULT_FROM_WIN32(GetLastError()); - szRootPathW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!szRootPathW) - return E_OUTOFMEMORY; - if (MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, szRootPathW, len) == 0) - { - HeapFree(GetProcessHeap(), 0, szRootPathW); - return HRESULT_FROM_WIN32(GetLastError()); - } - } - - hr = SHEmptyRecycleBinW(hwnd, szRootPathW, dwFlags); - HeapFree(GetProcessHeap(), 0, szRootPathW); - - return hr; -} - -HRESULT WINAPI SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags) -{ - WCHAR szPath[MAX_PATH] = {0}; - DWORD dwSize, dwType; - LONG ret; - - TRACE("%p, %s, 0x%08x\n", hwnd, debugstr_w(pszRootPath), dwFlags); - - if (!(dwFlags & SHERB_NOCONFIRMATION)) - { - /* FIXME - * enumerate available files - * show confirmation dialog - */ - FIXME("show confirmation dialog\n"); - } - - if (dwFlags & SHERB_NOPROGRESSUI) - { - ret = EmptyRecycleBinW(pszRootPath); - } - else - { - /* FIXME - * show a progress dialog - */ - ret = EmptyRecycleBinW(pszRootPath); - } - - if (!ret) - return HRESULT_FROM_WIN32(GetLastError()); - - if (!(dwFlags & SHERB_NOSOUND)) - { - dwSize = sizeof(szPath); - ret = RegGetValueW(HKEY_CURRENT_USER, - L"AppEvents\\Schemes\\Apps\\Explorer\\EmptyRecycleBin\\.Current", - NULL, - RRF_RT_REG_EXPAND_SZ, - &dwType, - (PVOID)szPath, - &dwSize); - if (ret != ERROR_SUCCESS) - return S_OK; - - if (dwType != REG_EXPAND_SZ) /* type dismatch */ - return S_OK; - - szPath[(sizeof(szPath)/sizeof(WCHAR))-1] = L'\0'; - PlaySoundW(szPath, NULL, SND_FILENAME); - } - return S_OK; -} - -HRESULT WINAPI SHQueryRecycleBinA(LPCSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo) -{ - LPWSTR szRootPathW = NULL; - int len; - HRESULT hr; - - TRACE("%s, %p\n", debugstr_a(pszRootPath), pSHQueryRBInfo); - - if (pszRootPath) - { - len = MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, NULL, 0); - if (len == 0) - return HRESULT_FROM_WIN32(GetLastError()); - szRootPathW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!szRootPathW) - return E_OUTOFMEMORY; - if (MultiByteToWideChar(CP_ACP, 0, pszRootPath, -1, szRootPathW, len) == 0) - { - HeapFree(GetProcessHeap(), 0, szRootPathW); - return HRESULT_FROM_WIN32(GetLastError()); - } - } - - hr = SHQueryRecycleBinW(szRootPathW, pSHQueryRBInfo); - HeapFree(GetProcessHeap(), 0, szRootPathW); - - return hr; -} - -HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo) -{ - FIXME("%s, %p - stub\n", debugstr_w(pszRootPath), pSHQueryRBInfo); - - if (!(pszRootPath) || (pszRootPath[0] == 0) || - !(pSHQueryRBInfo) || (pSHQueryRBInfo->cbSize < sizeof(SHQUERYRBINFO))) - { - return E_INVALIDARG; - } - - pSHQueryRBInfo->i64Size = 0; - pSHQueryRBInfo->i64NumItems = 0; - - return S_OK; -} - -/************************************************************************* - * SHSetLocalizedName (SHELL32.@) - */ -EXTERN_C HRESULT WINAPI SHSetLocalizedName(LPCWSTR pszPath, LPCWSTR pszResModule, int idsRes) -{ - FIXME("%p, %s, %d - stub\n", pszPath, debugstr_w(pszResModule), idsRes); - - return S_OK; -} - -/************************************************************************* - * LinkWindow_RegisterClass (SHELL32.258) - */ -EXTERN_C BOOL WINAPI LinkWindow_RegisterClass(void) -{ - FIXME("()\n"); - return TRUE; -} - -/************************************************************************* - * LinkWindow_UnregisterClass (SHELL32.259) - */ -EXTERN_C BOOL WINAPI LinkWindow_UnregisterClass(void) -{ - FIXME("()\n"); - return TRUE; - -} - -/************************************************************************* - * SHFlushSFCache (SHELL32.526) - * - * Notifies the shell that a user-specified special folder location has changed. - * - * NOTES - * In Wine, the shell folder registry values are not cached, so this function - * has no effect. - */ -EXTERN_C void WINAPI SHFlushSFCache(void) -{ -} - -/************************************************************************* - * SHGetImageList (SHELL32.727) - * - * Returns a copy of a shell image list. - * - * NOTES - * Windows XP features 4 sizes of image list, and Vista 5. Wine currently - * only supports the traditional small and large image lists, so requests - * for the others will currently fail. - */ -EXTERN_C HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv) -{ - HIMAGELIST hLarge, hSmall; - HIMAGELIST hNew; - HRESULT ret = E_FAIL; - - /* Wine currently only maintains large and small image lists */ - if ((iImageList != SHIL_LARGE) && (iImageList != SHIL_SMALL) && (iImageList != SHIL_SYSSMALL)) - { - FIXME("Unsupported image list %i requested\n", iImageList); - return E_FAIL; - } - - Shell_GetImageLists(&hLarge, &hSmall); - - // Duplicating the imagelist causes the start menu items not to draw on the first show. - // Was the Duplicate necessary for some reason? I believe Windows returns the raw pointer here. - hNew = /*ImageList_Duplicate*/(iImageList == SHIL_LARGE ? hLarge : hSmall); - - /* Get the interface for the new image list */ - if (hNew) - { - IImageList *imageList = reinterpret_cast<IImageList*>(hNew); - ret = imageList->QueryInterface(riid, ppv); - - // Since we are not duplicating, destroying makes no sense. - /* ImageList_Destroy(hNew); */ - } - - return ret; -} - -/************************************************************************* - * SHParseDisplayName [shell version 6.0] - */ -EXTERN_C HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, - LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut) -{ - CComPtr<IShellFolder> psfDesktop; - HRESULT hr=E_FAIL; - ULONG dwAttr=sfgaoIn; - - if(!ppidl) - return E_INVALIDARG; - - if (!pszName || !psfgaoOut) - { - *ppidl = NULL; - return E_INVALIDARG; - } - - hr = SHGetDesktopFolder(&psfDesktop); - if (FAILED(hr)) - { - *ppidl = NULL; - return hr; - } - - hr = psfDesktop->ParseDisplayName((HWND)NULL, pbc, (LPOLESTR)pszName, (ULONG *)NULL, ppidl, &dwAttr); - - psfDesktop->Release(); - - if (SUCCEEDED(hr)) - *psfgaoOut = dwAttr; - else - *ppidl = NULL; - - return hr; -} Copied: branches/shell-experiments/dll/win32/shell32/wine/shellord.c (from r65228, branches/shell-experiments/dll/win32/shell32/shellord.cpp) URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/shellord.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/shellord.c [iso-8859-1] Mon Nov 3 18:09:50 2014 @@ -20,19 +20,50 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" - +#include <wine/config.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COBJMACROS + +#include <windef.h> +#include <winbase.h> +#include <winternl.h> +#include <shlobj.h> +#include <undocshell.h> +#include <shlwapi.h> +#include <commdlg.h> +#include <commoncontrols.h> +#include <recyclebin.h> #include <mmsystem.h> -#include <commoncontrols.h> + +#include <wine/debug.h> +#include <wine/unicode.h> + +#include "pidl.h" +#include "shell32_main.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DECLARE_DEBUG_CHANNEL(pidl); -/* FIXME: !!! move flags to header file !!! */ +/* FIXME: !!! move CREATEMRULIST and flags to header file !!! */ +/* !!! it is in both here and comctl32undoc.c !!! */ +typedef struct tagCREATEMRULIST +{ + DWORD cbSize; /* size of struct */ + DWORD nMaxItems; /* max no. of items in list */ + DWORD dwFlags; /* see below */ + HKEY hKey; /* root reg. key under which list is saved */ + LPCSTR lpszSubKey; /* reg. subkey */ + int (CALLBACK *lpfnCompare)(LPCVOID, LPCVOID, DWORD); /* item compare proc */ +} CREATEMRULISTA, *LPCREATEMRULISTA; + /* dwFlags */ #define MRUF_STRING_LIST 0 /* list will contain strings */ #define MRUF_BINARY_LIST 1 /* list will contain binary data */ #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */ + +VOID WINAPI FreeMRUList(HANDLE); EXTERN_C HANDLE WINAPI CreateMRUListA(LPCREATEMRULISTA lpcml); EXTERN_C INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData); @@ -52,7 +83,6 @@ /* Function pointers for GET_FUNC macro */ static HMODULE SHELL32_hshlwapi=NULL; - /************************************************************************* * ParseFieldA [internal] @@ -668,7 +698,7 @@ CHAR new_lnk_filepath[MAX_PATH]; CHAR new_lnk_name[MAX_PATH]; CHAR * ext; - CComPtr<IMalloc> ppM; + IMalloc *ppM; LPITEMIDLIST pidl; HWND hwnd = 0; /* FIXME: get real window handle */ INT ret; @@ -727,7 +757,7 @@ if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT, &pidl))) { SHGetPathFromIDListA(pidl, link_dir); - ppM->Free(pidl); + IMalloc_Free(ppM, pidl); } else { /* serious issues */ @@ -805,9 +835,10 @@ ext = strrchr(doc_name, '.'); if (!lstrcmpiA(ext, ".lnk")) { - CComPtr<IShellLinkA> ShellLink; - IShellLink_ConstructFromFile(NULL, IID_IShellLinkA, (LPCITEMIDLIST)SHSimpleIDListFromPathA(doc_name), (LPVOID*)&ShellLink); - ShellLink->GetPath(doc_name, MAX_PATH, NULL, 0); + IShellLinkA* ShellLink; + IShellLink_ConstructFromFile(NULL, &IID_IShellLinkA, (LPCITEMIDLIST)SHSimpleIDListFromPathA(doc_name), (LPVOID*)&ShellLink); + IShellLinkA_GetPath(ShellLink, doc_name, MAX_PATH, NULL, 0); + IShellLinkA_Release(ShellLink); } ext = strrchr(doc_name, '.'); @@ -847,7 +878,7 @@ mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE; mymru.hKey = HCUbasekey; mymru.lpszSubKey = "RecentDocs"; - mymru.lpfnCompare = (PROC)SHADD_compare_mru; + mymru.lpfnCompare = SHADD_compare_mru; mruhandle = CreateMRUListA(&mymru); if (!mruhandle) { /* MRU failed */ @@ -931,21 +962,22 @@ * uFlags[in] - flags on call to SHAddToRecentDocs * pv[in] - document path/pidl on call to SHAddToRecentDocs */ - CComPtr<IShellLinkA> psl; - CComPtr<IPersistFile> pPf; + IShellLinkA *psl = NULL; + IPersistFile *pPf = NULL; HRESULT hres; CHAR desc[MAX_PATH]; WCHAR widelink[MAX_PATH]; CoInitialize(0); - hres = CoCreateInstance(CLSID_ShellLink, + hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IShellLinkA,&psl)); + &IID_IShellLinkA, + (LPVOID )&psl); if(SUCCEEDED(hres)) { - hres = psl->QueryInterface(IID_PPV_ARG(IPersistFile,&pPf)); + hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile, (LPVOID *)&pPf); if(FAILED(hres)) { /* bombed */ ERR("failed QueryInterface for IPersistFile %08x\n", hres); @@ -954,9 +986,9 @@ /* Set the document path or pidl */ if (uFlags == SHARD_PIDL) { - hres = psl->SetIDList((LPCITEMIDLIST) pv); + hres = IShellLinkA_SetIDList(psl, pv); } else { - hres = psl->SetPath((LPCSTR) pv); + hres = IShellLinkA_SetPath(psl, pv); } if(FAILED(hres)) { /* bombed */ @@ -966,7 +998,7 @@ lstrcpyA(desc, "Shortcut to "); lstrcatA(desc, doc_name); - hres = psl->SetDescription(desc); + hres = IShellLinkA_SetDescription(psl, desc); if(FAILED(hres)) { /* bombed */ ERR("failed SetDescription %08x\n", hres); @@ -976,13 +1008,13 @@ MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1, widelink, MAX_PATH); /* create the short cut */ - hres = pPf->Save(widelink, TRUE); + hres = IPersistFile_Save(pPf, widelink, TRUE); if(FAILED(hres)) { /* bombed */ ERR("failed IPersistFile::Save %08x\n", hres); goto fail; } - hres = pPf->SaveCompleted(widelink); + hres = IPersistFile_SaveCompleted(pPf, widelink); TRACE("shortcut %s has been created, result=%08x\n", new_lnk_filepath, hres); } @@ -1015,7 +1047,7 @@ LPCSFV psvcbi, /* [in] shelltemplate struct */ IShellView **ppv) /* [out] IShellView pointer */ { - CComPtr<IShellView> psf; + IShellView * psf; HRESULT hRes; TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n", @@ -1027,7 +1059,7 @@ if (FAILED(hRes)) return hRes; - hRes = psf->QueryInterface(IID_PPV_ARG(IShellView, ppv)); + hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv); return hRes; } @@ -1074,7 +1106,7 @@ if (!SHELL32_IExplorerInterface) return E_FAIL; - SHELL32_IExplorerInterface->AddRef(); + IUnknown_AddRef(SHELL32_IExplorerInterface); return S_OK; } /************************************************************************* @@ -1341,7 +1373,7 @@ * * See shlwapi.SHAllocShared */ -HANDLE WINAPI SHAllocShared(LPVOID lpvData, DWORD dwSize, DWORD dwProcId) +HANDLE WINAPI SHAllocShared(LPCVOID lpvData, DWORD dwSize, DWORD dwProcId) { typedef HANDLE (WINAPI *SHAllocSharedProc)(LPCVOID, DWORD, DWORD); static SHAllocSharedProc pSHAllocShared; @@ -1689,7 +1721,7 @@ /* Call the AddPage method of all registered IShellPropSheetExt interfaces */ for (i = 0; i != psxa->uiCount; i++) { - psxa->pspsx[i]->AddPages(PsxaCall, (LPARAM)&Call); + psxa->pspsx[i]->lpVtbl->AddPages(psxa->pspsx[i], PsxaCall, (LPARAM)&Call); } return Call.uiCount; @@ -1772,20 +1804,20 @@ } if (SUCCEEDED(hr)) { - CComPtr<IShellExtInit> psxi; - CComPtr<IShellPropSheetExt> pspsx; + IShellExtInit *psxi; + IShellPropSheetExt *pspsx; /* Attempt to get an IShellPropSheetExt and an IShellExtInit instance. Only if both interfaces are supported it's a real shell extension. Then call IShellExtInit's Initialize method. */ - if (SUCCEEDED(CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER/* | CLSCTX_NO_CODE_DOWNLOAD */, IID_PPV_ARG(IShellPropSheetExt, &pspsx)))) + if (SUCCEEDED(CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER/* | CLSCTX_NO_CODE_DOWNLOAD */, &IID_IShellPropSheetExt, (LPVOID *)&pspsx))) { - if (SUCCEEDED(pspsx->QueryInterface(IID_PPV_ARG(IShellExtInit, &psxi)))) + if (SUCCEEDED(pspsx->lpVtbl->QueryInterface(pspsx, &IID_IShellExtInit, (PVOID *)&psxi))) { - if (SUCCEEDED(psxi->Initialize(NULL, pDataObj, hKey))) + if (SUCCEEDED(psxi->lpVtbl->Initialize(psxi, NULL, pDataObj, hKey))) { /* Add the IShellPropSheetExt instance to the array */ - psxa->pspsx[psxa->uiCount++] = pspsx.Detach(); + psxa->pspsx[psxa->uiCount++] = pspsx; } } } @@ -1829,7 +1861,7 @@ for (i = 0; i != psxa->uiCount; i++) { Call.bCalled = FALSE; - psxa->pspsx[i]->ReplacePage(uPageID, PsxaCall, (LPARAM)&Call); + psxa->pspsx[i]->lpVtbl->ReplacePage(psxa->pspsx[i], uPageID, PsxaCall, (LPARAM)&Call); } return Call.uiCount; @@ -1852,7 +1884,7 @@ { for (i = 0; i != psxa->uiCount; i++) { - psxa->pspsx[i]->Release(); + psxa->pspsx[i]->lpVtbl->Release(psxa->pspsx[i]); } LocalFree((HLOCAL)psxa); @@ -1896,7 +1928,7 @@ const FORMATETC *lpFormats, LPENUMFORMATETC *ppenumFormatetc) { - CComPtr<IEnumFORMATETC> pef; + IEnumFORMATETC *pef; HRESULT hRes; TRACE("cf=%d fe=%p pef=%p\n", cFormats, lpFormats, ppenumFormatetc); @@ -1904,8 +1936,8 @@ if (FAILED(hRes)) return hRes; - pef->AddRef(); - hRes = pef->QueryInterface(IID_PPV_ARG(IEnumFORMATETC, ppenumFormatetc)); + IEnumFORMATETC_AddRef(pef); + hRes = IEnumFORMATETC_QueryInterface(pef, &IID_IEnumFORMATETC, (LPVOID*)ppenumFormatetc); return hRes; } @@ -1916,7 +1948,7 @@ */ HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv) { - CComPtr<IShellView> psf; + IShellView *psf; HRESULT hRes; *ppsv = NULL; @@ -1930,7 +1962,7 @@ if (FAILED(hRes)) return hRes; - hRes = psf->QueryInterface(IID_PPV_ARG(IShellView, ppsv)); + hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppsv); return hRes; } @@ -2267,20 +2299,22 @@ } Shell_GetImageLists(&hLarge, &hSmall); - - // Duplicating the imagelist causes the start menu items not to draw on the first show. - // Was the Duplicate necessary for some reason? I believe Windows returns the raw pointer here. - hNew = /*ImageList_Duplicate*/(iImageList == SHIL_LARGE ? hLarge : hSmall); +#ifndef __REACTOS__ + hNew = ImageList_Duplicate(iImageList == SHIL_LARGE ? hLarge : hSmall); /* Get the interface for the new image list */ if (hNew) { - IImageList *imageList = reinterpret_cast<IImageList*>(hNew); - ret = imageList->QueryInterface(riid, ppv); - - // Since we are not duplicating, destroying makes no sense. - /* ImageList_Destroy(hNew); */ - } + ret = HIMAGELIST_QueryInterface(hNew, riid, ppv); + ImageList_Destroy(hNew); + } +#else + /* Duplicating the imagelist causes the start menu items not to draw on + * the first show. Was the Duplicate necessary for some reason? I believe + * Windows returns the raw pointer here. */ + hNew = (iImageList == SHIL_LARGE ? hLarge : hSmall); + ret = IImageList2_QueryInterface((IImageList2 *) hNew, riid, ppv); +#endif return ret; } @@ -2291,7 +2325,7 @@ EXTERN_C HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut) { - CComPtr<IShellFolder> psfDesktop; + IShellFolder *psfDesktop; HRESULT hr=E_FAIL; ULONG dwAttr=sfgaoIn; @@ -2311,9 +2345,9 @@ return hr; } - hr = psfDesktop->ParseDisplayName((HWND)NULL, pbc, (LPOLESTR)pszName, (ULONG *)NULL, ppidl, &dwAttr); - - psfDesktop->Release(); + hr = IShellFolder_ParseDisplayName(psfDesktop, (HWND)NULL, pbc, (LPOLESTR)pszName, (ULONG *)NULL, ppidl, &dwAttr); + + IShellFolder_Release(psfDesktop); if (SUCCEEDED(hr)) *psfgaoOut = dwAttr;
10 years, 1 month
1
0
0
0
[gadamopoulos] 65228: [SHELL32] - Begin improving our shell folders implementation - CAdminToolsFolder is just a fancy CFSFolder so there is no need to reinvent the wheel - Use a real CFSFolder to ...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Mon Nov 3 16:41:20 2014 New Revision: 65228 URL:
http://svn.reactos.org/svn/reactos?rev=65228&view=rev
Log: [SHELL32] - Begin improving our shell folders implementation - CAdminToolsFolder is just a fancy CFSFolder so there is no need to reinvent the wheel - Use a real CFSFolder to do all the work. When ATL aggregation works, we will be able to make this prettier - Keep a small hack in CAdminToolsFolder::GetDisplayNameOf which returns the folder's name (I need to investigate if this is correct or not) Modified: branches/shell-experiments/dll/win32/shell32/folders/admintools.cpp branches/shell-experiments/dll/win32/shell32/folders/admintools.h Modified: branches/shell-experiments/dll/win32/shell32/folders/admintools.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/folders/admintools.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/folders/admintools.cpp [iso-8859-1] Mon Nov 3 16:41:20 2014 @@ -36,304 +36,100 @@ * AdminTools folder implementation */ -class CDesktopFolderEnumY : - public IEnumIDListImpl -{ - private: - public: - CDesktopFolderEnumY(); - ~CDesktopFolderEnumY(); - HRESULT WINAPI Initialize(LPWSTR szTarget, DWORD dwFlags); - - BEGIN_COM_MAP(CDesktopFolderEnumY) - COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList) - END_COM_MAP() -}; - -static const shvheader AdminToolsSFHeader[] = { - {IDS_SHV_COLUMN8, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15}, - {IDS_SHV_COLUMN2, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10}, - {IDS_SHV_COLUMN3, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10}, - {IDS_SHV_COLUMN4, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12} -}; - -#define COLUMN_NAME 0 -#define COLUMN_SIZE 1 -#define COLUMN_TYPE 2 -#define COLUMN_DATE 3 - -#define AdminToolsHELLVIEWCOLUMNS (4) - -CDesktopFolderEnumY::CDesktopFolderEnumY() -{ -} - -CDesktopFolderEnumY::~CDesktopFolderEnumY() -{ -} - -HRESULT WINAPI CDesktopFolderEnumY::Initialize(LPWSTR szTarget, DWORD dwFlags) -{ - TRACE("(%p)->(flags=0x%08x)\n", this, dwFlags); - /* enumerate the elements in %windir%\desktop */ - return CreateFolderEnumList(szTarget, dwFlags); -} - CAdminToolsFolder::CAdminToolsFolder() { - pclsid = NULL; - - pidlRoot = NULL; /* absolute pidl */ + m_pisfInner = NULL; + m_pisf2Inner = NULL; + szTarget = NULL; - - dwAttributes = 0; /* attributes returned by GetAttributesOf FIXME: use it */ } CAdminToolsFolder::~CAdminToolsFolder() { - TRACE ("-- destroying IShellFolder(%p)\n", this); - if (pidlRoot) - SHFree(pidlRoot); HeapFree(GetProcessHeap(), 0, szTarget); + m_pisfInner.Release(); + m_pisf2Inner.Release(); } HRESULT WINAPI CAdminToolsFolder::FinalConstruct() { + HRESULT hr; + CComPtr<IPersistFolder3> ppf3; + hr = SHCoCreateInstance(NULL, &CLSID_ShellFSFolder, NULL, IID_PPV_ARG(IShellFolder, &m_pisfInner)); + if (FAILED(hr)) + return hr; + + hr = m_pisfInner->QueryInterface(IID_PPV_ARG(IShellFolder2, &m_pisf2Inner)); + if (FAILED(hr)) + return hr; + + hr = m_pisfInner->QueryInterface(IID_PPV_ARG(IPersistFolder3, &ppf3)); + if (FAILED(hr)) + return hr; + + PERSIST_FOLDER_TARGET_INFO info; + ZeroMemory(&info, sizeof(PERSIST_FOLDER_TARGET_INFO)); + info.csidl = CSIDL_COMMON_ADMINTOOLS; + hr = ppf3->InitializeEx(NULL, _ILCreateAdminTools(), &info); + szTarget = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR)); if (szTarget == NULL) return E_OUTOFMEMORY; if (!SHGetSpecialFolderPathW(NULL, szTarget, CSIDL_COMMON_ADMINTOOLS, FALSE)) return E_FAIL; - pidlRoot = _ILCreateAdminTools(); /* my qualified pidl */ - if (pidlRoot == NULL) - return E_OUTOFMEMORY; return S_OK; } -/************************************************************************** - * CAdminToolsFolder::ParseDisplayName - * - */ HRESULT WINAPI CAdminToolsFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, - DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) -{ - TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", - this, hwndOwner, pbc, lpszDisplayName, debugstr_w(lpszDisplayName), - pchEaten, ppidl, pdwAttributes); - - *ppidl = 0; - if (pchEaten) - *pchEaten = 0; - - MessageBoxW(NULL, lpszDisplayName, L"ParseDisplayName", MB_OK); - - return E_NOTIMPL; -} - -/************************************************************************** - * CAdminToolsFolder::EnumObjects - */ + ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes) +{ + return m_pisfInner->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl, pdwAttributes); +} + HRESULT WINAPI CAdminToolsFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) { - return ShellObjectCreatorInit<CDesktopFolderEnumY>(szTarget, dwFlags, IID_IEnumIDList, ppEnumIDList); -} - -/************************************************************************** - * CAdminToolsFolder::BindToObject - */ + return m_pisfInner->EnumObjects(hwndOwner, dwFlags, ppEnumIDList); +} + HRESULT WINAPI CAdminToolsFolder::BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) { - TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", this, - pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut); - - return SHELL32_BindToChild(pidlRoot, NULL, pidl, riid, ppvOut); -} - -/************************************************************************** - * CAdminToolsFolder::BindToStorage - */ + return m_pisfInner->BindToObject(pidl, pbcReserved, riid, ppvOut); +} + HRESULT WINAPI CAdminToolsFolder::BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) { - FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", - this, pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut); - - *ppvOut = NULL; - return E_NOTIMPL; -} - -/************************************************************************** - * CAdminToolsFolder::CompareIDs - */ + return m_pisfInner->BindToStorage(pidl, pbcReserved, riid, ppvOut); +} + HRESULT WINAPI CAdminToolsFolder::CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) { - int nReturn; - - TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", this, lParam, pidl1, pidl2); - nReturn = SHELL32_CompareIDs (this, lParam, pidl1, pidl2); - TRACE ("-- %i\n", nReturn); - return nReturn; -} - -/************************************************************************** - * CAdminToolsFolder::CreateViewObject - */ + return m_pisfInner->CompareIDs(lParam, pidl1, pidl2); +} + HRESULT WINAPI CAdminToolsFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) { - CComPtr<IShellView> pShellView; - HRESULT hr = E_INVALIDARG; - - TRACE ("(%p)->(hwnd=%p,%s,%p)\n", this, - hwndOwner, shdebugstr_guid (&riid), ppvOut); - - if (!ppvOut) - return hr; - - *ppvOut = NULL; - - if (IsEqualIID (riid, IID_IDropTarget)) - { - WARN ("IDropTarget not implemented\n"); - hr = E_NOTIMPL; - } - else if (IsEqualIID (riid, IID_IShellView)) - { - hr = IShellView_Constructor ((IShellFolder *)this, &pShellView); - if (pShellView) - hr = pShellView->QueryInterface(riid, ppvOut); - } - TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut); - return hr; -} - -/************************************************************************** - * ISF_AdminTools_fnGetAttributesOf - */ + return m_pisfInner->CreateViewObject(hwndOwner, riid, ppvOut); +} + HRESULT WINAPI CAdminToolsFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) { - HRESULT hr = S_OK; - static const DWORD dwAdminToolsAttributes = - SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | - SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM; - - TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", - this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0); - - if (!rgfInOut) - return E_INVALIDARG; - if (cidl && !apidl) - return E_INVALIDARG; - - if (*rgfInOut == 0) - *rgfInOut = ~0; - - if(cidl == 0) { - *rgfInOut &= dwAdminToolsAttributes; - } else { - while (cidl > 0 && *apidl) { - pdump (*apidl); - if (_ILIsAdminTools(*apidl)) { - *rgfInOut &= dwAdminToolsAttributes; - } else { - SHELL32_GetItemAttributes (this, *apidl, rgfInOut); - } - apidl++; - cidl--; - } - } - /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */ - *rgfInOut &= ~SFGAO_VALIDATE; - - TRACE ("-- result=0x%08x\n", *rgfInOut); - - return hr; -} - -/************************************************************************** - * CAdminToolsFolder::GetUIObjectOf - * - * PARAMETERS - * HWND hwndOwner, //[in ] Parent window for any output - * UINT cidl, //[in ] array size - * LPCITEMIDLIST* apidl, //[in ] simple pidl array - * REFIID riid, //[in ] Requested Interface - * UINT* prgfInOut, //[ ] reserved - * LPVOID* ppvObject) //[out] Resulting Interface - * - */ + return m_pisfInner->GetAttributesOf(cidl, apidl, rgfInOut); +} + HRESULT WINAPI CAdminToolsFolder::GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) { - LPITEMIDLIST pidl; - CComPtr<IUnknown> pObj; - HRESULT hr = E_INVALIDARG; - - TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", - this, hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut); - - if (!ppvOut) - return hr; - - *ppvOut = NULL; - - if (IsEqualIID (riid, IID_IContextMenu)) - { - IContextMenu * pCm = NULL; - hr = CDefFolderMenu_Create2(pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), NULL, 0, NULL, &pCm); - pObj = pCm; - } - else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1)) - { - IDataObject * pDo = NULL; - hr = IDataObject_Constructor(hwndOwner, pidlRoot, apidl, cidl, &pDo); - pObj = pDo; - } - else if (IsEqualIID (riid, IID_IExtractIconA) && (cidl == 1)) - { - pidl = ILCombine (pidlRoot, apidl[0]); - pObj = IExtractIconA_Constructor (pidl); - SHFree (pidl); - hr = S_OK; - } - else if (IsEqualIID (riid, IID_IExtractIconW) && (cidl == 1)) - { - pidl = ILCombine (pidlRoot, apidl[0]); - pObj = IExtractIconW_Constructor (pidl); - SHFree (pidl); - hr = S_OK; - } - else if (IsEqualIID (riid, IID_IDropTarget) && (cidl >= 1)) - { - IDropTarget * pDt = NULL; - hr = this->QueryInterface(IID_PPV_ARG(IDropTarget, &pDt)); - pObj = pDt; - } - else if ((IsEqualIID(riid, IID_IShellLinkW) || - IsEqualIID(riid, IID_IShellLinkA)) && (cidl == 1)) - { - pidl = ILCombine (pidlRoot, apidl[0]); - hr = IShellLink_ConstructFromFile(NULL, riid, pidl, reinterpret_cast<LPVOID*>(&pObj)); - SHFree (pidl); - } - else - hr = E_NOINTERFACE; - - if (SUCCEEDED(hr) && !pObj) - hr = E_OUTOFMEMORY; - - *ppvOut = pObj.Detach(); - TRACE ("(%p)->hr=0x%08x\n", this, hr); - return hr; -} - -/************************************************************************** - * CAdminToolsFolder::GetDisplayNameOf - * - */ + return m_pisfInner->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppvOut); +} + HRESULT WINAPI CAdminToolsFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) { + if (!_ILIsSpecialFolder(pidl)) + return m_pisfInner->GetDisplayNameOf(pidl, dwFlags, strRet); + HRESULT hr = S_OK; - LPWSTR pszPath, pOffset; + LPWSTR pszPath; TRACE ("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet); pdump (pidl); @@ -355,58 +151,6 @@ else if (!HCR_GetClassNameW(CLSID_AdminFolderShortcut, pszPath, MAX_PATH)) hr = E_FAIL; } - else if (_ILIsPidlSimple(pidl)) - { - if ((GET_SHGDN_FOR(dwFlags) & SHGDN_FORPARSING) && - (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER) && - szTarget) - { - wcscpy(pszPath, szTarget); - pOffset = PathAddBackslashW(pszPath); - if (pOffset) - { - if (!_ILSimpleGetTextW(pidl, pOffset, MAX_PATH + 1 - (pOffset - pszPath))) - hr = E_FAIL; - } - else - hr = E_FAIL; - } - else - { - if (_ILSimpleGetTextW(pidl, pszPath, MAX_PATH + 1)) - { - if (SHELL_FS_HideExtension(pszPath)) - PathRemoveExtensionW(pszPath); - } - else - hr = E_FAIL; - } - } - else if (_ILIsSpecialFolder(pidl)) - { - BOOL bSimplePidl = _ILIsPidlSimple(pidl); - - if (bSimplePidl) - { - if (!_ILSimpleGetTextW(pidl, pszPath, MAX_PATH)) - hr = E_FAIL; - } - else if ((dwFlags & SHGDN_FORPARSING) && !bSimplePidl) - { - int len = 0; - - wcscpy(pszPath, szTarget); - PathAddBackslashW(pszPath); - len = wcslen(pszPath); - - if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags | SHGDN_INFOLDER, pszPath + len, MAX_PATH + 1 - len))) - { - CoTaskMemFree(pszPath); - return E_OUTOFMEMORY; - } - - } - } if (SUCCEEDED(hr)) { @@ -420,111 +164,45 @@ return hr; } -/************************************************************************** - * CAdminToolsFolder::SetNameOf - * Changes the name of a file object or subfolder, possibly changing its item - * identifier in the process. - * - * PARAMETERS - * HWND hwndOwner, //[in ] Owner window for output - * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change - * LPCOLESTR lpszName, //[in ] the items new display name - * DWORD dwFlags, //[in ] SHGNO formatting flags - * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned - */ HRESULT WINAPI CAdminToolsFolder::SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, /* simple pidl */ LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) { - FIXME ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", this, hwndOwner, pidl, - debugstr_w (lpName), dwFlags, pPidlOut); - - return E_FAIL; + return m_pisfInner->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut); } HRESULT WINAPI CAdminToolsFolder::GetDefaultSearchGUID(GUID *pguid) { - FIXME ("(%p)\n", this); - return E_NOTIMPL; + return m_pisf2Inner->GetDefaultSearchGUID(pguid); } HRESULT WINAPI CAdminToolsFolder::EnumSearches(IEnumExtraSearch ** ppenum) { - FIXME ("(%p)\n", this); - return E_NOTIMPL; + return m_pisf2Inner->EnumSearches(ppenum); } HRESULT WINAPI CAdminToolsFolder::GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) { - if (pSort) - *pSort = 0; - if (pDisplay) - *pDisplay = 0; - - return S_OK; -} + return m_pisf2Inner->GetDefaultColumn(dwRes, pSort, pDisplay); +} + HRESULT WINAPI CAdminToolsFolder::GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags) { - if (!pcsFlags || iColumn >= AdminToolsHELLVIEWCOLUMNS) - return E_INVALIDARG; - *pcsFlags = AdminToolsSFHeader[iColumn].pcsFlags; - return S_OK; - + return m_pisf2Inner->GetDefaultColumnState(iColumn, pcsFlags); } HRESULT WINAPI CAdminToolsFolder::GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) { - FIXME ("(%p): stub\n", this); - - return E_NOTIMPL; + return m_pisf2Inner->GetDetailsEx(pidl, pscid, pv); } HRESULT WINAPI CAdminToolsFolder::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) { - WCHAR buffer[MAX_PATH] = {0}; - HRESULT hr = E_FAIL; - - TRACE("(%p)->(%p %i %p): stub\n", this, pidl, iColumn, psd); - - if (iColumn >= AdminToolsHELLVIEWCOLUMNS) - return E_FAIL; - - psd->fmt = AdminToolsSFHeader[iColumn].fmt; - psd->cxChar = AdminToolsSFHeader[iColumn].cxChar; - if (pidl == NULL) - { - psd->str.uType = STRRET_WSTR; - if (LoadStringW(shell32_hInstance, AdminToolsSFHeader[iColumn].colnameid, buffer, MAX_PATH)) - hr = SHStrDupW(buffer, &psd->str.pOleStr); - - return hr; - } - - psd->str.uType = STRRET_CSTR; - switch (iColumn) - { - case COLUMN_NAME: - psd->str.uType = STRRET_WSTR; - hr = GetDisplayNameOf(pidl, - SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str); - break; - case COLUMN_SIZE: - _ILGetFileSize (pidl, psd->str.cStr, MAX_PATH); - break; - case COLUMN_TYPE: - _ILGetFileType (pidl, psd->str.cStr, MAX_PATH); - break; - case COLUMN_DATE: - _ILGetFileDate (pidl, psd->str.cStr, MAX_PATH); - break; - } - - return hr; + return m_pisf2Inner->GetDetailsOf(pidl, iColumn, psd); } HRESULT WINAPI CAdminToolsFolder::MapColumnToSCID(UINT column, SHCOLUMNID *pscid) { - FIXME ("(%p): stub\n", this); - return E_NOTIMPL; + return m_pisf2Inner->MapColumnToSCID(column, pscid); } /************************************************************************ @@ -545,10 +223,6 @@ */ HRESULT WINAPI CAdminToolsFolder::Initialize(LPCITEMIDLIST pidl) { - if (pidlRoot) - SHFree((LPVOID)pidlRoot); - - pidlRoot = ILClone(pidl); return S_OK; } @@ -557,8 +231,7 @@ */ HRESULT WINAPI CAdminToolsFolder::GetCurFolder(LPITEMIDLIST *pidl) { - TRACE ("(%p)->(%p)\n", this, pidl); - - *pidl = ILClone (pidlRoot); - return S_OK; -} + CComPtr<IPersistFolder2> ppf2; + m_pisfInner->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2)); + return ppf2->GetCurFolder(pidl); +} Modified: branches/shell-experiments/dll/win32/shell32/folders/admintools.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/folders/admintools.h [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/folders/admintools.h [iso-8859-1] Mon Nov 3 16:41:20 2014 @@ -29,19 +29,16 @@ public IPersistFolder2 { private: - CLSID *pclsid; - - LPITEMIDLIST pidlRoot; /* absolute pidl */ + CComPtr<IShellFolder> m_pisfInner; + CComPtr<IShellFolder2> m_pisf2Inner; LPWSTR szTarget; - - int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */ public: CAdminToolsFolder(); ~CAdminToolsFolder(); HRESULT WINAPI FinalConstruct(); // IShellFolder - virtual HRESULT WINAPI ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes); + virtual HRESULT WINAPI ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes); virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList); virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut); virtual HRESULT WINAPI BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
10 years, 1 month
1
0
0
0
[tfaber] 65227: [PCI] - Addendum to r65181: fix a stray debug print
by tfaber@svn.reactos.org
Author: tfaber Date: Mon Nov 3 16:16:26 2014 New Revision: 65227 URL:
http://svn.reactos.org/svn/reactos?rev=65227&view=rev
Log: [PCI] - Addendum to r65181: fix a stray debug print Modified: trunk/reactos/drivers/bus/pci/pdo.c Modified: trunk/reactos/drivers/bus/pci/pdo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/pdo.c?rev=…
============================================================================== --- trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] Mon Nov 3 16:16:26 2014 @@ -1327,7 +1327,7 @@ } else { - DbgPrint("None\n"); + DBGPRINT("None\n"); } return STATUS_SUCCESS;
10 years, 1 month
1
0
0
0
[dquintana] 65226: [EXPLORER-NEW] * Move the CToolbar class into rosctrls.h, so we can make use of it in other parts of reactos.
by dquintana@svn.reactos.org
Author: dquintana Date: Mon Nov 3 16:05:09 2014 New Revision: 65226 URL:
http://svn.reactos.org/svn/reactos?rev=65226&view=rev
Log: [EXPLORER-NEW] * Move the CToolbar class into rosctrls.h, so we can make use of it in other parts of reactos. Modified: branches/shell-experiments/base/shell/explorer-new/precomp.h branches/shell-experiments/base/shell/explorer-new/trayntfy.cpp branches/shell-experiments/include/reactos/rosctrls.h Modified: branches/shell-experiments/base/shell/explorer-new/precomp.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
============================================================================== --- branches/shell-experiments/base/shell/explorer-new/precomp.h [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/explorer-new/precomp.h [iso-8859-1] Mon Nov 3 16:05:09 2014 @@ -30,6 +30,7 @@ #include <strsafe.h> #include <undocuser.h> #include <undocshell.h> +#include <rosctrls.h> #include "tmschema.h" #include "resource.h" Modified: branches/shell-experiments/base/shell/explorer-new/trayntfy.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
============================================================================== --- branches/shell-experiments/base/shell/explorer-new/trayntfy.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/explorer-new/trayntfy.cpp [iso-8859-1] Mon Nov 3 16:05:09 2014 @@ -21,8 +21,6 @@ #include "precomp.h" //#include <docobj.h> -typedef unsigned short USHORT; - /* * SysPagerWnd */ @@ -36,87 +34,6 @@ NOTIFYICONDATA nicon_data; } SYS_PAGER_COPY_DATA, *PSYS_PAGER_COPY_DATA; -template<typename TItemData> -class CToolbar : - public CWindowImpl < CToolbar<TItemData>, CWindow, CControlWinTraits> -{ - -public: - int GetItemCount() - { - return this->SendMessageW(TB_BUTTONCOUNT); - } - - DWORD GetButton(int index, TBBUTTON * btn) - { - return this->SendMessageW(TB_GETBUTTON, index, (LPARAM) btn); - } - - DWORD AddButton(TBBUTTON * btn) - { - return this->SendMessageW(TB_ADDBUTTONS, 1, (LPARAM) btn); - } - - DWORD AddButtons(int count, TBBUTTON * buttons) - { - return this->SendMessageW(TB_ADDBUTTONS, count, (LPARAM) buttons); - } - - DWORD InsertButton(int insertAt, TBBUTTON * btn) - { - return this->SendMessageW(TB_INSERTBUTTON, insertAt, (LPARAM) btn); - } - - DWORD MoveButton(int oldIndex, int newIndex) - { - return this->SendMessageW(TB_MOVEBUTTON, oldIndex, newIndex); - } - - DWORD DeleteButton(int index) - { - return this->SendMessageW(TB_DELETEBUTTON, index, 0); - } - - DWORD GetButtonInfo(int cmdId, TBBUTTONINFO * info) - { - return this->SendMessageW(TB_GETBUTTONINFO, cmdId, (LPARAM) info); - } - - DWORD SetButtonInfo(int cmdId, TBBUTTONINFO * info) - { - return this->SendMessageW(TB_SETBUTTONINFO, cmdId, (LPARAM) info); - } - -public: - DWORD SetButtonSize(int w, int h) - { - return this->SendMessageW(TB_SETBUTTONSIZE, 0, MAKELONG(w, h)); - } - -public: - DWORD AutoSize() - { - return this->SendMessageW(TB_AUTOSIZE); - } - -public: - TItemData * GetItemData(int index) - { - TBBUTTON btn; - GetButton(index, &btn); - return (TItemData*) btn.dwData; - } - - DWORD SetItemData(int index, TItemData * data) - { - TBBUTTONINFOW info = { 0 }; - info.cbSize = sizeof(info); - info.dwMask = TBIF_BYINDEX | TBIF_LPARAM; - info.lParam = (DWORD_PTR) data; - return SetButtonInfo(index, &info); - } -}; - class CNotifyToolbar : public CToolbar<NOTIFYICONDATA> { @@ -136,14 +53,14 @@ { } - int GetVisibleItemCount() + int GetVisibleButtonCount() { return VisibleButtonCount; } int FindItemByIconData(IN CONST NOTIFYICONDATA *iconData, NOTIFYICONDATA ** pdata) { - int count = GetItemCount(); + int count = GetButtonCount(); for (int i = 0; i < count; i++) { @@ -179,7 +96,7 @@ tbBtn.fsStyle = BTNS_NOPREFIX; tbBtn.dwData = (DWORD_PTR)notifyItem; tbBtn.iString = (INT_PTR) text; - tbBtn.idCommand = GetItemCount(); + tbBtn.idCommand = GetButtonCount(); if (iconData->uFlags & NIF_MESSAGE) { @@ -228,9 +145,6 @@ } tbbi.cbSize = sizeof(tbbi); - tbbi.dwMask = TBIF_BYINDEX | TBIF_STATE; - GetButtonInfo(index, &tbbi); - tbbi.dwMask = TBIF_BYINDEX | TBIF_COMMAND; tbbi.idCommand = index; @@ -258,19 +172,13 @@ tbbi.dwMask |= TBIF_STATE; if (iconData->dwState & NIS_HIDDEN) { - if ((tbbi.fsState & TBSTATE_HIDDEN) == 0) - { - tbbi.fsState |= TBSTATE_HIDDEN; - VisibleButtonCount--; - } + tbbi.fsState |= TBSTATE_HIDDEN; + VisibleButtonCount--; } else { - if ((tbbi.fsState & TBSTATE_HIDDEN) != 0) - { - tbbi.fsState &= ~TBSTATE_HIDDEN; - VisibleButtonCount++; - } + tbbi.fsState &= ~TBSTATE_HIDDEN; + VisibleButtonCount++; } } @@ -389,34 +297,15 @@ WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE | TBSTYLE_TRANSPARENT | CCS_TOP | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER; - DWORD exStyles = WS_EX_TOOLWINDOW; - - HWND hWndToolbar = CreateWindowEx(exStyles, - TOOLBARCLASSNAME, - NULL, - styles, - 0, - 0, - 0, - 0, - hWndParent, - NULL, - hExplorerInstance, - NULL); - if (hWndToolbar != NULL) - { - SubclassWindow(hWndToolbar); - - SetWindowTheme(hWndToolbar, L"TrayNotify", NULL); - - /* Identify the version we're using */ - SendMessageW(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); - - SysIcons = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1000); - SendMessageW(TB_SETIMAGELIST, 0, (LPARAM) SysIcons); - - SetButtonSize(ICON_SIZE, ICON_SIZE); - } + + Create(hWndParent, styles); + + SetWindowTheme(m_hWnd, L"TrayNotify", NULL); + + SysIcons = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1000); + SetImageList(SysIcons); + + SetButtonSize(ICON_SIZE, ICON_SIZE); } }; @@ -424,14 +313,11 @@ public CComObjectRootEx<CComMultiThreadModelNoCS>, public CWindowImpl < CSysPagerWnd, CWindow, CControlWinTraits > { - CNotifyToolbar * Toolbar; + CNotifyToolbar Toolbar; public: - CSysPagerWnd() : - Toolbar(NULL) - { - } - virtual ~CSysPagerWnd() { } + CSysPagerWnd() {} + virtual ~CSysPagerWnd() {} LRESULT DrawBackground(HDC hdc) { @@ -458,8 +344,7 @@ LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - Toolbar = new CNotifyToolbar(); - Toolbar->Initialize(m_hWnd); + Toolbar.Initialize(m_hWnd); return TRUE; } @@ -483,17 +368,17 @@ { case NIM_ADD: { - Toolbar->AddButton(iconData); + Toolbar.AddButton(iconData); break; } case NIM_MODIFY: { - Toolbar->UpdateButton(iconData); + Toolbar.UpdateButton(iconData); break; } case NIM_DELETE: { - Toolbar->RemoveButton(iconData); + Toolbar.RemoveButton(iconData); break; } default: @@ -514,7 +399,7 @@ { INT rows = 0; TBMETRICS tbm; - int VisibleButtonCount = Toolbar->GetVisibleItemCount(); + int VisibleButtonCount = Toolbar.GetVisibleButtonCount(); if (wParam) /* horizontal */ { @@ -537,13 +422,13 @@ tbm.cxButtonSpacing = 0; tbm.cyButtonSpacing = 0; - Toolbar->SendMessageW(TB_SETMETRICS, 0, (LPARAM) &tbm); + Toolbar.SetMetrics(&tbm); } LRESULT OnGetInfoTip(INT uCode, LPNMHDR hdr, BOOL& bHandled) { NMTBGETINFOTIPW * nmtip = (NMTBGETINFOTIPW *) hdr; - Toolbar->GetTooltip(nmtip->iItem, nmtip->pszText, nmtip->cchTextMax); + Toolbar.GetTooltip(nmtip->iItem, nmtip->pszText, nmtip->cchTextMax); return TRUE; } @@ -572,19 +457,18 @@ if (Toolbar) { - Toolbar->SetWindowPos(NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER); - - Toolbar->AutoSize(); + Toolbar.SetWindowPos(NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER); + Toolbar.AutoSize(); RECT rc; - Toolbar->GetClientRect(&rc); + Toolbar.GetClientRect(&rc); SIZE szBar = { rc.right - rc.left, rc.bottom - rc.top }; INT xOff = (szClient.cx - szBar.cx) / 2; INT yOff = (szClient.cy - szBar.cy) / 2; - Toolbar->SetWindowPos(NULL, xOff, yOff, szBar.cx, szBar.cy, SWP_NOZORDER); + Toolbar.SetWindowPos(NULL, xOff, yOff, szBar.cx, szBar.cy, SWP_NOZORDER); } return Ret; } Modified: branches/shell-experiments/include/reactos/rosctrls.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/include/react…
============================================================================== --- branches/shell-experiments/include/reactos/rosctrls.h [iso-8859-1] (original) +++ branches/shell-experiments/include/reactos/rosctrls.h [iso-8859-1] Mon Nov 3 16:05:09 2014 @@ -196,3 +196,134 @@ } }; + +template<typename TItemData> +class CToolbar : + public CWindow +{ +public: // Configuration methods + + HWND Create(HWND hWndParent, DWORD dwStyles = 0, DWORD dwExStyles = 0) + { + if (!dwStyles) + { + dwStyles = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN; + } + + if (!dwExStyles) + { + dwExStyles = WS_EX_TOOLWINDOW; + } + + m_hWnd = CreateWindowEx(dwExStyles, + TOOLBARCLASSNAME, + NULL, + dwStyles, + 0, + 0, + 0, + 0, + hWndParent, + NULL, + _AtlBaseModule.GetModuleInstance(), + NULL); + + if (!m_hWnd) + return NULL; + + /* Identify the version we're using */ + SetButtonStructSize(); + + return m_hWnd; + } + + DWORD SetButtonStructSize() + { + return SendMessageW(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); + } + +public: // Button list management methods + int GetButtonCount() + { + return SendMessageW(TB_BUTTONCOUNT); + } + + DWORD GetButton(int index, TBBUTTON * btn) + { + return SendMessageW(TB_GETBUTTON, index, (LPARAM) btn); + } + + DWORD AddButton(TBBUTTON * btn) + { + return SendMessageW(TB_ADDBUTTONS, 1, (LPARAM) btn); + } + + DWORD AddButtons(int count, TBBUTTON * buttons) + { + return SendMessageW(TB_ADDBUTTONS, count, (LPARAM) buttons); + } + + DWORD InsertButton(int insertAt, TBBUTTON * btn) + { + return SendMessageW(TB_INSERTBUTTON, insertAt, (LPARAM) btn); + } + + DWORD MoveButton(int oldIndex, int newIndex) + { + return SendMessageW(TB_MOVEBUTTON, oldIndex, newIndex); + } + + DWORD DeleteButton(int index) + { + return SendMessageW(TB_DELETEBUTTON, index, 0); + } + + DWORD GetButtonInfo(int cmdId, TBBUTTONINFO * info) + { + return SendMessageW(TB_GETBUTTONINFO, cmdId, (LPARAM) info); + } + + DWORD SetButtonInfo(int cmdId, TBBUTTONINFO * info) + { + return SendMessageW(TB_SETBUTTONINFO, cmdId, (LPARAM) info); + } + +public: // Layout management methods + DWORD SetButtonSize(int w, int h) + { + return SendMessageW(TB_SETBUTTONSIZE, 0, MAKELONG(w, h)); + } + + DWORD AutoSize() + { + return SendMessageW(TB_AUTOSIZE); + } + +public: // Image list management methods + DWORD SetImageList(HIMAGELIST himl) + { + return SendMessageW(TB_SETIMAGELIST, 0, (LPARAM) himl); + } + + DWORD SetMetrics(TBMETRICS * tbm) + { + return SendMessageW(TB_SETMETRICS, 0, (LPARAM) tbm); + } + +public: // Utility methods + TItemData * GetItemData(int index) + { + TBBUTTON btn; + GetButton(index, &btn); + return (TItemData*) btn.dwData; + } + + DWORD SetItemData(int index, TItemData * data) + { + TBBUTTONINFOW info = { 0 }; + info.cbSize = sizeof(info); + info.dwMask = TBIF_BYINDEX | TBIF_LPARAM; + info.lParam = (DWORD_PTR) data; + return SetButtonInfo(index, &info); + } +};
10 years, 1 month
1
0
0
0
← Newer
1
...
28
29
30
31
32
33
34
...
38
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
Results per page:
10
25
50
100
200