Initial stubbed implementation of UnixFolder's IDropTarget interface.
[wine] / dlls / shell32 / shlview.c
index b6764fa..a024933 100644 (file)
 #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"
@@ -70,12 +75,13 @@ typedef struct
 }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;
+{
+       const IShellViewVtbl*   lpVtbl;
+       LONG                    ref;
+       const IOleCommandTargetVtbl* lpvtblOleCommandTarget;
+       const IDropTargetVtbl*  lpvtblDropTarget;
+       const IDropSourceVtbl*  lpvtblDropSource;
+       const IViewObjectVtbl*  lpvtblViewObject;
        IShellFolder*   pSFParent;
        IShellFolder2*  pSF2Parent;
        IShellBrowser*  pShellBrowser;
@@ -91,25 +97,37 @@ typedef struct
         LISTVIEW_SORT_INFO ListViewSortInfo;
        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
@@ -132,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
 */
@@ -149,10 +164,10 @@ typedef struct
 
 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}
 };
 
@@ -163,7 +178,7 @@ typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMa
  */
 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;
        sv->lpVtbl=&svvt;
        sv->lpvtblOleCommandTarget=&ctvt;
@@ -208,7 +223,7 @@ static HRESULT OnDefaultCommand(IShellViewImpl * This)
        {
          TRACE("ICommDlgBrowser::OnDefaultCommand\n");
          ret = ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView*)This);
-         TRACE("--\n");
+         TRACE("-- returns %08lx\n", ret);
        }
        return ret;
 }
@@ -314,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;
 }
@@ -436,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)
@@ -444,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)
@@ -457,7 +481,7 @@ 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 */
@@ -466,7 +490,7 @@ static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam
     {
         _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
         _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
-        nDiff = strcasecmp(strName1, strName2);
+        nDiff = lstrcmpiA(strName1, strName2);
     }
 
     if(!pSortInfo->bIsAscending)
@@ -647,13 +671,10 @@ static LRESULT ShellView_OnCreate(IShellViewImpl * This)
          }
        }
 
-       if(GetShellOle() && pRegisterDragDrop)
+       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 */
@@ -661,7 +682,7 @@ static LRESULT ShellView_OnCreate(IShellViewImpl * This)
        if (ppf2)
        {
          IPersistFolder2_GetCurFolder(ppf2, (LPITEMIDLIST*)&ntreg.pidl);
-         ntreg.fRecursive = FALSE;
+         ntreg.fRecursive = TRUE;
          This->hNotify = SHChangeNotifyRegister(This->hWnd, SHCNF_IDLIST, SHCNE_ALLEVENTS, SHV_CHANGE_NOTIFY, 1, &ntreg);
          SHFree((LPITEMIDLIST)ntreg.pidl);
          IPersistFolder2_Release(ppf2);
@@ -701,7 +722,7 @@ static HMENU ShellView_BuildFileMenu(IShellViewImpl * This)
            mii.cbSize = sizeof(mii);
            mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
 
-           if(TBSTYLE_SEP != Tools[i].bStyle) /* no separator*/
+           if(BTNS_SEP != Tools[i].bStyle) /* no separator*/
            {
              mii.fType = MFT_STRING;
              mii.fState = MFS_ENABLED;
@@ -802,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()
  */
@@ -843,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");
@@ -857,10 +965,13 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
                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
                  {
@@ -883,7 +994,7 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL
        {
          hMenu = CreatePopupMenu();
 
-         pCM = ISvBgCm_Constructor(This->pSFParent);
+         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);
@@ -1138,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);
@@ -1149,6 +1286,10 @@ 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;
@@ -1156,7 +1297,6 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
          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:
@@ -1192,7 +1332,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
                 }
                 else /* LVN_GETDISPINFOW */
                 {
-                    StrRetToStrNW( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
+                    StrRetToStrNW( ((NMLVDISPINFOW *)lpdi)->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
                     TRACE("-- text=%s\n",debugstr_w((WCHAR*)(lpdi->item.pszText)));
                 }
              }
@@ -1222,10 +1362,8 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
              DWORD dwAttributes = SFGAO_CANLINK;
              DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
 
-             if(GetShellOle() && pDoDragDrop)
+             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, (LPCITEMIDLIST*)This->apidl, &IID_IDataObject,0,(LPVOID *)&pda)))
-               {
                  IDropSource * pds = (IDropSource*)&(This->lpvtblDropSource);  /* own DropSource interface */
 
                  if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, (LPCITEMIDLIST*)This->apidl, &dwAttributes)))
@@ -1239,10 +1377,9 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
                  if (pds)
                  {
                    DWORD dwEffect;
-                   pDoDragDrop(pda, pds, dwEffect, &dwEffect);
+                   DoDragDrop(pda, pds, dwEffect, &dwEffect);
                  }
                  IDataObject_Release(pda);
-               }
              }
            }
            break;
@@ -1261,7 +1398,6 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
              }
              return TRUE;
            }
-           break;
 
          case LVN_ENDLABELEDITA:
            {
@@ -1292,7 +1428,6 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
              }
              return FALSE;
            }
