Initial stubbed implementation of UnixFolder's IDropTarget interface.
[wine] / dlls / shell32 / shlview.c
index 3d3828b..a024933 100644 (file)
@@ -4,8 +4,22 @@
  *     Copyright 1998,1999     <juergen.schmied@debitel.net>
  *
  * This is the view visualizing the data provied by the shellfolder.
- * No direct access to data from pidls should be done from here. 
- * 
+ * No direct access to data from pidls should be done from here.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
  * FIXME: The order by part of the background context menu should be
  * buily according to the columns shown.
  *
  * FIXME: implement the drag and drop in the old (msg-based) way
  *
  * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a
- * Release() ??? 
+ * Release() ???
  */
 
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winerror.h"
+#include "winbase.h"
 #include "winnls.h"
+#include "objbase.h"
 #include "servprov.h"
 #include "shlguid.h"
+#include "wingdi.h"
+#include "winuser.h"
 #include "shlobj.h"
-#include "wine/undocshell.h"
+#include "undocshell.h"
 #include "shresdef.h"
-#include "debugtools.h"
+#include "wine/debug.h"
 
 #include "docobj.h"
 #include "pidl.h"
 #include "shell32_main.h"
 #include "shellfolder.h"
 
-DEFAULT_DEBUG_CHANNEL(shell);
+WINE_DEFAULT_DEBUG_CHANNEL(shell);
 
 typedef struct
 {   BOOL    bIsAscending;
@@ -48,13 +74,14 @@ typedef struct
     INT     nLastHeaderID;
 }LISTVIEW_SORT_INFO, *LPLISTVIEW_SORT_INFO;
 
-typedef struct 
-{      ICOM_VFIELD(IShellView);
-       DWORD           ref;
-       ICOM_VTABLE(IOleCommandTarget)* lpvtblOleCommandTarget;
-       ICOM_VTABLE(IDropTarget)*       lpvtblDropTarget;
-       ICOM_VTABLE(IDropSource)*       lpvtblDropSource;
-       ICOM_VTABLE(IViewObject)*       lpvtblViewObject;
+typedef struct
+{
+       const IShellViewVtbl*   lpVtbl;
+       LONG                    ref;
+       const IOleCommandTargetVtbl* lpvtblOleCommandTarget;
+       const IDropTargetVtbl*  lpvtblDropTarget;
+       const IDropSourceVtbl*  lpvtblDropSource;
+       const IViewObjectVtbl*  lpvtblViewObject;
        IShellFolder*   pSFParent;
        IShellFolder2*  pSF2Parent;
        IShellBrowser*  pShellBrowser;
@@ -68,27 +95,39 @@ typedef struct
        UINT            cidl;
        LPITEMIDLIST    *apidl;
         LISTVIEW_SORT_INFO ListViewSortInfo;
-       HANDLE          hNotify;        /* change notification handle */
+       ULONG                   hNotify;        /* change notification handle */
        HANDLE          hAccel;
+       DWORD           dwAspects;
+       DWORD           dwAdvf;
+       IAdviseSink    *pAdvSink;
 } IShellViewImpl;
 
-static struct ICOM_VTABLE(IShellView) svvt;
+static const IShellViewVtbl svvt;
+static const IOleCommandTargetVtbl ctvt;
+static const IDropTargetVtbl dtvt;
+static const IDropSourceVtbl dsvt;
+static const IViewObjectVtbl vovt;
 
-static struct ICOM_VTABLE(IOleCommandTarget) ctvt;
-#define _IOleCommandTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblOleCommandTarget))) 
-#define _ICOM_THIS_From_IOleCommandTarget(class, name) class* This = (class*)(((char*)name)-_IOleCommandTarget_Offset); 
 
-static struct ICOM_VTABLE(IDropTarget) dtvt;
-#define _IDropTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropTarget))) 
-#define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); 
+static inline IShellViewImpl *impl_from_IOleCommandTarget( IOleCommandTarget *iface )
+{
+    return (IShellViewImpl *)((char*)iface - FIELD_OFFSET(IShellViewImpl, lpvtblOleCommandTarget));
+}
 
-static struct ICOM_VTABLE(IDropSource) dsvt;
-#define _IDropSource_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropSource))) 
-#define _ICOM_THIS_From_IDropSource(class, name) class* This = (class*)(((char*)name)-_IDropSource_Offset); 
+static inline IShellViewImpl *impl_from_IDropTarget( IDropTarget *iface )
+{
+    return (IShellViewImpl *)((char*)iface - FIELD_OFFSET(IShellViewImpl, lpvtblDropTarget));
+}
 
-static struct ICOM_VTABLE(IViewObject) vovt;
-#define _IViewObject_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblViewObject))) 
-#define _ICOM_THIS_From_IViewObject(class, name) class* This = (class*)(((char*)name)-_IViewObject_Offset); 
+static inline IShellViewImpl *impl_from_IDropSource( IDropSource *iface )
+{
+    return (IShellViewImpl *)((char*)iface - FIELD_OFFSET(IShellViewImpl, lpvtblDropSource));
+}
+
+static inline IShellViewImpl *impl_from_IViewObject( IViewObject *iface )
+{
+    return (IShellViewImpl *)((char*)iface - FIELD_OFFSET(IShellViewImpl, lpvtblViewObject));
+}
 
 /* ListView Header ID's */
 #define LISTVIEW_COLUMN_NAME 0
@@ -111,9 +150,6 @@ static struct ICOM_VTABLE(IViewObject) vovt;
 #define GET_WM_COMMAND_HWND(wp, lp)             (HWND)(lp)
 #define GET_WM_COMMAND_CMD(wp, lp)              HIWORD(wp)
 
-extern void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition, 
-                       UINT wID, UINT fType, LPSTR dwTypeData, UINT fState);
-
 /*
   Items merged into the toolbar and and the filemenu
 */
@@ -126,25 +162,25 @@ typedef struct
    BYTE  bStyle;
 } MYTOOLINFO, *LPMYTOOLINFO;
 
-MYTOOLINFO Tools[] = 
+MYTOOLINFO Tools[] =
 {
-{ FCIDM_SHVIEW_BIGICON,    0, 0, IDS_VIEW_LARGE,   TBSTATE_ENABLED, TBSTYLE_BUTTON },
-{ FCIDM_SHVIEW_SMALLICON,  0, 0, IDS_VIEW_SMALL,   TBSTATE_ENABLED, TBSTYLE_BUTTON },
-{ FCIDM_SHVIEW_LISTVIEW,   0, 0, IDS_VIEW_LIST,    TBSTATE_ENABLED, TBSTYLE_BUTTON },
-{ FCIDM_SHVIEW_REPORTVIEW, 0, 0, IDS_VIEW_DETAILS, TBSTATE_ENABLED, TBSTYLE_BUTTON },
+{ FCIDM_SHVIEW_BIGICON,    0, 0, IDS_VIEW_LARGE,   TBSTATE_ENABLED, BTNS_BUTTON },
+{ FCIDM_SHVIEW_SMALLICON,  0, 0, IDS_VIEW_SMALL,   TBSTATE_ENABLED, BTNS_BUTTON },
+{ FCIDM_SHVIEW_LISTVIEW,   0, 0, IDS_VIEW_LIST,    TBSTATE_ENABLED, BTNS_BUTTON },
+{ FCIDM_SHVIEW_REPORTVIEW, 0, 0, IDS_VIEW_DETAILS, TBSTATE_ENABLED, BTNS_BUTTON },
 { -1, 0, 0, 0, 0, 0}
 };
 
-typedef void CALLBACK (*PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
+typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
 
 /**********************************************************
  *     IShellView_Constructor
  */
 IShellView * IShellView_Constructor( IShellFolder * pFolder)
 {      IShellViewImpl * sv;
-       sv=(IShellViewImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));
+       sv=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));
        sv->ref=1;
-       ICOM_VTBL(sv)=&svvt;
+       sv->lpVtbl=&svvt;
        sv->lpvtblOleCommandTarget=&ctvt;
        sv->lpvtblDropTarget=&dtvt;
        sv->lpvtblDropSource=&dsvt;
