From 5ff90962ebe966869fb421fee25dd02b9e52e6ad Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sat, 20 Dec 2003 18:52:50 +0000 Subject: [PATCH] fixed ShellFolderContextMenu() parameter svn path=/trunk/; revision=7141 --- reactos/subsys/system/explorer/desktop/desktop.cpp | 12 ++++++++++-- reactos/subsys/system/explorer/shell/mainframe.cpp | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/reactos/subsys/system/explorer/desktop/desktop.cpp b/reactos/subsys/system/explorer/desktop/desktop.cpp index c9fd8e92d89..23bda6fe28e 100644 --- a/reactos/subsys/system/explorer/desktop/desktop.cpp +++ b/reactos/subsys/system/explorer/desktop/desktop.cpp @@ -327,13 +327,21 @@ bool DesktopShellView::DoContextMenu(int x, int y) } LPIDA pida = pidList; + if (!pida->cidl) { + selection->Release(); + return false; + } LPCITEMIDLIST parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]); - LPCITEMIDLIST first_pidl = (LPCITEMIDLIST)((LPBYTE)pida+pida->aoffset[1]); + + LPCITEMIDLIST* apidl = (LPCITEMIDLIST*) alloca(pida->cidl*sizeof(LPCITEMIDLIST)); + + for(int i=pida->cidl; i>0; --i) + apidl[i-1] = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i]); ShellFolder folder(parent_pidl); - hr = ShellFolderContextMenu(folder, _hwnd, pida->cidl, &first_pidl, x, y); + hr = ShellFolderContextMenu(folder, _hwnd, pida->cidl, apidl, x, y); selection->Release(); diff --git a/reactos/subsys/system/explorer/shell/mainframe.cpp b/reactos/subsys/system/explorer/shell/mainframe.cpp index 942a01f48aa..ee8bed88865 100644 --- a/reactos/subsys/system/explorer/shell/mainframe.cpp +++ b/reactos/subsys/system/explorer/shell/mainframe.cpp @@ -219,7 +219,7 @@ int MainFrame::OpenShellFolders(LPIDA pida, HWND hFrameWnd) ShellFolder folder(parent_pidl); for(int i=pida->cidl; i>0; --i) { - LPCITEMIDLIST pidl = (LPCITEMIDLIST)((LPBYTE)pida+pida->aoffset[i]); + LPCITEMIDLIST pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i]); SFGAOF attribs = SFGAO_FOLDER; HRESULT hr = folder->GetAttributesOf(1, &pidl, &attribs);