Sync to Wine-20050211

James Hawkins <truiken@gmail.com>
- Use Interlocked* instead of ++/-- in AddRef/Release.
- Use only stored result of Interlocked* in AddRef/Release.
- Expand TRACEs to display the ref count.
Francois Gouget <fgouget@free.fr>
- Assorted spelling fixes.
Mike McCormack <mike@codeweavers.com>
- Implement GetAdvise and SetAdvise.
Henning Gerhardt <henning.gerhardt@web.de>
- A small spelling fix and a small update (thank to Andreas Mohr).
- Update German resources.
Joris Huizer <jorishuizer@planet.nl>
- add file_operation_delete
- add file_operation_checkFlags
- use these in SHFileOperationW replacing inline code

svn path=/trunk/; revision=13544
This commit is contained in:
Gé van Geldorp 2005-02-13 22:42:47 +00:00
parent 52cb066916
commit f890195506
21 changed files with 297 additions and 178 deletions

View file

@ -170,9 +170,11 @@ static ULONG WINAPI IAutoComplete_fnAddRef(
IAutoComplete * iface)
{
IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%lu)\n",This,This->ref);
return ++(This->ref);
TRACE("(%p)->(%lu)\n", This, refCount - 1);
return refCount;
}
/******************************************************************************
@ -182,10 +184,11 @@ static ULONG WINAPI IAutoComplete_fnRelease(
IAutoComplete * iface)
{
IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%lu)\n",This,This->ref);
TRACE("(%p)->(%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE(" destroying IAutoComplete(%p)\n",This);
HeapFree(GetProcessHeap(), 0, This->quickComplete);
HeapFree(GetProcessHeap(), 0, This->txtbackup);
@ -194,9 +197,8 @@ static ULONG WINAPI IAutoComplete_fnRelease(
if (This->enumstr)
IEnumString_Release(This->enumstr);
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return This->ref;
return refCount;
}
/******************************************************************************

View file

@ -181,26 +181,27 @@ static HRESULT WINAPI ISF_ControlPanel_fnQueryInterface(IShellFolder2 * iface, R
static ULONG WINAPI ISF_ControlPanel_fnAddRef(IShellFolder2 * iface)
{
ICPanelImpl *This = (ICPanelImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
static ULONG WINAPI ISF_ControlPanel_fnRelease(IShellFolder2 * iface)
{
ICPanelImpl *This = (ICPanelImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE("-- destroying IShellFolder(%p)\n", This);
if (This->pidlRoot)
SHFree(This->pidlRoot);
LocalFree((HLOCAL) This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View file

@ -124,16 +124,21 @@ static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(LPENUMFORMATETC iface, REF
static ULONG WINAPI IEnumFORMATETC_fnAddRef(LPENUMFORMATETC iface)
{
IEnumFORMATETCImpl *This = (IEnumFORMATETCImpl *)iface;
TRACE("(%p)->(count=%lu)\n",This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface)
{
IEnumFORMATETCImpl *This = (IEnumFORMATETCImpl *)iface;
TRACE("(%p)->()\n",This);
ULONG refCount = InterlockedDecrement(&This->ref);
if (!--(This->ref))
TRACE("(%p)->(%lu)\n", This, refCount + 1);
if (!refCount)
{
TRACE(" destroying IEnumFORMATETC(%p)\n",This);
if (This->pFmt)
@ -143,7 +148,7 @@ static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface)
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
static HRESULT WINAPI IEnumFORMATETC_fnNext(LPENUMFORMATETC iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFethed)
@ -291,8 +296,11 @@ static HRESULT WINAPI IDataObject_fnQueryInterface(LPDATAOBJECT iface, REFIID ri
static ULONG WINAPI IDataObject_fnAddRef(LPDATAOBJECT iface)
{
IDataObjectImpl *This = (IDataObjectImpl *)iface;
TRACE("(%p)->(count=%lu)\n",This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return refCount;
}
/**************************************************************************
@ -301,17 +309,18 @@ static ULONG WINAPI IDataObject_fnAddRef(LPDATAOBJECT iface)
static ULONG WINAPI IDataObject_fnRelease(LPDATAOBJECT iface)
{
IDataObjectImpl *This = (IDataObjectImpl *)iface;
TRACE("(%p)->()\n",This);
ULONG refCount = InterlockedDecrement(&This->ref);
if (!--(This->ref))
TRACE("(%p)->(%lu)\n", This, refCount + 1);
if (!refCount)
{
TRACE(" destroying IDataObject(%p)\n",This);
_ILFreeaPidl(This->apidl, This->cidl);
ILFree(This->pidl),
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View file

@ -113,24 +113,26 @@ static HRESULT WINAPI IDropTargetHelper_fnQueryInterface (IDropTargetHelper * if
static ULONG WINAPI IDropTargetHelper_fnAddRef (IDropTargetHelper * iface)
{
IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
static ULONG WINAPI IDropTargetHelper_fnRelease (IDropTargetHelper * iface)
{
IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE("-- destroying (%p)\n", This);
LocalFree ((HLOCAL) This);
return 0;
}
return This->ref;
return refCount;
}
static HRESULT WINAPI IDropTargetHelper_fnDragEnter (

View file

@ -240,8 +240,11 @@ static ULONG WINAPI IEnumIDList_fnAddRef(
IEnumIDList * iface)
{
IEnumIDListImpl *This = (IEnumIDListImpl *)iface;
TRACE("(%p)->(%lu)\n",This,This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%lu)\n", This, refCount - 1);
return refCount;
}
/******************************************************************************
* IEnumIDList_fnRelease
@ -250,16 +253,16 @@ static ULONG WINAPI IEnumIDList_fnRelease(
IEnumIDList * iface)
{
IEnumIDListImpl *This = (IEnumIDListImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%lu)\n",This,This->ref);
TRACE("(%p)->(%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE(" destroying IEnumIDList(%p)\n",This);
DeleteList((IEnumIDList*)This);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View file

@ -130,10 +130,11 @@ static HRESULT WINAPI IExtractIconW_fnQueryInterface(IExtractIconW *iface, REFII
static ULONG WINAPI IExtractIconW_fnAddRef(IExtractIconW * iface)
{
IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This, This->ref );
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/**************************************************************************
* IExtractIconW_Release
@ -141,17 +142,18 @@ static ULONG WINAPI IExtractIconW_fnAddRef(IExtractIconW * iface)
static ULONG WINAPI IExtractIconW_fnRelease(IExtractIconW * iface)
{
IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n",This);
TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref))
if (!refCount)
{
TRACE(" destroying IExtractIcon(%p)\n",This);
SHFree(This->pidl);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
static HRESULT getIconLocationForFolder(IExtractIconW *iface, UINT uFlags,

View file

@ -127,10 +127,11 @@ static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVO
static ULONG WINAPI IStream_fnAddRef(IStream *iface)
{
ISHFileStream *This = (ISHFileStream *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This, This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/**************************************************************************
@ -139,16 +140,17 @@ static ULONG WINAPI IStream_fnAddRef(IStream *iface)
static ULONG WINAPI IStream_fnRelease(IStream *iface)
{
ISHFileStream *This = (ISHFileStream *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n",This);
TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref))
if (!refCount)
{
TRACE(" destroying SHFileStream (%p)\n",This);
CloseHandle(This->handle);
HeapFree(GetProcessHeap(),0,This);
}
return This->ref;
return refCount;
}
static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG* pcbRead)

View file

@ -977,7 +977,7 @@ LPITEMIDLIST WINAPI ILCreateFromPathAW (LPCVOID path)
* IShellFolder uses that FileSystem Bind Data object of the BindContext
* to pass data about the current path element to the next object. This
* is used to avoid having to verify the current path element on disk, so
* that creating an ItemIDList from a non-existent path still can work.
* that creating an ItemIDList from a nonexistent path still can work.
*/
static HRESULT WINAPI _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile,
BOOL bBindCtx, LPITEMIDLIST *ppidl, LPDWORD prgfInOut)
@ -1024,7 +1024,7 @@ static HRESULT WINAPI _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile,
* SHSimpleIDListFromPath [SHELL32.162]
*
* Creates a simple ItemIDList from a path and returns it. This function
* does not fail on non-existent paths.
* does not fail on nonexistent paths.
*
* PARAMS
* path [I] path to parse and convert into an ItemIDList