@@ -153,9 +189,8 @@ IShellView * IShellView_Constructor( IShellFolder * pFolder)
        sv->pSFParent = pFolder;
        if(pFolder) IShellFolder_AddRef(pFolder);
        IShellFolder_QueryInterface(sv->pSFParent, &IID_IShellFolder2, (LPVOID*)&sv->pSF2Parent);
-       
+
        TRACE("(%p)->(%p)\n",sv, pFolder);
-       shell32_ObjCount++;
        return (IShellView *) sv;
 }
 
@@ -170,7 +205,7 @@ static BOOL IsInCommDlg(IShellViewImpl * This)
 static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl)
 {
        HRESULT ret = S_OK;
-       
+
        if ( IsInCommDlg(This) )
        {
          TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
@@ -183,12 +218,12 @@ static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl)
 static HRESULT OnDefaultCommand(IShellViewImpl * This)
 {
        HRESULT ret = S_FALSE;
-       
+
        if (IsInCommDlg(This))
        {
          TRACE("ICommDlgBrowser::OnDefaultCommand\n");
          ret = ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView*)This);
-         TRACE("--\n");
+         TRACE("-- returns %08lx\n", ret);
        }
        return ret;
 }
@@ -208,7 +243,7 @@ static HRESULT OnStateChange(IShellViewImpl * This, UINT uFlags)
 /**********************************************************
  *     set the toolbar of the filedialog buttons
  *
- * - activates the buttons from the shellbrowser according to 
+ * - activates the buttons from the shellbrowser according to
  *   the view state
  */
 static void CheckToolbar(IShellViewImpl * This)
@@ -216,7 +251,7 @@ static void CheckToolbar(IShellViewImpl * This)
        LRESULT result;
 
        TRACE("\n");
-       
+
        if (IsInCommDlg(This))
        {
          IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
@@ -253,12 +288,13 @@ static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove)
 * - creates the list view window
 */
 static BOOL ShellView_CreateList (IShellViewImpl * This)
-{      DWORD dwStyle;
+{      DWORD dwStyle, dwExStyle;
 
        TRACE("%p\n",This);
 
        dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
                  LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE;
+        dwExStyle = WS_EX_CLIENTEDGE;
 
        switch (This->FolderSettings.ViewMode)
        {
@@ -270,10 +306,13 @@ static BOOL ShellView_CreateList (IShellViewImpl * This)
        }
 
        if (This->FolderSettings.fFlags & FWF_AUTOARRANGE)      dwStyle |= LVS_AUTOARRANGE;
-       /*if (This->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/
+       if (This->FolderSettings.fFlags & FWF_DESKTOP)
+         This->FolderSettings.fFlags |= FWF_NOCLIENTEDGE | FWF_NOSCROLL;
        if (This->FolderSettings.fFlags & FWF_SINGLESEL)        dwStyle |= LVS_SINGLESEL;
+       if (This->FolderSettings.fFlags & FWF_NOCLIENTEDGE)
+         dwExStyle &= ~WS_EX_CLIENTEDGE;
 
-       This->hWndList=CreateWindowExA( WS_EX_CLIENTEDGE,
+       This->hWndList=CreateWindowExA( dwExStyle,
                                        WC_LISTVIEWA,
                                        NULL,
                                        dwStyle,
@@ -290,6 +329,15 @@ static BOOL ShellView_CreateList (IShellViewImpl * This)
         This->ListViewSortInfo.nHeaderID = -1;
         This->ListViewSortInfo.nLastHeaderID = -1;
 
+       if (This->FolderSettings.fFlags & FWF_DESKTOP) {
+         if (0)  /* FIXME: look into registry vale HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewShadow and activate drop shadows */
+           ListView_SetTextBkColor(This->hWndList, CLR_NONE);
+         else
+           ListView_SetTextBkColor(This->hWndList, GetSysColor(COLOR_DESKTOP));
+
+         ListView_SetTextColor(This->hWndList, RGB(255,255,255));
+       }
+
         /*  UpdateShellSettings(); */
        return TRUE;
 }
@@ -336,11 +384,11 @@ static BOOL ShellView_InitList(IShellViewImpl * This)
        return TRUE;
 }
 /**********************************************************
-* ShellView_CompareItems() 
+* ShellView_CompareItems()
 *
 * NOTES
 *  internal, CALLBACK for DSA_Sort
-*/   
+*/
 static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
 {
        int ret;
@@ -348,7 +396,7 @@ static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARA
 
        if(!lpData) return 0;
 
-       ret =  (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2));  
+       ret =  (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2));
        TRACE("ret=%i\n",ret);
        return ret;
 }
@@ -364,17 +412,17 @@ static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARA
  *     lpData        [I] The column ID for the header Ctrl to process
  *
  * RETURNS
- *     A negative value if the first item should precede the second, 
- *     a positive value if the first item should follow the second, 
+ *     A negative value if the first item should precede the second,
+ *     a positive value if the first item should follow the second,
  *     or zero if the two items are equivalent
  *
  * NOTES
  *     FIXME: function does what ShellView_CompareItems is supposed to do.
  *     unify it and figure out how to use the undocumented first parameter
  *     of IShellFolder_CompareIDs to do the job this function does and
- *     move this code to IShellFolder. 
+ *     move this code to IShellFolder.
  *     make LISTVIEW_SORT_INFO obsolete
- *     the way this function works is only usable if we had only 
+ *     the way this function works is only usable if we had only
  *     filesystemfolders  (25/10/99 jsch)
  */
 static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
@@ -398,9 +446,9 @@ static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam
         nDiff = bIsFolder1 ? -1 : 1;
     }
     else
-    {   
+    {
         /* Sort by Time: Folders or Files can be sorted */
+
         if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TIME)
         {
             _ILGetFileDateTime(pItemIdList1, &fd1);
@@ -412,7 +460,7 @@ static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam
         {
             _ILGetFileAttributes(pItemIdList1, strName1, MAX_PATH);
             _ILGetFileAttributes(pItemIdList2, strName2, MAX_PATH);
-            nDiff = strcasecmp(strName1, strName2);
+            nDiff = lstrcmpiA(strName1, strName2);
         }
         /* Sort by FileName: Folder or Files can be sorted */
         else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_NAME || bIsBothFolder)
@@ -420,7 +468,7 @@ static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam
             /* Sort by Text */
             _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
             _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
-            nDiff = strcasecmp(strName1, strName2);
+            nDiff = lstrcmpiA(strName1, strName2);
         }
         /* Sort by File Size, Only valid for Files */
         else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_SIZE)
@@ -433,16 +481,16 @@ static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam
             /* Sort by Type */
             _ILGetFileType(pItemIdList1, strName1, MAX_PATH);
             _ILGetFileType(pItemIdList2, strName2, MAX_PATH);
-            nDiff = strcasecmp(strName1, strName2);
+            nDiff = lstrcmpiA(strName1, strName2);
         }
     }
     /*  If the Date, FileSize, FileType, Attrib was the same, sort by FileName */
-        
+
     if(nDiff == 0)
     {
         _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
         _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
-        nDiff = strcasecmp(strName1, strName2);
+        nDiff = lstrcmpiA(strName1, strName2);
     }
 
     if(!pSortInfo->bIsAscending)
@@ -456,7 +504,7 @@ static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam
 
 /**********************************************************
 *  LV_FindItemByPidl()
-*/   
+*/
 static int LV_FindItemByPidl(
        IShellViewImpl * This,
        LPCITEMIDLIST pidl)
@@ -531,7 +579,7 @@ static BOOLEAN LV_RenameItem(IShellViewImpl * This, LPCITEMIDLIST pidlOld, LPCIT
          lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidlNew));      /* set the item's data */
          ListView_SetItemA(This->hWndList, &lvItem);
          ListView_Update(This->hWndList, nItem);
-         return TRUE;                                  /* fixme: better handling */
+         return TRUE;                                  /* FIXME: better handling */
        }
        return FALSE;
 }
