From 01c51c2aab685c3ebfa88e844d87965f6995ae36 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Wed, 7 Jan 2004 21:48:29 +0000 Subject: [PATCH] preciser error codes for some shell functions svn path=/trunk/; revision=7506 --- reactos/lib/shell32/shfldr_fs.c | 2 +- reactos/lib/shell32/shfldr_mycomp.c | 2 +- reactos/lib/shell32/shlfolder.c | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/reactos/lib/shell32/shfldr_fs.c b/reactos/lib/shell32/shfldr_fs.c index ec48409e31a..2499383400c 100644 --- a/reactos/lib/shell32/shfldr_fs.c +++ b/reactos/lib/shell32/shfldr_fs.c @@ -325,7 +325,7 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, { _ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface) - HRESULT hr = E_OUTOFMEMORY; + HRESULT hr = E_INVALIDARG; LPCWSTR szNext = NULL; WCHAR szElement[MAX_PATH]; CHAR szPath[MAX_PATH]; diff --git a/reactos/lib/shell32/shfldr_mycomp.c b/reactos/lib/shell32/shfldr_mycomp.c index c3fb8726a4e..c37402a7f21 100644 --- a/reactos/lib/shell32/shfldr_mycomp.c +++ b/reactos/lib/shell32/shfldr_mycomp.c @@ -191,7 +191,7 @@ ISF_MyComputer_fnParseDisplayName (IShellFolder2 * iface, { ICOM_THIS (IGenericSFImpl, iface); - HRESULT hr = E_OUTOFMEMORY; + HRESULT hr = E_INVALIDARG; LPCWSTR szNext = NULL; WCHAR szElement[MAX_PATH]; CHAR szTempA[MAX_PATH]; diff --git a/reactos/lib/shell32/shlfolder.c b/reactos/lib/shell32/shlfolder.c index 15f392df471..1fff0fa97cd 100644 --- a/reactos/lib/shell32/shlfolder.c +++ b/reactos/lib/shell32/shlfolder.c @@ -108,7 +108,7 @@ LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut) HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut, LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes) { - HRESULT hr = E_OUTOFMEMORY; + HRESULT hr = E_INVALIDARG; LPITEMIDLIST pidlOut = NULL, pidlTemp = NULL; IShellFolder *psfChild; @@ -124,6 +124,9 @@ HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, pidlTemp = ILCombine (*pidlInOut, pidlOut); + if (!pidlTemp) + hr = E_OUTOFMEMORY; + if (pidlOut) ILFree (pidlOut); } @@ -159,6 +162,9 @@ HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, IPersistFolder_Initialize (pPF, pidlAbsolute); IPersistFolder_Release (pPF); SHFree (pidlAbsolute); + + if (!pidlAbsolute) + hr = E_OUTOFMEMORY; } } @@ -293,7 +299,7 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTR szOut, DWORD dwOutLen) { LPITEMIDLIST pidlFirst; - HRESULT hr = E_OUTOFMEMORY; + HRESULT hr = E_INVALIDARG; TRACE ("(%p)->(pidl=%p 0x%08lx %p 0x%08lx)\n", psf, pidl, dwFlags, szOut, dwOutLen); pdump (pidl); @@ -314,7 +320,8 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, IShellFolder_Release (psfChild); } ILFree (pidlFirst); - } + } else + hr = E_OUTOFMEMORY; TRACE ("-- ret=0x%08lx %s\n", hr, szOut);