-           break;
 
          case LVN_KEYDOWN:
            {
@@ -1337,6 +1472,9 @@ 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;
 
@@ -1353,6 +1491,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
                  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 */
@@ -1367,13 +1506,20 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
                /* 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);
            }
            break;
 
          default:
-           FIXME("-- %p WM_COMMAND %x unhandled\n", This, lpnmh->code);
+           TRACE("-- %p WM_COMMAND %x unhandled\n", This, lpnmh->code);
            break;
        }
        return 0;
@@ -1412,7 +1558,7 @@ 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=%p msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
@@ -1422,7 +1568,7 @@ static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wPara
          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;
 
@@ -1446,10 +1592,8 @@ 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)
-                               {
-                                 pRevokeDragDrop(pThis->hWnd);
-                               }
+         case WM_DESTROY:      
+                               RevokeDragDrop(pThis->hWnd);
                                SHChangeNotifyDeregister(pThis->hNotify);
                                break;
 
@@ -1473,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);
 
@@ -1519,38 +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);
 
-       return ++(This->ref);
+       return refCount;
 }
 /**********************************************************
 *  IShellView_Release
 */
 static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
 {
-       ICOM_THIS(IShellViewImpl, 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);
 
+         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->pAdvSink)
+           IAdviseSink_Release(This->pAdvSink);
+
          HeapFree(GetProcessHeap(),0,This);
-         return 0;
        }
-       return This->ref;
+       return refCount;
 }
 
 /**********************************************************
@@ -1558,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);
 
@@ -1569,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);
 
@@ -1585,7 +1735,7 @@ 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
@@ -1599,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);
 
@@ -1608,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];
@@ -1651,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);
 
@@ -1669,7 +1819,7 @@ static HRESULT WINAPI IShellView_fnCreateViewWindow(
        RECT * prcView,
        HWND  *phWnd)
 {
-       ICOM_THIS(IShellViewImpl, iface);
+       IShellViewImpl *This = (IShellViewImpl *)iface;
 
        WNDCLASSA wc;
        *phWnd = 0;
@@ -1699,7 +1849,7 @@ 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;
@@ -1735,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);
 
@@ -1757,7 +1907,7 @@ static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView * iface)
 
 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,
                This->FolderSettings.ViewMode, This->FolderSettings.fFlags);
@@ -1770,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);
 
@@ -1779,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);
 
@@ -1791,7 +1941,7 @@ 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);
@@ -1840,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);
 
@@ -1849,7 +1999,7 @@ 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:
@@ -1864,9 +2014,8 @@ static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem,
        return S_OK;
 }
 
-static struct ICOM_VTABLE(IShellView) svvt =
+static const IShellViewVtbl svvt =
 {
-       ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
        IShellView_fnQueryInterface,
        IShellView_fnAddRef,
        IShellView_fnRelease,
@@ -1894,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);
 }
@@ -1905,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);
 }
@@ -1916,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);
 }
@@ -1932,7 +2081,7 @@ static HRESULT WINAPI ISVOleCmdTarget_QueryStatus(
        OLECMDTEXT* pCmdText)
 {
     UINT i;
-    _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
+    IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
 
     FIXME("(%p)->(%p(%s) 0x%08lx %p %p\n",
               This, pguidCmdGroup, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
@@ -1960,7 +2109,7 @@ 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);
@@ -1977,9 +2126,8 @@ static HRESULT WINAPI ISVOleCmdTarget_Exec(
        return OLECMDERR_E_UNKNOWNGROUP;
 }
 
-static ICOM_VTABLE(IOleCommandTarget) ctvt =
+static const IOleCommandTargetVtbl ctvt =
 {
-       ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
        ISVOleCmdTarget_QueryInterface,
        ISVOleCmdTarget_AddRef,
        ISVOleCmdTarget_Release,
@@ -1996,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);
 
@@ -2005,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);
 
@@ -2014,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);
 
@@ -2029,7 +2177,7 @@ static HRESULT WINAPI ISVDropTarget_DragEnter(
        DWORD           *pdwEffect)
 {
 
-       _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IDropTarget(iface);
 
        FIXME("Stub: This=%p, DataObject=%p\n",This,pDataObject);
 
@@ -2042,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);
 
@@ -2052,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);
 
@@ -2066,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,
@@ -2094,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);
 
@@ -2103,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);
 
@@ -2112,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);
 
@@ -2123,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)
@@ -2138,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,
@@ -2162,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);
 
@@ -2171,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);
 
@@ -2180,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);
 
@@ -2198,10 +2344,10 @@ static HRESULT WINAPI ISVViewObject_Draw(
        LPCRECTL lprcBounds,
        LPCRECTL lprcWBounds,
        BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue),
-       DWORD dwContinue)
+       ULONG_PTR dwContinue)
 {
 
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        FIXME("Stub: This=%p\n",This);
 
@@ -2217,7 +2363,7 @@ static HRESULT WINAPI ISVViewObject_GetColorSet(
        LOGPALETTE** ppColorSet)
 {
 
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        FIXME("Stub: This=%p\n",This);
 
@@ -2231,7 +2377,7 @@ static HRESULT WINAPI ISVViewObject_Freeze(
        DWORD* pdwFreeze)
 {
 
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        FIXME("Stub: This=%p\n",This);
 
@@ -2242,7 +2388,7 @@ static HRESULT WINAPI ISVViewObject_Unfreeze(
        DWORD dwFreeze)
 {
 
-       _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
+       IShellViewImpl *This = impl_from_IViewObject(iface);
 
        FIXME("Stub: This=%p\n",This);
 
@@ -2255,12 +2401,19 @@ static HRESULT WINAPI ISVViewObject_SetAdvise(
        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,
@@ -2268,17 +2421,27 @@ static HRESULT WINAPI ISVViewObject_GetAdvise(
        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,