Ignore:
Timestamp:
Sep 5, 2001, 3:19:02 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

File:
1 edited

Legend:

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

    r5602 r6648  
     1/* $Id: ole2.c,v 1.2 2001-09-05 13:17:11 bird Exp $ */
    12/*
    2  *      OLE2 library
    3  *
    4  *      Copyright 1995  Martin von Loewis
     3 *  OLE2 library
     4 *
     5 *  Copyright 1995  Martin von Loewis
    56 *      Copyright 1999  Francis Beaudet
    6  *      Copyright 1999  Noel Borthwick 
     7 *      Copyright 1999  Noel Borthwick
    78 */
    89
     
    3233
    3334/******************************************************************************
    34  * These are static/global variables and internal data structures that the 
     35 * These are static/global variables and internal data structures that the
    3536 * OLE module uses to maintain it's state.
    3637 */
     
    9495
    9596/******************************************************************************
    96  * These are the prototypes of miscelaneous utility methods 
     97 * These are the prototypes of miscelaneous utility methods
    9798 */
    9899static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD* pdwValue);
     
    123124static void            OLEDD_UnInitialize();
    124125static void            OLEDD_InsertDropTarget(
    125                         DropTargetNode* nodeToAdd);
     126            DropTargetNode* nodeToAdd);
    126127static DropTargetNode* OLEDD_ExtractDropTarget(
    127128                         HWND hwndOfTarget);
     
    129130                         HWND hwndOfTarget);
    130131static LRESULT WINAPI  OLEDD_DragTrackerWindowProc(
    131                          HWND   hwnd,
    132                         UINT   uMsg,
    133                          WPARAM wParam,
    134                         LPARAM   lParam);
     132             HWND   hwnd,
     133            UINT   uMsg,
     134             WPARAM wParam,
     135            LPARAM   lParam);
    135136static void OLEDD_TrackMouseMove(
    136137                         TrackerWindowInfo* trackerInfo,
    137                         POINT            mousePos,
    138                         DWORD              keyState);
     138            POINT            mousePos,
     139            DWORD              keyState);
    139140static void OLEDD_TrackStateChange(
    140141                         TrackerWindowInfo* trackerInfo,
    141                         POINT            mousePos,
    142                         DWORD              keyState);
     142            POINT            mousePos,
     143            DWORD              keyState);
    143144static DWORD OLEDD_GetButtonState();
    144145
    145146
    146147/******************************************************************************
    147  *              OleBuildVersion [OLE2.1]
     148 *      OleBuildVersion [OLE2.1]
    148149 */
    149150DWORD WINAPI OleBuildVersion(void)
     
    168169
    169170  /*
    170    * If the CoInitializeEx call failed, the OLE libraries can't be 
     171   * If the CoInitializeEx call failed, the OLE libraries can't be
    171172   * initialized.
    172173   */
    173174  if (FAILED(hr))
    174     return hr;   
     175    return hr;
    175176
    176177  /*
     
    184185  if (OLE_moduleLockCount==0)
    185186{
    186     /* 
     187    /*
    187188     * Initialize the libraries.
    188189     */
     
    208209   * Then, we increase the lock count on the OLE module.
    209210   */
    210   OLE_moduleLockCount++; 
     211  OLE_moduleLockCount++;
    211212
    212213  return hr;
     
    214215
    215216/******************************************************************************
    216  *              CoGetCurrentProcess     [COMPOBJ.34] [OLE2.2][OLE32.108]
     217 *      CoGetCurrentProcess [COMPOBJ.34] [OLE2.2][OLE32.108]
    217218 *
    218219 * NOTES
     
    221222DWORD WINAPI CoGetCurrentProcess(void)
    222223{
    223         return GetCurrentProcessId();
     224    return GetCurrentProcessId();
    224225}
    225226
    226227/******************************************************************************
    227  *              OleUninitialize [OLE2.3] [OLE32.131]
     228 *      OleUninitialize [OLE2.3] [OLE32.131]
    228229 */
    229230void WINAPI OleUninitialize(void)
     
    255256     */
    256257    OLEDD_UnInitialize();
    257    
     258
    258259    /*
    259260     * OLE shared menu
     
    261262    OLEMenu_UnInitialize();
    262263  }
    263  
     264
    264265  /*
    265266   * Then, uninitialize the COM libraries.
     
    271272//imessagefilter.cpp
    272273/******************************************************************************
    273  *              CoRegisterMessageFilter [OLE32.38]
     274 *      CoRegisterMessageFilter [OLE32.38]
    274275 */
    275276HRESULT WINAPI CoRegisterMessageFilter(
    276     LPMESSAGEFILTER lpMessageFilter,    /* [in] Pointer to interface */
    277     LPMESSAGEFILTER *lplpMessageFilter  /* [out] Indirect pointer to prior instance if non-NULL */
     277    LPMESSAGEFILTER lpMessageFilter,    /* [in] Pointer to interface */
     278    LPMESSAGEFILTER *lplpMessageFilter  /* [out] Indirect pointer to prior instance if non-NULL */
    278279) {
    279280    FIXME("stub\n");
    280281    if (lplpMessageFilter) {
    281         *lplpMessageFilter = NULL;
     282    *lplpMessageFilter = NULL;
    282283    }
    283284    return S_OK;
     
    286287
    287288/******************************************************************************
    288  *              OleInitializeWOW        [OLE32.109]
     289 *      OleInitializeWOW    [OLE32.109]
    289290 */
    290291HRESULT WINAPI OleInitializeWOW(DWORD x) {
     
    297298 */
    298299HRESULT WINAPI RegisterDragDrop16(
    299         HWND16 hwnd,
    300         LPDROPTARGET pDropTarget
     300    HWND16 hwnd,
     301    LPDROPTARGET pDropTarget
    301302) {
    302         FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
    303         return S_OK;
     303    FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
     304    return S_OK;
    304305}
    305306
     
    308309 */
    309310HRESULT WINAPI RegisterDragDrop(
    310         HWND hwnd,
    311         LPDROPTARGET pDropTarget)
     311    HWND hwnd,
     312    LPDROPTARGET pDropTarget)
    312313{
    313314  DropTargetNode* dropTargetInfo;
     
    341342  dropTargetInfo->dropTarget  = pDropTarget;
    342343  IDropTarget_AddRef(dropTargetInfo->dropTarget);
    343  
     344
    344345  OLEDD_InsertDropTarget(dropTargetInfo);
    345346
    346         return S_OK;
     347    return S_OK;
    347348}
    348349
     
    351352 */
    352353HRESULT WINAPI RevokeDragDrop16(
    353         HWND16 hwnd
     354    HWND16 hwnd
    354355) {
    355         FIXME("(0x%04x),stub!\n",hwnd);
    356         return S_OK;
     356    FIXME("(0x%04x),stub!\n",hwnd);
     357    return S_OK;
    357358}
    358359
     
    361362 */
    362363HRESULT WINAPI RevokeDragDrop(
    363         HWND hwnd)
     364    HWND hwnd)
    364365{
    365366  DropTargetNode* dropTargetInfo;
     
    383384   */
    384385  IDropTarget_Release(dropTargetInfo->dropTarget);
    385   HeapFree(GetProcessHeap(), 0, dropTargetInfo); 
    386 
    387         return S_OK;
     386  HeapFree(GetProcessHeap(), 0, dropTargetInfo);
     387
     388    return S_OK;
    388389}
    389390
     
    396397 * way they are registered.
    397398 */
    398 HRESULT WINAPI OleRegGetUserType( 
    399         REFCLSID clsid,
    400         DWORD dwFormOfType,
    401         LPOLESTR* pszUserType)
     399HRESULT WINAPI OleRegGetUserType(
     400    REFCLSID clsid,
     401    DWORD dwFormOfType,
     402    LPOLESTR* pszUserType)
    402403{
    403404  char    keyName[60];
     
    427428   */
    428429  hres = RegOpenKeyA(HKEY_CLASSES_ROOT,
    429                      keyName,
    430                      &clsidKey);
     430             keyName,
     431             &clsidKey);
    431432
    432433  if (hres != ERROR_SUCCESS)
     
    439440
    440441  hres = RegQueryValueExA(clsidKey,
    441                           "",
    442                           NULL,
    443                           &dwKeyType,
    444                           NULL,
    445                           &cbData);
     442              "",
     443              NULL,
     444              &dwKeyType,
     445              NULL,
     446              &cbData);
    446447
    447448  if (hres!=ERROR_SUCCESS)
     
    473474
    474475  hres = RegQueryValueExA(clsidKey,
    475                           "",
    476                           NULL,
    477                           &dwKeyType,
    478                           buffer,
    479                           &cbData);
     476              "",
     477              NULL,
     478              &dwKeyType,
     479              buffer,
     480              &cbData);
    480481
    481482  RegCloseKey(clsidKey);
    482483
    483  
     484
    484485  if (hres!=ERROR_SUCCESS)
    485486  {
     
    527528
    528529  hwndTrackWindow = CreateWindowA(OLEDD_DRAGTRACKERCLASS,
    529                                     "TrackerWindow",
    530                                     WS_POPUP,
    531                                     CW_USEDEFAULT, CW_USEDEFAULT,
    532                                     CW_USEDEFAULT, CW_USEDEFAULT,
    533                                     0,
    534                                     0,
    535                                     0,
    536                                     (LPVOID)&trackerInfo);
     530                    "TrackerWindow",
     531                    WS_POPUP,
     532                    CW_USEDEFAULT, CW_USEDEFAULT,
     533                    CW_USEDEFAULT, CW_USEDEFAULT,
     534                    0,
     535                    0,
     536                    0,
     537                    (LPVOID)&trackerInfo);
    537538
    538539  if (hwndTrackWindow!=0)
     
    548549    while (!trackerInfo.trackingDone && GetMessageA(&msg, 0, 0, 0) )
    549550    {
    550       if ( (msg.message >= WM_KEYFIRST) && 
    551            (msg.message <= WM_KEYLAST) )
     551      if ( (msg.message >= WM_KEYFIRST) &&
     552       (msg.message <= WM_KEYLAST) )
    552553      {
    553         /*
    554         * When keyboard messages are sent to windows on this thread, we
    555         * want to ignore notify the drop source that the state changed.
    556         * in the case of the Escape key, we also notify the drop source
    557         * we give it a special meaning.
    558         */
    559         if ( (msg.message==WM_KEYDOWN) &&
    560              (msg.wParam==VK_ESCAPE) )
    561         {
    562           trackerInfo.escPressed = TRUE;
    563         }
    564 
    565         /*
    566         * Notify the drop source.
    567          */       
    568         OLEDD_TrackStateChange(&trackerInfo,
    569                                msg.pt,
    570                                OLEDD_GetButtonState());
     554    /*
     555    * When keyboard messages are sent to windows on this thread, we
     556    * want to ignore notify the drop source that the state changed.
     557    * in the case of the Escape key, we also notify the drop source
     558    * we give it a special meaning.
     559    */
     560    if ( (msg.message==WM_KEYDOWN) &&
     561         (msg.wParam==VK_ESCAPE) )
     562    {
     563      trackerInfo.escPressed = TRUE;
     564    }
     565
     566    /*
     567    * Notify the drop source.
     568     */
     569    OLEDD_TrackStateChange(&trackerInfo,
     570                   msg.pt,
     571                   OLEDD_GetButtonState());
    571572      }
    572573      else
    573574      {
    574         /*
    575         * Dispatch the messages only when it's not a keyboard message.
    576         */
    577         DispatchMessageA(&msg);
     575    /*
     576    * Dispatch the messages only when it's not a keyboard message.
     577    */
     578    DispatchMessageA(&msg);
    578579      }
    579580    }
     
    633634   */
    634635  result = RegOpenKeyA(HKEY_CLASSES_ROOT,
    635                        keyName,
    636                        &clsidKey);
     636               keyName,
     637               &clsidKey);
    637638
    638639  if (result != ERROR_SUCCESS)
     
    643644   */
    644645  result = RegOpenKeyA(clsidKey,
    645                        "MiscStatus",
    646                        &miscStatusKey);
    647 
    648  
     646               "MiscStatus",
     647               &miscStatusKey);
     648
     649
    649650  if (result != ERROR_SUCCESS)
    650651  {
     
    664665
    665666  result = RegOpenKeyA(miscStatusKey,
    666                        keyName,
    667                        &aspectKey);
    668  
     667               keyName,
     668               &aspectKey);
     669
    669670  if (result == ERROR_SUCCESS)
    670671  {
     
    686687 */
    687688HRESULT WINAPI OleSetContainedObject(
    688   LPUNKNOWN pUnknown, 
     689  LPUNKNOWN pUnknown,
    689690  BOOL      fContained)
    690691{
     
    695696
    696697  hres = IUnknown_QueryInterface(pUnknown,
    697                                 &IID_IRunnableObject,
    698                                 (void**)&runnable);
     698                &IID_IRunnableObject,
     699                (void**)&runnable);
    699700
    700701  if (SUCCEEDED(hres))
     
    714715 */
    715716HRESULT WINAPI OleLoad(
    716   LPSTORAGE       pStg, 
    717   REFIID          riid, 
    718   LPOLECLIENTSITE pClientSite, 
     717  LPSTORAGE       pStg,
     718  REFIID          riid,
     719  LPOLECLIENTSITE pClientSite,
    719720  LPVOID*         ppvObj)
    720721{
     
    725726
    726727  TRACE("(%p,%p,%p,%p)\n", pStg, riid, pClientSite, ppvObj);
    727  
     728
    728729  /*
    729730   * TODO, Conversion ... OleDoAutoConvert
     
    739740   */
    740741  hres = CoCreateInstance(&storageInfo.clsid,
    741                           NULL,
    742                           CLSCTX_INPROC_HANDLER,
    743                           &IID_IOleObject,
    744                           (void**)&oleObject);
     742              NULL,
     743              CLSCTX_INPROC_HANDLER,
     744              &IID_IOleObject,
     745              (void**)&oleObject);
    745746
    746747  /*
     
    751752  {
    752753    hres = OleCreateDefaultHandler(&storageInfo.clsid,
    753                                    NULL,
    754                                    &IID_IOleObject,
    755                                    (void**)&oleObject);
     754                   NULL,
     755                   &IID_IOleObject,
     756                   (void**)&oleObject);
    756757  }
    757758
     
    771772   */
    772773  hres = IOleObject_QueryInterface(oleObject,
    773                                    &IID_IPersistStorage,
    774                                    (void**)&persistStorage);
    775 
    776   if (SUCCEEDED(hres)) 
     774                   &IID_IPersistStorage,
     775                   (void**)&persistStorage);
     776
     777  if (SUCCEEDED(hres))
    777778  {
    778779    IPersistStorage_Load(persistStorage, pStg);
     
    827828  {
    828829    IStorage_Commit(pStg,
    829                     STGC_DEFAULT);
    830   }
    831  
     830            STGC_DEFAULT);
     831  }
     832
    832833  return hres;
    833834}
     
    837838 *              OleLockRunning        [OLE32.114]
    838839 */
    839 HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses) 
     840HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses)
    840841{
    841842  IRunnableObject* runnable = NULL;
     
    845846
    846847  hres = IUnknown_QueryInterface(pUnknown,
    847                                 &IID_IRunnableObject,
    848                                 (void**)&runnable);
     848                &IID_IRunnableObject,
     849                (void**)&runnable);
    849850
    850851  if (SUCCEEDED(hres))
     
    902903  pHookItem->tid = tid;
    903904  pHookItem->hHeap = GetProcessHeap();
    904  
     905
    905906  /* Install a thread scope message hook for WH_GETMESSAGE */
    906907  pHookItem->GetMsg_hHook = SetWindowsHookExA( WH_GETMESSAGE, OLEMenu_GetMsgProc,
     
    918919  pHookItem->next = hook_list;
    919920  hook_list = pHookItem;
    920  
     921
    921922  return TRUE;
    922  
     923
    923924CLEANUP:
    924925  /* Unhook any hooks */
     
    929930  /* Release the hook table entry */
    930931  HeapFree(pHookItem->hHeap, 0, pHookItem );
    931  
     932
    932933  return FALSE;
    933934}
     
    994995      return pHookItem;
    995996  }
    996  
     997
    997998  return NULL;
    998999}
     
    10151016  {
    10161017    HMENU hsubmenu;
    1017      
     1018
    10181019    /*  Is the current item a submenu? */
    10191020    if ( (hsubmenu = GetSubMenu(hMainMenu, i)) )
     
    10621063  if ( !OLEMenu_FindMainMenuIndex( pOleMenuDescriptor->hmenuCombined, hmenu,  &nPos ) )
    10631064    return FALSE;
    1064  
     1065
    10651066  /* The group widths array has counts for the number of elements
    10661067   * in the groups File, Edit, Container, Object, Window, Help.
     
    10951096  OleMenuHookItem *pHookItem = NULL;
    10961097  WORD fuFlags;
    1097  
     1098
    10981099  TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam );
    10991100
     
    11011102  if ( HC_ACTION != code )
    11021103    goto NEXTHOOK;
    1103      
     1104
    11041105  /* Retrieve the current message being dispatched from lParam */
    11051106  pMsg = (LPCWPSTRUCT)lParam;
     
    11311132      goto NEXTHOOK;
    11321133    }
    1133    
     1134
    11341135    case WM_INITMENUPOPUP:
    11351136    {
     
    11381139      break;
    11391140    }
    1140    
     1141
    11411142    case WM_MENUSELECT:
    11421143    {
     
    11511152      break;
    11521153    }
    1153    
     1154
    11541155    case WM_DRAWITEM:
    11551156    {
     
    11711172                  pMsg->message, pMsg->wParam, pMsg->lParam );
    11721173  }
    1173    
     1174
    11741175NEXTHOOK:
    11751176  if ( pOleMenuDescriptor )
    11761177    GlobalUnlock( hOleMenu );
    1177  
     1178
    11781179  /* Lookup the hook item for the current thread */
    11791180  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
     
    11831184    return 0;
    11841185  }
    1185  
     1186
    11861187  /* Pass on the message to the next hooker */
    11871188  return CallNextHookEx( pHookItem->CallWndProc_hHook, code, wParam, lParam );
     
    12001201  OleMenuHookItem *pHookItem = NULL;
    12011202  WORD wCode;
    1202  
     1203
    12031204  TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam );
    12041205
     
    12061207  if ( HC_ACTION != code )
    12071208    goto NEXTHOOK;
    1208      
     1209
    12091210  /* Retrieve the current message being dispatched from lParam */
    12101211  pMsg = (LPMSG)lParam;
     
    12451246    pMsg->hwnd = pOleMenuDescriptor->hwndActiveObject;
    12461247  }
    1247    
     1248
    12481249NEXTHOOK:
    12491250  if ( pOleMenuDescriptor )
    12501251    GlobalUnlock( hOleMenu );
    1251  
     1252
    12521253  /* Lookup the hook item for the current thread */
    12531254  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
     
    12571258    return FALSE;
    12581259  }
    1259  
     1260
    12601261  /* Pass on the message to the next hooker */
    12611262  return CallNextHookEx( pHookItem->GetMsg_hHook, code, wParam, lParam );
     
    12951296  for ( i = 0; i < 6; i++ )
    12961297    pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i];
    1297  
     1298
    12981299  pOleMenuDescriptor->hmenuCombined = hmenuCombined;
    12991300  pOleMenuDescriptor->bIsServerItem = FALSE;
    13001301  GlobalUnlock( hOleMenu );
    1301      
     1302
    13021303  return hOleMenu;
    13031304}
     
    13121313  if ( hmenuDescriptor )
    13131314    GlobalFree( hmenuDescriptor );
    1314         return S_OK;
     1315    return S_OK;
    13151316}
    13161317
     
    13211322 * OLE should install context sensitive help F1 filtering for the app when
    13221323 * these are non null.
    1323  * 
     1324 *
    13241325 * PARAMS:
    13251326 *     hOleMenu         Handle to composite menu descriptor
     
    13491350  {
    13501351     FIXME("(%x, %x, %x, %p, %p), Context sensitive help filtering not implemented!\n",
    1351         (unsigned int)hOleMenu,
    1352         hwndFrame,
    1353         hwndActiveObject,
    1354         lpFrame,
    1355         lpActiveObject);
     1352    (unsigned int)hOleMenu,
     1353    hwndFrame,
     1354    hwndActiveObject,
     1355    lpFrame,
     1356    lpActiveObject);
    13561357  }
    13571358
     
    13691370    if ( OLEMenu_IsHookInstalled( GetCurrentThreadId() ) )
    13701371  return E_FAIL;
    1371        
     1372
    13721373    /* Get the menu descriptor */
    13731374    pOleMenuDescriptor = (OleMenuDescriptor *) GlobalLock( hOleMenu );
     
    13811382    GlobalUnlock( hOleMenu );
    13821383    pOleMenuDescriptor = NULL;
    1383    
     1384
    13841385    /* Add a menu descriptor windows property to the frame window */
    13851386    SetPropA( hwndFrame, "PROP_OLEMenuDescriptor", hOleMenu );
     
    13941395    if ( !OLEMenu_UnInstallHooks( GetCurrentThreadId() ) )
    13951396      return E_FAIL;
    1396    
     1397
    13971398    /* Remove the menu descriptor property from the frame window */
    13981399    RemovePropA( hwndFrame, "PROP_OLEMenuDescriptor" );
    13991400  }
    1400      
     1401
    14011402  return S_OK;
    14021403}
     
    14191420#endif
    14201421    {
    1421         WARN_(accel)("invalid accel handle=%04x\n", hAccel);
    1422         return FALSE;
     1422    WARN_(accel)("invalid accel handle=%04x\n", hAccel);
     1423    return FALSE;
    14231424    }
    14241425    if((lpMsg->message != WM_KEYDOWN &&
    1425         lpMsg->message != WM_KEYUP &&
    1426         lpMsg->message != WM_SYSKEYDOWN &&
    1427         lpMsg->message != WM_SYSKEYUP &&
    1428         lpMsg->message != WM_CHAR)) return FALSE;
     1426    lpMsg->message != WM_KEYUP &&
     1427    lpMsg->message != WM_SYSKEYDOWN &&
     1428    lpMsg->message != WM_SYSKEYUP &&
     1429    lpMsg->message != WM_CHAR)) return FALSE;
    14291430
    14301431    TRACE_(accel)("hAccel=%04x, cAccelEntries=%d,"
    1431                 "msg->hwnd=%04x, msg->message=%04x, wParam=%08x, lParam=%08lx\n",
    1432                 hAccel, cAccelEntries,
    1433                 lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
     1432        "msg->hwnd=%04x, msg->message=%04x, wParam=%08x, lParam=%08lx\n",
     1433        hAccel, cAccelEntries,
     1434        lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
    14341435    for(i = 0; i < cAccelEntries; i++)
    14351436    {
    1436         if(lpAccelTbl[i].key != lpMsg->wParam)
    1437             continue;
    1438 
    1439         if(lpMsg->message == WM_CHAR)
    1440         {
    1441             if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY))
    1442             {
    1443                 TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", lpMsg->wParam & 0xff);
    1444                 goto found;
    1445             }
    1446         }
    1447         else
    1448         {
    1449             if(lpAccelTbl[i].fVirt & FVIRTKEY)
    1450             {
    1451                 INT mask = 0;
    1452                 TRACE_(accel)("found accel for virt_key %04x (scan %04x)\n",
    1453                                 lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff);
    1454                 if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
    1455                 if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
    1456                 if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
    1457                 if(mask == (lpAccelTbl[i].fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
    1458                 TRACE_(accel)("incorrect SHIFT/CTRL/ALT-state\n");
    1459             }
    1460             else
    1461             {
    1462                 if(!(lpMsg->lParam & 0x01000000))  /* no special_key */
    1463                 {
    1464                     if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000))
    1465                     {                                                  /* ^^ ALT pressed */
    1466                         TRACE_(accel)("found accel for Alt-%c\n", lpMsg->wParam & 0xff);
    1467                         goto found;
    1468                     }
    1469                 }
    1470             }
    1471         }
    1472     }   
     1437    if(lpAccelTbl[i].key != lpMsg->wParam)
     1438        continue;
     1439
     1440    if(lpMsg->message == WM_CHAR)
     1441    {
     1442        if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY))
     1443        {
     1444        TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", lpMsg->wParam & 0xff);
     1445        goto found;
     1446        }
     1447    }
     1448    else
     1449    {
     1450        if(lpAccelTbl[i].fVirt & FVIRTKEY)
     1451        {
     1452        INT mask = 0;
     1453        TRACE_(accel)("found accel for virt_key %04x (scan %04x)\n",
     1454                lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff);
     1455        if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
     1456        if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
     1457        if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
     1458        if(mask == (lpAccelTbl[i].fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
     1459        TRACE_(accel)("incorrect SHIFT/CTRL/ALT-state\n");
     1460        }
     1461        else
     1462        {
     1463        if(!(lpMsg->lParam & 0x01000000))  /* no special_key */
     1464        {
     1465            if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000))
     1466            {                              /* ^^ ALT pressed */
     1467            TRACE_(accel)("found accel for Alt-%c\n", lpMsg->wParam & 0xff);
     1468            goto found;
     1469            }
     1470        }
     1471        }
     1472    }
     1473    }
    14731474
    14741475    WARN_(accel)("couldn't translate accelerator key\n");
     
    14901491    case TYMED_HGLOBAL:
    14911492    {
    1492       if ( (pmedium->pUnkForRelease==0) && 
    1493            (pmedium->u.hGlobal!=0) )
    1494         GlobalFree(pmedium->u.hGlobal);
     1493      if ( (pmedium->pUnkForRelease==0) &&
     1494       (pmedium->u.hGlobal!=0) )
     1495    GlobalFree(pmedium->u.hGlobal);
    14951496
    14961497      pmedium->u.hGlobal = 0;
     
    15011502      if (pmedium->u.lpszFileName!=0)
    15021503      {
    1503         if (pmedium->pUnkForRelease==0)
    1504         {
    1505           DeleteFileW(pmedium->u.lpszFileName);
    1506         }
    1507        
    1508         CoTaskMemFree(pmedium->u.lpszFileName);
     1504    if (pmedium->pUnkForRelease==0)
     1505    {
     1506      DeleteFileW(pmedium->u.lpszFileName);
     1507    }
     1508
     1509    CoTaskMemFree(pmedium->u.lpszFileName);
    15091510      }
    15101511
     
    15161517      if (pmedium->u.pstm!=0)
    15171518      {
    1518         IStream_Release(pmedium->u.pstm);
     1519    IStream_Release(pmedium->u.pstm);
    15191520      }
    15201521
     
    15261527      if (pmedium->u.pstg!=0)
    15271528      {
    1528         IStorage_Release(pmedium->u.pstg);
     1529    IStorage_Release(pmedium->u.pstg);
    15291530      }
    15301531
     
    15341535    case TYMED_GDI:
    15351536    {
    1536       if ( (pmedium->pUnkForRelease==0) && 
    1537            (pmedium->u.hGlobal!=0) )
    1538         DeleteObject(pmedium->u.hGlobal);
     1537      if ( (pmedium->pUnkForRelease==0) &&
     1538       (pmedium->u.hGlobal!=0) )
     1539    DeleteObject(pmedium->u.hGlobal);
    15391540
    15401541      pmedium->u.hGlobal = 0;
     
    15431544    case TYMED_MFPICT:
    15441545    {
    1545       if ( (pmedium->pUnkForRelease==0) && 
    1546            (pmedium->u.hMetaFilePict!=0) )
     1546      if ( (pmedium->pUnkForRelease==0) &&
     1547       (pmedium->u.hMetaFilePict!=0) )
    15471548      {
    1548         LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hMetaFilePict);
    1549         DeleteMetaFile(pMP->hMF);
    1550         GlobalUnlock(pmedium->u.hMetaFilePict);
    1551         GlobalFree(pmedium->u.hMetaFilePict);
     1549    LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hMetaFilePict);
     1550    DeleteMetaFile(pMP->hMF);
     1551    GlobalUnlock(pmedium->u.hMetaFilePict);
     1552    GlobalFree(pmedium->u.hMetaFilePict);
    15521553      }
    15531554
     
    15571558    case TYMED_ENHMF:
    15581559    {
    1559       if ( (pmedium->pUnkForRelease==0) && 
    1560            (pmedium->u.hEnhMetaFile!=0) )
     1560      if ( (pmedium->pUnkForRelease==0) &&
     1561       (pmedium->u.hEnhMetaFile!=0) )
    15611562      {
    1562         DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);
     1563    DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);
    15631564      }
    15641565
     
    15981599    wndClass.hbrBackground = 0;
    15991600    wndClass.lpszClassName = OLEDD_DRAGTRACKERCLASS;
    1600  
     1601
    16011602    RegisterClassA (&wndClass);
    16021603}
     
    16641665  /*
    16651666   * If we get here, we have found a spot for our item. The parentNodeLink
    1666    * pointer points to the pointer that we have to modify. 
     1667   * pointer points to the pointer that we have to modify.
    16671668   * The curNode should be NULL. We just have to establish the link and Voila!
    16681669   */
     
    17111712    {
    17121713      /*
    1713        * The item was found in the list. Detach it from it's parent and 
     1714       * The item was found in the list. Detach it from it's parent and
    17141715       * re-insert it's kids in the tree.
    17151716       */
     
    17271728      if (curNode->nextDropTarget!=NULL)
    17281729      {
    1729         OLEDD_InsertDropTarget(curNode->nextDropTarget);
     1730    OLEDD_InsertDropTarget(curNode->nextDropTarget);
    17301731      }
    17311732
     
    18011802 */
    18021803static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
    1803                          HWND   hwnd,
    1804                         UINT   uMsg,
    1805                          WPARAM wParam,
    1806                         LPARAM   lParam)
     1804             HWND   hwnd,
     1805            UINT   uMsg,
     1806             WPARAM wParam,
     1807            LPARAM   lParam)
    18071808{
    18081809  switch (uMsg)
     
    18121813      LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam;
    18131814
    1814       SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams); 
    1815 
    1816      
     1815      SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams);
     1816
     1817
    18171818      break;
    18181819    }
     
    19091910   * DragOver notification
    19101911   */
    1911   if ( (trackerInfo->curDragTarget != 0) && 
     1912  if ( (trackerInfo->curDragTarget != 0) &&
    19121913       (trackerInfo->curDragTargetHWND==hwndNewTarget) )
    19131914  {
    19141915    POINTL  mousePosParam;
    1915    
     1916
    19161917    /*
    19171918     * The documentation tells me that the coordinate should be in the target
     
    19211922    mousePosParam.x = mousePos.x;
    19221923    mousePosParam.y = mousePos.y;
    1923    
     1924
    19241925    IDropTarget_DragOver(trackerInfo->curDragTarget,
    1925                         keyState,
    1926                         mousePosParam,
    1927                         trackerInfo->pdwEffect);
     1926            keyState,
     1927            mousePosParam,
     1928            trackerInfo->pdwEffect);
    19281929  }
    19291930  else
    19301931  {
    19311932    DropTargetNode* newDropTargetNode = 0;
    1932    
     1933
    19331934    /*
    19341935     * If we changed window, we have to notify our old target and check for
     
    19391940      IDropTarget_DragLeave(trackerInfo->curDragTarget);
    19401941    }
    1941    
     1942
    19421943    /*
    19431944     * Make sure we're hovering over a window.
     
    19501951      HWND nexttar = hwndNewTarget;
    19511952      do {
    1952         newDropTargetNode = OLEDD_FindDropTarget(nexttar);
     1953    newDropTargetNode = OLEDD_FindDropTarget(nexttar);
    19531954      } while (!newDropTargetNode && (nexttar = GetParent(nexttar)) != 0);
    19541955      if(nexttar) hwndNewTarget = nexttar;
     
    19561957      trackerInfo->curDragTargetHWND = hwndNewTarget;
    19571958      trackerInfo->curDragTarget     = newDropTargetNode ? newDropTargetNode->dropTarget : 0;
    1958      
     1959
    19591960      /*
    19601961       * If there is, notify it that we just dragged-in
     
    19621963      if (trackerInfo->curDragTarget!=0)
    19631964      {
    1964         POINTL  mousePosParam;
    1965        
    1966         /*
    1967         * The documentation tells me that the coordinate should be in the target
    1968         * window's coordinate space. However, the tests I made tell me the
    1969         * coordinates should be in screen coordinates.
    1970         */
    1971         mousePosParam.x = mousePos.x;
    1972         mousePosParam.y = mousePos.y;
    1973        
    1974         IDropTarget_DragEnter(trackerInfo->curDragTarget,
    1975                               trackerInfo->dataObject,
    1976                               keyState,
    1977                               mousePosParam,
    1978                               trackerInfo->pdwEffect);
     1965    POINTL  mousePosParam;
     1966
     1967    /*
     1968    * The documentation tells me that the coordinate should be in the target
     1969    * window's coordinate space. However, the tests I made tell me the
     1970    * coordinates should be in screen coordinates.
     1971    */
     1972    mousePosParam.x = mousePos.x;
     1973    mousePosParam.y = mousePos.y;
     1974
     1975    IDropTarget_DragEnter(trackerInfo->curDragTarget,
     1976                  trackerInfo->dataObject,
     1977                  keyState,
     1978                  mousePosParam,
     1979                  trackerInfo->pdwEffect);
    19791980      }
    19801981    }
     
    19901991
    19911992  /*
    1992    * Now that we have done that, we have to tell the source to give 
    1993    * us feedback on the work being done by the target.  If we don't 
     1993   * Now that we have done that, we have to tell the source to give
     1994   * us feedback on the work being done by the target.  If we don't
    19941995   * have a target, simulate no effect.
    19951996   */
     
    20002001
    20012002  hr = IDropSource_GiveFeedback(trackerInfo->dropSource,
    2002                                 *trackerInfo->pdwEffect);
     2003                *trackerInfo->pdwEffect);
    20032004
    20042005  /*
     
    20262027      SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(0)));
    20272028    }
    2028   } 
     2029  }
    20292030}
    20302031
     
    20542055   */
    20552056  trackerInfo->returnValue = IDropSource_QueryContinueDrag(
    2056                                trackerInfo->dropSource,
    2057                                trackerInfo->escPressed,
    2058                                keyState);
    2059  
     2057                   trackerInfo->dropSource,
     2058                   trackerInfo->escPressed,
     2059                   keyState);
     2060
    20602061  /*
    20612062   * All the return valued will stop the operation except the S_OK
     
    20702071
    20712072    /*
    2072      * Release the mouse in case the drop target decides to show a popup 
     2073     * Release the mouse in case the drop target decides to show a popup
    20732074     * or a menu or something.
    20742075     */
    20752076    ReleaseCapture();
    2076    
     2077
    20772078    /*
    2078      * If we end-up over a target, drop the object in the target or 
     2079     * If we end-up over a target, drop the object in the target or
    20792080     * inform the target that the operation was cancelled.
    20802081     */
     
    20832084      switch (trackerInfo->returnValue)
    20842085      {
    2085         /*
    2086          * If the source wants us to complete the operation, we tell
    2087         * the drop target that we just dropped the object in it.
    2088         */
     2086    /*
     2087     * If the source wants us to complete the operation, we tell
     2088    * the drop target that we just dropped the object in it.
     2089    */
    20892090        case DRAGDROP_S_DROP:
    2090         {
    2091           POINTL  mousePosParam;
    2092        
    2093           /*
    2094            * The documentation tells me that the coordinate should be
    2095            * in the target window's coordinate space. However, the tests
    2096            * I made tell me the coordinates should be in screen coordinates.
    2097            */
    2098           mousePosParam.x = mousePos.x;
    2099           mousePosParam.y = mousePos.y;
    2100          
    2101           IDropTarget_Drop(trackerInfo->curDragTarget,
    2102                            trackerInfo->dataObject,
    2103                            keyState,
    2104                            mousePosParam,
    2105                            trackerInfo->pdwEffect);
    2106           break;
    2107         }
    2108         /*
    2109          * If the source told us that we should cancel, fool the drop
    2110         * target by telling it that the mouse left it's window.
    2111          * Also set the drop effect to "NONE" in case the application
    2112         * ignores the result of DoDragDrop.
    2113         */
     2091    {
     2092      POINTL  mousePosParam;
     2093
     2094      /*
     2095       * The documentation tells me that the coordinate should be
     2096       * in the target window's coordinate space. However, the tests
     2097       * I made tell me the coordinates should be in screen coordinates.
     2098       */
     2099      mousePosParam.x = mousePos.x;
     2100      mousePosParam.y = mousePos.y;
     2101
     2102      IDropTarget_Drop(trackerInfo->curDragTarget,
     2103               trackerInfo->dataObject,
     2104               keyState,
     2105               mousePosParam,
     2106               trackerInfo->pdwEffect);
     2107      break;
     2108    }
     2109    /*
     2110     * If the source told us that we should cancel, fool the drop
     2111    * target by telling it that the mouse left it's window.
     2112     * Also set the drop effect to "NONE" in case the application
     2113    * ignores the result of DoDragDrop.
     2114    */
    21142115        case DRAGDROP_S_CANCEL:
    2115           IDropTarget_DragLeave(trackerInfo->curDragTarget);
    2116           *trackerInfo->pdwEffect = DROPEFFECT_NONE;
    2117           break;
     2116      IDropTarget_DragLeave(trackerInfo->curDragTarget);
     2117      *trackerInfo->pdwEffect = DROPEFFECT_NONE;
     2118      break;
    21182119      }
    21192120    }
     
    21622163 * params:
    21632164 *     regKey   - Key to read the default value from
    2164  *     pdwValue - Pointer to the location where the DWORD 
     2165 *     pdwValue - Pointer to the location where the DWORD
    21652166 *                value is returned. This value is not modified
    21662167 *                if the value is not found.
     
    21682169
    21692170static void OLEUTL_ReadRegistryDWORDValue(
    2170   HKEY   regKey, 
     2171  HKEY   regKey,
    21712172  DWORD* pdwValue)
    21722173{
     
    21772178
    21782179  lres = RegQueryValueExA(regKey,
    2179                           "",
    2180                           NULL,
    2181                           &dwKeyType,
    2182                           (LPBYTE)buffer,
    2183                           &cbData);
     2180              "",
     2181              NULL,
     2182              &dwKeyType,
     2183              (LPBYTE)buffer,
     2184              &cbData);
    21842185
    21852186  if (lres==ERROR_SUCCESS)
     
    21882189    {
    21892190      case REG_DWORD:
    2190         *pdwValue = *(DWORD*)buffer;
    2191         break;
     2191    *pdwValue = *(DWORD*)buffer;
     2192    break;
    21922193      case REG_EXPAND_SZ:
    21932194      case REG_MULTI_SZ:
    21942195      case REG_SZ:
    2195         *pdwValue = (DWORD)strtoul(buffer, NULL, 10);
    2196         break;
     2196    *pdwValue = (DWORD)strtoul(buffer, NULL, 10);
     2197    break;
    21972198    }
    21982199  }
     
    22092210 */
    22102211HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(
    2211         HICON16 hIcon,
    2212         LPCOLESTR16 lpszLabel,
    2213         LPCOLESTR16 lpszSourceFile,
    2214         UINT16 iIconIndex
     2212    HICON16 hIcon,
     2213    LPCOLESTR16 lpszLabel,
     2214    LPCOLESTR16 lpszSourceFile,
     2215    UINT16 iIconIndex
    22152216) {
    22162217    METAFILEPICT16 *mf;
     
    22222223    if (!hIcon) {
    22232224        if (lpszSourceFile) {
    2224             HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile);
    2225 
    2226             /* load the icon at index from lpszSourceFile */
    2227             hIcon = (HICON16)LoadIconA(hInstance, (LPCSTR)(DWORD)iIconIndex);
    2228             FreeLibrary16(hInstance);
    2229         } else
    2230             return (HGLOBAL)NULL;
     2225        HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile);
     2226
     2227        /* load the icon at index from lpszSourceFile */
     2228        hIcon = (HICON16)LoadIconA(hInstance, (LPCSTR)(DWORD)iIconIndex);
     2229        FreeLibrary16(hInstance);
     2230    } else
     2231        return (HGLOBAL)NULL;
    22312232    }
    22322233
Note: See TracChangeset for help on using the changeset viewer.