Ignore:
Timestamp:
Jan 30, 2004, 11:11:42 PM (22 years ago)
Author:
bird
Message:

#682: Drag & Drop fixes. Some Wine resync.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ole32/ole2.c

    r10185 r10432  
    55 *      Copyright 1995  Martin von Loewis
    66 *      Copyright 1999  Francis Beaudet
    7  *      Copyright 1999  Noel Borthwick 
     7 *      Copyright 1999  Noel Borthwick
    88 *
    99 * This library is free software; you can redistribute it and/or
     
    3939
    4040#include "wine/obj_clientserver.h"
     41#ifdef __WIN32OS2__ /* we've got older headers! */
     42#include "wine/obj_propertystorage.h"
     43#include "wine/obj_oleaut.h"
     44#endif
    4145#include "wine/winbase16.h"
    4246#include "wine/wingdi16.h"
     
    5054
    5155/******************************************************************************
    52  * These are static/global variables and internal data structures that the 
     56 * These are static/global variables and internal data structures that the
    5357 * OLE module uses to maintain it's state.
    5458 */
     
    7680
    7781  BOOL       escPressed;
    78   HWND       curDragTargetHWND;
     82  HWND       curTargetHWND;     /* window the mouse is hovering over */
     83  HWND       curDragTargetHWND; /* might be a ancestor of curTargetHWND */
    7984  IDropTarget* curDragTarget;
    8085} TrackerWindowInfo;
     
    117122
    118123/******************************************************************************
    119  * These are the prototypes of miscelaneous utility methods 
     124 * These are the prototypes of miscelaneous utility methods
    120125 */
    121126static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD* pdwValue);
     
    124129 * These are the prototypes of the utility methods used to manage a shared menu
    125130 */
    126 static void OLEMenu_Initialize();
    127 static void OLEMenu_UnInitialize();
     131#ifdef __WIN32OS2__
     132/* Changed () -> (void) as () isn't a prototype good enought for VAC. */
     133#endif
     134static void OLEMenu_Initialize(void);
     135static void OLEMenu_UnInitialize(void);
    128136BOOL OLEMenu_InstallHooks( DWORD tid );
    129137BOOL OLEMenu_UnInstallHooks( DWORD tid );
     
    137145 * These are the prototypes of the OLE Clipboard initialization methods (in clipboard.c)
    138146 */
    139 void OLEClipbrd_UnInitialize();
    140 void OLEClipbrd_Initialize();
     147void OLEClipbrd_UnInitialize(void);
     148void OLEClipbrd_Initialize(void);
    141149
    142150/******************************************************************************
    143151 * These are the prototypes of the utility methods used for OLE Drag n Drop
    144152 */
    145 static void            OLEDD_Initialize();
    146 static void            OLEDD_UnInitialize();
     153static void            OLEDD_Initialize(void);
     154static void            OLEDD_UnInitialize(void);
    147155static void            OLEDD_InsertDropTarget(
    148156                         DropTargetNode* nodeToAdd);
     
    152160                         HWND hwndOfTarget);
    153161static LRESULT WINAPI  OLEDD_DragTrackerWindowProc(
    154                          HWND   hwnd, 
     162                         HWND   hwnd,
    155163                         UINT   uMsg,
    156                          WPARAM wParam, 
     164                         WPARAM wParam,
    157165                         LPARAM   lParam);
    158166static void OLEDD_TrackMouseMove(
     
    164172                         POINT            mousePos,
    165173                         DWORD              keyState);
    166 static DWORD OLEDD_GetButtonState();
     174static DWORD OLEDD_GetButtonState(void);
    167175
    168176#ifdef __WIN32OS2__
    169 static IDropTarget *IDropTarget_Constructor();
     177static IDropTarget *IDropTarget_Constructor(void);
    170178
    171179HWND hwndTracker = 0;
     
    174182/******************************************************************************
    175183 *              OleBuildVersion [OLE2.1]
    176  *              OleBuildVersion [OLE32.84]
     184 *              OleBuildVersion [OLE32.@]
    177185 */
    178186DWORD WINAPI OleBuildVersion(void)
     
    184192/***********************************************************************
    185193 *           OleInitialize       (OLE2.2)
    186  *           OleInitialize       (OLE32.108)
     194 *           OleInitialize       (OLE32.@)
    187195 */
    188196HRESULT WINAPI OleInitialize(LPVOID reserved)
     
    198206
    199207  /*
    200    * If the CoInitializeEx call failed, the OLE libraries can't be 
     208   * If the CoInitializeEx call failed, the OLE libraries can't be
    201209   * initialized.
    202210   */
    203211  if (FAILED(hr))
    204     return hr;   
     212    return hr;
    205213
    206214  /*
     
    214222  if (OLE_moduleLockCount==0)
    215223  {
    216     /* 
     224    /*
    217225     * Initialize the libraries.
    218226     */
     
    238246   * Then, we increase the lock count on the OLE module.
    239247   */
    240   OLE_moduleLockCount++; 
     248  OLE_moduleLockCount++;
    241249
    242250  return hr;
     
    245253/******************************************************************************
    246254 *              CoGetCurrentProcess     [COMPOBJ.34]
    247  *              CoGetCurrentProcess     [OLE32.18]
     255 *              CoGetCurrentProcess     [OLE32.@]
    248256 *
    249257 * NOTES
     
    257265/******************************************************************************
    258266 *              OleUninitialize [OLE2.3]
    259  *              OleUninitialize [OLE32.131]
     267 *              OleUninitialize [OLE32.@]
    260268 */
    261269void WINAPI OleUninitialize(void)
     
    287295     */
    288296    OLEDD_UnInitialize();
    289    
     297
    290298    /*
    291299     * OLE shared menu
     
    293301    OLEMenu_UnInitialize();
    294302  }
    295  
     303
    296304  /*
    297305   * Then, uninitialize the COM libraries.
     
    301309
    302310/******************************************************************************
    303  *              CoRegisterMessageFilter [OLE32.38]
     311 *              CoRegisterMessageFilter [OLE32.@]
    304312 */
    305313HRESULT WINAPI CoRegisterMessageFilter(
     
    315323
    316324/******************************************************************************
    317  *              OleInitializeWOW        [OLE32.109]
     325 *              OleInitializeWOW        [OLE32.@]
    318326 */
    319327HRESULT WINAPI OleInitializeWOW(DWORD x) {
     
    323331
    324332/***********************************************************************
    325  *           RegisterDragDrop (OLE2.35)
    326  */
    327 HRESULT WINAPI RegisterDragDrop16(
    328         HWND16 hwnd,
    329         LPDROPTARGET pDropTarget
    330 ) {
    331         FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
    332         return S_OK;
    333 }
    334 
    335 /***********************************************************************
    336  *           RegisterDragDrop (OLE32.139)
     333 *           RegisterDragDrop (OLE32.@)
    337334 */
    338335HRESULT WINAPI RegisterDragDrop(
    339336        HWND hwnd,
    340         LPDROPTARGET pDropTarget) 
     337        LPDROPTARGET pDropTarget)
    341338{
    342339  DropTargetNode* dropTargetInfo;
    343340
    344   TRACE("(0x%x,%p)\n", hwnd, pDropTarget);
     341  TRACE("(%p,%p)\n", hwnd, pDropTarget);
    345342
    346343  /*
     
    375372  dropTargetInfo->dropTarget  = pDropTarget;
    376373  IDropTarget_AddRef(dropTargetInfo->dropTarget);
    377  
     374
    378375  OLEDD_InsertDropTarget(dropTargetInfo);
    379376
     
    382379
    383380/***********************************************************************
    384  *           RevokeDragDrop (OLE2.36)
    385  */
    386 HRESULT WINAPI RevokeDragDrop16(
    387         HWND16 hwnd
    388 ) {
    389         FIXME("(0x%04x),stub!\n",hwnd);
    390         return S_OK;
    391 }
    392 
    393 /***********************************************************************
    394  *           RevokeDragDrop (OLE32.141)
     381 *           RevokeDragDrop (OLE32.@)
    395382 */
    396383HRESULT WINAPI RevokeDragDrop(
     
    399386  DropTargetNode* dropTargetInfo;
    400387
    401   TRACE("(0x%x)\n", hwnd);
     388  TRACE("(%p)\n", hwnd);
    402389
    403390  /*
     
    423410   */
    424411  IDropTarget_Release(dropTargetInfo->dropTarget);
    425   HeapFree(GetProcessHeap(), 0, dropTargetInfo); 
     412  HeapFree(GetProcessHeap(), 0, dropTargetInfo);
    426413
    427414        return S_OK;
     
    429416
    430417/***********************************************************************
    431  *           OleRegGetUserType (OLE32.122)
     418 *           OleRegGetUserType (OLE32.@)
    432419 *
    433420 * This implementation of OleRegGetUserType ignores the dwFormOfType
     
    436423 * way they are registered.
    437424 */
    438 HRESULT WINAPI OleRegGetUserType( 
    439         REFCLSID clsid, 
     425HRESULT WINAPI OleRegGetUserType(
     426        REFCLSID clsid,
    440427        DWORD dwFormOfType,
    441428        LPOLESTR* pszUserType)
     
    521508  RegCloseKey(clsidKey);
    522509
    523  
     510
    524511  if (hres!=ERROR_SUCCESS)
    525512  {
     
    540527
    541528/***********************************************************************
    542  * DoDragDrop [OLE32.65]
     529 * DoDragDrop [OLE32.@]
    543530 */
    544531HRESULT WINAPI DoDragDrop (
     
    557544   * Setup the drag n drop tracking window.
    558545   */
     546  if (!IsValidInterface((LPUNKNOWN)pDropSource))
     547      return E_INVALIDARG;
     548
    559549  trackerInfo.dataObject        = pDataObject;
    560550  trackerInfo.dropSource        = pDropSource;
     
    564554  trackerInfo.escPressed        = FALSE;
    565555  trackerInfo.curDragTargetHWND = 0;
     556  trackerInfo.curTargetHWND     = 0;
    566557  trackerInfo.curDragTarget     = 0;
    567558
     
    585576    hwndTracker = hwndTrackWindow;
    586577#endif
     578
    587579    /*
    588580     * Capture the mouse input
     
    595587    while (!trackerInfo.trackingDone && GetMessageA(&msg, 0, 0, 0) )
    596588    {
    597       if ( (msg.message >= WM_KEYFIRST) && 
     589      if ( (msg.message >= WM_KEYFIRST) &&
    598590           (msg.message <= WM_KEYLAST) )
    599591      {
     592#ifdef __WIN32OS2__
     593        dprintf(("dragloop: key msg %x\n", msg.message));
     594#endif
    600595        /*
    601596         * When keyboard messages are sent to windows on this thread, we
     
    612607        /*
    613608         * Notify the drop source.
    614          */       
     609         */
    615610        OLEDD_TrackStateChange(&trackerInfo,
    616611                               msg.pt,
     
    619614      else
    620615      {
     616#ifdef __WIN32OS2__
     617        dprintf(("dragloop: dispmsg %x\n", msg.message));
     618#endif
    621619        /*
    622620         * Dispatch the messages only when it's not a keyboard message.
     
    646644
    647645/***********************************************************************
    648  * OleQueryLinkFromData [OLE32.118]
     646 * OleQueryLinkFromData [OLE32.@]
    649647 */
    650648HRESULT WINAPI OleQueryLinkFromData(
     
    656654
    657655/***********************************************************************
    658  * OleRegGetMiscStatus [OLE32.121]
     656 * OleRegGetMiscStatus [OLE32.@]
    659657 */
    660658HRESULT WINAPI OleRegGetMiscStatus(
     
    701699                       &miscStatusKey);
    702700
    703  
     701
    704702  if (result != ERROR_SUCCESS)
    705703  {
     
    721719                       keyName,
    722720                       &aspectKey);
    723  
     721
    724722  if (result == ERROR_SUCCESS)
    725723  {
     
    738736
    739737/******************************************************************************
    740  *              OleSetContainedObject        [OLE32.128]
     738 *              OleSetContainedObject        [OLE32.@]
    741739 */
    742740HRESULT WINAPI OleSetContainedObject(
    743   LPUNKNOWN pUnknown, 
     741  LPUNKNOWN pUnknown,
    744742  BOOL      fContained)
    745743{
     
    766764
    767765/******************************************************************************
    768  *              OleLoad        [OLE32.112]
     766 *              OleLoad        [OLE32.@]
    769767 */
    770768HRESULT WINAPI OleLoad(
    771   LPSTORAGE       pStg, 
    772   REFIID          riid, 
    773   LPOLECLIENTSITE pClientSite, 
     769  LPSTORAGE       pStg,
     770  REFIID          riid,
     771  LPOLECLIENTSITE pClientSite,
    774772  LPVOID*         ppvObj)
    775773{
     
    780778
    781779  TRACE("(%p,%p,%p,%p)\n", pStg, riid, pClientSite, ppvObj);
    782  
     780
    783781  /*
    784782   * TODO, Conversion ... OleDoAutoConvert
     
    829827                                   (void**)&persistStorage);
    830828
    831   if (SUCCEEDED(hres)) 
     829  if (SUCCEEDED(hres))
    832830  {
    833831    IPersistStorage_Load(persistStorage, pStg);
     
    851849
    852850/***********************************************************************
    853  *           OleSave     [OLE32.124]
     851 *           OleSave     [OLE32.@]
    854852 */
    855853HRESULT WINAPI OleSave(
     
    884882                    STGC_DEFAULT);
    885883  }
    886  
     884
    887885  return hres;
    888886}
     
    890888
    891889/******************************************************************************
    892  *              OleLockRunning        [OLE32.114]
    893  */
    894 HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses) 
     890 *              OleLockRunning        [OLE32.@]
     891 */
     892HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses)
    895893{
    896894  IRunnableObject* runnable = NULL;
     
    943941 * Install thread scope message hooks for WH_GETMESSAGE and WH_CALLWNDPROC
    944942 *
    945  * RETURNS: TRUE if message hooks were succesfully installed
     943 * RETURNS: TRUE if message hooks were successfully installed
    946944 *          FALSE on failure
    947945 */
     
    957955  pHookItem->tid = tid;
    958956  pHookItem->hHeap = GetProcessHeap();
    959  
     957
    960958  /* Install a thread scope message hook for WH_GETMESSAGE */
    961959  pHookItem->GetMsg_hHook = SetWindowsHookExA( WH_GETMESSAGE, OLEMenu_GetMsgProc,
     
    973971  pHookItem->next = hook_list;
    974972  hook_list = pHookItem;
    975  
     973
    976974  return TRUE;
    977  
     975
    978976CLEANUP:
    979977  /* Unhook any hooks */
     
    984982  /* Release the hook table entry */
    985983  HeapFree(pHookItem->hHeap, 0, pHookItem );
    986  
     984
    987985  return FALSE;
    988986}
     
    992990 * UnInstall thread scope message hooks for WH_GETMESSAGE and WH_CALLWNDPROC
    993991 *
    994  * RETURNS: TRUE if message hooks were succesfully installed
     992 * RETURNS: TRUE if message hooks were successfully installed
    995993 *          FALSE on failure
    996994 */
     
    10491047      return pHookItem;
    10501048  }
    1051  
     1049
    10521050  return NULL;
    10531051}
     
    10701068  {
    10711069    HMENU hsubmenu;
    1072      
     1070
    10731071    /*  Is the current item a submenu? */
    10741072    if ( (hsubmenu = GetSubMenu(hMainMenu, i)) )
     
    11171115  if ( !OLEMenu_FindMainMenuIndex( pOleMenuDescriptor->hmenuCombined, hmenu,  &nPos ) )
    11181116    return FALSE;
    1119  
     1117
    11201118  /* The group widths array has counts for the number of elements
    11211119   * in the groups File, Edit, Container, Object, Window, Help.
     
    11501148  OleMenuHookItem *pHookItem = NULL;
    11511149  WORD fuFlags;
    1152  
     1150
    11531151  TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam );
    11541152
     
    11561154  if ( HC_ACTION != code )
    11571155    goto NEXTHOOK;
    1158      
     1156
    11591157  /* Retrieve the current message being dispatched from lParam */
    11601158  pMsg = (LPCWPSTRUCT)lParam;
     
    11861184      goto NEXTHOOK;
    11871185    }
    1188    
     1186
    11891187    case WM_INITMENUPOPUP:
    11901188    {
     
    11931191      break;
    11941192    }
    1195    
     1193
    11961194    case WM_MENUSELECT:
    11971195    {
     
    12061204      break;
    12071205    }
    1208    
     1206
    12091207    case WM_DRAWITEM:
    12101208    {
     
    12261224                  pMsg->message, pMsg->wParam, pMsg->lParam );
    12271225  }
    1228    
     1226
    12291227NEXTHOOK:
    12301228  if ( pOleMenuDescriptor )
    12311229    GlobalUnlock( hOleMenu );
    1232  
     1230
    12331231  /* Lookup the hook item for the current thread */
    12341232  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
     
    12381236    return 0;
    12391237  }
    1240  
     1238
    12411239  /* Pass on the message to the next hooker */
    12421240  return CallNextHookEx( pHookItem->CallWndProc_hHook, code, wParam, lParam );
     
    12551253  OleMenuHookItem *pHookItem = NULL;
    12561254  WORD wCode;
    1257  
     1255
    12581256  TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam );
    12591257
     
    12611259  if ( HC_ACTION != code )
    12621260    goto NEXTHOOK;
    1263      
     1261
    12641262  /* Retrieve the current message being dispatched from lParam */
    12651263  pMsg = (LPMSG)lParam;
     
    13001298    pMsg->hwnd = pOleMenuDescriptor->hwndActiveObject;
    13011299  }
    1302    
     1300
    13031301NEXTHOOK:
    13041302  if ( pOleMenuDescriptor )
    13051303    GlobalUnlock( hOleMenu );
    1306  
     1304
    13071305  /* Lookup the hook item for the current thread */
    13081306  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
     
    13121310    return FALSE;
    13131311  }
    1314  
     1312
    13151313  /* Pass on the message to the next hooker */
    13161314  return CallNextHookEx( pHookItem->GetMsg_hHook, code, wParam, lParam );
     
    13181316
    13191317/***********************************************************************
    1320  * OleCreateMenuDescriptor [OLE32.97]
     1318 * OleCreateMenuDescriptor [OLE32.@]
    13211319 * Creates an OLE menu descriptor for OLE to use when dispatching
    13221320 * menu messages and commands.
     
    13501348  for ( i = 0; i < 6; i++ )
    13511349    pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i];
    1352  
     1350
    13531351  pOleMenuDescriptor->hmenuCombined = hmenuCombined;
    13541352  pOleMenuDescriptor->bIsServerItem = FALSE;
    13551353  GlobalUnlock( hOleMenu );
    1356      
     1354
    13571355  return hOleMenu;
    13581356}
    13591357
    13601358/***********************************************************************
    1361  * OleDestroyMenuDescriptor [OLE32.99]
     1359 * OleDestroyMenuDescriptor [OLE32.@]
    13621360 * Destroy the shared menu descriptor
    13631361 */
     
    13711369
    13721370/***********************************************************************
    1373  * OleSetMenuDescriptor [OLE32.129]
     1371 * OleSetMenuDescriptor [OLE32.@]
    13741372 * Installs or removes OLE dispatching code for the containers frame window
    13751373 * FIXME: The lpFrame and lpActiveObject parameters are currently ignored
    13761374 * OLE should install context sensitive help F1 filtering for the app when
    13771375 * these are non null.
    1378  * 
     1376 *
    13791377 * PARAMS:
    13801378 *     hOleMenu         Handle to composite menu descriptor
     
    14031401  if ( lpFrame || lpActiveObject )
    14041402  {
    1405      FIXME("(%x, %x, %x, %p, %p), Context sensitive help filtering not implemented!\n",
     1403     FIXME("(%x, %p, %p, %p, %p), Context sensitive help filtering not implemented!\n",
    14061404        (unsigned int)hOleMenu,
    14071405        hwndFrame,
     
    14241422    if ( OLEMenu_IsHookInstalled( GetCurrentThreadId() ) )
    14251423  return E_FAIL;
    1426        
     1424
    14271425    /* Get the menu descriptor */
    14281426    pOleMenuDescriptor = (OleMenuDescriptor *) GlobalLock( hOleMenu );
     
    14361434    GlobalUnlock( hOleMenu );
    14371435    pOleMenuDescriptor = NULL;
    1438    
     1436
    14391437    /* Add a menu descriptor windows property to the frame window */
    14401438    SetPropA( hwndFrame, "PROP_OLEMenuDescriptor", hOleMenu );
     
    14491447    if ( !OLEMenu_UnInstallHooks( GetCurrentThreadId() ) )
    14501448      return E_FAIL;
    1451    
     1449
    14521450    /* Remove the menu descriptor property from the frame window */
    14531451    RemovePropA( hwndFrame, "PROP_OLEMenuDescriptor" );
    14541452  }
    1455      
     1453
    14561454  return S_OK;
    14571455}
    14581456
    14591457/******************************************************************************
    1460  *              IsAccelerator        [OLE32.75]
     1458 *              IsAccelerator        [OLE32.@]
    14611459 * Mostly copied from controls/menu.c TranslateAccelerator implementation
    14621460 */
     
    14751473#endif
    14761474    {
    1477         WARN_(accel)("invalid accel handle=%04x\n", hAccel);
     1475        WARN_(accel)("invalid accel handle=%p\n", hAccel);
    14781476        return FALSE;
    14791477    }
     
    14841482        lpMsg->message != WM_CHAR)) return FALSE;
    14851483
    1486     TRACE_(accel)("hAccel=%04x, cAccelEntries=%d,"
    1487                 "msg->hwnd=%04x, msg->message=%04x, wParam=%08x, lParam=%08lx\n",
     1484    TRACE_(accel)("hAccel=%p, cAccelEntries=%d,"
     1485                "msg->hwnd=%p, msg->message=%04x, wParam=%08x, lParam=%08lx\n",
    14881486                hAccel, cAccelEntries,
    14891487                lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
     
    15371535
    15381536/***********************************************************************
    1539  * ReleaseStgMedium [OLE32.140]
     1537 * ReleaseStgMedium [OLE32.@]
    15401538 */
    15411539void WINAPI ReleaseStgMedium(
     
    15461544    case TYMED_HGLOBAL:
    15471545    {
    1548       if ( (pmedium->pUnkForRelease==0) && 
     1546      if ( (pmedium->pUnkForRelease==0) &&
    15491547           (pmedium->u.hGlobal!=0) )
    15501548        GlobalFree(pmedium->u.hGlobal);
     
    15901588    case TYMED_GDI:
    15911589    {
    1592       if ( (pmedium->pUnkForRelease==0) && 
     1590      if ( (pmedium->pUnkForRelease==0) &&
    15931591           (pmedium->u.hGlobal!=0) )
    15941592        DeleteObject(pmedium->u.hGlobal);
     
    15991597    case TYMED_MFPICT:
    16001598    {
    1601       if ( (pmedium->pUnkForRelease==0) && 
     1599      if ( (pmedium->pUnkForRelease==0) &&
    16021600           (pmedium->u.hMetaFilePict!=0) )
    16031601      {
     
    16131611    case TYMED_ENHMF:
    16141612    {
    1615       if ( (pmedium->pUnkForRelease==0) && 
     1613      if ( (pmedium->pUnkForRelease==0) &&
    16161614           (pmedium->u.hEnhMetaFile!=0) )
    16171615      {
     
    16261624      break;
    16271625  }
     1626  pmedium->tymed=TYMED_NULL;
    16281627
    16291628  /*
     
    16541653    wndClass.hbrBackground = 0;
    16551654    wndClass.lpszClassName = OLEDD_DRAGTRACKERCLASS;
    1656  
     1655
    16571656    RegisterClassA (&wndClass);
    16581657
     
    17291728  /*
    17301729   * If we get here, we have found a spot for our item. The parentNodeLink
    1731    * pointer points to the pointer that we have to modify. 
     1730   * pointer points to the pointer that we have to modify.
    17321731   * The curNode should be NULL. We just have to establish the link and Voila!
    17331732   */
     
    17761775    {
    17771776      /*
    1778        * The item was found in the list. Detach it from it's parent and 
     1777       * The item was found in the list. Detach it from it's parent and
    17791778       * re-insert it's kids in the tree.
    17801779       */
     
    18661865 */
    18671866static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
    1868                          HWND   hwnd, 
     1867                         HWND   hwnd,
    18691868                         UINT   uMsg,
    1870                          WPARAM wParam, 
     1869                         WPARAM wParam,
    18711870                         LPARAM   lParam)
    18721871{
     1872  dprintf(("OLEDD_DragTrackerWindowProc(%x, %x, %x, %x)\n", hwnd, uMsg, wParam, lParam));
    18731873  switch (uMsg)
    18741874  {
     
    18771877      LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam;
    18781878
    1879       SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams);
    1880 
    1881      
     1879      SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams);
     1880
    18821881      break;
    18831882    }
     
    18971896       * Track the movement of the mouse.
    18981897       */
     1898      #ifdef __WIN32OS2__
     1899      wParam = OLEDD_GetButtonState();
     1900      #endif
    18991901      OLEDD_TrackMouseMove(trackerInfo, mousePos, wParam);
    19001902
     
    19561958  DWORD              keyState)
    19571959{
    1958   HWND   hwndNewTarget = 0;
    1959   HRESULT  hr = S_OK;
     1960  HWND     hwndNewTarget;
     1961  HRESULT  hr;
     1962
     1963#ifdef __WIN32OS2__
     1964  TRACE("OLEDD_TrackMouseMove: %p, (%d,%d), %x\n", trackerInfo, mousePos.x, mousePos.y, keyState);
     1965#endif
    19601966
    19611967  /*
     
    19781984   * DragOver notification
    19791985   */
    1980   if ( (trackerInfo->curDragTarget != 0) && 
    1981        (trackerInfo->curDragTargetHWND==hwndNewTarget) )
     1986  if ( (trackerInfo->curDragTarget != 0) &&
     1987       (trackerInfo->curTargetHWND == hwndNewTarget) )
    19821988  {
    19831989    POINTL  mousePosParam;
    1984    
     1990
    19851991    /*
    19861992     * The documentation tells me that the coordinate should be in the target
     
    19901996    mousePosParam.x = mousePos.x;
    19911997    mousePosParam.y = mousePos.y;
    1992    
     1998
     1999#ifdef __WIN32OS2__
     2000    hr =
     2001#endif
    19932002    IDropTarget_DragOver(trackerInfo->curDragTarget,
    19942003                         keyState,
    19952004                         mousePosParam,
    19962005                         trackerInfo->pdwEffect);
     2006#ifdef __WIN32OS2__
     2007    TRACE("OLEDD_TrackMouseMove: IDropTarget_DragEnter -> %x, *pdwEffect=%x\n", hr, *trackerInfo->pdwEffect);
     2008#endif
    19972009  }
    19982010  else
    19992011  {
    20002012    DropTargetNode* newDropTargetNode = 0;
    2001    
     2013
    20022014    /*
    20032015     * If we changed window, we have to notify our old target and check for
     
    20062018    if (trackerInfo->curDragTarget!=0)
    20072019    {
     2020#ifdef __WIN32OS2__
     2021      hr =
     2022#endif
    20082023      IDropTarget_DragLeave(trackerInfo->curDragTarget);
    2009     }
    2010    
     2024#ifdef __WIN32OS2__
     2025      TRACE("OLEDD_TrackMouseMove: IDropTarget_DragLeave -> %x\n", hr);
     2026#endif
     2027    }
     2028
    20112029    /*
    20122030     * Make sure we're hovering over a window.
     
    20182036       */
    20192037      HWND nexttar = hwndNewTarget;
     2038      trackerInfo->curTargetHWND = hwndNewTarget;
     2039
    20202040      do {
    20212041        newDropTargetNode = OLEDD_FindDropTarget(nexttar);
     
    20252045      trackerInfo->curDragTargetHWND = hwndNewTarget;
    20262046      trackerInfo->curDragTarget     = newDropTargetNode ? newDropTargetNode->dropTarget : 0;
    2027      
     2047
    20282048      /*
    20292049       * If there is, notify it that we just dragged-in
     
    20412061        mousePosParam.y = mousePos.y;
    20422062       
     2063#ifdef __WIN32OS2__
     2064        hr =
     2065#endif
    20432066        IDropTarget_DragEnter(trackerInfo->curDragTarget,
    20442067                              trackerInfo->dataObject,
     
    20462069                              mousePosParam,
    20472070                              trackerInfo->pdwEffect);
     2071#ifdef __WIN32OS2__
     2072        TRACE("OLEDD_TrackMouseMove: IDropTarget_DragEnter -> %x, *pdwEffect=%x\n", hr, *trackerInfo->pdwEffect);
     2073#endif
    20482074      }
    20492075    }
     
    20542080       */
    20552081      trackerInfo->curDragTargetHWND = 0;
     2082      trackerInfo->curTargetHWND     = 0;
    20562083      trackerInfo->curDragTarget     = 0;
    20572084    }
     
    20592086
    20602087  /*
    2061    * Now that we have done that, we have to tell the source to give 
    2062    * us feedback on the work being done by the target.  If we don't 
     2088   * Now that we have done that, we have to tell the source to give
     2089   * us feedback on the work being done by the target.  If we don't
    20632090   * have a target, simulate no effect.
    20642091   */
     
    20702097  hr = IDropSource_GiveFeedback(trackerInfo->dropSource,
    20712098                                *trackerInfo->pdwEffect);
     2099#ifdef __WIN32OS2__
     2100  TRACE("OLEDD_TrackMouseMove: IDropSource_GiveFeedback *pdwEffect=%x -> %x\n", *trackerInfo->pdwEffect, hr);
     2101#endif
    20722102
    20732103  /*
     
    20792109  if (hr==DRAGDROP_S_USEDEFAULTCURSORS)
    20802110  {
    2081 #ifndef __WIN32OS2__
    2082     //SvL: This needs to be changed. Causes mouse cursor changes when
    2083     //     e.g. clicking on an item in the file open dialog
    20842111    if (*trackerInfo->pdwEffect & DROPEFFECT_MOVE)
    20852112    {
     
    20982125      SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(0)));
    20992126    }
    2100 #endif
    2101   } 
     2127  }
    21022128}
    21032129
     
    21232149  DWORD              keyState)
    21242150{
     2151#ifdef __WIN32OS2__
     2152  TRACE("OLEDD_TrackStateChange: %p (%d,%d) %x\n", trackerInfo, mousePos.x, mousePos.y, keyState);
     2153#endif
     2154
    21252155  /*
    21262156   * Ask the drop source what to do with the operation.
     
    21282158  trackerInfo->returnValue = IDropSource_QueryContinueDrag(
    21292159                               trackerInfo->dropSource,
    2130                                trackerInfo->escPressed, 
     2160                               trackerInfo->escPressed,
    21312161                               keyState);
    2132  
     2162#ifdef __WIN32OS2__
     2163  TRACE("OLEDD_TrackStateChange: IDropSource_QueryContinueDrag -> %x\n", trackerInfo->returnValue);
     2164#endif
     2165
    21332166  /*
    21342167   * All the return valued will stop the operation except the S_OK
     
    21432176
    21442177    /*
    2145      * Release the mouse in case the drop target decides to show a popup 
     2178     * Release the mouse in case the drop target decides to show a popup
    21462179     * or a menu or something.
    21472180     */
    21482181    ReleaseCapture();
    2149    
     2182
    21502183    /*
    2151      * If we end-up over a target, drop the object in the target or 
     2184     * If we end-up over a target, drop the object in the target or
    21522185     * inform the target that the operation was cancelled.
    21532186     */
     
    21572190      {
    21582191        /*
    2159          * If the source wants us to complete the operation, we tell 
     2192         * If the source wants us to complete the operation, we tell
    21602193         * the drop target that we just dropped the object in it.
    21612194         */
     
    21652198       
    21662199          /*
    2167            * The documentation tells me that the coordinate should be 
     2200           * The documentation tells me that the coordinate should be
    21682201           * in the target window's coordinate space. However, the tests
    21692202           * I made tell me the coordinates should be in screen coordinates.
     
    21712204          mousePosParam.x = mousePos.x;
    21722205          mousePosParam.y = mousePos.y;
    2173          
     2206       
    21742207          IDropTarget_Drop(trackerInfo->curDragTarget,
    21752208                           trackerInfo->dataObject,
     
    21802213        }
    21812214        /*
    2182          * If the source told us that we should cancel, fool the drop 
     2215         * If the source told us that we should cancel, fool the drop
    21832216         * target by telling it that the mouse left it's window.
    2184          * Also set the drop effect to "NONE" in case the application 
     2217         * Also set the drop effect to "NONE" in case the application
    21852218         * ignores the result of DoDragDrop.
    21862219         */
     
    21892222          *trackerInfo->pdwEffect = DROPEFFECT_NONE;
    21902223          break;
     2224
     2225#ifdef __WIN32OS2__
     2226#ifdef DEBUG
     2227        default:
     2228          TRACE("OLEDD_TrackStateChange: unknown return value %x\n", trackerInfo->returnValue);
     2229          assert(FALSE);
     2230          break;
     2231#endif
     2232#endif
    21912233      }
    21922234    }
    21932235  }
     2236#ifdef __WIN32OS2__
     2237  else  /* Read DoDragDrop() docs. This is point 5 in the remark section. */
     2238    OLEDD_TrackMouseMove(trackerInfo, mousePos, keyState);
     2239  TRACE("OLEDD_TrackStateChange: IDropSource_QueryContinueDrag -> %x\n", trackerInfo->returnValue);
     2240#endif
    21942241}
    21952242
     
    22012248 * WM_MOUSEMOVE wParam.
    22022249 */
    2203 static DWORD OLEDD_GetButtonState()
     2250static DWORD OLEDD_GetButtonState(void)
    22042251{
    22052252  BYTE  keyboardState[256];
     
    22142261    keyMask |= MK_CONTROL;
    22152262
     2263#ifdef __WIN32OS2__
     2264  if ( (keyboardState[VK_MENU] & 0x80) != 0)
     2265    keyMask |= MK_ALT;
     2266#endif
     2267
    22162268  if ( (keyboardState[VK_LBUTTON] & 0x80) !=0)
    22172269    keyMask |= MK_LBUTTON;
     
    22222274  if ( (keyboardState[VK_MBUTTON] & 0x80) !=0)
    22232275    keyMask |= MK_MBUTTON;
     2276
    22242277
    22252278  return keyMask;
     
    22352288 * params:
    22362289 *     regKey   - Key to read the default value from
    2237  *     pdwValue - Pointer to the location where the DWORD 
     2290 *     pdwValue - Pointer to the location where the DWORD
    22382291 *                value is returned. This value is not modified
    22392292 *                if the value is not found.
     
    22412294
    22422295static void OLEUTL_ReadRegistryDWORDValue(
    2243   HKEY   regKey, 
     2296  HKEY   regKey,
    22442297  DWORD* pdwValue)
    22452298{
     
    22712324  }
    22722325}
     2326
     2327
     2328/******************************************************************************
     2329 * OleDraw (OLE32.@)
     2330 *
     2331 * The operation of this function is documented literally in the WinAPI
     2332 * documentation to involve a QueryInterface for the IViewObject interface,
     2333 * followed by a call to IViewObject::Draw.
     2334 */
     2335HRESULT WINAPI OleDraw(
     2336        IUnknown *pUnk,
     2337        DWORD dwAspect,
     2338        HDC hdcDraw,
     2339        LPCRECT lprcBounds)
     2340{
     2341  HRESULT hres;
     2342  IViewObject *viewobject;
     2343
     2344  hres = IUnknown_QueryInterface(pUnk,
     2345                                 &IID_IViewObject,
     2346                                 (void**)&viewobject);
     2347
     2348  if (SUCCEEDED(hres))
     2349  {
     2350    RECTL rectl;
     2351
     2352    rectl.left = lprcBounds->left;
     2353    rectl.right = lprcBounds->right;
     2354    rectl.top = lprcBounds->top;
     2355    rectl.bottom = lprcBounds->bottom;
     2356    hres = IViewObject_Draw(viewobject, dwAspect, -1, 0, 0, 0, hdcDraw, &rectl, 0, 0, 0);
     2357
     2358    IViewObject_Release(viewobject);
     2359    return hres;
     2360  }
     2361  else
     2362  {
     2363    return DV_E_NOIVIEWOBJECT;
     2364  }
     2365}
     2366
     2367/***********************************************************************
     2368 *             OleTranslateAccelerator [OLE32.@]
     2369 */
     2370HRESULT WINAPI OleTranslateAccelerator (LPOLEINPLACEFRAME lpFrame,
     2371                   LPOLEINPLACEFRAMEINFO lpFrameInfo, LPMSG lpmsg)
     2372{
     2373    WORD wID;
     2374
     2375    TRACE("(%p,%p,%p)\n", lpFrame, lpFrameInfo, lpmsg);
     2376
     2377    if (IsAccelerator(lpFrameInfo->haccel,lpFrameInfo->cAccelEntries,lpmsg,&wID))
     2378        return IOleInPlaceFrame_TranslateAccelerator(lpFrame,lpmsg,wID);
     2379
     2380    return S_FALSE;
     2381}
     2382
     2383/******************************************************************************
     2384 *              OleCreate        [OLE32.@]
     2385 *
     2386 */
     2387HRESULT WINAPI OleCreate(
     2388        REFCLSID rclsid,
     2389        REFIID riid,
     2390        DWORD renderopt,
     2391        LPFORMATETC pFormatEtc,
     2392        LPOLECLIENTSITE pClientSite,
     2393        LPSTORAGE pStg,
     2394        LPVOID* ppvObj)
     2395{
     2396    HRESULT hres, hres1;
     2397    IUnknown * pUnk = NULL;
     2398
     2399    FIXME("\n\t%s\n\t%s semi-stub!\n", debugstr_guid(rclsid), debugstr_guid(riid));
     2400
     2401    if (SUCCEEDED((hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER|CLSCTX_LOCAL_SERVER , riid, (LPVOID*)&pUnk))))
     2402    {
     2403        if (pClientSite)
     2404        {
     2405            IOleObject * pOE;
     2406            IPersistStorage * pPS;
     2407            if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IOleObject, (LPVOID*)&pOE))))
     2408            {
     2409                TRACE("trying to set clientsite %p\n", pClientSite);
     2410                hres1 = IOleObject_SetClientSite(pOE, pClientSite);
     2411                TRACE("-- result 0x%08lx\n", hres1);
     2412                IOleObject_Release(pOE);
     2413            }
     2414            if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IPersistStorage, (LPVOID*)&pPS))))
     2415            {
     2416                TRACE("trying to set stg %p\n", pStg);
     2417                hres1 = IPersistStorage_InitNew(pPS, pStg);
     2418                TRACE("-- result 0x%08lx\n", hres1);
     2419                IPersistStorage_Release(pPS);
     2420            }
     2421        }
     2422    }
     2423
     2424    *ppvObj = pUnk;
     2425
     2426    TRACE("-- %p \n", pUnk);
     2427    return hres;
     2428}
     2429
     2430/***********************************************************************
     2431 *           OLE_FreeClipDataArray   [internal]
     2432 *
     2433 * NOTES:
     2434 *  frees the data associated with an array of CLIPDATAs
     2435 */
     2436static void OLE_FreeClipDataArray(ULONG count, CLIPDATA * pClipDataArray)
     2437{
     2438    ULONG i;
     2439    for (i = 0; i < count; i++)
     2440        if (pClipDataArray[i].pClipData)
     2441            CoTaskMemFree(pClipDataArray[i].pClipData);
     2442}
     2443
     2444HRESULT WINAPI FreePropVariantArray(ULONG,PROPVARIANT*);
     2445
     2446/***********************************************************************
     2447 *           PropVariantClear                       [OLE32.@]
     2448 */
     2449HRESULT WINAPI PropVariantClear(PROPVARIANT * pvar) /* [in/out] */
     2450{
     2451    TRACE("(%p)\n", pvar);
     2452
     2453    if (!pvar)
     2454        return S_OK;
     2455
     2456    switch(pvar->vt)
     2457    {
     2458    case VT_STREAM:
     2459    case VT_STREAMED_OBJECT:
     2460    case VT_STORAGE:
     2461    case VT_STORED_OBJECT:
     2462        IUnknown_Release((LPUNKNOWN)pvar->u.pStream);
     2463        break;
     2464    case VT_CLSID:
     2465    case VT_LPSTR:
     2466    case VT_LPWSTR:
     2467        /* pick an arbitary typed pointer - we don't care about the type
     2468         * as we are just freeing it */
     2469        CoTaskMemFree(pvar->u.puuid);
     2470        break;
     2471    case VT_BLOB:
     2472    case VT_BLOB_OBJECT:
     2473        CoTaskMemFree(pvar->u.blob.pBlobData);
     2474        break;
     2475    case VT_BSTR:
     2476        FIXME("Need to load OLEAUT32 for SysFreeString\n");
     2477        /* SysFreeString(pvar->u.bstrVal); */
     2478        break;
     2479   case VT_CF:
     2480        if (pvar->u.pclipdata)
     2481        {
     2482            OLE_FreeClipDataArray(1, pvar->u.pclipdata);
     2483            CoTaskMemFree(pvar->u.pclipdata);
     2484        }
     2485        break;
     2486    default:
     2487        if (pvar->vt & VT_ARRAY)
     2488        {
     2489            FIXME("Need to call SafeArrayDestroy\n");
     2490            /* SafeArrayDestroy(pvar->u.caub); */
     2491        }
     2492        switch (pvar->vt & VT_VECTOR)
     2493        {
     2494        case VT_VARIANT:
     2495            FreePropVariantArray(pvar->u.capropvar.cElems, pvar->u.capropvar.pElems);
     2496            break;
     2497        case VT_CF:
     2498            OLE_FreeClipDataArray(pvar->u.caclipdata.cElems, pvar->u.caclipdata.pElems);
     2499            break;
     2500        case VT_BSTR:
     2501        case VT_LPSTR:
     2502        case VT_LPWSTR:
     2503            FIXME("Freeing of vector sub-type not supported yet\n");
     2504        }
     2505        if (pvar->vt & VT_VECTOR)
     2506        {
     2507            /* pick an arbitary VT_VECTOR structure - they all have the same
     2508             * memory layout */
     2509            CoTaskMemFree(pvar->u.capropvar.pElems);
     2510        }
     2511    }
     2512
     2513    ZeroMemory(pvar, sizeof(*pvar));
     2514
     2515    return S_OK;
     2516}
     2517
     2518/***********************************************************************
     2519 *           PropVariantCopy                        [OLE32.@]
     2520 */
     2521HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest,      /* [out] */
     2522                               const PROPVARIANT *pvarSrc) /* [in] */
     2523{
     2524    ULONG len;
     2525    TRACE("(%p, %p): stub:\n", pvarDest, pvarSrc);
     2526
     2527    /* this will deal with most cases */
     2528    CopyMemory(pvarDest, pvarSrc, sizeof(*pvarDest));
     2529
     2530    switch(pvarSrc->vt)
     2531    {
     2532    case VT_STREAM:
     2533    case VT_STREAMED_OBJECT:
     2534    case VT_STORAGE:
     2535    case VT_STORED_OBJECT:
     2536        IUnknown_AddRef((LPUNKNOWN)pvarDest->u.pStream);
     2537        break;
     2538    case VT_CLSID:
     2539        pvarDest->u.puuid = CoTaskMemAlloc(sizeof(CLSID));
     2540        CopyMemory(pvarDest->u.puuid, pvarSrc->u.puuid, sizeof(CLSID));
     2541        break;
     2542    case VT_LPSTR:
     2543        len = strlen(pvarSrc->u.pszVal);
     2544        pvarDest->u.pszVal = CoTaskMemAlloc(len);
     2545        CopyMemory(pvarDest->u.pszVal, pvarSrc->u.pszVal, len);
     2546        break;
     2547    case VT_LPWSTR:
     2548        len = lstrlenW(pvarSrc->u.pwszVal);
     2549        pvarDest->u.pwszVal = CoTaskMemAlloc(len);
     2550        CopyMemory(pvarDest->u.pwszVal, pvarSrc->u.pwszVal, len);
     2551        break;
     2552    case VT_BLOB:
     2553    case VT_BLOB_OBJECT:
     2554        if (pvarSrc->u.blob.pBlobData)
     2555        {
     2556            len = pvarSrc->u.blob.cbSize;
     2557            pvarDest->u.blob.pBlobData = CoTaskMemAlloc(len);
     2558            CopyMemory(pvarDest->u.blob.pBlobData, pvarSrc->u.blob.pBlobData, len);
     2559        }
     2560        break;
     2561    case VT_BSTR:
     2562        FIXME("Need to copy BSTR\n");
     2563        break;
     2564    case VT_CF:
     2565        if (pvarSrc->u.pclipdata)
     2566        {
     2567            len = pvarSrc->u.pclipdata->cbSize - sizeof(pvarSrc->u.pclipdata->ulClipFmt);
     2568            CoTaskMemAlloc(len);
     2569            CopyMemory(pvarDest->u.pclipdata->pClipData, pvarSrc->u.pclipdata->pClipData, len);
     2570        }
     2571        break;
     2572    default:
     2573        if (pvarSrc->vt & VT_ARRAY)
     2574        {
     2575            FIXME("Need to call SafeArrayCopy\n");
     2576            /* SafeArrayCopy(...); */
     2577        }
     2578        if (pvarSrc->vt & VT_VECTOR)
     2579        {
     2580            int elemSize;
     2581            switch(pvarSrc->vt & VT_VECTOR)
     2582            {
     2583            case VT_I1:       elemSize = sizeof(pvarSrc->u.cVal); break;
     2584            case VT_UI1:      elemSize = sizeof(pvarSrc->u.bVal); break;
     2585            case VT_I2:       elemSize = sizeof(pvarSrc->u.iVal); break;
     2586            case VT_UI2:      elemSize = sizeof(pvarSrc->u.uiVal); break;
     2587            case VT_BOOL:     elemSize = sizeof(pvarSrc->u.boolVal); break;
     2588            case VT_I4:       elemSize = sizeof(pvarSrc->u.lVal); break;
     2589            case VT_UI4:      elemSize = sizeof(pvarSrc->u.ulVal); break;
     2590            case VT_R4:       elemSize = sizeof(pvarSrc->u.fltVal); break;
     2591            case VT_R8:       elemSize = sizeof(pvarSrc->u.dblVal); break;
     2592            case VT_ERROR:    elemSize = sizeof(pvarSrc->u.scode); break;
     2593            case VT_I8:       elemSize = sizeof(pvarSrc->u.hVal); break;
     2594            case VT_UI8:      elemSize = sizeof(pvarSrc->u.uhVal); break;
     2595            case VT_CY:       elemSize = sizeof(pvarSrc->u.cyVal); break;
     2596            case VT_DATE:     elemSize = sizeof(pvarSrc->u.date); break;
     2597            case VT_FILETIME: elemSize = sizeof(pvarSrc->u.filetime); break;
     2598            case VT_CLSID:    elemSize = sizeof(*pvarSrc->u.puuid); break;
     2599            case VT_CF:       elemSize = sizeof(*pvarSrc->u.pclipdata); break;
     2600
     2601            case VT_BSTR:
     2602            case VT_LPSTR:
     2603            case VT_LPWSTR:
     2604            case VT_VARIANT:
     2605            default:
     2606                FIXME("Invalid element type: %ul\n", pvarSrc->vt & VT_VECTOR);
     2607                return E_INVALIDARG;
     2608            }
     2609            len = pvarSrc->u.capropvar.cElems;
     2610            pvarDest->u.capropvar.pElems = CoTaskMemAlloc(len * elemSize);
     2611            if (pvarSrc->vt == (VT_VECTOR | VT_VARIANT))
     2612            {
     2613                ULONG i;
     2614                for (i = 0; i < len; i++)
     2615                    PropVariantCopy(&pvarDest->u.capropvar.pElems[i], &pvarSrc->u.capropvar.pElems[i]);
     2616            }
     2617            else if (pvarSrc->vt == (VT_VECTOR | VT_CF))
     2618            {
     2619                FIXME("Copy clipformats\n");
     2620            }
     2621            else if (pvarSrc->vt == (VT_VECTOR | VT_BSTR))
     2622            {
     2623                FIXME("Copy BSTRs\n");
     2624            }
     2625            else if (pvarSrc->vt == (VT_VECTOR | VT_LPSTR))
     2626            {
     2627                FIXME("Copy LPSTRs\n");
     2628            }
     2629            else if (pvarSrc->vt == (VT_VECTOR | VT_LPSTR))
     2630            {
     2631                FIXME("Copy LPWSTRs\n");
     2632            }
     2633            else
     2634                CopyMemory(pvarDest->u.capropvar.pElems, pvarSrc->u.capropvar.pElems, len * elemSize);
     2635        }
     2636    }
     2637
     2638    return S_OK;
     2639}
     2640
     2641/***********************************************************************
     2642 *           FreePropVariantArray                           [OLE32.@]
     2643 */
     2644HRESULT WINAPI FreePropVariantArray(ULONG cVariants, /* [in] */
     2645                                    PROPVARIANT *rgvars)    /* [in/out] */
     2646{
     2647    ULONG i;
     2648
     2649    TRACE("(%lu, %p)\n", cVariants, rgvars);
     2650
     2651    for(i = 0; i < cVariants; i++)
     2652        PropVariantClear(&rgvars[i]);
     2653
     2654    return S_OK;
     2655}
     2656
     2657
     2658
    22732659#ifdef __WIN32OS2__
    22742660#include <dbglog.h>
     
    22782664*/
    22792665
    2280 typedef struct 
     2666typedef struct
    22812667{
    22822668    /* IUnknown fields */
     
    22972683static HRESULT WINAPI IEnumFORMATETC_fnClone(LPENUMFORMATETC iface, LPENUMFORMATETC* ppenum);
    22982684
    2299 static struct ICOM_VTABLE(IEnumFORMATETC) efvt = 
     2685static struct ICOM_VTABLE(IEnumFORMATETC) efvt =
    23002686{
    23012687    ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     
    23432729        if(IsEqualIID(riid, &IID_IUnknown))
    23442730        {
    2345           *ppvObj = This; 
     2731          *ppvObj = This;
    23462732        }
    23472733        else if(IsEqualIID(riid, &IID_IEnumFORMATETC))
    23482734        {
    23492735          *ppvObj = (IEnumFORMATETC*)This;
    2350         }   
     2736        }
    23512737
    23522738        if(*ppvObj)
     
    23732759        TRACE("(%p)->()\n",This);
    23742760
    2375     if (!--(This->ref)) 
     2761    if (!--(This->ref))
    23762762        {
    23772763          TRACE(" destroying IEnumFORMATETC(%p)\n",This);
     
    24582844*  IDataObject_Constructor
    24592845*/
    2460 static LPDATAOBJECT IDataObject_Constructor()
     2846static LPDATAOBJECT IDataObject_Constructor(void)
    24612847{
    24622848        IDataObjectImpl* dto;
     
    24852871        if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
    24862872        {
    2487             *ppvObj = This; 
     2873            *ppvObj = This;
    24882874        }
    24892875        else if(IsEqualIID(riid, &IID_IDataObject))  /*IDataObject*/
    24902876        {
    24912877            *ppvObj = (IDataObject*)This;
    2492         }   
     2878        }
    24932879
    24942880        if(*ppvObj)
    24952881        {
    2496             IUnknown_AddRef((IUnknown*)*ppvObj);     
     2882            IUnknown_AddRef((IUnknown*)*ppvObj);
    24972883            TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
    24982884            return S_OK;
     
    25222908        dprintf(("IDataObject_fnRelease (%p)->()\n",This));
    25232909
    2524     if (!--(This->ref)) 
     2910    if (!--(This->ref))
    25252911        {
    25262912          TRACE(" destroying IDataObject(%p)\n",This);
     
    26323018        memset(pfeNew, 0, sizeof(FORMATETC) * This->cDataCount);
    26333019        memset(psmNew, 0, sizeof(STGMEDIUM) * This->cDataCount);
    2634    
     3020
    26353021        /* copy the existing data */
    26363022        if(This->pFormatEtc)
     
    26423028            memcpy(psmNew, This->pStgMedium, sizeof(STGMEDIUM) * (This->cDataCount - 1));
    26433029        }
    2644    
     3030
    26453031        /* add the new data */
    26463032        pfeNew[This->cDataCount - 1] = *pformatetc;
     
    27033089{
    27043090        ICOM_THIS(IDataObjectImpl,iface);
    2705    
     3091
    27063092    dprintf(("IDataObject_fnDUnadvise STUB"));
    27073093        return E_NOTIMPL;
     
    27103096{
    27113097        ICOM_THIS(IDataObjectImpl,iface);
    2712    
     3098
    27133099    dprintf(("IDataObject_fnEnumDAdvise STUB"));
    27143100    return OLE_E_ADVISENOTSUPPORTED;
    27153101}
    27163102
    2717 static struct ICOM_VTABLE(IDataObject) dtovt = 
     3103static struct ICOM_VTABLE(IDataObject) dtovt =
    27183104{
    27193105        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     
    27443130    do {
    27453131        pTarget = OLEDD_FindDropTarget(nexttar);
    2746     } 
     3132    }
    27473133    while(!pTarget && (nexttar = GetParent(nexttar)) != 0);
    27483134
     
    27683154    do {
    27693155        pTarget = OLEDD_FindDropTarget(nexttar);
    2770     } 
     3156    }
    27713157    while(!pTarget && (nexttar = GetParent(nexttar)) != 0);
    27723158    if(pTarget == NULL) {
    27733159        return FALSE;
    27743160    }
    2775    
     3161
    27763162    /*
    27773163     * The documentation tells me that the coordinate should be in the target
     
    27823168    mousePosParam.x = mousePos.x;
    27833169    mousePosParam.y = mousePos.y;
    2784    
     3170
    27853171    if(GetKeyState(VK_SHIFT)   & 0x8000) keyState |= MK_SHIFT;
    27863172    if(GetKeyState(VK_CONTROL) & 0x8000) keyState |= MK_CONTROL;
     
    28073193    do {
    28083194        pTarget = OLEDD_FindDropTarget(nexttar);
    2809     } 
     3195    }
    28103196    while(!pTarget && (nexttar = GetParent(nexttar)) != 0);
    28113197    if(pTarget == NULL) {
    28123198        return FALSE;
    28133199    }
    2814    
     3200
    28153201    /*
    28163202     * The documentation tells me that the coordinate should be in the target
     
    28213207    mousePosParam.x = mousePos.x;
    28223208    mousePosParam.y = mousePos.y;
    2823    
     3209
    28243210    if(GetKeyState(VK_SHIFT)   & 0x8000) keyState |= MK_SHIFT;
    28253211    if(GetKeyState(VK_CONTROL) & 0x8000) keyState |= MK_CONTROL;
     
    28463232    do {
    28473233        pTarget = OLEDD_FindDropTarget(nexttar);
    2848     } 
     3234    }
    28493235    while(!pTarget && (nexttar = GetParent(nexttar)) != 0);
    28503236    if(pTarget == NULL) {
    28513237        return FALSE;
    28523238    }
    2853    
     3239
    28543240    /*
    28553241     * The documentation tells me that the coordinate should be in the target
     
    28603246    mousePosParam.x = mousePos.x;
    28613247    mousePosParam.y = mousePos.y;
    2862    
     3248
    28633249    if(GetKeyState(VK_SHIFT)   & 0x8000) keyState |= MK_SHIFT;
    28643250    if(GetKeyState(VK_CONTROL) & 0x8000) keyState |= MK_CONTROL;
     
    28723258    fe.cfFormat = CF_HDROP;
    28733259    fe.ptd      = NULL;
    2874     fe.dwAspect = DVASPECT_CONTENT; 
     3260    fe.dwAspect = DVASPECT_CONTENT;
    28753261    fe.lindex   = -1;
    2876     fe.tymed    = TYMED_HGLOBAL; 
     3262    fe.tymed    = TYMED_HGLOBAL;
    28773263
    28783264    medium.u.hGlobal      = hDrop;
     
    29023288    do {
    29033289        pTarget = OLEDD_FindDropTarget(nexttar);
    2904     } 
     3290    }
    29053291    while(!pTarget && (nexttar = GetParent(nexttar)) != 0);
    29063292    if(pTarget == NULL) {
     
    29493335    if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
    29503336    {
    2951         *ppvObj = This; 
     3337        *ppvObj = This;
    29523338    }
    29533339    else if(IsEqualIID(riid, &IID_IDropTarget))  /*IDropTarget*/
    29543340    {
    29553341        *ppvObj = (IDropTarget*)This;
    2956     }   
     3342    }
    29573343
    29583344    if(*ppvObj)
    29593345    {
    2960         IUnknown_AddRef((IUnknown*)*ppvObj);     
     3346        IUnknown_AddRef((IUnknown*)*ppvObj);
    29613347        TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
    29623348        return S_OK;
     
    29993385            OSLibFreeDragStruct(This->lpDragStruct);
    30003386            This->lpDragStruct = NULL;
    3001         } 
    3002     }
     3387        }
     3388    }
     3389    return S_OK;
    30033390}
    30043391/**************************************************************************
     
    30223409//******************************************************************************
    30233410//******************************************************************************
    3024 static HRESULT WINAPI IDropTarget_fnDragEnter(IDropTarget *iface, IDataObject* pDataObject, 
     3411static HRESULT WINAPI IDropTarget_fnDragEnter(IDropTarget *iface, IDataObject* pDataObject,
    30253412                                DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
    30263413{
     
    30613448#endif
    30623449
    3063     for(i=0;i<sizeof(supportedformats)/sizeof(supportedformats[0]);i++) 
     3450    for(i=0;i<sizeof(supportedformats)/sizeof(supportedformats[0]);i++)
    30643451    {
    30653452        This->format.cfFormat = supportedformats[i];
    30663453        This->format.ptd      = NULL;
    3067         This->format.dwAspect = DVASPECT_CONTENT; 
     3454        This->format.dwAspect = DVASPECT_CONTENT;
    30683455        This->format.lindex   = -1;
    3069         This->format.tymed    = TYMED_HGLOBAL; 
     3456        This->format.tymed    = TYMED_HGLOBAL;
    30703457        ret = IDataObject_GetData(pDataObject, &This->format, &This->medium);
    30713458        if(ret != S_OK) {
     
    31443531        dwEffect = OSLibDragOver(This->lpDragStruct, pt.x, pt.y);
    31453532        break;
    3146     }   
     3533    }
    31473534    if(ret != S_OK) {
    31483535        dprintf(("IDataObject_GetData failed (fatal) with %x", ret));
     
    31523539        *pdwEffect = dwEffect;
    31533540    }
    3154  
     3541
    31553542    return S_OK;
    31563543}
    31573544//******************************************************************************
    31583545//******************************************************************************
    3159 static HRESULT WINAPI IDropTarget_fnDragOver(IDropTarget *iface, DWORD grfKeyState, POINTL pt, 
     3546static HRESULT WINAPI IDropTarget_fnDragOver(IDropTarget *iface, DWORD grfKeyState, POINTL pt,
    31603547                               DWORD* pdwEffect)
    31613548{
     
    31783565
    31793566    dprintf(("IDropTarget_fnDragLeave"));
    3180  
     3567
    31813568    OSLibDragLeave(This->lpDragStruct);
    31823569
     
    31863573//******************************************************************************
    31873574//******************************************************************************
    3188 static HRESULT WINAPI IDropTarget_fnDrop(IDropTarget *iface, IDataObject* pDataObject, DWORD grfKeyState, 
     3575static HRESULT WINAPI IDropTarget_fnDrop(IDropTarget *iface, IDataObject* pDataObject, DWORD grfKeyState,
    31893576                           POINTL pt, DWORD* pdwEffect)
    31903577{
     
    32033590//******************************************************************************
    32043591
    3205 static struct ICOM_VTABLE(IDropTarget) droptarget = 
     3592static struct ICOM_VTABLE(IDropTarget) droptarget =
    32063593{
    32073594        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     
    32873674
    32883675/******************************************************************************
    3289  * DllDebugObjectRPCHook (OLE32.62)
     3676 * DllDebugObjectRPCHook (OLE32.@)
    32903677 * turns on and off internal debugging,  pointer is only used on macintosh
    32913678 */
     
    32963683  return TRUE;
    32973684}
    3298 
Note: See TracChangeset for help on using the changeset viewer.