Ignore:
Timestamp:
Sep 15, 2001, 11:32:00 AM (24 years ago)
Author:
sandervl
Message:

restored old version + wine update

File:
1 edited

Legend:

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

    r6648 r6711  
    1 /* $Id: ole2.c,v 1.2 2001-09-05 13:17:11 bird Exp $ */
    21/*
    3  *  OLE2 library
    4  *
    5  *  Copyright 1995  Martin von Loewis
     2 *      OLE2 library
     3 *
     4 *      Copyright 1995  Martin von Loewis
    65 *      Copyright 1999  Francis Beaudet
    7  *      Copyright 1999  Noel Borthwick
     6 *      Copyright 1999  Noel Borthwick 
    87 */
    98
     
    3332
    3433/******************************************************************************
    35  * These are static/global variables and internal data structures that the
     34 * These are static/global variables and internal data structures that the 
    3635 * OLE module uses to maintain it's state.
    3736 */
     
    9594
    9695/******************************************************************************
    97  * These are the prototypes of miscelaneous utility methods
     96 * These are the prototypes of miscelaneous utility methods 
    9897 */
    9998static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD* pdwValue);
     
    124123static void            OLEDD_UnInitialize();
    125124static void            OLEDD_InsertDropTarget(
    126             DropTargetNode* nodeToAdd);
     125                        DropTargetNode* nodeToAdd);
    127126static DropTargetNode* OLEDD_ExtractDropTarget(
    128127                         HWND hwndOfTarget);
     
    130129                         HWND hwndOfTarget);
    131130static LRESULT WINAPI  OLEDD_DragTrackerWindowProc(
    132              HWND   hwnd,
    133             UINT   uMsg,
    134              WPARAM wParam,
    135             LPARAM   lParam);
     131                         HWND   hwnd,
     132                        UINT   uMsg,
     133                         WPARAM wParam,
     134                        LPARAM   lParam);
    136135static void OLEDD_TrackMouseMove(
    137136                         TrackerWindowInfo* trackerInfo,
    138             POINT            mousePos,
    139             DWORD              keyState);
     137                        POINT            mousePos,
     138                        DWORD              keyState);
    140139static void OLEDD_TrackStateChange(
    141140                         TrackerWindowInfo* trackerInfo,
    142             POINT            mousePos,
    143             DWORD              keyState);
     141                        POINT            mousePos,
     142                        DWORD              keyState);
    144143static DWORD OLEDD_GetButtonState();
    145144
    146145
    147146/******************************************************************************
    148  *      OleBuildVersion [OLE2.1]
     147 *              OleBuildVersion [OLE2.1]
    149148 */
    150149DWORD WINAPI OleBuildVersion(void)
     
    169168
    170169  /*
    171    * If the CoInitializeEx call failed, the OLE libraries can't be
     170   * If the CoInitializeEx call failed, the OLE libraries can't be 
    172171   * initialized.
    173172   */
    174173  if (FAILED(hr))
    175     return hr;
     174    return hr;   
    176175
    177176  /*
     
    185184  if (OLE_moduleLockCount==0)
    186185{
    187     /*
     186    /* 
    188187     * Initialize the libraries.
    189188     */
     
    209208   * Then, we increase the lock count on the OLE module.
    210209   */
    211   OLE_moduleLockCount++;
     210  OLE_moduleLockCount++; 
    212211
    213212  return hr;
     
    215214
    216215/******************************************************************************
    217  *      CoGetCurrentProcess [COMPOBJ.34] [OLE2.2][OLE32.108]
     216 *              CoGetCurrentProcess     [COMPOBJ.34] [OLE2.2][OLE32.108]
    218217 *
    219218 * NOTES
     
    222221DWORD WINAPI CoGetCurrentProcess(void)
    223222{
    224     return GetCurrentProcessId();
     223        return GetCurrentProcessId();
    225224}
    226225
    227226/******************************************************************************
    228  *      OleUninitialize [OLE2.3] [OLE32.131]
     227 *              OleUninitialize [OLE2.3] [OLE32.131]
    229228 */
    230229void WINAPI OleUninitialize(void)
     
    256255     */
    257256    OLEDD_UnInitialize();
    258 
     257   
    259258    /*
    260259     * OLE shared menu
     
    262261    OLEMenu_UnInitialize();
    263262  }
    264 
     263 
    265264  /*
    266265   * Then, uninitialize the COM libraries.
     
    272271//imessagefilter.cpp
    273272/******************************************************************************
    274  *      CoRegisterMessageFilter [OLE32.38]
     273 *              CoRegisterMessageFilter [OLE32.38]
    275274 */
    276275HRESULT WINAPI CoRegisterMessageFilter(
    277     LPMESSAGEFILTER lpMessageFilter,    /* [in] Pointer to interface */
    278     LPMESSAGEFILTER *lplpMessageFilter  /* [out] Indirect pointer to prior instance if non-NULL */
     276    LPMESSAGEFILTER lpMessageFilter,    /* [in] Pointer to interface */
     277    LPMESSAGEFILTER *lplpMessageFilter  /* [out] Indirect pointer to prior instance if non-NULL */
    279278) {
    280279    FIXME("stub\n");
    281280    if (lplpMessageFilter) {
    282     *lplpMessageFilter = NULL;
     281        *lplpMessageFilter = NULL;
    283282    }
    284283    return S_OK;
     
    287286
    288287/******************************************************************************
    289  *      OleInitializeWOW    [OLE32.109]
     288 *              OleInitializeWOW        [OLE32.109]
    290289 */
    291290HRESULT WINAPI OleInitializeWOW(DWORD x) {
     
    298297 */
    299298HRESULT WINAPI RegisterDragDrop16(
    300     HWND16 hwnd,
    301     LPDROPTARGET pDropTarget
     299        HWND16 hwnd,
     300        LPDROPTARGET pDropTarget
    302301) {
    303     FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
    304     return S_OK;
     302        FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
     303        return S_OK;
    305304}
    306305
     
    309308 */
    310309HRESULT WINAPI RegisterDragDrop(
    311     HWND hwnd,
    312     LPDROPTARGET pDropTarget)
     310        HWND hwnd,
     311        LPDROPTARGET pDropTarget)
    313312{
    314313  DropTargetNode* dropTargetInfo;
     
    342341  dropTargetInfo->dropTarget  = pDropTarget;
    343342  IDropTarget_AddRef(dropTargetInfo->dropTarget);
    344 
     343 
    345344  OLEDD_InsertDropTarget(dropTargetInfo);
    346345
    347     return S_OK;
     346        return S_OK;
    348347}
    349348
     
    352351 */
    353352HRESULT WINAPI RevokeDragDrop16(
    354     HWND16 hwnd
     353        HWND16 hwnd
    355354) {
    356     FIXME("(0x%04x),stub!\n",hwnd);
    357     return S_OK;
     355        FIXME("(0x%04x),stub!\n",hwnd);
     356        return S_OK;
    358357}
    359358
     
    362361 */
    363362HRESULT WINAPI RevokeDragDrop(
    364     HWND hwnd)
     363        HWND hwnd)
    365364{
    366365  DropTargetNode* dropTargetInfo;
     
    384383   */
    385384  IDropTarget_Release(dropTargetInfo->dropTarget);
    386   HeapFree(GetProcessHeap(), 0, dropTargetInfo);
    387 
    388     return S_OK;
     385  HeapFree(GetProcessHeap(), 0, dropTargetInfo); 
     386
     387        return S_OK;
    389388}
    390389
     
    397396 * way they are registered.
    398397 */
    399 HRESULT WINAPI OleRegGetUserType(
    400     REFCLSID clsid,
    401     DWORD dwFormOfType,
    402     LPOLESTR* pszUserType)
     398HRESULT WINAPI OleRegGetUserType( 
     399        REFCLSID clsid,
     400        DWORD dwFormOfType,
     401        LPOLESTR* pszUserType)
    403402{
    404403  char    keyName[60];
     
    428427   */
    429428  hres = RegOpenKeyA(HKEY_CLASSES_ROOT,
    430              keyName,
    431              &clsidKey);
     429                     keyName,
     430                     &clsidKey);
    432431
    433432  if (hres != ERROR_SUCCESS)
     
    440439
    441440  hres = RegQueryValueExA(clsidKey,
    442               "",
    443               NULL,
    444               &dwKeyType,
    445               NULL,
    446               &cbData);
     441                          "",
     442                          NULL,
     443                          &dwKeyType,
     444                          NULL,
     445                          &cbData);
    447446
    448447  if (hres!=ERROR_SUCCESS)
     
    474473
    475474  hres = RegQueryValueExA(clsidKey,
    476               "",
    477               NULL,
    478               &dwKeyType,
    479               buffer,
    480               &cbData);
     475                          "",
     476                          NULL,
     477                          &dwKeyType,
     478                          buffer,
     479                          &cbData);
    481480
    482481  RegCloseKey(clsidKey);
    483482
    484 
     483 
    485484  if (hres!=ERROR_SUCCESS)
    486485  {
     
    528527
    529528  hwndTrackWindow = CreateWindowA(OLEDD_DRAGTRACKERCLASS,
    530                     "TrackerWindow",
    531                     WS_POPUP,
    532                     CW_USEDEFAULT, CW_USEDEFAULT,
    533                     CW_USEDEFAULT, CW_USEDEFAULT,
    534                     0,
    535                     0,
    536                     0,
    537                     (LPVOID)&trackerInfo);
     529                                    "TrackerWindow",
     530                                    WS_POPUP,
     531                                    CW_USEDEFAULT, CW_USEDEFAULT,
     532                                    CW_USEDEFAULT, CW_USEDEFAULT,
     533                                    0,
     534                                    0,
     535                                    0,
     536                                    (LPVOID)&trackerInfo);
    538537
    539538  if (hwndTrackWindow!=0)
     
    549548    while (!trackerInfo.trackingDone && GetMessageA(&msg, 0, 0, 0) )
    550549    {
    551       if ( (msg.message >= WM_KEYFIRST) &&
    552        (msg.message <= WM_KEYLAST) )
     550      if ( (msg.message >= WM_KEYFIRST) && 
     551           (msg.message <= WM_KEYLAST) )
    553552      {
    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());
     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());
    572571      }
    573572      else
    574573      {
    575     /*
    576     * Dispatch the messages only when it's not a keyboard message.
    577     */
    578     DispatchMessageA(&msg);
     574        /*
     575        * Dispatch the messages only when it's not a keyboard message.
     576        */
     577        DispatchMessageA(&msg);
    579578      }
    580579    }
     
    634633   */
    635634  result = RegOpenKeyA(HKEY_CLASSES_ROOT,
    636                keyName,
    637                &clsidKey);
     635                       keyName,
     636                       &clsidKey);
    638637
    639638  if (result != ERROR_SUCCESS)
     
    644643   */
    645644  result = RegOpenKeyA(clsidKey,
    646                "MiscStatus",
    647                &miscStatusKey);
    648 
    649 
     645                       "MiscStatus",
     646                       &miscStatusKey);
     647
     648 
    650649  if (result != ERROR_SUCCESS)
    651650  {
     
    665664
    666665  result = RegOpenKeyA(miscStatusKey,
    667                keyName,
    668                &aspectKey);
    669 
     666                       keyName,
     667                       &aspectKey);
     668 
    670669  if (result == ERROR_SUCCESS)
    671670  {
     
    687686 */
    688687HRESULT WINAPI OleSetContainedObject(
    689   LPUNKNOWN pUnknown,
     688  LPUNKNOWN pUnknown, 
    690689  BOOL      fContained)
    691690{
     
    696695
    697696  hres = IUnknown_QueryInterface(pUnknown,
    698                 &IID_IRunnableObject,
    699                 (void**)&runnable);
     697                                &IID_IRunnableObject,
     698                                (void**)&runnable);
    700699
    701700  if (SUCCEEDED(hres))
     
    715714 */
    716715HRESULT WINAPI OleLoad(
    717   LPSTORAGE       pStg,
    718   REFIID          riid,
    719   LPOLECLIENTSITE pClientSite,
     716  LPSTORAGE       pStg, 
     717  REFIID          riid, 
     718  LPOLECLIENTSITE pClientSite, 
    720719  LPVOID*         ppvObj)
    721720{
     
    726725
    727726  TRACE("(%p,%p,%p,%p)\n", pStg, riid, pClientSite, ppvObj);
    728 
     727 
    729728  /*
    730729   * TODO, Conversion ... OleDoAutoConvert
     
    740739   */
    741740  hres = CoCreateInstance(&storageInfo.clsid,
    742               NULL,
    743               CLSCTX_INPROC_HANDLER,
    744               &IID_IOleObject,
    745               (void**)&oleObject);
     741                          NULL,
     742                          CLSCTX_INPROC_HANDLER,
     743                          &IID_IOleObject,
     744                          (void**)&oleObject);
    746745
    747746  /*
     
    752751  {
    753752    hres = OleCreateDefaultHandler(&storageInfo.clsid,
    754                    NULL,
    755                    &IID_IOleObject,
    756                    (void**)&oleObject);
     753                                   NULL,
     754                                   &IID_IOleObject,
     755                                   (void**)&oleObject);
    757756  }
    758757
     
    772771   */
    773772  hres = IOleObject_QueryInterface(oleObject,
    774                    &IID_IPersistStorage,
    775                    (void**)&persistStorage);
    776 
    777   if (SUCCEEDED(hres))
     773                                   &IID_IPersistStorage,
     774                                   (void**)&persistStorage);
     775
     776  if (SUCCEEDED(hres)) 
    778777  {
    779778    IPersistStorage_Load(persistStorage, pStg);
     
    828827  {
    829828    IStorage_Commit(pStg,
    830             STGC_DEFAULT);
    831   }
    832 
     829                    STGC_DEFAULT);
     830  }
     831 
    833832  return hres;
    834833}
     
    838837 *              OleLockRunning        [OLE32.114]
    839838 */
    840 HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses)
     839HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses) 
    841840{
    842841  IRunnableObject* runnable = NULL;
     
    846845
    847846  hres = IUnknown_QueryInterface(pUnknown,
    848                 &IID_IRunnableObject,
    849                 (void**)&runnable);
     847                                &IID_IRunnableObject,
     848                                (void**)&runnable);
    850849
    851850  if (SUCCEEDED(hres))
     
    903902  pHookItem->tid = tid;
    904903  pHookItem->hHeap = GetProcessHeap();
    905 
     904 
    906905  /* Install a thread scope message hook for WH_GETMESSAGE */
    907906  pHookItem->GetMsg_hHook = SetWindowsHookExA( WH_GETMESSAGE, OLEMenu_GetMsgProc,
     
    919918  pHookItem->next = hook_list;
    920919  hook_list = pHookItem;
    921 
     920 
    922921  return TRUE;
    923 
     922 
    924923CLEANUP:
    925924  /* Unhook any hooks */
     
    930929  /* Release the hook table entry */
    931930  HeapFree(pHookItem->hHeap, 0, pHookItem );
    932 
     931 
    933932  return FALSE;
    934933}
     
    995994      return pHookItem;
    996995  }
    997 
     996 
    998997  return NULL;
    999998}
     
    10161015  {
    10171016    HMENU hsubmenu;
    1018 
     1017     
    10191018    /*  Is the current item a submenu? */
    10201019    if ( (hsubmenu = GetSubMenu(hMainMenu, i)) )
     
    10631062  if ( !OLEMenu_FindMainMenuIndex( pOleMenuDescriptor->hmenuCombined, hmenu,  &nPos ) )
    10641063    return FALSE;
    1065 
     1064 
    10661065  /* The group widths array has counts for the number of elements
    10671066   * in the groups File, Edit, Container, Object, Window, Help.
     
    10961095  OleMenuHookItem *pHookItem = NULL;
    10971096  WORD fuFlags;
    1098 
     1097 
    10991098  TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam );
    11001099
     
    11021101  if ( HC_ACTION != code )
    11031102    goto NEXTHOOK;
    1104 
     1103     
    11051104  /* Retrieve the current message being dispatched from lParam */
    11061105  pMsg = (LPCWPSTRUCT)lParam;
     
    11321131      goto NEXTHOOK;
    11331132    }
    1134 
     1133   
    11351134    case WM_INITMENUPOPUP:
    11361135    {
     
    11391138      break;
    11401139    }
    1141 
     1140   
    11421141    case WM_MENUSELECT:
    11431142    {
     
    11521151      break;
    11531152    }
    1154 
     1153   
    11551154    case WM_DRAWITEM:
    11561155    {
     
    11721171                  pMsg->message, pMsg->wParam, pMsg->lParam );
    11731172  }
    1174 
     1173   
    11751174NEXTHOOK:
    11761175  if ( pOleMenuDescriptor )
    11771176    GlobalUnlock( hOleMenu );
    1178 
     1177 
    11791178  /* Lookup the hook item for the current thread */
    11801179  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
     
    11841183    return 0;
    11851184  }
    1186 
     1185 
    11871186  /* Pass on the message to the next hooker */
    11881187  return CallNextHookEx( pHookItem->CallWndProc_hHook, code, wParam, lParam );
     
    12011200  OleMenuHookItem *pHookItem = NULL;
    12021201  WORD wCode;
    1203 
     1202 
    12041203  TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam );
    12051204
     
    12071206  if ( HC_ACTION != code )
    12081207    goto NEXTHOOK;
    1209 
     1208     
    12101209  /* Retrieve the current message being dispatched from lParam */
    12111210  pMsg = (LPMSG)lParam;
     
    12461245    pMsg->hwnd = pOleMenuDescriptor->hwndActiveObject;
    12471246  }
    1248 
     1247   
    12491248NEXTHOOK:
    12501249  if ( pOleMenuDescriptor )
    12511250    GlobalUnlock( hOleMenu );
    1252 
     1251 
    12531252  /* Lookup the hook item for the current thread */
    12541253  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
     
    12581257    return FALSE;
    12591258  }
    1260 
     1259 
    12611260  /* Pass on the message to the next hooker */
    12621261  return CallNextHookEx( pHookItem->GetMsg_hHook, code, wParam, lParam );
     
    12961295  for ( i = 0; i < 6; i++ )
    12971296    pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i];
    1298 
     1297 
    12991298  pOleMenuDescriptor->hmenuCombined = hmenuCombined;
    13001299  pOleMenuDescriptor->bIsServerItem = FALSE;
    13011300  GlobalUnlock( hOleMenu );
    1302 
     1301     
    13031302  return hOleMenu;
    13041303}
     
    13131312  if ( hmenuDescriptor )
    13141313    GlobalFree( hmenuDescriptor );
    1315     return S_OK;
     1314        return S_OK;
    13161315}
    13171316
     
    13221321 * OLE should install context sensitive help F1 filtering for the app when
    13231322 * these are non null.
    1324  *
     1323 * 
    13251324 * PARAMS:
    13261325 *     hOleMenu         Handle to composite menu descriptor
     
    13501349  {
    13511350     FIXME("(%x, %x, %x, %p, %p), Context sensitive help filtering not implemented!\n",
    1352     (unsigned int)hOleMenu,
    1353     hwndFrame,
    1354     hwndActiveObject,
    1355     lpFrame,
    1356     lpActiveObject);
     1351        (unsigned int)hOleMenu,
     1352        hwndFrame,
     1353        hwndActiveObject,
     1354        lpFrame,
     1355        lpActiveObject);
    13571356  }
    13581357
     
    13701369    if ( OLEMenu_IsHookInstalled( GetCurrentThreadId() ) )
    13711370  return E_FAIL;
    1372 
     1371       
    13731372    /* Get the menu descriptor */
    13741373    pOleMenuDescriptor = (OleMenuDescriptor *) GlobalLock( hOleMenu );
     
    13821381    GlobalUnlock( hOleMenu );
    13831382    pOleMenuDescriptor = NULL;
    1384 
     1383   
    13851384    /* Add a menu descriptor windows property to the frame window */
    13861385    SetPropA( hwndFrame, "PROP_OLEMenuDescriptor", hOleMenu );
     
    13951394    if ( !OLEMenu_UnInstallHooks( GetCurrentThreadId() ) )
    13961395      return E_FAIL;
    1397 
     1396   
    13981397    /* Remove the menu descriptor property from the frame window */
    13991398    RemovePropA( hwndFrame, "PROP_OLEMenuDescriptor" );
    14001399  }
    1401 
     1400     
    14021401  return S_OK;
    14031402}
     
    14201419#endif
    14211420    {
    1422     WARN_(accel)("invalid accel handle=%04x\n", hAccel);
    1423     return FALSE;
     1421        WARN_(accel)("invalid accel handle=%04x\n", hAccel);
     1422        return FALSE;
    14241423    }
    14251424    if((lpMsg->message != WM_KEYDOWN &&
    1426     lpMsg->message != WM_KEYUP &&
    1427     lpMsg->message != WM_SYSKEYDOWN &&
    1428     lpMsg->message != WM_SYSKEYUP &&
    1429     lpMsg->message != WM_CHAR)) return FALSE;
     1425        lpMsg->message != WM_KEYUP &&
     1426        lpMsg->message != WM_SYSKEYDOWN &&
     1427        lpMsg->message != WM_SYSKEYUP &&
     1428        lpMsg->message != WM_CHAR)) return FALSE;
    14301429
    14311430    TRACE_(accel)("hAccel=%04x, cAccelEntries=%d,"
    1432         "msg->hwnd=%04x, msg->message=%04x, wParam=%08x, lParam=%08lx\n",
    1433         hAccel, cAccelEntries,
    1434         lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
     1431                "msg->hwnd=%04x, msg->message=%04x, wParam=%08x, lParam=%08lx\n",
     1432                hAccel, cAccelEntries,
     1433                lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
    14351434    for(i = 0; i < cAccelEntries; i++)
    14361435    {
    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     }
     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    }   
    14741473
    14751474    WARN_(accel)("couldn't translate accelerator key\n");
     
    14911490    case TYMED_HGLOBAL:
    14921491    {
    1493       if ( (pmedium->pUnkForRelease==0) &&
    1494        (pmedium->u.hGlobal!=0) )
    1495     GlobalFree(pmedium->u.hGlobal);
     1492      if ( (pmedium->pUnkForRelease==0) && 
     1493           (pmedium->u.hGlobal!=0) )
     1494        GlobalFree(pmedium->u.hGlobal);
    14961495
    14971496      pmedium->u.hGlobal = 0;
     
    15021501      if (pmedium->u.lpszFileName!=0)
    15031502      {
    1504     if (pmedium->pUnkForRelease==0)
    1505     {
    1506       DeleteFileW(pmedium->u.lpszFileName);
    1507     }
    1508 
    1509     CoTaskMemFree(pmedium->u.lpszFileName);
     1503        if (pmedium->pUnkForRelease==0)
     1504        {
     1505          DeleteFileW(pmedium->u.lpszFileName);
     1506        }
     1507       
     1508        CoTaskMemFree(pmedium->u.lpszFileName);
    15101509      }
    15111510
     
    15171516      if (pmedium->u.pstm!=0)
    15181517      {
    1519     IStream_Release(pmedium->u.pstm);
     1518        IStream_Release(pmedium->u.pstm);
    15201519      }
    15211520
     
    15271526      if (pmedium->u.pstg!=0)
    15281527      {
    1529     IStorage_Release(pmedium->u.pstg);
     1528        IStorage_Release(pmedium->u.pstg);
    15301529      }
    15311530
     
    15351534    case TYMED_GDI:
    15361535    {
    1537       if ( (pmedium->pUnkForRelease==0) &&
    1538        (pmedium->u.hGlobal!=0) )
    1539     DeleteObject(pmedium->u.hGlobal);
     1536      if ( (pmedium->pUnkForRelease==0) && 
     1537           (pmedium->u.hGlobal!=0) )
     1538        DeleteObject(pmedium->u.hGlobal);
    15401539
    15411540      pmedium->u.hGlobal = 0;
     
    15441543    case TYMED_MFPICT:
    15451544    {
    1546       if ( (pmedium->pUnkForRelease==0) &&
    1547        (pmedium->u.hMetaFilePict!=0) )
     1545      if ( (pmedium->pUnkForRelease==0) && 
     1546           (pmedium->u.hMetaFilePict!=0) )
    15481547      {
    1549     LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hMetaFilePict);
    1550     DeleteMetaFile(pMP->hMF);
    1551     GlobalUnlock(pmedium->u.hMetaFilePict);
    1552     GlobalFree(pmedium->u.hMetaFilePict);
     1548        LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hMetaFilePict);
     1549        DeleteMetaFile(pMP->hMF);
     1550        GlobalUnlock(pmedium->u.hMetaFilePict);
     1551        GlobalFree(pmedium->u.hMetaFilePict);
    15531552      }
    15541553
     
    15581557    case TYMED_ENHMF:
    15591558    {
    1560       if ( (pmedium->pUnkForRelease==0) &&
    1561        (pmedium->u.hEnhMetaFile!=0) )
     1559      if ( (pmedium->pUnkForRelease==0) && 
     1560           (pmedium->u.hEnhMetaFile!=0) )
    15621561      {
    1563     DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);
     1562        DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);
    15641563      }
    15651564
     
    15991598    wndClass.hbrBackground = 0;
    16001599    wndClass.lpszClassName = OLEDD_DRAGTRACKERCLASS;
    1601 
     1600 
    16021601    RegisterClassA (&wndClass);
    16031602}
     
    16651664  /*
    16661665   * If we get here, we have found a spot for our item. The parentNodeLink
    1667    * pointer points to the pointer that we have to modify.
     1666   * pointer points to the pointer that we have to modify. 
    16681667   * The curNode should be NULL. We just have to establish the link and Voila!
    16691668   */
     
    17121711    {
    17131712      /*
    1714        * The item was found in the list. Detach it from it's parent and
     1713       * The item was found in the list. Detach it from it's parent and 
    17151714       * re-insert it's kids in the tree.
    17161715       */
     
    17281727      if (curNode->nextDropTarget!=NULL)
    17291728      {
    1730     OLEDD_InsertDropTarget(curNode->nextDropTarget);
     1729        OLEDD_InsertDropTarget(curNode->nextDropTarget);
    17311730      }
    17321731
     
    18021801 */
    18031802static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
    1804              HWND   hwnd,
    1805             UINT   uMsg,
    1806              WPARAM wParam,
    1807             LPARAM   lParam)
     1803                         HWND   hwnd,
     1804                        UINT   uMsg,
     1805                         WPARAM wParam,
     1806                        LPARAM   lParam)
    18081807{
    18091808  switch (uMsg)
     
    18131812      LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam;
    18141813
    1815       SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams);
    1816 
    1817 
     1814      SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams); 
     1815
     1816     
    18181817      break;
    18191818    }
     
    19101909   * DragOver notification
    19111910   */
    1912   if ( (trackerInfo->curDragTarget != 0) &&
     1911  if ( (trackerInfo->curDragTarget != 0) && 
    19131912       (trackerInfo->curDragTargetHWND==hwndNewTarget) )
    19141913  {
    19151914    POINTL  mousePosParam;
    1916 
     1915   
    19171916    /*
    19181917     * The documentation tells me that the coordinate should be in the target
     
    19221921    mousePosParam.x = mousePos.x;
    19231922    mousePosParam.y = mousePos.y;
    1924 
     1923   
    19251924    IDropTarget_DragOver(trackerInfo->curDragTarget,
    1926             keyState,
    1927             mousePosParam,
    1928             trackerInfo->pdwEffect);
     1925                        keyState,
     1926                        mousePosParam,
     1927                        trackerInfo->pdwEffect);
    19291928  }
    19301929  else
    19311930  {
    19321931    DropTargetNode* newDropTargetNode = 0;
    1933 
     1932   
    19341933    /*
    19351934     * If we changed window, we have to notify our old target and check for
     
    19401939      IDropTarget_DragLeave(trackerInfo->curDragTarget);
    19411940    }
    1942 
     1941   
    19431942    /*
    19441943     * Make sure we're hovering over a window.
     
    19511950      HWND nexttar = hwndNewTarget;
    19521951      do {
    1953     newDropTargetNode = OLEDD_FindDropTarget(nexttar);
     1952        newDropTargetNode = OLEDD_FindDropTarget(nexttar);
    19541953      } while (!newDropTargetNode && (nexttar = GetParent(nexttar)) != 0);
    19551954      if(nexttar) hwndNewTarget = nexttar;
     
    19571956      trackerInfo->curDragTargetHWND = hwndNewTarget;
    19581957      trackerInfo->curDragTarget     = newDropTargetNode ? newDropTargetNode->dropTarget : 0;
    1959 
     1958     
    19601959      /*
    19611960       * If there is, notify it that we just dragged-in
     
    19631962      if (trackerInfo->curDragTarget!=0)
    19641963      {
    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);
     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);
    19801979      }
    19811980    }
     
    19911990
    19921991  /*
    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
     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 
    19951994   * have a target, simulate no effect.
    19961995   */
     
    20012000
    20022001  hr = IDropSource_GiveFeedback(trackerInfo->dropSource,
    2003                 *trackerInfo->pdwEffect);
     2002                                *trackerInfo->pdwEffect);
    20042003
    20052004  /*
     
    20272026      SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(0)));
    20282027    }
    2029   }
     2028  } 
    20302029}
    20312030
     
    20552054   */
    20562055  trackerInfo->returnValue = IDropSource_QueryContinueDrag(
    2057                    trackerInfo->dropSource,
    2058                    trackerInfo->escPressed,
    2059                    keyState);
    2060 
     2056                               trackerInfo->dropSource,
     2057                               trackerInfo->escPressed,
     2058                               keyState);
     2059 
    20612060  /*
    20622061   * All the return valued will stop the operation except the S_OK
     
    20712070
    20722071    /*
    2073      * Release the mouse in case the drop target decides to show a popup
     2072     * Release the mouse in case the drop target decides to show a popup 
    20742073     * or a menu or something.
    20752074     */
    20762075    ReleaseCapture();
    2077 
     2076   
    20782077    /*
    2079      * If we end-up over a target, drop the object in the target or
     2078     * If we end-up over a target, drop the object in the target or 
    20802079     * inform the target that the operation was cancelled.
    20812080     */
     
    20842083      switch (trackerInfo->returnValue)
    20852084      {
    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     */
     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        */
    20902089        case DRAGDROP_S_DROP:
    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     */
     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        */
    21152114        case DRAGDROP_S_CANCEL:
    2116       IDropTarget_DragLeave(trackerInfo->curDragTarget);
    2117       *trackerInfo->pdwEffect = DROPEFFECT_NONE;
    2118       break;
     2115          IDropTarget_DragLeave(trackerInfo->curDragTarget);
     2116          *trackerInfo->pdwEffect = DROPEFFECT_NONE;
     2117          break;
    21192118      }
    21202119    }
     
    21632162 * params:
    21642163 *     regKey   - Key to read the default value from
    2165  *     pdwValue - Pointer to the location where the DWORD
     2164 *     pdwValue - Pointer to the location where the DWORD 
    21662165 *                value is returned. This value is not modified
    21672166 *                if the value is not found.
     
    21692168
    21702169static void OLEUTL_ReadRegistryDWORDValue(
    2171   HKEY   regKey,
     2170  HKEY   regKey, 
    21722171  DWORD* pdwValue)
    21732172{
     
    21782177
    21792178  lres = RegQueryValueExA(regKey,
    2180               "",
    2181               NULL,
    2182               &dwKeyType,
    2183               (LPBYTE)buffer,
    2184               &cbData);
     2179                          "",
     2180                          NULL,
     2181                          &dwKeyType,
     2182                          (LPBYTE)buffer,
     2183                          &cbData);
    21852184
    21862185  if (lres==ERROR_SUCCESS)
     
    21892188    {
    21902189      case REG_DWORD:
    2191     *pdwValue = *(DWORD*)buffer;
    2192     break;
     2190        *pdwValue = *(DWORD*)buffer;
     2191        break;
    21932192      case REG_EXPAND_SZ:
    21942193      case REG_MULTI_SZ:
    21952194      case REG_SZ:
    2196     *pdwValue = (DWORD)strtoul(buffer, NULL, 10);
    2197     break;
     2195        *pdwValue = (DWORD)strtoul(buffer, NULL, 10);
     2196        break;
    21982197    }
    21992198  }
     
    22102209 */
    22112210HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(
    2212     HICON16 hIcon,
    2213     LPCOLESTR16 lpszLabel,
    2214     LPCOLESTR16 lpszSourceFile,
    2215     UINT16 iIconIndex
     2211        HICON16 hIcon,
     2212        LPCOLESTR16 lpszLabel,
     2213        LPCOLESTR16 lpszSourceFile,
     2214        UINT16 iIconIndex
    22162215) {
    22172216    METAFILEPICT16 *mf;
     
    22232222    if (!hIcon) {
    22242223        if (lpszSourceFile) {
    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;
     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;
    22322231    }
    22332232
Note: See TracChangeset for help on using the changeset viewer.