Changeset 6648 for trunk/src/ole32/clipboard.c
- Timestamp:
- Sep 5, 2001, 3:19:02 PM (24 years ago)
- File:
-
- 1 edited
-
trunk/src/ole32/clipboard.c (modified) (88 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/clipboard.c
r5602 r6648 1 /* $Id: clipboard.c,v 1.2 2001-09-05 13:17:07 bird Exp $ */ 1 2 /* 2 3 * OLE 2 clipboard support … … 81 82 82 83 /* 83 * The hidden OLE clipboard window. This window is used as the bridge between the 84 * The hidden OLE clipboard window. This window is used as the bridge between the 84 85 * the OLE and windows clipboard API. (Windows creates one such window per process) 85 86 */ … … 114 115 * DO NOT add any members before the VTables declaration! 115 116 */ 116 typedef struct 117 typedef struct 117 118 { 118 119 /* IEnumFORMATETC VTable */ 119 120 ICOM_VFIELD(IEnumFORMATETC); 120 121 121 122 /* IEnumFORMATETC fields */ 122 123 UINT posFmt; /* current enumerator position */ … … 133 134 */ 134 135 IUnknown* pUnkDataObj; 135 136 136 137 } IEnumFORMATETCImpl; 137 138 … … 172 173 REFIID riid, 173 174 void** ppvObject); 174 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 175 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 175 176 IDataObject* iface); 176 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 177 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 177 178 IDataObject* iface); 178 179 static HRESULT WINAPI OLEClipbrd_IDataObject_GetData( 179 IDataObject* iface,180 LPFORMATETC pformatetcIn, 181 STGMEDIUM* pmedium);180 IDataObject* iface, 181 LPFORMATETC pformatetcIn, 182 STGMEDIUM* pmedium); 182 183 static HRESULT WINAPI OLEClipbrd_IDataObject_GetDataHere( 183 IDataObject* iface, 184 LPFORMATETC pformatetc,185 STGMEDIUM* pmedium);184 IDataObject* iface, 185 LPFORMATETC pformatetc, 186 STGMEDIUM* pmedium); 186 187 static HRESULT WINAPI OLEClipbrd_IDataObject_QueryGetData( 187 IDataObject* iface,188 LPFORMATETC pformatetc);188 IDataObject* iface, 189 LPFORMATETC pformatetc); 189 190 static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc( 190 IDataObject* iface, 191 LPFORMATETC pformatectIn, 192 LPFORMATETC pformatetcOut);191 IDataObject* iface, 192 LPFORMATETC pformatectIn, 193 LPFORMATETC pformatetcOut); 193 194 static HRESULT WINAPI OLEClipbrd_IDataObject_SetData( 194 IDataObject* iface,195 LPFORMATETC pformatetc, 196 STGMEDIUM* pmedium, 197 BOOL fRelease);195 IDataObject* iface, 196 LPFORMATETC pformatetc, 197 STGMEDIUM* pmedium, 198 BOOL fRelease); 198 199 static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc( 199 IDataObject* iface, 200 DWORD dwDirection,201 IEnumFORMATETC** ppenumFormatEtc);200 IDataObject* iface, 201 DWORD dwDirection, 202 IEnumFORMATETC** ppenumFormatEtc); 202 203 static HRESULT WINAPI OLEClipbrd_IDataObject_DAdvise( 203 IDataObject* iface, 204 FORMATETC* pformatetc, 205 DWORD advf, 206 IAdviseSink* pAdvSink, 207 DWORD* pdwConnection);204 IDataObject* iface, 205 FORMATETC* pformatetc, 206 DWORD advf, 207 IAdviseSink* pAdvSink, 208 DWORD* pdwConnection); 208 209 static HRESULT WINAPI OLEClipbrd_IDataObject_DUnadvise( 209 IDataObject* iface,210 DWORD dwConnection);210 IDataObject* iface, 211 DWORD dwConnection); 211 212 static HRESULT WINAPI OLEClipbrd_IDataObject_EnumDAdvise( 212 IDataObject* iface,213 IEnumSTATDATA** ppenumAdvise);213 IDataObject* iface, 214 IEnumSTATDATA** ppenumAdvise); 214 215 215 216 /* … … 265 266 266 267 /* 267 * Name of our registered OLE clipboard window class 268 * Name of our registered OLE clipboard window class 268 269 */ 269 270 CHAR OLEClipbrd_WNDCLASS[] = "CLIPBRDWNDCLASS"; … … 279 280 280 281 /*---------------------------------------------------------------------* 281 * Win32 OLE clipboard API 282 * Win32 OLE clipboard API 282 283 *---------------------------------------------------------------------*/ 283 284 … … 290 291 * 291 292 * S_OK IDataObject pointer placed on the clipboard 292 * CLIPBRD_E_CANT_OPEN OpenClipboard failed 293 * CLIPBRD_E_CANT_EMPTY EmptyClipboard failed 293 * CLIPBRD_E_CANT_OPEN OpenClipboard failed 294 * CLIPBRD_E_CANT_EMPTY EmptyClipboard failed 294 295 * CLIPBRD_E_CANT_CLOSE CloseClipboard failed 295 296 * CLIPBRD_E_CANT_SET SetClipboard failed … … 306 307 OLEClipbrd **ppDataObject; 307 308 */ 308 309 309 310 TRACE("(%p)\n", pDataObj); 310 311 311 312 /* 312 313 * Make sure we have a clipboard object … … 331 332 /* 332 333 * Empty the current clipboard and make our window the clipboard owner 333 * NOTE: This will trigger a WM_DESTROYCLIPBOARD message 334 * NOTE: This will trigger a WM_DESTROYCLIPBOARD message 334 335 */ 335 336 if ( !EmptyClipboard() ) … … 356 357 357 358 /* 358 * Enumerate all HGLOBAL formats supported by the source and make 359 * Enumerate all HGLOBAL formats supported by the source and make 359 360 * those formats available using delayed rendering using SetClipboardData. 360 * Only global memory based data items may be made available to non-OLE 361 * applications via the standard Windows clipboard API. Data based on other 361 * Only global memory based data items may be made available to non-OLE 362 * applications via the standard Windows clipboard API. Data based on other 362 363 * mediums(non TYMED_HGLOBAL) can only be accessed via the Ole Clipboard API. 363 364 * … … 373 374 HANDLE_ERROR( hr ); 374 375 } 375 376 376 377 while ( S_OK == IEnumFORMATETC_Next(penumFormatetc, 1, &rgelt, NULL) ) 377 378 { … … 382 383 GetClipboardFormatNameA(rgelt.cfFormat, szFmtName, sizeof(szFmtName)-1) 383 384 ? szFmtName : ""); 384 385 385 386 SetClipboardData( rgelt.cfFormat, (HANDLE)NULL); 386 387 } … … 391 392 /* 392 393 * Windows additionally creates a new "DataObject" clipboard format 393 * and stores in on the clipboard. We could possibly store a pointer 394 * and stores in on the clipboard. We could possibly store a pointer 394 395 * to our internal IDataObject interface on the clipboard. I'm not 395 396 * sure what the use of this is though. … … 402 403 if (hDataObject==0) 403 404 HANDLE_ERROR( E_OUTOFMEMORY ); 404 405 405 406 ppDataObject = (OLEClipbrd**)GlobalLock(hDataObject); 406 407 *ppDataObject = theOleClipboard; … … 410 411 HANDLE_ERROR( CLIPBRD_E_CANT_SET ); 411 412 */ 412 413 413 414 hr = S_OK; 414 415 … … 439 440 /*********************************************************************** 440 441 * OleGetClipboard [OLE32.105] 441 * Returns a pointer to our internal IDataObject which represents the conceptual 442 * state of the Windows clipboard. If the current clipboard already contains 442 * Returns a pointer to our internal IDataObject which represents the conceptual 443 * state of the Windows clipboard. If the current clipboard already contains 443 444 * an IDataObject, our internal IDataObject will delegate to this object. 444 445 */ … … 447 448 HRESULT hr = S_OK; 448 449 TRACE("()\n"); 449 450 450 451 /* 451 452 * Make sure we have a clipboard object … … 488 489 BOOL bClipboardOpen = FALSE; 489 490 IDataObject* pIDataObjectSrc = NULL; 490 491 491 492 TRACE("()\n"); 492 493 … … 508 509 pIDataObjectSrc = theOleClipboard->pIDataObjectSrc; 509 510 IDataObject_AddRef(pIDataObjectSrc); 510 511 511 512 /* 512 513 * Open the Windows clipboard … … 548 549 } 549 550 } 550 551 551 552 IEnumFORMATETC_Release(penumFormatetc); 552 553 553 554 /* 554 555 * Release the source data object we are holding on to … … 571 572 * OleIsCurrentClipboard [OLE32.110] 572 573 */ 573 HRESULT WINAPI OleIsCurrentClipboard ( IDataObject *pDataObject) 574 HRESULT WINAPI OleIsCurrentClipboard ( IDataObject *pDataObject) 574 575 { 575 576 TRACE("()\n"); … … 587 588 588 589 /*---------------------------------------------------------------------* 589 * Internal implementation methods for the OLE clipboard 590 * Internal implementation methods for the OLE clipboard 590 591 *---------------------------------------------------------------------*/ 591 592 592 593 /*********************************************************************** 593 594 * OLEClipbrd_Initialize() 594 * Initializes the OLE clipboard. 595 * Initializes the OLE clipboard. 595 596 */ 596 597 void OLEClipbrd_Initialize() 597 598 { 598 599 /* 599 * Create the clipboard if necessary 600 * Create the clipboard if necessary 600 601 */ 601 602 if ( !theOleClipboard ) … … 609 610 /*********************************************************************** 610 611 * OLEClipbrd_UnInitialize() 611 * Un-Initializes the OLE clipboard 612 * Un-Initializes the OLE clipboard 612 613 */ 613 614 void OLEClipbrd_UnInitialize() … … 636 637 OLEClipbrd* newObject = NULL; 637 638 HGLOBAL hNewObject = 0; 638 639 639 640 /* 640 641 * Allocate space for the object. We use GlobalAlloc since we need … … 650 651 */ 651 652 newObject = GlobalLock(hNewObject); 652 653 653 654 /* 654 655 * Initialize the virtual function table. … … 657 658 658 659 /* 659 * Start with one reference count. The caller of this function 660 * Start with one reference count. The caller of this function 660 661 * must release the interface pointer when it is done. 661 662 */ … … 663 664 664 665 newObject->hSelf = hNewObject; 665 666 666 667 /* 667 668 * The Ole clipboard is a singleton - save the global handle and pointer … … 676 677 { 677 678 TRACE("()\n"); 678 679 679 680 if ( !ptrToDestroy ) 680 681 return; 681 682 682 683 /* 683 * Destroy the Ole clipboard window 684 * Destroy the Ole clipboard window 684 685 */ 685 686 if ( ptrToDestroy->hWndClipboard ) … … 703 704 /*********************************************************************** 704 705 * OLEClipbrd_CreateWindow() 705 * Create the clipboard window 706 * Create the clipboard window 706 707 */ 707 708 static HWND OLEClipbrd_CreateWindow() … … 710 711 WNDCLASSEXA wcex; 711 712 712 /* 713 * Register the clipboard window class if necessary 713 /* 714 * Register the clipboard window class if necessary 714 715 */ 715 716 ZeroMemory( &wcex, sizeof(WNDCLASSEXA)); … … 727 728 728 729 /* 729 * Create a hidden window to receive OLE clipboard messages 730 * Create a hidden window to receive OLE clipboard messages 730 731 */ 731 732 … … 737 738 */ 738 739 739 hwnd = CreateWindowA(OLEClipbrd_WNDCLASS, 740 "ClipboardWindow",741 WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED,742 CW_USEDEFAULT, CW_USEDEFAULT,743 CW_USEDEFAULT, CW_USEDEFAULT,744 0,745 0,746 0,747 0 /*(LPVOID)&clipboardInfo */);740 hwnd = CreateWindowA(OLEClipbrd_WNDCLASS, 741 "ClipboardWindow", 742 WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED, 743 CW_USEDEFAULT, CW_USEDEFAULT, 744 CW_USEDEFAULT, CW_USEDEFAULT, 745 0, 746 0, 747 0, 748 0 /*(LPVOID)&clipboardInfo */); 748 749 749 750 return hwnd; … … 756 757 static void OLEClipbrd_DestroyWindow(HWND hwnd) 757 758 { 758 /* 759 * Destroy clipboard window and unregister its WNDCLASS 759 /* 760 * Destroy clipboard window and unregister its WNDCLASS 760 761 */ 761 762 DestroyWindow(hwnd); … … 765 766 /*********************************************************************** 766 767 * OLEClipbrd_WndProc(HWND, unsigned, WORD, LONG) 767 * Processes messages sent to the OLE clipboard window. 768 * Note that we will intercept messages in our WndProc only when data 769 * has been placed in the clipboard via OleSetClipboard(). 768 * Processes messages sent to the OLE clipboard window. 769 * Note that we will intercept messages in our WndProc only when data 770 * has been placed in the clipboard via OleSetClipboard(). 770 771 * i.e. Only when OLE owns the windows clipboard. 771 772 */ … … 773 774 (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 774 775 { 775 switch (message) 776 switch (message) 776 777 { 777 778 /* 778 * WM_RENDERFORMAT 779 * WM_RENDERFORMAT 779 780 * We receive this message to allow us to handle delayed rendering of 780 * a specific clipboard format when an application requests data in 781 * a specific clipboard format when an application requests data in 781 782 * that format by calling GetClipboardData. 782 * (Recall that in OleSetClipboard, we used SetClipboardData to 783 * (Recall that in OleSetClipboard, we used SetClipboardData to 783 784 * make all HGLOBAL formats supported by the source IDataObject 784 785 * available using delayed rendering) 785 * On receiving this mesage we must actually render the data in the 786 * specified format and place it on the clipboard by calling the 787 * SetClipboardData function. 786 * On receiving this mesage we must actually render the data in the 787 * specified format and place it on the clipboard by calling the 788 * SetClipboardData function. 788 789 */ 789 790 case WM_RENDERFORMAT: 790 791 { 791 792 FORMATETC rgelt; 792 793 793 794 ZeroMemory( &rgelt, sizeof(FORMATETC)); 794 795 … … 802 803 803 804 TRACE("(): WM_RENDERFORMAT(cfFormat=%d)\n", rgelt.cfFormat); 804 805 805 806 /* 806 807 * Render the clipboard data. … … 826 827 IEnumFORMATETC* penumFormatetc = NULL; 827 828 FORMATETC rgelt; 828 829 829 830 TRACE("(): WM_RENDERALLFORMATS\n"); 830 831 831 832 /* 832 833 * Render all HGLOBAL formats supported by the source into … … 845 846 { 846 847 /* 847 * Render the clipboard data. 848 * Render the clipboard data. 848 849 */ 849 850 if ( FAILED(OLEClipbrd_RenderFormat( (IDataObject*)&(theOleClipboard->lpvtbl1), &rgelt )) ) 850 851 continue; 851 852 852 853 TRACE("(): WM_RENDERALLFORMATS(cfFormat=%d)\n", rgelt.cfFormat); 853 854 } 854 855 } 855 856 856 857 IEnumFORMATETC_Release(penumFormatetc); 857 858 … … 992 993 993 994 HeapFree(GetProcessHeap(), 0, mfBits); 994 995 995 996 GlobalUnlock(std2.u.hMetaFilePict); 996 997 … … 1020 1021 * Put a copy of the rendered data back on the clipboard 1021 1022 */ 1022 1023 1023 1024 if ( !(hDup = OLEClipbrd_GlobalDupMem(hStorage)) ) 1024 1025 HANDLE_ERROR( E_OUTOFMEMORY ); 1025 1026 1026 1027 if ( !SetClipboardData( pFormatetc->cfFormat, hDup ) ) 1027 1028 { … … 1031 1032 1032 1033 CLEANUP: 1033 1034 1034 1035 ReleaseStgMedium(&std); 1035 1036 1036 1037 return hr; 1037 1038 } … … 1047 1048 PVOID pGlobalSrc, pGlobalDest; 1048 1049 DWORD cBytes; 1049 1050 1050 1051 if ( !hGlobalSrc ) 1051 1052 return 0; … … 1054 1055 if ( 0 == cBytes ) 1055 1056 return 0; 1056 1057 1057 1058 hGlobalDest = GlobalAlloc( GMEM_DDESHARE|GMEM_MOVEABLE, 1058 1059 cBytes ); 1059 1060 if ( !hGlobalDest ) 1060 1061 return 0; 1061 1062 1062 1063 pGlobalSrc = GlobalLock(hGlobalSrc); 1063 1064 pGlobalDest = GlobalLock(hGlobalDest); … … 1066 1067 1067 1068 memcpy(pGlobalDest, pGlobalSrc, cBytes); 1068 1069 1069 1070 GlobalUnlock(hGlobalSrc); 1070 1071 GlobalUnlock(hGlobalDest); … … 1075 1076 1076 1077 /*---------------------------------------------------------------------* 1077 * Implementation of the internal IDataObject interface exposed by 1078 * Implementation of the internal IDataObject interface exposed by 1078 1079 * the OLE clipboard. 1079 1080 *---------------------------------------------------------------------*/ … … 1090 1091 void** ppvObject) 1091 1092 { 1092 /* 1093 * Declare "This" pointer 1093 /* 1094 * Declare "This" pointer 1094 1095 */ 1095 1096 ICOM_THIS(OLEClipbrd, iface); 1096 1097 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObject); 1097 1098 1098 1099 /* 1099 1100 * Perform a sanity check on the parameters. … … 1101 1102 if ( (This==0) || (ppvObject==0) ) 1102 1103 return E_INVALIDARG; 1103 1104 1104 1105 /* 1105 1106 * Initialize the return parameter. … … 1110 1111 * Compare the riid with the interface IDs implemented by this object. 1111 1112 */ 1112 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 1113 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 1113 1114 { 1114 1115 *ppvObject = iface; 1115 1116 } 1116 else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) 1117 else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) 1117 1118 { 1118 1119 *ppvObject = (IDataObject*)&(This->lpvtbl1); … … 1123 1124 return E_NOINTERFACE; 1124 1125 } 1125 1126 1126 1127 /* 1127 1128 * Query Interface always increases the reference count by one when it is 1128 * successful. 1129 * successful. 1129 1130 */ 1130 1131 IUnknown_AddRef((IUnknown*)*ppvObject); … … 1138 1139 * See Windows documentation for more details on IUnknown methods. 1139 1140 */ 1140 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 1141 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 1141 1142 IDataObject* iface) 1142 1143 { 1143 /* 1144 * Declare "This" pointer 1144 /* 1145 * Declare "This" pointer 1145 1146 */ 1146 1147 ICOM_THIS(OLEClipbrd, iface); 1147 1148 1148 1149 TRACE("(%p)->(count=%lu)\n",This, This->ref); 1149 1150 1150 1151 This->ref++; 1151 1152 … … 1158 1159 * See Windows documentation for more details on IUnknown methods. 1159 1160 */ 1160 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 1161 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 1161 1162 IDataObject* iface) 1162 1163 { 1163 /* 1164 * Declare "This" pointer 1164 /* 1165 * Declare "This" pointer 1165 1166 */ 1166 1167 ICOM_THIS(OLEClipbrd, iface); 1167 1168 1168 1169 TRACE("(%p)->(count=%lu)\n",This, This->ref); 1169 1170 1170 1171 /* 1171 1172 * Decrease the reference count on this object. … … 1180 1181 OLEClipbrd_Destroy(This); 1181 1182 } 1182 1183 1183 1184 return This->ref; 1184 1185 } 1185 1186 1186 1187 1187 1188 /************************************************************************ 1188 1189 * OLEClipbrd_IDataObject_GetData (IDataObject) 1189 1190 * 1190 * The OLE Clipboard's implementation of this method delegates to 1191 * The OLE Clipboard's implementation of this method delegates to 1191 1192 * a data source if there is one or wraps around the windows clipboard 1192 1193 * … … 1194 1195 */ 1195 1196 static HRESULT WINAPI OLEClipbrd_IDataObject_GetData( 1196 IDataObject* iface,1197 LPFORMATETC pformatetcIn, 1198 STGMEDIUM* pmedium)1197 IDataObject* iface, 1198 LPFORMATETC pformatetcIn, 1199 STGMEDIUM* pmedium) 1199 1200 { 1200 1201 HANDLE hData = 0; … … 1203 1204 1204 1205 /* 1205 * Declare "This" pointer 1206 * Declare "This" pointer 1206 1207 */ 1207 1208 ICOM_THIS(OLEClipbrd, iface); 1208 1209 1209 1210 TRACE("(%p,%p,%p)\n", iface, pformatetcIn, pmedium); 1210 1211 … … 1232 1233 */ 1233 1234 1234 /* 1235 /* 1235 1236 * Otherwise, get the data from the windows clipboard using GetClipboardData 1236 1237 */ … … 1240 1241 hData = GetClipboardData(pformatetcIn->cfFormat); 1241 1242 1242 /* 1243 /* 1243 1244 * Return the clipboard data in the storage medium structure 1244 1245 */ … … 1246 1247 pmedium->u.hGlobal = (HGLOBAL)hData; 1247 1248 pmedium->pUnkForRelease = NULL; 1248 1249 1249 1250 hr = S_OK; 1250 1251 1251 1252 CLEANUP: 1252 1253 /* … … 1262 1263 1263 1264 static HRESULT WINAPI OLEClipbrd_IDataObject_GetDataHere( 1264 IDataObject* iface, 1265 LPFORMATETC pformatetc,1266 STGMEDIUM* pmedium)1265 IDataObject* iface, 1266 LPFORMATETC pformatetc, 1267 STGMEDIUM* pmedium) 1267 1268 { 1268 1269 FIXME(": Stub\n"); … … 1273 1274 * OLEClipbrd_IDataObject_QueryGetData (IDataObject) 1274 1275 * 1275 * The OLE Clipboard's implementation of this method delegates to 1276 * The OLE Clipboard's implementation of this method delegates to 1276 1277 * a data source if there is one or wraps around the windows clipboard 1277 1278 * function IsClipboardFormatAvailable() otherwise. … … 1280 1281 */ 1281 1282 static HRESULT WINAPI OLEClipbrd_IDataObject_QueryGetData( 1282 IDataObject* iface,1283 LPFORMATETC pformatetc)1284 { 1285 /* 1286 * Declare "This" pointer 1283 IDataObject* iface, 1284 LPFORMATETC pformatetc) 1285 { 1286 /* 1287 * Declare "This" pointer 1287 1288 */ 1288 1289 ICOM_THIS(OLEClipbrd, iface); … … 1314 1315 if ( pformatetc->tymed != TYMED_HGLOBAL ) 1315 1316 return DV_E_TYMED; 1316 1317 1317 1318 /* 1318 1319 * Delegate to the Windows clipboard function IsClipboardFormatAvailable … … 1327 1328 */ 1328 1329 static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc( 1329 IDataObject* iface, 1330 LPFORMATETC pformatectIn, 1331 LPFORMATETC pformatetcOut)1330 IDataObject* iface, 1331 LPFORMATETC pformatectIn, 1332 LPFORMATETC pformatetcOut) 1332 1333 { 1333 1334 TRACE("(%p, %p, %p)\n", iface, pformatectIn, pformatetcOut); … … 1343 1344 * OLEClipbrd_IDataObject_SetData (IDataObject) 1344 1345 * 1345 * The OLE Clipboard's does not implement this method 1346 * The OLE Clipboard's does not implement this method 1346 1347 * 1347 1348 * See Windows documentation for more details on IDataObject methods. 1348 1349 */ 1349 1350 static HRESULT WINAPI OLEClipbrd_IDataObject_SetData( 1350 IDataObject* iface,1351 LPFORMATETC pformatetc, 1352 STGMEDIUM* pmedium, 1353 BOOL fRelease)1351 IDataObject* iface, 1352 LPFORMATETC pformatetc, 1353 STGMEDIUM* pmedium, 1354 BOOL fRelease) 1354 1355 { 1355 1356 TRACE("\n"); … … 1363 1364 */ 1364 1365 static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc( 1365 IDataObject* iface,1366 DWORD dwDirection,1367 IEnumFORMATETC** ppenumFormatEtc)1366 IDataObject* iface, 1367 DWORD dwDirection, 1368 IEnumFORMATETC** ppenumFormatEtc) 1368 1369 { 1369 1370 HRESULT hr = S_OK; … … 1372 1373 UINT format; 1373 1374 BOOL bClipboardOpen; 1374 1375 /* 1376 * Declare "This" pointer 1375 1376 /* 1377 * Declare "This" pointer 1377 1378 */ 1378 1379 ICOM_THIS(OLEClipbrd, iface); … … 1427 1428 HANDLE_ERROR( E_FAIL ); 1428 1429 } 1429 1430 1430 1431 /* Init the FORMATETC struct */ 1431 1432 afmt[i].cfFormat = format; … … 1446 1447 if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenumFormatEtc))) 1447 1448 HANDLE_ERROR( hr ); 1448 1449 1449 1450 hr = S_OK; 1450 1451 1451 1452 CLEANUP: 1452 1453 /* … … 1455 1456 if (afmt) 1456 1457 HeapFree(GetProcessHeap(), 0, afmt); 1457 1458 1458 1459 /* 1459 1460 * Close Windows clipboard … … 1468 1469 * OLEClipbrd_IDataObject_DAdvise (IDataObject) 1469 1470 * 1470 * The OLE Clipboard's does not implement this method 1471 * The OLE Clipboard's does not implement this method 1471 1472 * 1472 1473 * See Windows documentation for more details on IDataObject methods. 1473 1474 */ 1474 1475 static HRESULT WINAPI OLEClipbrd_IDataObject_DAdvise( 1475 IDataObject* iface, 1476 FORMATETC* pformatetc, 1477 DWORD advf, 1478 IAdviseSink* pAdvSink, 1479 DWORD* pdwConnection)1476 IDataObject* iface, 1477 FORMATETC* pformatetc, 1478 DWORD advf, 1479 IAdviseSink* pAdvSink, 1480 DWORD* pdwConnection) 1480 1481 { 1481 1482 TRACE("\n"); … … 1486 1487 * OLEClipbrd_IDataObject_DUnadvise (IDataObject) 1487 1488 * 1488 * The OLE Clipboard's does not implement this method 1489 * The OLE Clipboard's does not implement this method 1489 1490 * 1490 1491 * See Windows documentation for more details on IDataObject methods. 1491 1492 */ 1492 1493 static HRESULT WINAPI OLEClipbrd_IDataObject_DUnadvise( 1493 IDataObject* iface,1494 DWORD dwConnection)1494 IDataObject* iface, 1495 DWORD dwConnection) 1495 1496 { 1496 1497 TRACE("\n"); … … 1506 1507 */ 1507 1508 static HRESULT WINAPI OLEClipbrd_IDataObject_EnumDAdvise( 1508 IDataObject* iface,1509 IEnumSTATDATA** ppenumAdvise)1509 IDataObject* iface, 1510 IEnumSTATDATA** ppenumAdvise) 1510 1511 { 1511 1512 TRACE("\n"); … … 1533 1534 DWORD size=cfmt * sizeof(FORMATETC); 1534 1535 LPMALLOC pIMalloc; 1535 1536 1536 1537 ef = (IEnumFORMATETCImpl*)HeapAlloc(GetProcessHeap(), 1537 1538 HEAP_ZERO_MEMORY, … … 1539 1540 if (!ef) 1540 1541 return NULL; 1541 1542 1542 1543 ef->ref = 0; 1543 1544 ICOM_VTBL(ef) = &efvt; 1544 1545 ef->pUnkDataObj = pUnkDataObj; 1545 1546 1546 1547 ef->posFmt = 0; 1547 1548 ef->countFmt = cfmt; … … 1550 1551 ef->pFmt = (LPFORMATETC)IMalloc_Alloc(pIMalloc, size); 1551 1552 IMalloc_Release(pIMalloc); 1552 1553 1553 1554 if (ef->pFmt) 1554 1555 memcpy(ef->pFmt, afmt, size); 1555 1556 1556 1557 TRACE("(%p)->()\n",ef); 1557 1558 return (LPENUMFORMATETC)ef; … … 1575 1576 * we only need to support the IUnknown and IEnumFORMATETC interfaces 1576 1577 */ 1577 1578 1578 1579 *ppvObj = NULL; 1579 1580 1580 1581 if(IsEqualIID(riid, &IID_IUnknown)) 1581 1582 { … … 1585 1586 { 1586 1587 *ppvObj = (IDataObject*)This; 1587 } 1588 1588 } 1589 1589 1590 if(*ppvObj) 1590 1591 { … … 1593 1594 return S_OK; 1594 1595 } 1595 1596 1596 1597 TRACE("-- Interface: E_NOINTERFACE\n"); 1597 1598 return E_NOINTERFACE; … … 1614 1615 if (This->pUnkDataObj) 1615 1616 IUnknown_AddRef(This->pUnkDataObj); 1616 1617 1617 1618 return ++(This->ref); 1618 1619 } … … 1632 1633 if (This->pUnkDataObj) 1633 1634 IUnknown_Release(This->pUnkDataObj); /* Release parent data object */ 1634 1635 if (!--(This->ref)) 1635 1636 if (!--(This->ref)) 1636 1637 { 1637 1638 TRACE("() - destroying IEnumFORMATETC(%p)\n",This); … … 1641 1642 IMalloc_Release(pIMalloc); 1642 1643 } 1643 1644 1644 1645 HeapFree(GetProcessHeap(),0,This); 1645 1646 return 0; … … 1660 1661 UINT cfetch; 1661 1662 HRESULT hres = S_FALSE; 1662 1663 1663 1664 TRACE("(%p)->(pos=%u)\n", This, This->posFmt); 1664 1665 1665 1666 if (This->posFmt < This->countFmt) 1666 1667 { … … 1671 1672 hres = S_OK; 1672 1673 } 1673 1674 1674 1675 memcpy(rgelt, &This->pFmt[This->posFmt], cfetch * sizeof(FORMATETC)); 1675 1676 This->posFmt += cfetch; … … 1679 1680 cfetch = 0; 1680 1681 } 1681 1682 1682 1683 if (pceltFethed) 1683 1684 { 1684 1685 *pceltFethed = cfetch; 1685 1686 } 1686 1687 1687 1688 return hres; 1688 1689 } … … 1697 1698 ICOM_THIS(IEnumFORMATETCImpl,iface); 1698 1699 TRACE("(%p)->(num=%lu)\n", This, celt); 1699 1700 1700 1701 This->posFmt += celt; 1701 1702 if (This->posFmt > This->countFmt) … … 1716 1717 ICOM_THIS(IEnumFORMATETCImpl,iface); 1717 1718 TRACE("(%p)->()\n", This); 1718 1719 1719 1720 This->posFmt = 0; 1720 1721 return S_OK; … … 1731 1732 ICOM_THIS(IEnumFORMATETCImpl,iface); 1732 1733 HRESULT hr = S_OK; 1733 1734 1734 1735 TRACE("(%p)->(ppenum=%p)\n", This, ppenum); 1735 1736 … … 1743 1744 if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenum))) 1744 1745 return ( hr ); 1745 1746 1746 1747 return (*ppenum) ? S_OK : E_OUTOFMEMORY; 1747 1748 }
Note:
See TracChangeset
for help on using the changeset viewer.
