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
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 -----
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
[khornicek] 65295: [USER32] - partially sync exticon.c with Wine 1.7.30
by khornicek@svn.reactos.org
Author: khornicek Date: Thu Nov 6 18:33:42 2014 New Revision: 65295 URL:
http://svn.reactos.org/svn/reactos?rev=65295&view=rev
Log: [USER32] - partially sync exticon.c with Wine 1.7.30 Modified: trunk/reactos/win32ss/user/user32/misc/exticon.c Modified: trunk/reactos/win32ss/user/user32/misc/exticon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/e…
============================================================================== --- trunk/reactos/win32ss/user/user32/misc/exticon.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/exticon.c [iso-8859-1] Thu Nov 6 18:33:42 2014 @@ -112,7 +112,7 @@ } if (*((DWORD*)(peimage + mz_header->e_lfanew)) == IMAGE_NT_SIGNATURE ) return IMAGE_NT_SIGNATURE; -#if 0 +#ifdef WINE if (*((WORD*)(peimage + mz_header->e_lfanew)) == IMAGE_OS2_SIGNATURE ) { IMAGE_OS2_HEADER * ne_header; @@ -132,7 +132,7 @@ #endif return 0; /* failed */ } -#if 0 +#ifdef WINE /************************************************************************* * USER32_LoadResource */ @@ -160,9 +160,6 @@ * * Reads .ico file and build phony ICONDIR struct */ -#define HEADER_SIZE (sizeof(CURSORICONDIR) - sizeof (CURSORICONDIRENTRY)) -#define HEADER_SIZE_FILE (sizeof(icoICONDIR) - sizeof (icoICONDIRENTRY)) - static BYTE * ICO_GetIconDirectory( LPBYTE peimage, LPicoICONDIR* lplpiID, ULONG *uSize ) { CURSORICONDIR * lpcid; /* icon resource in resource-dir format */ @@ -177,7 +174,7 @@ return 0; /* allocate the phony ICONDIR structure */ - *uSize = lpcid->idCount * sizeof(CURSORICONDIRENTRY) + HEADER_SIZE; + *uSize = FIELD_OFFSET(CURSORICONDIR, idEntries[lpcid->idCount]); if( (lpID = HeapAlloc(GetProcessHeap(),0, *uSize) )) { /* copy the header */ @@ -188,7 +185,7 @@ /* copy the entries */ for( i=0; i < lpcid->idCount; i++ ) { - memcpy(&lpID->idEntries[i], &lpcid->idEntries[i], sizeof(CURSORICONDIRENTRY) - 2); + memcpy(&lpID->idEntries[i], &lpcid->idEntries[i], sizeof(CURSORICONDIRENTRY) - 2); lpID->idEntries[i].wResId = i; } @@ -274,8 +271,8 @@ sig = USER32_GetResourceTable(peimage, fsizel, &pData); +#ifdef WINE /* ico file or NE exe/dll*/ -#if 0 if (sig==IMAGE_OS2_SIGNATURE || sig==1) /* .ICO file */ { BYTE *pCIDir = 0; @@ -283,8 +280,9 @@ NE_NAMEINFO *pIconStorage = NULL; NE_NAMEINFO *pIconDir = NULL; LPicoICONDIR lpiID = NULL; - - TRACE("-- OS2/icon Signature (0x%08lx)\n", sig); + ULONG uSize = 0; + + TRACE("-- OS2/icon Signature (0x%08x)\n", sig); if (pData == (BYTE*)-1) { @@ -292,7 +290,7 @@ if (pCIDir) { iconDirCount = 1; iconCount = lpiID->idCount; - TRACE("-- icon found %p 0x%08lx 0x%08x 0x%08x\n", pCIDir, uSize, iconDirCount, iconCount); + TRACE("-- icon found %p 0x%08x 0x%08x 0x%08x\n", pCIDir, uSize, iconDirCount, iconCount); } } else while (pTInfo->type_id && !(pIconStorage && pIconDir)) @@ -317,7 +315,7 @@ if (nIcons == 0) { ret = iconDirCount; - if (lpiID && pCIDir) /* *.ico file, deallocate heap pointer*/ + if (lpiID) /* *.ico file, deallocate heap pointer*/ HeapFree(GetProcessHeap(), 0, pCIDir); } else if (nIconIndex < iconDirCount) @@ -331,9 +329,10 @@ /* .ICO files have only one icon directory */ if (lpiID == NULL) /* not *.ico */ pCIDir = USER32_LoadResource(peimage, pIconDir + i + nIconIndex, *(WORD*)pData, &uSize); - pIconId[i] = LookupIconIdFromDirectoryEx(pCIDir, TRUE, (i & 1) ? cx2 : cx1, (i & 1) ? cy2 : cy1, flags); + pIconId[i] = LookupIconIdFromDirectoryEx(pCIDir, TRUE, cx1, cy1, flags); + if (cx2 && cy2) pIconId[++i] = LookupIconIdFromDirectoryEx(pCIDir, TRUE, cx2, cy2, flags); } - if (lpiID && pCIDir) /* *.ico file, deallocate heap pointer*/ + if (lpiID) /* *.ico file, deallocate heap pointer*/ HeapFree(GetProcessHeap(), 0, pCIDir); for (icon = 0; icon < nIcons; icon++) @@ -347,8 +346,13 @@ pCIDir = USER32_LoadResource(peimage, pIconStorage + i, *(WORD*)pData, &uSize); if (pCIDir) - RetPtr[icon] = (HICON)CreateIconFromResourceEx(pCIDir, uSize, TRUE, 0x00030000, - (icon & 1) ? cx2 : cx1, (icon & 1) ? cy2 : cy1, flags); + { + RetPtr[icon] = CreateIconFromResourceEx(pCIDir, uSize, TRUE, 0x00030000, + cx1, cy1, flags); + if (cx2 && cy2) + RetPtr[++icon] = CreateIconFromResourceEx(pCIDir, uSize, TRUE, 0x00030000, + cx2, cy2, flags); + } else RetPtr[icon] = 0; } @@ -363,47 +367,19 @@ #endif if( sig == IMAGE_NT_SIGNATURE ) { - LPBYTE idata,igdata; - PIMAGE_DOS_HEADER dheader; - PIMAGE_NT_HEADERS pe_header; - PIMAGE_SECTION_HEADER pe_sections; - const IMAGE_RESOURCE_DIRECTORY *rootresdir,*iconresdir,*icongroupresdir; - const IMAGE_RESOURCE_DATA_ENTRY *idataent,*igdataent; - const IMAGE_RESOURCE_DIRECTORY_ENTRY *xresent; - UINT i, j; - - dheader = (PIMAGE_DOS_HEADER)peimage; - pe_header = (PIMAGE_NT_HEADERS)(peimage+dheader->e_lfanew); /* it is a pe header, USER32_GetResourceTable checked that */ - pe_sections = (PIMAGE_SECTION_HEADER)(((char*)pe_header) + sizeof(DWORD) + sizeof(IMAGE_FILE_HEADER) - + pe_header->FileHeader.SizeOfOptionalHeader); - rootresdir = NULL; - - /* search for the root resource directory */ - for (i=0;i<pe_header->FileHeader.NumberOfSections;i++) - { - if (pe_sections[i].Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) - continue; - if (fsizel < pe_sections[i].PointerToRawData+pe_sections[i].SizeOfRawData) { - FIXME("File %s too short (section is at %ld bytes, real size is %ld)\n", - debugstr_w(lpszExeFileName), - pe_sections[i].PointerToRawData+pe_sections[i].SizeOfRawData, - fsizel - ); - goto end; - } - /* FIXME: doesn't work when the resources are not in a separate section */ - if (pe_sections[i].VirtualAddress == pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress) - { - rootresdir = (PIMAGE_RESOURCE_DIRECTORY)(peimage+pe_sections[i].PointerToRawData); - break; - } - } - - if (!rootresdir) - { - WARN("haven't found section for resource directory.\n"); - goto end; /* failure */ - } + BYTE *idata, *igdata; + const IMAGE_RESOURCE_DIRECTORY *rootresdir, *iconresdir, *icongroupresdir; + const IMAGE_RESOURCE_DATA_ENTRY *idataent, *igdataent; + const IMAGE_RESOURCE_DIRECTORY_ENTRY *xresent; + ULONG size; + UINT i; + + rootresdir = RtlImageDirectoryEntryToData((HMODULE)peimage, FALSE, IMAGE_DIRECTORY_ENTRY_RESOURCE, &size); + if (!rootresdir) + { + WARN("haven't found section for resource directory.\n"); + goto end; + } /* search for the group icon directory */ if (!(icongroupresdir = find_entry_by_id(rootresdir, LOWORD(RT_GROUP_ICON), rootresdir))) @@ -465,37 +441,21 @@ const IMAGE_RESOURCE_DIRECTORY *resdir; /* go down this resource entry, name */ - resdir = (const IMAGE_RESOURCE_DIRECTORY*)((const char *)rootresdir+(xresent->OffsetToDirectory)); + resdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)rootresdir + xresent->OffsetToDirectory); /* default language (0) */ resdir = find_entry_default(resdir,rootresdir); igdataent = (const IMAGE_RESOURCE_DATA_ENTRY*)resdir; /* lookup address in mapped image for virtual address */ - igdata = NULL; - - for (j=0;j<pe_header->FileHeader.NumberOfSections;j++) - { - if (igdataent->OffsetToData < pe_sections[j].VirtualAddress) - continue; - if (igdataent->OffsetToData+igdataent->Size > pe_sections[j].VirtualAddress+pe_sections[j].SizeOfRawData) - continue; - - if (igdataent->OffsetToData-pe_sections[j].VirtualAddress+pe_sections[j].PointerToRawData+igdataent->Size > fsizel) { - FIXME("overflow in PE lookup (%s has len %ld, have offset %ld), short file?\n", debugstr_w(lpszExeFileName), fsizel, - igdataent->OffsetToData - pe_sections[j].VirtualAddress + pe_sections[j].PointerToRawData + igdataent->Size); - goto end; /* failure */ - } - igdata = peimage+(igdataent->OffsetToData-pe_sections[j].VirtualAddress+pe_sections[j].PointerToRawData); - } - - if (!igdata) + igdata = RtlImageRvaToVa(RtlImageNtHeader((HMODULE)peimage), (HMODULE)peimage, igdataent->OffsetToData, NULL); + if (!igdata) { FIXME("no matching real address for icongroup!\n"); goto end; /* failure */ } pIconId[i] = LookupIconIdFromDirectoryEx(igdata, TRUE, cx1, cy1, flags); - if (cx2 && cy2) pIconId[++i] = LookupIconIdFromDirectoryEx(igdata, TRUE, cx2, cy2, flags); + if (cx2 && cy2) pIconId[++i] = LookupIconIdFromDirectoryEx(igdata, TRUE, cx2, cy2, flags); } if (!(iconresdir=find_entry_by_id(rootresdir,LOWORD(RT_ICON),rootresdir))) @@ -508,32 +468,17 @@ { const IMAGE_RESOURCE_DIRECTORY *xresdir; xresdir = find_entry_by_id(iconresdir, LOWORD(pIconId[i]), rootresdir); - if (!xresdir) - { - WARN("icon entry %d not found\n", LOWORD(pIconId[i])); + if( !xresdir ) + { + WARN("icon entry %d not found\n", LOWORD(pIconId[i])); RetPtr[i]=0; continue; - } + } xresdir = find_entry_default(xresdir, rootresdir); - if (!xresdir) - { - WARN("icon entry %d not found\n", LOWORD(pIconId[i])); - RetPtr[i]=0; - continue; - } idataent = (const IMAGE_RESOURCE_DATA_ENTRY*)xresdir; - idata = NULL; - - /* map virtual to address in image */ - for (j=0;j<pe_header->FileHeader.NumberOfSections;j++) - { - if (idataent->OffsetToData < pe_sections[j].VirtualAddress) - continue; - if (idataent->OffsetToData+idataent->Size > pe_sections[j].VirtualAddress+pe_sections[j].SizeOfRawData) - continue; - idata = peimage+(idataent->OffsetToData-pe_sections[j].VirtualAddress+pe_sections[j].PointerToRawData); - } - if (!idata) + + idata = RtlImageRvaToVa(RtlImageNtHeader((HMODULE)peimage), (HMODULE)peimage, idataent->OffsetToData, NULL); + if (!idata) { WARN("no matching real address found for icondata!\n"); RetPtr[i]=0; @@ -644,7 +589,7 @@ cxsmicon = GetSystemMetrics(SM_CXSMICON); cysmicon = GetSystemMetrics(SM_CYSMICON); - ret = ICO_ExtractIconExW(lpwstrFile, hIcon, nIndex, 2, cxicon | (cxsmicon<<16), + ret = ICO_ExtractIconExW(lpwstrFile, hIcon, nIndex, 2, cxicon | (cxsmicon<<16), cyicon | (cysmicon<<16), NULL, LR_DEFAULTCOLOR); *phIconLarge = hIcon[0]; *phIconSmall = hIcon[1];
10 years
1
0
0
0
[akhaldi] 65294: [SHELL32] * Another partial sync of clipboard.c with Wine 1.7.27. * Move RenderPREFEREDDROPEFFECT to CIDLDataObj.cpp where it belongs. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Nov 6 18:33:33 2014 New Revision: 65294 URL:
http://svn.reactos.org/svn/reactos?rev=65294&view=rev
Log: [SHELL32] * Another partial sync of clipboard.c with Wine 1.7.27. * Move RenderPREFEREDDROPEFFECT to CIDLDataObj.cpp where it belongs. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/CIDLDataObj.cpp branches/shell-experiments/dll/win32/shell32/wine/clipboard.c branches/shell-experiments/dll/win32/shell32/wine/shell32_main.h Modified: branches/shell-experiments/dll/win32/shell32/CIDLDataObj.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/CIDLDataObj.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/CIDLDataObj.cpp [iso-8859-1] Thu Nov 6 18:33:33 2014 @@ -225,6 +225,21 @@ return S_OK; } +static HGLOBAL RenderPREFEREDDROPEFFECT (DWORD dwFlags) +{ + DWORD * pdwFlag; + HGLOBAL hGlobal; + + TRACE("(0x%08x)\n", dwFlags); + + hGlobal = GlobalAlloc(GHND|GMEM_SHARE, sizeof(DWORD)); + if(!hGlobal) return hGlobal; + pdwFlag = (DWORD*)GlobalLock(hGlobal); + *pdwFlag = dwFlags; + GlobalUnlock(hGlobal); + return hGlobal; +} + /************************************************************************** * IDataObject_fnGetData */ Modified: branches/shell-experiments/dll/win32/shell32/wine/clipboard.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/clipboard.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/clipboard.c [iso-8859-1] Thu Nov 6 18:33:33 2014 @@ -54,56 +54,91 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) { UINT i; - int size = 0; +#ifdef __REACTOS__ + int size = 0; +#else + int rootlen = 0,size = 0; + WCHAR wszRootPath[MAX_PATH]; +#endif WCHAR wszFileName[MAX_PATH]; - HGLOBAL hGlobal = NULL; + HGLOBAL hGlobal = NULL; DROPFILES *pDropFiles; int offset; - LPITEMIDLIST *pidls; - - TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); - - pidls = (LPITEMIDLIST *)HeapAlloc(GetProcessHeap(), 0, cidl * sizeof(*pidls)); - if (!pidls) - goto cleanup; +#ifdef __REACTOS__ + LPITEMIDLIST *pidls; +#endif + + TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); + +#ifdef __REACTOS__ + pidls = (LPITEMIDLIST *)HeapAlloc(GetProcessHeap(), 0, cidl * sizeof(*pidls)); + if (!pidls) + goto cleanup; +#endif /* get the size needed */ size = sizeof(DROPFILES); +#ifndef __REACTOS__ + SHGetPathFromIDListW(pidlRoot, wszRootPath); + PathAddBackslashW(wszRootPath); + rootlen = strlenW(wszRootPath); +#endif + for (i=0; i<cidl;i++) { - pidls[i] = ILCombine(pidlRoot, apidl[i]); - SHGetPathFromIDListW(pidls[i], wszFileName); - size += (wcslen(wszFileName) + 1) * sizeof(WCHAR); +#ifdef __REACTOS__ + pidls[i] = ILCombine(pidlRoot, apidl[i]); + SHGetPathFromIDListW(pidls[i], wszFileName); + size += (wcslen(wszFileName) + 1) * sizeof(WCHAR); +#else + _ILSimpleGetTextW(apidl[i], wszFileName, MAX_PATH); + size += (rootlen + strlenW(wszFileName) + 1) * sizeof(WCHAR); +#endif } size += sizeof(WCHAR); /* Fill the structure */ hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); - if(!hGlobal) - goto cleanup; - - pDropFiles = (DROPFILES *)GlobalLock(hGlobal); +#ifdef __REACTOS__ + if(!hGlobal) goto cleanup; +#else + if(!hGlobal) return hGlobal; +#endif + + pDropFiles = GlobalLock(hGlobal); offset = (sizeof(DROPFILES) + sizeof(WCHAR) - 1) / sizeof(WCHAR); pDropFiles->pFiles = offset * sizeof(WCHAR); pDropFiles->fWide = TRUE; +#ifndef __REACTOS__ + strcpyW(wszFileName, wszRootPath); +#endif + for (i=0; i<cidl;i++) { - SHGetPathFromIDListW(pidls[i], wszFileName); - wcscpy(((WCHAR*)pDropFiles)+offset, wszFileName); - offset += wcslen(wszFileName) + 1; - ILFree(pidls[i]); +#ifdef __REACTOS__ + SHGetPathFromIDListW(pidls[i], wszFileName); + wcscpy(((WCHAR*)pDropFiles)+offset, wszFileName); + offset += wcslen(wszFileName) + 1; + ILFree(pidls[i]); +#else + _ILSimpleGetTextW(apidl[i], wszFileName + rootlen, MAX_PATH - rootlen); + strcpyW(((WCHAR*)pDropFiles)+offset, wszFileName); + offset += strlenW(wszFileName) + 1; +#endif } ((WCHAR*)pDropFiles)[offset] = 0; GlobalUnlock(hGlobal); +#ifdef __REACTOS__ cleanup: if(pidls) HeapFree(GetProcessHeap(), 0, pidls); +#endif return hGlobal; } @@ -150,24 +185,6 @@ return hGlobal; } -HGLOBAL RenderSHELLIDLISTOFFSET (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) -{ - FIXME("\n"); - return 0; -} - -HGLOBAL RenderFILECONTENTS (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) -{ - FIXME("\n"); - return 0; -} - -HGLOBAL RenderFILEDESCRIPTOR (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) -{ - FIXME("\n"); - return 0; -} - HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) { int size = 0; @@ -231,18 +248,3 @@ return hGlobal; } - -HGLOBAL RenderPREFEREDDROPEFFECT (DWORD dwFlags) -{ - DWORD * pdwFlag; - HGLOBAL hGlobal; - - TRACE("(0x%08x)\n", dwFlags); - - hGlobal = GlobalAlloc(GHND|GMEM_SHARE, sizeof(DWORD)); - if(!hGlobal) return hGlobal; - pdwFlag = (DWORD*)GlobalLock(hGlobal); - *pdwFlag = dwFlags; - GlobalUnlock(hGlobal); - return hGlobal; -} Modified: branches/shell-experiments/dll/win32/shell32/wine/shell32_main.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/shell32_main.h [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/shell32_main.h [iso-8859-1] Thu Nov 6 18:33:33 2014 @@ -98,12 +98,8 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl); HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl); -HGLOBAL RenderSHELLIDLISTOFFSET (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl); -HGLOBAL RenderFILECONTENTS (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl); -HGLOBAL RenderFILEDESCRIPTOR (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl); HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl); HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl); -HGLOBAL RenderPREFEREDDROPEFFECT (DWORD dwFlags); /* Change Notification */ void InitChangeNotifications(void);
10 years
1
0
0
0
[akhaldi] 65293: [SHELL32] * Partial sync of clipboard.c with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Nov 6 18:10:37 2014 New Revision: 65293 URL:
http://svn.reactos.org/svn/reactos?rev=65293&view=rev
Log: [SHELL32] * Partial sync of clipboard.c with Wine 1.7.27. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/wine/clipboard.c Modified: branches/shell-experiments/dll/win32/shell32/wine/clipboard.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/clipboard.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/clipboard.c [iso-8859-1] Thu Nov 6 18:10:37 2014 @@ -1,7 +1,7 @@ /* - * clipboard helper functions - * - * Copyright 2000 Juergen Schmied <juergen.schmied(a)debitel.de> + * clipboard helper functions + * + * Copyright 2000 Juergen Schmied <juergen.schmied(a)debitel.de> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,13 +25,13 @@ * * - a right mousebutton-copy sets the following formats: * classic: - * Shell IDList Array - * Preferred Drop Effect - * Shell Object Offsets - * HDROP - * FileName + * Shell IDList Array + * Preferred Drop Effect + * Shell Object Offsets + * HDROP + * FileName * ole: - * OlePrivateData (ClipboardDataObjectInterface) + * OlePrivateData (ClipboardDataObjectInterface) * */ @@ -42,6 +42,7 @@ #include <winbase.h> #include <shlobj.h> #include <wine/debug.h> +#include <wine/unicode.h> WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -52,100 +53,101 @@ */ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) { - UINT i; + UINT i; int size = 0; - WCHAR wszFileName[MAX_PATH]; + WCHAR wszFileName[MAX_PATH]; HGLOBAL hGlobal = NULL; - DROPFILES *pDropFiles; - int offset; + DROPFILES *pDropFiles; + int offset; LPITEMIDLIST *pidls; - TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); + TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); pidls = (LPITEMIDLIST *)HeapAlloc(GetProcessHeap(), 0, cidl * sizeof(*pidls)); if (!pidls) goto cleanup; - /* get the size needed */ - size = sizeof(DROPFILES); - - for (i=0; i<cidl;i++) - { + /* get the size needed */ + size = sizeof(DROPFILES); + + for (i=0; i<cidl;i++) + { pidls[i] = ILCombine(pidlRoot, apidl[i]); SHGetPathFromIDListW(pidls[i], wszFileName); size += (wcslen(wszFileName) + 1) * sizeof(WCHAR); - } - - size += sizeof(WCHAR); - - /* Fill the structure */ - hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); + } + + size += sizeof(WCHAR); + + /* Fill the structure */ + hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); if(!hGlobal) goto cleanup; pDropFiles = (DROPFILES *)GlobalLock(hGlobal); - offset = (sizeof(DROPFILES) + sizeof(WCHAR) - 1) / sizeof(WCHAR); + offset = (sizeof(DROPFILES) + sizeof(WCHAR) - 1) / sizeof(WCHAR); pDropFiles->pFiles = offset * sizeof(WCHAR); pDropFiles->fWide = TRUE; - for (i=0; i<cidl;i++) - { + for (i=0; i<cidl;i++) + { + SHGetPathFromIDListW(pidls[i], wszFileName); wcscpy(((WCHAR*)pDropFiles)+offset, wszFileName); offset += wcslen(wszFileName) + 1; ILFree(pidls[i]); - } - - ((WCHAR*)pDropFiles)[offset] = 0; - GlobalUnlock(hGlobal); + } + + ((WCHAR*)pDropFiles)[offset] = 0; + GlobalUnlock(hGlobal); cleanup: if(pidls) HeapFree(GetProcessHeap(), 0, pidls); - return hGlobal; + return hGlobal; } HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) { - UINT i; - int offset = 0, sizePidl, size; - HGLOBAL hGlobal; - LPIDA pcida; - - TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); - - /* get the size needed */ - size = sizeof(CIDA) + sizeof (UINT)*(cidl); /* header */ - size += ILGetSize (pidlRoot); /* root pidl */ - for(i=0; i<cidl; i++) - { - size += ILGetSize(apidl[i]); /* child pidls */ - } - - /* fill the structure */ - hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); - if(!hGlobal) return hGlobal; - pcida = (LPIDA)GlobalLock (hGlobal); - pcida->cidl = cidl; - - /* root pidl */ - offset = sizeof(CIDA) + sizeof (UINT)*(cidl); - pcida->aoffset[0] = offset; /* first element */ - sizePidl = ILGetSize (pidlRoot); - memcpy(((LPBYTE)pcida)+offset, pidlRoot, sizePidl); - offset += sizePidl; - - for(i=0; i<cidl; i++) /* child pidls */ - { - pcida->aoffset[i+1] = offset; - sizePidl = ILGetSize(apidl[i]); - memcpy(((LPBYTE)pcida)+offset, apidl[i], sizePidl); - offset += sizePidl; - } - - GlobalUnlock(hGlobal); - return hGlobal; + UINT i; + int offset = 0, sizePidl, size; + HGLOBAL hGlobal; + LPIDA pcida; + + TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); + + /* get the size needed */ + size = sizeof(CIDA) + sizeof (UINT)*(cidl); /* header */ + size += ILGetSize (pidlRoot); /* root pidl */ + for(i=0; i<cidl; i++) + { + size += ILGetSize(apidl[i]); /* child pidls */ + } + + /* fill the structure */ + hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); + if(!hGlobal) return hGlobal; + pcida = GlobalLock (hGlobal); + pcida->cidl = cidl; + + /* root pidl */ + offset = sizeof(CIDA) + sizeof (UINT)*(cidl); + pcida->aoffset[0] = offset; /* first element */ + sizePidl = ILGetSize (pidlRoot); + memcpy(((LPBYTE)pcida)+offset, pidlRoot, sizePidl); + offset += sizePidl; + + for(i=0; i<cidl; i++) /* child pidls */ + { + pcida->aoffset[i+1] = offset; + sizePidl = ILGetSize(apidl[i]); + memcpy(((LPBYTE)pcida)+offset, apidl[i], sizePidl); + offset += sizePidl; + } + + GlobalUnlock(hGlobal); + return hGlobal; } HGLOBAL RenderSHELLIDLISTOFFSET (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) @@ -168,66 +170,66 @@ HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) { - int size = 0; - char szTemp[MAX_PATH], *szFileName; - LPITEMIDLIST pidl; - HGLOBAL hGlobal; - BOOL bSuccess; - - TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); - - /* get path of combined pidl */ - pidl = ILCombine(pidlRoot, apidl[0]); - if (!pidl) - return 0; - - bSuccess = SHGetPathFromIDListA(pidl, szTemp); - SHFree(pidl); - if (!bSuccess) - return 0; - - size = strlen(szTemp) + 1; - - /* fill the structure */ - hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); - if(!hGlobal) return hGlobal; - szFileName = (char *)GlobalLock(hGlobal); - memcpy(szFileName, szTemp, size); - GlobalUnlock(hGlobal); - - return hGlobal; + int size = 0; + char szTemp[MAX_PATH], *szFileName; + LPITEMIDLIST pidl; + HGLOBAL hGlobal; + BOOL bSuccess; + + TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); + + /* get path of combined pidl */ + pidl = ILCombine(pidlRoot, apidl[0]); + if (!pidl) + return 0; + + bSuccess = SHGetPathFromIDListA(pidl, szTemp); + SHFree(pidl); + if (!bSuccess) + return 0; + + size = strlen(szTemp) + 1; + + /* fill the structure */ + hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); + if(!hGlobal) return hGlobal; + szFileName = GlobalLock(hGlobal); + memcpy(szFileName, szTemp, size); + GlobalUnlock(hGlobal); + + return hGlobal; } HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) { - int size = 0; - WCHAR szTemp[MAX_PATH], *szFileName; - LPITEMIDLIST pidl; - HGLOBAL hGlobal; - BOOL bSuccess; - - TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); - - /* get path of combined pidl */ - pidl = ILCombine(pidlRoot, apidl[0]); - if (!pidl) - return 0; - - bSuccess = SHGetPathFromIDListW(pidl, szTemp); - SHFree(pidl); - if (!bSuccess) - return 0; - - size = (wcslen(szTemp)+1) * sizeof(WCHAR); - - /* fill the structure */ - hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); - if(!hGlobal) return hGlobal; - szFileName = (WCHAR *)GlobalLock(hGlobal); - memcpy(szFileName, szTemp, size); - GlobalUnlock(hGlobal); - - return hGlobal; + int size = 0; + WCHAR szTemp[MAX_PATH], *szFileName; + LPITEMIDLIST pidl; + HGLOBAL hGlobal; + BOOL bSuccess; + + TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); + + /* get path of combined pidl */ + pidl = ILCombine(pidlRoot, apidl[0]); + if (!pidl) + return 0; + + bSuccess = SHGetPathFromIDListW(pidl, szTemp); + SHFree(pidl); + if (!bSuccess) + return 0; + + size = (strlenW(szTemp)+1) * sizeof(WCHAR); + + /* fill the structure */ + hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); + if(!hGlobal) return hGlobal; + szFileName = GlobalLock(hGlobal); + memcpy(szFileName, szTemp, size); + GlobalUnlock(hGlobal); + + return hGlobal; } HGLOBAL RenderPREFEREDDROPEFFECT (DWORD dwFlags)
10 years
1
0
0
0
[akhaldi] 65292: [SHELL32] * Move clipboard.cpp to the wine folder. * Convert clipboard.cpp into clipboard.c.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Nov 6 18:07:58 2014 New Revision: 65292 URL:
http://svn.reactos.org/svn/reactos?rev=65292&view=rev
Log: [SHELL32] * Move clipboard.cpp to the wine folder. * Convert clipboard.cpp into clipboard.c. Added: branches/shell-experiments/dll/win32/shell32/wine/clipboard.c - copied, changed from r65270, branches/shell-experiments/dll/win32/shell32/clipboard.cpp Removed: branches/shell-experiments/dll/win32/shell32/clipboard.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] Thu Nov 6 18:07:58 2014 @@ -17,7 +17,6 @@ list(APPEND SOURCE CAutoComplete.cpp - clipboard.cpp CMenuBand.cpp CMenuDeskBar.cpp CIDLDataObj.cpp @@ -67,6 +66,7 @@ wine/brsfolder.c wine/changenotify.c wine/classes.c + wine/clipboard.c wine/control.c wine/pidl.c wine/shell32_main.c Removed: branches/shell-experiments/dll/win32/shell32/clipboard.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/clipboard.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/clipboard.cpp (removed) @@ -1,240 +0,0 @@ -/* - * clipboard helper functions - * - * Copyright 2000 Juergen Schmied <juergen.schmied(a)debitel.de> - * - * 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: - * - * For copy & paste functions within contextmenus does the shell use - * the OLE clipboard functions in combination with dataobjects. - * The OLE32.DLL gets loaded with LoadLibrary - * - * - a right mousebutton-copy sets the following formats: - * classic: - * Shell IDList Array - * Preferred Drop Effect - * Shell Object Offsets - * HDROP - * FileName - * ole: - * OlePrivateData (ClipboardDataObjectInterface) - * - */ - -#include "precomp.h" - -WINE_DEFAULT_DEBUG_CHANNEL(shell); - -/************************************************************************** - * RenderHDROP - * - * creates a CF_HDROP structure - */ -HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) -{ - UINT i; - int size = 0; - WCHAR wszFileName[MAX_PATH]; - HGLOBAL hGlobal = NULL; - DROPFILES *pDropFiles; - int offset; - LPITEMIDLIST *pidls; - - TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); - - pidls = (LPITEMIDLIST *)HeapAlloc(GetProcessHeap(), 0, cidl * sizeof(*pidls)); - if (!pidls) - goto cleanup; - - /* get the size needed */ - size = sizeof(DROPFILES); - - for (i=0; i<cidl;i++) - { - pidls[i] = ILCombine(pidlRoot, apidl[i]); - SHGetPathFromIDListW(pidls[i], wszFileName); - size += (wcslen(wszFileName) + 1) * sizeof(WCHAR); - } - - size += sizeof(WCHAR); - - /* Fill the structure */ - hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); - if(!hGlobal) - goto cleanup; - - pDropFiles = (DROPFILES *)GlobalLock(hGlobal); - offset = (sizeof(DROPFILES) + sizeof(WCHAR) - 1) / sizeof(WCHAR); - pDropFiles->pFiles = offset * sizeof(WCHAR); - pDropFiles->fWide = TRUE; - - for (i=0; i<cidl;i++) - { - SHGetPathFromIDListW(pidls[i], wszFileName); - wcscpy(((WCHAR*)pDropFiles)+offset, wszFileName); - offset += wcslen(wszFileName) + 1; - ILFree(pidls[i]); - } - - ((WCHAR*)pDropFiles)[offset] = 0; - GlobalUnlock(hGlobal); - -cleanup: - if(pidls) - HeapFree(GetProcessHeap(), 0, pidls); - - return hGlobal; -} - -HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) -{ - UINT i; - int offset = 0, sizePidl, size; - HGLOBAL hGlobal; - LPIDA pcida; - - TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); - - /* get the size needed */ - size = sizeof(CIDA) + sizeof (UINT)*(cidl); /* header */ - size += ILGetSize (pidlRoot); /* root pidl */ - for(i=0; i<cidl; i++) - { - size += ILGetSize(apidl[i]); /* child pidls */ - } - - /* fill the structure */ - hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); - if(!hGlobal) return hGlobal; - pcida = (LPIDA)GlobalLock (hGlobal); - pcida->cidl = cidl; - - /* root pidl */ - offset = sizeof(CIDA) + sizeof (UINT)*(cidl); - pcida->aoffset[0] = offset; /* first element */ - sizePidl = ILGetSize (pidlRoot); - memcpy(((LPBYTE)pcida)+offset, pidlRoot, sizePidl); - offset += sizePidl; - - for(i=0; i<cidl; i++) /* child pidls */ - { - pcida->aoffset[i+1] = offset; - sizePidl = ILGetSize(apidl[i]); - memcpy(((LPBYTE)pcida)+offset, apidl[i], sizePidl); - offset += sizePidl; - } - - GlobalUnlock(hGlobal); - return hGlobal; -} - -HGLOBAL RenderSHELLIDLISTOFFSET (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) -{ - FIXME("\n"); - return 0; -} - -HGLOBAL RenderFILECONTENTS (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) -{ - FIXME("\n"); - return 0; -} - -HGLOBAL RenderFILEDESCRIPTOR (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) -{ - FIXME("\n"); - return 0; -} - -HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) -{ - int size = 0; - char szTemp[MAX_PATH], *szFileName; - LPITEMIDLIST pidl; - HGLOBAL hGlobal; - BOOL bSuccess; - - TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); - - /* get path of combined pidl */ - pidl = ILCombine(pidlRoot, apidl[0]); - if (!pidl) - return 0; - - bSuccess = SHGetPathFromIDListA(pidl, szTemp); - SHFree(pidl); - if (!bSuccess) - return 0; - - size = strlen(szTemp) + 1; - - /* fill the structure */ - hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); - if(!hGlobal) return hGlobal; - szFileName = (char *)GlobalLock(hGlobal); - memcpy(szFileName, szTemp, size); - GlobalUnlock(hGlobal); - - return hGlobal; -} - -HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) -{ - int size = 0; - WCHAR szTemp[MAX_PATH], *szFileName; - LPITEMIDLIST pidl; - HGLOBAL hGlobal; - BOOL bSuccess; - - TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl); - - /* get path of combined pidl */ - pidl = ILCombine(pidlRoot, apidl[0]); - if (!pidl) - return 0; - - bSuccess = SHGetPathFromIDListW(pidl, szTemp); - SHFree(pidl); - if (!bSuccess) - return 0; - - size = (wcslen(szTemp)+1) * sizeof(WCHAR); - - /* fill the structure */ - hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); - if(!hGlobal) return hGlobal; - szFileName = (WCHAR *)GlobalLock(hGlobal); - memcpy(szFileName, szTemp, size); - GlobalUnlock(hGlobal); - - return hGlobal; -} - -HGLOBAL RenderPREFEREDDROPEFFECT (DWORD dwFlags) -{ - DWORD * pdwFlag; - HGLOBAL hGlobal; - - TRACE("(0x%08x)\n", dwFlags); - - hGlobal = GlobalAlloc(GHND|GMEM_SHARE, sizeof(DWORD)); - if(!hGlobal) return hGlobal; - pdwFlag = (DWORD*)GlobalLock(hGlobal); - *pdwFlag = dwFlags; - GlobalUnlock(hGlobal); - return hGlobal; -} Copied: branches/shell-experiments/dll/win32/shell32/wine/clipboard.c (from r65270, branches/shell-experiments/dll/win32/shell32/clipboard.cpp) URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/clipboard.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/clipboard.c [iso-8859-1] Thu Nov 6 18:07:58 2014 @@ -35,7 +35,13 @@ * */ -#include "precomp.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);
10 years
1
0
0
0
[akhaldi] 65291: [SHELL32] * Another partial sync of classes.c with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Nov 6 17:26:42 2014 New Revision: 65291 URL:
http://svn.reactos.org/svn/reactos?rev=65291&view=rev
Log: [SHELL32] * Another partial sync of classes.c with Wine 1.7.27. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/wine/classes.c branches/shell-experiments/dll/win32/shell32/wine/shell32_main.h Modified: branches/shell-experiments/dll/win32/shell32/wine/classes.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/classes.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/classes.c [iso-8859-1] Thu Nov 6 17:26:42 2014 @@ -48,7 +48,7 @@ HKEY hkey; WCHAR szTemp[MAX_EXTENSION_LENGTH + 2]; - TRACE("%s %p\n", debugstr_w(szExtension), debugstr_w(szFileType)); + TRACE("%s %p\n", debugstr_w(szExtension), szFileType); /* added because we do not want to have double dots */ if (szExtension[0] == '.') @@ -59,10 +59,12 @@ lstrcpynW(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH); - if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey) != ERROR_SUCCESS) - return FALSE; - - if (RegQueryValueW(hkey, NULL, szFileType, &len) != ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey)) + { + return FALSE; + } + + if (RegQueryValueW(hkey, NULL, szFileType, &len)) { RegCloseKey(hkey); return FALSE; @@ -96,11 +98,13 @@ return FALSE; } - if (RegLoadMUIStringA(hkey, "FriendlyTypeName", szFileType, len, NULL, 0, NULL) == ERROR_SUCCESS) - { - RegCloseKey(hkey); - return TRUE; - } +#ifdef __REACTOS__ + if (!RegLoadMUIStringA(hkey, "FriendlyTypeName", szFileType, len, NULL, 0, NULL)) + { + RegCloseKey(hkey); + return TRUE; + } +#endif if (RegQueryValueA(hkey, NULL, szFileType, &len)) { @@ -115,9 +119,9 @@ return TRUE; } -static const WCHAR swShell[] = L"shell\\"; -static const WCHAR swOpen[] = L"open"; -static const WCHAR swCommand[] = L"\\command"; +static const WCHAR swShell[] = {'s','h','e','l','l','\\',0}; +static const WCHAR swOpen[] = {'o','p','e','n',0}; +static const WCHAR swCommand[] = {'\\','c','o','m','m','a','n','d',0}; BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) { @@ -135,13 +139,13 @@ size=len; *szDest='\0'; - if (RegQueryValueW(hkeyClass, L"shell", szDest, &size) == ERROR_SUCCESS && *szDest) + if (!RegQueryValueW(hkeyClass, swShell, szDest, &size) && *szDest) { /* The MSDN says to first try the default verb */ - wcscpy(sTemp, swShell); - wcscat(sTemp, szDest); - wcscat(sTemp, swCommand); - if (RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey) == ERROR_SUCCESS) + lstrcpyW(sTemp, swShell); + lstrcatW(sTemp, szDest); + lstrcatW(sTemp, swCommand); + if (!RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey)) { RegCloseKey(hkey); TRACE("default verb=%s\n", debugstr_w(szDest)); @@ -150,10 +154,10 @@ } /* then fallback to 'open' */ - wcscpy(sTemp, swShell); - wcscat(sTemp, swOpen); - wcscat(sTemp, swCommand); - if (RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey) == ERROR_SUCCESS) + lstrcpyW(sTemp, swShell); + lstrcatW(sTemp, swOpen); + lstrcatW(sTemp, swCommand); + if (!RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey)) { RegCloseKey(hkey); lstrcpynW(szDest, swOpen, len); @@ -162,17 +166,24 @@ } /* and then just use the first verb on Windows >= 2000 */ - if (RegOpenKeyExW(hkeyClass, L"shell", 0, KEY_READ, &hkey) == ERROR_SUCCESS) - { - if (RegEnumKeyW(hkey, 0, szDest, len) == ERROR_SUCCESS && *szDest) +#ifdef __REACTOS__ + if (!RegOpenKeyExW(hkeyClass, L"shell", 0, KEY_READ, &hkey)) + { + if (!RegEnumKeyW(hkey, 0, szDest, len) && *szDest) + { + TRACE("default verb=first verb=%s\n", debugstr_w(szDest)); + RegCloseKey(hkey); + return TRUE; + } + RegCloseKey(hkey); + } +#else + if (!RegEnumKeyW(hkeyClass, 0, szDest, len) && *szDest) { TRACE("default verb=first verb=%s\n", debugstr_w(szDest)); - RegCloseKey(hkey); return TRUE; } - RegCloseKey(hkey); - } - +#endif TRACE("no default verb!\n"); return FALSE; @@ -194,9 +205,9 @@ if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, sizeof(sTempVerb)/sizeof(sTempVerb[0]))) { WCHAR sTemp[MAX_PATH]; - wcscpy(sTemp, swShell); - wcscat(sTemp, sTempVerb); - wcscat(sTemp, swCommand); + lstrcpyW(sTemp, swShell); + lstrcatW(sTemp, sTempVerb); + lstrcatW(sTemp, swCommand); ret = (ERROR_SUCCESS == SHGetValueW(hkeyClass, sTemp, NULL, NULL, szDest, &len)); } if (szClass) @@ -221,7 +232,7 @@ TRACE("%s\n",xriid ); - return (RegOpenKeyExA(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey) == ERROR_SUCCESS); + return !RegOpenKeyExA(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey); } static BOOL HCR_RegGetIconW(HKEY hkey, LPWSTR szDest, LPCWSTR szName, DWORD len, int* picon_idx) @@ -254,7 +265,7 @@ char sTemp[MAX_PATH]; char sNum[5]; - if (!RegQueryValueExA(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len)) + if (!RegQueryValueExA(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len)) { if (dwType == REG_EXPAND_SZ) { @@ -274,20 +285,20 @@ BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int* picon_idx) { - static const WCHAR swDefaultIcon[] = L"\\DefaultIcon"; - HKEY hKey; + static const WCHAR swDefaultIcon[] = {'\\','D','e','f','a','u','l','t','I','c','o','n',0}; + HKEY hkey; WCHAR sTemp[MAX_PATH]; BOOL ret = FALSE; TRACE("%s\n",debugstr_w(szClass) ); lstrcpynW(sTemp, szClass, MAX_PATH); - wcscat(sTemp, swDefaultIcon); - - if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hKey)) - { - ret = HCR_RegGetIconW(hKey, szDest, szName, len, picon_idx); - RegCloseKey(hKey); + lstrcatW(sTemp, swDefaultIcon); + + if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey)) + { + ret = HCR_RegGetIconW(hkey, szDest, szName, len, picon_idx); + RegCloseKey(hkey); } if(ret) @@ -300,7 +311,7 @@ BOOL HCR_GetIconA(LPCSTR szClass, LPSTR szDest, LPCSTR szName, DWORD len, int* picon_idx) { - HKEY hKey; + HKEY hkey; char sTemp[MAX_PATH]; BOOL ret = FALSE; @@ -308,27 +319,13 @@ sprintf(sTemp, "%s\\DefaultIcon",szClass); - if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hKey)) - { - ret = HCR_RegGetIconA(hKey, szDest, szName, len, picon_idx); - RegCloseKey(hKey); + if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey)) + { + ret = HCR_RegGetIconA(hkey, szDest, szName, len, picon_idx); + RegCloseKey(hkey); } TRACE("-- %s %i\n", szDest, *picon_idx); return ret; -} - -BOOL HCR_GetIconFromGUIDW(REFIID riid, LPWSTR szDest, LPWSTR szName, DWORD len, int* picon_idx) -{ - HKEY hKey; - BOOL ret = FALSE; - - if (HCR_RegOpenClassIDKey(riid, &hKey)) - { - ret = HCR_RegGetIconW(hKey, szDest, szName, len, picon_idx); - RegCloseKey(hKey); - } - TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx); - return ret; } /*************************************************************************************** @@ -340,34 +337,40 @@ BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len) { - HKEY hKey; + HKEY hkey; BOOL ret = FALSE; DWORD buflen = len; - WCHAR szName[100]; - LPOLESTR pStr; +#ifdef __REACTOS__ + WCHAR szName[100]; + LPOLESTR pStr; +#endif szDest[0] = 0; - if (StringFromCLSID(riid, &pStr) == S_OK) - { - DWORD dwLen = buflen * sizeof(WCHAR); - swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr); - if (RegGetValueW(HKEY_CURRENT_USER, szName, NULL, RRF_RT_REG_SZ, NULL, (PVOID)szDest, &dwLen) == ERROR_SUCCESS) - { - ret = TRUE; - } - CoTaskMemFree(pStr); - } - if (!ret && HCR_RegOpenClassIDKey(riid, &hKey)) - { - static const WCHAR wszLocalizedString[] = L"LocalizedString"; - - if (RegLoadMUIStringW(hKey, wszLocalizedString, szDest, len, NULL, 0, NULL) == ERROR_SUCCESS || - RegQueryValueExW(hKey, swEmpty, 0, NULL, (LPBYTE)szDest, &len) == ERROR_SUCCESS) +#ifdef __REACTOS__ + if (StringFromCLSID(riid, &pStr) == S_OK) + { + DWORD dwLen = buflen * sizeof(WCHAR); + swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr); + if (!RegGetValueW(HKEY_CURRENT_USER, szName, NULL, RRF_RT_REG_SZ, NULL, (PVOID)szDest, &dwLen)) + { + ret = TRUE; + } + CoTaskMemFree(pStr); + } + if (!ret && HCR_RegOpenClassIDKey(riid, &hkey)) +#else + if (HCR_RegOpenClassIDKey(riid, &hkey)) +#endif + { + static const WCHAR wszLocalizedString[] = + { 'L','o','c','a','l','i','z','e','d','S','t','r','i','n','g', 0 }; + if (!RegLoadMUIStringW(hkey, wszLocalizedString, szDest, len, NULL, 0, NULL) || + !RegQueryValueExW(hkey, swEmpty, 0, NULL, (LPBYTE)szDest, &len)) { ret = TRUE; } - RegCloseKey(hKey); + RegCloseKey(hkey); } if (!ret || !szDest[0]) @@ -382,46 +385,47 @@ if(LoadStringW(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) ret = TRUE; } - else if (IsEqualIID(riid, &CLSID_MyDocuments)) - { - if(LoadStringW(shell32_hInstance, IDS_PERSONAL, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, &CLSID_RecycleBin)) - { - if(LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_FOLDER_NAME, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, &CLSID_ControlPanel)) - { - if(LoadStringW(shell32_hInstance, IDS_CONTROLPANEL, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, &CLSID_AdminFolderShortcut)) - { - if(LoadStringW(shell32_hInstance, IDS_ADMINISTRATIVETOOLS, szDest, buflen)) - ret = TRUE; - } - } - +#ifdef __REACTOS__ + else if (IsEqualIID(riid, &CLSID_MyDocuments)) + { + if(LoadStringW(shell32_hInstance, IDS_PERSONAL, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, &CLSID_RecycleBin)) + { + if(LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_FOLDER_NAME, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, &CLSID_ControlPanel)) + { + if(LoadStringW(shell32_hInstance, IDS_CONTROLPANEL, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, &CLSID_AdminFolderShortcut)) + { + if(LoadStringW(shell32_hInstance, IDS_ADMINISTRATIVETOOLS, szDest, buflen)) + ret = TRUE; + } +#endif + } TRACE("-- %s\n", debugstr_w(szDest)); return ret; } BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len) -{ HKEY hKey; +{ HKEY hkey; BOOL ret = FALSE; DWORD buflen = len; szDest[0] = 0; - if (HCR_RegOpenClassIDKey(riid, &hKey)) - { - if (!RegLoadMUIStringA(hKey, "LocalizedString", szDest, len, NULL, 0, NULL) || - !RegQueryValueExA(hKey, "", 0, NULL, (LPBYTE)szDest, &len)) + if (HCR_RegOpenClassIDKey(riid, &hkey)) + { + if (!RegLoadMUIStringA(hkey,"LocalizedString",szDest,len,NULL,0,NULL) || + !RegQueryValueExA(hkey,"",0,NULL,(LPBYTE)szDest,&len)) { ret = TRUE; } - RegCloseKey(hKey); + RegCloseKey(hkey); } if (!ret || !szDest[0]) @@ -476,7 +480,11 @@ TRACE("(pidlFolder=%p, pdwAttributes=%p)\n", pidlFolder, pdwAttributes); if (!_ILIsPidlSimple(pidlFolder)) { - ERR("should be called for simple PIDL's only!\n"); + static BOOL firstHit = TRUE; + if (firstHit) { + ERR("should be called for simple PIDL's only!\n"); + firstHit = FALSE; + } return FALSE; } @@ -487,17 +495,20 @@ } lResult = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszShellFolderKey, 0, KEY_READ, &hSFKey); +#ifdef __REACTOS__ if (lResult != ERROR_SUCCESS) { ERR("Cannot open key: %ls\n", wszShellFolderKey); return FALSE; } +#else + if (lResult != ERROR_SUCCESS) return FALSE; +#endif dwLen = sizeof(DWORD); lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen); if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) { - IShellFolder *psfDesktop; - IShellFolder *psfFolder; + LPSHELLFOLDER psfDesktop, psfFolder; HRESULT hr; RegCloseKey(hSFKey); @@ -505,8 +516,11 @@ if (SUCCEEDED(hr)) { hr = IShellFolder_BindToObject(psfDesktop, pidlFolder, NULL, &IID_IShellFolder, (LPVOID*)&psfFolder); - if (SUCCEEDED(hr)) + if (SUCCEEDED(hr)) { hr = IShellFolder_GetAttributesOf(psfFolder, 0, NULL, pdwAttributes); + IShellFolder_Release(psfFolder); + } + IShellFolder_Release(psfDesktop); } if (FAILED(hr)) return FALSE; } else { Modified: branches/shell-experiments/dll/win32/shell32/wine/shell32_main.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/shell32_main.h [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/shell32_main.h [iso-8859-1] Thu Nov 6 17:26:42 2014 @@ -46,7 +46,6 @@ BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ); BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ); BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int* picon_idx); -BOOL HCR_GetIconFromGUIDW(REFIID riid, LPWSTR szDest, LPWSTR szName, DWORD len, int* picon_idx); BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len); /* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
10 years
1
0
0
0
[akhaldi] 65290: [SHELL32] * Partial sync of classes.c with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Nov 6 16:58:43 2014 New Revision: 65290 URL:
http://svn.reactos.org/svn/reactos?rev=65290&view=rev
Log: [SHELL32] * Partial sync of classes.c with Wine 1.7.27. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/wine/classes.c Modified: branches/shell-experiments/dll/win32/shell32/wine/classes.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/classes.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/classes.c [iso-8859-1] Thu Nov 6 16:58:43 2014 @@ -1,6 +1,6 @@ /* - * file type mapping - * (HKEY_CLASSES_ROOT - Stuff) + * file type mapping + * (HKEY_CLASSES_ROOT - Stuff) * * Copyright 1998, 1999, 2000 Juergen Schmied * @@ -44,57 +44,57 @@ #define MAX_EXTENSION_LENGTH 20 BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot) -{ - HKEY hkey; - WCHAR szTemp[MAX_EXTENSION_LENGTH + 2]; +{ + HKEY hkey; + WCHAR szTemp[MAX_EXTENSION_LENGTH + 2]; TRACE("%s %p\n", debugstr_w(szExtension), debugstr_w(szFileType)); - /* added because we do not want to have double dots */ - if (szExtension[0] == '.') - bPrependDot = FALSE; - - if (bPrependDot) - szTemp[0] = '.'; - - lstrcpynW(szTemp + (bPrependDot ? 1 : 0), szExtension, MAX_EXTENSION_LENGTH); + /* added because we do not want to have double dots */ + if (szExtension[0] == '.') + bPrependDot = FALSE; + + if (bPrependDot) + szTemp[0] = '.'; + + lstrcpynW(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH); if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey) != ERROR_SUCCESS) return FALSE; if (RegQueryValueW(hkey, NULL, szFileType, &len) != ERROR_SUCCESS) - { - RegCloseKey(hkey); - return FALSE; - } - - RegCloseKey(hkey); - - TRACE("--UE;\n} %s\n", debugstr_w(szFileType)); - - return TRUE; + { + RegCloseKey(hkey); + return FALSE; + } + + RegCloseKey(hkey); + + TRACE("--UE;\n} %s\n", debugstr_w(szFileType)); + + return TRUE; } BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot) { - HKEY hkey; - char szTemp[MAX_EXTENSION_LENGTH + 2]; - - TRACE("%s %p\n", szExtension, szFileType); - - /* added because we do not want to have double dots */ - if (szExtension[0] == '.') - bPrependDot = FALSE; - - if (bPrependDot) - szTemp[0] = '.'; - - lstrcpynA(szTemp + (bPrependDot ? 1 : 0), szExtension, MAX_EXTENSION_LENGTH); - - if (RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey)) - { - return FALSE; - } + HKEY hkey; + char szTemp[MAX_EXTENSION_LENGTH + 2]; + + TRACE("%s %p\n", szExtension, szFileType); + + /* added because we do not want to have double dots */ + if (szExtension[0] == '.') + bPrependDot = FALSE; + + if (bPrependDot) + szTemp[0] = '.'; + + lstrcpynA(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH); + + if (RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey)) + { + return FALSE; + } if (RegLoadMUIStringA(hkey, "FriendlyTypeName", szFileType, len, NULL, 0, NULL) == ERROR_SUCCESS) { @@ -102,66 +102,66 @@ return TRUE; } - if (RegQueryValueA(hkey, NULL, szFileType, &len)) - { - RegCloseKey(hkey); - return FALSE; - } - - RegCloseKey(hkey); - - TRACE("--UE;\n} %s\n", szFileType); - - return TRUE; + if (RegQueryValueA(hkey, NULL, szFileType, &len)) + { + RegCloseKey(hkey); + return FALSE; + } + + RegCloseKey(hkey); + + TRACE("--UE;\n} %s\n", szFileType); + + return TRUE; } static const WCHAR swShell[] = L"shell\\"; static const WCHAR swOpen[] = L"open"; static const WCHAR swCommand[] = L"\\command"; -BOOL HCR_GetDefaultVerbW(HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len) -{ - WCHAR sTemp[MAX_PATH]; - LONG size; - HKEY hkey; - - TRACE("%p %s %p\n", hkeyClass, debugstr_w(szVerb), szDest); - - if (szVerb && *szVerb) - { - lstrcpynW(szDest, szVerb, len); - return TRUE; - } - - size = len; - *szDest = '\0'; +BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) +{ + WCHAR sTemp[MAX_PATH]; + LONG size; + HKEY hkey; + + TRACE("%p %s %p\n", hkeyClass, debugstr_w(szVerb), szDest); + + if (szVerb && *szVerb) + { + lstrcpynW(szDest, szVerb, len); + return TRUE; + } + + size=len; + *szDest='\0'; if (RegQueryValueW(hkeyClass, L"shell", szDest, &size) == ERROR_SUCCESS && *szDest) - { - /* The MSDN says to first try the default verb */ + { + /* The MSDN says to first try the default verb */ wcscpy(sTemp, swShell); wcscat(sTemp, szDest); wcscat(sTemp, swCommand); if (RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey) == ERROR_SUCCESS) - { - RegCloseKey(hkey); - TRACE("default verb=%s\n", debugstr_w(szDest)); - return TRUE; - } - } - - /* then fallback to 'open' */ + { + RegCloseKey(hkey); + TRACE("default verb=%s\n", debugstr_w(szDest)); + return TRUE; + } + } + + /* then fallback to 'open' */ wcscpy(sTemp, swShell); wcscat(sTemp, swOpen); wcscat(sTemp, swCommand); if (RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey) == ERROR_SUCCESS) - { - RegCloseKey(hkey); - lstrcpynW(szDest, swOpen, len); - TRACE("default verb=open\n"); - return TRUE; - } - - /* and then just use the first verb on Windows >= 2000 */ + { + RegCloseKey(hkey); + lstrcpynW(szDest, swOpen, len); + TRACE("default verb=open\n"); + return TRUE; + } + + /* and then just use the first verb on Windows >= 2000 */ if (RegOpenKeyExW(hkeyClass, L"shell", 0, KEY_READ, &hkey) == ERROR_SUCCESS) { if (RegEnumKeyW(hkey, 0, szDest, len) == ERROR_SUCCESS && *szDest) @@ -174,56 +174,56 @@ } - TRACE("no default verb!\n"); - return FALSE; -} - -BOOL HCR_GetExecuteCommandW(HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len) -{ - WCHAR sTempVerb[MAX_PATH]; - BOOL ret; - - TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb), szDest); - - if (szClass) - RegOpenKeyExW(HKEY_CLASSES_ROOT, szClass, 0, KEY_READ, &hkeyClass); - if (!hkeyClass) - return FALSE; - ret = FALSE; - - if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, sizeof(sTempVerb)/sizeof(sTempVerb[0]))) - { - WCHAR sTemp[MAX_PATH]; + TRACE("no default verb!\n"); + return FALSE; +} + +BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) +{ + WCHAR sTempVerb[MAX_PATH]; + BOOL ret; + + TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb), szDest); + + if (szClass) + RegOpenKeyExW(HKEY_CLASSES_ROOT, szClass, 0, KEY_READ, &hkeyClass); + if (!hkeyClass) + return FALSE; + ret = FALSE; + + if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, sizeof(sTempVerb)/sizeof(sTempVerb[0]))) + { + WCHAR sTemp[MAX_PATH]; wcscpy(sTemp, swShell); wcscat(sTemp, sTempVerb); wcscat(sTemp, swCommand); - ret = (ERROR_SUCCESS == SHGetValueW(hkeyClass, sTemp, NULL, NULL, szDest, &len)); - } - if (szClass) - RegCloseKey(hkeyClass); - - TRACE("-- %s\n", debugstr_w(szDest)); - return ret; -} - + ret = (ERROR_SUCCESS == SHGetValueW(hkeyClass, sTemp, NULL, NULL, szDest, &len)); + } + if (szClass) + RegCloseKey(hkeyClass); + + TRACE("-- %s\n", debugstr_w(szDest) ); + return ret; +} + +/*************************************************************************************** +* HCR_GetDefaultIcon [internal] +* +* Gets the icon for a filetype +*/ static BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey) { - char xriid[50]; - sprintf(xriid, "CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - riid->Data1, riid->Data2, riid->Data3, - riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], - riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] ); - - TRACE("%s\n", xriid); + char xriid[50]; + sprintf( xriid, "CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + riid->Data1, riid->Data2, riid->Data3, + riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], + riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] ); + + TRACE("%s\n",xriid ); return (RegOpenKeyExA(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey) == ERROR_SUCCESS); } -/*************************************************************************************** -* HCR_GetIcon [internal] -* -* Gets the icon for a filetype, szName can be NULL, in which case the default icon is loaded -*/ static BOOL HCR_RegGetIconW(HKEY hkey, LPWSTR szDest, LPCWSTR szName, DWORD len, int* picon_idx) { DWORD dwType; @@ -232,89 +232,89 @@ if (!RegQueryValueExW(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len)) { - if (dwType == REG_EXPAND_SZ) - { - ExpandEnvironmentStringsW(szDest, sTemp, MAX_PATH); - lstrcpynW(szDest, sTemp, len); - } + if (dwType == REG_EXPAND_SZ) + { + ExpandEnvironmentStringsW(szDest, sTemp, MAX_PATH); + lstrcpynW(szDest, sTemp, len); + } if (ParseFieldW (szDest, 2, sNum, _countof(sNum))) - *picon_idx = atoiW(sNum); - else - *picon_idx = 0; /* sometimes the icon number is missing */ - ParseFieldW (szDest, 1, szDest, len); - PathUnquoteSpacesW(szDest); - return TRUE; + *picon_idx = atoiW(sNum); + else + *picon_idx=0; /* sometimes the icon number is missing */ + ParseFieldW (szDest, 1, szDest, len); + PathUnquoteSpacesW(szDest); + return TRUE; } return FALSE; } static BOOL HCR_RegGetIconA(HKEY hkey, LPSTR szDest, LPCSTR szName, DWORD len, int* picon_idx) { - DWORD dwType; - char sTemp[MAX_PATH]; - char sNum[5]; + DWORD dwType; + char sTemp[MAX_PATH]; + char sNum[5]; if (!RegQueryValueExA(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len)) - { - if (dwType == REG_EXPAND_SZ) - { - ExpandEnvironmentStringsA(szDest, sTemp, MAX_PATH); - lstrcpynA(szDest, sTemp, len); - } - if (ParseFieldA (szDest, 2, sNum, 5)) - *picon_idx = atoi(sNum); - else - *picon_idx = 0; /* sometimes the icon number is missing */ - ParseFieldA (szDest, 1, szDest, len); - PathUnquoteSpacesA(szDest); - return TRUE; - } - return FALSE; + { + if (dwType == REG_EXPAND_SZ) + { + ExpandEnvironmentStringsA(szDest, sTemp, MAX_PATH); + lstrcpynA(szDest, sTemp, len); + } + if (ParseFieldA (szDest, 2, sNum, 5)) + *picon_idx=atoi(sNum); + else + *picon_idx=0; /* sometimes the icon number is missing */ + ParseFieldA (szDest, 1, szDest, len); + PathUnquoteSpacesA(szDest); + return TRUE; + } + return FALSE; } BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int* picon_idx) { static const WCHAR swDefaultIcon[] = L"\\DefaultIcon"; HKEY hKey; - WCHAR sTemp[MAX_PATH]; - BOOL ret = FALSE; - - TRACE("%s\n", debugstr_w(szClass) ); - - lstrcpynW(sTemp, szClass, MAX_PATH); + WCHAR sTemp[MAX_PATH]; + BOOL ret = FALSE; + + TRACE("%s\n",debugstr_w(szClass) ); + + lstrcpynW(sTemp, szClass, MAX_PATH); wcscat(sTemp, swDefaultIcon); if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hKey)) - { + { ret = HCR_RegGetIconW(hKey, szDest, szName, len, picon_idx); RegCloseKey(hKey); - } - - if(ret) - TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx); - else - TRACE("-- not found\n"); - - return ret; + } + + if(ret) + TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx); + else + TRACE("-- not found\n"); + + return ret; } BOOL HCR_GetIconA(LPCSTR szClass, LPSTR szDest, LPCSTR szName, DWORD len, int* picon_idx) { HKEY hKey; - char sTemp[MAX_PATH]; - BOOL ret = FALSE; - - TRACE("%s\n", szClass ); - - sprintf(sTemp, "%s\\DefaultIcon", szClass); + char sTemp[MAX_PATH]; + BOOL ret = FALSE; + + TRACE("%s\n",szClass ); + + sprintf(sTemp, "%s\\DefaultIcon",szClass); if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hKey)) - { + { ret = HCR_RegGetIconA(hKey, szDest, szName, len, picon_idx); RegCloseKey(hKey); - } - TRACE("-- %s %i\n", szDest, *picon_idx); - return ret; + } + TRACE("-- %s %i\n", szDest, *picon_idx); + return ret; } BOOL HCR_GetIconFromGUIDW(REFIID riid, LPWSTR szDest, LPWSTR szName, DWORD len, int* picon_idx) @@ -332,21 +332,21 @@ } /*************************************************************************************** -* HCR_GetClassName [internal] +* HCR_GetClassName [internal] * * Gets the name of a registered class */ static const WCHAR swEmpty[] = {0}; BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len) -{ +{ HKEY hKey; - BOOL ret = FALSE; - DWORD buflen = len; + BOOL ret = FALSE; + DWORD buflen = len; WCHAR szName[100]; LPOLESTR pStr; - szDest[0] = 0; + szDest[0] = 0; if (StringFromCLSID(riid, &pStr) == S_OK) { @@ -359,34 +359,34 @@ CoTaskMemFree(pStr); } if (!ret && HCR_RegOpenClassIDKey(riid, &hKey)) - { + { static const WCHAR wszLocalizedString[] = L"LocalizedString"; if (RegLoadMUIStringW(hKey, wszLocalizedString, szDest, len, NULL, 0, NULL) == ERROR_SUCCESS || RegQueryValueExW(hKey, swEmpty, 0, NULL, (LPBYTE)szDest, &len) == ERROR_SUCCESS) - { - ret = TRUE; - } + { + ret = TRUE; + } RegCloseKey(hKey); - } - - if (!ret || !szDest[0]) - { - if(IsEqualIID(riid, &CLSID_ShellDesktop)) - { - if (LoadStringW(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, &CLSID_MyComputer)) - { - if(LoadStringW(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) - ret = TRUE; - } + } + + if (!ret || !szDest[0]) + { + if(IsEqualIID(riid, &CLSID_ShellDesktop)) + { + if (LoadStringW(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, &CLSID_MyComputer)) + { + if(LoadStringW(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) + ret = TRUE; + } else if (IsEqualIID(riid, &CLSID_MyDocuments)) { if(LoadStringW(shell32_hInstance, IDS_PERSONAL, szDest, buflen)) ret = TRUE; - } + } else if (IsEqualIID(riid, &CLSID_RecycleBin)) { if(LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_FOLDER_NAME, szDest, buflen)) @@ -404,43 +404,43 @@ } } - TRACE("-- %s\n", debugstr_w(szDest)); - return ret; + TRACE("-- %s\n", debugstr_w(szDest)); + return ret; } BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len) { HKEY hKey; - BOOL ret = FALSE; - DWORD buflen = len; - - szDest[0] = 0; + BOOL ret = FALSE; + DWORD buflen = len; + + szDest[0] = 0; if (HCR_RegOpenClassIDKey(riid, &hKey)) - { + { if (!RegLoadMUIStringA(hKey, "LocalizedString", szDest, len, NULL, 0, NULL) || !RegQueryValueExA(hKey, "", 0, NULL, (LPBYTE)szDest, &len)) - { - ret = TRUE; - } + { + ret = TRUE; + } RegCloseKey(hKey); - } - - if (!ret || !szDest[0]) - { - if(IsEqualIID(riid, &CLSID_ShellDesktop)) - { - if (LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, &CLSID_MyComputer)) - { - if(LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) - ret = TRUE; - } - } - - TRACE("-- (%s)\n", szDest); - - return ret; + } + + if (!ret || !szDest[0]) + { + if(IsEqualIID(riid, &CLSID_ShellDesktop)) + { + if (LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, &CLSID_MyComputer)) + { + if(LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) + ret = TRUE; + } + } + + TRACE("-- (%s)\n", szDest); + + return ret; } /****************************************************************************** @@ -449,7 +449,7 @@ * Query the registry for a shell folders' attributes * * PARAMS - * pidlFolder [I] A simple pidl of type PT_GUID. + * pidlFolder [I] A simple pidl of type PT_GUID. * pdwAttributes [IO] In: Attributes to be queried, OUT: Resulting attributes. * * RETURNS @@ -466,60 +466,57 @@ LPOLESTR pwszCLSID; LONG lResult; DWORD dwTemp, dwLen; - static const WCHAR wszAttributes[] = L"Attributes"; - static const WCHAR wszCallForAttributes[] = L"CallForAttributes"; - WCHAR wszShellFolderKey[] = L"CLSID\\{00021400-0000-0000-C000-000000000046}\\ShellFolder"; + static const WCHAR wszAttributes[] = { 'A','t','t','r','i','b','u','t','e','s',0 }; + static const WCHAR wszCallForAttributes[] = { + 'C','a','l','l','F','o','r','A','t','t','r','i','b','u','t','e','s',0 }; + WCHAR wszShellFolderKey[] = { 'C','L','S','I','D','\\','{','0','0','0','2','1','4','0','0','-', + '0','0','0','0','-','0','0','0','0','-','C','0','0','0','-','0','0','0','0','0','0','0', + '0','0','0','4','6','}','\\','S','h','e','l','l','F','o','l','d','e','r',0 }; TRACE("(pidlFolder=%p, pdwAttributes=%p)\n", pidlFolder, pdwAttributes); - - if (!_ILIsPidlSimple(pidlFolder)) - { + + if (!_ILIsPidlSimple(pidlFolder)) { ERR("should be called for simple PIDL's only!\n"); return FALSE; } - - if (!_ILIsDesktop(pidlFolder)) - { - if (FAILED(StringFromCLSID(_ILGetGUIDPointer(pidlFolder), &pwszCLSID))) - return FALSE; + + if (!_ILIsDesktop(pidlFolder)) { + if (FAILED(StringFromCLSID(_ILGetGUIDPointer(pidlFolder), &pwszCLSID))) return FALSE; memcpy(&wszShellFolderKey[6], pwszCLSID, 38 * sizeof(WCHAR)); CoTaskMemFree(pwszCLSID); } - + lResult = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszShellFolderKey, 0, KEY_READ, &hSFKey); if (lResult != ERROR_SUCCESS) { ERR("Cannot open key: %ls\n", wszShellFolderKey); return FALSE; } - + dwLen = sizeof(DWORD); lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen); - if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) - { + if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) { IShellFolder *psfDesktop; IShellFolder *psfFolder; HRESULT hr; RegCloseKey(hSFKey); hr = SHGetDesktopFolder(&psfDesktop); - if (SUCCEEDED(hr)) - { - hr = IShellFolder_BindToObject(psfDesktop, pidlFolder, NULL, &IID_IShellFolder, (LPVOID*)&psfFolder); + if (SUCCEEDED(hr)) { + hr = IShellFolder_BindToObject(psfDesktop, pidlFolder, NULL, &IID_IShellFolder, + (LPVOID*)&psfFolder); if (SUCCEEDED(hr)) hr = IShellFolder_GetAttributesOf(psfFolder, 0, NULL, pdwAttributes); } - if (FAILED(hr)) - return FALSE; - } - else - { + if (FAILED(hr)) return FALSE; + } else { lResult = RegQueryValueExW(hSFKey, wszAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen); RegCloseKey(hSFKey); - if (lResult == ERROR_SUCCESS) + if (lResult == ERROR_SUCCESS) { *pdwAttributes &= dwTemp; - else + } else { return FALSE; + } } TRACE("-- *pdwAttributes == 0x%08x\n", *pdwAttributes);
10 years
1
0
0
0
[akhaldi] 65289: [SHELL32] * Move classes.cpp to the wine folder. * Convert classes.cpp into classes.c.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Nov 6 16:49:41 2014 New Revision: 65289 URL:
http://svn.reactos.org/svn/reactos?rev=65289&view=rev
Log: [SHELL32] * Move classes.cpp to the wine folder. * Convert classes.cpp into classes.c. Added: branches/shell-experiments/dll/win32/shell32/wine/classes.c - copied, changed from r65270, branches/shell-experiments/dll/win32/shell32/classes.cpp Removed: branches/shell-experiments/dll/win32/shell32/classes.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] Thu Nov 6 16:49:41 2014 @@ -17,7 +17,6 @@ list(APPEND SOURCE CAutoComplete.cpp - classes.cpp clipboard.cpp CMenuBand.cpp CMenuDeskBar.cpp @@ -67,6 +66,7 @@ ${SOURCE} wine/brsfolder.c wine/changenotify.c + wine/classes.c wine/control.c wine/pidl.c wine/shell32_main.c Removed: branches/shell-experiments/dll/win32/shell32/classes.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/classes.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/classes.cpp (removed) @@ -1,510 +0,0 @@ -/* - * file type mapping - * (HKEY_CLASSES_ROOT - Stuff) - * - * Copyright 1998, 1999, 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); - -#define MAX_EXTENSION_LENGTH 20 - -BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot) -{ - HKEY hkey; - WCHAR szTemp[MAX_EXTENSION_LENGTH + 2]; - - TRACE("%s %p\n", debugstr_w(szExtension), debugstr_w(szFileType)); - - /* added because we do not want to have double dots */ - if (szExtension[0] == '.') - bPrependDot = FALSE; - - if (bPrependDot) - szTemp[0] = '.'; - - lstrcpynW(szTemp + (bPrependDot ? 1 : 0), szExtension, MAX_EXTENSION_LENGTH); - - if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey) != ERROR_SUCCESS) - return FALSE; - - if (RegQueryValueW(hkey, NULL, szFileType, &len) != ERROR_SUCCESS) - { - RegCloseKey(hkey); - return FALSE; - } - - RegCloseKey(hkey); - - TRACE("--UE;\n} %s\n", debugstr_w(szFileType)); - - return TRUE; -} - -BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot) -{ - HKEY hkey; - char szTemp[MAX_EXTENSION_LENGTH + 2]; - - TRACE("%s %p\n", szExtension, szFileType); - - /* added because we do not want to have double dots */ - if (szExtension[0] == '.') - bPrependDot = FALSE; - - if (bPrependDot) - szTemp[0] = '.'; - - lstrcpynA(szTemp + (bPrependDot ? 1 : 0), szExtension, MAX_EXTENSION_LENGTH); - - if (RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey)) - { - return FALSE; - } - - if (RegLoadMUIStringA(hkey, "FriendlyTypeName", szFileType, len, NULL, 0, NULL) == ERROR_SUCCESS) - { - RegCloseKey(hkey); - return TRUE; - } - - if (RegQueryValueA(hkey, NULL, szFileType, &len)) - { - RegCloseKey(hkey); - return FALSE; - } - - RegCloseKey(hkey); - - TRACE("--UE;\n} %s\n", szFileType); - - return TRUE; -} - -static const WCHAR swShell[] = L"shell\\"; -static const WCHAR swOpen[] = L"open"; -static const WCHAR swCommand[] = L"\\command"; - -BOOL HCR_GetDefaultVerbW(HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len) -{ - WCHAR sTemp[MAX_PATH]; - LONG size; - HKEY hkey; - - TRACE("%p %s %p\n", hkeyClass, debugstr_w(szVerb), szDest); - - if (szVerb && *szVerb) - { - lstrcpynW(szDest, szVerb, len); - return TRUE; - } - - size = len; - *szDest = '\0'; - if (RegQueryValueW(hkeyClass, L"shell", szDest, &size) == ERROR_SUCCESS && *szDest) - { - /* The MSDN says to first try the default verb */ - wcscpy(sTemp, swShell); - wcscat(sTemp, szDest); - wcscat(sTemp, swCommand); - if (RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey) == ERROR_SUCCESS) - { - RegCloseKey(hkey); - TRACE("default verb=%s\n", debugstr_w(szDest)); - return TRUE; - } - } - - /* then fallback to 'open' */ - wcscpy(sTemp, swShell); - wcscat(sTemp, swOpen); - wcscat(sTemp, swCommand); - if (RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey) == ERROR_SUCCESS) - { - RegCloseKey(hkey); - lstrcpynW(szDest, swOpen, len); - TRACE("default verb=open\n"); - return TRUE; - } - - /* and then just use the first verb on Windows >= 2000 */ - if (RegOpenKeyExW(hkeyClass, L"shell", 0, KEY_READ, &hkey) == ERROR_SUCCESS) - { - if (RegEnumKeyW(hkey, 0, szDest, len) == ERROR_SUCCESS && *szDest) - { - TRACE("default verb=first verb=%s\n", debugstr_w(szDest)); - RegCloseKey(hkey); - return TRUE; - } - RegCloseKey(hkey); - } - - - TRACE("no default verb!\n"); - return FALSE; -} - -BOOL HCR_GetExecuteCommandW(HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len) -{ - WCHAR sTempVerb[MAX_PATH]; - BOOL ret; - - TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb), szDest); - - if (szClass) - RegOpenKeyExW(HKEY_CLASSES_ROOT, szClass, 0, KEY_READ, &hkeyClass); - if (!hkeyClass) - return FALSE; - ret = FALSE; - - if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, sizeof(sTempVerb)/sizeof(sTempVerb[0]))) - { - WCHAR sTemp[MAX_PATH]; - wcscpy(sTemp, swShell); - wcscat(sTemp, sTempVerb); - wcscat(sTemp, swCommand); - ret = (ERROR_SUCCESS == SHGetValueW(hkeyClass, sTemp, NULL, NULL, szDest, &len)); - } - if (szClass) - RegCloseKey(hkeyClass); - - TRACE("-- %s\n", debugstr_w(szDest)); - return ret; -} - -static BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey) -{ - WCHAR xriid[50]; - swprintf(xriid, L"CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - riid.Data1, riid.Data2, riid.Data3, - riid.Data4[0], riid.Data4[1], riid.Data4[2], riid.Data4[3], - riid.Data4[4], riid.Data4[5], riid.Data4[6], riid.Data4[7] ); - - TRACE("%S\n", xriid); - - return (RegOpenKeyExW(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey) == ERROR_SUCCESS); -} - -/*************************************************************************************** -* HCR_GetIcon [internal] -* -* Gets the icon for a filetype, szName can be NULL, in which case the default icon is loaded -*/ -static BOOL HCR_RegGetIconW(HKEY hkey, LPWSTR szDest, LPCWSTR szName, DWORD len, int* picon_idx) -{ - DWORD dwType; - WCHAR sTemp[MAX_PATH]; - WCHAR sNum[7]; - - if (!RegQueryValueExW(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len)) - { - if (dwType == REG_EXPAND_SZ) - { - ExpandEnvironmentStringsW(szDest, sTemp, MAX_PATH); - lstrcpynW(szDest, sTemp, len); - } - if (ParseFieldW (szDest, 2, sNum, _countof(sNum))) - *picon_idx = atoiW(sNum); - else - *picon_idx = 0; /* sometimes the icon number is missing */ - ParseFieldW (szDest, 1, szDest, len); - PathUnquoteSpacesW(szDest); - return TRUE; - } - return FALSE; -} - -static BOOL HCR_RegGetIconA(HKEY hkey, LPSTR szDest, LPCSTR szName, DWORD len, int* picon_idx) -{ - DWORD dwType; - char sTemp[MAX_PATH]; - char sNum[5]; - - if (!RegQueryValueExA(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len)) - { - if (dwType == REG_EXPAND_SZ) - { - ExpandEnvironmentStringsA(szDest, sTemp, MAX_PATH); - lstrcpynA(szDest, sTemp, len); - } - if (ParseFieldA (szDest, 2, sNum, 5)) - *picon_idx = atoi(sNum); - else - *picon_idx = 0; /* sometimes the icon number is missing */ - ParseFieldA (szDest, 1, szDest, len); - PathUnquoteSpacesA(szDest); - return TRUE; - } - return FALSE; -} - -BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int* picon_idx) -{ - static const WCHAR swDefaultIcon[] = L"\\DefaultIcon"; - HKEY hKey; - WCHAR sTemp[MAX_PATH]; - BOOL ret = FALSE; - - TRACE("%s\n", debugstr_w(szClass) ); - - lstrcpynW(sTemp, szClass, MAX_PATH); - wcscat(sTemp, swDefaultIcon); - - if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hKey)) - { - ret = HCR_RegGetIconW(hKey, szDest, szName, len, picon_idx); - RegCloseKey(hKey); - } - - if(ret) - TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx); - else - TRACE("-- not found\n"); - - return ret; -} - -BOOL HCR_GetIconA(LPCSTR szClass, LPSTR szDest, LPCSTR szName, DWORD len, int* picon_idx) -{ - HKEY hKey; - char sTemp[MAX_PATH]; - BOOL ret = FALSE; - - TRACE("%s\n", szClass ); - - sprintf(sTemp, "%s\\DefaultIcon", szClass); - - if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hKey)) - { - ret = HCR_RegGetIconA(hKey, szDest, szName, len, picon_idx); - RegCloseKey(hKey); - } - TRACE("-- %s %i\n", szDest, *picon_idx); - return ret; -} - -BOOL HCR_GetIconFromGUIDW(REFIID riid, LPWSTR szDest, LPWSTR szName, DWORD len, int* picon_idx) -{ - HKEY hKey; - BOOL ret = FALSE; - - if (HCR_RegOpenClassIDKey(riid, &hKey)) - { - ret = HCR_RegGetIconW(hKey, szDest, szName, len, picon_idx); - RegCloseKey(hKey); - } - TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx); - return ret; -} - -/*************************************************************************************** -* HCR_GetClassName [internal] -* -* Gets the name of a registered class -*/ -static const WCHAR swEmpty[] = {0}; - -BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len) -{ - HKEY hKey; - BOOL ret = FALSE; - DWORD buflen = len; - WCHAR szName[100]; - LPOLESTR pStr; - - szDest[0] = 0; - - if (StringFromCLSID(riid, &pStr) == S_OK) - { - DWORD dwLen = buflen * sizeof(WCHAR); - swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr); - if (RegGetValueW(HKEY_CURRENT_USER, szName, NULL, RRF_RT_REG_SZ, NULL, (PVOID)szDest, &dwLen) == ERROR_SUCCESS) - { - ret = TRUE; - } - CoTaskMemFree(pStr); - } - if (!ret && HCR_RegOpenClassIDKey(riid, &hKey)) - { - static const WCHAR wszLocalizedString[] = L"LocalizedString"; - - if (RegLoadMUIStringW(hKey, wszLocalizedString, szDest, len, NULL, 0, NULL) == ERROR_SUCCESS || - RegQueryValueExW(hKey, swEmpty, 0, NULL, (LPBYTE)szDest, &len) == ERROR_SUCCESS) - { - ret = TRUE; - } - RegCloseKey(hKey); - } - - if (!ret || !szDest[0]) - { - if(IsEqualIID(riid, CLSID_ShellDesktop)) - { - if (LoadStringW(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_MyComputer)) - { - if(LoadStringW(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_MyDocuments)) - { - if(LoadStringW(shell32_hInstance, IDS_PERSONAL, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_RecycleBin)) - { - if(LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_FOLDER_NAME, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_ControlPanel)) - { - if(LoadStringW(shell32_hInstance, IDS_CONTROLPANEL, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_AdminFolderShortcut)) - { - if(LoadStringW(shell32_hInstance, IDS_ADMINISTRATIVETOOLS, szDest, buflen)) - ret = TRUE; - } - } - - TRACE("-- %s\n", debugstr_w(szDest)); - return ret; -} - -BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len) -{ HKEY hKey; - BOOL ret = FALSE; - DWORD buflen = len; - - szDest[0] = 0; - if (HCR_RegOpenClassIDKey(riid, &hKey)) - { - if (!RegLoadMUIStringA(hKey, "LocalizedString", szDest, len, NULL, 0, NULL) || - !RegQueryValueExA(hKey, "", 0, NULL, (LPBYTE)szDest, &len)) - { - ret = TRUE; - } - RegCloseKey(hKey); - } - - if (!ret || !szDest[0]) - { - if(IsEqualIID(riid, CLSID_ShellDesktop)) - { - if (LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_MyComputer)) - { - if(LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) - ret = TRUE; - } - } - - TRACE("-- (%s)\n", szDest); - - return ret; -} - -/****************************************************************************** - * HCR_GetFolderAttributes [Internal] - * - * Query the registry for a shell folders' attributes - * - * PARAMS - * pidlFolder [I] A simple pidl of type PT_GUID. - * pdwAttributes [IO] In: Attributes to be queried, OUT: Resulting attributes. - * - * RETURNS - * TRUE: Found information for the attributes in the registry - * FALSE: No attribute information found - * - * NOTES - * If queried for an attribute, which is set in the CallForAttributes registry - * value, the function binds to the shellfolder objects and queries it. - */ -BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes) -{ - HKEY hSFKey; - LPOLESTR pwszCLSID; - LONG lResult; - DWORD dwTemp, dwLen; - static const WCHAR wszAttributes[] = L"Attributes"; - static const WCHAR wszCallForAttributes[] = L"CallForAttributes"; - WCHAR wszShellFolderKey[] = L"CLSID\\{00021400-0000-0000-C000-000000000046}\\ShellFolder"; - - TRACE("(pidlFolder=%p, pdwAttributes=%p)\n", pidlFolder, pdwAttributes); - - if (!_ILIsPidlSimple(pidlFolder)) - { - ERR("should be called for simple PIDL's only!\n"); - return FALSE; - } - - if (!_ILIsDesktop(pidlFolder)) - { - if (FAILED(StringFromCLSID(*_ILGetGUIDPointer(pidlFolder), &pwszCLSID))) - return FALSE; - memcpy(&wszShellFolderKey[6], pwszCLSID, 38 * sizeof(WCHAR)); - CoTaskMemFree(pwszCLSID); - } - - lResult = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszShellFolderKey, 0, KEY_READ, &hSFKey); - if (lResult != ERROR_SUCCESS) - { - ERR("Cannot open key: %ls\n", wszShellFolderKey); - return FALSE; - } - - dwLen = sizeof(DWORD); - lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen); - if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) - { - CComPtr<IShellFolder> psfDesktop; - CComPtr<IShellFolder> psfFolder; - HRESULT hr; - - RegCloseKey(hSFKey); - hr = SHGetDesktopFolder(&psfDesktop); - if (SUCCEEDED(hr)) - { - hr = psfDesktop->BindToObject(pidlFolder, NULL, IID_PPV_ARG(IShellFolder,&psfFolder)); - if (SUCCEEDED(hr)) - hr = psfFolder->GetAttributesOf(0, NULL, pdwAttributes); - } - if (FAILED(hr)) - return FALSE; - } - else - { - lResult = RegQueryValueExW(hSFKey, wszAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen); - RegCloseKey(hSFKey); - if (lResult == ERROR_SUCCESS) - *pdwAttributes &= dwTemp; - else - return FALSE; - } - - TRACE("-- *pdwAttributes == 0x%08x\n", *pdwAttributes); - - return TRUE; -} Copied: branches/shell-experiments/dll/win32/shell32/wine/classes.c (from r65270, branches/shell-experiments/dll/win32/shell32/classes.cpp) URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/classes.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/classes.c [iso-8859-1] Thu Nov 6 16:49:41 2014 @@ -19,7 +19,25 @@ * 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 +#define COBJMACROS + +#include <windef.h> +#include <winbase.h> +#include <shlobj.h> +#include <shlguid_undoc.h> +#include <shlwapi.h> +#include <wine/debug.h> +#include <wine/unicode.h> + +#include "pidl.h" +#include "shell32_main.h" +#include "shresdef.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -190,15 +208,15 @@ static BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey) { - WCHAR xriid[50]; - swprintf(xriid, L"CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - riid.Data1, riid.Data2, riid.Data3, - riid.Data4[0], riid.Data4[1], riid.Data4[2], riid.Data4[3], - riid.Data4[4], riid.Data4[5], riid.Data4[6], riid.Data4[7] ); - - TRACE("%S\n", xriid); - - return (RegOpenKeyExW(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey) == ERROR_SUCCESS); + char xriid[50]; + sprintf(xriid, "CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + riid->Data1, riid->Data2, riid->Data3, + riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], + riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] ); + + TRACE("%s\n", xriid); + + return (RegOpenKeyExA(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey) == ERROR_SUCCESS); } /*************************************************************************************** @@ -354,32 +372,32 @@ if (!ret || !szDest[0]) { - if(IsEqualIID(riid, CLSID_ShellDesktop)) + if(IsEqualIID(riid, &CLSID_ShellDesktop)) { if (LoadStringW(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) ret = TRUE; } - else if (IsEqualIID(riid, CLSID_MyComputer)) + else if (IsEqualIID(riid, &CLSID_MyComputer)) { if(LoadStringW(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) ret = TRUE; } - else if (IsEqualIID(riid, CLSID_MyDocuments)) + else if (IsEqualIID(riid, &CLSID_MyDocuments)) { if(LoadStringW(shell32_hInstance, IDS_PERSONAL, szDest, buflen)) ret = TRUE; } - else if (IsEqualIID(riid, CLSID_RecycleBin)) + else if (IsEqualIID(riid, &CLSID_RecycleBin)) { if(LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_FOLDER_NAME, szDest, buflen)) ret = TRUE; } - else if (IsEqualIID(riid, CLSID_ControlPanel)) + else if (IsEqualIID(riid, &CLSID_ControlPanel)) { if(LoadStringW(shell32_hInstance, IDS_CONTROLPANEL, szDest, buflen)) ret = TRUE; } - else if (IsEqualIID(riid, CLSID_AdminFolderShortcut)) + else if (IsEqualIID(riid, &CLSID_AdminFolderShortcut)) { if(LoadStringW(shell32_hInstance, IDS_ADMINISTRATIVETOOLS, szDest, buflen)) ret = TRUE; @@ -408,12 +426,12 @@ if (!ret || !szDest[0]) { - if(IsEqualIID(riid, CLSID_ShellDesktop)) + if(IsEqualIID(riid, &CLSID_ShellDesktop)) { if (LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) ret = TRUE; } - else if (IsEqualIID(riid, CLSID_MyComputer)) + else if (IsEqualIID(riid, &CLSID_MyComputer)) { if(LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) ret = TRUE; @@ -462,7 +480,7 @@ if (!_ILIsDesktop(pidlFolder)) { - if (FAILED(StringFromCLSID(*_ILGetGUIDPointer(pidlFolder), &pwszCLSID))) + if (FAILED(StringFromCLSID(_ILGetGUIDPointer(pidlFolder), &pwszCLSID))) return FALSE; memcpy(&wszShellFolderKey[6], pwszCLSID, 38 * sizeof(WCHAR)); CoTaskMemFree(pwszCLSID); @@ -479,17 +497,17 @@ lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen); if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) { - CComPtr<IShellFolder> psfDesktop; - CComPtr<IShellFolder> psfFolder; + IShellFolder *psfDesktop; + IShellFolder *psfFolder; HRESULT hr; RegCloseKey(hSFKey); hr = SHGetDesktopFolder(&psfDesktop); if (SUCCEEDED(hr)) { - hr = psfDesktop->BindToObject(pidlFolder, NULL, IID_PPV_ARG(IShellFolder,&psfFolder)); + hr = IShellFolder_BindToObject(psfDesktop, pidlFolder, NULL, &IID_IShellFolder, (LPVOID*)&psfFolder); if (SUCCEEDED(hr)) - hr = psfFolder->GetAttributesOf(0, NULL, pdwAttributes); + hr = IShellFolder_GetAttributesOf(psfFolder, 0, NULL, pdwAttributes); } if (FAILED(hr)) return FALSE;
10 years
1
0
0
0
[akhaldi] 65288: [SHELL32] * Another partial sync of changenotify.c with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Nov 6 16:35:20 2014 New Revision: 65288 URL:
http://svn.reactos.org/svn/reactos?rev=65288&view=rev
Log: [SHELL32] * Another partial sync of changenotify.c with Wine 1.7.27. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/wine/changenotify.c Modified: branches/shell-experiments/dll/win32/shell32/wine/changenotify.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/changenotify.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/changenotify.c [iso-8859-1] Thu Nov 6 16:35:20 2014 @@ -1,5 +1,5 @@ /* - * shell change notification + * shell change notification * * Copyright 2000 Juergen Schmied * @@ -29,6 +29,7 @@ #include <undocshell.h> #include <shlwapi.h> #include <wine/debug.h> +#include <wine/list.h> #include "pidl.h" @@ -48,20 +49,18 @@ /* internal list of notification clients (internal) */ typedef struct _NOTIFICATIONLIST { - struct _NOTIFICATIONLIST *next; - struct _NOTIFICATIONLIST *prev; + struct list entry; HWND hwnd; /* window to notify */ DWORD uMsg; /* message to send */ LPNOTIFYREGISTER apidl; /* array of entries to watch*/ UINT cidl; /* number of pidls in array */ LONG wEventMask; /* subscribed events */ - LONG wSignalledEvent; /* event that occurred */ DWORD dwFlags; /* client flags */ - LPCITEMIDLIST pidlSignaled; /*pidl of the path that caused the signal*/ - + ULONG id; } NOTIFICATIONLIST, *LPNOTIFICATIONLIST; -static NOTIFICATIONLIST *head, *tail; +static struct list notifications = LIST_INIT( notifications ); +static LONG next_id; #define SHCNE_NOITEMEVENTS ( \ SHCNE_ASSOCCHANGED ) @@ -121,44 +120,14 @@ return str; } -static void AddNode(LPNOTIFICATIONLIST item) -{ - TRACE("item %p\n", item ); - - /* link items */ - item->prev = tail; - item->next = NULL; - if( tail ) - tail->next = item; - else - head = item; - tail = item; -} - -static LPNOTIFICATIONLIST FindNode( HANDLE hitem ) -{ - LPNOTIFICATIONLIST ptr; - for( ptr = head; ptr; ptr = ptr->next ) - if( ptr == (LPNOTIFICATIONLIST) hitem ) - return ptr; - return NULL; -} - static void DeleteNode(LPNOTIFICATIONLIST item) { UINT i; - TRACE("item=%p prev=%p next=%p\n", item, item->prev, item->next); + TRACE("item=%p\n", item); /* remove item from list */ - if( item->prev ) - item->prev->next = item->next; - else - head = item->next; - if( item->next ) - item->next->prev = item->prev; - else - tail = item->prev; + list_remove( &item->entry ); /* free the item */ for (i=0; i<item->cidl; i++) @@ -173,16 +142,18 @@ void FreeChangeNotifications(void) { + LPNOTIFICATIONLIST ptr, next; + TRACE("\n"); EnterCriticalSection(&SHELL32_ChangenotifyCS); - while( head ) - DeleteNode( head ); + LIST_FOR_EACH_ENTRY_SAFE( ptr, next, ¬ifications, NOTIFICATIONLIST, entry ) + DeleteNode( ptr ); LeaveCriticalSection(&SHELL32_ChangenotifyCS); - // DeleteCriticalSection(&SHELL32_ChangenotifyCS); // static + DeleteCriticalSection(&SHELL32_ChangenotifyCS); } /************************************************************************* @@ -201,15 +172,13 @@ LPNOTIFICATIONLIST item; int i; - item = (NOTIFICATIONLIST *)SHAlloc(sizeof(NOTIFICATIONLIST)); + item = SHAlloc(sizeof(NOTIFICATIONLIST)); TRACE("(%p,0x%08x,0x%08x,0x%08x,%d,%p) item=%p\n", hwnd, fSources, wEventMask, uMsg, cItems, lpItems, item); - item->next = NULL; - item->prev = NULL; item->cidl = cItems; - item->apidl = (SHChangeNotifyEntry *)SHAlloc(sizeof(SHChangeNotifyEntry) * cItems); + item->apidl = SHAlloc(sizeof(SHChangeNotifyEntry) * cItems); for(i=0;i<cItems;i++) { item->apidl[i].pidl = ILClone(lpItems[i].pidl); @@ -218,18 +187,18 @@ item->hwnd = hwnd; item->uMsg = uMsg; item->wEventMask = wEventMask; - item->wSignalledEvent = 0; item->dwFlags = fSources; + item->id = InterlockedIncrement( &next_id ); TRACE("new node: %s\n", NodeName( item )); EnterCriticalSection(&SHELL32_ChangenotifyCS); - AddNode(item); + list_add_tail( ¬ifications, &item->entry ); LeaveCriticalSection(&SHELL32_ChangenotifyCS); - return (ULONG)item; + return item->id; } /************************************************************************* @@ -243,25 +212,39 @@ EnterCriticalSection(&SHELL32_ChangenotifyCS); - node = FindNode((HANDLE)hNotify); - if( node ) - DeleteNode(node); - + LIST_FOR_EACH_ENTRY( node, ¬ifications, NOTIFICATIONLIST, entry ) + { + if (node->id == hNotify) + { + DeleteNode( node ); + LeaveCriticalSection(&SHELL32_ChangenotifyCS); + return TRUE; + } + } LeaveCriticalSection(&SHELL32_ChangenotifyCS); - return node?TRUE:FALSE; + return FALSE; } /************************************************************************* * SHChangeNotifyUpdateEntryList [SHELL32.5] */ -EXTERN_C BOOL WINAPI SHChangeNotifyUpdateEntryList(DWORD unknown1, DWORD unknown2, +BOOL WINAPI SHChangeNotifyUpdateEntryList(DWORD unknown1, DWORD unknown2, DWORD unknown3, DWORD unknown4) { FIXME("(0x%08x, 0x%08x, 0x%08x, 0x%08x)\n", unknown1, unknown2, unknown3, unknown4); - return -1; -} + return TRUE; +} + +struct new_delivery_notification +{ + LONG event; + DWORD pidl1_size; + DWORD pidl2_size; + LPITEMIDLIST pidls[2]; + BYTE data[1]; +}; static BOOL should_notify( LPCITEMIDLIST changed, LPCITEMIDLIST watched, BOOL sub ) { @@ -270,8 +253,9 @@ return FALSE; if (ILIsEqual( watched, changed ) ) return TRUE; - if( sub && ILIsParent( watched, changed, TRUE ) ) + if( sub && ILIsParent( watched, changed, FALSE ) ) return TRUE; +#ifdef __REACTOS__ if (sub && _ILIsDesktop(watched)) { LPITEMIDLIST deskpidl; WCHAR wszPath[MAX_PATH]; @@ -292,6 +276,7 @@ } ILFree(deskpidl); } +#endif return FALSE; } @@ -300,14 +285,25 @@ */ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2) { + struct notification_recipients { + struct list entry; + HWND hwnd; + DWORD msg; + DWORD flags; + } *cur, *next; + + HANDLE shared_data = NULL; LPITEMIDLIST Pidls[2]; LPNOTIFICATIONLIST ptr; - UINT typeFlag = uFlags & SHCNF_TYPE; + struct list recipients; Pidls[0] = NULL; Pidls[1] = NULL; - TRACE("(0x%08x,0x%08x,%p,%p):stub.\n", wEventId, uFlags, dwItem1, dwItem2); + TRACE("(0x%08x,0x%08x,%p,%p)\n", wEventId, uFlags, dwItem1, dwItem2); + + if(uFlags & ~(SHCNF_TYPE|SHCNF_FLUSH)) + FIXME("ignoring unsupported flags: %x\n", uFlags); if( ( wEventId & SHCNE_NOITEMEVENTS ) && ( dwItem1 || dwItem2 ) ) { @@ -335,15 +331,16 @@ } /* convert paths in IDLists*/ - switch (typeFlag) + switch (uFlags & SHCNF_TYPE) { case SHCNF_PATHA: - if (dwItem1) Pidls[0] = SHSimpleIDListFromPathA((LPCSTR)dwItem1); //FIXME - if (dwItem2) Pidls[1] = SHSimpleIDListFromPathA((LPCSTR)dwItem2); //FIXME + if (dwItem1) Pidls[0] = SHSimpleIDListFromPathA(dwItem1); //FIXME + if (dwItem2) Pidls[1] = SHSimpleIDListFromPathA(dwItem2); //FIXME break; case SHCNF_PATHW: - if (dwItem1) Pidls[0] = SHSimpleIDListFromPathW((LPCWSTR)dwItem1); - if (dwItem2) Pidls[1] = SHSimpleIDListFromPathW((LPCWSTR)dwItem2); + if (dwItem1) Pidls[0] = SHSimpleIDListFromPathW(dwItem1); + if (dwItem2) Pidls[1] = SHSimpleIDListFromPathW(dwItem2); +#ifdef __REACTOS__ if (wEventId & (SHCNE_MKDIR | SHCNE_RMDIR | SHCNE_UPDATEDIR | SHCNE_RENAMEFOLDER)) { /* @@ -379,10 +376,11 @@ ILFree(oldpidl); } } +#endif break; case SHCNF_IDLIST: - Pidls[0] = (LPITEMIDLIST)dwItem1; - Pidls[1] = (LPITEMIDLIST)dwItem2; + Pidls[0] = ILClone(dwItem1); + Pidls[1] = ILClone(dwItem2); break; case SHCNF_PRINTERA: case SHCNF_PRINTERW: @@ -390,31 +388,17 @@ return; case SHCNF_DWORD: default: - FIXME("unknown type %08x\n",typeFlag); + FIXME("unknown type %08x\n", uFlags & SHCNF_TYPE); return; } - { - WCHAR path[MAX_PATH]; - - if( Pidls[0] && SHGetPathFromIDListW(Pidls[0], path )) - TRACE("notify %08x on item1 = %s\n", wEventId, debugstr_w(path)); - - if( Pidls[1] && SHGetPathFromIDListW(Pidls[1], path )) - TRACE("notify %08x on item2 = %s\n", wEventId, debugstr_w(path)); - } - + list_init(&recipients); EnterCriticalSection(&SHELL32_ChangenotifyCS); - - /* loop through the list */ - for( ptr = head; ptr; ptr = ptr->next ) - { - BOOL notify; + LIST_FOR_EACH_ENTRY( ptr, ¬ifications, NOTIFICATIONLIST, entry ) + { + struct notification_recipients *item; + BOOL notify = FALSE; DWORD i; - - notify = FALSE; - - TRACE("trying %p\n", ptr); for( i=0; (i<ptr->cidl) && !notify ; i++ ) { @@ -437,31 +421,71 @@ if( !notify ) continue; - ptr->pidlSignaled = ILClone(Pidls[0]); - - TRACE("notifying %s, event %s(%x) before\n", NodeName( ptr ), DumpEvent( - wEventId ),wEventId ); - - ptr->wSignalledEvent |= wEventId; - - if (ptr->dwFlags & SHCNRF_NewDelivery) - SendMessageW(ptr->hwnd, ptr->uMsg, (WPARAM) ptr, (LPARAM) GetCurrentProcessId()); - else - SendMessageW(ptr->hwnd, ptr->uMsg, (WPARAM)Pidls, wEventId); - - TRACE("notifying %s, event %s(%x) after\n", NodeName( ptr ), DumpEvent( - wEventId ),wEventId ); - - } - TRACE("notify Done\n"); + item = SHAlloc(sizeof(struct notification_recipients)); + if(!item) { + ERR("out of memory\n"); + continue; + } + + item->hwnd = ptr->hwnd; + item->msg = ptr->uMsg; + item->flags = ptr->dwFlags; + list_add_tail(&recipients, &item->entry); + } LeaveCriticalSection(&SHELL32_ChangenotifyCS); - /* if we allocated it, free it. The ANSI flag is also set in its Unicode sibling. */ - if ((typeFlag & SHCNF_PATHA) || (typeFlag & SHCNF_PRINTERA)) - { - SHFree((LPITEMIDLIST)Pidls[0]); - SHFree((LPITEMIDLIST)Pidls[1]); - } + LIST_FOR_EACH_ENTRY_SAFE(cur, next, &recipients, struct notification_recipients, entry) + { + TRACE("notifying %p, event %s(%x)\n", cur->hwnd, DumpEvent(wEventId), wEventId); + + if (cur->flags & SHCNRF_NewDelivery) { + if(!shared_data) { + struct new_delivery_notification *notification; + UINT size1 = ILGetSize(Pidls[0]), size2 = ILGetSize(Pidls[1]); + UINT offset = (size1+sizeof(int)-1)/sizeof(int)*sizeof(int); + + notification = SHAlloc(sizeof(struct new_delivery_notification)+offset+size2); + if(!notification) { + ERR("out of memory\n"); + } else { + notification->event = wEventId; + notification->pidl1_size = size1; + notification->pidl2_size = size2; + if(size1) + memcpy(notification->data, Pidls[0], size1); + if(size2) + memcpy(notification->data+offset, Pidls[1], size2); + + shared_data = SHAllocShared(notification, + sizeof(struct new_delivery_notification)+size1+size2, + GetCurrentProcessId()); + SHFree(notification); + } + } + + if(shared_data) + SendMessageA(cur->hwnd, cur->msg, (WPARAM)shared_data, GetCurrentProcessId()); + else + ERR("out of memory\n"); + } else { + SendMessageA(cur->hwnd, cur->msg, (WPARAM)Pidls, wEventId); + } + + list_remove(&cur->entry); + SHFree(cur); + } + SHFreeShared(shared_data, GetCurrentProcessId()); + SHFree(Pidls[0]); + SHFree(Pidls[1]); + +#ifndef __REACTOS__ + if (wEventId & SHCNE_ASSOCCHANGED) + { + static const WCHAR args[] = {' ','-','a',0 }; + TRACE("refreshing file type associations\n"); + run_winemenubuilder( args ); + } +#endif } /************************************************************************* @@ -492,26 +516,28 @@ LPITEMIDLIST **lppidls, LPLONG lpwEventId) { - DWORD i; - LPNOTIFICATIONLIST node; - LPCITEMIDLIST *idlist; + struct new_delivery_notification *ndn; + UINT offset; TRACE("%p %08x %p %p\n", hChange, dwProcessId, lppidls, lpwEventId); - node = FindNode( hChange ); - if( node ) - { - idlist = (LPCITEMIDLIST *)SHAlloc( sizeof(LPCITEMIDLIST *) * node->cidl ); - for(i=0; i<node->cidl; i++) - idlist[i] = (LPCITEMIDLIST)node->pidlSignaled; - *lpwEventId = node->wSignalledEvent; - *lppidls = (LPITEMIDLIST*)idlist; - node->wSignalledEvent = 0; - } - else - ERR("Couldn't find %p\n", hChange ); - - return (HANDLE) node; + ndn = SHLockShared(hChange, dwProcessId); + if(!ndn) { + WARN("SHLockShared failed\n"); + return NULL; + } + + if(lppidls) { + offset = (ndn->pidl1_size+sizeof(int)-1)/sizeof(int)*sizeof(int); + ndn->pidls[0] = ndn->pidl1_size ? (LPITEMIDLIST)ndn->data : NULL; + ndn->pidls[1] = ndn->pidl2_size ? (LPITEMIDLIST)(ndn->data+offset) : NULL; + *lppidls = ndn->pidls; + } + + if(lpwEventId) + *lpwEventId = ndn->event; + + return ndn; } /************************************************************************* @@ -519,14 +545,14 @@ */ BOOL WINAPI SHChangeNotification_Unlock ( HANDLE hLock) { - TRACE("\n"); - return 1; + TRACE("%p\n", hLock); + return SHUnlockShared(hLock); } /************************************************************************* * NTSHChangeNotifyDeregister [SHELL32.641] */ -EXTERN_C DWORD WINAPI NTSHChangeNotifyDeregister(ULONG x1) +DWORD WINAPI NTSHChangeNotifyDeregister(ULONG x1) { FIXME("(0x%08x):semi stub.\n",x1);
10 years
1
0
0
0
[akhaldi] 65287: [SHELL32] * Partial sync of changenotify.c with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Nov 6 16:11:48 2014 New Revision: 65287 URL:
http://svn.reactos.org/svn/reactos?rev=65287&view=rev
Log: [SHELL32] * Partial sync of changenotify.c with Wine 1.7.27. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/wine/changenotify.c Modified: branches/shell-experiments/dll/win32/shell32/wine/changenotify.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/changenotify.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/changenotify.c [iso-8859-1] Thu Nov 6 16:11:48 2014 @@ -50,13 +50,13 @@ { struct _NOTIFICATIONLIST *next; struct _NOTIFICATIONLIST *prev; - HWND hwnd; /* window to notify */ - DWORD uMsg; /* message to send */ - LPNOTIFYREGISTER apidl; /* array of entries to watch*/ - UINT cidl; /* number of pidls in array */ - LONG wEventMask; /* subscribed events */ + HWND hwnd; /* window to notify */ + DWORD uMsg; /* message to send */ + LPNOTIFYREGISTER apidl; /* array of entries to watch*/ + UINT cidl; /* number of pidls in array */ + LONG wEventMask; /* subscribed events */ LONG wSignalledEvent; /* event that occurred */ - DWORD dwFlags; /* client flags */ + DWORD dwFlags; /* client flags */ LPCITEMIDLIST pidlSignaled; /*pidl of the path that caused the signal*/ } NOTIFICATIONLIST, *LPNOTIFICATIONLIST; @@ -186,7 +186,7 @@ } /************************************************************************* - * SHChangeNotifyRegister [SHELL32.2] + * SHChangeNotifyRegister [SHELL32.2] * */ ULONG WINAPI @@ -204,7 +204,7 @@ item = (NOTIFICATIONLIST *)SHAlloc(sizeof(NOTIFICATIONLIST)); TRACE("(%p,0x%08x,0x%08x,0x%08x,%d,%p) item=%p\n", - hwnd, fSources, wEventMask, uMsg, cItems, lpItems, item); + hwnd, fSources, wEventMask, uMsg, cItems, lpItems, item); item->next = NULL; item->prev = NULL; @@ -233,7 +233,7 @@ } /************************************************************************* - * SHChangeNotifyDeregister [SHELL32.4] + * SHChangeNotifyDeregister [SHELL32.4] */ BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify) { @@ -248,15 +248,14 @@ DeleteNode(node); LeaveCriticalSection(&SHELL32_ChangenotifyCS); - return node?TRUE:FALSE; } /************************************************************************* - * SHChangeNotifyUpdateEntryList [SHELL32.5] + * SHChangeNotifyUpdateEntryList [SHELL32.5] */ EXTERN_C BOOL WINAPI SHChangeNotifyUpdateEntryList(DWORD unknown1, DWORD unknown2, - DWORD unknown3, DWORD unknown4) + DWORD unknown3, DWORD unknown4) { FIXME("(0x%08x, 0x%08x, 0x%08x, 0x%08x)\n", unknown1, unknown2, unknown3, unknown4); @@ -297,7 +296,7 @@ } /************************************************************************* - * SHChangeNotify [SHELL32.@] + * SHChangeNotify [SHELL32.@] */ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2) { @@ -324,11 +323,11 @@ return; } - if( ( ( wEventId & SHCNE_NOITEMEVENTS ) && + if( ( ( wEventId & SHCNE_NOITEMEVENTS ) && ( wEventId & ~SHCNE_NOITEMEVENTS ) ) || - ( ( wEventId & SHCNE_ONEITEMEVENTS ) && + ( ( wEventId & SHCNE_ONEITEMEVENTS ) && ( wEventId & ~SHCNE_ONEITEMEVENTS ) ) || - ( ( wEventId & SHCNE_TWOITEMEVENTS ) && + ( ( wEventId & SHCNE_TWOITEMEVENTS ) && ( wEventId & ~SHCNE_TWOITEMEVENTS ) ) ) { WARN("mutually incompatible events listed\n"); @@ -485,21 +484,19 @@ } /************************************************************************* - * SHChangeNotification_Lock [SHELL32.644] + * SHChangeNotification_Lock [SHELL32.644] */ HANDLE WINAPI SHChangeNotification_Lock( - HANDLE hChange, - DWORD dwProcessId, - LPITEMIDLIST **lppidls, - LPLONG lpwEventId) + HANDLE hChange, + DWORD dwProcessId, + LPITEMIDLIST **lppidls, + LPLONG lpwEventId) { DWORD i; LPNOTIFICATIONLIST node; LPCITEMIDLIST *idlist; TRACE("%p %08x %p %p\n", hChange, dwProcessId, lppidls, lpwEventId); - - /* EnterCriticalSection(&SHELL32_ChangenotifyCS); */ node = FindNode( hChange ); if( node ) @@ -514,13 +511,11 @@ else ERR("Couldn't find %p\n", hChange ); - /* LeaveCriticalSection(&SHELL32_ChangenotifyCS); */ - return (HANDLE) node; } /************************************************************************* - * SHChangeNotification_Unlock [SHELL32.645] + * SHChangeNotification_Unlock [SHELL32.645] */ BOOL WINAPI SHChangeNotification_Unlock ( HANDLE hLock) { @@ -529,7 +524,7 @@ } /************************************************************************* - * NTSHChangeNotifyDeregister [SHELL32.641] + * NTSHChangeNotifyDeregister [SHELL32.641] */ EXTERN_C DWORD WINAPI NTSHChangeNotifyDeregister(ULONG x1) {
10 years
1
0
0
0
[akhaldi] 65286: [SHELL32] * Move changenotify.cpp to the wine folder. * Convert changenotify.cpp into changenotify.c.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Nov 6 16:01:10 2014 New Revision: 65286 URL:
http://svn.reactos.org/svn/reactos?rev=65286&view=rev
Log: [SHELL32] * Move changenotify.cpp to the wine folder. * Convert changenotify.cpp into changenotify.c. Added: branches/shell-experiments/dll/win32/shell32/wine/changenotify.c - copied, changed from r65270, branches/shell-experiments/dll/win32/shell32/changenotify.cpp Removed: branches/shell-experiments/dll/win32/shell32/changenotify.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] Thu Nov 6 16:01:10 2014 @@ -17,7 +17,6 @@ list(APPEND SOURCE CAutoComplete.cpp - changenotify.cpp classes.cpp clipboard.cpp CMenuBand.cpp @@ -67,6 +66,7 @@ add_library(shell32 SHARED ${SOURCE} wine/brsfolder.c + wine/changenotify.c wine/control.c wine/pidl.c wine/shell32_main.c Removed: branches/shell-experiments/dll/win32/shell32/changenotify.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/changenotify.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/changenotify.cpp (removed) @@ -1,527 +0,0 @@ -/* - * shell change notification - * - * 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); - -namespace -{ - extern CRITICAL_SECTION SHELL32_ChangenotifyCS; - CRITICAL_SECTION_DEBUG critsect_debug = - { - 0, 0, &SHELL32_ChangenotifyCS, - { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": SHELL32_ChangenotifyCS") } - }; - CRITICAL_SECTION SHELL32_ChangenotifyCS = { &critsect_debug, -1, 0, 0, 0, 0 }; -} - -typedef SHChangeNotifyEntry *LPNOTIFYREGISTER; - -/* internal list of notification clients (internal) */ -typedef struct _NOTIFICATIONLIST -{ - struct _NOTIFICATIONLIST *next; - struct _NOTIFICATIONLIST *prev; - HWND hwnd; /* window to notify */ - DWORD uMsg; /* message to send */ - LPNOTIFYREGISTER apidl; /* array of entries to watch*/ - UINT cidl; /* number of pidls in array */ - LONG wEventMask; /* subscribed events */ - LONG wSignalledEvent; /* event that occurred */ - DWORD dwFlags; /* client flags */ - LPCITEMIDLIST pidlSignaled; /*pidl of the path that caused the signal*/ - -} NOTIFICATIONLIST, *LPNOTIFICATIONLIST; - -static NOTIFICATIONLIST *head, *tail; - -#define SHCNE_NOITEMEVENTS ( \ - SHCNE_ASSOCCHANGED ) - -#define SHCNE_ONEITEMEVENTS ( \ - SHCNE_ATTRIBUTES | SHCNE_CREATE | SHCNE_DELETE | SHCNE_DRIVEADD | \ - SHCNE_DRIVEADDGUI | SHCNE_DRIVEREMOVED | SHCNE_FREESPACE | \ - SHCNE_MEDIAINSERTED | SHCNE_MEDIAREMOVED | SHCNE_MKDIR | \ - SHCNE_NETSHARE | SHCNE_NETUNSHARE | SHCNE_RMDIR | \ - SHCNE_SERVERDISCONNECT | SHCNE_UPDATEDIR | SHCNE_UPDATEIMAGE ) - -#define SHCNE_TWOITEMEVENTS ( \ - SHCNE_RENAMEFOLDER | SHCNE_RENAMEITEM | SHCNE_UPDATEITEM ) - -/* for dumping events */ -static const char * DumpEvent( LONG event ) -{ - if( event == SHCNE_ALLEVENTS ) - return "SHCNE_ALLEVENTS"; -#define DUMPEV(x) ,( event & SHCNE_##x )? #x " " : "" - return wine_dbg_sprintf( "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" - DUMPEV(RENAMEITEM) - DUMPEV(CREATE) - DUMPEV(DELETE) - DUMPEV(MKDIR) - DUMPEV(RMDIR) - DUMPEV(MEDIAINSERTED) - DUMPEV(MEDIAREMOVED) - DUMPEV(DRIVEREMOVED) - DUMPEV(DRIVEADD) - DUMPEV(NETSHARE) - DUMPEV(NETUNSHARE) - DUMPEV(ATTRIBUTES) - DUMPEV(UPDATEDIR) - DUMPEV(UPDATEITEM) - DUMPEV(SERVERDISCONNECT) - DUMPEV(UPDATEIMAGE) - DUMPEV(DRIVEADDGUI) - DUMPEV(RENAMEFOLDER) - DUMPEV(FREESPACE) - DUMPEV(EXTENDED_EVENT) - DUMPEV(ASSOCCHANGED) - DUMPEV(INTERRUPT) - ); -#undef DUMPEV -} - -static const char * NodeName(const NOTIFICATIONLIST *item) -{ - const char *str; - WCHAR path[MAX_PATH]; - - if(SHGetPathFromIDListW(item->apidl[0].pidl, path )) - str = wine_dbg_sprintf("%s", debugstr_w(path)); - else - str = wine_dbg_sprintf("<not a disk file>" ); - return str; -} - -static void AddNode(LPNOTIFICATIONLIST item) -{ - TRACE("item %p\n", item ); - - /* link items */ - item->prev = tail; - item->next = NULL; - if( tail ) - tail->next = item; - else - head = item; - tail = item; -} - -static LPNOTIFICATIONLIST FindNode( HANDLE hitem ) -{ - LPNOTIFICATIONLIST ptr; - for( ptr = head; ptr; ptr = ptr->next ) - if( ptr == (LPNOTIFICATIONLIST) hitem ) - return ptr; - return NULL; -} - -static void DeleteNode(LPNOTIFICATIONLIST item) -{ - UINT i; - - TRACE("item=%p prev=%p next=%p\n", item, item->prev, item->next); - - /* remove item from list */ - if( item->prev ) - item->prev->next = item->next; - else - head = item->next; - if( item->next ) - item->next->prev = item->prev; - else - tail = item->prev; - - /* free the item */ - for (i=0; i<item->cidl; i++) - SHFree((LPITEMIDLIST)item->apidl[i].pidl); - SHFree(item->apidl); - SHFree(item); -} - -void InitChangeNotifications(void) -{ -} - -void FreeChangeNotifications(void) -{ - TRACE("\n"); - - EnterCriticalSection(&SHELL32_ChangenotifyCS); - - while( head ) - DeleteNode( head ); - - LeaveCriticalSection(&SHELL32_ChangenotifyCS); - - // DeleteCriticalSection(&SHELL32_ChangenotifyCS); // static -} - -/************************************************************************* - * SHChangeNotifyRegister [SHELL32.2] - * - */ -ULONG WINAPI -SHChangeNotifyRegister( - HWND hwnd, - int fSources, - LONG wEventMask, - UINT uMsg, - int cItems, - SHChangeNotifyEntry *lpItems) -{ - LPNOTIFICATIONLIST item; - int i; - - item = (NOTIFICATIONLIST *)SHAlloc(sizeof(NOTIFICATIONLIST)); - - TRACE("(%p,0x%08x,0x%08x,0x%08x,%d,%p) item=%p\n", - hwnd, fSources, wEventMask, uMsg, cItems, lpItems, item); - - item->next = NULL; - item->prev = NULL; - item->cidl = cItems; - item->apidl = (SHChangeNotifyEntry *)SHAlloc(sizeof(SHChangeNotifyEntry) * cItems); - for(i=0;i<cItems;i++) - { - item->apidl[i].pidl = ILClone(lpItems[i].pidl); - item->apidl[i].fRecursive = lpItems[i].fRecursive; - } - item->hwnd = hwnd; - item->uMsg = uMsg; - item->wEventMask = wEventMask; - item->wSignalledEvent = 0; - item->dwFlags = fSources; - - TRACE("new node: %s\n", NodeName( item )); - - EnterCriticalSection(&SHELL32_ChangenotifyCS); - - AddNode(item); - - LeaveCriticalSection(&SHELL32_ChangenotifyCS); - - return (ULONG)item; -} - -/************************************************************************* - * SHChangeNotifyDeregister [SHELL32.4] - */ -BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify) -{ - LPNOTIFICATIONLIST node; - - TRACE("(0x%08x)\n", hNotify); - - EnterCriticalSection(&SHELL32_ChangenotifyCS); - - node = FindNode((HANDLE)hNotify); - if( node ) - DeleteNode(node); - - LeaveCriticalSection(&SHELL32_ChangenotifyCS); - - return node?TRUE:FALSE; -} - -/************************************************************************* - * SHChangeNotifyUpdateEntryList [SHELL32.5] - */ -EXTERN_C BOOL WINAPI SHChangeNotifyUpdateEntryList(DWORD unknown1, DWORD unknown2, - DWORD unknown3, DWORD unknown4) -{ - FIXME("(0x%08x, 0x%08x, 0x%08x, 0x%08x)\n", - unknown1, unknown2, unknown3, unknown4); - - return -1; -} - -static BOOL should_notify( LPCITEMIDLIST changed, LPCITEMIDLIST watched, BOOL sub ) -{ - TRACE("%p %p %d\n", changed, watched, sub ); - if ( !watched ) - return FALSE; - if (ILIsEqual( watched, changed ) ) - return TRUE; - if( sub && ILIsParent( watched, changed, TRUE ) ) - return TRUE; - if (sub && _ILIsDesktop(watched)) { - WCHAR wszPath[MAX_PATH]; - SHGetSpecialFolderPathW(0, wszPath, CSIDL_DESKTOPDIRECTORY, FALSE); - LPITEMIDLIST deskpidl = SHSimpleIDListFromPathW(wszPath); - if (ILIsParent(deskpidl, changed, TRUE)) - { - ILFree(deskpidl); - return TRUE; - } - ILFree(deskpidl); - SHGetSpecialFolderPathW(0, wszPath, CSIDL_COMMON_DESKTOPDIRECTORY, FALSE); - deskpidl = SHSimpleIDListFromPathW(wszPath); - if (ILIsParent(deskpidl, changed, TRUE)) - { - ILFree(deskpidl); - return TRUE; - } - ILFree(deskpidl); - } - return FALSE; -} - -/************************************************************************* - * SHChangeNotify [SHELL32.@] - */ -void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2) -{ - LPITEMIDLIST Pidls[2]; - LPNOTIFICATIONLIST ptr; - UINT typeFlag = uFlags & SHCNF_TYPE; - - Pidls[0] = NULL; - Pidls[1] = NULL; - - TRACE("(0x%08x,0x%08x,%p,%p):stub.\n", wEventId, uFlags, dwItem1, dwItem2); - - if( ( wEventId & SHCNE_NOITEMEVENTS ) && ( dwItem1 || dwItem2 ) ) - { - TRACE("dwItem1 and dwItem2 are not zero, but should be\n"); - dwItem1 = 0; - dwItem2 = 0; - return; - } - else if( ( wEventId & SHCNE_ONEITEMEVENTS ) && dwItem2 ) - { - TRACE("dwItem2 is not zero, but should be\n"); - dwItem2 = 0; - return; - } - - if( ( ( wEventId & SHCNE_NOITEMEVENTS ) && - ( wEventId & ~SHCNE_NOITEMEVENTS ) ) || - ( ( wEventId & SHCNE_ONEITEMEVENTS ) && - ( wEventId & ~SHCNE_ONEITEMEVENTS ) ) || - ( ( wEventId & SHCNE_TWOITEMEVENTS ) && - ( wEventId & ~SHCNE_TWOITEMEVENTS ) ) ) - { - WARN("mutually incompatible events listed\n"); - return; - } - - /* convert paths in IDLists*/ - switch (typeFlag) - { - case SHCNF_PATHA: - if (dwItem1) Pidls[0] = SHSimpleIDListFromPathA((LPCSTR)dwItem1); //FIXME - if (dwItem2) Pidls[1] = SHSimpleIDListFromPathA((LPCSTR)dwItem2); //FIXME - break; - case SHCNF_PATHW: - if (dwItem1) Pidls[0] = SHSimpleIDListFromPathW((LPCWSTR)dwItem1); - if (dwItem2) Pidls[1] = SHSimpleIDListFromPathW((LPCWSTR)dwItem2); - if (wEventId & (SHCNE_MKDIR | SHCNE_RMDIR | SHCNE_UPDATEDIR | SHCNE_RENAMEFOLDER)) - { - /* - * The last items in the ID are currently files. So we chop off the last - * entry, and create a new one using a find data struct. - */ - if (dwItem1 && Pidls[0]){ - ILRemoveLastID(Pidls[0]); - WIN32_FIND_DATAW wfd; - LPWSTR p = PathFindFileNameW((LPCWSTR)dwItem1); - lstrcpynW(&wfd.cFileName[0], p, MAX_PATH); - wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; - LPITEMIDLIST newpidl = _ILCreateFromFindDataW(&wfd); - LPITEMIDLIST oldpidl = ILClone(Pidls[0]); - ILFree(Pidls[0]); - Pidls[0] = ILCombine(oldpidl, newpidl); - ILFree(newpidl); - ILFree(oldpidl); - } - if (dwItem2 && Pidls[1]){ - ILRemoveLastID(Pidls[1]); - WIN32_FIND_DATAW wfd; - LPWSTR p = PathFindFileNameW((LPCWSTR)dwItem2); - lstrcpynW(&wfd.cFileName[0], p, MAX_PATH); - wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; - LPITEMIDLIST newpidl = _ILCreateFromFindDataW(&wfd); - LPITEMIDLIST oldpidl = ILClone(Pidls[0]); - ILFree(Pidls[1]); - Pidls[1] = ILCombine(oldpidl, newpidl); - ILFree(newpidl); - ILFree(oldpidl); - } - } - break; - case SHCNF_IDLIST: - Pidls[0] = (LPITEMIDLIST)dwItem1; - Pidls[1] = (LPITEMIDLIST)dwItem2; - break; - case SHCNF_PRINTERA: - case SHCNF_PRINTERW: - FIXME("SHChangeNotify with (uFlags & SHCNF_PRINTER)\n"); - return; - case SHCNF_DWORD: - default: - FIXME("unknown type %08x\n",typeFlag); - return; - } - - { - WCHAR path[MAX_PATH]; - - if( Pidls[0] && SHGetPathFromIDListW(Pidls[0], path )) - TRACE("notify %08x on item1 = %s\n", wEventId, debugstr_w(path)); - - if( Pidls[1] && SHGetPathFromIDListW(Pidls[1], path )) - TRACE("notify %08x on item2 = %s\n", wEventId, debugstr_w(path)); - } - - EnterCriticalSection(&SHELL32_ChangenotifyCS); - - /* loop through the list */ - for( ptr = head; ptr; ptr = ptr->next ) - { - BOOL notify; - DWORD i; - - notify = FALSE; - - TRACE("trying %p\n", ptr); - - for( i=0; (i<ptr->cidl) && !notify ; i++ ) - { - LPCITEMIDLIST pidl = ptr->apidl[i].pidl; - BOOL subtree = ptr->apidl[i].fRecursive; - - if (wEventId & ptr->wEventMask) - { - if( !pidl ) /* all ? */ - notify = TRUE; - else if( wEventId & SHCNE_NOITEMEVENTS ) - notify = TRUE; - else if( wEventId & ( SHCNE_ONEITEMEVENTS | SHCNE_TWOITEMEVENTS ) ) - notify = should_notify( Pidls[0], pidl, subtree ); - else if( wEventId & SHCNE_TWOITEMEVENTS ) - notify = should_notify( Pidls[1], pidl, subtree ); - } - } - - if( !notify ) - continue; - - ptr->pidlSignaled = ILClone(Pidls[0]); - - TRACE("notifying %s, event %s(%x) before\n", NodeName( ptr ), DumpEvent( - wEventId ),wEventId ); - - ptr->wSignalledEvent |= wEventId; - - if (ptr->dwFlags & SHCNRF_NewDelivery) - SendMessageW(ptr->hwnd, ptr->uMsg, (WPARAM) ptr, (LPARAM) GetCurrentProcessId()); - else - SendMessageW(ptr->hwnd, ptr->uMsg, (WPARAM)Pidls, wEventId); - - TRACE("notifying %s, event %s(%x) after\n", NodeName( ptr ), DumpEvent( - wEventId ),wEventId ); - - } - TRACE("notify Done\n"); - LeaveCriticalSection(&SHELL32_ChangenotifyCS); - - /* if we allocated it, free it. The ANSI flag is also set in its Unicode sibling. */ - if ((typeFlag & SHCNF_PATHA) || (typeFlag & SHCNF_PRINTERA)) - { - SHFree((LPITEMIDLIST)Pidls[0]); - SHFree((LPITEMIDLIST)Pidls[1]); - } -} - -/************************************************************************* - * NTSHChangeNotifyRegister [SHELL32.640] - * NOTES - * Idlist is an array of structures and Count specifies how many items in the array. - * count should always be one when calling SHChangeNotifyRegister, or - * SHChangeNotifyDeregister will not work properly. - */ -EXTERN_C ULONG WINAPI NTSHChangeNotifyRegister( - HWND hwnd, - int fSources, - LONG fEvents, - UINT msg, - int count, - SHChangeNotifyEntry *idlist) -{ - return SHChangeNotifyRegister(hwnd, fSources | SHCNRF_NewDelivery, - fEvents, msg, count, idlist); -} - -/************************************************************************* - * SHChangeNotification_Lock [SHELL32.644] - */ -HANDLE WINAPI SHChangeNotification_Lock( - HANDLE hChange, - DWORD dwProcessId, - LPITEMIDLIST **lppidls, - LPLONG lpwEventId) -{ - DWORD i; - LPNOTIFICATIONLIST node; - LPCITEMIDLIST *idlist; - - TRACE("%p %08x %p %p\n", hChange, dwProcessId, lppidls, lpwEventId); - - /* EnterCriticalSection(&SHELL32_ChangenotifyCS); */ - - node = FindNode( hChange ); - if( node ) - { - idlist = (LPCITEMIDLIST *)SHAlloc( sizeof(LPCITEMIDLIST *) * node->cidl ); - for(i=0; i<node->cidl; i++) - idlist[i] = (LPCITEMIDLIST)node->pidlSignaled; - *lpwEventId = node->wSignalledEvent; - *lppidls = (LPITEMIDLIST*)idlist; - node->wSignalledEvent = 0; - } - else - ERR("Couldn't find %p\n", hChange ); - - /* LeaveCriticalSection(&SHELL32_ChangenotifyCS); */ - - return (HANDLE) node; -} - -/************************************************************************* - * SHChangeNotification_Unlock [SHELL32.645] - */ -BOOL WINAPI SHChangeNotification_Unlock ( HANDLE hLock) -{ - TRACE("\n"); - return 1; -} - -/************************************************************************* - * NTSHChangeNotifyDeregister [SHELL32.641] - */ -EXTERN_C DWORD WINAPI NTSHChangeNotifyDeregister(ULONG x1) -{ - FIXME("(0x%08x):semi stub.\n",x1); - - return SHChangeNotifyDeregister( x1 ); -} Copied: branches/shell-experiments/dll/win32/shell32/wine/changenotify.c (from r65270, branches/shell-experiments/dll/win32/shell32/changenotify.cpp) URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/changenotify.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/changenotify.c [iso-8859-1] Thu Nov 6 16:01:10 2014 @@ -18,21 +18,30 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define NONAMELESSUNION +#define NONAMELESSSTRUCT + +#include <windef.h> +#include <winbase.h> +#include <shlobj.h> +#include <undocshell.h> +#include <shlwapi.h> +#include <wine/debug.h> + +#include "pidl.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); -namespace -{ - extern CRITICAL_SECTION SHELL32_ChangenotifyCS; - CRITICAL_SECTION_DEBUG critsect_debug = - { - 0, 0, &SHELL32_ChangenotifyCS, - { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": SHELL32_ChangenotifyCS") } - }; - CRITICAL_SECTION SHELL32_ChangenotifyCS = { &critsect_debug, -1, 0, 0, 0, 0 }; -} +static CRITICAL_SECTION SHELL32_ChangenotifyCS; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &SHELL32_ChangenotifyCS, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": SHELL32_ChangenotifyCS") } +}; +static CRITICAL_SECTION SHELL32_ChangenotifyCS = { &critsect_debug, -1, 0, 0, 0, 0 }; typedef SHChangeNotifyEntry *LPNOTIFYREGISTER; @@ -265,9 +274,10 @@ if( sub && ILIsParent( watched, changed, TRUE ) ) return TRUE; if (sub && _ILIsDesktop(watched)) { + LPITEMIDLIST deskpidl; WCHAR wszPath[MAX_PATH]; SHGetSpecialFolderPathW(0, wszPath, CSIDL_DESKTOPDIRECTORY, FALSE); - LPITEMIDLIST deskpidl = SHSimpleIDListFromPathW(wszPath); + deskpidl = SHSimpleIDListFromPathW(wszPath); if (ILIsParent(deskpidl, changed, TRUE)) { ILFree(deskpidl); @@ -342,26 +352,28 @@ * entry, and create a new one using a find data struct. */ if (dwItem1 && Pidls[0]){ + WIN32_FIND_DATAW wfd; + LPITEMIDLIST oldpidl, newpidl; + LPWSTR p = PathFindFileNameW((LPCWSTR)dwItem1); ILRemoveLastID(Pidls[0]); - WIN32_FIND_DATAW wfd; - LPWSTR p = PathFindFileNameW((LPCWSTR)dwItem1); lstrcpynW(&wfd.cFileName[0], p, MAX_PATH); wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; - LPITEMIDLIST newpidl = _ILCreateFromFindDataW(&wfd); - LPITEMIDLIST oldpidl = ILClone(Pidls[0]); + newpidl = _ILCreateFromFindDataW(&wfd); + oldpidl = ILClone(Pidls[0]); ILFree(Pidls[0]); Pidls[0] = ILCombine(oldpidl, newpidl); ILFree(newpidl); ILFree(oldpidl); } if (dwItem2 && Pidls[1]){ + WIN32_FIND_DATAW wfd; + LPITEMIDLIST oldpidl, newpidl; + LPWSTR p = PathFindFileNameW((LPCWSTR)dwItem2); ILRemoveLastID(Pidls[1]); - WIN32_FIND_DATAW wfd; - LPWSTR p = PathFindFileNameW((LPCWSTR)dwItem2); lstrcpynW(&wfd.cFileName[0], p, MAX_PATH); wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; - LPITEMIDLIST newpidl = _ILCreateFromFindDataW(&wfd); - LPITEMIDLIST oldpidl = ILClone(Pidls[0]); + newpidl = _ILCreateFromFindDataW(&wfd); + oldpidl = ILClone(Pidls[0]); ILFree(Pidls[1]); Pidls[1] = ILCombine(oldpidl, newpidl); ILFree(newpidl);
10 years
1
0
0
0
← Newer
1
...
22
23
24
25
26
27
28
...
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