@@ -541,20 +589,29 @@ static BOOLEAN LV_RenameItem(IShellViewImpl * This, LPCITEMIDLIST pidlOld, LPCIT
 * - gets the objectlist from the shellfolder
 * - sorts the list
 * - fills the list into the view
-*/   
+*/
+
+static INT CALLBACK fill_list( LPVOID ptr, LPVOID arg )
+{
+    LPITEMIDLIST pidl = ptr;
+    IShellViewImpl *This = arg;
+    /* in a commdlg This works as a filemask*/
+    if ( IncludeObject(This, pidl)==S_OK ) LV_AddItem(This, pidl);
+    SHFree(pidl);
+    return TRUE;
+}
 
 static HRESULT ShellView_FillList(IShellViewImpl * This)
 {
        LPENUMIDLIST    pEnumIDList;
        LPITEMIDLIST    pidl;
        DWORD           dwFetched;
-       UINT            i;
        HRESULT         hRes;
        HDPA            hdpa;
 
        TRACE("%p\n",This);
 
-       /* get the itemlist from the shfolder*/  
+       /* get the itemlist from the shfolder*/
        hRes = IShellFolder_EnumObjects(This->pSFParent,This->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList);
        if (hRes != S_OK)
        {
@@ -563,8 +620,8 @@ static HRESULT ShellView_FillList(IShellViewImpl * This)
          return(hRes);
        }
 
-       /* create a pointer array */    
-       hdpa = pDPA_Create(16);
+       /* create a pointer array */
+       hdpa = DPA_Create(16);
        if (!hdpa)
        {
          return(E_OUTOFMEMORY);
@@ -573,46 +630,37 @@ static HRESULT ShellView_FillList(IShellViewImpl * This)
        /* copy the items into the array*/
        while((S_OK == IEnumIDList_Next(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched)
        {
-         if (pDPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
+         if (DPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
          {
            SHFree(pidl);
-         } 
+         }
        }
 
        /* sort the array */
-       pDPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent);
+       DPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent);
 
        /*turn the listview's redrawing off*/
-       SendMessageA(This->hWndList, WM_SETREDRAW, FALSE, 0); 
-
-       for (i=0; i < DPA_GetPtrCount(hdpa); ++i)       /* DPA_GetPtrCount is a macro*/
-       {
-         pidl = (LPITEMIDLIST)pDPA_GetPtr(hdpa, i);
+       SendMessageA(This->hWndList, WM_SETREDRAW, FALSE, 0);
 
-         /* in a commdlg This works as a filemask*/
-         if ( IncludeObject(This, pidl)==S_OK )
-           LV_AddItem(This, pidl);
-         SHFree(pidl);
-       }
+        DPA_DestroyCallback( hdpa, fill_list, This );
 
        /*turn the listview's redrawing back on and force it to draw*/
        SendMessageA(This->hWndList, WM_SETREDRAW, TRUE, 0);
 
        IEnumIDList_Release(pEnumIDList); /* destroy the list*/
-       pDPA_Destroy(hdpa);
-       
+
        return S_OK;
 }
 
 /**********************************************************
 *  ShellView_OnCreate()
-*/   
+*/
 static LRESULT ShellView_OnCreate(IShellViewImpl * This)
 {
        IDropTarget* pdt;
-       NOTIFYREGISTER ntreg;
+       SHChangeNotifyEntry ntreg;
        IPersistFolder2 * ppf2 = NULL;
-       
+
        TRACE("%p\n",This);
 
        if(ShellView_CreateList(This))
@@ -622,29 +670,26 @@ static LRESULT ShellView_OnCreate(IShellViewImpl * This)
            ShellView_FillList(This);
          }
        }
-       
-       if(GetShellOle())
+
+       if (SUCCEEDED(IShellFolder_CreateViewObject(This->pSFParent, This->hWnd, &IID_IDropTarget, (LPVOID*)&pdt)))
        {
-         if (SUCCEEDED(IShellFolder_CreateViewObject(This->pSFParent, This->hWnd, &IID_IDropTarget, (LPVOID*)&pdt)))
-         {
-           pRegisterDragDrop(This->hWnd, pdt);
+           RegisterDragDrop(This->hWnd, pdt);
            IDropTarget_Release(pdt);
-         }
        }
 
        /* register for receiving notifications */
        IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2);
        if (ppf2)
        {
-         IPersistFolder2_GetCurFolder(ppf2, &ntreg.pidlPath);
-         ntreg.bWatchSubtree = FALSE;
+         IPersistFolder2_GetCurFolder(ppf2, (LPITEMIDLIST*)&ntreg.pidl);
+         ntreg.fRecursive = TRUE;
          This->hNotify = SHChangeNotifyRegister(This->hWnd, SHCNF_IDLIST, SHCNE_ALLEVENTS, SHV_CHANGE_NOTIFY, 1, &ntreg);
-         SHFree(ntreg.pidlPath);
+         SHFree((LPITEMIDLIST)ntreg.pidl);
          IPersistFolder2_Release(ppf2);
        }
 
        This->hAccel = LoadAcceleratorsA(shell32_hInstance, "shv_accel");
-       
+
        return S_OK;
 }
 
@@ -670,14 +715,14 @@ static HMENU ShellView_BuildFileMenu(IShellViewImpl * This)
 
          /*add the menu items*/
          for(i = 0; i < nTools; i++)
-         { 
+         {
            LoadStringA(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH);
 
            ZeroMemory(&mii, sizeof(mii));
            mii.cbSize = sizeof(mii);
            mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
 
-           if(TBSTYLE_SEP != Tools[i].bStyle) /* no seperator*/
+           if(BTNS_SEP != Tools[i].bStyle) /* no separator*/
            {
              mii.fType = MFT_STRING;
              mii.fState = MFS_ENABLED;
@@ -692,14 +737,14 @@ static HMENU ShellView_BuildFileMenu(IShellViewImpl * This)
            InsertMenuItemA(hSubMenu, (UINT)-1, TRUE, &mii);
          }
        }
-       TRACE("-- return (menu=0x%x)\n",hSubMenu);
+       TRACE("-- return (menu=%p)\n",hSubMenu);
        return hSubMenu;
 }
 /**********************************************************
 * ShellView_MergeFileMenu()
 */
 static void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu)
-{      TRACE("(%p)->(submenu=0x%08x) stub\n",This,hSubMenu);
+{      TRACE("(%p)->(submenu=%p) stub\n",This,hSubMenu);
 
        if(hSubMenu)
        { /*insert This item at the beginning of the menu */
@@ -707,7 +752,7 @@ static void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu)
          _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED);
 
        }
-       TRACE("--\n");  
+       TRACE("--\n");
 }
 
 /**********************************************************
@@ -717,7 +762,7 @@ static void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu)
 static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu)
 {      MENUITEMINFOA   mii;
 
-       TRACE("(%p)->(submenu=0x%08x)\n",This,hSubMenu);
+       TRACE("(%p)->(submenu=%p)\n",This,hSubMenu);
 
        if(hSubMenu)
        { /*add a separator at the correct position in the menu*/
@@ -725,7 +770,7 @@ static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu)
 
          ZeroMemory(&mii, sizeof(mii));
          mii.cbSize = sizeof(mii);
-         mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;;
+         mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;
          mii.fType = MFT_STRING;
          mii.dwTypeData = "View";
          mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001");
@@ -740,7 +785,7 @@ static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu)
 *
 * RETURNS
 *  number of selected items
-*/   
+*/
 static UINT ShellView_GetSelections(IShellViewImpl * This)
 {
        LVITEMA lvItem;
@@ -755,7 +800,7 @@ static UINT ShellView_GetSelections(IShellViewImpl * This)
        This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST));
 
        TRACE("selected=%i\n", This->cidl);
-       
+
        if(This->apidl)
        {
          TRACE("-- Items selected =%u\n", This->cidl);
@@ -778,6 +823,90 @@ static UINT ShellView_GetSelections(IShellViewImpl * This)
        return This->cidl;
 
 }