View file

@ -188,3 +188,35 @@ STRINGTABLE DISCARDABLE
IDS_SHUTDOWN_TITLE "Anhalten"
IDS_SHUTDOWN_PROMPT "Möchten Sie die aktuelle ReactOS Sitzung beenden ?"
}
/* shell folder path default values */
STRINGTABLE DISCARDABLE
{
IDS_PROGRAMS "Startmenü\\Programme"
IDS_PERSONAL "Eigene Dateien"
IDS_FAVORITES "Favoriten"
IDS_STARTUP "Startmenü\\Programme\\Autostart"
IDS_RECENT "Recent"
IDS_SENDTO "SendTo"
IDS_STARTMENU "Startmenü"
IDS_MYMUSIC "Eigene Dateien\\Meine Musik"
IDS_MYVIDEO "Eigene Dateien\\Meine Videos"
IDS_DESKTOPDIRECTORY "Desktop"
IDS_NETHOOD "Netzwerkumgebung"
IDS_TEMPLATES "Vorlagen"
IDS_APPDATA "Anwendungsdaten"
IDS_PRINTHOOD "Druckumgebung"
IDS_LOCAL_APPDATA "Lokale Einstellungen\\Anwendungsdaten"
IDS_INTERNET_CACHE "Temporary Internet Files"
IDS_COOKIES "Cookies"
IDS_HISTORY "Verlauf"
IDS_PROGRAM_FILES "Programme"
IDS_MYPICTURES "Eigene Dateien\\Eigene Bilder"
IDS_PROGRAM_FILES_COMMON "Programme\\Gemeinsame Dateien"
IDS_COMMON_DOCUMENTS "Dokumente"
IDS_ADMINTOOLS "Startmenü\\Programme\\Verwaltung"
IDS_COMMON_MUSIC "Dokumente\\Eigene Musik"
IDS_COMMON_PICTURES "Dokumente\\Eigene Bilder"
IDS_COMMON_VIDEO "Dokumente\\Eigene Videos"
IDS_CDBURN_AREA "Lokale Einstellungen\\Anwendungsdaten\\Microsoft\\CD Burning"
}

