Changeset 8620 for trunk/src/ole32/clipboard.c
- Timestamp:
 - Jun 9, 2002, 6:37:22 PM (23 years ago)
 - File:
 - 
      
- 1 edited
 
- 
          
  trunk/src/ole32/clipboard.c (modified) (87 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
trunk/src/ole32/clipboard.c
r8441 r8620 95 95 96 96 /* 97 * The hidden OLE clipboard window. This window is used as the bridge between the 97 * The hidden OLE clipboard window. This window is used as the bridge between the 98 98 * the OLE and windows clipboard API. (Windows creates one such window per process) 99 99 */ … … 128 128 * DO NOT add any members before the VTables declaration! 129 129 */ 130 typedef struct 130 typedef struct 131 131 { 132 132 /* IEnumFORMATETC VTable */ 133 133 ICOM_VFIELD(IEnumFORMATETC); 134 134 135 135 /* IEnumFORMATETC fields */ 136 136 UINT posFmt; /* current enumerator position */ … … 147 147 */ 148 148 IUnknown* pUnkDataObj; 149 149 150 150 } IEnumFORMATETCImpl; 151 151 … … 186 186 REFIID riid, 187 187 void** ppvObject); 188 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 188 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 189 189 IDataObject* iface); 190 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 190 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 191 191 IDataObject* iface); 192 192 static HRESULT WINAPI OLEClipbrd_IDataObject_GetData( 193 193 IDataObject* iface, 194 LPFORMATETC pformatetcIn, 194 LPFORMATETC pformatetcIn, 195 195 STGMEDIUM* pmedium); 196 196 static HRESULT WINAPI OLEClipbrd_IDataObject_GetDataHere( 197 IDataObject* iface, 197 IDataObject* iface, 198 198 LPFORMATETC pformatetc, 199 199 STGMEDIUM* pmedium); … … 202 202 LPFORMATETC pformatetc); 203 203 static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc( 204 IDataObject* iface, 205 LPFORMATETC pformatectIn, 204 IDataObject* iface, 205 LPFORMATETC pformatectIn, 206 206 LPFORMATETC pformatetcOut); 207 207 static HRESULT WINAPI OLEClipbrd_IDataObject_SetData( 208 208 IDataObject* iface, 209 LPFORMATETC pformatetc, 210 STGMEDIUM* pmedium, 209 LPFORMATETC pformatetc, 210 STGMEDIUM* pmedium, 211 211 BOOL fRelease); 212 212 static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc( 213 IDataObject* iface, 213 IDataObject* iface, 214 214 DWORD dwDirection, 215 215 IEnumFORMATETC** ppenumFormatEtc); 216 216 static HRESULT WINAPI OLEClipbrd_IDataObject_DAdvise( 217 IDataObject* iface, 218 FORMATETC* pformatetc, 219 DWORD advf, 220 IAdviseSink* pAdvSink, 217 IDataObject* iface, 218 FORMATETC* pformatetc, 219 DWORD advf, 220 IAdviseSink* pAdvSink, 221 221 DWORD* pdwConnection); 222 222 static HRESULT WINAPI OLEClipbrd_IDataObject_DUnadvise( … … 279 279 280 280 /* 281 * Name of our registered OLE clipboard window class 281 * Name of our registered OLE clipboard window class 282 282 */ 283 283 CHAR OLEClipbrd_WNDCLASS[] = "CLIPBRDWNDCLASS"; … … 293 293 294 294 /*---------------------------------------------------------------------* 295 * Win32 OLE clipboard API 295 * Win32 OLE clipboard API 296 296 *---------------------------------------------------------------------*/ 297 297 … … 304 304 * 305 305 * S_OK IDataObject pointer placed on the clipboard 306 * CLIPBRD_E_CANT_OPEN OpenClipboard failed 307 * CLIPBRD_E_CANT_EMPTY EmptyClipboard failed 306 * CLIPBRD_E_CANT_OPEN OpenClipboard failed 307 * CLIPBRD_E_CANT_EMPTY EmptyClipboard failed 308 308 * CLIPBRD_E_CANT_CLOSE CloseClipboard failed 309 309 * CLIPBRD_E_CANT_SET SetClipboard failed … … 320 320 OLEClipbrd **ppDataObject; 321 321 */ 322 322 323 323 TRACE("(%p)\n", pDataObj); 324 324 325 325 /* 326 326 * Make sure we have a clipboard object … … 345 345 /* 346 346 * Empty the current clipboard and make our window the clipboard owner 347 * NOTE: This will trigger a WM_DESTROYCLIPBOARD message 347 * NOTE: This will trigger a WM_DESTROYCLIPBOARD message 348 348 */ 349 349 if ( !EmptyClipboard() ) … … 370 370 371 371 /* 372 * Enumerate all HGLOBAL formats supported by the source and make 372 * Enumerate all HGLOBAL formats supported by the source and make 373 373 * those formats available using delayed rendering using SetClipboardData. 374 * Only global memory based data items may be made available to non-OLE 375 * applications via the standard Windows clipboard API. Data based on other 374 * Only global memory based data items may be made available to non-OLE 375 * applications via the standard Windows clipboard API. Data based on other 376 376 * mediums(non TYMED_HGLOBAL) can only be accessed via the Ole Clipboard API. 377 377 * … … 387 387 HANDLE_ERROR( hr ); 388 388 } 389 389 390 390 while ( S_OK == IEnumFORMATETC_Next(penumFormatetc, 1, &rgelt, NULL) ) 391 391 { … … 396 396 GetClipboardFormatNameA(rgelt.cfFormat, szFmtName, sizeof(szFmtName)-1) 397 397 ? szFmtName : ""); 398 398 399 399 SetClipboardData( rgelt.cfFormat, (HANDLE)NULL); 400 400 } … … 405 405 /* 406 406 * Windows additionally creates a new "DataObject" clipboard format 407 * and stores in on the clipboard. We could possibly store a pointer 407 * and stores in on the clipboard. We could possibly store a pointer 408 408 * to our internal IDataObject interface on the clipboard. I'm not 409 409 * sure what the use of this is though. … … 416 416 if (hDataObject==0) 417 417 HANDLE_ERROR( E_OUTOFMEMORY ); 418 418 419 419 ppDataObject = (OLEClipbrd**)GlobalLock(hDataObject); 420 420 *ppDataObject = theOleClipboard; … … 424 424 HANDLE_ERROR( CLIPBRD_E_CANT_SET ); 425 425 */ 426 426 427 427 hr = S_OK; 428 428 … … 453 453 /*********************************************************************** 454 454 * OleGetClipboard [OLE32.105] 455 * Returns a pointer to our internal IDataObject which represents the conceptual 456 * state of the Windows clipboard. If the current clipboard already contains 455 * Returns a pointer to our internal IDataObject which represents the conceptual 456 * state of the Windows clipboard. If the current clipboard already contains 457 457 * an IDataObject, our internal IDataObject will delegate to this object. 458 458 */ … … 461 461 HRESULT hr = S_OK; 462 462 TRACE("()\n"); 463 463 464 464 /* 465 465 * Make sure we have a clipboard object … … 502 502 BOOL bClipboardOpen = FALSE; 503 503 IDataObject* pIDataObjectSrc = NULL; 504 504 505 505 TRACE("()\n"); 506 506 … … 522 522 pIDataObjectSrc = theOleClipboard->pIDataObjectSrc; 523 523 IDataObject_AddRef(pIDataObjectSrc); 524 524 525 525 /* 526 526 * Open the Windows clipboard … … 562 562 } 563 563 } 564 564 565 565 IEnumFORMATETC_Release(penumFormatetc); 566 566 567 567 /* 568 568 * Release the source data object we are holding on to … … 585 585 * OleIsCurrentClipboard [OLE32.110] 586 586 */ 587 HRESULT WINAPI OleIsCurrentClipboard ( IDataObject *pDataObject) 587 HRESULT WINAPI OleIsCurrentClipboard ( IDataObject *pDataObject) 588 588 { 589 589 TRACE("()\n"); … … 601 601 602 602 /*---------------------------------------------------------------------* 603 * Internal implementation methods for the OLE clipboard 603 * Internal implementation methods for the OLE clipboard 604 604 *---------------------------------------------------------------------*/ 605 605 606 606 /*********************************************************************** 607 607 * OLEClipbrd_Initialize() 608 * Initializes the OLE clipboard. 608 * Initializes the OLE clipboard. 609 609 */ 610 610 void OLEClipbrd_Initialize() 611 611 { 612 612 /* 613 * Create the clipboard if necessary 613 * Create the clipboard if necessary 614 614 */ 615 615 if ( !theOleClipboard ) … … 623 623 /*********************************************************************** 624 624 * OLEClipbrd_UnInitialize() 625 * Un-Initializes the OLE clipboard 625 * Un-Initializes the OLE clipboard 626 626 */ 627 627 void OLEClipbrd_UnInitialize() … … 650 650 OLEClipbrd* newObject = NULL; 651 651 HGLOBAL hNewObject = 0; 652 652 653 653 /* 654 654 * Allocate space for the object. We use GlobalAlloc since we need … … 664 664 */ 665 665 newObject = GlobalLock(hNewObject); 666 666 667 667 /* 668 668 * Initialize the virtual function table. … … 671 671 672 672 /* 673 * Start with one reference count. The caller of this function 673 * Start with one reference count. The caller of this function 674 674 * must release the interface pointer when it is done. 675 675 */ … … 677 677 678 678 newObject->hSelf = hNewObject; 679 679 680 680 /* 681 681 * The Ole clipboard is a singleton - save the global handle and pointer … … 690 690 { 691 691 TRACE("()\n"); 692 692 693 693 if ( !ptrToDestroy ) 694 694 return; 695 695 696 696 /* 697 * Destroy the Ole clipboard window 697 * Destroy the Ole clipboard window 698 698 */ 699 699 if ( ptrToDestroy->hWndClipboard ) … … 717 717 /*********************************************************************** 718 718 * OLEClipbrd_CreateWindow() 719 * Create the clipboard window 719 * Create the clipboard window 720 720 */ 721 721 static HWND OLEClipbrd_CreateWindow() … … 724 724 WNDCLASSEXA wcex; 725 725 726 /* 727 * Register the clipboard window class if necessary 726 /* 727 * Register the clipboard window class if necessary 728 728 */ 729 729 ZeroMemory( &wcex, sizeof(WNDCLASSEXA)); … … 741 741 742 742 /* 743 * Create a hidden window to receive OLE clipboard messages 743 * Create a hidden window to receive OLE clipboard messages 744 744 */ 745 745 … … 751 751 */ 752 752 753 hwnd = CreateWindowA(OLEClipbrd_WNDCLASS, 753 hwnd = CreateWindowA(OLEClipbrd_WNDCLASS, 754 754 "ClipboardWindow", 755 755 WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED, … … 770 770 static void OLEClipbrd_DestroyWindow(HWND hwnd) 771 771 { 772 /* 773 * Destroy clipboard window and unregister its WNDCLASS 772 /* 773 * Destroy clipboard window and unregister its WNDCLASS 774 774 */ 775 775 DestroyWindow(hwnd); … … 779 779 /*********************************************************************** 780 780 * OLEClipbrd_WndProc(HWND, unsigned, WORD, LONG) 781 * Processes messages sent to the OLE clipboard window. 782 * Note that we will intercept messages in our WndProc only when data 783 * has been placed in the clipboard via OleSetClipboard(). 781 * Processes messages sent to the OLE clipboard window. 782 * Note that we will intercept messages in our WndProc only when data 783 * has been placed in the clipboard via OleSetClipboard(). 784 784 * i.e. Only when OLE owns the windows clipboard. 785 785 */ … … 787 787 (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 788 788 { 789 switch (message) 789 switch (message) 790 790 { 791 791 /* 792 * WM_RENDERFORMAT 792 * WM_RENDERFORMAT 793 793 * We receive this message to allow us to handle delayed rendering of 794 * a specific clipboard format when an application requests data in 794 * a specific clipboard format when an application requests data in 795 795 * that format by calling GetClipboardData. 796 * (Recall that in OleSetClipboard, we used SetClipboardData to 796 * (Recall that in OleSetClipboard, we used SetClipboardData to 797 797 * make all HGLOBAL formats supported by the source IDataObject 798 798 * available using delayed rendering) 799 * On receiving this mesage we must actually render the data in the 800 * specified format and place it on the clipboard by calling the 801 * SetClipboardData function. 799 * On receiving this mesage we must actually render the data in the 800 * specified format and place it on the clipboard by calling the 801 * SetClipboardData function. 802 802 */ 803 803 case WM_RENDERFORMAT: 804 804 { 805 805 FORMATETC rgelt; 806 806 807 807 ZeroMemory( &rgelt, sizeof(FORMATETC)); 808 808 … … 816 816 817 817 TRACE("(): WM_RENDERFORMAT(cfFormat=%d)\n", rgelt.cfFormat); 818 818 819 819 /* 820 820 * Render the clipboard data. … … 840 840 IEnumFORMATETC* penumFormatetc = NULL; 841 841 FORMATETC rgelt; 842 842 843 843 TRACE("(): WM_RENDERALLFORMATS\n"); 844 844 845 845 /* 846 846 * Render all HGLOBAL formats supported by the source into … … 859 859 { 860 860 /* 861 * Render the clipboard data. 861 * Render the clipboard data. 862 862 */ 863 863 if ( FAILED(OLEClipbrd_RenderFormat( (IDataObject*)&(theOleClipboard->lpvtbl1), &rgelt )) ) 864 864 continue; 865 865 866 866 TRACE("(): WM_RENDERALLFORMATS(cfFormat=%d)\n", rgelt.cfFormat); 867 867 } 868 868 } 869 869 870 870 IEnumFORMATETC_Release(penumFormatetc); 871 871 … … 1006 1006 1007 1007 HeapFree(GetProcessHeap(), 0, mfBits); 1008 1008 1009 1009 GlobalUnlock(std2.u.hGlobal); 1010 1010 … … 1034 1034 * Put a copy of the rendered data back on the clipboard 1035 1035 */ 1036 1036 1037 1037 if ( !(hDup = OLEClipbrd_GlobalDupMem(hStorage)) ) 1038 1038 HANDLE_ERROR( E_OUTOFMEMORY ); 1039 1039 1040 1040 if ( !SetClipboardData( pFormatetc->cfFormat, hDup ) ) 1041 1041 { … … 1045 1045 1046 1046 CLEANUP: 1047 1047 1048 1048 ReleaseStgMedium(&std); 1049 1049 1050 1050 return hr; 1051 1051 } … … 1061 1061 PVOID pGlobalSrc, pGlobalDest; 1062 1062 DWORD cBytes; 1063 1063 1064 1064 if ( !hGlobalSrc ) 1065 1065 return 0; … … 1068 1068 if ( 0 == cBytes ) 1069 1069 return 0; 1070 1070 1071 1071 hGlobalDest = GlobalAlloc( GMEM_DDESHARE|GMEM_MOVEABLE, 1072 1072 cBytes ); 1073 1073 if ( !hGlobalDest ) 1074 1074 return 0; 1075 1075 1076 1076 pGlobalSrc = GlobalLock(hGlobalSrc); 1077 1077 pGlobalDest = GlobalLock(hGlobalDest); … … 1080 1080 1081 1081 memcpy(pGlobalDest, pGlobalSrc, cBytes); 1082 1082 1083 1083 GlobalUnlock(hGlobalSrc); 1084 1084 GlobalUnlock(hGlobalDest); … … 1089 1089 1090 1090 /*---------------------------------------------------------------------* 1091 * Implementation of the internal IDataObject interface exposed by 1091 * Implementation of the internal IDataObject interface exposed by 1092 1092 * the OLE clipboard. 1093 1093 *---------------------------------------------------------------------*/ … … 1104 1104 void** ppvObject) 1105 1105 { 1106 /* 1107 * Declare "This" pointer 1106 /* 1107 * Declare "This" pointer 1108 1108 */ 1109 1109 ICOM_THIS(OLEClipbrd, iface); 1110 1110 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObject); 1111 1111 1112 1112 /* 1113 1113 * Perform a sanity check on the parameters. … … 1115 1115 if ( (This==0) || (ppvObject==0) ) 1116 1116 return E_INVALIDARG; 1117 1117 1118 1118 /* 1119 1119 * Initialize the return parameter. … … 1124 1124 * Compare the riid with the interface IDs implemented by this object. 1125 1125 */ 1126 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 1126 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 1127 1127 { 1128 1128 *ppvObject = iface; 1129 1129 } 1130 else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) 1130 else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) 1131 1131 { 1132 1132 *ppvObject = (IDataObject*)&(This->lpvtbl1); … … 1137 1137 return E_NOINTERFACE; 1138 1138 } 1139 1139 1140 1140 /* 1141 1141 * Query Interface always increases the reference count by one when it is 1142 * successful. 1142 * successful. 1143 1143 */ 1144 1144 IUnknown_AddRef((IUnknown*)*ppvObject); … … 1152 1152 * See Windows documentation for more details on IUnknown methods. 1153 1153 */ 1154 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 1154 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 1155 1155 IDataObject* iface) 1156 1156 { 1157 /* 1158 * Declare "This" pointer 1157 /* 1158 * Declare "This" pointer 1159 1159 */ 1160 1160 ICOM_THIS(OLEClipbrd, iface); 1161 1161 1162 1162 TRACE("(%p)->(count=%lu)\n",This, This->ref); 1163 1163 1164 1164 This->ref++; 1165 1165 … … 1172 1172 * See Windows documentation for more details on IUnknown methods. 1173 1173 */ 1174 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 1174 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 1175 1175 IDataObject* iface) 1176 1176 { 1177 /* 1178 * Declare "This" pointer 1177 /* 1178 * Declare "This" pointer 1179 1179 */ 1180 1180 ICOM_THIS(OLEClipbrd, iface); 1181 1181 1182 1182 TRACE("(%p)->(count=%lu)\n",This, This->ref); 1183 1183 1184 1184 /* 1185 1185 * Decrease the reference count on this object. … … 1194 1194 OLEClipbrd_Destroy(This); 1195 1195 } 1196 1196 1197 1197 return This->ref; 1198 1198 } 1199 1199 1200 1200 1201 1201 /************************************************************************ 1202 1202 * OLEClipbrd_IDataObject_GetData (IDataObject) 1203 1203 * 1204 * The OLE Clipboard's implementation of this method delegates to 1204 * The OLE Clipboard's implementation of this method delegates to 1205 1205 * a data source if there is one or wraps around the windows clipboard 1206 1206 * … … 1209 1209 static HRESULT WINAPI OLEClipbrd_IDataObject_GetData( 1210 1210 IDataObject* iface, 1211 LPFORMATETC pformatetcIn, 1211 LPFORMATETC pformatetcIn, 1212 1212 STGMEDIUM* pmedium) 1213 1213 { … … 1218 1218 1219 1219 /* 1220 * Declare "This" pointer 1220 * Declare "This" pointer 1221 1221 */ 1222 1222 ICOM_THIS(OLEClipbrd, iface); 1223 1223 1224 1224 TRACE("(%p,%p,%p)\n", iface, pformatetcIn, pmedium); 1225 1225 … … 1247 1247 */ 1248 1248 1249 /* 1249 /* 1250 1250 * Otherwise, get the data from the windows clipboard using GetClipboardData 1251 1251 */ … … 1274 1274 } 1275 1275 1276 /* 1276 /* 1277 1277 * Return the clipboard data in the storage medium structure 1278 1278 */ … … 1280 1280 pmedium->u.hGlobal = (HGLOBAL)hData; 1281 1281 pmedium->pUnkForRelease = NULL; 1282 1282 1283 1283 hr = S_OK; 1284 1284 1285 1285 CLEANUP: 1286 1286 /* … … 1296 1296 1297 1297 static HRESULT WINAPI OLEClipbrd_IDataObject_GetDataHere( 1298 IDataObject* iface, 1298 IDataObject* iface, 1299 1299 LPFORMATETC pformatetc, 1300 1300 STGMEDIUM* pmedium) … … 1307 1307 * OLEClipbrd_IDataObject_QueryGetData (IDataObject) 1308 1308 * 1309 * The OLE Clipboard's implementation of this method delegates to 1309 * The OLE Clipboard's implementation of this method delegates to 1310 1310 * a data source if there is one or wraps around the windows clipboard 1311 1311 * function IsClipboardFormatAvailable() otherwise. … … 1317 1317 LPFORMATETC pformatetc) 1318 1318 { 1319 /* 1320 * Declare "This" pointer 1319 /* 1320 * Declare "This" pointer 1321 1321 */ 1322 1322 ICOM_THIS(OLEClipbrd, iface); … … 1348 1348 if ( pformatetc->tymed != TYMED_HGLOBAL ) 1349 1349 return DV_E_TYMED; 1350 1350 1351 1351 /* 1352 1352 * Delegate to the Windows clipboard function IsClipboardFormatAvailable … … 1361 1361 */ 1362 1362 static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc( 1363 IDataObject* iface, 1364 LPFORMATETC pformatectIn, 1363 IDataObject* iface, 1364 LPFORMATETC pformatectIn, 1365 1365 LPFORMATETC pformatetcOut) 1366 1366 { … … 1377 1377 * OLEClipbrd_IDataObject_SetData (IDataObject) 1378 1378 * 1379 * The OLE Clipboard's does not implement this method 1379 * The OLE Clipboard's does not implement this method 1380 1380 * 1381 1381 * See Windows documentation for more details on IDataObject methods. … … 1383 1383 static HRESULT WINAPI OLEClipbrd_IDataObject_SetData( 1384 1384 IDataObject* iface, 1385 LPFORMATETC pformatetc, 1386 STGMEDIUM* pmedium, 1385 LPFORMATETC pformatetc, 1386 STGMEDIUM* pmedium, 1387 1387 BOOL fRelease) 1388 1388 { … … 1406 1406 UINT format; 1407 1407 BOOL bClipboardOpen; 1408 1409 /* 1410 * Declare "This" pointer 1408 1409 /* 1410 * Declare "This" pointer 1411 1411 */ 1412 1412 ICOM_THIS(OLEClipbrd, iface); … … 1461 1461 HANDLE_ERROR( E_FAIL ); 1462 1462 } 1463 1463 1464 1464 /* Init the FORMATETC struct */ 1465 1465 afmt[i].cfFormat = format; … … 1480 1480 if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenumFormatEtc))) 1481 1481 HANDLE_ERROR( hr ); 1482 1482 1483 1483 hr = S_OK; 1484 1484 1485 1485 CLEANUP: 1486 1486 /* … … 1489 1489 if (afmt) 1490 1490 HeapFree(GetProcessHeap(), 0, afmt); 1491 1491 1492 1492 /* 1493 1493 * Close Windows clipboard … … 1502 1502 * OLEClipbrd_IDataObject_DAdvise (IDataObject) 1503 1503 * 1504 * The OLE Clipboard's does not implement this method 1504 * The OLE Clipboard's does not implement this method 1505 1505 * 1506 1506 * See Windows documentation for more details on IDataObject methods. 1507 1507 */ 1508 1508 static HRESULT WINAPI OLEClipbrd_IDataObject_DAdvise( 1509 IDataObject* iface, 1510 FORMATETC* pformatetc, 1511 DWORD advf, 1512 IAdviseSink* pAdvSink, 1509 IDataObject* iface, 1510 FORMATETC* pformatetc, 1511 DWORD advf, 1512 IAdviseSink* pAdvSink, 1513 1513 DWORD* pdwConnection) 1514 1514 { … … 1520 1520 * OLEClipbrd_IDataObject_DUnadvise (IDataObject) 1521 1521 * 1522 * The OLE Clipboard's does not implement this method 1522 * The OLE Clipboard's does not implement this method 1523 1523 * 1524 1524 * See Windows documentation for more details on IDataObject methods. … … 1567 1567 DWORD size=cfmt * sizeof(FORMATETC); 1568 1568 LPMALLOC pIMalloc; 1569 1569 1570 1570 ef = (IEnumFORMATETCImpl*)HeapAlloc(GetProcessHeap(), 1571 1571 HEAP_ZERO_MEMORY, … … 1573 1573 if (!ef) 1574 1574 return NULL; 1575 1575 1576 1576 ef->ref = 0; 1577 1577 ICOM_VTBL(ef) = &efvt; 1578 1578 ef->pUnkDataObj = pUnkDataObj; 1579 1579 1580 1580 ef->posFmt = 0; 1581 1581 ef->countFmt = cfmt; … … 1584 1584 ef->pFmt = (LPFORMATETC)IMalloc_Alloc(pIMalloc, size); 1585 1585 IMalloc_Release(pIMalloc); 1586 1586 1587 1587 if (ef->pFmt) 1588 1588 memcpy(ef->pFmt, afmt, size); 1589 1589 1590 1590 TRACE("(%p)->()\n",ef); 1591 1591 return (LPENUMFORMATETC)ef; … … 1609 1609 * we only need to support the IUnknown and IEnumFORMATETC interfaces 1610 1610 */ 1611 1611 1612 1612 *ppvObj = NULL; 1613 1613 1614 1614 if(IsEqualIID(riid, &IID_IUnknown)) 1615 1615 { … … 1619 1619 { 1620 1620 *ppvObj = (IDataObject*)This; 1621 } 1622 1621 } 1622 1623 1623 if(*ppvObj) 1624 1624 { … … 1627 1627 return S_OK; 1628 1628 } 1629 1629 1630 1630 TRACE("-- Interface: E_NOINTERFACE\n"); 1631 1631 return E_NOINTERFACE; … … 1648 1648 if (This->pUnkDataObj) 1649 1649 IUnknown_AddRef(This->pUnkDataObj); 1650 1650 1651 1651 return ++(This->ref); 1652 1652 } … … 1666 1666 if (This->pUnkDataObj) 1667 1667 IUnknown_Release(This->pUnkDataObj); /* Release parent data object */ 1668 1669 if (!--(This->ref)) 1668 1669 if (!--(This->ref)) 1670 1670 { 1671 1671 TRACE("() - destroying IEnumFORMATETC(%p)\n",This); … … 1675 1675 IMalloc_Release(pIMalloc); 1676 1676 } 1677 1677 1678 1678 HeapFree(GetProcessHeap(),0,This); 1679 1679 return 0; … … 1694 1694 UINT cfetch; 1695 1695 HRESULT hres = S_FALSE; 1696 1696 1697 1697 TRACE("(%p)->(pos=%u)\n", This, This->posFmt); 1698 1698 1699 1699 if (This->posFmt < This->countFmt) 1700 1700 { … … 1705 1705 hres = S_OK; 1706 1706 } 1707 1707 1708 1708 memcpy(rgelt, &This->pFmt[This->posFmt], cfetch * sizeof(FORMATETC)); 1709 1709 This->posFmt += cfetch; … … 1713 1713 cfetch = 0; 1714 1714 } 1715 1715 1716 1716 if (pceltFethed) 1717 1717 { 1718 1718 *pceltFethed = cfetch; 1719 1719 } 1720 1720 1721 1721 return hres; 1722 1722 } … … 1731 1731 ICOM_THIS(IEnumFORMATETCImpl,iface); 1732 1732 TRACE("(%p)->(num=%lu)\n", This, celt); 1733 1733 1734 1734 This->posFmt += celt; 1735 1735 if (This->posFmt > This->countFmt) … … 1750 1750 ICOM_THIS(IEnumFORMATETCImpl,iface); 1751 1751 TRACE("(%p)->()\n", This); 1752 1752 1753 1753 This->posFmt = 0; 1754 1754 return S_OK; … … 1765 1765 ICOM_THIS(IEnumFORMATETCImpl,iface); 1766 1766 HRESULT hr = S_OK; 1767 1767 1768 1768 TRACE("(%p)->(ppenum=%p)\n", This, ppenum); 1769 1769 … … 1777 1777 if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenum))) 1778 1778 return ( hr ); 1779 1779 1780 1780 return (*ppenum) ? S_OK : E_OUTOFMEMORY; 1781 1781 }  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  