+
+/**********************************************************
+ *     ShellView_OpenSelectedItems()
+ */
+static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
+{
+       static UINT CF_IDLIST = 0;
+       HRESULT hr;
+       IDataObject* selection;
+       FORMATETC fetc;
+       STGMEDIUM stgm;
+       LPIDA pIDList;
+       LPCITEMIDLIST parent_pidl;
+       int i;
+
+       if (0 == ShellView_GetSelections(This))
+       {
+         return S_OK;
+       }
+       hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl,
+                                       (LPCITEMIDLIST*)This->apidl, &IID_IDataObject,
+                                       0, (LPVOID *)&selection);
+       if (FAILED(hr))
+         return hr;
+
+       if (0 == CF_IDLIST)
+       {
+         CF_IDLIST = RegisterClipboardFormatA(CFSTR_SHELLIDLIST);
+       }
+       fetc.cfFormat = CF_IDLIST;
+       fetc.ptd = NULL;
+       fetc.dwAspect = DVASPECT_CONTENT;
+       fetc.lindex = -1;
+       fetc.tymed = TYMED_HGLOBAL;
+
+       hr = IDataObject_QueryGetData(selection, &fetc);
+       if (FAILED(hr))
+         return hr;
+
+       hr = IDataObject_GetData(selection, &fetc, &stgm);
+       if (FAILED(hr))
+         return hr;
+
+       pIDList = GlobalLock(stgm.u.hGlobal);
+
+       parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pIDList+pIDList->aoffset[0]);
+       for (i = pIDList->cidl; i > 0; --i)
+       {
+         LPCITEMIDLIST pidl;
+         SFGAOF attribs;
+
+         pidl = (LPCITEMIDLIST)((LPBYTE)pIDList+pIDList->aoffset[i]);
+
+         attribs = SFGAO_FOLDER;
+         hr = IShellFolder_GetAttributesOf(This->pSFParent, 1, &pidl, &attribs);
+
+         if (SUCCEEDED(hr) && ! (attribs & SFGAO_FOLDER))
+         {
+           SHELLEXECUTEINFOA shexinfo;
+
+           shexinfo.cbSize = sizeof(SHELLEXECUTEINFOA);
+           shexinfo.fMask = SEE_MASK_INVOKEIDLIST;     /* SEE_MASK_IDLIST is also possible. */
+           shexinfo.hwnd = NULL;
+           shexinfo.lpVerb = NULL;
+           shexinfo.lpFile = NULL;
+           shexinfo.lpParameters = NULL;
+           shexinfo.lpDirectory = NULL;
+           shexinfo.nShow = SW_NORMAL;
+           shexinfo.lpIDList = ILCombine(parent_pidl, pidl);
+
+           ShellExecuteExA(&shexinfo);    /* Discard error/success info */
+
+           ILFree((LPITEMIDLIST)shexinfo.lpIDList);
+         }
+       }
+
+       GlobalUnlock(stgm.u.hGlobal);
+       ReleaseStgMedium(&stgm);
+
+       IDataObject_Release(selection);
+
+       return S_OK;
+}
+
 /**********************************************************
  *     ShellView_DoContextMenu()
  */
@@ -788,15 +917,15 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
        BOOL    fExplore = FALSE;
        HWND    hwndTree = 0;
        LPCONTEXTMENU   pContextMenu = NULL;
-       IContextMenu *  pCM = NULL;
+       IContextMenu2 *pCM = NULL;
        CMINVOKECOMMANDINFO     cmi;
-       
+
        TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault);
 
        /* look, what's selected and create a context menu object of it*/
        if( ShellView_GetSelections(This) )
        {
-         IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, This->apidl, 
+         IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, (LPCITEMIDLIST*)This->apidl,
                                        (REFIID)&IID_IContextMenu, NULL, (LPVOID *)&pContextMenu);
 
          if(pContextMenu)
@@ -819,6 +948,9 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
              /* let the ContextMenu merge its items in */
              if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, wFlags )))
              {
+               if (This->FolderSettings.fFlags & FWF_DESKTOP)
+                 SetMenuDefaultItem(hMenu, FCIDM_SHVIEW_OPEN, MF_BYCOMMAND);
+
                if( bDefault )
                {
                  TRACE("-- get menu default command\n");
@@ -828,15 +960,18 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
                {
                  TRACE("-- track popup\n");
                  uCommand = TrackPopupMenu( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
-               }               
+               }
 
                if(uCommand > 0)
                {
                  TRACE("-- uCommand=%u\n", uCommand);
-                 if (IsInCommDlg(This) && ((uCommand==FCIDM_SHVIEW_EXPLORE) || (uCommand==FCIDM_SHVIEW_OPEN)))
+                 if (uCommand==FCIDM_SHVIEW_OPEN && IsInCommDlg(This))
                  {
                    TRACE("-- dlg: OnDefaultCommand\n");
-                   OnDefaultCommand(This);
+                   if (OnDefaultCommand(This) != S_OK)
+                   {
+                     ShellView_OpenSelectedItems(This);
+                   }
                  }
                  else
                  {
@@ -856,11 +991,11 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
          }
        }
        else    /* background context menu */
-       { 
+       {
          hMenu = CreatePopupMenu();
 
-         pCM = ISvBgCm_Constructor(This->pSFParent);
-         IContextMenu_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
+         pCM = ISvBgCm_Constructor(This->pSFParent, FALSE);
+         IContextMenu2_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
 
          uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
          DestroyMenu(hMenu);
@@ -871,9 +1006,9 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
          cmi.cbSize = sizeof(cmi);
          cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);
          cmi.hwnd = This->hWndParent;
-         IContextMenu_InvokeCommand(pCM, &cmi);
+         IContextMenu2_InvokeCommand(pCM, &cmi);
 
-         IContextMenu_Release(pCM);
+         IContextMenu2_Release(pCM);
        }
 }
 
@@ -901,7 +1036,7 @@ static LRESULT ShellView_OnSize(IShellViewImpl * This, WORD wWidth, WORD wHeight
 *
 * NOTES
 *  internal
-*/   
+*/
 static void ShellView_OnDeactivate(IShellViewImpl * This)
 {
        TRACE("%p\n",This);
@@ -922,13 +1057,13 @@ static void ShellView_OnDeactivate(IShellViewImpl * This)
 
 /**********************************************************
 * ShellView_OnActivate()
-*/   
+*/
 static LRESULT ShellView_OnActivate(IShellViewImpl * This, UINT uState)
 {      OLEMENUGROUPWIDTHS   omw = { {0, 0, 0, 0, 0, 0} };
        MENUITEMINFOA         mii;
        CHAR                szText[MAX_PATH];
 
-       TRACE("%p uState=%x\n",This,uState);    
+       TRACE("%p uState=%x\n",This,uState);
 
        /*don't do anything if the state isn't really changing */
        if(This->uState == uState)
@@ -947,7 +1082,7 @@ static LRESULT ShellView_OnActivate(IShellViewImpl * This, UINT uState)
          if(This->hMenu)
          {
            IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw);
-           TRACE("-- after fnInsertMenusSB\n");    
+           TRACE("-- after fnInsertMenusSB\n");
 
            /*build the top level menu get the menu item's text*/
            strcpy(szText,"dummy 31");
@@ -989,12 +1124,12 @@ static LRESULT ShellView_OnActivate(IShellViewImpl * This, UINT uState)
                ShellView_MergeFileMenu(This, mii.hSubMenu);
              }
            }
-           TRACE("-- before fnSetMenuSB\n");      
+           TRACE("-- before fnSetMenuSB\n");
            IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd);
          }
        }
        This->uState = uState;
-       TRACE("--\n");    
+       TRACE("--\n");
        return S_OK;
 }
 
@@ -1007,7 +1142,7 @@ static LRESULT ShellView_OnSetFocus(IShellViewImpl * This)
        TRACE("%p\n",This);
 
        /* Tell the browser one of our windows has received the focus. This
-       should always be done before merging menus (OnActivate merges the 
+       should always be done before merging menus (OnActivate merges the
        menus) if one of our windows has the focus.*/
 
        IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This);
@@ -1024,7 +1159,7 @@ static LRESULT ShellView_OnSetFocus(IShellViewImpl * This)
 
 /**********************************************************
 * ShellView_OnKillFocus()
-*/   
+*/
 static LRESULT ShellView_OnKillFocus(IShellViewImpl * This)
 {
        TRACE("(%p) stub\n",This);
@@ -1041,10 +1176,10 @@ static LRESULT ShellView_OnKillFocus(IShellViewImpl * This)
 *
 * NOTES
 *      the CmdID's are the ones from the context menu
-*/   
+*/
 static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dwCmd, HWND hwndCmd)
 {
-       TRACE("(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",This, dwCmdID, dwCmd, hwndCmd);
+       TRACE("(%p)->(0x%08lx 0x%08lx %p) stub\n",This, dwCmdID, dwCmd, hwndCmd);
 
        switch(dwCmdID)
        {
@@ -1082,7 +1217,7 @@ static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dw
            This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;
            ListView_SortItems(This->hWndList, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo)));
            break;