View file

@ -974,10 +974,11 @@ static HRESULT WINAPI IShellLinkA_fnQueryInterface( IShellLinkA * iface, REFIID
static ULONG WINAPI IShellLinkA_fnAddRef(IShellLinkA * iface)
{
IShellLinkImpl *This = (IShellLinkImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This,This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/******************************************************************************
* IShellLinkA_Release
@ -985,11 +986,12 @@ static ULONG WINAPI IShellLinkA_fnAddRef(IShellLinkA * iface)
static ULONG WINAPI IShellLinkA_fnRelease(IShellLinkA * iface)
{
IShellLinkImpl *This = (IShellLinkImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This,This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
if (--(This->ref))
return This->ref;
if (refCount)
return refCount;
TRACE("-- destroying IShellLink(%p)\n",This);

View file

@ -556,9 +556,11 @@ static HRESULT WINAPI IDefClF_fnQueryInterface(
static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
{
IDefClFImpl *This = (IDefClFImpl *)iface;
TRACE("(%p)->(count=%lu)\n",This,This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
return InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return refCount;
}
/******************************************************************************
* IDefClF_fnRelease
@ -566,9 +568,11 @@ static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
{
IDefClFImpl *This = (IDefClFImpl *)iface;
TRACE("(%p)->(count=%lu)\n",This,This->ref);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
if (!InterlockedDecrement(&This->ref))
if (!refCount)
{
if (This->pcRefDll) InterlockedDecrement(This->pcRefDll);
@ -576,7 +580,7 @@ static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/******************************************************************************
* IDefClF_fnCreateInstance

View file

@ -673,7 +673,7 @@ void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
if (ret == ERROR_SUCCESS) {
if (!( (type == REG_DWORD) ||
((type == REG_BINARY) && (datalen == 4)) )) {
ERR("Error policy data for \"NoRecentDocsHistory\" not formated correctly, type=%ld, len=%ld\n",
ERR("Error policy data for \"NoRecentDocsHistory\" not formatted correctly, type=%ld, len=%ld\n",
type, datalen);
return;
}

View file

@ -1995,7 +1995,7 @@ HRESULT WINAPI SHGetFolderLocation(
else if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
{
/* unlike SHGetFolderPath, SHGetFolderLocation in shell32
* version 6.0 returns E_FAIL for non-existing paths
* version 6.0 returns E_FAIL for nonexistent paths
*/
hr = E_FAIL;
}

View file

@ -157,19 +157,21 @@ static HRESULT WINAPI ISF_Desktop_fnQueryInterface (IShellFolder2 * iface, REFII
static ULONG WINAPI ISF_Desktop_fnAddRef (IShellFolder2 * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE ("-- destroying IShellFolder(%p)\n", This);
if (This->pidlRoot)
SHFree (This->pidlRoot);
@ -178,7 +180,7 @@ static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
LocalFree ((HLOCAL) This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View file

@ -173,19 +173,21 @@ static HRESULT WINAPI IUnknown_fnQueryInterface (IUnknown * iface, REFIID riid,
static ULONG WINAPI IUnknown_fnAddRef (IUnknown * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
static ULONG WINAPI IUnknown_fnRelease (IUnknown * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE ("-- destroying IShellFolder(%p)\n", This);
if (This->pidlRoot)
@ -193,9 +195,8 @@ static ULONG WINAPI IUnknown_fnRelease (IUnknown * iface)
if (This->sPathTarget)
SHFree (This->sPathTarget);
LocalFree ((HLOCAL) This);
return 0;
}
return This->ref;
return refCount;
}
static IUnknownVtbl unkvt =

View file

@ -160,26 +160,27 @@ static HRESULT WINAPI ISF_MyComputer_fnQueryInterface (IShellFolder2 * iface, RE
static ULONG WINAPI ISF_MyComputer_fnAddRef (IShellFolder2 * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
static ULONG WINAPI ISF_MyComputer_fnRelease (IShellFolder2 * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE ("-- destroying IShellFolder(%p)\n", This);
if (This->pidlRoot)
SHFree (This->pidlRoot);
LocalFree ((HLOCAL) This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View file

@ -861,6 +861,90 @@ static const char * debug_shfileops_action( DWORD op )
#define ERROR_SHELL_INTERNAL_FILE_NOT_FOUND 1026
#define HIGH_ADR (LPWSTR)0xffffffff
static int file_operation_delete( WIN32_FIND_DATAW *wfd,SHFILEOPSTRUCTW nFileOp, LPWSTR pFromFile,LPWSTR pTempFrom,HANDLE *hFind)
{
LPWSTR lpFileName;
BOOL b_Mask = (NULL != StrPBrkW(&pFromFile[1], wWildcardChars));
int retCode = 0;
do
{
lpFileName = wfd->cAlternateFileName;
if (!lpFileName[0])
lpFileName = wfd->cFileName;
if (IsDotDir(lpFileName) ||
((b_Mask) && IsAttribDir(wfd->dwFileAttributes) && (nFileOp.fFlags & FOF_FILESONLY)))
continue;
SHFileStrCpyCatW(&pFromFile[1], lpFileName, NULL);
/* TODO: Check the SHELL_DeleteFileOrDirectoryW() function in shell32.dll */
if (IsAttribFile(wfd->dwFileAttributes))
{
if(SHNotifyDeleteFileW(pTempFrom) != ERROR_SUCCESS)
{
nFileOp.fAnyOperationsAborted = TRUE;
retCode = 0x78; /* value unknown */
}
}
else if(!SHELL_DeleteDirectoryW(pTempFrom, (!(nFileOp.fFlags & FOF_NOCONFIRMATION))))
{
nFileOp.fAnyOperationsAborted = TRUE;
retCode = 0x79; /* value unknown */
}
}
while (!nFileOp.fAnyOperationsAborted && FindNextFileW(*hFind,wfd));
FindClose(*hFind);
*hFind = INVALID_HANDLE_VALUE;
return retCode;
}
/*
* Summary of flags:
*
* implemented flags:
* FOF_MULTIDESTFILES, FOF_NOCONFIRMATION, FOF_FILESONLY
*
* unimplememented and ignored flags:
* FOF_CONFIRMMOUSE, FOF_SILENT, FOF_NOCONFIRMMKDIR,
* FOF_SIMPLEPROGRESS, FOF_NOCOPYSECURITYATTRIBS
*
* partially implemented, breaks if file exists:
* FOF_RENAMEONCOLLISION
*
* unimplemented and break if any other flag set:
* FOF_ALLOWUNDO, FOF_WANTMAPPINGHANDLE
*/
static int file_operation_checkFlags(SHFILEOPSTRUCTW nFileOp)
{
FILEOP_FLAGS OFl = ((FILEOP_FLAGS)nFileOp.fFlags & 0xfff);
long FuncSwitch = (nFileOp.wFunc & FO_MASK);
long level= nFileOp.wFunc >> 4;
TRACE("%s level=%ld nFileOp.fFlags=0x%x\n",
debug_shfileops_action(FuncSwitch), level, nFileOp.fFlags);
/* OFl &= (-1 - (FOF_MULTIDESTFILES | FOF_FILESONLY)); */
/* OFl ^= (FOF_SILENT | FOF_NOCONFIRMATION | FOF_SIMPLEPROGRESS | FOF_NOCONFIRMMKDIR); */
OFl &= (~(FOF_MULTIDESTFILES | FOF_NOCONFIRMATION | FOF_FILESONLY)); /* implemented */
OFl ^= (FOF_SILENT | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_NOCOPYSECURITYATTRIBS); /* ignored, if one */
OFl &= (~FOF_SIMPLEPROGRESS); /* ignored, only with FOF_SILENT */
if (OFl)
{
if (OFl & (~(FOF_CONFIRMMOUSE | FOF_SILENT | FOF_RENAMEONCOLLISION |
FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_NOCOPYSECURITYATTRIBS)))
{
TRACE("%s level=%ld lpFileOp->fFlags=0x%x not implemented, Aborted=TRUE, stub\n",
debug_shfileops_action(FuncSwitch), level, OFl);
return 0x403; /* 1027, we need an extension to shlfileop */
}
else
{
TRACE("%s level=%ld lpFileOp->fFlags=0x%x not fully implemented, stub\n",
debug_shfileops_action(FuncSwitch), level, OFl);
}
}
return 0;
}
/*************************************************************************
* SHFileOperationW [SHELL32.@]
*
@ -884,8 +968,6 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
int retCode = 0;
DWORD ToAttr;
DWORD ToPathAttr;
DWORD FromPathAttr;
FILEOP_FLAGS OFl = ((FILEOP_FLAGS)lpFileOp->fFlags & 0xfff);
BOOL b_Multi = (nFileOp.fFlags & FOF_MULTIDESTFILES);
@ -904,6 +986,8 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
long FuncSwitch = (nFileOp.wFunc & FO_MASK);
long level= nFileOp.wFunc>>4;
int ret;
/* default no error */
nFileOp.fAnyOperationsAborted = FALSE;
@ -932,47 +1016,12 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
* create dir 0 0 0 0 0 0 1 0
*/
/*
* Summary of flags:
*
* implemented flags:
* FOF_MULTIDESTFILES, FOF_NOCONFIRMATION, FOF_FILESONLY
*
* unimplememented and ignored flags:
* FOF_CONFIRMMOUSE, FOF_SILENT, FOF_NOCONFIRMMKDIR,
* FOF_SIMPLEPROGRESS, FOF_NOCOPYSECURITYATTRIBS
*
* partially implemented, breaks if file exists:
* FOF_RENAMEONCOLLISION
*
* unimplemented and break if any other flag set:
* FOF_ALLOWUNDO, FOF_WANTMAPPINGHANDLE
*/
TRACE("%s level=%ld nFileOp.fFlags=0x%x\n",
debug_shfileops_action(FuncSwitch), level, lpFileOp->fFlags);
/* OFl &= (-1 - (FOF_MULTIDESTFILES | FOF_FILESONLY)); */
/* OFl ^= (FOF_SILENT | FOF_NOCONFIRMATION | FOF_SIMPLEPROGRESS | FOF_NOCONFIRMMKDIR); */
OFl &= (~(FOF_MULTIDESTFILES | FOF_NOCONFIRMATION | FOF_FILESONLY)); /* implemented */
OFl ^= (FOF_SILENT | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_NOCOPYSECURITYATTRIBS); /* ignored, if one */
OFl &= (~FOF_SIMPLEPROGRESS); /* ignored, only with FOF_SILENT */
if (OFl)
ret = file_operation_checkFlags(nFileOp);
if (ret != 0)
{
if (OFl & (~(FOF_CONFIRMMOUSE | FOF_SILENT | FOF_RENAMEONCOLLISION |
FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_NOCOPYSECURITYATTRIBS)))
{
TRACE("%s level=%ld lpFileOp->fFlags=0x%x not implemented, Aborted=TRUE, stub\n",
debug_shfileops_action(FuncSwitch), level, OFl);
retCode = 0x403; /* 1027, we need an extension to shlfileop */
goto shfileop_end;
}
else
{
TRACE("%s level=%ld lpFileOp->fFlags=0x%x not fully implemented, stub\n",
debug_shfileops_action(FuncSwitch), level, OFl);
}
}
retCode = ret;
goto shfileop_end;
}
if ((pNextFrom) && (!(b_MultiTo) || (pNextTo)))
{
@ -1055,12 +1104,13 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
goto shfileop_end;
}
}
hFind = FindFirstFileW(pFrom, &wfd);
if (INVALID_HANDLE_VALUE == hFind)
{
if ((FO_DELETE == FuncSwitch) && (b_Mask))
{
DWORD FromPathAttr;
pFromFile[0] = '\0';
FromPathAttr = GetFileAttributesW(pTempFrom);
pFromFile[0] = '\\';
@ -1080,37 +1130,13 @@ int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
/* ??? b_Mask = (!SHFileStrICmpA(&pFromFile[1], &wfd.cFileName[0], HIGH_ADR, HIGH_ADR)); */
if (!pTo) /* FO_DELETE */
{
do
ret = file_operation_delete(&wfd,nFileOp,pFromFile,pTempFrom,&hFind);
/* if ret is not 0, nFileOp.fAnyOperationsAborted is TRUE */
if (ret != 0)
{
lpFileName = wfd.cAlternateFileName;
if (!lpFileName[0])
lpFileName = wfd.cFileName;
if (IsDotDir(lpFileName) ||
((b_Mask) && IsAttribDir(wfd.dwFileAttributes) && (nFileOp.fFlags & FOF_FILESONLY)))
continue;
SHFileStrCpyCatW(&pFromFile[1], lpFileName, NULL);
/* TODO: Check the SHELL_DeleteFileOrDirectoryW() function in shell32.dll */
if (IsAttribFile(wfd.dwFileAttributes))
{
if(SHNotifyDeleteFileW(pTempFrom) != ERROR_SUCCESS)
{
nFileOp.fAnyOperationsAborted = TRUE;
retCode = 0x78; /* value unknown */
}
}
else
{
if(!SHELL_DeleteDirectoryW(pTempFrom, (!(nFileOp.fFlags & FOF_NOCONFIRMATION))))
{
nFileOp.fAnyOperationsAborted = TRUE;
retCode = 0x79; /* value unknown */
}
}
} while (!nFileOp.fAnyOperationsAborted && FindNextFileW(hFind, &wfd));
FindClose(hFind);
hFind = INVALID_HANDLE_VALUE;
if (nFileOp.fAnyOperationsAborted)
goto shfileop_end;
retCode = ret;
goto shfileop_end;
}
continue;
} /* FO_DELETE ends, pTo must be always valid from here */

View file

@ -179,22 +179,26 @@ static HRESULT WINAPI IFileSystemBindData_fnQueryInterface(IFileSystemBindData *
static ULONG WINAPI IFileSystemBindData_fnAddRef(IFileSystemBindData *iface)
{
IFileSystemBindDataImpl *This = (IFileSystemBindDataImpl *)iface;
TRACE("(%p)\n", This);
return InterlockedIncrement(&This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%li)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI IFileSystemBindData_fnRelease(IFileSystemBindData *iface)
{
IFileSystemBindDataImpl *This = (IFileSystemBindDataImpl *)iface;
TRACE("(%p)\n", This);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%li)\n", This, refCount + 1);
if (!InterlockedDecrement(&This->ref))
if (!refCount)
{
TRACE(" destroying ISFBindPidl(%p)\n",This);
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return This->ref;
return refCount;
}
static HRESULT WINAPI IFileSystemBindData_fnGetFindData(IFileSystemBindData *iface, WIN32_FIND_DATAW *pfd)

View file

@ -97,6 +97,9 @@ typedef struct
LISTVIEW_SORT_INFO ListViewSortInfo;
ULONG hNotify; /* change notification handle */
HANDLE hAccel;
DWORD dwAspects;
DWORD dwAdvf;
IAdviseSink *pAdvSink;
} IShellViewImpl;
static struct IShellViewVtbl svvt;
@ -1639,10 +1642,11 @@ static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid
static ULONG WINAPI IShellView_fnAddRef(IShellView * iface)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This,This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/**********************************************************
* IShellView_Release
@ -1650,10 +1654,11 @@ static ULONG WINAPI IShellView_fnAddRef(IShellView * iface)
static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n",This);
TRACE("(%p)->(count=%li)\n", This, refCount + 1);
if (!--(This->ref))
if (!refCount)
{
TRACE(" destroying IShellView(%p)\n",This);
@ -1665,13 +1670,15 @@ static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
if(This->pSF2Parent)
IShellFolder2_Release(This->pSF2Parent);
if (This->apidl)
if(This->apidl)
SHFree(This->apidl);
if(This->pAdvSink)
IAdviseSink_Release(This->pAdvSink);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/**********************************************************
@ -2374,10 +2381,17 @@ static HRESULT WINAPI ISVViewObject_SetAdvise(
_ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
FIXME("Stub: This=%p\n",This);
FIXME("partial stub: %p %08lx %08lx %p\n",
This, aspects, advf, pAdvSink);
return E_NOTIMPL;
/* FIXME: we set the AdviseSink, but never use it to send any advice */
This->pAdvSink = pAdvSink;
This->dwAspects = aspects;
This->dwAdvf = advf;
return S_OK;
}
static HRESULT WINAPI ISVViewObject_GetAdvise(
IViewObject *iface,
DWORD* pAspects,
@ -2387,9 +2401,20 @@ static HRESULT WINAPI ISVViewObject_GetAdvise(
_ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
FIXME("Stub: This=%p\n",This);
TRACE("This=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n",
This, pAspects, pAdvf, ppAdvSink);
return E_NOTIMPL;
if( ppAdvSink )
{
IAdviseSink_AddRef( This->pAdvSink );
*ppAdvSink = This->pAdvSink;
}
if( pAspects )
*pAspects = This->dwAspects;
if( pAdvf )
*pAdvf = This->dwAdvf;
return S_OK;
}

View file

@ -106,10 +106,11 @@ static HRESULT WINAPI ISVBgCm_fnQueryInterface(IContextMenu2 *iface, REFIID riid
static ULONG WINAPI ISVBgCm_fnAddRef(IContextMenu2 *iface)
{
BgCmImpl *This = (BgCmImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This, This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/**************************************************************************
@ -118,10 +119,11 @@ static ULONG WINAPI ISVBgCm_fnAddRef(IContextMenu2 *iface)
static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu2 *iface)
{
BgCmImpl *This = (BgCmImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n",This);
TRACE("(%p)->(count=%li)\n", This, refCount + 1);
if (!--(This->ref))
if (!refCount)
{
TRACE(" destroying IContextMenu(%p)\n",This);
@ -129,10 +131,8 @@ static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu2 *iface)
IShellFolder_Release(This->pSFParent);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View file

@ -142,10 +142,11 @@ static HRESULT WINAPI ISvItemCm_fnQueryInterface(IContextMenu2 *iface, REFIID ri
static ULONG WINAPI ISvItemCm_fnAddRef(IContextMenu2 *iface)
{
ItemCmImpl *This = (ItemCmImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This, This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/**************************************************************************
@ -154,10 +155,11 @@ static ULONG WINAPI ISvItemCm_fnAddRef(IContextMenu2 *iface)
static ULONG WINAPI ISvItemCm_fnRelease(IContextMenu2 *iface)
{
ItemCmImpl *This = (ItemCmImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n",This);
TRACE("(%p)->(count=%li)\n", This, refCount + 1);
if (!--(This->ref))
if (!refCount)
{
TRACE(" destroying IContextMenu(%p)\n",This);
@ -171,9 +173,8 @@ static ULONG WINAPI ISvItemCm_fnRelease(IContextMenu2 *iface)
_ILFreeaPidl(This->apidl, This->cidl);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************