Changeset 6648 for trunk/src/ole32/ole2.c
- Timestamp:
 - Sep 5, 2001, 3:19:02 PM (24 years ago)
 - File:
 - 
      
- 1 edited
 
- 
          
  trunk/src/ole32/ole2.c (modified) (95 diffs)
 
 
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 $ */ 1 2 /* 2 * OLE2 library3 * 4 * Copyright 1995Martin von Loewis3 * OLE2 library 4 * 5 * Copyright 1995 Martin von Loewis 5 6 * Copyright 1999 Francis Beaudet 6 * Copyright 1999 Noel Borthwick 7 * Copyright 1999 Noel Borthwick 7 8 */ 8 9 … … 32 33 33 34 /****************************************************************************** 34 * These are static/global variables and internal data structures that the 35 * These are static/global variables and internal data structures that the 35 36 * OLE module uses to maintain it's state. 36 37 */ … … 94 95 95 96 /****************************************************************************** 96 * These are the prototypes of miscelaneous utility methods 97 * These are the prototypes of miscelaneous utility methods 97 98 */ 98 99 static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD* pdwValue); … … 123 124 static void OLEDD_UnInitialize(); 124 125 static void OLEDD_InsertDropTarget( 125 DropTargetNode* nodeToAdd);126 DropTargetNode* nodeToAdd); 126 127 static DropTargetNode* OLEDD_ExtractDropTarget( 127 128 HWND hwndOfTarget); … … 129 130 HWND hwndOfTarget); 130 131 static 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); 135 136 static void OLEDD_TrackMouseMove( 136 137 TrackerWindowInfo* trackerInfo, 137 POINT mousePos,138 DWORD keyState);138 POINT mousePos, 139 DWORD keyState); 139 140 static void OLEDD_TrackStateChange( 140 141 TrackerWindowInfo* trackerInfo, 141 POINT mousePos,142 DWORD keyState);142 POINT mousePos, 143 DWORD keyState); 143 144 static DWORD OLEDD_GetButtonState(); 144 145 145 146 146 147 /****************************************************************************** 147 * OleBuildVersion[OLE2.1]148 * OleBuildVersion [OLE2.1] 148 149 */ 149 150 DWORD WINAPI OleBuildVersion(void) … … 168 169 169 170 /* 170 * If the CoInitializeEx call failed, the OLE libraries can't be 171 * If the CoInitializeEx call failed, the OLE libraries can't be 171 172 * initialized. 172 173 */ 173 174 if (FAILED(hr)) 174 return hr; 175 return hr; 175 176 176 177 /* … … 184 185 if (OLE_moduleLockCount==0) 185 186 { 186 /* 187 /* 187 188 * Initialize the libraries. 188 189 */ … … 208 209 * Then, we increase the lock count on the OLE module. 209 210 */ 210 OLE_moduleLockCount++; 211 OLE_moduleLockCount++; 211 212 212 213 return hr; … … 214 215 215 216 /****************************************************************************** 216 * CoGetCurrentProcess[COMPOBJ.34] [OLE2.2][OLE32.108]217 * CoGetCurrentProcess [COMPOBJ.34] [OLE2.2][OLE32.108] 217 218 * 218 219 * NOTES … … 221 222 DWORD WINAPI CoGetCurrentProcess(void) 222 223 { 223 return GetCurrentProcessId();224 return GetCurrentProcessId(); 224 225 } 225 226 226 227 /****************************************************************************** 227 * OleUninitialize[OLE2.3] [OLE32.131]228 * OleUninitialize [OLE2.3] [OLE32.131] 228 229 */ 229 230 void WINAPI OleUninitialize(void) … … 255 256 */ 256 257 OLEDD_UnInitialize(); 257 258 258 259 /* 259 260 * OLE shared menu … … 261 262 OLEMenu_UnInitialize(); 262 263 } 263 264 264 265 /* 265 266 * Then, uninitialize the COM libraries. … … 271 272 //imessagefilter.cpp 272 273 /****************************************************************************** 273 * CoRegisterMessageFilter[OLE32.38]274 * CoRegisterMessageFilter [OLE32.38] 274 275 */ 275 276 HRESULT 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 */ 278 279 ) { 279 280 FIXME("stub\n"); 280 281 if (lplpMessageFilter) { 281 *lplpMessageFilter = NULL;282 *lplpMessageFilter = NULL; 282 283 } 283 284 return S_OK; … … 286 287 287 288 /****************************************************************************** 288 * OleInitializeWOW[OLE32.109]289 * OleInitializeWOW [OLE32.109] 289 290 */ 290 291 HRESULT WINAPI OleInitializeWOW(DWORD x) { … … 297 298 */ 298 299 HRESULT WINAPI RegisterDragDrop16( 299 HWND16 hwnd,300 LPDROPTARGET pDropTarget300 HWND16 hwnd, 301 LPDROPTARGET pDropTarget 301 302 ) { 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; 304 305 } 305 306 … … 308 309 */ 309 310 HRESULT WINAPI RegisterDragDrop( 310 HWND hwnd,311 LPDROPTARGET pDropTarget) 311 HWND hwnd, 312 LPDROPTARGET pDropTarget) 312 313 { 313 314 DropTargetNode* dropTargetInfo; … … 341 342 dropTargetInfo->dropTarget = pDropTarget; 342 343 IDropTarget_AddRef(dropTargetInfo->dropTarget); 343 344 344 345 OLEDD_InsertDropTarget(dropTargetInfo); 345 346 346 return S_OK;347 return S_OK; 347 348 } 348 349 … … 351 352 */ 352 353 HRESULT WINAPI RevokeDragDrop16( 353 HWND16 hwnd354 HWND16 hwnd 354 355 ) { 355 FIXME("(0x%04x),stub!\n",hwnd);356 return S_OK;356 FIXME("(0x%04x),stub!\n",hwnd); 357 return S_OK; 357 358 } 358 359 … … 361 362 */ 362 363 HRESULT WINAPI RevokeDragDrop( 363 HWND hwnd)364 HWND hwnd) 364 365 { 365 366 DropTargetNode* dropTargetInfo; … … 383 384 */ 384 385 IDropTarget_Release(dropTargetInfo->dropTarget); 385 HeapFree(GetProcessHeap(), 0, dropTargetInfo); 386 387 return S_OK;386 HeapFree(GetProcessHeap(), 0, dropTargetInfo); 387 388 return S_OK; 388 389 } 389 390 … … 396 397 * way they are registered. 397 398 */ 398 HRESULT WINAPI OleRegGetUserType( 399 REFCLSID clsid, 400 DWORD dwFormOfType,401 LPOLESTR* pszUserType)399 HRESULT WINAPI OleRegGetUserType( 400 REFCLSID clsid, 401 DWORD dwFormOfType, 402 LPOLESTR* pszUserType) 402 403 { 403 404 char keyName[60]; … … 427 428 */ 428 429 hres = RegOpenKeyA(HKEY_CLASSES_ROOT, 429 keyName,430 &clsidKey);430 keyName, 431 &clsidKey); 431 432 432 433 if (hres != ERROR_SUCCESS) … … 439 440 440 441 hres = RegQueryValueExA(clsidKey, 441 "",442 NULL,443 &dwKeyType,444 NULL,445 &cbData);442 "", 443 NULL, 444 &dwKeyType, 445 NULL, 446 &cbData); 446 447 447 448 if (hres!=ERROR_SUCCESS) … … 473 474 474 475 hres = RegQueryValueExA(clsidKey, 475 "",476 NULL,477 &dwKeyType,478 buffer,479 &cbData);476 "", 477 NULL, 478 &dwKeyType, 479 buffer, 480 &cbData); 480 481 481 482 RegCloseKey(clsidKey); 482 483 483 484 484 485 if (hres!=ERROR_SUCCESS) 485 486 { … … 527 528 528 529 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); 537 538 538 539 if (hwndTrackWindow!=0) … … 548 549 while (!trackerInfo.trackingDone && GetMessageA(&msg, 0, 0, 0) ) 549 550 { 550 if ( (msg.message >= WM_KEYFIRST) && 551 (msg.message <= WM_KEYLAST) )551 if ( (msg.message >= WM_KEYFIRST) && 552 (msg.message <= WM_KEYLAST) ) 552 553 { 553 /*554 * When keyboard messages are sent to windows on this thread, we555 * want to ignore notify the drop source that the state changed.556 * in the case of the Escape key, we also notify the drop source557 * 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()); 571 572 } 572 573 else 573 574 { 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); 578 579 } 579 580 } … … 633 634 */ 634 635 result = RegOpenKeyA(HKEY_CLASSES_ROOT, 635 keyName,636 &clsidKey);636 keyName, 637 &clsidKey); 637 638 638 639 if (result != ERROR_SUCCESS) … … 643 644 */ 644 645 result = RegOpenKeyA(clsidKey, 645 "MiscStatus",646 &miscStatusKey);647 648 646 "MiscStatus", 647 &miscStatusKey); 648 649 649 650 if (result != ERROR_SUCCESS) 650 651 { … … 664 665 665 666 result = RegOpenKeyA(miscStatusKey, 666 keyName,667 &aspectKey);668 667 keyName, 668 &aspectKey); 669 669 670 if (result == ERROR_SUCCESS) 670 671 { … … 686 687 */ 687 688 HRESULT WINAPI OleSetContainedObject( 688 LPUNKNOWN pUnknown, 689 LPUNKNOWN pUnknown, 689 690 BOOL fContained) 690 691 { … … 695 696 696 697 hres = IUnknown_QueryInterface(pUnknown, 697 &IID_IRunnableObject,698 (void**)&runnable);698 &IID_IRunnableObject, 699 (void**)&runnable); 699 700 700 701 if (SUCCEEDED(hres)) … … 714 715 */ 715 716 HRESULT WINAPI OleLoad( 716 LPSTORAGE pStg, 717 REFIID riid, 718 LPOLECLIENTSITE pClientSite, 717 LPSTORAGE pStg, 718 REFIID riid, 719 LPOLECLIENTSITE pClientSite, 719 720 LPVOID* ppvObj) 720 721 { … … 725 726 726 727 TRACE("(%p,%p,%p,%p)\n", pStg, riid, pClientSite, ppvObj); 727 728 728 729 /* 729 730 * TODO, Conversion ... OleDoAutoConvert … … 739 740 */ 740 741 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); 745 746 746 747 /* … … 751 752 { 752 753 hres = OleCreateDefaultHandler(&storageInfo.clsid, 753 NULL,754 &IID_IOleObject,755 (void**)&oleObject);754 NULL, 755 &IID_IOleObject, 756 (void**)&oleObject); 756 757 } 757 758 … … 771 772 */ 772 773 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)) 777 778 { 778 779 IPersistStorage_Load(persistStorage, pStg); … … 827 828 { 828 829 IStorage_Commit(pStg, 829 STGC_DEFAULT);830 } 831 830 STGC_DEFAULT); 831 } 832 832 833 return hres; 833 834 } … … 837 838 * OleLockRunning [OLE32.114] 838 839 */ 839 HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses) 840 HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses) 840 841 { 841 842 IRunnableObject* runnable = NULL; … … 845 846 846 847 hres = IUnknown_QueryInterface(pUnknown, 847 &IID_IRunnableObject,848 (void**)&runnable);848 &IID_IRunnableObject, 849 (void**)&runnable); 849 850 850 851 if (SUCCEEDED(hres)) … … 902 903 pHookItem->tid = tid; 903 904 pHookItem->hHeap = GetProcessHeap(); 904 905 905 906 /* Install a thread scope message hook for WH_GETMESSAGE */ 906 907 pHookItem->GetMsg_hHook = SetWindowsHookExA( WH_GETMESSAGE, OLEMenu_GetMsgProc, … … 918 919 pHookItem->next = hook_list; 919 920 hook_list = pHookItem; 920 921 921 922 return TRUE; 922 923 923 924 CLEANUP: 924 925 /* Unhook any hooks */ … … 929 930 /* Release the hook table entry */ 930 931 HeapFree(pHookItem->hHeap, 0, pHookItem ); 931 932 932 933 return FALSE; 933 934 } … … 994 995 return pHookItem; 995 996 } 996 997 997 998 return NULL; 998 999 } … … 1015 1016 { 1016 1017 HMENU hsubmenu; 1017 1018 1018 1019 /* Is the current item a submenu? */ 1019 1020 if ( (hsubmenu = GetSubMenu(hMainMenu, i)) ) … … 1062 1063 if ( !OLEMenu_FindMainMenuIndex( pOleMenuDescriptor->hmenuCombined, hmenu, &nPos ) ) 1063 1064 return FALSE; 1064 1065 1065 1066 /* The group widths array has counts for the number of elements 1066 1067 * in the groups File, Edit, Container, Object, Window, Help. … … 1095 1096 OleMenuHookItem *pHookItem = NULL; 1096 1097 WORD fuFlags; 1097 1098 1098 1099 TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam ); 1099 1100 … … 1101 1102 if ( HC_ACTION != code ) 1102 1103 goto NEXTHOOK; 1103 1104 1104 1105 /* Retrieve the current message being dispatched from lParam */ 1105 1106 pMsg = (LPCWPSTRUCT)lParam; … … 1131 1132 goto NEXTHOOK; 1132 1133 } 1133 1134 1134 1135 case WM_INITMENUPOPUP: 1135 1136 { … … 1138 1139 break; 1139 1140 } 1140 1141 1141 1142 case WM_MENUSELECT: 1142 1143 { … … 1151 1152 break; 1152 1153 } 1153 1154 1154 1155 case WM_DRAWITEM: 1155 1156 { … … 1171 1172 pMsg->message, pMsg->wParam, pMsg->lParam ); 1172 1173 } 1173 1174 1174 1175 NEXTHOOK: 1175 1176 if ( pOleMenuDescriptor ) 1176 1177 GlobalUnlock( hOleMenu ); 1177 1178 1178 1179 /* Lookup the hook item for the current thread */ 1179 1180 if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) ) … … 1183 1184 return 0; 1184 1185 } 1185 1186 1186 1187 /* Pass on the message to the next hooker */ 1187 1188 return CallNextHookEx( pHookItem->CallWndProc_hHook, code, wParam, lParam ); … … 1200 1201 OleMenuHookItem *pHookItem = NULL; 1201 1202 WORD wCode; 1202 1203 1203 1204 TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam ); 1204 1205 … … 1206 1207 if ( HC_ACTION != code ) 1207 1208 goto NEXTHOOK; 1208 1209 1209 1210 /* Retrieve the current message being dispatched from lParam */ 1210 1211 pMsg = (LPMSG)lParam; … … 1245 1246 pMsg->hwnd = pOleMenuDescriptor->hwndActiveObject; 1246 1247 } 1247 1248 1248 1249 NEXTHOOK: 1249 1250 if ( pOleMenuDescriptor ) 1250 1251 GlobalUnlock( hOleMenu ); 1251 1252 1252 1253 /* Lookup the hook item for the current thread */ 1253 1254 if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) ) … … 1257 1258 return FALSE; 1258 1259 } 1259 1260 1260 1261 /* Pass on the message to the next hooker */ 1261 1262 return CallNextHookEx( pHookItem->GetMsg_hHook, code, wParam, lParam ); … … 1295 1296 for ( i = 0; i < 6; i++ ) 1296 1297 pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i]; 1297 1298 1298 1299 pOleMenuDescriptor->hmenuCombined = hmenuCombined; 1299 1300 pOleMenuDescriptor->bIsServerItem = FALSE; 1300 1301 GlobalUnlock( hOleMenu ); 1301 1302 1302 1303 return hOleMenu; 1303 1304 } … … 1312 1313 if ( hmenuDescriptor ) 1313 1314 GlobalFree( hmenuDescriptor ); 1314 return S_OK;1315 return S_OK; 1315 1316 } 1316 1317 … … 1321 1322 * OLE should install context sensitive help F1 filtering for the app when 1322 1323 * these are non null. 1323 * 1324 * 1324 1325 * PARAMS: 1325 1326 * hOleMenu Handle to composite menu descriptor … … 1349 1350 { 1350 1351 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); 1356 1357 } 1357 1358 … … 1369 1370 if ( OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) 1370 1371 return E_FAIL; 1371 1372 1372 1373 /* Get the menu descriptor */ 1373 1374 pOleMenuDescriptor = (OleMenuDescriptor *) GlobalLock( hOleMenu ); … … 1381 1382 GlobalUnlock( hOleMenu ); 1382 1383 pOleMenuDescriptor = NULL; 1383 1384 1384 1385 /* Add a menu descriptor windows property to the frame window */ 1385 1386 SetPropA( hwndFrame, "PROP_OLEMenuDescriptor", hOleMenu ); … … 1394 1395 if ( !OLEMenu_UnInstallHooks( GetCurrentThreadId() ) ) 1395 1396 return E_FAIL; 1396 1397 1397 1398 /* Remove the menu descriptor property from the frame window */ 1398 1399 RemovePropA( hwndFrame, "PROP_OLEMenuDescriptor" ); 1399 1400 } 1400 1401 1401 1402 return S_OK; 1402 1403 } … … 1419 1420 #endif 1420 1421 { 1421 WARN_(accel)("invalid accel handle=%04x\n", hAccel);1422 return FALSE;1422 WARN_(accel)("invalid accel handle=%04x\n", hAccel); 1423 return FALSE; 1423 1424 } 1424 1425 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; 1429 1430 1430 1431 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); 1434 1435 for(i = 0; i < cAccelEntries; i++) 1435 1436 { 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 else1448 {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 else1461 {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 } 1473 1474 1474 1475 WARN_(accel)("couldn't translate accelerator key\n"); … … 1490 1491 case TYMED_HGLOBAL: 1491 1492 { 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); 1495 1496 1496 1497 pmedium->u.hGlobal = 0; … … 1501 1502 if (pmedium->u.lpszFileName!=0) 1502 1503 { 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); 1509 1510 } 1510 1511 … … 1516 1517 if (pmedium->u.pstm!=0) 1517 1518 { 1518 IStream_Release(pmedium->u.pstm);1519 IStream_Release(pmedium->u.pstm); 1519 1520 } 1520 1521 … … 1526 1527 if (pmedium->u.pstg!=0) 1527 1528 { 1528 IStorage_Release(pmedium->u.pstg);1529 IStorage_Release(pmedium->u.pstg); 1529 1530 } 1530 1531 … … 1534 1535 case TYMED_GDI: 1535 1536 { 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); 1539 1540 1540 1541 pmedium->u.hGlobal = 0; … … 1543 1544 case TYMED_MFPICT: 1544 1545 { 1545 if ( (pmedium->pUnkForRelease==0) && 1546 (pmedium->u.hMetaFilePict!=0) )1546 if ( (pmedium->pUnkForRelease==0) && 1547 (pmedium->u.hMetaFilePict!=0) ) 1547 1548 { 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); 1552 1553 } 1553 1554 … … 1557 1558 case TYMED_ENHMF: 1558 1559 { 1559 if ( (pmedium->pUnkForRelease==0) && 1560 (pmedium->u.hEnhMetaFile!=0) )1560 if ( (pmedium->pUnkForRelease==0) && 1561 (pmedium->u.hEnhMetaFile!=0) ) 1561 1562 { 1562 DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);1563 DeleteEnhMetaFile(pmedium->u.hEnhMetaFile); 1563 1564 } 1564 1565 … … 1598 1599 wndClass.hbrBackground = 0; 1599 1600 wndClass.lpszClassName = OLEDD_DRAGTRACKERCLASS; 1600 1601 1601 1602 RegisterClassA (&wndClass); 1602 1603 } … … 1664 1665 /* 1665 1666 * 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. 1667 1668 * The curNode should be NULL. We just have to establish the link and Voila! 1668 1669 */ … … 1711 1712 { 1712 1713 /* 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 1714 1715 * re-insert it's kids in the tree. 1715 1716 */ … … 1727 1728 if (curNode->nextDropTarget!=NULL) 1728 1729 { 1729 OLEDD_InsertDropTarget(curNode->nextDropTarget);1730 OLEDD_InsertDropTarget(curNode->nextDropTarget); 1730 1731 } 1731 1732 … … 1801 1802 */ 1802 1803 static 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) 1807 1808 { 1808 1809 switch (uMsg) … … 1812 1813 LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam; 1813 1814 1814 SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams); 1815 1816 1815 SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams); 1816 1817 1817 1818 break; 1818 1819 } … … 1909 1910 * DragOver notification 1910 1911 */ 1911 if ( (trackerInfo->curDragTarget != 0) && 1912 if ( (trackerInfo->curDragTarget != 0) && 1912 1913 (trackerInfo->curDragTargetHWND==hwndNewTarget) ) 1913 1914 { 1914 1915 POINTL mousePosParam; 1915 1916 1916 1917 /* 1917 1918 * The documentation tells me that the coordinate should be in the target … … 1921 1922 mousePosParam.x = mousePos.x; 1922 1923 mousePosParam.y = mousePos.y; 1923 1924 1924 1925 IDropTarget_DragOver(trackerInfo->curDragTarget, 1925 keyState,1926 mousePosParam,1927 trackerInfo->pdwEffect);1926 keyState, 1927 mousePosParam, 1928 trackerInfo->pdwEffect); 1928 1929 } 1929 1930 else 1930 1931 { 1931 1932 DropTargetNode* newDropTargetNode = 0; 1932 1933 1933 1934 /* 1934 1935 * If we changed window, we have to notify our old target and check for … … 1939 1940 IDropTarget_DragLeave(trackerInfo->curDragTarget); 1940 1941 } 1941 1942 1942 1943 /* 1943 1944 * Make sure we're hovering over a window. … … 1950 1951 HWND nexttar = hwndNewTarget; 1951 1952 do { 1952 newDropTargetNode = OLEDD_FindDropTarget(nexttar);1953 newDropTargetNode = OLEDD_FindDropTarget(nexttar); 1953 1954 } while (!newDropTargetNode && (nexttar = GetParent(nexttar)) != 0); 1954 1955 if(nexttar) hwndNewTarget = nexttar; … … 1956 1957 trackerInfo->curDragTargetHWND = hwndNewTarget; 1957 1958 trackerInfo->curDragTarget = newDropTargetNode ? newDropTargetNode->dropTarget : 0; 1958 1959 1959 1960 /* 1960 1961 * If there is, notify it that we just dragged-in … … 1962 1963 if (trackerInfo->curDragTarget!=0) 1963 1964 { 1964 POINTL mousePosParam;1965 1966 /*1967 * The documentation tells me that the coordinate should be in the target1968 * window's coordinate space. However, the tests I made tell me the1969 * 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); 1979 1980 } 1980 1981 } … … 1990 1991 1991 1992 /* 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 1994 1995 * have a target, simulate no effect. 1995 1996 */ … … 2000 2001 2001 2002 hr = IDropSource_GiveFeedback(trackerInfo->dropSource, 2002 *trackerInfo->pdwEffect);2003 *trackerInfo->pdwEffect); 2003 2004 2004 2005 /* … … 2026 2027 SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(0))); 2027 2028 } 2028 } 2029 } 2029 2030 } 2030 2031 … … 2054 2055 */ 2055 2056 trackerInfo->returnValue = IDropSource_QueryContinueDrag( 2056 trackerInfo->dropSource,2057 trackerInfo->escPressed, 2058 keyState);2059 2057 trackerInfo->dropSource, 2058 trackerInfo->escPressed, 2059 keyState); 2060 2060 2061 /* 2061 2062 * All the return valued will stop the operation except the S_OK … … 2070 2071 2071 2072 /* 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 2073 2074 * or a menu or something. 2074 2075 */ 2075 2076 ReleaseCapture(); 2076 2077 2077 2078 /* 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 2079 2080 * inform the target that the operation was cancelled. 2080 2081 */ … … 2083 2084 switch (trackerInfo->returnValue) 2084 2085 { 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 */ 2089 2090 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 tests2096 * 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 */ 2114 2115 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; 2118 2119 } 2119 2120 } … … 2162 2163 * params: 2163 2164 * 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 2165 2166 * value is returned. This value is not modified 2166 2167 * if the value is not found. … … 2168 2169 2169 2170 static void OLEUTL_ReadRegistryDWORDValue( 2170 HKEY regKey, 2171 HKEY regKey, 2171 2172 DWORD* pdwValue) 2172 2173 { … … 2177 2178 2178 2179 lres = RegQueryValueExA(regKey, 2179 "",2180 NULL,2181 &dwKeyType,2182 (LPBYTE)buffer,2183 &cbData);2180 "", 2181 NULL, 2182 &dwKeyType, 2183 (LPBYTE)buffer, 2184 &cbData); 2184 2185 2185 2186 if (lres==ERROR_SUCCESS) … … 2188 2189 { 2189 2190 case REG_DWORD: 2190 *pdwValue = *(DWORD*)buffer;2191 break;2191 *pdwValue = *(DWORD*)buffer; 2192 break; 2192 2193 case REG_EXPAND_SZ: 2193 2194 case REG_MULTI_SZ: 2194 2195 case REG_SZ: 2195 *pdwValue = (DWORD)strtoul(buffer, NULL, 10);2196 break;2196 *pdwValue = (DWORD)strtoul(buffer, NULL, 10); 2197 break; 2197 2198 } 2198 2199 } … … 2209 2210 */ 2210 2211 HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16( 2211 HICON16 hIcon,2212 LPCOLESTR16 lpszLabel,2213 LPCOLESTR16 lpszSourceFile,2214 UINT16 iIconIndex2212 HICON16 hIcon, 2213 LPCOLESTR16 lpszLabel, 2214 LPCOLESTR16 lpszSourceFile, 2215 UINT16 iIconIndex 2215 2216 ) { 2216 2217 METAFILEPICT16 *mf; … … 2222 2223 if (!hIcon) { 2223 2224 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 } else2230 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; 2231 2232 } 2232 2233  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  