-           
+
          default:
            TRACE("-- COMMAND 0x%04lx unhandled\n", dwCmdID);
        }
@@ -1092,7 +1227,7 @@ static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dw
 /**********************************************************
 * ShellView_OnNotify()
 */
-   
+
 static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpnmh)
 {      LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh;
        NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh;
@@ -1114,6 +1249,32 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
            OnStateChange(This,CDBOSC_KILLFOCUS);
            break;
 
+         case NM_CUSTOMDRAW:
+           TRACE("-- NM_CUSTOMDRAW %p\n",This);
+           return CDRF_DODEFAULT;
+
+         case NM_RELEASEDCAPTURE:
+           TRACE("-- NM_RELEASEDCAPTURE %p\n",This);
+           break;
+
+         case NM_CLICK:
+           TRACE("-- NM_CLICK %p\n",This);
+           break;
+
+         case NM_RCLICK:
+           TRACE("-- NM_RCLICK %p\n",This);
+           break;          
+
+          case NM_DBLCLK:
+            TRACE("-- NM_DBLCLK %p\n",This);
+            if (OnDefaultCommand(This) != S_OK) ShellView_OpenSelectedItems(This);
+            break;
+
+          case NM_RETURN:
+            TRACE("-- NM_DBLCLK %p\n",This);
+            if (OnDefaultCommand(This) != S_OK) ShellView_OpenSelectedItems(This);
+            break;
+
          case HDN_ENDTRACKA:
            TRACE("-- HDN_ENDTRACKA %p\n",This);
            /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0);
@@ -1125,10 +1286,17 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
            SHFree((LPITEMIDLIST)lpnmlv->lParam);     /*delete the pidl because we made a copy of it*/
            break;
 
+         case LVN_DELETEALLITEMS:
+           TRACE("-- LVN_DELETEALLITEMS %p\n",This);
+           return FALSE;
+
+         case LVN_INSERTITEM:
+           TRACE("-- LVN_INSERTITEM (STUB)%p\n",This);
+           break;
+
          case LVN_ITEMACTIVATE:
            TRACE("-- LVN_ITEMACTIVATE %p\n",This);
            OnStateChange(This, CDBOSC_SELCHANGE);  /* the browser will get the IDataObject now */
-           ShellView_DoContextMenu(This, 0, 0, TRUE);
            break;
 
          case LVN_COLUMNCLICK:
@@ -1145,9 +1313,10 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
 
            ListView_SortItems(lpnmlv->hdr.hwndFrom, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo)));
            break;
-       
+
          case LVN_GETDISPINFOA:
-           TRACE("-- LVN_GETDISPINFOA %p\n",This);
+          case LVN_GETDISPINFOW:
+           TRACE("-- LVN_GETDISPINFO %p\n",This);
            pidl = (LPITEMIDLIST)lpdi->item.lParam;
 
            if(lpdi->item.mask & LVIF_TEXT)     /* text requested */
@@ -1156,8 +1325,16 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
              {
                SHELLDETAILS sd;
                IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd);
-               StrRetToStrNA( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
-               TRACE("-- text=%s\n",lpdi->item.pszText);               
+                if (lpnmh->code == LVN_GETDISPINFOA)
+                {
+                    StrRetToStrNA( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
+                    TRACE("-- text=%s\n",lpdi->item.pszText);
+                }
+                else /* LVN_GETDISPINFOW */
+                {
+                    StrRetToStrNW( ((NMLVDISPINFOW *)lpdi)->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
+                    TRACE("-- text=%s\n",debugstr_w((WCHAR*)(lpdi->item.pszText)));
+                }
              }
              else
              {
@@ -1180,32 +1357,29 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
            TRACE("-- LVN_BEGINDRAG\n");
 
            if (ShellView_GetSelections(This))
-           {  
+           {
              IDataObject * pda;
              DWORD dwAttributes = SFGAO_CANLINK;
              DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
-             
-             if(GetShellOle())
+
+             if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, (LPCITEMIDLIST*)This->apidl, &IID_IDataObject,0,(LPVOID *)&pda)))
              {
-               if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, &IID_IDataObject,0,(LPVOID *)&pda)))
-               {
                  IDropSource * pds = (IDropSource*)&(This->lpvtblDropSource);  /* own DropSource interface */
 
-                 if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, This->apidl, &dwAttributes)))
+                 if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, (LPCITEMIDLIST*)This->apidl, &dwAttributes)))
                  {
                    if (dwAttributes & SFGAO_CANLINK)
                    {
                      dwEffect |= DROPEFFECT_LINK;
                    }
                  }
-               
+
                  if (pds)
                  {
                    DWORD dwEffect;
-                   pDoDragDrop(pda, pds, dwEffect, &dwEffect);
+                   DoDragDrop(pda, pds, dwEffect, &dwEffect);
                  }
                  IDataObject_Release(pda);
-               }
              }
            }
            break;
@@ -1217,14 +1391,13 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
 
              TRACE("-- LVN_BEGINLABELEDITA %p\n",This);
 
-             IShellFolder_GetAttributesOf(This->pSFParent, 1, &pidl, &dwAttr);
+             IShellFolder_GetAttributesOf(This->pSFParent, 1, (LPCITEMIDLIST*)&pidl, &dwAttr);
              if (SFGAO_CANRENAME & dwAttr)
              {
                return FALSE;
              }
              return TRUE;
            }
-           break;
 
          case LVN_ENDLABELEDITA:
            {
@@ -1239,12 +1412,12 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
                lvItem.iItem = lpdi->item.iItem;
                lvItem.mask = LVIF_PARAM;
                ListView_GetItemA(This->hWndList, &lvItem);
-               
+
                pidl = (LPITEMIDLIST)lpdi->item.lParam;
                 if (!MultiByteToWideChar( CP_ACP, 0, lpdi->item.pszText, -1, wszNewName, MAX_PATH ))
                     wszNewName[MAX_PATH-1] = 0;
                hr = IShellFolder_SetNameOf(This->pSFParent, 0, pidl, wszNewName, SHGDN_INFOLDER, &pidl);
-               
+
                if(SUCCEEDED(hr) && pidl)
                {
                  lvItem.mask = LVIF_PARAM;
@@ -1255,8 +1428,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
              }
              return FALSE;
            }
-           break;
-         
+
          case LVN_KEYDOWN:
            {
            /*  MSG msg;
@@ -1266,7 +1438,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
              msg.lParam = 0;
              msg.time = 0;
              msg.pt = 0;*/
-             
+
              LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh;
 
               /* initiate a rename of the selected file or directory */
@@ -1281,7 +1453,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
                   /* get selected item */
                   i = ListView_GetNextItem(This->hWndList, -1,
                        LVNI_SELECTED);
+
                   ListView_EnsureVisible(This->hWndList, i, 0);
                   ListView_EditLabelA(This->hWndList, i);
                 }
@@ -1291,7 +1463,8 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
 #endif
              else if(plvKeyDown->wVKey == VK_DELETE)
               {
-               int i, item_index;
+               UINT i;
+               int item_index;
                LVITEMA item;
                LPITEMIDLIST* pItems;
                ISFHelper *psfhlp;
@@ -1299,36 +1472,47 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
                IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper,
                        (LPVOID*)&psfhlp);
 
+               if (psfhlp == NULL)
+                 break;
+
                if(!(i = ListView_GetSelectedCount(This->hWndList)))
                  break;
-       
+
                /* allocate memory for the pidl array */
