diff --git a/reactos/lib/shell32/autocomplete.c b/reactos/lib/shell32/autocomplete.c index 93e2b1f0718..f4f9b42548e 100644 --- a/reactos/lib/shell32/autocomplete.c +++ b/reactos/lib/shell32/autocomplete.c @@ -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; } /****************************************************************************** diff --git a/reactos/lib/shell32/cpanelfolder.c b/reactos/lib/shell32/cpanelfolder.c index f20940390cb..6a918017ef2 100644 --- a/reactos/lib/shell32/cpanelfolder.c +++ b/reactos/lib/shell32/cpanelfolder.c @@ -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; } /************************************************************************** diff --git a/reactos/lib/shell32/dataobject.c b/reactos/lib/shell32/dataobject.c index 96adeb04a40..b311e30424f 100644 --- a/reactos/lib/shell32/dataobject.c +++ b/reactos/lib/shell32/dataobject.c @@ -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; } /************************************************************************** diff --git a/reactos/lib/shell32/dragdrophelper.c b/reactos/lib/shell32/dragdrophelper.c index f8005708433..53a879f186b 100644 --- a/reactos/lib/shell32/dragdrophelper.c +++ b/reactos/lib/shell32/dragdrophelper.c @@ -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 ( diff --git a/reactos/lib/shell32/enumidlist.c b/reactos/lib/shell32/enumidlist.c index 31abedbcad7..1d78e29cbe3 100644 --- a/reactos/lib/shell32/enumidlist.c +++ b/reactos/lib/shell32/enumidlist.c @@ -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; } /************************************************************************** diff --git a/reactos/lib/shell32/folders.c b/reactos/lib/shell32/folders.c index 7aa2e7485d5..12b6fe4d52a 100644 --- a/reactos/lib/shell32/folders.c +++ b/reactos/lib/shell32/folders.c @@ -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, diff --git a/reactos/lib/shell32/memorystream.c b/reactos/lib/shell32/memorystream.c index ff7ea0b00c8..e6460a6d6c1 100644 --- a/reactos/lib/shell32/memorystream.c +++ b/reactos/lib/shell32/memorystream.c @@ -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) diff --git a/reactos/lib/shell32/pidl.c b/reactos/lib/shell32/pidl.c index f77343c7453..d0f4206c5b7 100644 --- a/reactos/lib/shell32/pidl.c +++ b/reactos/lib/shell32/pidl.c @@ -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 diff --git a/reactos/lib/shell32/shell32_De.rc b/reactos/lib/shell32/shell32_De.rc index 0084189fc08..15288eb3c19 100644 --- a/reactos/lib/shell32/shell32_De.rc +++ b/reactos/lib/shell32/shell32_De.rc @@ -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" +} diff --git a/reactos/lib/shell32/shelllink.c b/reactos/lib/shell32/shelllink.c index e0272646ecb..b7b379f81c5 100644 --- a/reactos/lib/shell32/shelllink.c +++ b/reactos/lib/shell32/shelllink.c @@ -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); diff --git a/reactos/lib/shell32/shellole.c b/reactos/lib/shell32/shellole.c index 0167b16dc2f..ea74a9fa088 100644 --- a/reactos/lib/shell32/shellole.c +++ b/reactos/lib/shell32/shellole.c @@ -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 diff --git a/reactos/lib/shell32/shellord.c b/reactos/lib/shell32/shellord.c index ad6261e510f..403afe2e855 100644 --- a/reactos/lib/shell32/shellord.c +++ b/reactos/lib/shell32/shellord.c @@ -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; } diff --git a/reactos/lib/shell32/shellpath.c b/reactos/lib/shell32/shellpath.c index f77a9bf10fe..718bfc216e6 100644 --- a/reactos/lib/shell32/shellpath.c +++ b/reactos/lib/shell32/shellpath.c @@ -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; } diff --git a/reactos/lib/shell32/shfldr_desktop.c b/reactos/lib/shell32/shfldr_desktop.c index 66b4e8c5d16..e14dd087735 100644 --- a/reactos/lib/shell32/shfldr_desktop.c +++ b/reactos/lib/shell32/shfldr_desktop.c @@ -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; } /************************************************************************** diff --git a/reactos/lib/shell32/shfldr_fs.c b/reactos/lib/shell32/shfldr_fs.c index 858628540a4..e8fdca78b38 100644 --- a/reactos/lib/shell32/shfldr_fs.c +++ b/reactos/lib/shell32/shfldr_fs.c @@ -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 = diff --git a/reactos/lib/shell32/shfldr_mycomp.c b/reactos/lib/shell32/shfldr_mycomp.c index 5de8574efcd..cacfcfbd68c 100644 --- a/reactos/lib/shell32/shfldr_mycomp.c +++ b/reactos/lib/shell32/shfldr_mycomp.c @@ -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; } /************************************************************************** diff --git a/reactos/lib/shell32/shlfileop.c b/reactos/lib/shell32/shlfileop.c index f229819b73b..811a5a9b854 100644 --- a/reactos/lib/shell32/shlfileop.c +++ b/reactos/lib/shell32/shlfileop.c @@ -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 */ diff --git a/reactos/lib/shell32/shlfsbind.c b/reactos/lib/shell32/shlfsbind.c index 14e1f3a811d..b558aeab3e1 100644 --- a/reactos/lib/shell32/shlfsbind.c +++ b/reactos/lib/shell32/shlfsbind.c @@ -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) diff --git a/reactos/lib/shell32/shlview.c b/reactos/lib/shell32/shlview.c index aa01c94a881..6dc5e5f92ca 100644 --- a/reactos/lib/shell32/shlview.c +++ b/reactos/lib/shell32/shlview.c @@ -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; } diff --git a/reactos/lib/shell32/shv_bg_cmenu.c b/reactos/lib/shell32/shv_bg_cmenu.c index 9dd5dc6cb90..b879d180fa2 100644 --- a/reactos/lib/shell32/shv_bg_cmenu.c +++ b/reactos/lib/shell32/shv_bg_cmenu.c @@ -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; } /************************************************************************** diff --git a/reactos/lib/shell32/shv_item_cmenu.c b/reactos/lib/shell32/shv_item_cmenu.c index 96584068191..9aedddd735b 100644 --- a/reactos/lib/shell32/shv_item_cmenu.c +++ b/reactos/lib/shell32/shv_item_cmenu.c @@ -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; } /**************************************************************************