-               pItems = HeapAlloc(GetProcessHeap(), 0, 
+               pItems = HeapAlloc(GetProcessHeap(), 0,
                        sizeof(LPITEMIDLIST) * i);
+
                /* retrieve all selected items */
                i = 0;
                item_index = -1;
                while(ListView_GetSelectedCount(This->hWndList) > i)
                {
                  /* get selected item */
-                 item_index = ListView_GetNextItem(This->hWndList, 
+                 item_index = ListView_GetNextItem(This->hWndList,
                        item_index, LVNI_SELECTED);
                  item.iItem = item_index;
+                 item.mask |= LVIF_PARAM;
                  ListView_GetItemA(This->hWndList, &item);
 
                  /* get item pidl */
                  pItems[i] = (LPITEMIDLIST)item.lParam;
-                 
+
                  i++;
                }
 
                /* perform the item deletion */
-               ISFHelper_DeleteItems(psfhlp, i, pItems);
+               ISFHelper_DeleteItems(psfhlp, i, (LPCITEMIDLIST*)pItems);
 
                /* free pidl array memory */
                HeapFree(GetProcessHeap(), 0, pItems);
               }
+
+              /* Initiate a refresh */
+              else if(plvKeyDown->wVKey == VK_F5)
+              {
+               IShellView_Refresh((IShellView*)This);
+              }
+
               else
                FIXME("LVN_KEYDOWN key=0x%08x\n",plvKeyDown->wVKey);
            }
@@ -1336,7 +1520,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
 
          default:
            TRACE("-- %p WM_COMMAND %x unhandled\n", This, lpnmh->code);
-           break;;
+           break;
        }
        return 0;
 }
@@ -1350,7 +1534,7 @@ static LRESULT ShellView_OnChange(IShellViewImpl * This, LPITEMIDLIST * Pidls, L
 
        TRACE("(%p)(%p,%p,0x%08lx)\n", This, Pidls[0], Pidls[1], wEventId);
        switch(wEventId)
-       {               
+       {
          case SHCNE_MKDIR:
          case SHCNE_CREATE:
            LV_AddItem(This, Pidls[0]);
@@ -1374,17 +1558,17 @@ static LRESULT ShellView_OnChange(IShellViewImpl * This, LPITEMIDLIST * Pidls, L
 
 static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
 {
-       IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongA(hWnd, GWL_USERDATA);
+       IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
        LPCREATESTRUCTA lpcs;
 
-       TRACE("(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
+       TRACE("(hwnd=%p msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
 
        switch (uMessage)
        {
          case WM_NCCREATE:
            lpcs = (LPCREATESTRUCTA)lParam;
            pThis = (IShellViewImpl*)(lpcs->lpCreateParams);
-           SetWindowLongA(hWnd, GWL_USERDATA, (LONG)pThis);
+           SetWindowLongPtrW(hWnd, GWLP_USERDATA, (ULONG_PTR)pThis);
            pThis->hWnd = hWnd;        /*set the window handle*/
            break;
 
@@ -1394,9 +1578,9 @@ static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wPara
          case WM_CREATE:       return ShellView_OnCreate(pThis);
          case WM_ACTIVATE:     return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS);
          case WM_NOTIFY:       return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam);
-         case WM_COMMAND:      return ShellView_OnCommand(pThis, 
-                                       GET_WM_COMMAND_ID(wParam, lParam), 
-                                       GET_WM_COMMAND_CMD(wParam, lParam), 
+         case WM_COMMAND:      return ShellView_OnCommand(pThis,
+                                       GET_WM_COMMAND_ID(wParam, lParam),
+                                       GET_WM_COMMAND_CMD(wParam, lParam),
                                        GET_WM_COMMAND_HWND(wParam, lParam));
          case SHV_CHANGE_NOTIFY: return ShellView_OnChange(pThis, (LPITEMIDLIST*)wParam, (LONG)lParam);
 
@@ -1408,12 +1592,16 @@ static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wPara
 
          case WM_GETDLGCODE:   return SendMessageA(pThis->hWndList,uMessage,0,0);
 
-         case WM_DESTROY:      if(GetShellOle())
-                               {
-                                 pRevokeDragDrop(pThis->hWnd);
-                               }
+         case WM_DESTROY:      
+                               RevokeDragDrop(pThis->hWnd);
                                SHChangeNotifyDeregister(pThis->hNotify);
                                break;
+
+         case WM_ERASEBKGND:
+           if ((pThis->FolderSettings.fFlags & FWF_DESKTOP) ||
+               (pThis->FolderSettings.fFlags & FWF_TRANSPARENT))
+             return 1;
+           break;
        }
 
        return DefWindowProcA (hWnd, uMessage, wParam, lParam);
@@ -1429,7 +1617,7 @@ static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wPara
 */
 static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid, LPVOID *ppvObj)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
 
@@ -1437,7 +1625,7 @@ static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid
 
        if(IsEqualIID(riid, &IID_IUnknown))
        {
-         *ppvObj = This; 
+         *ppvObj = This;
        }
        else if(IsEqualIID(riid, &IID_IShellView))
        {
@@ -1475,44 +1663,44 @@ static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid
 */
 static ULONG WINAPI IShellView_fnAddRef(IShellView * iface)
 {
-       ICOM_THIS(IShellViewImpl, 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);
 
-       shell32_ObjCount++;
-       return ++(This->ref);
+       return refCount;
 }
 /**********************************************************
 *  IShellView_Release
 */
 static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
 {
-       ICOM_THIS(IShellViewImpl, iface);
-
-       TRACE("(%p)->()\n",This);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
+       ULONG refCount = InterlockedDecrement(&This->ref);
 
-       shell32_ObjCount--;
+       TRACE("(%p)->(count=%li)\n", This, refCount + 1);
 
-       if (!--(This->ref)) 
+       if (!refCount)
        {
          TRACE(" destroying IShellView(%p)\n",This);
 
+         DestroyWindow(This->hWndList);
+
          if(This->pSFParent)
            IShellFolder_Release(This->pSFParent);
 
          if(This->pSF2Parent)
            IShellFolder2_Release(This->pSF2Parent);
 
-         if (This->apidl)
+         if(This->apidl)
            SHFree(This->apidl);
 
-         if (This->pCommDlgBrowser)
-           ICommDlgBrowser_Release(This->pCommDlgBrowser);
+         if(This->pAdvSink)
+           IAdviseSink_Release(This->pAdvSink);
 
          HeapFree(GetProcessHeap(),0,This);
-         return 0;
        }
-       return This->ref;
+       return refCount;
 }
 
 /**********************************************************
@@ -1520,7 +1708,7 @@ static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
 */
 static HRESULT WINAPI IShellView_fnGetWindow(IShellView * iface,HWND * phWnd)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        TRACE("(%p)\n",This);
 
@@ -1531,7 +1719,7 @@ static HRESULT WINAPI IShellView_fnGetWindow(IShellView * iface,HWND * phWnd)
 
 static HRESULT WINAPI IShellView_fnContextSensitiveHelp(IShellView * iface,BOOL fEnterMode)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        FIXME("(%p) stub\n",This);
 
@@ -1547,11 +1735,11 @@ static HRESULT WINAPI IShellView_fnContextSensitiveHelp(IShellView * iface,BOOL
 static HRESULT WINAPI IShellView_fnTranslateAccelerator(IShellView * iface,LPMSG lpmsg)
 {
 #if 0
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam);
 #endif
-       
+
        if ((lpmsg->message>=WM_KEYFIRST) && (lpmsg->message>=WM_KEYLAST))
        {
          TRACE("-- key=0x04%x\n",lpmsg->wParam) ;
@@ -1561,7 +1749,7 @@ static HRESULT WINAPI IShellView_fnTranslateAccelerator(IShellView * iface,LPMSG
 
 static HRESULT WINAPI IShellView_fnEnableModeless(IShellView * iface,BOOL fEnable)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        FIXME("(%p) stub\n",This);
 
@@ -1570,7 +1758,7 @@ static HRESULT WINAPI IShellView_fnEnableModeless(IShellView * iface,BOOL fEnabl
 
 static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
 /*
        CHAR    szName[MAX_PATH];
@@ -1605,7 +1793,7 @@ static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState)
 /*
          IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,
                                                        0, (LPARAM)szName, &lResult);
-*/                                                     
+*/
        }
 
        return S_OK;
@@ -1613,7 +1801,7 @@ static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState)
 
 static HRESULT WINAPI IShellView_fnRefresh(IShellView * iface)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        TRACE("(%p)\n",This);
 
@@ -1631,14 +1819,14 @@ static HRESULT WINAPI IShellView_fnCreateViewWindow(
        RECT * prcView,
        HWND  *phWnd)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        WNDCLASSA wc;
        *phWnd = 0;
 
-       
+
        TRACE("(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",This, lpPrevView,lpfs, psb, prcView, phWnd);
-       TRACE("-- vmode=%x flags=%x left=%i top=%i right=%i bottom=%i\n",lpfs->ViewMode, lpfs->fFlags ,prcView->left,prcView->top, prcView->right, prcView->bottom);
+       TRACE("-- vmode=%x flags=%x left=%li top=%li right=%li bottom=%li\n",lpfs->ViewMode, lpfs->fFlags ,prcView->left,prcView->top, prcView->right, prcView->bottom);
 
        /*set up the member variables*/
        This->pShellBrowser = psb;
@@ -1650,7 +1838,7 @@ static HRESULT WINAPI IShellView_fnCreateViewWindow(
 
        /* try to get the ICommDlgBrowserInterface, adds a reference !!! */
        This->pCommDlgBrowser=NULL;
-       if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser, 
+       if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser,
                        (REFIID)&IID_ICommDlgBrowser, (LPVOID*) &This->pCommDlgBrowser)))
        {
          TRACE("-- CommDlgBrowser\n");
@@ -1661,12 +1849,12 @@ static HRESULT WINAPI IShellView_fnCreateViewWindow(
        {
          ZeroMemory(&wc, sizeof(wc));
          wc.style              = CS_HREDRAW | CS_VREDRAW;
-         wc.lpfnWndProc        = (WNDPROC) ShellView_WndProc;
+         wc.lpfnWndProc        = ShellView_WndProc;
          wc.cbClsExtra         = 0;
          wc.cbWndExtra         = 0;
          wc.hInstance          = shell32_hInstance;
          wc.hIcon              = 0;
-         wc.hCursor            = LoadCursorA (0, IDC_ARROWA);
+         wc.hCursor            = LoadCursorA (0, (LPSTR)IDC_ARROW);
          wc.hbrBackground      = (HBRUSH) (COLOR_WINDOW + 1);
          wc.lpszMenuName       = NULL;
          wc.lpszClassName      = SV_CLASS_NAME;
@@ -1689,7 +1877,7 @@ static HRESULT WINAPI IShellView_fnCreateViewWindow(
                                (LPVOID)This);
 
        CheckToolbar(This);
-       
+
        if(!*phWnd) return E_FAIL;
 
        return S_OK;
@@ -1697,7 +1885,7 @@ static HRESULT WINAPI IShellView_fnCreateViewWindow(
 
 static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView * iface)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        TRACE("(%p)\n",This);
 
@@ -1710,16 +1898,18 @@ static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView * iface)
        }
 
        DestroyWindow(This->hWnd);
-       IShellBrowser_Release(This->pShellBrowser);
+       if(This->pShellBrowser) IShellBrowser_Release(This->pShellBrowser);
+       if(This->pCommDlgBrowser) ICommDlgBrowser_Release(This->pCommDlgBrowser);
+
 
        return S_OK;
 }
 
 static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView * iface, LPFOLDERSETTINGS lpfs)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
-       TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs, 
+       TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs,
                This->FolderSettings.ViewMode, This->FolderSettings.fFlags);
 
        if (!lpfs) return E_INVALIDARG;
@@ -1730,7 +1920,7 @@ static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView * iface, LPFOLDERSE
 
 static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView * iface, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        FIXME("(%p) stub\n",This);
 
@@ -1739,7 +1929,7 @@ static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView * iface, DWO
 
 static HRESULT WINAPI IShellView_fnSaveViewState(IShellView * iface)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        FIXME("(%p) stub\n",This);
 
@@ -1751,17 +1941,17 @@ static HRESULT WINAPI IShellView_fnSelectItem(
        LPCITEMIDLIST pidl,
        UINT uFlags)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
        int i;
-       
+
        TRACE("(%p)->(pidl=%p, 0x%08x) stub\n",This, pidl, uFlags);
-       
+
        i = LV_FindItemByPidl(This, pidl);
 
        if (i != -1)
        {
          LVITEMA lvItem;
-         
+
          if(uFlags & SVSI_ENSUREVISIBLE)
            ListView_EnsureVisible(This->hWndList, i, 0);
 
@@ -1800,7 +1990,7 @@ static HRESULT WINAPI IShellView_fnSelectItem(
 
 static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem, REFIID riid, LPVOID *ppvOut)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",This, uItem, debugstr_guid(riid), ppvOut);
 
@@ -1809,12 +1999,12 @@ static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem,
        switch(uItem)
        {
          case SVGIO_BACKGROUND:
-           *ppvOut = ISvBgCm_Constructor(This->pSFParent);
+           *ppvOut = ISvBgCm_Constructor(This->pSFParent, FALSE);
            break;
 
          case SVGIO_SELECTION:
            ShellView_GetSelections(This);
-           IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, riid, 0, ppvOut);
+           IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, (LPCITEMIDLIST*)This->apidl, riid, 0, ppvOut);
            break;
        }
        TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut);
@@ -1824,27 +2014,8 @@ static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem,
        return S_OK;
 }
 
-static HRESULT WINAPI IShellView_fnEditItem(
-       IShellView * iface,
-       LPITEMIDLIST pidl)
+static const IShellViewVtbl svvt =
 {
-       ICOM_THIS(IShellViewImpl, iface);
-       int i;
-       
-       TRACE("(%p)->(pidl=%p)\n",This, pidl);
-       
-       i = LV_FindItemByPidl(This, pidl);
-       if (i != -1)
-       {
-         SetFocus(This->hWndList);
-         ListView_EditLabelA(This->hWndList, i);
-       }
-       return S_OK;
-}
-
-static struct ICOM_VTABLE(IShellView) svvt = 
-{      
-       ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
        IShellView_fnQueryInterface,
        IShellView_fnAddRef,
        IShellView_fnRelease,
@@ -1860,8 +2031,7 @@ static struct ICOM_VTABLE(IShellView) svvt =
        IShellView_fnAddPropertySheetPages,
        IShellView_fnSaveViewState,
        IShellView_fnSelectItem,
-       IShellView_fnGetItemObject,
-       IShellView_fnEditItem
+       IShellView_fnGetItemObject
 };
 
 
@@ -1873,7 +2043,7 @@ static HRESULT WINAPI ISVOleCmdTarget_QueryInterface(
        REFIID                  iid,
        LPVOID*                 ppvObj)
 {
-       _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
 
        return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj);
 }
@@ -1884,7 +2054,7 @@ static HRESULT WINAPI ISVOleCmdTarget_QueryInterface(
 static ULONG WINAPI ISVOleCmdTarget_AddRef(
        IOleCommandTarget *     iface)
 {
-       _ICOM_THIS_From_IOleCommandTarget(IShellFolder, iface);
+       IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
 
        return IShellFolder_AddRef((IShellFolder*)This);
 }
@@ -1895,7 +2065,7 @@ static ULONG WINAPI ISVOleCmdTarget_AddRef(
 static ULONG WINAPI ISVOleCmdTarget_Release(
        IOleCommandTarget *     iface)
 {
-       _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
 
        return IShellFolder_Release((IShellFolder*)This);
 }
@@ -1906,15 +2076,24 @@ static ULONG WINAPI ISVOleCmdTarget_Release(
 static HRESULT WINAPI ISVOleCmdTarget_QueryStatus(
        IOleCommandTarget *iface,
        const GUID* pguidCmdGroup,
-       ULONG cCmds, 
+       ULONG cCmds,
        OLECMD * prgCmds,
        OLECMDTEXT* pCmdText)
 {
-       _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
+    UINT i;
+    IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
 
-       FIXME("(%p)->(%p(%s) 0x%08lx %p %p\n",
+    FIXME("(%p)->(%p(%s) 0x%08lx %p %p\n",
               This, pguidCmdGroup, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
-       return E_NOTIMPL;
+
+    if (!prgCmds)
+        return E_POINTER;
+    for (i = 0; i < cCmds; i++)
+    {
+        FIXME("\tprgCmds[%d].cmdID = %ld\n", i, prgCmds[i].cmdID);
+        prgCmds[i].cmdf = 0;
+    }
+    return OLECMDERR_E_UNKNOWNGROUP;
 }
 
 /**********************************************************
@@ -1930,16 +2109,25 @@ static HRESULT WINAPI ISVOleCmdTarget_Exec(
        VARIANT* pvaIn,
        VARIANT* pvaOut)
 {
-       _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
 
        FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08lx Opt:0x%08lx %p %p)\n",
               This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut);
-       return E_NOTIMPL;
+
+       if (IsEqualIID(pguidCmdGroup, &CGID_Explorer) &&
+          (nCmdID == 0x29) &&
+          (nCmdexecopt == 4) && pvaOut)
+          return S_OK;
+       if (IsEqualIID(pguidCmdGroup, &CGID_ShellDocView) &&
+          (nCmdID == 9) &&
+          (nCmdexecopt == 0))
+          return 1;
+
+       return OLECMDERR_E_UNKNOWNGROUP;
 }
 
-static ICOM_VTABLE(IOleCommandTarget) ctvt = 
+static const IOleCommandTargetVtbl ctvt =
 {
-       ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
        ISVOleCmdTarget_QueryInterface,
        ISVOleCmdTarget_AddRef,
        ISVOleCmdTarget_Release,
@@ -1956,7 +2144,7 @@ static HRESULT WINAPI ISVDropTarget_QueryInterface(
        REFIID riid,
        LPVOID *ppvObj)
 {
-       _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropTarget(iface);
 
        TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
 
@@ -1965,7 +2153,7 @@ static HRESULT WINAPI ISVDropTarget_QueryInterface(
 
 static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface)
 {
-       _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropTarget(iface);
 
        TRACE("(%p)->(count=%lu)\n",This,This->ref);
 
@@ -1974,7 +2162,7 @@ static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface)
 
 static ULONG WINAPI ISVDropTarget_Release( IDropTarget *iface)
 {
-       _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropTarget(iface);
 
        TRACE("(%p)->(count=%lu)\n",This,This->ref);
 
@@ -1987,9 +2175,9 @@ static HRESULT WINAPI ISVDropTarget_DragEnter(
        DWORD           grfKeyState,
        POINTL          pt,
        DWORD           *pdwEffect)
-{      
+{
 
-       _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropTarget(iface);
 
        FIXME("Stub: This=%p, DataObject=%p\n",This,pDataObject);
 
@@ -2002,7 +2190,7 @@ static HRESULT WINAPI ISVDropTarget_DragOver(
        POINTL          pt,
        DWORD           *pdwEffect)
 {
-       _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropTarget(iface);
 
        FIXME("Stub: This=%p\n",This);
 
@@ -2012,7 +2200,7 @@ static HRESULT WINAPI ISVDropTarget_DragOver(
 static HRESULT WINAPI ISVDropTarget_DragLeave(
        IDropTarget     *iface)
 {
-       _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropTarget(iface);
 
        FIXME("Stub: This=%p\n",This);
 
@@ -2026,16 +2214,15 @@ static HRESULT WINAPI ISVDropTarget_Drop(
        POINTL          pt,
        DWORD           *pdwEffect)
 {
-       _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropTarget(iface);
 
        FIXME("Stub: This=%p\n",This);
 
        return E_NOTIMPL;
 }
 
-static struct ICOM_VTABLE(IDropTarget) dtvt = 
+static const IDropTargetVtbl dtvt =
 {
-       ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
        ISVDropTarget_QueryInterface,
        ISVDropTarget_AddRef,
        ISVDropTarget_Release,
@@ -2054,7 +2241,7 @@ static HRESULT WINAPI ISVDropSource_QueryInterface(
        REFIID riid,
        LPVOID *ppvObj)
 {
-       _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropSource(iface);
 
        TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
 
@@ -2063,7 +2250,7 @@ static HRESULT WINAPI ISVDropSource_QueryInterface(
 
 static ULONG WINAPI ISVDropSource_AddRef( IDropSource *iface)
 {
-       _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropSource(iface);
 
        TRACE("(%p)->(count=%lu)\n",This,This->ref);
 
@@ -2072,7 +2259,7 @@ static ULONG WINAPI ISVDropSource_AddRef( IDropSource *iface)
 
 static ULONG WINAPI ISVDropSource_Release( IDropSource *iface)
 {
-       _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropSource(iface);
 
        TRACE("(%p)->(count=%lu)\n",This,This->ref);
 
@@ -2083,7 +2270,7 @@ static HRESULT WINAPI ISVDropSource_QueryContinueDrag(
        BOOL fEscapePressed,
        DWORD grfKeyState)
 {
-       _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropSource(iface);
        TRACE("(%p)\n",This);
 
        if (fEscapePressed)
@@ -2098,15 +2285,14 @@ static HRESULT WINAPI ISVDropSource_GiveFeedback(
        IDropSource *iface,
        DWORD dwEffect)
 {
-       _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropSource(iface);
        TRACE("(%p)\n",This);
 
        return DRAGDROP_S_USEDEFAULTCURSORS;
 }
 
-static struct ICOM_VTABLE(IDropSource) dsvt =
+static const IDropSourceVtbl dsvt =
 {
-       ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
        ISVDropSource_QueryInterface,
        ISVDropSource_AddRef,
        ISVDropSource_Release,
@@ -2122,7 +2308,7 @@ static HRESULT WINAPI ISVViewObject_QueryInterface(
        REFIID riid,
        LPVOID *ppvObj)
 {
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
 
@@ -2131,7 +2317,7 @@ static HRESULT WINAPI ISVViewObject_QueryInterface(
 
 static ULONG WINAPI ISVViewObject_AddRef( IViewObject *iface)
 {
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        TRACE("(%p)->(count=%lu)\n",This,This->ref);
 
@@ -2140,7 +2326,7 @@ static ULONG WINAPI ISVViewObject_AddRef( IViewObject *iface)
 
 static ULONG WINAPI ISVViewObject_Release( IViewObject *iface)
 {
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        TRACE("(%p)->(count=%lu)\n",This,This->ref);
 
@@ -2156,12 +2342,12 @@ static HRESULT WINAPI ISVViewObject_Draw(
        HDC hdcTargetDev,
        HDC hdcDraw,
        LPCRECTL lprcBounds,
-       LPCRECTL lprcWBounds, 
-       IVO_ContCallback pfnContinue,
-       DWORD dwContinue)
-{      
+       LPCRECTL lprcWBounds,
+       BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue),
+       ULONG_PTR dwContinue)
+{
 
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        FIXME("Stub: This=%p\n",This);
 
@@ -2175,9 +2361,9 @@ static HRESULT WINAPI ISVViewObject_GetColorSet(
        DVTARGETDEVICE* ptd,
        HDC hicTargetDevice,
        LOGPALETTE** ppColorSet)
-{      
+{
 
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        FIXME("Stub: This=%p\n",This);
 
@@ -2189,9 +2375,9 @@ static HRESULT WINAPI ISVViewObject_Freeze(
        LONG lindex,
        void* pvAspect,
        DWORD* pdwFreeze)
-{      
+{
 
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        FIXME("Stub: This=%p\n",This);
 
@@ -2200,9 +2386,9 @@ static HRESULT WINAPI ISVViewObject_Freeze(
 static HRESULT WINAPI ISVViewObject_Unfreeze(
        IViewObject     *iface,
        DWORD dwFreeze)
-{      
+{
 
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        FIXME("Stub: This=%p\n",This);
 
@@ -2213,32 +2399,49 @@ static HRESULT WINAPI ISVViewObject_SetAdvise(
        DWORD aspects,
        DWORD advf,
        IAdviseSink* pAdvSink)
-{      
+{
 
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(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,
        DWORD* pAdvf,
        IAdviseSink** ppAdvSink)
-{      
+{
 
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(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;
 }
 
 
-static struct ICOM_VTABLE(IViewObject) vovt = 
+static const IViewObjectVtbl vovt =
 {
-       ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
        ISVViewObject_QueryInterface,
        ISVViewObject_AddRef,
        ISVViewObject_Release,
@@ -2249,4 +2452,3 @@ static struct ICOM_VTABLE(IViewObject) vovt =
        ISVViewObject_SetAdvise,
        ISVViewObject_GetAdvise
 };
-