- Timestamp:
- Jun 9, 2002, 6:37:22 PM (23 years ago)
- Location:
- trunk/src/ole32
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/antimoniker.c
r8441 r8620 37 37 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ 38 38 39 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 39 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 40 40 * two monikers are equal. That's whay IROTData interface is implemented by monikers. 41 41 */ … … 143 143 { 144 144 ICOM_THIS(AntiMonikerImpl,iface); 145 145 146 146 TRACE("(%p,%p,%p)\n",This,riid,ppvObject); 147 147 … … 149 149 if ( (This==0) || (ppvObject==0) ) 150 150 return E_INVALIDARG; 151 151 152 152 /* Initialize the return parameter */ 153 153 *ppvObject = 0; … … 166 166 if ((*ppvObject)==0) 167 167 return E_NOINTERFACE; 168 168 169 169 /* Query Interface always increases the reference count by one when it is successful */ 170 170 AntiMonikerImpl_AddRef(iface); … … 203 203 return 0; 204 204 } 205 return This->ref; ;205 return This->ref; 206 206 } 207 207 … … 215 215 if (pClassID==NULL) 216 216 return E_POINTER; 217 217 218 218 *pClassID = CLSID_AntiMoniker; 219 219 220 220 return S_OK; 221 221 } … … 259 259 DWORD constant=1; 260 260 HRESULT res; 261 261 262 262 /* data writen by this function is only a DWORD constant seted to 1 ! */ 263 263 res=IStream_Write(pStm,&constant,sizeof(constant),NULL); … … 278 278 279 279 /* for more details see AntiMonikerImpl_Save coments */ 280 280 281 281 /* Normaly the sizemax must be the size of DWORD ! but I tested this function it ususlly return 16 bytes */ 282 282 /* more than the number of bytes used by AntiMoniker::Save function */ … … 357 357 358 358 *ppmkReduced=iface; 359 359 360 360 return MK_S_REDUCED_TO_SELF; 361 361 } … … 375 375 376 376 *ppmkComposite=0; 377 377 378 378 if (fOnlyIfNotGeneric) 379 379 return MK_E_NEEDGENERIC; … … 391 391 if (ppenumMoniker == NULL) 392 392 return E_POINTER; 393 393 394 394 *ppenumMoniker = NULL; 395 395 … … 403 403 { 404 404 DWORD mkSys; 405 405 406 406 TRACE("(%p,%p)\n",iface,pmkOtherMoniker); 407 407 408 408 if (pmkOtherMoniker==NULL) 409 409 return S_FALSE; 410 410 411 411 IMoniker_IsSystemMoniker(pmkOtherMoniker,&mkSys); 412 412 … … 491 491 { 492 492 DWORD mkSys; 493 493 494 494 IMoniker_IsSystemMoniker(pmkOther,&mkSys); 495 495 … … 501 501 502 502 IMoniker_AddRef(iface); 503 503 504 504 return MK_S_US; 505 505 } … … 534 534 { 535 535 WCHAR back[]={'\\','.','.',0}; 536 536 537 537 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName); 538 538 … … 551 551 552 552 strcpyW(*ppszDisplayName,back); 553 553 554 554 return S_OK; 555 555 } … … 578 578 if (!pwdMksys) 579 579 return E_POINTER; 580 580 581 581 (*pwdMksys)=MKSYS_ANTIMONIKER; 582 582 … … 615 615 { 616 616 ICOM_THIS_From_IROTData(IMoniker, iface); 617 617 618 618 TRACE("(%p)\n",iface); 619 619 … … 641 641 HRESULT hr = S_OK; 642 642 IID riid=IID_IMoniker; 643 643 644 644 TRACE("(%p)\n",ppmk); 645 645 -
trunk/src/ole32/bindctx.c
r8441 r8620 33 33 34 34 /* represent the first size table and it's increment block size */ 35 #define BLOCK_TAB_SIZE 10 35 #define BLOCK_TAB_SIZE 10 36 36 #define MAX_TAB_SIZE 0xFFFFFFFF 37 37 … … 51 51 52 52 ICOM_VFIELD(IBindCtx); /* VTable relative to the IBindCtx interface.*/ 53 53 54 54 ULONG ref; /* reference counter for this object */ 55 55 … … 115 115 if ( (This==0) || (ppvObject==0) ) 116 116 return E_INVALIDARG; 117 117 118 118 /* Initialize the return parameter.*/ 119 119 *ppvObject = 0; … … 129 129 if ((*ppvObject)==0) 130 130 return E_NOINTERFACE; 131 131 132 132 /* Query Interface always increases the reference count by one when it is successful */ 133 133 BindCtxImpl_AddRef(iface); … … 168 168 return 0; 169 169 } 170 return This->ref; ;170 return This->ref; 171 171 } 172 172 … … 236 236 if (punk==NULL) 237 237 return E_POINTER; 238 238 239 239 IUnknown_AddRef(punk); 240 240 241 241 /* put the object in the first free element in the table */ 242 242 This->bindCtxTable[lastIndex].pObj = punk; … … 276 276 /* check if the object was registred or not */ 277 277 if (BindCtxImpl_GetObjectIndex(This,punk,NULL,&index)==S_FALSE) 278 278 279 279 return MK_E_NOTBOUND; 280 280 281 281 IUnknown_Release(This->bindCtxTable[index].pObj); 282 282 283 283 /* left-shift all elements in the right side of the current revoked object */ 284 284 for(j=index; j<This->bindCtxTableLastIndex-1; j++) 285 285 This->bindCtxTable[j]= This->bindCtxTable[j+1]; 286 286 287 287 This->bindCtxTableLastIndex--; 288 288 … … 320 320 if (pbindopts==NULL) 321 321 return E_POINTER; 322 322 323 323 if (pbindopts->cbStruct > sizeof(BIND_OPTS2)) 324 324 { … … 364 364 if (pprot==NULL) 365 365 return E_POINTER; 366 366 367 367 res=GetRunningObjectTable(0, pprot); 368 368 … … 381 381 if (punk==NULL) 382 382 return E_INVALIDARG; 383 383 384 384 IUnknown_AddRef(punk); 385 385 … … 402 402 403 403 This->bindCtxTableLastIndex++; 404 404 405 405 if (This->bindCtxTableLastIndex == This->bindCtxTableSize){ /* table is full ! must be resized */ 406 406 … … 432 432 433 433 *punk=0; 434 434 435 435 if (BindCtxImpl_GetObjectIndex(This,NULL,pszkey,&index)==S_FALSE) 436 436 return E_FAIL; 437 437 438 438 IUnknown_AddRef(This->bindCtxTable[index].pObj); 439 439 440 440 *punk = This->bindCtxTable[index].pObj; 441 441 … … 459 459 /* release the object if it's found */ 460 460 IUnknown_Release(This->bindCtxTable[index].pObj); 461 461 462 462 /* remove the object from the table with a left-shifting of all objects in the right side */ 463 463 for(j=index; j<This->bindCtxTableLastIndex-1; j++) 464 464 This->bindCtxTable[j]= This->bindCtxTable[j+1]; 465 465 466 466 This->bindCtxTableLastIndex--; 467 467 … … 489 489 DWORD i; 490 490 BYTE found=0; 491 491 492 492 TRACE("(%p,%p,%p,%p)\n",This,punk,pszkey,index); 493 493 -
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 } -
trunk/src/ole32/compobj.c
r8441 r8620 50 50 #include "ifs.h" 51 51 52 #include " debugtools.h"53 54 DEFAULT_DEBUG_CHANNEL(ole);52 #include "wine/debug.h" 53 54 WINE_DEFAULT_DEBUG_CHANNEL(ole); 55 55 56 56 /**************************************************************************** … … 399 399 return S_OK; 400 400 } 401 402 401 #ifndef __WIN32OS2__ 403 402 /*********************************************************************** … … 413 412 } 414 413 #endif 415 416 414 /****************************************************************************** 417 415 * CoDisconnectObject [COMPOBJ.15] … … 612 610 return S_OK; 613 611 } 614 615 612 #ifndef __WIN32OS2__ 616 613 /****************************************************************************** … … 656 653 } 657 654 #endif 658 659 655 /****************************************************************************** 660 656 * StringFromCLSID [OLE32.151] … … 932 928 return S_OK; 933 929 } 934 935 930 #ifndef __WIN32OS2__ 936 931 /* FIXME: this function is not declared in the WINELIB headers. But where should it go ? */ … … 955 950 return 0; 956 951 } 957 #endif 952 958 953 /* FIXME: this function is not declared in the WINELIB headers. But where should it go ? */ 959 954 /*********************************************************************** … … 1013 1008 return DosDateTimeToFileTime(wDosDate, wDosTime, ft); 1014 1009 } 1015 1010 #endif 1016 1011 /*** 1017 1012 * COM_GetRegisteredClassObject … … 1300 1295 } 1301 1296 1302 static HRESULT WINAPI Remote_CoGetClassObject(1303 REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo,1304 REFIID iid, LPVOID *ppv1305 ) {1306 HKEY key;1307 char buf[200];1308 HRESULT hres = E_UNEXPECTED;1309 char xclsid[80];1310 WCHAR dllName[MAX_PATH+1];1311 DWORD dllNameLen = sizeof(dllName);1312 STARTUPINFOW sinfo;1313 PROCESS_INFORMATION pinfo;1314 1315 WINE_StringFromCLSID((LPCLSID)rclsid,xclsid);1316 1317 sprintf(buf,"CLSID\\%s\\LocalServer32",xclsid);1318 hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key);1319 1320 if (hres != ERROR_SUCCESS)1321 return REGDB_E_CLASSNOTREG;1322 1323 memset(dllName,0,sizeof(dllName));1324 hres= RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)dllName,&dllNameLen);1325 if (hres)1326 return REGDB_E_CLASSNOTREG; /* FIXME: check retval */1327 RegCloseKey(key);1328 1329 TRACE("found LocalServer32 exe %s\n", debugstr_w(dllName));1330 1331 memset(&sinfo,0,sizeof(sinfo));1332 sinfo.cb = sizeof(sinfo);1333 if (!CreateProcessW(NULL,dllName,NULL,NULL,FALSE,0,NULL,NULL,&sinfo,&pinfo))1334 return E_FAIL;1335 return create_marshalled_proxy(rclsid,iid,ppv);1336 }1337 1338 1297 /*********************************************************************** 1339 1298 * CoGetClassObject [COMPOBJ.7] 1340 1299 * CoGetClassObject [OLE32.16] 1341 1300 * 1342 * FIXME. If request allows of several options and there is a failure 1301 * FIXME. If request allows of several options and there is a failure 1343 1302 * with one (other than not being registered) do we try the 1344 1303 * others or return failure? (E.g. inprocess is registered but … … 1363 1322 #endif 1364 1323 DllGetClassObjectFunc DllGetClassObject; 1365 HKEY key;1366 char buf[200];1367 1324 1368 1325 WINE_StringFromCLSID((LPCLSID)rclsid,xclsid); … … 1397 1354 1398 1355 return hres; 1399 }1400 1401 if (((CLSCTX_LOCAL_SERVER) & dwClsContext)1402 && !((CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER) & dwClsContext))1403 return Remote_CoGetClassObject(rclsid,dwClsContext,pServerInfo,iid,ppv);1404 1405 /* remote servers not supported yet */1406 if ( ((CLSCTX_REMOTE_SERVER) & dwClsContext)1407 && !((CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER) & dwClsContext)1408 ){1409 FIXME("CLSCTX_REMOTE_SERVER not supported!\n");1410 return E_NOINTERFACE;1411 1356 } 1412 1357 … … 1444 1389 } 1445 1390 } 1446 1447 1448 /* Finally try out of process */ 1449 /* out of process and remote servers not supported yet */ 1391 1392 1393 /* Next try out of process */ 1450 1394 if (CLSCTX_LOCAL_SERVER & dwClsContext) 1451 1395 { 1452 memset(ProviderName,0,sizeof(ProviderName)); 1453 sprintf(buf,"CLSID\\%s\\LocalServer32",xclsid); 1454 if (((hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key)) != ERROR_SUCCESS) || 1455 ((hres = RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)ProviderName,&ProviderNameLen)), 1456 RegCloseKey (key), 1457 hres != ERROR_SUCCESS)) 1458 { 1459 hres = REGDB_E_CLASSNOTREG; 1460 } 1461 else 1462 { 1463 /* CO_E_APPNOTFOUND if no exe */ 1464 FIXME("CLSCTX_LOCAL_SERVER %s registered but not yet supported!\n",debugstr_w(ProviderName)); 1465 hres = E_ACCESSDENIED; 1466 } 1467 } 1468 1396 return create_marshalled_proxy(rclsid,iid,ppv); 1397 } 1398 1399 /* Finally try remote */ 1469 1400 if (CLSCTX_REMOTE_SERVER & dwClsContext) 1470 1401 { 1471 1402 FIXME ("CLSCTX_REMOTE_SERVER not supported\n"); 1472 hres = E_ ACCESSDENIED;1403 hres = E_NOINTERFACE; 1473 1404 } 1474 1405 … … 1576 1507 return MK_E_INVALIDEXTENSION; 1577 1508 } 1578 #ifndef __WIN32OS2__1579 1509 /****************************************************************************** 1580 1510 * CoRegisterMessageFilter [COMPOBJ.27] … … 1587 1517 return 0; 1588 1518 } 1589 #endif 1519 1590 1520 /*********************************************************************** 1591 1521 * CoCreateInstance [COMPOBJ.13] -
trunk/src/ole32/compobj_private.h
r8441 r8620 20 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 */ 22 22 23 #ifndef __WINE_OLE_COMPOBJ_H 23 24 #define __WINE_OLE_COMPOBJ_H -
trunk/src/ole32/compositemoniker.c
r8441 r8620 40 40 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ 41 41 42 /* The ROT (RunningObjectTable implementation) uses the IROTData 43 * interface to test whether two monikers are equal. That's why IROTData 42 /* The ROT (RunningObjectTable implementation) uses the IROTData 43 * interface to test whether two monikers are equal. That's why IROTData 44 44 * interface is implemented by monikers. 45 45 */ … … 201 201 { 202 202 ICOM_THIS(CompositeMonikerImpl,iface); 203 203 204 204 TRACE("(%p,%p,%p)\n",This,riid,ppvObject); 205 205 … … 207 207 if ( (This==0) || (ppvObject==0) ) 208 208 return E_INVALIDARG; 209 209 210 210 /* Initialize the return parameter */ 211 211 *ppvObject = 0; … … 250 250 ICOM_THIS(CompositeMonikerImpl,iface); 251 251 ULONG i; 252 252 253 253 TRACE("(%p)\n",This); 254 254 … … 261 261 for (i=0;i<This->tabLastIndex;i++) 262 262 IMoniker_Release(This->tabMoniker[i]); 263 263 264 264 CompositeMonikerImpl_Destroy(This); 265 265 266 266 return 0; 267 267 } 268 return This->ref; ;268 return This->ref; 269 269 } 270 270 … … 278 278 if (pClassID==NULL) 279 279 return E_POINTER; 280 280 281 281 *pClassID = CLSID_CompositeMoniker; 282 282 283 283 return S_OK; 284 284 } … … 307 307 CLSID clsid; 308 308 WCHAR string[1]={0}; 309 310 ICOM_THIS(CompositeMonikerImpl,iface); 309 310 ICOM_THIS(CompositeMonikerImpl,iface); 311 311 312 312 TRACE("(%p,%p)\n",iface,pStm); … … 366 366 /* resize the table if needed */ 367 367 if (++This->tabLastIndex==This->tabSize){ 368 368 369 369 This->tabSize+=BLOCK_TAB_SIZE; 370 370 This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); … … 387 387 IMoniker *pmk; 388 388 DWORD constant=3; 389 389 390 390 TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty); 391 391 392 /* This function calls OleSaveToStream function for each moniker within 392 /* This function calls OleSaveToStream function for each moniker within 393 393 * this object. 394 * When I tested this function in windows, I usually found this constant 395 * at the beginning of the stream. I don't known why (there's no 394 * When I tested this function in windows, I usually found this constant 395 * at the beginning of the stream. I don't known why (there's no 396 396 * indication in the specification) ! 397 397 */ … … 427 427 ULARGE_INTEGER ptmpSize; 428 428 429 /* The sizeMax of this object is calculated by calling GetSizeMax on 429 /* The sizeMax of this object is calculated by calling GetSizeMax on 430 430 * each moniker within this object then summing all returned values 431 431 */ … … 465 465 IMoniker *tempMk; 466 466 HRESULT res; 467 467 468 468 TRACE("(%p,%p,%p)\n",This,pmkFirst,pmkRest); 469 469 … … 491 491 492 492 IMoniker_Enum(pmkFirst,TRUE,&enumMoniker); 493 493 494 494 while(IEnumMoniker_Next(enumMoniker,1,&This->tabMoniker[This->tabLastIndex],NULL)==S_OK){ 495 495 496 496 497 497 if (++This->tabLastIndex==This->tabSize){ 498 498 499 499 This->tabSize+=BLOCK_TAB_SIZE; 500 500 This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); … … 511 511 512 512 IMoniker_IsSystemMoniker(pmkRest,&mkSys); 513 513 514 514 if (mkSys!=MKSYS_GENERICCOMPOSITE){ 515 515 … … 518 518 res=IMoniker_ComposeWith(This->tabMoniker[This->tabLastIndex-1],pmkRest,TRUE,&tempMk); 519 519 520 if (res==MK_E_NEEDGENERIC){ 520 if (res==MK_E_NEEDGENERIC){ 521 521 522 522 /* there's no simplification in this case */ … … 527 527 IMoniker_AddRef(pmkRest); 528 528 } 529 else if (tempMk==NULL){ 529 else if (tempMk==NULL){ 530 530 531 531 /* we have an antimoniker after a simple moniker so we can make a simplification in this case */ … … 545 545 /* resize tabMoniker if needed */ 546 546 if (This->tabLastIndex==This->tabSize){ 547 547 548 548 This->tabSize+=BLOCK_TAB_SIZE; 549 549 … … 556 556 else{ 557 557 558 /* add a composite moniker to the moniker table (do the same thing 559 * for each moniker within the composite moniker as a simple moniker 558 /* add a composite moniker to the moniker table (do the same thing 559 * for each moniker within the composite moniker as a simple moniker 560 560 * (see above for how to add a simple moniker case) ) 561 561 */ … … 584 584 585 585 if (This->tabLastIndex==This->tabSize){ 586 586 587 587 This->tabSize+=BLOCK_TAB_SIZE; 588 588 … … 627 627 IMoniker *tempMk,*antiMk,*mostRigthMk; 628 628 IEnumMoniker *enumMoniker; 629 629 630 630 TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult); 631 631 632 632 if (ppvResult==NULL) 633 633 return E_POINTER; 634 634 635 635 *ppvResult=0; 636 636 /* If pmkToLeft is NULL, this method looks for the moniker in the ROT, and if found, queries the retrieved */ … … 656 656 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 657 657 IEnumMoniker_Release(enumMoniker); 658 658 659 659 res=CreateAntiMoniker(&antiMk); 660 660 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); 661 661 IMoniker_Release(antiMk); 662 662 663 663 res=CompositeMonikerImpl_BindToObject(mostRigthMk,pbc,tempMk,riid,ppvResult); 664 664 … … 691 691 692 692 if (pmkToLeft!=NULL){ 693 693 694 694 IMoniker_Enum(iface,FALSE,&enumMoniker); 695 695 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 696 696 IEnumMoniker_Release(enumMoniker); 697 697 698 698 res=CreateAntiMoniker(&antiMk); 699 699 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); 700 700 IMoniker_Release(antiMk); 701 701 702 702 res=CompositeMonikerImpl_BindToStorage(mostRigthMk,pbc,tempMk,riid,ppvResult); 703 703 … … 737 737 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 738 738 IEnumMoniker_Release(enumMoniker); 739 739 740 740 res=CreateAntiMoniker(&antiMk); 741 741 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); … … 754 754 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 755 755 IEnumMoniker_Release(enumMoniker); 756 756 757 757 res=CreateAntiMoniker(&antiMk); 758 758 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); … … 797 797 /* otherwise, the method returns the result of combining the two monikers by calling the */ 798 798 /* CreateGenericComposite function */ 799 799 800 800 if (fOnlyIfNotGeneric) 801 801 return MK_E_NEEDGENERIC; 802 802 803 803 return CreateGenericComposite(iface,pmkRight,ppmkComposite); 804 804 } … … 815 815 if (ppenumMoniker == NULL) 816 816 return E_POINTER; 817 817 818 818 return EnumMonikerImpl_CreateEnumMoniker(This->tabMoniker,This->tabLastIndex,0,fForward,ppenumMoniker); 819 819 } … … 827 827 IMoniker *tempMk1,*tempMk2; 828 828 HRESULT res1,res2,res; 829 829 830 830 TRACE("(%p,%p)\n",iface,pmkOtherMoniker); 831 831 … … 839 839 if (enumMoniker1==NULL) 840 840 return S_FALSE; 841 841 842 842 IMoniker_Enum(iface,TRUE,&enumMoniker2); 843 843 … … 846 846 res1=IEnumMoniker_Next(enumMoniker1,1,&tempMk1,NULL); 847 847 res2=IEnumMoniker_Next(enumMoniker2,1,&tempMk2,NULL); 848 848 849 849 if((res1==S_OK)&&(res2==S_OK)){ 850 850 … … 916 916 /* If pmkToLeft is NULL, this method returns S_OK if pmkNewlyRunning is non-NULL and is equal */ 917 917 /* to this moniker */ 918 918 919 919 if (pmkNewlyRunning!=NULL) 920 920 … … 934 934 /* IMoniker::IsRunning on the rightmost component of the composite, passing the remainder of */ 935 935 /* the composite as the pmkToLeft parameter for that call. */ 936 936 937 937 res=IBindCtx_GetRunningObjectTable(pbc,&rot); 938 938 … … 978 978 IMoniker *tempMk,*antiMk,*mostRigthMk; 979 979 IEnumMoniker *enumMoniker; 980 980 981 981 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime); 982 982 … … 1075 1075 IEnumMoniker *enumMoniker1,*enumMoniker2; 1076 1076 ULONG i,nbCommonMk=0; 1077 1077 1078 1078 /* If the other moniker is a composite, this method compares the components of each composite from left */ 1079 1079 /* to right. The returned common prefix moniker might also be a composite moniker, depending on how many */ … … 1082 1082 if (ppmkPrefix==NULL) 1083 1083 return E_POINTER; 1084 1084 1085 1085 *ppmkPrefix=0; 1086 1086 1087 1087 if (pmkOther==NULL) 1088 1088 return MK_E_NOPREFIX; 1089 1089 1090 1090 IMoniker_IsSystemMoniker(pmkOther,&mkSys); 1091 1091 … … 1151 1151 IMoniker_Release(tempMk1); 1152 1152 IMoniker_Release(tempMk2); 1153 1153 1154 1154 /* compose all common monikers in a composite moniker */ 1155 1155 for(i=0;i<nbCommonMk;i++){ … … 1162 1162 1163 1163 IMoniker_Release(tempMk1); 1164 1164 1165 1165 *ppmkPrefix=tempMk2; 1166 1166 } … … 1203 1203 DWORD mkSys; 1204 1204 HRESULT res1,res2; 1205 1205 1206 1206 *restMk=0; 1207 1207 … … 1246 1246 for(;IEnumMoniker_Next(enumMoniker3,1,&tempMk,NULL)==S_OK;nbRestMk++) 1247 1247 1248 IMoniker_Release(tempMk); ;1248 IMoniker_Release(tempMk); 1249 1249 1250 1250 if (nbRestMk==0) … … 1301 1301 1302 1302 /* finds the common prefix of the two monikers */ 1303 res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk); 1303 res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk); 1304 1304 1305 1305 /* if there's no common prefix or the two moniker are equal the relative is the other moniker */ … … 1358 1358 if (ppszDisplayName==NULL) 1359 1359 return E_POINTER; 1360 1360 1361 1361 *ppszDisplayName=CoTaskMemAlloc(sizeof(WCHAR)); 1362 1362 … … 1370 1370 1371 1371 IMoniker_Enum(iface,TRUE,&enumMoniker); 1372 1372 1373 1373 while(IEnumMoniker_Next(enumMoniker,1,&tempMk,NULL)==S_OK){ 1374 1374 … … 1430 1430 if (!pwdMksys) 1431 1431 return E_POINTER; 1432 1432 1433 1433 (*pwdMksys)=MKSYS_GENERICCOMPOSITE; 1434 1434 … … 1467 1467 { 1468 1468 ICOM_THIS_From_IROTData(IMoniker, iface); 1469 1469 1470 1470 TRACE("(%p)\n",iface); 1471 1471 … … 1491 1491 { 1492 1492 ICOM_THIS(EnumMonikerImpl,iface); 1493 1493 1494 1494 TRACE("(%p,%p,%p)\n",This,riid,ppvObject); 1495 1495 … … 1497 1497 if ( (This==0) || (ppvObject==0) ) 1498 1498 return E_INVALIDARG; 1499 1499 1500 1500 /* Initialize the return parameter */ 1501 1501 *ppvObject = 0; … … 1542 1542 /* destroy the object if there's no more reference on it */ 1543 1543 if (This->ref==0){ 1544 1544 1545 1545 for(i=0;i<This->tabSize;i++) 1546 1546 IMoniker_Release(This->tabMoniker[i]); … … 1551 1551 return 0; 1552 1552 } 1553 return This->ref; ;1553 return This->ref; 1554 1554 } 1555 1555 … … 1569 1569 if (pceltFethed!=NULL) 1570 1570 *pceltFethed= i; 1571 1571 1572 1572 if (i==celt) 1573 1573 return S_OK; … … 1587 1587 1588 1588 This->currentPos+=celt; 1589 1589 1590 1590 return S_OK; 1591 1591 } … … 1633 1633 if (currentPos > tabSize) 1634 1634 return E_INVALIDARG; 1635 1635 1636 1636 /* Initialize the virtual function table. */ 1637 1637 ICOM_VTBL(newEnumMoniker) = &VT_EnumMonikerImpl; … … 1676 1676 if (ppmkComposite==NULL) 1677 1677 return E_POINTER; 1678 1678 1679 1679 *ppmkComposite=0; 1680 1680 -
trunk/src/ole32/datacache.c
r8441 r8620 31 31 * - This implementation of the datacache will let your application 32 32 * load documents that have embedded OLE objects in them and it will 33 * also retrieve the metafile representation of those objects. 33 * also retrieve the metafile representation of those objects. 34 34 * - This implementation of the datacache will also allow your 35 35 * application to save new documents with OLE objects in them. 36 * - The main thing that it doesn't do is allow you to activate 36 * - The main thing that it doesn't do is allow you to activate 37 37 * or modify the OLE objects in any way. 38 38 * - I haven't found any good documentation on the real usage of … … 41 41 * "\002OlePresXXX". It appears to just be a counter. 42 42 * - Also, I don't know the real content of the presentation stream 43 * header. I was able to figure-out where the extent of the object 43 * header. I was able to figure-out where the extent of the object 44 44 * was stored and the aspect, but that's about it. 45 45 */ … … 95 95 * List all interface VTables here 96 96 */ 97 ICOM_VTABLE(IDataObject)* lpvtbl1; 97 ICOM_VTABLE(IDataObject)* lpvtbl1; 98 98 ICOM_VTABLE(IUnknown)* lpvtbl2; 99 99 ICOM_VTABLE(IPersistStorage)* lpvtbl3; 100 ICOM_VTABLE(IViewObject2)* lpvtbl4; 100 ICOM_VTABLE(IViewObject2)* lpvtbl4; 101 101 ICOM_VTABLE(IOleCache2)* lpvtbl5; 102 102 ICOM_VTABLE(IOleCacheControl)* lpvtbl6; … … 133 133 134 134 /* 135 * Here, I define utility macros to help with the casting of the 135 * Here, I define utility macros to help with the casting of the 136 136 * "this" parameter. 137 137 * There is a version to accomodate all of the VTables implemented … … 139 139 */ 140 140 #define _ICOM_THIS_From_IDataObject(class,name) class* this = (class*)name; 141 #define _ICOM_THIS_From_NDIUnknown(class, name) class* this = (class*)(((char*)name)-sizeof(void*)); 142 #define _ICOM_THIS_From_IPersistStorage(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*)); 143 #define _ICOM_THIS_From_IViewObject2(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*)); 144 #define _ICOM_THIS_From_IOleCache2(class, name) class* this = (class*)(((char*)name)-4*sizeof(void*)); 145 #define _ICOM_THIS_From_IOleCacheControl(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*)); 141 #define _ICOM_THIS_From_NDIUnknown(class, name) class* this = (class*)(((char*)name)-sizeof(void*)); 142 #define _ICOM_THIS_From_IPersistStorage(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*)); 143 #define _ICOM_THIS_From_IViewObject2(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*)); 144 #define _ICOM_THIS_From_IOleCache2(class, name) class* this = (class*)(((char*)name)-4*sizeof(void*)); 145 #define _ICOM_THIS_From_IOleCacheControl(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*)); 146 146 147 147 /* … … 171 171 REFIID riid, 172 172 void** ppvObject); 173 static ULONG WINAPI DataCache_NDIUnknown_AddRef( 173 static ULONG WINAPI DataCache_NDIUnknown_AddRef( 174 174 IUnknown* iface); 175 static ULONG WINAPI DataCache_NDIUnknown_Release( 175 static ULONG WINAPI DataCache_NDIUnknown_Release( 176 176 IUnknown* iface); 177 177 … … 184 184 REFIID riid, 185 185 void** ppvObject); 186 static ULONG WINAPI DataCache_IDataObject_AddRef( 186 static ULONG WINAPI DataCache_IDataObject_AddRef( 187 187 IDataObject* iface); 188 static ULONG WINAPI DataCache_IDataObject_Release( 188 static ULONG WINAPI DataCache_IDataObject_Release( 189 189 IDataObject* iface); 190 190 static HRESULT WINAPI DataCache_GetData( 191 191 IDataObject* iface, 192 LPFORMATETC pformatetcIn, 192 LPFORMATETC pformatetcIn, 193 193 STGMEDIUM* pmedium); 194 194 static HRESULT WINAPI DataCache_GetDataHere( 195 IDataObject* iface, 195 IDataObject* iface, 196 196 LPFORMATETC pformatetc, 197 197 STGMEDIUM* pmedium); … … 200 200 LPFORMATETC pformatetc); 201 201 static HRESULT WINAPI DataCache_GetCanonicalFormatEtc( 202 IDataObject* iface, 203 LPFORMATETC pformatectIn, 202 IDataObject* iface, 203 LPFORMATETC pformatectIn, 204 204 LPFORMATETC pformatetcOut); 205 205 static HRESULT WINAPI DataCache_IDataObject_SetData( 206 206 IDataObject* iface, 207 LPFORMATETC pformatetc, 208 STGMEDIUM* pmedium, 207 LPFORMATETC pformatetc, 208 STGMEDIUM* pmedium, 209 209 BOOL fRelease); 210 210 static HRESULT WINAPI DataCache_EnumFormatEtc( 211 IDataObject* iface, 211 IDataObject* iface, 212 212 DWORD dwDirection, 213 213 IEnumFORMATETC** ppenumFormatEtc); 214 214 static HRESULT WINAPI DataCache_DAdvise( 215 IDataObject* iface, 216 FORMATETC* pformatetc, 217 DWORD advf, 218 IAdviseSink* pAdvSink, 215 IDataObject* iface, 216 FORMATETC* pformatetc, 217 DWORD advf, 218 IAdviseSink* pAdvSink, 219 219 DWORD* pdwConnection); 220 220 static HRESULT WINAPI DataCache_DUnadvise( … … 233 233 REFIID riid, 234 234 void** ppvObject); 235 static ULONG WINAPI DataCache_IPersistStorage_AddRef( 235 static ULONG WINAPI DataCache_IPersistStorage_AddRef( 236 236 IPersistStorage* iface); 237 static ULONG WINAPI DataCache_IPersistStorage_Release( 237 static ULONG WINAPI DataCache_IPersistStorage_Release( 238 238 IPersistStorage* iface); 239 static HRESULT WINAPI DataCache_GetClassID( 239 static HRESULT WINAPI DataCache_GetClassID( 240 240 IPersistStorage* iface, 241 241 CLSID* pClassID); 242 static HRESULT WINAPI DataCache_IsDirty( 242 static HRESULT WINAPI DataCache_IsDirty( 243 243 IPersistStorage* iface); 244 static HRESULT WINAPI DataCache_InitNew( 245 IPersistStorage* iface, 246 IStorage* pStg); 247 static HRESULT WINAPI DataCache_Load( 244 static HRESULT WINAPI DataCache_InitNew( 248 245 IPersistStorage* iface, 249 246 IStorage* pStg); 250 static HRESULT WINAPI DataCache_ Save(247 static HRESULT WINAPI DataCache_Load( 251 248 IPersistStorage* iface, 252 IStorage* pStg, 249 IStorage* pStg); 250 static HRESULT WINAPI DataCache_Save( 251 IPersistStorage* iface, 252 IStorage* pStg, 253 253 BOOL fSameAsLoad); 254 static HRESULT WINAPI DataCache_SaveCompleted( 255 IPersistStorage* iface, 254 static HRESULT WINAPI DataCache_SaveCompleted( 255 IPersistStorage* iface, 256 256 IStorage* pStgNew); 257 257 static HRESULT WINAPI DataCache_HandsOffStorage( … … 266 266 REFIID riid, 267 267 void** ppvObject); 268 static ULONG WINAPI DataCache_IViewObject2_AddRef( 268 static ULONG WINAPI DataCache_IViewObject2_AddRef( 269 269 IViewObject2* iface); 270 static ULONG WINAPI DataCache_IViewObject2_Release( 270 static ULONG WINAPI DataCache_IViewObject2_Release( 271 271 IViewObject2* iface); 272 272 static HRESULT WINAPI DataCache_Draw( … … 275 275 LONG lindex, 276 276 void* pvAspect, 277 DVTARGETDEVICE* ptd, 278 HDC hdcTargetDev, 277 DVTARGETDEVICE* ptd, 278 HDC hdcTargetDev, 279 279 HDC hdcDraw, 280 280 LPCRECTL lprcBounds, … … 283 283 DWORD dwContinue); 284 284 static HRESULT WINAPI DataCache_GetColorSet( 285 IViewObject2* iface, 286 DWORD dwDrawAspect, 287 LONG lindex, 288 void* pvAspect, 289 DVTARGETDEVICE* ptd, 290 HDC hicTargetDevice, 285 IViewObject2* iface, 286 DWORD dwDrawAspect, 287 LONG lindex, 288 void* pvAspect, 289 DVTARGETDEVICE* ptd, 290 HDC hicTargetDevice, 291 291 LOGPALETTE** ppColorSet); 292 292 static HRESULT WINAPI DataCache_Freeze( … … 294 294 DWORD dwDrawAspect, 295 295 LONG lindex, 296 void* pvAspect, 296 void* pvAspect, 297 297 DWORD* pdwFreeze); 298 298 static HRESULT WINAPI DataCache_Unfreeze( … … 301 301 static HRESULT WINAPI DataCache_SetAdvise( 302 302 IViewObject2* iface, 303 DWORD aspects, 304 DWORD advf, 303 DWORD aspects, 304 DWORD advf, 305 305 IAdviseSink* pAdvSink); 306 306 static HRESULT WINAPI DataCache_GetAdvise( 307 IViewObject2* iface, 308 DWORD* pAspects, 309 DWORD* pAdvf, 307 IViewObject2* iface, 308 DWORD* pAspects, 309 DWORD* pAdvf, 310 310 IAdviseSink** ppAdvSink); 311 311 static HRESULT WINAPI DataCache_GetExtent( 312 IViewObject2* iface, 313 DWORD dwDrawAspect, 314 LONG lindex, 315 DVTARGETDEVICE* ptd, 312 IViewObject2* iface, 313 DWORD dwDrawAspect, 314 LONG lindex, 315 DVTARGETDEVICE* ptd, 316 316 LPSIZEL lpsizel); 317 317 … … 324 324 REFIID riid, 325 325 void** ppvObject); 326 static ULONG WINAPI DataCache_IOleCache2_AddRef( 326 static ULONG WINAPI DataCache_IOleCache2_AddRef( 327 327 IOleCache2* iface); 328 static ULONG WINAPI DataCache_IOleCache2_Release( 328 static ULONG WINAPI DataCache_IOleCache2_Release( 329 329 IOleCache2* iface); 330 330 static HRESULT WINAPI DataCache_Cache( … … 349 349 static HRESULT WINAPI DataCache_UpdateCache( 350 350 IOleCache2* iface, 351 LPDATAOBJECT pDataObject, 351 LPDATAOBJECT pDataObject, 352 352 DWORD grfUpdf, 353 353 LPVOID pReserved); … … 364 364 REFIID riid, 365 365 void** ppvObject); 366 static ULONG WINAPI DataCache_IOleCacheControl_AddRef( 366 static ULONG WINAPI DataCache_IOleCacheControl_AddRef( 367 367 IOleCacheControl* iface); 368 static ULONG WINAPI DataCache_IOleCacheControl_Release( 368 static ULONG WINAPI DataCache_IOleCacheControl_Release( 369 369 IOleCacheControl* iface); 370 370 static HRESULT WINAPI DataCache_OnRun( … … 461 461 */ 462 462 HRESULT WINAPI CreateDataCache( 463 LPUNKNOWN pUnkOuter, 464 REFCLSID rclsid, 465 REFIID riid, 463 LPUNKNOWN pUnkOuter, 464 REFCLSID rclsid, 465 REFIID riid, 466 466 LPVOID* ppvObj) 467 467 { … … 485 485 * IUnknown pointer can be returned to the outside. 486 486 */ 487 if ( (pUnkOuter!=NULL) && 487 if ( (pUnkOuter!=NULL) && 488 488 (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) != 0) ) 489 489 return CLASS_E_NOAGGREGATION; … … 492 492 * Try to construct a new instance of the class. 493 493 */ 494 newCache = DataCache_Construct(rclsid, 494 newCache = DataCache_Construct(rclsid, 495 495 pUnkOuter); 496 496 … … 528 528 if (newObject==0) 529 529 return newObject; 530 530 531 531 /* 532 532 * Initialize the virtual function table. … … 538 538 newObject->lpvtbl5 = &DataCache_IOleCache2_VTable; 539 539 newObject->lpvtbl6 = &DataCache_IOleCacheControl_VTable; 540 541 /* 542 * Start with one reference count. The caller of this function 540 541 /* 542 * Start with one reference count. The caller of this function 543 543 * must release the interface pointer when it is done. 544 544 */ … … 547 547 /* 548 548 * Initialize the outer unknown 549 * We don't keep a reference on the outer unknown since, the way 549 * We don't keep a reference on the outer unknown since, the way 550 550 * aggregation works, our lifetime is at least as large as it's 551 551 * lifetime. … … 593 593 * DataCache_ReadPresentationData 594 594 * 595 * This method will read information for the requested presentation 595 * This method will read information for the requested presentation 596 596 * into the given structure. 597 597 * … … 796 796 * DataCache_ReadPresentationData 797 797 * 798 * This method will read information for the requested presentation 798 * This method will read information for the requested presentation 799 799 * into the given structure. 800 800 * … … 822 822 */ 823 823 hres = DataCache_OpenPresStream( 824 this, 824 this, 825 825 drawAspect, 826 826 &presStream); … … 853 853 * Allocate a buffer for the metafile bits. 854 854 */ 855 metafileBits = HeapAlloc(GetProcessHeap(), 856 0, 855 metafileBits = HeapAlloc(GetProcessHeap(), 856 0, 857 857 streamInfo.cbSize.s.LowPart); 858 858 … … 911 911 if ( (this==0) || (ppvObject==0) ) 912 912 return E_INVALIDARG; 913 913 914 914 /* 915 915 * Initialize the return parameter. … … 920 920 * Compare the riid with the interface IDs implemented by this object. 921 921 */ 922 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 922 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 923 923 { 924 924 *ppvObject = iface; 925 925 } 926 else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) 926 else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) 927 927 { 928 928 *ppvObject = (IDataObject*)&(this->lpvtbl1); … … 943 943 *ppvObject = (IOleCache2*)&(this->lpvtbl5); 944 944 } 945 else if (memcmp(&IID_IOleCacheControl, riid, sizeof(IID_IOleCacheControl)) == 0) 945 else if (memcmp(&IID_IOleCacheControl, riid, sizeof(IID_IOleCacheControl)) == 0) 946 946 { 947 947 *ppvObject = (IOleCacheControl*)&(this->lpvtbl6); … … 956 956 return E_NOINTERFACE; 957 957 } 958 958 959 959 /* 960 960 * Query Interface always increases the reference count by one when it is 961 * successful. 961 * successful. 962 962 */ 963 963 IUnknown_AddRef((IUnknown*)*ppvObject); 964 964 965 return S_OK; ;965 return S_OK; 966 966 } 967 967 … … 974 974 * to the outer unknown. 975 975 */ 976 static ULONG WINAPI DataCache_NDIUnknown_AddRef( 976 static ULONG WINAPI DataCache_NDIUnknown_AddRef( 977 977 IUnknown* iface) 978 978 { … … 992 992 * to the outer unknown. 993 993 */ 994 static ULONG WINAPI DataCache_NDIUnknown_Release( 994 static ULONG WINAPI DataCache_NDIUnknown_Release( 995 995 IUnknown* iface) 996 996 { … … 1011 1011 return 0; 1012 1012 } 1013 1013 1014 1014 return this->ref; 1015 1015 } … … 1032 1032 _ICOM_THIS_From_IDataObject(DataCache, iface); 1033 1033 1034 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 1034 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 1035 1035 } 1036 1036 … … 1040 1040 * See Windows documentation for more details on IUnknown methods. 1041 1041 */ 1042 static ULONG WINAPI DataCache_IDataObject_AddRef( 1042 static ULONG WINAPI DataCache_IDataObject_AddRef( 1043 1043 IDataObject* iface) 1044 1044 { 1045 1045 _ICOM_THIS_From_IDataObject(DataCache, iface); 1046 1046 1047 return IUnknown_AddRef(this->outerUnknown); 1047 return IUnknown_AddRef(this->outerUnknown); 1048 1048 } 1049 1049 … … 1053 1053 * See Windows documentation for more details on IUnknown methods. 1054 1054 */ 1055 static ULONG WINAPI DataCache_IDataObject_Release( 1055 static ULONG WINAPI DataCache_IDataObject_Release( 1056 1056 IDataObject* iface) 1057 1057 { 1058 1058 _ICOM_THIS_From_IDataObject(DataCache, iface); 1059 1059 1060 return IUnknown_Release(this->outerUnknown); 1060 return IUnknown_Release(this->outerUnknown); 1061 1061 } 1062 1062 … … 1070 1070 static HRESULT WINAPI DataCache_GetData( 1071 1071 IDataObject* iface, 1072 LPFORMATETC pformatetcIn, 1072 LPFORMATETC pformatetcIn, 1073 1073 STGMEDIUM* pmedium) 1074 1074 { … … 1168 1168 1169 1169 static HRESULT WINAPI DataCache_GetDataHere( 1170 IDataObject* iface, 1170 IDataObject* iface, 1171 1171 LPFORMATETC pformatetc, 1172 1172 STGMEDIUM* pmedium) … … 1192 1192 */ 1193 1193 static HRESULT WINAPI DataCache_GetCanonicalFormatEtc( 1194 IDataObject* iface, 1195 LPFORMATETC pformatectIn, 1194 IDataObject* iface, 1195 LPFORMATETC pformatectIn, 1196 1196 LPFORMATETC pformatetcOut) 1197 1197 { … … 1209 1209 static HRESULT WINAPI DataCache_IDataObject_SetData( 1210 1210 IDataObject* iface, 1211 LPFORMATETC pformatetc, 1212 STGMEDIUM* pmedium, 1211 LPFORMATETC pformatetc, 1212 STGMEDIUM* pmedium, 1213 1213 BOOL fRelease) 1214 1214 { … … 1227 1227 IOleCache2_Release(oleCache); 1228 1228 1229 return hres; ;1229 return hres; 1230 1230 } 1231 1231 … … 1238 1238 */ 1239 1239 static HRESULT WINAPI DataCache_EnumFormatEtc( 1240 IDataObject* iface, 1240 IDataObject* iface, 1241 1241 DWORD dwDirection, 1242 1242 IEnumFORMATETC** ppenumFormatEtc) … … 1254 1254 */ 1255 1255 static HRESULT WINAPI DataCache_DAdvise( 1256 IDataObject* iface, 1257 FORMATETC* pformatetc, 1258 DWORD advf, 1259 IAdviseSink* pAdvSink, 1256 IDataObject* iface, 1257 FORMATETC* pformatetc, 1258 DWORD advf, 1259 IAdviseSink* pAdvSink, 1260 1260 DWORD* pdwConnection) 1261 1261 { … … 1311 1311 _ICOM_THIS_From_IPersistStorage(DataCache, iface); 1312 1312 1313 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 1313 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 1314 1314 } 1315 1315 … … 1319 1319 * See Windows documentation for more details on IUnknown methods. 1320 1320 */ 1321 static ULONG WINAPI DataCache_IPersistStorage_AddRef( 1321 static ULONG WINAPI DataCache_IPersistStorage_AddRef( 1322 1322 IPersistStorage* iface) 1323 1323 { 1324 1324 _ICOM_THIS_From_IPersistStorage(DataCache, iface); 1325 1325 1326 return IUnknown_AddRef(this->outerUnknown); 1326 return IUnknown_AddRef(this->outerUnknown); 1327 1327 } 1328 1328 … … 1332 1332 * See Windows documentation for more details on IUnknown methods. 1333 1333 */ 1334 static ULONG WINAPI DataCache_IPersistStorage_Release( 1334 static ULONG WINAPI DataCache_IPersistStorage_Release( 1335 1335 IPersistStorage* iface) 1336 1336 { 1337 1337 _ICOM_THIS_From_IPersistStorage(DataCache, iface); 1338 1338 1339 return IUnknown_Release(this->outerUnknown); 1339 return IUnknown_Release(this->outerUnknown); 1340 1340 } 1341 1341 … … 1347 1347 * See Windows documentation for more details on IPersistStorage methods. 1348 1348 */ 1349 static HRESULT WINAPI DataCache_GetClassID( 1349 static HRESULT WINAPI DataCache_GetClassID( 1350 1350 IPersistStorage* iface, 1351 1351 CLSID* pClassID) … … 1358 1358 * DataCache_IsDirty (IPersistStorage) 1359 1359 * 1360 * Until we actully connect to a running object and retrieve new 1360 * Until we actully connect to a running object and retrieve new 1361 1361 * information to it, we never get dirty. 1362 1362 * 1363 1363 * See Windows documentation for more details on IPersistStorage methods. 1364 1364 */ 1365 static HRESULT WINAPI DataCache_IsDirty( 1365 static HRESULT WINAPI DataCache_IsDirty( 1366 1366 IPersistStorage* iface) 1367 1367 { … … 1379 1379 * See Windows documentation for more details on IPersistStorage methods. 1380 1380 */ 1381 static HRESULT WINAPI DataCache_InitNew( 1382 IPersistStorage* iface, 1383 IStorage* pStg) 1384 { 1385 TRACE("(%p, %p)\n", iface, pStg); 1386 1387 return DataCache_Load(iface, pStg); 1388 } 1389 1390 /************************************************************************ 1391 * DataCache_Load (IPersistStorage) 1392 * 1393 * The data cache implementation of IPersistStorage_Load doesn't 1394 * actually load anything. Instead, it holds on to the storage pointer 1395 * and it will load the presentation information when the 1396 * IDataObject_GetData or IViewObject2_Draw methods are called. 1397 * 1398 * See Windows documentation for more details on IPersistStorage methods. 1399 */ 1400 static HRESULT WINAPI DataCache_Load( 1381 static HRESULT WINAPI DataCache_InitNew( 1401 1382 IPersistStorage* iface, 1402 1383 IStorage* pStg) 1403 1384 { 1385 TRACE("(%p, %p)\n", iface, pStg); 1386 1387 return DataCache_Load(iface, pStg); 1388 } 1389 1390 /************************************************************************ 1391 * DataCache_Load (IPersistStorage) 1392 * 1393 * The data cache implementation of IPersistStorage_Load doesn't 1394 * actually load anything. Instead, it holds on to the storage pointer 1395 * and it will load the presentation information when the 1396 * IDataObject_GetData or IViewObject2_Draw methods are called. 1397 * 1398 * See Windows documentation for more details on IPersistStorage methods. 1399 */ 1400 static HRESULT WINAPI DataCache_Load( 1401 IPersistStorage* iface, 1402 IStorage* pStg) 1403 { 1404 1404 _ICOM_THIS_From_IPersistStorage(DataCache, iface); 1405 1405 … … 1423 1423 * DataCache_Save (IPersistStorage) 1424 1424 * 1425 * Until we actully connect to a running object and retrieve new 1425 * Until we actully connect to a running object and retrieve new 1426 1426 * information to it, we never have to save anything. However, it is 1427 1427 * our responsability to copy the information when saving to a new … … 1430 1430 * See Windows documentation for more details on IPersistStorage methods. 1431 1431 */ 1432 static HRESULT WINAPI DataCache_Save( 1432 static HRESULT WINAPI DataCache_Save( 1433 1433 IPersistStorage* iface, 1434 IStorage* pStg, 1434 IStorage* pStg, 1435 1435 BOOL fSameAsLoad) 1436 1436 { … … 1439 1439 TRACE("(%p, %p, %d)\n", iface, pStg, fSameAsLoad); 1440 1440 1441 if ( (!fSameAsLoad) && 1441 if ( (!fSameAsLoad) && 1442 1442 (this->presentationStorage!=NULL) ) 1443 1443 { … … 1460 1460 * See Windows documentation for more details on IPersistStorage methods. 1461 1461 */ 1462 static HRESULT WINAPI DataCache_SaveCompleted( 1463 IPersistStorage* iface, 1462 static HRESULT WINAPI DataCache_SaveCompleted( 1463 IPersistStorage* iface, 1464 1464 IStorage* pStgNew) 1465 1465 { … … 1525 1525 _ICOM_THIS_From_IViewObject2(DataCache, iface); 1526 1526 1527 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 1527 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 1528 1528 } 1529 1529 … … 1533 1533 * See Windows documentation for more details on IUnknown methods. 1534 1534 */ 1535 static ULONG WINAPI DataCache_IViewObject2_AddRef( 1535 static ULONG WINAPI DataCache_IViewObject2_AddRef( 1536 1536 IViewObject2* iface) 1537 1537 { 1538 1538 _ICOM_THIS_From_IViewObject2(DataCache, iface); 1539 1539 1540 return IUnknown_AddRef(this->outerUnknown); 1540 return IUnknown_AddRef(this->outerUnknown); 1541 1541 } 1542 1542 … … 1546 1546 * See Windows documentation for more details on IUnknown methods. 1547 1547 */ 1548 static ULONG WINAPI DataCache_IViewObject2_Release( 1548 static ULONG WINAPI DataCache_IViewObject2_Release( 1549 1549 IViewObject2* iface) 1550 1550 { 1551 1551 _ICOM_THIS_From_IViewObject2(DataCache, iface); 1552 1552 1553 return IUnknown_Release(this->outerUnknown); 1553 return IUnknown_Release(this->outerUnknown); 1554 1554 } 1555 1555 … … 1567 1567 LONG lindex, 1568 1568 void* pvAspect, 1569 DVTARGETDEVICE* ptd, 1570 HDC hdcTargetDev, 1569 DVTARGETDEVICE* ptd, 1570 HDC hdcTargetDev, 1571 1571 HDC hdcDraw, 1572 1572 LPCRECTL lprcBounds, … … 1586 1586 lindex, 1587 1587 pvAspect, 1588 hdcTargetDev, 1588 hdcTargetDev, 1589 1589 hdcDraw, 1590 1590 lprcBounds, … … 1637 1637 &oldWindowExt); 1638 1638 1639 SetViewportExtEx(hdcDraw, 1639 SetViewportExtEx(hdcDraw, 1640 1640 lprcBounds->right - lprcBounds->left, 1641 1641 lprcBounds->bottom - lprcBounds->top, … … 1654 1654 NULL); 1655 1655 1656 SetViewportExtEx(hdcDraw, 1656 SetViewportExtEx(hdcDraw, 1657 1657 oldViewportExt.cx, 1658 1658 oldViewportExt.cy, … … 1673 1673 1674 1674 static HRESULT WINAPI DataCache_GetColorSet( 1675 IViewObject2* iface, 1676 DWORD dwDrawAspect, 1677 LONG lindex, 1678 void* pvAspect, 1679 DVTARGETDEVICE* ptd, 1680 HDC hicTargetDevice, 1675 IViewObject2* iface, 1676 DWORD dwDrawAspect, 1677 LONG lindex, 1678 void* pvAspect, 1679 DVTARGETDEVICE* ptd, 1680 HDC hicTargetDevice, 1681 1681 LOGPALETTE** ppColorSet) 1682 1682 { … … 1689 1689 DWORD dwDrawAspect, 1690 1690 LONG lindex, 1691 void* pvAspect, 1691 void* pvAspect, 1692 1692 DWORD* pdwFreeze) 1693 1693 { … … 1714 1714 static HRESULT WINAPI DataCache_SetAdvise( 1715 1715 IViewObject2* iface, 1716 DWORD aspects, 1717 DWORD advf, 1716 DWORD aspects, 1717 DWORD advf, 1718 1718 IAdviseSink* pAdvSink) 1719 1719 { … … 1729 1729 IAdviseSink_Release(this->sinkInterface); 1730 1730 this->sinkInterface = NULL; 1731 this->sinkAspects = 0; 1731 this->sinkAspects = 0; 1732 1732 this->sinkAdviseFlag = 0; 1733 1733 } … … 1739 1739 { 1740 1740 this->sinkInterface = pAdvSink; 1741 this->sinkAspects = aspects; 1742 this->sinkAdviseFlag = advf; 1741 this->sinkAspects = aspects; 1742 this->sinkAdviseFlag = advf; 1743 1743 1744 1744 IAdviseSink_AddRef(this->sinkInterface); … … 1762 1762 * DataCache_GetAdvise (IViewObject2) 1763 1763 * 1764 * This method queries the current state of the advise sink 1764 * This method queries the current state of the advise sink 1765 1765 * installed on the data cache. 1766 1766 * … … 1768 1768 */ 1769 1769 static HRESULT WINAPI DataCache_GetAdvise( 1770 IViewObject2* iface, 1771 DWORD* pAspects, 1772 DWORD* pAdvf, 1770 IViewObject2* iface, 1771 DWORD* pAspects, 1772 DWORD* pAdvf, 1773 1773 IAdviseSink** ppAdvSink) 1774 1774 { … … 1788 1788 if (ppAdvSink!=NULL) 1789 1789 { 1790 IAdviseSink_QueryInterface(this->sinkInterface, 1791 &IID_IAdviseSink, 1790 IAdviseSink_QueryInterface(this->sinkInterface, 1791 &IID_IAdviseSink, 1792 1792 (void**)ppAdvSink); 1793 1793 } … … 1804 1804 */ 1805 1805 static HRESULT WINAPI DataCache_GetExtent( 1806 IViewObject2* iface, 1807 DWORD dwDrawAspect, 1808 LONG lindex, 1809 DVTARGETDEVICE* ptd, 1806 IViewObject2* iface, 1807 DWORD dwDrawAspect, 1808 LONG lindex, 1809 DVTARGETDEVICE* ptd, 1810 1810 LPSIZEL lpsizel) 1811 1811 { … … 1815 1815 _ICOM_THIS_From_IViewObject2(DataCache, iface); 1816 1816 1817 TRACE("(%p, %lx, %ld, %p, %p)\n", 1817 TRACE("(%p, %lx, %ld, %p, %p)\n", 1818 1818 iface, dwDrawAspect, lindex, ptd, lpsizel); 1819 1819 … … 1842 1842 if (ptd!=NULL) 1843 1843 FIXME("Unimplemented ptd = %p\n", ptd); 1844 1845 /* 1846 * Get the presentation information from the 1844 1845 /* 1846 * Get the presentation information from the 1847 1847 * cache. 1848 1848 */ … … 1884 1884 _ICOM_THIS_From_IOleCache2(DataCache, iface); 1885 1885 1886 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 1886 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 1887 1887 } 1888 1888 … … 1892 1892 * See Windows documentation for more details on IUnknown methods. 1893 1893 */ 1894 static ULONG WINAPI DataCache_IOleCache2_AddRef( 1894 static ULONG WINAPI DataCache_IOleCache2_AddRef( 1895 1895 IOleCache2* iface) 1896 1896 { 1897 1897 _ICOM_THIS_From_IOleCache2(DataCache, iface); 1898 1898 1899 return IUnknown_AddRef(this->outerUnknown); 1899 return IUnknown_AddRef(this->outerUnknown); 1900 1900 } 1901 1901 … … 1905 1905 * See Windows documentation for more details on IUnknown methods. 1906 1906 */ 1907 static ULONG WINAPI DataCache_IOleCache2_Release( 1907 static ULONG WINAPI DataCache_IOleCache2_Release( 1908 1908 IOleCache2* iface) 1909 1909 { 1910 1910 _ICOM_THIS_From_IOleCache2(DataCache, iface); 1911 1911 1912 return IUnknown_Release(this->outerUnknown); 1912 return IUnknown_Release(this->outerUnknown); 1913 1913 } 1914 1914 … … 1959 1959 static HRESULT WINAPI DataCache_UpdateCache( 1960 1960 IOleCache2* iface, 1961 LPDATAOBJECT pDataObject, 1961 LPDATAOBJECT pDataObject, 1962 1962 DWORD grfUpdf, 1963 1963 LPVOID pReserved) … … 1993 1993 _ICOM_THIS_From_IOleCacheControl(DataCache, iface); 1994 1994 1995 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 1995 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 1996 1996 } 1997 1997 … … 2001 2001 * See Windows documentation for more details on IUnknown methods. 2002 2002 */ 2003 static ULONG WINAPI DataCache_IOleCacheControl_AddRef( 2003 static ULONG WINAPI DataCache_IOleCacheControl_AddRef( 2004 2004 IOleCacheControl* iface) 2005 2005 { 2006 2006 _ICOM_THIS_From_IOleCacheControl(DataCache, iface); 2007 2007 2008 return IUnknown_AddRef(this->outerUnknown); 2008 return IUnknown_AddRef(this->outerUnknown); 2009 2009 } 2010 2010 … … 2014 2014 * See Windows documentation for more details on IUnknown methods. 2015 2015 */ 2016 static ULONG WINAPI DataCache_IOleCacheControl_Release( 2016 static ULONG WINAPI DataCache_IOleCacheControl_Release( 2017 2017 IOleCacheControl* iface) 2018 2018 { 2019 2019 _ICOM_THIS_From_IOleCacheControl(DataCache, iface); 2020 2020 2021 return IUnknown_Release(this->outerUnknown); 2021 return IUnknown_Release(this->outerUnknown); 2022 2022 } 2023 2023 -
trunk/src/ole32/errorinfo.c
r8441 r8620 20 20 * NOTES: 21 21 * 22 * The errorinfo is a per-thread object. The reference is stored in the 22 * The errorinfo is a per-thread object. The reference is stored in the 23 23 * TEB at offset 0xf80 24 24 */ … … 48 48 WCHAR* stringBuffer; 49 49 DWORD len; 50 50 51 51 if (in == NULL) 52 52 return NULL; … … 107 107 { 108 108 DWORD* bufferPointer; 109 109 110 110 /* NULL is a valid parameter */ 111 111 if(!in) return; … … 133 133 ICOM_VTABLE(ISupportErrorInfo) *lpvtsei; 134 134 DWORD ref; 135 135 136 136 GUID m_Guid; 137 137 BSTR bstrSource; … … 148 148 converts a objectpointer to This 149 149 */ 150 #define _IErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtei))) 151 #define _ICOM_THIS_From_IErrorInfo(class, name) class* This = (class*)(((char*)name)-_IErrorInfo_Offset); 152 153 #define _ICreateErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtcei))) 154 #define _ICOM_THIS_From_ICreateErrorInfo(class, name) class* This = (class*)(((char*)name)-_ICreateErrorInfo_Offset); 155 156 #define _ISupportErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtsei))) 157 #define _ICOM_THIS_From_ISupportErrorInfo(class, name) class* This = (class*)(((char*)name)-_ISupportErrorInfo_Offset); 150 #define _IErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtei))) 151 #define _ICOM_THIS_From_IErrorInfo(class, name) class* This = (class*)(((char*)name)-_IErrorInfo_Offset); 152 153 #define _ICreateErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtcei))) 154 #define _ICOM_THIS_From_ICreateErrorInfo(class, name) class* This = (class*)(((char*)name)-_ICreateErrorInfo_Offset); 155 156 #define _ISupportErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtsei))) 157 #define _ICOM_THIS_From_ISupportErrorInfo(class, name) class* This = (class*)(((char*)name)-_ISupportErrorInfo_Offset); 158 158 159 159 /* … … 194 194 if(IsEqualIID(riid, &IID_IErrorInfo)) 195 195 { 196 *ppvoid = _IErrorInfo_(This); 196 *ppvoid = _IErrorInfo_(This); 197 197 } 198 198 else if(IsEqualIID(riid, &IID_ICreateErrorInfo)) … … 240 240 static HRESULT WINAPI IErrorInfoImpl_GetGUID( 241 241 IErrorInfo* iface, 242 GUID * pGUID) 242 GUID * pGUID) 243 243 { 244 244 _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface); … … 271 271 return E_INVALIDARG; 272 272 *pBstrDescription = ERRORINFO_SysAllocString(This->bstrDescription); 273 273 274 274 return S_OK; 275 275 } … … 285 285 return E_INVALIDARG; 286 286 *pBstrHelpFile = ERRORINFO_SysAllocString(This->bstrHelpFile); 287 287 288 288 return S_OK; 289 289 } … … 298 298 return E_INVALIDARG; 299 299 *pdwHelpContext = This->m_dwHelpContext; 300 300 301 301 return S_OK; 302 302 } … … 308 308 IErrorInfoImpl_AddRef, 309 309 IErrorInfoImpl_Release, 310 310 311 311 IErrorInfoImpl_GetGUID, 312 312 IErrorInfoImpl_GetSource, … … 363 363 ERRORINFO_SysFreeString(This->bstrSource); 364 364 This->bstrSource = ERRORINFO_SysAllocString(szSource); 365 365 366 366 return S_OK; 367 367 } … … 376 376 ERRORINFO_SysFreeString(This->bstrDescription); 377 377 This->bstrDescription = ERRORINFO_SysAllocString(szDescription); 378 378 379 379 return S_OK; 380 380 } … … 400 400 TRACE("(%p)\n",This); 401 401 This->m_dwHelpContext = dwHelpContext; 402 402 403 403 return S_OK; 404 404 } … … 425 425 _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface); 426 426 TRACE("(%p)\n", This); 427 427 428 428 return IErrorInfo_QueryInterface(_IErrorInfo_(This), riid, ppvoid); 429 429 } … … 475 475 if(! pperrinfo ) return E_INVALIDARG; 476 476 if(!(pei=IErrorInfoImpl_Constructor()))return E_OUTOFMEMORY; 477 477 478 478 res = IErrorInfo_QueryInterface(pei, &IID_ICreateErrorInfo, (LPVOID*)pperrinfo); 479 479 IErrorInfo_Release(pei); -
trunk/src/ole32/filemoniker.c
r8441 r8620 40 40 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ 41 41 42 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 42 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 43 43 * two monikers are equal. That's whay IROTData interface is implemented by monikers. 44 44 */ … … 150 150 { 151 151 ICOM_THIS(FileMonikerImpl,iface); 152 152 153 153 TRACE("(%p,%p,%p)\n",This,riid,ppvObject); 154 154 … … 156 156 if ( (This==0) || (ppvObject==0) ) 157 157 return E_INVALIDARG; 158 158 159 159 /* Initialize the return parameter */ 160 160 *ppvObject = 0; … … 167 167 ) 168 168 *ppvObject = iface; 169 169 170 170 else if (IsEqualIID(&IID_IROTData, riid)) 171 171 *ppvObject = (IROTData*)&(This->lpvtbl2); … … 174 174 if ((*ppvObject)==0) 175 175 return E_NOINTERFACE; 176 176 177 177 /* Query Interface always increases the reference count by one when it is successful */ 178 178 FileMonikerImpl_AddRef(iface); … … 211 211 return 0; 212 212 } 213 return This->ref; ;213 return This->ref; 214 214 } 215 215 … … 226 226 227 227 *pClassID = CLSID_FileMoniker; 228 228 229 229 return S_OK; 230 230 } … … 266 266 if (bread!=sizeof(WORD) || wbuffer!=0) 267 267 return E_FAIL; 268 268 269 269 /* read filePath string length (plus one) */ 270 270 res=IStream_Read(pStm,&length,sizeof(DWORD),&bread); … … 282 282 if (bread != sizeof(DWORD) || dwbuffer != 0xDEADFFFF) 283 283 return E_FAIL; 284 284 285 285 length--; 286 286 287 287 for(i=0;i<10;i++){ 288 288 res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread); … … 290 290 return E_FAIL; 291 291 } 292 292 293 293 if (length>8) 294 294 length=0; 295 295 296 296 doubleLenHex=doubleLenDec=2*length; 297 297 if (length > 5) … … 304 304 if (length==0) 305 305 return res; 306 306 307 307 res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread); 308 308 if (bread!=sizeof(DWORD) || dwbuffer!=doubleLenHex) … … 325 325 326 326 HeapFree(GetProcessHeap(),0,filePathA); 327 327 328 328 return res; 329 329 } … … 336 336 BOOL fClearDirty)/* Specifies whether to clear the dirty flag */ 337 337 { 338 /* this function saves data of this object. In the beginning I thougth 339 * that I have just to write the filePath string on Stream. But, when I 340 * tested this function whith windows programs samples, I noticed that it 341 * was not the case. So I analysed data written by this function on 342 * Windows and what this did function exactly ! But I have no idea about 338 /* this function saves data of this object. In the beginning I thougth 339 * that I have just to write the filePath string on Stream. But, when I 340 * tested this function whith windows programs samples, I noticed that it 341 * was not the case. So I analysed data written by this function on 342 * Windows and what this did function exactly ! But I have no idea about 343 343 * its logic ! 344 344 * I guessed data which must be written on stream is: … … 348 348 * 4) DWORD constant : 0xDEADFFFF 349 349 * 5) ten WORD constant: zero 350 * 6) DWORD: double-length of the the path string type W ("\0" not 350 * 6) DWORD: double-length of the the path string type W ("\0" not 351 351 * included) 352 352 * 7) WORD constant: 0x3 … … 355 355 */ 356 356 357 ICOM_THIS(FileMonikerImpl,iface); 357 ICOM_THIS(FileMonikerImpl,iface); 358 358 359 359 HRESULT res; … … 390 390 /* write a DWORD set to 0xDEADFFFF: constant */ 391 391 res=IStream_Write(pStm,&constant1,sizeof(DWORD),NULL); 392 392 393 393 len--; 394 394 /* write 10 times a DWORD set to 0 : constants */ 395 395 for(i=0;i<10;i++) 396 396 res=IStream_Write(pStm,&zero,sizeof(WORD),NULL); 397 397 398 398 if (len>8) 399 399 len=0; 400 400 401 401 doubleLenHex=doubleLenDec=2*len; 402 402 if (len > 5) … … 437 437 438 438 /* for more details see FileMonikerImpl_Save coments */ 439 439 440 440 sizeMAx = sizeof(WORD) + /* first WORD is 0 */ 441 441 sizeof(DWORD)+ /* length of filePath including "\0" in the end of the string */ … … 447 447 if (len==0 || len > 8) 448 448 return S_OK; 449 449 450 450 sizeMAx += sizeof(DWORD)+ /* size of the unicode filePath: "\0" not included */ 451 451 sizeof(WORD)+ /* constant : 0x3 */ 452 452 len*sizeof(WCHAR); /* unicde filePath string */ 453 453 454 454 pcbSize->s.LowPart=sizeMAx; 455 455 pcbSize->s.HighPart=0; … … 469 469 WCHAR bkSlash[]={'\\',0}; 470 470 BYTE addBkSlash; 471 471 472 472 TRACE("(%p,%p)\n",This,lpszPathName); 473 473 … … 514 514 515 515 *This->filePathName=0; 516 516 517 517 for(i=0;tabStr[i]!=NULL;i++) 518 518 strcatW(This->filePathName,tabStr[i]); 519 519 520 520 if (addBkSlash) 521 521 strcatW(This->filePathName,bkSlash); … … 560 560 IClassFactory *pcf=0; 561 561 IClassActivator *pca=0; 562 563 ICOM_THIS(FileMonikerImpl,iface); 562 563 ICOM_THIS(FileMonikerImpl,iface); 564 564 565 565 *ppvResult=0; … … 568 568 569 569 if(pmkToLeft==NULL){ 570 570 571 571 res=IBindCtx_GetRunningObjectTable(pbc,&prot); 572 572 … … 600 600 601 601 res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassActivator,(void**)&pca); 602 602 603 603 if (res==E_NOINTERFACE) 604 604 return MK_E_INTERMEDIATEINTERFACENOTSUPPORTED; … … 619 619 620 620 FIXME("()\n"); 621 621 622 622 /*res=GetClassFile(This->filePathName,&clsID); 623 623 … … 655 655 if (pcf!=NULL) 656 656 IClassFactory_Release(pcf); 657 657 658 658 return res; 659 659 } … … 761 761 762 762 *ppmkComposite=0; 763 763 764 764 IMoniker_IsSystemMoniker(pmkRight,&mkSys); 765 765 … … 790 790 /* the length of the composed path string is raised by the sum of the two paths lengths */ 791 791 newStr=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(lstrlenW(str1)+lstrlenW(str2)+1)); 792 792 793 793 if (newStr==NULL) 794 794 return E_OUTOFMEMORY; … … 800 800 if ((strDec2[i]==NULL && lastIdx1>-1 && lastIdx2>-1) || lstrcmpW(strDec2[i],bkSlash)!=0) 801 801 strcatW(newStr,bkSlash); 802 802 803 803 for(j=i;j<=lastIdx2;j++) 804 804 strcatW(newStr,strDec2[j]); 805 805 806 806 /* create a new moniker with the new string */ 807 807 res=CreateFileMoniker(newStr,ppmkComposite); … … 879 879 880 880 IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath); 881 881 882 882 if (lstrcmpiW(filePath, 883 883 This->filePathName)!=0) 884 884 885 885 return S_FALSE; 886 886 887 887 return S_OK; 888 888 } … … 901 901 if (pdwHash==NULL) 902 902 return E_POINTER; 903 903 904 904 val = This->filePathName; 905 905 len = lstrlenW(val); … … 985 985 if (!GetFileAttributesExW(This->filePathName,GetFileExInfoStandard,&info)) 986 986 return MK_E_NOOBJECT; 987 987 988 988 *pFileTime=info.ftLastWriteTime; 989 989 } … … 1020 1020 if (pmkOther==NULL) 1021 1021 return E_INVALIDARG; 1022 1022 1023 1023 *ppmkPrefix=0; 1024 1024 1025 1025 /* check if we have the same type of moniker */ 1026 1026 IMoniker_IsSystemMoniker(pmkOther,&mkSys); … … 1044 1044 1045 1045 *commonPath=0; 1046 1046 1047 1047 for(sameIdx=0; ( (stringTable1[sameIdx]!=NULL) && 1048 1048 (stringTable2[sameIdx]!=NULL) && … … 1063 1063 if (machimeNameCase && *stringTable1[sameIdx-1]=='\\') 1064 1064 sameIdx--; 1065 1065 1066 1066 if (machimeNameCase && (sameIdx<=3) && (nb1 > 3 || nb2 > 3) ) 1067 1067 return MK_E_NOPREFIX; … … 1069 1069 for(i=0;i<sameIdx;i++) 1070 1070 strcatW(commonPath,stringTable1[i]); 1071 1071 1072 1072 for(i=0;i<nb1;i++) 1073 1073 CoTaskMemFree(stringTable1[i]); … … 1081 1081 1082 1082 HeapFree(GetProcessHeap(),0,commonPath); 1083 1083 1084 1084 return CreateFileMoniker(commonPath,ppmkPrefix); 1085 1085 } … … 1101 1101 1102 1102 strgtable =CoTaskMemAlloc(len*sizeof(LPOLESTR)); 1103 1103 1104 1104 if (strgtable==NULL) 1105 1105 return E_OUTOFMEMORY; 1106 1106 1107 1107 while(str[i]!=0){ 1108 1108 … … 1135 1135 } 1136 1136 strgtable[tabIndex]=NULL; 1137 1137 1138 1138 *stringTable=strgtable; 1139 1139 1140 1140 return tabIndex; 1141 1141 } … … 1151 1151 DWORD len1=0,len2=0,sameIdx=0,j=0; 1152 1152 WCHAR back[] ={'.','.','\\',0}; 1153 1153 1154 1154 TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath); 1155 1155 … … 1159 1159 if (pmOther==NULL) 1160 1160 return E_INVALIDARG; 1161 1161 1162 1162 res=CreateBindCtx(0,&bind); 1163 1163 if (FAILED(res)) … … 1176 1176 if (FAILED(len1) || FAILED(len2)) 1177 1177 return E_OUTOFMEMORY; 1178 1178 1179 1179 /* count the number of similar items from the begin of the two paths */ 1180 1180 for(sameIdx=0; ( (tabStr1[sameIdx]!=NULL) && … … 1197 1197 for(j=sameIdx;tabStr2[j]!=NULL;j++) 1198 1198 strcatW(relPath,tabStr2[j]); 1199 1199 1200 1200 res=CreateFileMoniker(relPath,ppmkRelPath); 1201 1201 1202 1202 for(j=0; tabStr1[j]!=NULL;j++) 1203 1203 CoTaskMemFree(tabStr1[j]); … … 1241 1241 1242 1242 strcpyW(*ppszDisplayName,This->filePathName); 1243 1243 1244 1244 return S_OK; 1245 1245 } … … 1268 1268 if (!pwdMksys) 1269 1269 return E_POINTER; 1270 1270 1271 1271 (*pwdMksys)=MKSYS_FILEMONIKER; 1272 1272 … … 1305 1305 { 1306 1306 ICOM_THIS_From_IROTData(IMoniker, iface); 1307 1307 1308 1308 TRACE("(%p)\n",This); 1309 1309 … … 1349 1349 if(lpszPathName==NULL) 1350 1350 return MK_E_SYNTAX; 1351 1351 1352 1352 *ppmk=0; 1353 1353 1354 1354 newFileMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(FileMonikerImpl)); 1355 1355 -
trunk/src/ole32/hglobalstream.c
r8441 r8620 49 49 ICOM_VFIELD(IStream); /* Needs to be the first item in the stuct 50 50 * since we want to cast this in a IStream pointer */ 51 51 52 52 /* 53 53 * Reference count … … 94 94 HRESULT WINAPI HGLOBALStreamImpl_QueryInterface( 95 95 IStream* iface, 96 REFIID riid, /* [in] */ 97 void** ppvObject); /* [iid_is][out] */ 98 96 REFIID riid, /* [in] */ 97 void** ppvObject); /* [iid_is][out] */ 98 99 99 ULONG WINAPI HGLOBALStreamImpl_AddRef( 100 100 IStream* iface); 101 101 102 102 ULONG WINAPI HGLOBALStreamImpl_Release( 103 103 IStream* iface); 104 105 HRESULT WINAPI HGLOBALStreamImpl_Read( 104 105 HRESULT WINAPI HGLOBALStreamImpl_Read( 106 106 IStream* iface, 107 107 void* pv, /* [length_is][size_is][out] */ 108 ULONG cb, /* [in] */ 109 ULONG* pcbRead); /* [out] */ 110 108 ULONG cb, /* [in] */ 109 ULONG* pcbRead); /* [out] */ 110 111 111 HRESULT WINAPI HGLOBALStreamImpl_Write( 112 112 IStream* iface, 113 const void* pv, /* [size_is][in] */ 114 ULONG cb, /* [in] */ 115 ULONG* pcbWritten); /* [out] */ 116 117 HRESULT WINAPI HGLOBALStreamImpl_Seek( 113 const void* pv, /* [size_is][in] */ 114 ULONG cb, /* [in] */ 115 ULONG* pcbWritten); /* [out] */ 116 117 HRESULT WINAPI HGLOBALStreamImpl_Seek( 118 118 IStream* iface, 119 LARGE_INTEGER dlibMove, /* [in] */ 120 DWORD dwOrigin, /* [in] */ 119 LARGE_INTEGER dlibMove, /* [in] */ 120 DWORD dwOrigin, /* [in] */ 121 121 ULARGE_INTEGER* plibNewPosition); /* [out] */ 122 123 HRESULT WINAPI HGLOBALStreamImpl_SetSize( 122 123 HRESULT WINAPI HGLOBALStreamImpl_SetSize( 124 124 IStream* iface, 125 ULARGE_INTEGER libNewSize); /* [in] */ 126 127 HRESULT WINAPI HGLOBALStreamImpl_CopyTo( 125 ULARGE_INTEGER libNewSize); /* [in] */ 126 127 HRESULT WINAPI HGLOBALStreamImpl_CopyTo( 128 128 IStream* iface, 129 IStream* pstm, /* [unique][in] */ 130 ULARGE_INTEGER cb, /* [in] */ 131 ULARGE_INTEGER* pcbRead, /* [out] */ 132 ULARGE_INTEGER* pcbWritten); /* [out] */ 133 134 HRESULT WINAPI HGLOBALStreamImpl_Commit( 129 IStream* pstm, /* [unique][in] */ 130 ULARGE_INTEGER cb, /* [in] */ 131 ULARGE_INTEGER* pcbRead, /* [out] */ 132 ULARGE_INTEGER* pcbWritten); /* [out] */ 133 134 HRESULT WINAPI HGLOBALStreamImpl_Commit( 135 135 IStream* iface, 136 DWORD grfCommitFlags); /* [in] */ 137 138 HRESULT WINAPI HGLOBALStreamImpl_Revert( 136 DWORD grfCommitFlags); /* [in] */ 137 138 HRESULT WINAPI HGLOBALStreamImpl_Revert( 139 139 IStream* iface); 140 141 HRESULT WINAPI HGLOBALStreamImpl_LockRegion( 140 141 HRESULT WINAPI HGLOBALStreamImpl_LockRegion( 142 142 IStream* iface, 143 ULARGE_INTEGER libOffset, /* [in] */ 144 ULARGE_INTEGER cb, /* [in] */ 145 DWORD dwLockType); /* [in] */ 146 147 HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion( 143 ULARGE_INTEGER libOffset, /* [in] */ 144 ULARGE_INTEGER cb, /* [in] */ 145 DWORD dwLockType); /* [in] */ 146 147 HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion( 148 148 IStream* iface, 149 ULARGE_INTEGER libOffset, /* [in] */ 150 ULARGE_INTEGER cb, /* [in] */ 151 DWORD dwLockType); /* [in] */ 152 153 HRESULT WINAPI HGLOBALStreamImpl_Stat( 149 ULARGE_INTEGER libOffset, /* [in] */ 150 ULARGE_INTEGER cb, /* [in] */ 151 DWORD dwLockType); /* [in] */ 152 153 HRESULT WINAPI HGLOBALStreamImpl_Stat( 154 154 IStream* iface, 155 155 STATSTG* pstatstg, /* [out] */ 156 DWORD grfStatFlag); /* [in] */ 157 158 HRESULT WINAPI HGLOBALStreamImpl_Clone( 156 DWORD grfStatFlag); /* [in] */ 157 158 HRESULT WINAPI HGLOBALStreamImpl_Clone( 159 159 IStream* iface, 160 IStream** ppstm); /* [out] */ 160 IStream** ppstm); /* [out] */ 161 161 162 162 … … 187 187 */ 188 188 HRESULT WINAPI CreateStreamOnHGlobal( 189 HGLOBAL hGlobal, 190 BOOL fDeleteOnRelease, 189 HGLOBAL hGlobal, 190 BOOL fDeleteOnRelease, 191 191 LPSTREAM* ppstm) 192 192 { … … 198 198 if (newStream!=NULL) 199 199 { 200 return IUnknown_QueryInterface((IUnknown*)newStream, 200 return IUnknown_QueryInterface((IUnknown*)newStream, 201 201 &IID_IStream, 202 202 (void**)ppstm); … … 241 241 * Params: 242 242 * hGlobal - Handle that will support the stream. can be NULL. 243 * fDeleteOnRelease - Flag set to TRUE if the HGLOBAL will be released 243 * fDeleteOnRelease - Flag set to TRUE if the HGLOBAL will be released 244 244 * when the IStream object is destroyed. 245 245 */ … … 251 251 252 252 newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(HGLOBALStreamImpl)); 253 253 254 254 if (newStream!=0) 255 255 { … … 259 259 ICOM_VTBL(newStream) = &HGLOBALStreamImpl_Vtbl; 260 260 newStream->ref = 0; 261 261 262 262 /* 263 263 * Initialize the support. … … 274 274 GMEM_SHARE, 0); 275 275 } 276 276 277 277 /* 278 278 * Start the stream at the beginning. … … 280 280 newStream->currentPosition.s.HighPart = 0; 281 281 newStream->currentPosition.s.LowPart = 0; 282 282 283 283 /* 284 284 * Initialize the size of the stream to the size of the handle. … … 287 287 newStream->streamSize.s.LowPart = GlobalSize(newStream->supportHandle); 288 288 } 289 289 290 290 return newStream; 291 291 } … … 294 294 * This is the destructor of the HGLOBALStreamImpl class. 295 295 * 296 * This method will clean-up all the resources used-up by the given HGLOBALStreamImpl 296 * This method will clean-up all the resources used-up by the given HGLOBALStreamImpl 297 297 * class. The pointer passed-in to this function will be freed and will not 298 298 * be valid anymore. … … 314 314 * Finally, free the memory used-up by the class. 315 315 */ 316 HeapFree(GetProcessHeap(), 0, This); 316 HeapFree(GetProcessHeap(), 0, This); 317 317 } 318 318 … … 323 323 HRESULT WINAPI HGLOBALStreamImpl_QueryInterface( 324 324 IStream* iface, 325 REFIID riid, /* [in] */ 326 void** ppvObject) /* [iid_is][out] */ 325 REFIID riid, /* [in] */ 326 void** ppvObject) /* [iid_is][out] */ 327 327 { 328 328 HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; … … 333 333 if (ppvObject==0) 334 334 return E_INVALIDARG; 335 335 336 336 /* 337 337 * Initialize the return parameter. 338 338 */ 339 339 *ppvObject = 0; 340 340 341 341 /* 342 342 * Compare the riid with the interface IDs implemented by this object. 343 343 */ 344 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 344 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 345 345 { 346 346 *ppvObject = (IStream*)This; 347 347 } 348 else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0) 348 else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0) 349 349 { 350 350 *ppvObject = (IStream*)This; 351 351 } 352 352 353 353 /* 354 354 * Check that we obtained an interface. … … 356 356 if ((*ppvObject)==0) 357 357 return E_NOINTERFACE; 358 358 359 359 /* 360 360 * Query Interface always increases the reference count by one when it is … … 362 362 */ 363 363 HGLOBALStreamImpl_AddRef(iface); 364 365 return S_OK; ;364 365 return S_OK; 366 366 } 367 367 … … 376 376 377 377 This->ref++; 378 378 379 379 return This->ref; 380 380 } … … 390 390 391 391 ULONG newRef; 392 392 393 393 This->ref--; 394 394 395 395 newRef = This->ref; 396 396 397 397 /* 398 398 * If the reference count goes down to 0, perform suicide. … … 402 402 HGLOBALStreamImpl_Destroy(This); 403 403 } 404 404 405 405 return newRef; 406 406 } … … 415 415 * See the documentation of ISequentialStream for more info. 416 416 */ 417 HRESULT WINAPI HGLOBALStreamImpl_Read( 417 HRESULT WINAPI HGLOBALStreamImpl_Read( 418 418 IStream* iface, 419 419 void* pv, /* [length_is][size_is][out] */ 420 ULONG cb, /* [in] */ 421 ULONG* pcbRead) /* [out] */ 420 ULONG cb, /* [in] */ 421 ULONG* pcbRead) /* [out] */ 422 422 { 423 423 HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; … … 429 429 TRACE("(%p, %p, %ld, %p)\n", iface, 430 430 pv, cb, pcbRead); 431 432 /* 431 432 /* 433 433 * If the caller is not interested in the nubmer of bytes read, 434 434 * we use another buffer to avoid "if" statements in the code. … … 436 436 if (pcbRead==0) 437 437 pcbRead = &bytesReadBuffer; 438 438 439 439 /* 440 440 * Using the known size of the stream, calculate the number of bytes … … 464 464 */ 465 465 GlobalUnlock(This->supportHandle); 466 466 467 467 /* 468 468 * The function returns S_OK if the buffer was filled completely … … 472 472 if(*pcbRead == cb) 473 473 return S_OK; 474 474 475 475 return S_FALSE; 476 476 } 477 477 478 478 /*** 479 479 * This method is part of the ISequentialStream interface. … … 488 488 HRESULT WINAPI HGLOBALStreamImpl_Write( 489 489 IStream* iface, 490 const void* pv, /* [size_is][in] */ 491 ULONG cb, /* [in] */ 492 ULONG* pcbWritten) /* [out] */ 490 const void* pv, /* [size_is][in] */ 491 ULONG cb, /* [in] */ 492 ULONG* pcbWritten) /* [out] */ 493 493 { 494 494 HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; … … 500 500 TRACE("(%p, %p, %ld, %p)\n", iface, 501 501 pv, cb, pcbWritten); 502 502 503 503 /* 504 504 * If the caller is not interested in the number of bytes written, … … 507 507 if (pcbWritten == 0) 508 508 pcbWritten = &bytesWritten; 509 509 510 510 if (cb == 0) 511 511 { … … 517 517 newSize.s.LowPart = This->currentPosition.s.LowPart + cb; 518 518 } 519 519 520 520 /* 521 521 * Verify if we need to grow the stream … … 526 526 IStream_SetSize(iface, newSize); 527 527 } 528 528 529 529 /* 530 530 * Lock the buffer in position and copy the data. … … 532 532 supportBuffer = GlobalLock(This->supportHandle); 533 533 534 memcpy((char *) supportBuffer+This->currentPosition.s.LowPart, pv, cb); 534 memcpy((char *) supportBuffer+This->currentPosition.s.LowPart, pv, cb); 535 535 536 536 /* … … 548 548 */ 549 549 GlobalUnlock(This->supportHandle); 550 550 551 551 return S_OK; 552 552 } … … 559 559 * 560 560 * See the documentation of IStream for more info. 561 */ 562 HRESULT WINAPI HGLOBALStreamImpl_Seek( 561 */ 562 HRESULT WINAPI HGLOBALStreamImpl_Seek( 563 563 IStream* iface, 564 LARGE_INTEGER dlibMove, /* [in] */ 565 DWORD dwOrigin, /* [in] */ 564 LARGE_INTEGER dlibMove, /* [in] */ 565 DWORD dwOrigin, /* [in] */ 566 566 ULARGE_INTEGER* plibNewPosition) /* [out] */ 567 567 { … … 573 573 dlibMove.s.LowPart, dwOrigin, plibNewPosition); 574 574 575 /* 575 /* 576 576 * The caller is allowed to pass in NULL as the new position return value. 577 577 * If it happens, we assign it to a dynamic variable to avoid special cases … … 627 627 plibNewPosition->s.LowPart += dlibMove.s.LowPart; 628 628 This->currentPosition = *plibNewPosition; 629 629 630 630 return S_OK; 631 631 } … … 640 640 * See the documentation of IStream for more info. 641 641 */ 642 HRESULT WINAPI HGLOBALStreamImpl_SetSize( 642 HRESULT WINAPI HGLOBALStreamImpl_SetSize( 643 643 IStream* iface, 644 ULARGE_INTEGER libNewSize) /* [in] */ 644 ULARGE_INTEGER libNewSize) /* [in] */ 645 645 { 646 646 HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; … … 653 653 if (libNewSize.s.HighPart != 0) 654 654 return STG_E_INVALIDFUNCTION; 655 655 656 656 if (This->streamSize.s.LowPart == libNewSize.s.LowPart) 657 657 return S_OK; … … 660 660 * Re allocate the HGlobal to fit the new size of the stream. 661 661 */ 662 This->supportHandle = GlobalReAlloc(This->supportHandle, 662 This->supportHandle = GlobalReAlloc(This->supportHandle, 663 663 libNewSize.s.LowPart, 664 664 0); 665 665 666 666 This->streamSize.s.LowPart = libNewSize.s.LowPart; 667 668 return S_OK; 669 } 670 667 668 return S_OK; 669 } 670 671 671 /*** 672 672 * This method is part of the IStream interface. … … 676 676 * See the documentation of IStream for more info. 677 677 */ 678 HRESULT WINAPI HGLOBALStreamImpl_CopyTo( 678 HRESULT WINAPI HGLOBALStreamImpl_CopyTo( 679 679 IStream* iface, 680 IStream* pstm, /* [unique][in] */ 681 ULARGE_INTEGER cb, /* [in] */ 682 ULARGE_INTEGER* pcbRead, /* [out] */ 683 ULARGE_INTEGER* pcbWritten) /* [out] */ 680 IStream* pstm, /* [unique][in] */ 681 ULARGE_INTEGER cb, /* [in] */ 682 ULARGE_INTEGER* pcbRead, /* [out] */ 683 ULARGE_INTEGER* pcbWritten) /* [out] */ 684 684 { 685 685 HRESULT hr = S_OK; … … 689 689 ULARGE_INTEGER totalBytesWritten; 690 690 691 TRACE("(%p, %p, %ld, %p, %p)\n", iface, pstm, 691 TRACE("(%p, %p, %ld, %p, %p)\n", iface, pstm, 692 692 cb.s.LowPart, pcbRead, pcbWritten); 693 693 … … 712 712 else 713 713 copySize = cb.s.LowPart; 714 714 715 715 IStream_Read(iface, tmpBuffer, copySize, &bytesRead); 716 716 717 717 totalBytesRead.s.LowPart += bytesRead; 718 718 719 719 IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten); 720 720 … … 729 729 break; 730 730 } 731 731 732 732 if (bytesRead!=copySize) 733 733 cb.s.LowPart = 0; … … 756 756 * This method is part of the IStream interface. 757 757 * 758 * For streams supported by HGLOBALS, this function does nothing. 758 * For streams supported by HGLOBALS, this function does nothing. 759 759 * This is what the documentation tells us. 760 760 * 761 761 * See the documentation of IStream for more info. 762 */ 763 HRESULT WINAPI HGLOBALStreamImpl_Commit( 762 */ 763 HRESULT WINAPI HGLOBALStreamImpl_Commit( 764 764 IStream* iface, 765 DWORD grfCommitFlags) /* [in] */ 765 DWORD grfCommitFlags) /* [in] */ 766 766 { 767 767 return S_OK; … … 771 771 * This method is part of the IStream interface. 772 772 * 773 * For streams supported by HGLOBALS, this function does nothing. 773 * For streams supported by HGLOBALS, this function does nothing. 774 774 * This is what the documentation tells us. 775 775 * 776 776 * See the documentation of IStream for more info. 777 */ 778 HRESULT WINAPI HGLOBALStreamImpl_Revert( 777 */ 778 HRESULT WINAPI HGLOBALStreamImpl_Revert( 779 779 IStream* iface) 780 780 { … … 785 785 * This method is part of the IStream interface. 786 786 * 787 * For streams supported by HGLOBALS, this function does nothing. 787 * For streams supported by HGLOBALS, this function does nothing. 788 788 * This is what the documentation tells us. 789 789 * 790 790 * See the documentation of IStream for more info. 791 */ 792 HRESULT WINAPI HGLOBALStreamImpl_LockRegion( 791 */ 792 HRESULT WINAPI HGLOBALStreamImpl_LockRegion( 793 793 IStream* iface, 794 ULARGE_INTEGER libOffset, /* [in] */ 795 ULARGE_INTEGER cb, /* [in] */ 796 DWORD dwLockType) /* [in] */ 794 ULARGE_INTEGER libOffset, /* [in] */ 795 ULARGE_INTEGER cb, /* [in] */ 796 DWORD dwLockType) /* [in] */ 797 797 { 798 798 return S_OK; … … 802 802 * This method is part of the IStream interface. 803 803 * 804 * For streams supported by HGLOBALS, this function does nothing. 804 * For streams supported by HGLOBALS, this function does nothing. 805 805 * This is what the documentation tells us. 806 806 * 807 807 * See the documentation of IStream for more info. 808 */ 809 HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion( 808 */ 809 HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion( 810 810 IStream* iface, 811 ULARGE_INTEGER libOffset, /* [in] */ 812 ULARGE_INTEGER cb, /* [in] */ 813 DWORD dwLockType) /* [in] */ 811 ULARGE_INTEGER libOffset, /* [in] */ 812 ULARGE_INTEGER cb, /* [in] */ 813 DWORD dwLockType) /* [in] */ 814 814 { 815 815 return S_OK; … … 823 823 * 824 824 * See the documentation of IStream for more info. 825 */ 826 HRESULT WINAPI HGLOBALStreamImpl_Stat( 825 */ 826 HRESULT WINAPI HGLOBALStreamImpl_Stat( 827 827 IStream* iface, 828 828 STATSTG* pstatstg, /* [out] */ 829 DWORD grfStatFlag) /* [in] */ 829 DWORD grfStatFlag) /* [in] */ 830 830 { 831 831 HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; … … 839 839 return S_OK; 840 840 } 841 842 HRESULT WINAPI HGLOBALStreamImpl_Clone( 841 842 HRESULT WINAPI HGLOBALStreamImpl_Clone( 843 843 IStream* iface, 844 IStream** ppstm) /* [out] */ 844 IStream** ppstm) /* [out] */ 845 845 { 846 846 FIXME("not implemented!\n"); -
trunk/src/ole32/itemmoniker.c
r8441 r8620 39 39 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ 40 40 41 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 41 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 42 42 * two monikers are equal. That's whay IROTData interface is implemented by monikers. 43 43 */ … … 49 49 50 50 LPOLESTR itemDelimiter; /* Delimiter string */ 51 51 52 52 } ItemMonikerImpl; 53 53 … … 155 155 if ( (This==0) || (ppvObject==0) ) 156 156 return E_INVALIDARG; 157 157 158 158 /* Initialize the return parameter */ 159 159 *ppvObject = 0; … … 166 166 ) 167 167 *ppvObject = iface; 168 168 169 169 else if (IsEqualIID(&IID_IROTData, riid)) 170 170 *ppvObject = (IROTData*)&(This->lpvtbl2); … … 173 173 if ((*ppvObject)==0) 174 174 return E_NOINTERFACE; 175 175 176 176 /* Query Interface always increases the reference count by one when it is successful */ 177 177 ItemMonikerImpl_AddRef(iface); … … 210 210 return 0; 211 211 } 212 return This->ref; ;212 return This->ref; 213 213 } 214 214 … … 222 222 if (pClassID==NULL) 223 223 return E_POINTER; 224 224 225 225 *pClassID = CLSID_ItemMoniker; 226 226 227 227 return S_OK; 228 228 } … … 356 356 357 357 /* for more details see ItemMonikerImpl_Save coments */ 358 358 359 359 pcbSize->s.LowPart = sizeof(DWORD) + /* DWORD which contains delimiter length */ 360 360 delimiterLength + /* item delimiter string */ … … 433 433 { 434 434 ICOM_THIS(ItemMonikerImpl,iface); 435 435 436 436 HRESULT res; 437 437 IID refid=IID_IOleItemContainer; … … 480 480 if(pmkToLeft==NULL) 481 481 return E_INVALIDARG; 482 482 483 483 res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic); 484 484 … … 510 510 511 511 *ppmkReduced=iface; 512 512 513 513 return MK_S_REDUCED_TO_SELF; 514 514 } … … 533 533 534 534 *ppmkComposite=0; 535 535 536 536 IMoniker_IsSystemMoniker(pmkRight,&mkSys); 537 537 … … 543 543 /* if pmkRight is a composite whose leftmost component is an anti-moniker, */ 544 544 /* the returned moniker is the composite after the leftmost anti-moniker is removed. */ 545 545 546 546 if(mkSys==MKSYS_GENERICCOMPOSITE){ 547 547 … … 561 561 tempMkComposite=iface; 562 562 IMoniker_AddRef(iface); 563 563 564 564 while(IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL)==S_OK){ 565 565 … … 618 618 if (pmkOtherMoniker==NULL) 619 619 return S_FALSE; 620 620 621 621 /* This method returns S_OK if both monikers are item monikers and their display names are */ 622 622 /* identical (using a case-insensitive comparison); otherwise, the method returns S_FALSE. */ … … 633 633 IMoniker_GetDisplayName(iface,bind,NULL,&dispName1); 634 634 IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2); 635 635 636 636 if (lstrcmpW(dispName1,dispName2)!=0) 637 637 return S_FALSE; 638 638 639 639 return S_OK; 640 640 } … … 653 653 if (pdwHash==NULL) 654 654 return E_POINTER; 655 655 656 656 val = This->itemName; 657 657 len = lstrlenW(val); … … 712 712 /* requesting an IOleItemContainer interface pointer. The method then calls IOleItemContainer::IsRunning,*/ 713 713 /* passing the string contained within this moniker. */ 714 714 715 715 res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic); 716 716 … … 793 793 794 794 *ppmkPrefix=iface; 795 795 796 796 IMoniker_AddRef(iface); 797 797 798 798 return MK_S_US; 799 799 } … … 815 815 816 816 *ppmkRelPath=0; 817 817 818 818 return MK_E_NOTBINDABLE; 819 819 } … … 845 845 strcpyW(*ppszDisplayName,This->itemDelimiter); 846 846 strcatW(*ppszDisplayName,This->itemName); 847 847 848 848 return S_OK; 849 849 } … … 900 900 if (!pwdMksys) 901 901 return E_POINTER; 902 902 903 903 (*pwdMksys)=MKSYS_ITEMMONIKER; 904 904 … … 937 937 { 938 938 ICOM_THIS_From_IROTData(IMoniker, iface); 939 939 940 940 TRACE("(%p)\n",iface); 941 941 -
trunk/src/ole32/marshal.c
r8441 r8620 479 479 hres = IMarshal_MarshalInterface(pMarshal,pStm,riid,pUnk,dwDestContext,pvDestContext,mshlflags); 480 480 if (hres) { 481 FIXME("Failed to Marshal the interface, %lx?\n",hres); 481 if (IsEqualGUID(riid,&IID_IClassFactory)) { 482 MESSAGE("\nERROR: You need to merge the 'winedefault.reg' file into your\n"); 483 MESSAGE(" Wine registry by running: `regedit winedefault.reg'\n\n"); 484 } else { 485 FIXME("Failed to Marshal the interface, %lx?\n",hres); 486 } 482 487 goto release_marshal; 483 488 } … … 541 546 * CoMarshalInterThreadInterfaceInStream [OLE32.33] 542 547 * 543 * Marshal interfaces across threads. We don't have a thread distinction, 544 * meaning most interfaces just work across different threads, the RPC 548 * Marshal interfaces across threads. We don't have a thread distinction, 549 * meaning most interfaces just work across different threads, the RPC 545 550 * handles it. 546 551 */ … … 601 606 StdMarshalImpl *dm; 602 607 dm=(StdMarshalImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(StdMarshalImpl)); 603 if (!dm) 608 if (!dm) 604 609 return E_FAIL; 605 610 dm->lpvtbl = &stdmvtbl; -
trunk/src/ole32/memlockbytes.c
r8441 r8620 43 43 { 44 44 /* 45 * Needs to be the first item in the stuct 45 * Needs to be the first item in the stuct 46 46 * since we want to cast this in an ILockBytes pointer 47 47 */ … … 206 206 HGLOBALLockBytesImpl* newLockBytes; 207 207 newLockBytes = HeapAlloc(GetProcessHeap(), 0, sizeof(HGLOBALLockBytesImpl)); 208 208 209 209 if (newLockBytes!=0) 210 210 { … … 214 214 ICOM_VTBL(newLockBytes) = &HGLOBALLockBytesImpl_Vtbl; 215 215 newLockBytes->ref = 0; 216 216 217 217 /* 218 218 * Initialize the support. … … 312 312 HGLOBALLockBytesImpl_AddRef(iface); 313 313 314 return S_OK; ;314 return S_OK; 315 315 } 316 316 … … 416 416 * The function returns S_OK if the specified number of bytes were read 417 417 * or the end of the array was reached. 418 * It returns STG_E_READFAULT if the number of bytes to read does not equal 418 * It returns STG_E_READFAULT if the number of bytes to read does not equal 419 419 * the number of bytes actually read. 420 420 */ … … 521 521 if (libNewSize.s.HighPart != 0) 522 522 return STG_E_INVALIDFUNCTION; 523 523 524 524 if (This->byteArraySize.s.LowPart == libNewSize.s.LowPart) 525 525 return S_OK; … … 536 536 537 537 This->byteArraySize.s.LowPart = libNewSize.s.LowPart; 538 538 539 539 return S_OK; 540 540 } -
trunk/src/ole32/moniker.c
r8441 r8620 62 62 DWORD runObjTabLastIndx; /* first free index element in the table. */ 63 63 DWORD runObjTabRegister; /* registration key of the next registered object */ 64 64 65 65 } RunningObjectTableImpl; 66 66 … … 152 152 { 153 153 TRACE("()\n"); 154 154 155 155 if (runningObjectTableInstance==NULL) 156 156 return E_INVALIDARG; … … 185 185 if (( This->runObjTab[i].regTypeObj & ROTFLAGS_REGISTRATIONKEEPSALIVE) != 0) 186 186 IUnknown_Release(This->runObjTab[i].pObj); 187 187 188 188 IMoniker_Release(This->runObjTab[i].pmkObj); 189 189 } … … 245 245 if (runningObjectTableInstance==NULL) 246 246 return E_POINTER; 247 247 248 248 RunningObjectTableImpl_Release((IRunningObjectTable*)runningObjectTableInstance); 249 249 … … 286 286 This->runObjTab[This->runObjTabLastIndx].identRegObj = This->runObjTabRegister; 287 287 CoFileTimeNow(&(This->runObjTab[This->runObjTabLastIndx].lastModifObj)); 288 288 289 289 /* gives a registration identifier to the registered object*/ 290 290 (*pdwRegister)= This->runObjTabRegister; … … 297 297 This->runObjTabRegister++; 298 298 This->runObjTabLastIndx++; 299 299 300 300 if (This->runObjTabLastIndx == This->runObjTabSize){ /* table is full ! so it must be resized */ 301 301 … … 311 311 312 312 IMoniker_AddRef(pmkObjectName); 313 313 314 314 return res; 315 315 } … … 337 337 338 338 IMoniker_Release(This->runObjTab[index].pmkObj); 339 339 340 340 /* remove the object from the table */ 341 341 for(j=index; j<This->runObjTabLastIndx-1; j++) 342 342 This->runObjTab[j]= This->runObjTab[j+1]; 343 343 344 344 This->runObjTabLastIndx--; 345 345 … … 352 352 HRESULT WINAPI RunningObjectTableImpl_IsRunning( IRunningObjectTable* iface, 353 353 IMoniker *pmkObjectName) /* Pointer to the moniker of the object whose status is desired */ 354 { 354 { 355 355 ICOM_THIS(RunningObjectTableImpl,iface); 356 356 … … 374 374 if (ppunkObject==NULL) 375 375 return E_POINTER; 376 376 377 377 *ppunkObject=0; 378 378 … … 409 409 return S_OK; 410 410 } 411 411 412 412 /*********************************************************************** 413 413 * RunningObjectTable_GetTimeOfLastChange … … 427 427 /* verify if the object was registered before or not */ 428 428 if (RunningObjectTableImpl_GetObjectIndex(This,-1,pmkObjectName,&index)==S_FALSE) 429 return MK_E_UNAVAILABLE; ;429 return MK_E_UNAVAILABLE; 430 430 431 431 (*pfiletime)= This->runObjTab[index].lastModifObj; … … 463 463 /* search object identified by a register identifier */ 464 464 for(i=0;((i<This->runObjTabLastIndx)&&(This->runObjTab[i].identRegObj!=identReg));i++); 465 465 466 466 if (i==This->runObjTabLastIndx) return S_FALSE; 467 467 … … 511 511 512 512 ret = IRunnableObject_QueryInterface(This,&IID_IRunnableObject,(LPVOID*)&runable); 513 if (ret) 513 if (ret) 514 514 return 0; /* Appears to return no error. */ 515 515 ret = IRunnableObject_Run(runable,NULL); -
trunk/src/ole32/ole2stubs.c
r8441 r8620 50 50 } 51 51 52 52 53 53 /*********************************************************************** 54 54 * WriteFmtUserTypeStg (OLE32.160) … … 95 95 HRESULT hres, hres1; 96 96 IUnknown * pUnk = NULL; 97 97 98 98 FIXME("\n\t%s\n\t%s stub!\n", debugstr_guid(rclsid), debugstr_guid(riid)); 99 99 … … 212 212 */ 213 213 HRESULT WINAPI OleRegEnumFormatEtc ( 214 REFCLSID clsid, 214 REFCLSID clsid, 215 215 DWORD dwDirection, 216 216 LPENUMFORMATETC* ppenumFormatetc) -
trunk/src/ole32/oleobj.c
r8441 r8620 87 87 0, 88 88 sizeof(OleAdviseHolderImpl)); 89 89 90 90 ICOM_VTBL(lpoah) = &oahvt; 91 91 lpoah->ref = 1; … … 119 119 } 120 120 } 121 121 122 122 HeapFree(GetProcessHeap(), 123 123 0, 124 124 ptrToDestroy->arrayOfSinks); 125 125 126 126 127 127 HeapFree(GetProcessHeap(), … … 135 135 static HRESULT WINAPI OleAdviseHolderImpl_QueryInterface( 136 136 LPOLEADVISEHOLDER iface, 137 REFIID riid, 137 REFIID riid, 138 138 LPVOID* ppvObj) 139 139 { 140 ICOM_THIS(OleAdviseHolderImpl, iface); 140 ICOM_THIS(OleAdviseHolderImpl, iface); 141 141 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObj); 142 142 /* … … 148 148 *ppvObj = NULL; 149 149 150 if (IsEqualIID(riid, &IID_IUnknown)) 150 if (IsEqualIID(riid, &IID_IUnknown)) 151 151 { 152 152 /* IUnknown */ 153 *ppvObj = This; 154 } 155 else if(IsEqualIID(riid, &IID_IOleAdviseHolder)) 153 *ppvObj = This; 154 } 155 else if(IsEqualIID(riid, &IID_IOleAdviseHolder)) 156 156 { 157 157 /* IOleAdviseHolder */ … … 161 161 if(*ppvObj == NULL) 162 162 return E_NOINTERFACE; 163 163 164 164 /* 165 165 * A successful QI always increments the reference count. … … 176 176 LPOLEADVISEHOLDER iface) 177 177 { 178 ICOM_THIS(OleAdviseHolderImpl, iface); 179 TRACE("(%p)->(ref=%ld)\n", This, This->ref); 178 ICOM_THIS(OleAdviseHolderImpl, iface); 179 TRACE("(%p)->(ref=%ld)\n", This, This->ref); 180 180 return ++(This->ref); 181 181 } … … 187 187 LPOLEADVISEHOLDER iface) 188 188 { 189 ICOM_THIS(OleAdviseHolderImpl, iface); 190 TRACE("(%p)->(ref=%ld)\n", This, This->ref); 189 ICOM_THIS(OleAdviseHolderImpl, iface); 190 TRACE("(%p)->(ref=%ld)\n", This, This->ref); 191 191 This->ref--; 192 192 … … 210 210 { 211 211 DWORD index; 212 213 ICOM_THIS(OleAdviseHolderImpl, iface); 212 213 ICOM_THIS(OleAdviseHolderImpl, iface); 214 214 215 215 TRACE("(%p)->(%p, %p)\n", This, pAdvise, pdwConnection); … … 220 220 if (pdwConnection==NULL) 221 221 return E_POINTER; 222 222 223 223 *pdwConnection = 0; 224 224 … … 241 241 This->maxSinks+=INITIAL_SINKS; 242 242 243 This->arrayOfSinks = HeapReAlloc(GetProcessHeap(), 243 This->arrayOfSinks = HeapReAlloc(GetProcessHeap(), 244 244 0, 245 245 This->arrayOfSinks, … … 247 247 248 248 for (i=index;i < This->maxSinks; i++) 249 This->arrayOfSinks[i]=0; 249 This->arrayOfSinks[i]=0; 250 250 } 251 251 … … 272 272 */ 273 273 static HRESULT WINAPI OleAdviseHolderImpl_Unadvise( 274 LPOLEADVISEHOLDER iface, 274 LPOLEADVISEHOLDER iface, 275 275 DWORD dwConnection) 276 276 { 277 ICOM_THIS(OleAdviseHolderImpl, iface); 277 ICOM_THIS(OleAdviseHolderImpl, iface); 278 278 279 279 TRACE("(%p)->(%lu)\n", This, dwConnection); 280 280 281 281 /* 282 * So we don't return 0 as a cookie, the index was 282 * So we don't return 0 as a cookie, the index was 283 283 * incremented by 1 in OleAdviseHolderImpl_Advise 284 284 * we have to compensate. 285 285 */ 286 286 dwConnection--; 287 287 288 288 /* 289 289 * Check for invalid cookies. 290 290 */ 291 if ( (dwConnection < 0) || 291 if ( (dwConnection < 0) || 292 292 (dwConnection >= This->maxSinks) ) 293 293 return OLE_E_NOCONNECTION; … … 311 311 OleAdviseHolderImpl_EnumAdvise (LPOLEADVISEHOLDER iface, IEnumSTATDATA **ppenumAdvise) 312 312 { 313 ICOM_THIS(OleAdviseHolderImpl, iface); 313 ICOM_THIS(OleAdviseHolderImpl, iface); 314 314 FIXME("(%p)->(%p)\n", This, ppenumAdvise); 315 315 … … 325 325 OleAdviseHolderImpl_SendOnRename (LPOLEADVISEHOLDER iface, IMoniker *pmk) 326 326 { 327 ICOM_THIS(OleAdviseHolderImpl, iface); 327 ICOM_THIS(OleAdviseHolderImpl, iface); 328 328 FIXME("(%p)->(%p)\n", This, pmk); 329 329 … … 338 338 OleAdviseHolderImpl_SendOnSave (LPOLEADVISEHOLDER iface) 339 339 { 340 ICOM_THIS(OleAdviseHolderImpl, iface); 340 ICOM_THIS(OleAdviseHolderImpl, iface); 341 341 FIXME("(%p)\n", This); 342 342 … … 350 350 OleAdviseHolderImpl_SendOnClose (LPOLEADVISEHOLDER iface) 351 351 { 352 ICOM_THIS(OleAdviseHolderImpl, iface); 352 ICOM_THIS(OleAdviseHolderImpl, iface); 353 353 FIXME("(%p)\n", This); 354 354 … … 364 364 FORMATETC fmat; 365 365 DWORD advf; 366 } DataAdviseConnection; 366 } DataAdviseConnection; 367 367 368 368 typedef struct DataAdviseHolder … … 384 384 REFIID riid, 385 385 void** ppvObject); 386 static ULONG WINAPI DataAdviseHolder_AddRef( 386 static ULONG WINAPI DataAdviseHolder_AddRef( 387 387 IDataAdviseHolder* iface); 388 static ULONG WINAPI DataAdviseHolder_Release( 388 static ULONG WINAPI DataAdviseHolder_Release( 389 389 IDataAdviseHolder* iface); 390 static HRESULT WINAPI DataAdviseHolder_Advise( 390 static HRESULT WINAPI DataAdviseHolder_Advise( 391 391 IDataAdviseHolder* iface, 392 IDataObject* pDataObject, 393 FORMATETC* pFetc, 394 DWORD advf, 395 IAdviseSink* pAdvise, 392 IDataObject* pDataObject, 393 FORMATETC* pFetc, 394 DWORD advf, 395 IAdviseSink* pAdvise, 396 396 DWORD* pdwConnection); 397 static HRESULT WINAPI DataAdviseHolder_Unadvise( 397 static HRESULT WINAPI DataAdviseHolder_Unadvise( 398 398 IDataAdviseHolder* iface, 399 399 DWORD dwConnection); 400 static HRESULT WINAPI DataAdviseHolder_EnumAdvise( 401 IDataAdviseHolder* iface, 400 static HRESULT WINAPI DataAdviseHolder_EnumAdvise( 401 IDataAdviseHolder* iface, 402 402 IEnumSTATDATA** ppenumAdvise); 403 static HRESULT WINAPI DataAdviseHolder_SendOnDataChange( 404 IDataAdviseHolder* iface, 405 IDataObject* pDataObject, 406 DWORD dwReserved, 403 static HRESULT WINAPI DataAdviseHolder_SendOnDataChange( 404 IDataAdviseHolder* iface, 405 IDataObject* pDataObject, 406 DWORD dwReserved, 407 407 DWORD advf); 408 408 … … 432 432 0, 433 433 sizeof(DataAdviseHolder)); 434 434 435 435 ICOM_VTBL(newHolder) = &DataAdviseHolderImpl_VTable; 436 436 newHolder->ref = 1; … … 438 438 newHolder->Connections = HeapAlloc(GetProcessHeap(), 439 439 HEAP_ZERO_MEMORY, 440 newHolder->maxCons * 440 newHolder->maxCons * 441 441 sizeof(DataAdviseConnection)); 442 442 … … 461 461 } 462 462 } 463 463 464 464 HeapFree(GetProcessHeap(), 0, ptrToDestroy->Connections); 465 465 HeapFree(GetProcessHeap(), 0, ptrToDestroy); … … 476 476 void** ppvObject) 477 477 { 478 ICOM_THIS(DataAdviseHolder, iface); 478 ICOM_THIS(DataAdviseHolder, iface); 479 479 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject); 480 480 /* … … 483 483 if ( (This==0) || (ppvObject==0) ) 484 484 return E_INVALIDARG; 485 485 486 486 /* 487 487 * Initialize the return parameter. … … 497 497 *ppvObject = iface; 498 498 } 499 499 500 500 /* 501 501 * Check that we obtained an interface. … … 505 505 return E_NOINTERFACE; 506 506 } 507 507 508 508 /* 509 509 * Query Interface always increases the reference count by one when it is 510 * successful. 510 * successful. 511 511 */ 512 512 IUnknown_AddRef((IUnknown*)*ppvObject); 513 513 514 return S_OK; ;514 return S_OK; 515 515 } 516 516 … … 520 520 * See Windows documentation for more details on IUnknown methods. 521 521 */ 522 static ULONG WINAPI DataAdviseHolder_AddRef( 522 static ULONG WINAPI DataAdviseHolder_AddRef( 523 523 IDataAdviseHolder* iface) 524 524 { 525 ICOM_THIS(DataAdviseHolder, iface); 525 ICOM_THIS(DataAdviseHolder, iface); 526 526 TRACE("(%p) (ref=%ld)\n", This, This->ref); 527 527 This->ref++; … … 535 535 * See Windows documentation for more details on IUnknown methods. 536 536 */ 537 static ULONG WINAPI DataAdviseHolder_Release( 537 static ULONG WINAPI DataAdviseHolder_Release( 538 538 IDataAdviseHolder* iface) 539 539 { … … 555 555 return 0; 556 556 } 557 557 558 558 return This->ref; 559 559 } … … 565 565 static HRESULT WINAPI DataAdviseHolder_Advise( 566 566 IDataAdviseHolder* iface, 567 IDataObject* pDataObject, 568 FORMATETC* pFetc, 569 DWORD advf, 570 IAdviseSink* pAdvise, 567 IDataObject* pDataObject, 568 FORMATETC* pFetc, 569 DWORD advf, 570 IAdviseSink* pAdvise, 571 571 DWORD* pdwConnection) 572 572 { 573 573 DWORD index; 574 575 ICOM_THIS(DataAdviseHolder, iface); 574 575 ICOM_THIS(DataAdviseHolder, iface); 576 576 577 577 TRACE("(%p)->(%p, %p, %08lx, %p, %p)\n", This, pDataObject, pFetc, advf, … … 582 582 if (pdwConnection==NULL) 583 583 return E_POINTER; 584 584 585 585 *pdwConnection = 0; 586 586 … … 630 630 * DataAdviseHolder_Unadvise 631 631 */ 632 static HRESULT WINAPI DataAdviseHolder_Unadvise( 632 static HRESULT WINAPI DataAdviseHolder_Unadvise( 633 633 IDataAdviseHolder* iface, 634 634 DWORD dwConnection) 635 635 { 636 ICOM_THIS(DataAdviseHolder, iface); 636 ICOM_THIS(DataAdviseHolder, iface); 637 637 638 638 TRACE("(%p)->(%lu)\n", This, dwConnection); 639 639 640 640 /* 641 * So we don't return 0 as a cookie, the index was 641 * So we don't return 0 as a cookie, the index was 642 642 * incremented by 1 in OleAdviseHolderImpl_Advise 643 643 * we have to compensate. 644 644 */ 645 645 dwConnection--; 646 646 647 647 /* 648 648 * Check for invalid cookies. 649 649 */ 650 if ( (dwConnection < 0) || 650 if ( (dwConnection < 0) || 651 651 (dwConnection >= This->maxCons) ) 652 652 return OLE_E_NOCONNECTION; … … 663 663 } 664 664 665 static HRESULT WINAPI DataAdviseHolder_EnumAdvise( 666 IDataAdviseHolder* iface, 665 static HRESULT WINAPI DataAdviseHolder_EnumAdvise( 666 IDataAdviseHolder* iface, 667 667 IEnumSTATDATA** ppenumAdvise) 668 668 { 669 ICOM_THIS(DataAdviseHolder, iface); 669 ICOM_THIS(DataAdviseHolder, iface); 670 670 671 671 FIXME("(%p)->(%p)\n", This, ppenumAdvise); … … 676 676 * DataAdviseHolder_SendOnDataChange 677 677 */ 678 static HRESULT WINAPI DataAdviseHolder_SendOnDataChange( 679 IDataAdviseHolder* iface, 680 IDataObject* pDataObject, 681 DWORD dwReserved, 678 static HRESULT WINAPI DataAdviseHolder_SendOnDataChange( 679 IDataAdviseHolder* iface, 680 IDataObject* pDataObject, 681 DWORD dwReserved, 682 682 DWORD advf) 683 683 { 684 ICOM_THIS(DataAdviseHolder, iface); 684 ICOM_THIS(DataAdviseHolder, iface); 685 685 DWORD index; 686 686 STGMEDIUM stg; -
trunk/src/ole32/oleproxy.c
r8441 r8620 250 250 } 251 251 252 /* Since we create proxy buffers and classfactory in a pair, there is 253 * no need for 2 seperate structs. Just put them in one, but remember 252 /* Since we create proxy buffers and classfactory in a pair, there is 253 * no need for 2 seperate structs. Just put them in one, but remember 254 254 * the refcount. 255 255 */ … … 348 348 TRACE("(%p,%s,%p)\n",pUnkOuter,debugstr_guid(riid),ppv); 349 349 350 /* Send CreateInstance to the remote classfactory. 350 /* Send CreateInstance to the remote classfactory. 351 351 * 352 352 * Data: Only the 'IID'. … … 437 437 PSFacBuf_QueryInterface(LPPSFACTORYBUFFER iface, REFIID iid, LPVOID *ppv) { 438 438 if (IsEqualIID(iid,&IID_IPSFactoryBuffer)||IsEqualIID(iid,&IID_IUnknown)) { 439 *ppv = (LPVOID)iface; 439 *ppv = (LPVOID)iface; 440 440 /* No ref counting, static class */ 441 441 return S_OK; … … 453 453 IRpcProxyBuffer **ppProxy, LPVOID *ppv 454 454 ) { 455 if (IsEqualIID(&IID_IClassFactory,riid)) 455 if (IsEqualIID(&IID_IClassFactory,riid) || 456 IsEqualIID(&IID_IUnknown,riid) 457 ) 456 458 return CFProxy_Construct(ppv,(LPVOID*)ppProxy); 457 459 FIXME("proxying not implemented for (%s) yet!\n",debugstr_guid(riid)); … … 468 470 TRACE("(%s,%p,%p)\n",debugstr_guid(riid),pUnkServer,ppStub); 469 471 470 if (IsEqualIID(&IID_IClassFactory,riid)) { 472 if (IsEqualIID(&IID_IClassFactory,riid) || 473 IsEqualIID(&IID_IUnknown,riid) 474 ) { 471 475 hres = CFStub_Construct(ppStub); 472 476 if (!hres) … … 498 502 if (IsEqualIID(rclsid,&CLSID_PSFactoryBuffer)) { 499 503 *ppv = &lppsfac; 500 /* If we create a ps factory, we might need a stub manager later 504 /* If we create a ps factory, we might need a stub manager later 501 505 * anyway 502 506 */ … … 504 508 return S_OK; 505 509 } 506 if (IsEqualIID(rclsid,&CLSID_DfMarshal)&&IsEqualIID(iid,&IID_IClassFactory)) 510 if (IsEqualIID(rclsid,&CLSID_DfMarshal)&&( 511 IsEqualIID(iid,&IID_IClassFactory) || 512 IsEqualIID(iid,&IID_IUnknown) 513 ) 514 ) 507 515 return MARSHAL_GetStandardMarshalCF(ppv); 508 516 FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid)); -
trunk/src/ole32/rpc.c
r8441 r8620 95 95 } 96 96 if (res!=size) { 97 FIXME("Read only %ld of %ld bytes .\n",res,size);97 FIXME("Read only %ld of %ld bytes from %x.\n",res,size,hf); 98 98 return E_FAIL; 99 99 } … … 131 131 } 132 132 if (res!=size) { 133 FIXME("Wrote only %ld of %ld bytes .\n",res,size);133 FIXME("Wrote only %ld of %ld bytes to %x.\n",res,size,hf); 134 134 return E_FAIL; 135 135 } … … 143 143 int i; 144 144 char pipefn[100]; 145 wine_pipe *new_pipes; 145 146 146 147 for (i=0;i<nrofpipes;i++) … … 148 149 return S_OK; 149 150 if (pipes) 150 pipes=(wine_pipe*)HeapReAlloc(GetProcessHeap(),0,pipes,sizeof(pipes[0])*(nrofpipes+1));151 new_pipes=(wine_pipe*)HeapReAlloc(GetProcessHeap(),0,pipes,sizeof(pipes[0])*(nrofpipes+1)); 151 152 else 152 pipes=(wine_pipe*)HeapAlloc(GetProcessHeap(),0,sizeof(pipes[0])); 153 if (!pipes) return E_OUTOFMEMORY; 153 new_pipes=(wine_pipe*)HeapAlloc(GetProcessHeap(),0,sizeof(pipes[0])); 154 if (!new_pipes) return E_OUTOFMEMORY; 155 pipes = new_pipes; 154 156 sprintf(pipefn,OLESTUBMGR"_%08lx",mid->processid); 155 157 memcpy(&(pipes[nrofpipes].mid),mid,sizeof(*mid)); … … 158 160 nrofpipes++; 159 161 if (startreader) { 160 #ifdef __WIN32OS2__161 162 pipes[nrofpipes-1].hThread = CreateThread(NULL,0,_StubReaderThread,(LPVOID)(pipes+(nrofpipes-1)),0,&(pipes[nrofpipes-1].tid)); 162 #else163 pipes[nrofpipes-1].hThread = CreateThread(NULL,0,_StubReaderThread,(LPVOID)pipes+(nrofpipes-1),0,&(pipes[nrofpipes-1].tid));164 #endif165 163 } else { 166 164 pipes[nrofpipes-1].tid = GetCurrentThreadId(); … … 192 190 } 193 191 194 static HRESULT 192 static HRESULT 195 193 RPC_GetRequest(wine_rpc_request **req) { 196 194 static int reqid = 0xdeadbeef; … … 484 482 485 483 if (hres != ERROR_SUCCESS) 486 return REGDB_E_ CLASSNOTREG;484 return REGDB_E_READREGDB; /* Probably */ 487 485 488 486 memset(dllName,0,sizeof(dllName)); 489 487 hres= RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)dllName,&dllNameLen); 488 RegCloseKey(key); 490 489 if (hres) 491 490 return REGDB_E_CLASSNOTREG; /* FIXME: check retval */ 492 RegCloseKey(key);493 491 memset(&sinfo,0,sizeof(sinfo)); 494 492 sinfo.cb = sizeof(sinfo); … … 543 541 break; 544 542 } 545 if (tries>=MAXTRIES) 543 if (tries>=MAXTRIES) 546 544 return E_NOINTERFACE; 547 545 hres = CreateStreamOnHGlobal(0,TRUE,&pStm); -
trunk/src/ole32/stg_bigblockfile.c
r8441 r8620 3 3 * BigBlockFile 4 4 * 5 * This is the implementation of a file that consists of blocks of 5 * This is the implementation of a file that consists of blocks of 6 6 * a predetermined size. 7 * This class is used in the Compound File implementation of the 8 * IStorage and IStream interfaces. It provides the functionality 9 * to read and write any blocks in the file as well as setting and 7 * This class is used in the Compound File implementation of the 8 * IStorage and IStream interfaces. It provides the functionality 9 * to read and write any blocks in the file as well as setting and 10 10 * obtaining the size of the file. 11 11 * The blocks are indexed sequentially from the start of the file 12 12 * starting with -1. 13 * 13 * 14 14 * TODO: 15 15 * - Support for a transacted mode … … 73 73 /*** 74 74 * This structure identifies the paged that are mapped 75 * from the file and their position in memory. It is 75 * from the file and their position in memory. It is 76 76 * also used to hold a reference count to those pages. 77 77 * … … 106 106 ULONG index, 107 107 DWORD desired_access); 108 static MappedPage* BIGBLOCKFILE_GetPageFromPointer(LPBIGBLOCKFILE This, 108 static MappedPage* BIGBLOCKFILE_GetPageFromPointer(LPBIGBLOCKFILE This, 109 109 void* pBlock); 110 110 static MappedPage* BIGBLOCKFILE_CreatePage(LPBIGBLOCKFILE This, … … 154 154 * BIGBLOCKFILE_Construct 155 155 * 156 * Construct a big block file. Create the file mapping object. 156 * Construct a big block file. Create the file mapping object. 157 157 * Create the read only mapped pages list, the writable mapped page list 158 158 * and the blocks in use list. … … 327 327 /* 328 328 * validate the block index 329 * 329 * 330 330 */ 331 331 if (This->blocksize * (index + 1) … … 397 397 * 398 398 * Sets the size of the file. 399 * 399 * 400 400 */ 401 401 void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize) … … 409 409 */ 410 410 BIGBLOCKFILE_UnmapAllMappedPages(This); 411 411 412 412 if (This->fileBased) 413 413 { … … 427 427 * 428 428 * The problem is that the SetFilePointer-SetEndOfFile combo below 429 * doesn't always succeed. The file is not grown. It seems like the 429 * doesn't always succeed. The file is not grown. It seems like the 430 430 * operation is cached. By doing the WriteFile, the file is actually 431 431 * grown on disk. … … 436 436 WriteFile(This->hfile, buf, 10, NULL, NULL); 437 437 /* 438 * END HACK 438 * END HACK 439 439 */ 440 440 … … 444 444 SetFilePointer(This->hfile, newSize.s.LowPart, NULL, FILE_BEGIN); 445 445 SetEndOfFile(This->hfile); 446 446 447 447 /* 448 448 * re-create the file mapping object … … 451 451 NULL, 452 452 This->flProtect, 453 0, 0, 453 0, 0, 454 454 NULL); 455 455 } … … 480 480 * 481 481 * Returns the size of the file. 482 * 482 * 483 483 */ 484 484 ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This) … … 523 523 */ 524 524 static void* BIGBLOCKFILE_GetBigBlockPointer( 525 LPBIGBLOCKFILE This, 526 ULONG block_index, 525 LPBIGBLOCKFILE This, 526 ULONG block_index, 527 527 DWORD desired_access) 528 528 { -
trunk/src/ole32/stg_stream.c
r8441 r8620 79 79 80 80 newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(StgStreamImpl)); 81 81 82 82 if (newStream!=0) 83 83 { … … 87 87 ICOM_VTBL(newStream) = &StgStreamImpl_Vtbl; 88 88 newStream->ref = 0; 89 89 90 90 /* 91 91 * We want to nail-down the reference to the storage in case the … … 95 95 IStorage_AddRef((IStorage*)newStream->parentStorage); 96 96 97 newStream->grfMode = grfMode; 97 newStream->grfMode = grfMode; 98 98 newStream->ownerProperty = ownerProperty; 99 99 100 100 /* 101 101 * Start the stream at the beginning. … … 103 103 newStream->currentPosition.s.HighPart = 0; 104 104 newStream->currentPosition.s.LowPart = 0; 105 105 106 106 /* 107 107 * Initialize the rest of the data. … … 111 111 newStream->bigBlockChain = 0; 112 112 newStream->smallBlockChain = 0; 113 113 114 114 /* 115 115 * Read the size from the property and determine if the blocks forming … … 118 118 StgStreamImpl_OpenBlockChain(newStream); 119 119 } 120 120 121 121 return newStream; 122 122 } … … 125 125 * This is the destructor of the StgStreamImpl class. 126 126 * 127 * This method will clean-up all the resources used-up by the given StgStreamImpl 127 * This method will clean-up all the resources used-up by the given StgStreamImpl 128 128 * class. The pointer passed-in to this function will be freed and will not 129 129 * be valid anymore. … … 157 157 * Finally, free the memory used-up by the class. 158 158 */ 159 HeapFree(GetProcessHeap(), 0, This); 159 HeapFree(GetProcessHeap(), 0, This); 160 160 } 161 161 … … 166 166 HRESULT WINAPI StgStreamImpl_QueryInterface( 167 167 IStream* iface, 168 REFIID riid, /* [in] */ 169 void** ppvObject) /* [iid_is][out] */ 168 REFIID riid, /* [in] */ 169 void** ppvObject) /* [iid_is][out] */ 170 170 { 171 171 StgStreamImpl* const This=(StgStreamImpl*)iface; … … 176 176 if (ppvObject==0) 177 177 return E_INVALIDARG; 178 178 179 179 /* 180 180 * Initialize the return parameter. 181 181 */ 182 182 *ppvObject = 0; 183 183 184 184 /* 185 185 * Compare the riid with the interface IDs implemented by this object. 186 186 */ 187 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 187 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 188 188 { 189 189 *ppvObject = (IStream*)This; 190 190 } 191 else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0) 191 else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0) 192 192 { 193 193 *ppvObject = (IStream*)This; 194 194 } 195 195 196 196 /* 197 197 * Check that we obtained an interface. … … 199 199 if ((*ppvObject)==0) 200 200 return E_NOINTERFACE; 201 201 202 202 /* 203 203 * Query Interface always increases the reference count by one when it is … … 205 205 */ 206 206 StgStreamImpl_AddRef(iface); 207 208 return S_OK; ;207 208 return S_OK; 209 209 } 210 210 … … 219 219 220 220 This->ref++; 221 221 222 222 return This->ref; 223 223 } … … 233 233 234 234 ULONG newRef; 235 235 236 236 This->ref--; 237 237 238 238 newRef = This->ref; 239 239 240 240 /* 241 241 * If the reference count goes down to 0, perform suicide. … … 245 245 StgStreamImpl_Destroy(This); 246 246 } 247 247 248 248 return newRef; 249 249 } … … 281 281 This->ownerProperty, 282 282 &curProperty); 283 283 284 284 if (readSucessful) 285 285 { 286 286 This->streamSize = curProperty.size; 287 287 288 288 /* 289 289 * This code supports only streams that are <32 bits in size. 290 290 */ 291 291 assert(This->streamSize.s.HighPart == 0); 292 292 293 293 if(curProperty.startingBlock == BLOCK_END_OF_CHAIN) 294 294 { … … 301 301 { 302 302 This->smallBlockChain = SmallBlockChainStream_Construct( 303 This->parentStorage->ancestorStorage, 303 This->parentStorage->ancestorStorage, 304 304 This->ownerProperty); 305 305 } … … 324 324 * See the documentation of ISequentialStream for more info. 325 325 */ 326 HRESULT WINAPI StgStreamImpl_Read( 326 HRESULT WINAPI StgStreamImpl_Read( 327 327 IStream* iface, 328 328 void* pv, /* [length_is][size_is][out] */ 329 ULONG cb, /* [in] */ 330 ULONG* pcbRead) /* [out] */ 329 ULONG cb, /* [in] */ 330 ULONG* pcbRead) /* [out] */ 331 331 { 332 332 StgStreamImpl* const This=(StgStreamImpl*)iface; … … 339 339 iface, pv, cb, pcbRead); 340 340 341 /* 341 /* 342 342 * If the caller is not interested in the number of bytes read, 343 343 * we use another buffer to avoid "if" statements in the code. … … 345 345 if (pcbRead==0) 346 346 pcbRead = &bytesReadBuffer; 347 347 348 348 /* 349 349 * Using the known size of the stream, calculate the number of bytes … … 351 351 */ 352 352 bytesToReadFromBuffer = min( This->streamSize.s.LowPart - This->currentPosition.s.LowPart, cb); 353 353 354 354 /* 355 355 * Depending on the type of chain that was opened when the stream was constructed, … … 363 363 pv, 364 364 pcbRead); 365 365 366 366 } 367 367 else if (This->bigBlockChain!=0) … … 395 395 */ 396 396 This->currentPosition.s.LowPart += *pcbRead; 397 397 398 398 if(*pcbRead != cb) 399 399 { … … 409 409 else 410 410 res = S_OK; 411 411 412 412 end: 413 413 TRACE("<-- %08lx\n", res); 414 414 return res; 415 415 } 416 416 417 417 /*** 418 418 * This method is part of the ISequentialStream interface. … … 427 427 HRESULT WINAPI StgStreamImpl_Write( 428 428 IStream* iface, 429 const void* pv, /* [size_is][in] */ 430 ULONG cb, /* [in] */ 431 ULONG* pcbWritten) /* [out] */ 429 const void* pv, /* [size_is][in] */ 430 ULONG cb, /* [in] */ 431 ULONG* pcbWritten) /* [out] */ 432 432 { 433 433 StgStreamImpl* const This=(StgStreamImpl*)iface; … … 438 438 TRACE("(%p, %p, %ld, %p)\n", 439 439 iface, pv, cb, pcbWritten); 440 440 441 441 /* 442 442 * Do we have permission to write to this stream? … … 452 452 if (pcbWritten == 0) 453 453 pcbWritten = &bytesWritten; 454 454 455 455 /* 456 456 * Initialize the out parameter … … 467 467 newSize.s.LowPart = This->currentPosition.s.LowPart + cb; 468 468 } 469 469 470 470 /* 471 471 * Verify if we need to grow the stream … … 476 476 IStream_SetSize(iface, newSize); 477 477 } 478 478 479 479 /* 480 480 * Depending on the type of chain that was opened when the stream was constructed, … … 488 488 pv, 489 489 pcbWritten); 490 490 491 491 } 492 492 else if (This->bigBlockChain!=0) … … 500 500 else 501 501 assert(FALSE); 502 502 503 503 /* 504 504 * Advance the position pointer for the number of positions written. 505 505 */ 506 506 This->currentPosition.s.LowPart += *pcbWritten; 507 507 508 508 return S_OK; 509 509 } … … 516 516 * 517 517 * See the documentation of IStream for more info. 518 */ 519 HRESULT WINAPI StgStreamImpl_Seek( 518 */ 519 HRESULT WINAPI StgStreamImpl_Seek( 520 520 IStream* iface, 521 LARGE_INTEGER dlibMove, /* [in] */ 522 DWORD dwOrigin, /* [in] */ 521 LARGE_INTEGER dlibMove, /* [in] */ 522 DWORD dwOrigin, /* [in] */ 523 523 ULARGE_INTEGER* plibNewPosition) /* [out] */ 524 524 { … … 530 530 iface, dlibMove.s.LowPart, dwOrigin, plibNewPosition); 531 531 532 /* 532 /* 533 533 * The caller is allowed to pass in NULL as the new position return value. 534 534 * If it happens, we assign it to a dynamic variable to avoid special cases … … 570 570 */ 571 571 This->currentPosition = *plibNewPosition; 572 572 573 573 return S_OK; 574 574 } … … 583 583 * See the documentation of IStream for more info. 584 584 */ 585 HRESULT WINAPI StgStreamImpl_SetSize( 585 HRESULT WINAPI StgStreamImpl_SetSize( 586 586 IStream* iface, 587 ULARGE_INTEGER libNewSize) /* [in] */ 587 ULARGE_INTEGER libNewSize) /* [in] */ 588 588 { 589 589 StgStreamImpl* const This=(StgStreamImpl*)iface; … … 634 634 Success = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage, 635 635 This->ownerProperty, 636 &curProperty); 636 &curProperty); 637 637 /* 638 638 * Determine if we have to switch from small to big blocks or vice versa 639 */ 640 if ( (This->smallBlockChain!=0) && 639 */ 640 if ( (This->smallBlockChain!=0) && 641 641 (curProperty.size.s.LowPart < LIMIT_TO_USE_SMALL_BLOCK) ) 642 642 { … … 670 670 curProperty.size.s.HighPart = libNewSize.s.HighPart; 671 671 curProperty.size.s.LowPart = libNewSize.s.LowPart; 672 672 673 673 if (Success) 674 674 { … … 677 677 &curProperty); 678 678 } 679 679 680 680 This->streamSize = libNewSize; 681 681 682 682 return S_OK; 683 683 } 684 684 685 685 /*** 686 686 * This method is part of the IStream interface. … … 690 690 * See the documentation of IStream for more info. 691 691 */ 692 HRESULT WINAPI StgStreamImpl_CopyTo( 692 HRESULT WINAPI StgStreamImpl_CopyTo( 693 693 IStream* iface, 694 IStream* pstm, /* [unique][in] */ 695 ULARGE_INTEGER cb, /* [in] */ 696 ULARGE_INTEGER* pcbRead, /* [out] */ 697 ULARGE_INTEGER* pcbWritten) /* [out] */ 694 IStream* pstm, /* [unique][in] */ 695 ULARGE_INTEGER cb, /* [in] */ 696 ULARGE_INTEGER* pcbRead, /* [out] */ 697 ULARGE_INTEGER* pcbWritten) /* [out] */ 698 698 { 699 699 HRESULT hr = S_OK; … … 703 703 ULARGE_INTEGER totalBytesWritten; 704 704 705 TRACE("(%p, %p, %ld, %p, %p)\n", 705 TRACE("(%p, %p, %ld, %p, %p)\n", 706 706 iface, pstm, cb.s.LowPart, pcbRead, pcbWritten); 707 707 … … 726 726 else 727 727 copySize = cb.s.LowPart; 728 728 729 729 IStream_Read(iface, tmpBuffer, copySize, &bytesRead); 730 730 731 731 totalBytesRead.s.LowPart += bytesRead; 732 732 733 733 IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten); 734 734 … … 743 743 break; 744 744 } 745 745 746 746 if (bytesRead!=copySize) 747 747 cb.s.LowPart = 0; … … 774 774 * 775 775 * See the documentation of IStream for more info. 776 */ 777 HRESULT WINAPI StgStreamImpl_Commit( 776 */ 777 HRESULT WINAPI StgStreamImpl_Commit( 778 778 IStream* iface, 779 DWORD grfCommitFlags) /* [in] */ 779 DWORD grfCommitFlags) /* [in] */ 780 780 { 781 781 return S_OK; … … 789 789 * 790 790 * See the documentation of IStream for more info. 791 */ 792 HRESULT WINAPI StgStreamImpl_Revert( 791 */ 792 HRESULT WINAPI StgStreamImpl_Revert( 793 793 IStream* iface) 794 794 { … … 796 796 } 797 797 798 HRESULT WINAPI StgStreamImpl_LockRegion( 798 HRESULT WINAPI StgStreamImpl_LockRegion( 799 799 IStream* iface, 800 ULARGE_INTEGER libOffset, /* [in] */ 801 ULARGE_INTEGER cb, /* [in] */ 802 DWORD dwLockType) /* [in] */ 800 ULARGE_INTEGER libOffset, /* [in] */ 801 ULARGE_INTEGER cb, /* [in] */ 802 DWORD dwLockType) /* [in] */ 803 803 { 804 804 FIXME("not implemented!\n"); … … 806 806 } 807 807 808 HRESULT WINAPI StgStreamImpl_UnlockRegion( 808 HRESULT WINAPI StgStreamImpl_UnlockRegion( 809 809 IStream* iface, 810 ULARGE_INTEGER libOffset, /* [in] */ 811 ULARGE_INTEGER cb, /* [in] */ 812 DWORD dwLockType) /* [in] */ 810 ULARGE_INTEGER libOffset, /* [in] */ 811 ULARGE_INTEGER cb, /* [in] */ 812 DWORD dwLockType) /* [in] */ 813 813 { 814 814 FIXME("not implemented!\n"); … … 823 823 * 824 824 * See the documentation of IStream for more info. 825 */ 826 HRESULT WINAPI StgStreamImpl_Stat( 825 */ 826 HRESULT WINAPI StgStreamImpl_Stat( 827 827 IStream* iface, 828 828 STATSTG* pstatstg, /* [out] */ 829 DWORD grfStatFlag) /* [in] */ 829 DWORD grfStatFlag) /* [in] */ 830 830 { 831 831 StgStreamImpl* const This=(StgStreamImpl*)iface; … … 833 833 StgProperty curProperty; 834 834 BOOL readSucessful; 835 835 836 836 /* 837 837 * Read the information from the property. … … 840 840 This->ownerProperty, 841 841 &curProperty); 842 842 843 843 if (readSucessful) 844 844 { 845 StorageUtl_CopyPropertyToSTATSTG(pstatstg, 846 &curProperty, 845 StorageUtl_CopyPropertyToSTATSTG(pstatstg, 846 &curProperty, 847 847 grfStatFlag); 848 848 849 849 pstatstg->grfMode = This->grfMode; 850 850 851 851 return S_OK; 852 852 } 853 853 854 854 return E_FAIL; 855 855 } 856 856 857 857 /*** 858 858 * This method is part of the IStream interface. … … 866 866 * should be basically as simple as creating a new stream with the same 867 867 * parent etc and positioning its seek cursor. 868 */ 869 HRESULT WINAPI StgStreamImpl_Clone( 868 */ 869 HRESULT WINAPI StgStreamImpl_Clone( 870 870 IStream* iface, 871 IStream** ppstm) /* [out] */ 871 IStream** ppstm) /* [out] */ 872 872 { 873 873 StgStreamImpl* const This=(StgStreamImpl*)iface; … … 889 889 *ppstm = (IStream*) new_stream; 890 890 seek_pos.QuadPart = This->currentPosition.QuadPart; 891 891 892 892 hres=StgStreamImpl_Seek (*ppstm, seek_pos, STREAM_SEEK_SET, NULL); 893 893 894 894 assert (SUCCEEDED(hres)); 895 895 -
trunk/src/ole32/storage32.c
r8441 r8620 24 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 25 */ 26 27 26 #ifdef __WIN32OS2__ 28 27 #include "ole32.h" … … 60 59 /* OLESTREAM memory structure to use for Get and Put Routines */ 61 60 /* Used for OleConvertIStorageToOLESTREAM and OleConvertOLESTREAMToIStorage */ 62 typedef struct 61 typedef struct 63 62 { 64 63 DWORD dwOleID; … … 98 97 DWORD dwExtentX; 99 98 DWORD dwExtentY; 100 DWORD dwSize; 99 DWORD dwSize; 101 100 BYTE *pData; 102 101 }OLECONVERT_ISTORAGE_OLEPRES; … … 123 122 INT typeOfRelation); 124 123 125 static HRESULT adjustPropertyChain( 124 static HRESULT adjustPropertyChain( 126 125 StorageImpl *This, 127 126 StgProperty propertyToDelete, … … 150 149 * Declaration of miscellaneous functions... 151 150 */ 152 static HRESULT validateSTGM(DWORD stgmValue); 151 static HRESULT validateSTGM(DWORD stgmValue); 153 152 154 153 static DWORD GetShareModeFromSTGM(DWORD stgm); … … 236 235 * This method implements the common QueryInterface for all IStorage32 237 236 * implementations contained in this file. 238 * 237 * 239 238 * See Windows documentation for more details on IUnknown methods. 240 239 */ … … 250 249 if ( (This==0) || (ppvObject==0) ) 251 250 return E_INVALIDARG; 252 251 253 252 /* 254 253 * Initialize the return parameter. 255 254 */ 256 255 *ppvObject = 0; 257 256 258 257 /* 259 258 * Compare the riid with the interface IDs implemented by this object. 260 259 */ 261 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 260 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 262 261 { 263 262 *ppvObject = (IStorage*)This; 264 263 } 265 else if (memcmp(&IID_IStorage, riid, sizeof(IID_IStorage)) == 0) 264 else if (memcmp(&IID_IStorage, riid, sizeof(IID_IStorage)) == 0) 266 265 { 267 266 *ppvObject = (IStorage*)This; 268 267 } 269 268 270 269 /* 271 270 * Check that we obtained an interface. … … 273 272 if ((*ppvObject)==0) 274 273 return E_NOINTERFACE; 275 274 276 275 /* 277 276 * Query Interface always increases the reference count by one when it is … … 282 281 return S_OK; 283 282 } 284 283 285 284 /************************************************************************ 286 285 * Storage32BaseImpl_AddRef (IUnknown) … … 288 287 * This method implements the common AddRef for all IStorage32 289 288 * implementations contained in this file. 290 * 289 * 291 290 * See Windows documentation for more details on IUnknown methods. 292 291 */ 293 ULONG WINAPI StorageBaseImpl_AddRef( 292 ULONG WINAPI StorageBaseImpl_AddRef( 294 293 IStorage* iface) 295 294 { … … 299 298 return This->ref; 300 299 } 301 300 302 301 /************************************************************************ 303 302 * Storage32BaseImpl_Release (IUnknown) … … 305 304 * This method implements the common Release for all IStorage32 306 305 * implementations contained in this file. 307 * 306 * 308 307 * See Windows documentation for more details on IUnknown methods. 309 308 */ 310 ULONG WINAPI StorageBaseImpl_Release( 309 ULONG WINAPI StorageBaseImpl_Release( 311 310 IStorage* iface) 312 311 { … … 323 322 { 324 323 /* 325 * Since we are using a system of base-classes, we want to call the 326 * destructor of the appropriate derived class. To do this, we are 324 * Since we are using a system of base-classes, we want to call the 325 * destructor of the appropriate derived class. To do this, we are 327 326 * using virtual functions to implement the destructor. 328 327 */ … … 331 330 return 0; 332 331 } 333 332 334 333 return This->ref; 335 334 } … … 342 341 * See Windows documentation for more details on IStorage methods. 343 342 */ 344 HRESULT WINAPI StorageBaseImpl_OpenStream( 343 HRESULT WINAPI StorageBaseImpl_OpenStream( 345 344 IStorage* iface, 346 345 const OLECHAR* pwcsName, /* [string][in] */ 347 346 void* reserved1, /* [unique][in] */ 348 DWORD grfMode, /* [in] */ 349 DWORD reserved2, /* [in] */ 350 IStream** ppstm) /* [out] */ 347 DWORD grfMode, /* [in] */ 348 DWORD reserved2, /* [in] */ 349 IStream** ppstm) /* [out] */ 351 350 { 352 351 ICOM_THIS(StorageBaseImpl,iface); … … 357 356 HRESULT res = STG_E_UNKNOWN; 358 357 359 TRACE("(%p, %s, %p, %lx, %ld, %p)\n", 358 TRACE("(%p, %s, %p, %lx, %ld, %p)\n", 360 359 iface, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm); 361 360 … … 368 367 goto end; 369 368 } 370 369 371 370 /* 372 371 * Initialize the out parameter 373 372 */ 374 373 *ppstm = NULL; 375 374 376 375 /* 377 376 * Validate the STGM flags … … 398 397 */ 399 398 propertyEnumeration = IEnumSTATSTGImpl_Construct( 400 This->ancestorStorage, 399 This->ancestorStorage, 401 400 This->rootPropertySetIndex); 402 401 403 402 /* 404 403 * Search the enumeration for the property with the given name … … 408 407 pwcsName, 409 408 ¤tProperty); 410 409 411 410 /* 412 411 * Delete the property enumeration since we don't need it anymore 413 412 */ 414 413 IEnumSTATSTGImpl_Destroy(propertyEnumeration); 415 414 416 415 /* 417 416 * If it was found, construct the stream object and return a pointer to it. 418 417 */ 419 if ( (foundPropertyIndex!=PROPERTY_NULL) && 418 if ( (foundPropertyIndex!=PROPERTY_NULL) && 420 419 (currentProperty.propertyType==PROPTYPE_STREAM) ) 421 420 { 422 421 newStream = StgStreamImpl_Construct(This, grfMode, foundPropertyIndex); 423 422 424 423 if (newStream!=0) 425 424 { … … 428 427 429 428 /* 430 * Since we are returning a pointer to the interface, we have to 429 * Since we are returning a pointer to the interface, we have to 431 430 * nail down the reference. 432 431 */ 433 432 StgStreamImpl_AddRef(*ppstm); 434 433 435 434 res = S_OK; 436 435 goto end; 437 436 } 438 437 439 438 res = E_OUTOFMEMORY; 440 439 goto end; 441 440 } 442 441 443 442 res = STG_E_FILENOTFOUND; 444 443 … … 454 453 * 455 454 * This method will open a new storage object from the current storage. 456 * 455 * 457 456 * See Windows documentation for more details on IStorage methods. 458 */ 459 HRESULT WINAPI StorageBaseImpl_OpenStorage( 457 */ 458 HRESULT WINAPI StorageBaseImpl_OpenStorage( 460 459 IStorage* iface, 461 const OLECHAR* pwcsName, /* [string][unique][in] */ 462 IStorage* pstgPriority, /* [unique][in] */ 463 DWORD grfMode, /* [in] */ 464 SNB snbExclude, /* [unique][in] */ 465 DWORD reserved, /* [in] */ 466 IStorage** ppstg) /* [out] */ 460 const OLECHAR* pwcsName, /* [string][unique][in] */ 461 IStorage* pstgPriority, /* [unique][in] */ 462 DWORD grfMode, /* [in] */ 463 SNB snbExclude, /* [unique][in] */ 464 DWORD reserved, /* [in] */ 465 IStorage** ppstg) /* [out] */ 467 466 { 468 467 ICOM_THIS(StorageBaseImpl,iface); … … 473 472 HRESULT res = STG_E_UNKNOWN; 474 473 475 TRACE("(%p, %s, %p, %lx, %p, %ld, %p)\n", 476 iface, debugstr_w(pwcsName), pstgPriority, 474 TRACE("(%p, %s, %p, %lx, %p, %ld, %p)\n", 475 iface, debugstr_w(pwcsName), pstgPriority, 477 476 grfMode, snbExclude, reserved, ppstg); 478 477 479 478 /* 480 479 * Perform a sanity check on the parameters. … … 485 484 goto end; 486 485 } 487 486 488 487 /* as documented */ 489 488 if (snbExclude != NULL) … … 492 491 goto end; 493 492 } 494 493 495 494 /* 496 495 * Validate the STGM flags … … 505 504 * As documented. 506 505 */ 507 if ( !(grfMode & STGM_SHARE_EXCLUSIVE) || 506 if ( !(grfMode & STGM_SHARE_EXCLUSIVE) || 508 507 (grfMode & STGM_DELETEONRELEASE) || 509 508 (grfMode & STGM_PRIORITY) ) … … 517 516 */ 518 517 *ppstg = NULL; 519 518 520 519 /* 521 520 * Create a property enumeration to search the properties 522 521 */ 523 522 propertyEnumeration = IEnumSTATSTGImpl_Construct( 524 This->ancestorStorage, 523 This->ancestorStorage, 525 524 This->rootPropertySetIndex); 526 525 527 526 /* 528 527 * Search the enumeration for the property with the given name … … 532 531 pwcsName, 533 532 ¤tProperty); 534 533 535 534 /* 536 535 * Delete the property enumeration since we don't need it anymore 537 536 */ 538 537 IEnumSTATSTGImpl_Destroy(propertyEnumeration); 539 538 540 539 /* 541 540 * If it was found, construct the stream object and return a pointer to it. 542 541 */ 543 if ( (foundPropertyIndex!=PROPERTY_NULL) && 542 if ( (foundPropertyIndex!=PROPERTY_NULL) && 544 543 (currentProperty.propertyType==PROPTYPE_STORAGE) ) 545 544 { … … 550 549 This->ancestorStorage, 551 550 foundPropertyIndex); 552 551 553 552 if (newStorage != 0) 554 553 { … … 556 555 557 556 /* 558 * Since we are returning a pointer to the interface, 557 * Since we are returning a pointer to the interface, 559 558 * we have to nail down the reference. 560 559 */ 561 560 StorageBaseImpl_AddRef(*ppstg); 562 561 563 562 res = S_OK; 564 563 goto end; 565 564 } 566 565 567 566 res = STG_E_INSUFFICIENTMEMORY; 568 567 goto end; 569 568 } 570 569 571 570 res = STG_E_FILENOTFOUND; 572 571 … … 579 578 * Storage32BaseImpl_EnumElements (IStorage) 580 579 * 581 * This method will create an enumerator object that can be used to 580 * This method will create an enumerator object that can be used to 582 581 * retrieve informatino about all the properties in the storage object. 583 * 582 * 584 583 * See Windows documentation for more details on IStorage methods. 585 */ 586 HRESULT WINAPI StorageBaseImpl_EnumElements( 584 */ 585 HRESULT WINAPI StorageBaseImpl_EnumElements( 587 586 IStorage* iface, 588 DWORD reserved1, /* [in] */ 589 void* reserved2, /* [size_is][unique][in] */ 590 DWORD reserved3, /* [in] */ 591 IEnumSTATSTG** ppenum) /* [out] */ 587 DWORD reserved1, /* [in] */ 588 void* reserved2, /* [size_is][unique][in] */ 589 DWORD reserved3, /* [in] */ 590 IEnumSTATSTG** ppenum) /* [out] */ 592 591 { 593 592 ICOM_THIS(StorageBaseImpl,iface); 594 593 IEnumSTATSTGImpl* newEnum; 595 594 596 TRACE("(%p, %ld, %p, %ld, %p)\n", 595 TRACE("(%p, %ld, %p, %ld, %p)\n", 597 596 iface, reserved1, reserved2, reserved3, ppenum); 598 597 … … 602 601 if ( (This==0) || (ppenum==0)) 603 602 return E_INVALIDARG; 604 603 605 604 /* 606 605 * Construct the enumerator. … … 619 618 */ 620 619 IEnumSTATSTGImpl_AddRef(*ppenum); 621 620 622 621 return S_OK; 623 622 } … … 630 629 * 631 630 * This method will retrieve information about this storage object. 632 * 631 * 633 632 * See Windows documentation for more details on IStorage methods. 634 */ 635 HRESULT WINAPI StorageBaseImpl_Stat( 633 */ 634 HRESULT WINAPI StorageBaseImpl_Stat( 636 635 IStorage* iface, 637 STATSTG* pstatstg, /* [out] */ 638 DWORD grfStatFlag) /* [in] */ 636 STATSTG* pstatstg, /* [out] */ 637 DWORD grfStatFlag) /* [in] */ 639 638 { 640 639 ICOM_THIS(StorageBaseImpl,iface); … … 643 642 HRESULT res = STG_E_UNKNOWN; 644 643 645 TRACE("(%p, %p, %lx)\n", 644 TRACE("(%p, %p, %lx)\n", 646 645 iface, pstatstg, grfStatFlag); 647 646 … … 666 665 { 667 666 StorageUtl_CopyPropertyToSTATSTG( 668 pstatstg, 669 &curProperty, 667 pstatstg, 668 &curProperty, 670 669 grfStatFlag); 671 670 672 671 res = S_OK; 673 672 goto end; 674 673 } 675 674 676 675 res = E_FAIL; 677 676 … … 688 687 * Storage32BaseImpl_RenameElement (IStorage) 689 688 * 690 * This method will rename the specified element. 689 * This method will rename the specified element. 691 690 * 692 691 * See Windows documentation for more details on IStorage methods. 693 * 694 * Implementation notes: The method used to rename consists of creating a clone 695 * of the deleted StgProperty object setting it with the new name and to 692 * 693 * Implementation notes: The method used to rename consists of creating a clone 694 * of the deleted StgProperty object setting it with the new name and to 696 695 * perform a DestroyElement of the old StgProperty. 697 696 */ … … 706 705 ULONG foundPropertyIndex; 707 706 708 TRACE("(%p, %s, %s)\n", 707 TRACE("(%p, %s, %s)\n", 709 708 iface, debugstr_w(pwcsOldName), debugstr_w(pwcsNewName)); 710 709 … … 753 752 * Setup a new property for the renamed property 754 753 */ 755 renamedProperty.sizeOfNameString = 754 renamedProperty.sizeOfNameString = 756 755 ( lstrlenW(pwcsNewName)+1 ) * sizeof(WCHAR); 757 756 758 757 if (renamedProperty.sizeOfNameString > PROPERTY_NAME_BUFFER_LEN) 759 758 return STG_E_INVALIDNAME; 760 759 761 760 strcpyW(renamedProperty.name, pwcsNewName); 762 761 763 762 renamedProperty.propertyType = currentProperty.propertyType; 764 763 renamedProperty.startingBlock = currentProperty.startingBlock; 765 764 renamedProperty.size.s.LowPart = currentProperty.size.s.LowPart; 766 765 renamedProperty.size.s.HighPart = currentProperty.size.s.HighPart; 767 766 768 767 renamedProperty.previousProperty = PROPERTY_NULL; 769 768 renamedProperty.nextProperty = PROPERTY_NULL; 770 769 771 770 /* 772 771 * Bring the dirProperty link in case it is a storage and in which … … 774 773 */ 775 774 renamedProperty.dirProperty = currentProperty.dirProperty; 776 777 /* call CoFileTime to get the current time 775 776 /* call CoFileTime to get the current time 778 777 renamedProperty.timeStampS1 779 778 renamedProperty.timeStampD1 780 779 renamedProperty.timeStampS2 781 780 renamedProperty.timeStampD2 782 renamedProperty.propertyUniqueID 781 renamedProperty.propertyUniqueID 783 782 */ 784 785 /* 783 784 /* 786 785 * Obtain a free property in the property chain 787 786 */ 788 787 renamedPropertyIndex = getFreeProperty(This->ancestorStorage); 789 788 790 789 /* 791 790 * Save the new property into the new property spot 792 */ 791 */ 793 792 StorageImpl_WriteProperty( 794 793 This->ancestorStorage, 795 renamedPropertyIndex, 794 renamedPropertyIndex, 796 795 &renamedProperty); 797 798 /* 796 797 /* 799 798 * Find a spot in the property chain for our newly created property. 800 799 */ 801 800 updatePropertyChain( 802 801 (StorageImpl*)This, 803 renamedPropertyIndex, 802 renamedPropertyIndex, 804 803 renamedProperty); 805 804 806 805 /* 807 * At this point the renamed property has been inserted in the tree, 808 * now, before to Destroy the old property we must zeroed it's dirProperty 809 * otherwise the DestroyProperty below will zap it all and we do not want 806 * At this point the renamed property has been inserted in the tree, 807 * now, before to Destroy the old property we must zeroed it's dirProperty 808 * otherwise the DestroyProperty below will zap it all and we do not want 810 809 * this to happen. 811 810 * Also, we fake that the old property is a storage so the DestroyProperty 812 811 * will not do a SetSize(0) on the stream data. 813 * 812 * 814 813 * This means that we need to tweek the StgProperty if it is a stream or a 815 814 * non empty storage. … … 823 822 StorageImpl_WriteProperty( 824 823 This->ancestorStorage, 825 foundPropertyIndex, 824 foundPropertyIndex, 826 825 ¤tProperty); 827 826 828 /* 829 * Invoke Destroy to get rid of the ole property and automatically redo 830 * the linking of it's previous and next members... 831 */ 832 StorageImpl_DestroyElement((IStorage*)This->ancestorStorage, pwcsOldName); 827 /* 828 * Invoke Destroy to get rid of the ole property and automatically redo 829 * the linking of it's previous and next members... 830 */ 831 StorageImpl_DestroyElement((IStorage*)This->ancestorStorage, pwcsOldName); 833 832 834 833 } … … 847 846 * Storage32BaseImpl_CreateStream (IStorage) 848 847 * 849 * This method will create a stream object within this storage 848 * This method will create a stream object within this storage 850 849 * 851 850 * See Windows documentation for more details on IStorage methods. … … 865 864 ULONG foundPropertyIndex, newPropertyIndex; 866 865 867 TRACE("(%p, %s, %lx, %ld, %ld, %p)\n", 868 iface, debugstr_w(pwcsName), grfMode, 866 TRACE("(%p, %s, %lx, %ld, %ld, %p)\n", 867 iface, debugstr_w(pwcsName), grfMode, 869 868 reserved1, reserved2, ppstm); 870 869 … … 912 911 { 913 912 /* 914 * An element with this name already exists 913 * An element with this name already exists 915 914 */ 916 915 if (grfMode & STGM_CREATE) 917 916 { 918 IStorage_DestroyElement(iface, pwcsName); 919 } 920 else 917 IStorage_DestroyElement(iface, pwcsName); 918 } 919 else 921 920 return STG_E_FILEALREADYEXISTS; 922 921 } 923 922 924 /* 925 * memset the empty property 923 /* 924 * memset the empty property 926 925 */ 927 926 memset(&newStreamProperty, 0, sizeof(StgProperty)); … … 944 943 newStreamProperty.dirProperty = PROPERTY_NULL; 945 944 946 /* call CoFileTime to get the current time 945 /* call CoFileTime to get the current time 947 946 newStreamProperty.timeStampS1 948 947 newStreamProperty.timeStampD1 … … 954 953 955 954 /* 956 * Get a free property or create a new one 955 * Get a free property or create a new one 957 956 */ 958 957 newPropertyIndex = getFreeProperty(This->ancestorStorage); … … 960 959 /* 961 960 * Save the new property into the new property spot 962 */ 961 */ 963 962 StorageImpl_WriteProperty( 964 963 This->ancestorStorage, 965 newPropertyIndex, 964 newPropertyIndex, 966 965 &newStreamProperty); 967 966 968 /* 967 /* 969 968 * Find a spot in the property chain for our newly created property. 970 969 */ 971 970 updatePropertyChain( 972 971 (StorageImpl*)This, 973 newPropertyIndex, 972 newPropertyIndex, 974 973 newStreamProperty); 975 974 976 /* 975 /* 977 976 * Open the stream to return it. 978 977 */ … … 1000 999 * Storage32BaseImpl_SetClass (IStorage) 1001 1000 * 1002 * This method will write the specified CLSID in the property of this 1001 * This method will write the specified CLSID in the property of this 1003 1002 * storage. 1004 1003 * … … 1015 1014 1016 1015 TRACE("(%p, %p)\n", iface, clsid); 1017 1016 1018 1017 success = StorageImpl_ReadProperty(This->ancestorStorage, 1019 1018 This->rootPropertySetIndex, … … 1036 1035 ** Storage32Impl implementation 1037 1036 */ 1038 1037 1039 1038 /************************************************************************ 1040 1039 * Storage32Impl_CreateStorage (IStorage) … … 1044 1043 * See Windows documentation for more details on IStorage methods. 1045 1044 */ 1046 HRESULT WINAPI StorageImpl_CreateStorage( 1045 HRESULT WINAPI StorageImpl_CreateStorage( 1047 1046 IStorage* iface, 1048 const OLECHAR *pwcsName, /* [string][in] */ 1049 DWORD grfMode, /* [in] */ 1050 DWORD reserved1, /* [in] */ 1051 DWORD reserved2, /* [in] */ 1052 IStorage **ppstg) /* [out] */ 1047 const OLECHAR *pwcsName, /* [string][in] */ 1048 DWORD grfMode, /* [in] */ 1049 DWORD reserved1, /* [in] */ 1050 DWORD reserved2, /* [in] */ 1051 IStorage **ppstg) /* [out] */ 1053 1052 { 1054 1053 StorageImpl* const This=(StorageImpl*)iface; … … 1061 1060 HRESULT hr; 1062 1061 1063 TRACE("(%p, %s, %lx, %ld, %ld, %p)\n", 1064 iface, debugstr_w(pwcsName), grfMode, 1062 TRACE("(%p, %s, %lx, %ld, %ld, %p)\n", 1063 iface, debugstr_w(pwcsName), grfMode, 1065 1064 reserved1, reserved2, ppstg); 1066 1065 1067 1066 /* 1068 1067 * Validate parameters … … 1100 1099 { 1101 1100 /* 1102 * An element with this name already exists 1101 * An element with this name already exists 1103 1102 */ 1104 1103 if (grfMode & STGM_CREATE) 1105 IStorage_DestroyElement(iface, pwcsName); 1106 else 1104 IStorage_DestroyElement(iface, pwcsName); 1105 else 1107 1106 return STG_E_FILEALREADYEXISTS; 1108 1107 } 1109 1108 1110 /* 1111 * memset the empty property 1109 /* 1110 * memset the empty property 1112 1111 */ 1113 1112 memset(&newProperty, 0, sizeof(StgProperty)); … … 1129 1128 newProperty.dirProperty = PROPERTY_NULL; 1130 1129 1131 /* call CoFileTime to get the current time 1130 /* call CoFileTime to get the current time 1132 1131 newProperty.timeStampS1 1133 1132 newProperty.timeStampD1 … … 1138 1137 /* newStorageProperty.propertyUniqueID */ 1139 1138 1140 /* 1139 /* 1141 1140 * Obtain a free property in the property chain 1142 1141 */ … … 1145 1144 /* 1146 1145 * Save the new property into the new property spot 1147 */ 1146 */ 1148 1147 StorageImpl_WriteProperty( 1149 1148 This->ancestorStorage, 1150 newPropertyIndex, 1149 newPropertyIndex, 1151 1150 &newProperty); 1152 1151 1153 /* 1152 /* 1154 1153 * Find a spot in the property chain for our newly created property. 1155 1154 */ 1156 1155 updatePropertyChain( 1157 1156 This, 1158 newPropertyIndex, 1157 newPropertyIndex, 1159 1158 newProperty); 1160 1159 1161 /* 1160 /* 1162 1161 * Open it to get a pointer to return. 1163 1162 */ … … 1176 1175 } 1177 1176 1178 1177 1179 1178 return S_OK; 1180 1179 } … … 1207 1206 if (currentProperty.sizeOfNameString == 0) 1208 1207 { 1209 /* 1208 /* 1210 1209 * The property existis and is available, we found it. 1211 1210 */ … … 1224 1223 } while (newPropertyIndex == PROPERTY_NULL); 1225 1224 1226 /* 1227 * grow the property chain 1225 /* 1226 * grow the property chain 1228 1227 */ 1229 1228 if (! readSuccessful) … … 1235 1234 ULONG blockCount = 0; 1236 1235 1237 /* 1238 * obtain the new count of property blocks 1236 /* 1237 * obtain the new count of property blocks 1239 1238 */ 1240 1239 blockCount = BlockChainStream_GetCount( 1241 1240 storage->ancestorStorage->rootBlockChain)+1; 1242 1241 1243 /* 1244 * initialize the size used by the property stream 1242 /* 1243 * initialize the size used by the property stream 1245 1244 */ 1246 1245 newSize.s.HighPart = 0; 1247 1246 newSize.s.LowPart = storage->bigBlockSize * blockCount; 1248 1247 1249 /* 1250 * add a property block to the property chain 1248 /* 1249 * add a property block to the property chain 1251 1250 */ 1252 1251 BlockChainStream_SetSize(storage->ancestorStorage->rootBlockChain, newSize); 1253 1252 1254 /* 1255 * memset the empty property in order to initialize the unused newly 1253 /* 1254 * memset the empty property in order to initialize the unused newly 1256 1255 * created property 1257 1256 */ 1258 1257 memset(&emptyProperty, 0, sizeof(StgProperty)); 1259 1258 1260 /* 1259 /* 1261 1260 * initialize them 1262 1261 */ 1263 lastProperty = storage->bigBlockSize / PROPSET_BLOCK_SIZE * blockCount; 1264 1262 lastProperty = storage->bigBlockSize / PROPSET_BLOCK_SIZE * blockCount; 1263 1265 1264 for( 1266 1265 propertyIndex = newPropertyIndex; … … 1270 1269 StorageImpl_WriteProperty( 1271 1270 storage->ancestorStorage, 1272 propertyIndex, 1271 propertyIndex, 1273 1272 &emptyProperty); 1274 1273 } … … 1282 1281 * Internal Method 1283 1282 * 1284 * Case insensitive comparaison of StgProperty.name by first considering 1283 * Case insensitive comparaison of StgProperty.name by first considering 1285 1284 * their size. 1286 1285 * … … 1295 1294 LONG diff = lstrlenW(newProperty) - lstrlenW(currentProperty); 1296 1295 1297 if (diff == 0) 1298 { 1299 /* 1296 if (diff == 0) 1297 { 1298 /* 1300 1299 * We compare the string themselves only when they are of the same lenght 1301 1300 */ … … 1303 1302 } 1304 1303 1305 return diff; 1304 return diff; 1306 1305 } 1307 1306 … … 1315 1314 StorageImpl *storage, 1316 1315 ULONG newPropertyIndex, 1317 StgProperty newProperty) 1316 StgProperty newProperty) 1318 1317 { 1319 1318 StgProperty currentProperty; … … 1328 1327 if (currentProperty.dirProperty != PROPERTY_NULL) 1329 1328 { 1330 /* 1329 /* 1331 1330 * The root storage contains some element, therefore, start the research 1332 1331 * for the appropriate location. … … 1341 1340 1342 1341 /* 1343 * Read 1342 * Read 1344 1343 */ 1345 1344 StorageImpl_ReadProperty(storage->ancestorStorage, … … 1354 1353 { 1355 1354 LONG diff = propertyNameCmp( newProperty.name, currentProperty.name); 1356 1355 1357 1356 if (diff < 0) 1358 1357 { … … 1406 1405 else 1407 1406 { 1408 /* 1407 /* 1409 1408 * The root storage is empty, link the new property to it's dir property 1410 1409 */ … … 1416 1415 } 1417 1416 1418 1417 1419 1418 /************************************************************************* 1420 1419 * CopyTo (IStorage) 1421 1420 */ 1422 HRESULT WINAPI StorageImpl_CopyTo( 1421 HRESULT WINAPI StorageImpl_CopyTo( 1423 1422 IStorage* iface, 1424 DWORD ciidExclude, /* [in] */ 1425 const IID* rgiidExclude, /* [size_is][unique][in] */ 1426 SNB snbExclude, /* [unique][in] */ 1427 IStorage* pstgDest) /* [unique][in] */ 1423 DWORD ciidExclude, /* [in] */ 1424 const IID* rgiidExclude, /* [size_is][unique][in] */ 1425 SNB snbExclude, /* [unique][in] */ 1426 IStorage* pstgDest) /* [unique][in] */ 1428 1427 { 1429 1428 IEnumSTATSTG *elements = 0; … … 1436 1435 FIXME("Exclude option not implemented\n"); 1437 1436 1438 TRACE("(%p, %ld, %p, %p, %p)\n", 1439 iface, ciidExclude, rgiidExclude, 1437 TRACE("(%p, %ld, %p, %p, %p)\n", 1438 iface, ciidExclude, rgiidExclude, 1440 1439 snbExclude, pstgDest); 1441 1440 … … 1446 1445 return STG_E_INVALIDPOINTER; 1447 1446 1448 /* 1447 /* 1449 1448 * Enumerate the elements 1450 1449 */ … … 1459 1458 IStorage_Stat( iface, &curElement, STATFLAG_NONAME); 1460 1459 IStorage_SetClass( pstgDest, &curElement.clsid ); 1461 1460 1462 1461 do 1463 1462 { … … 1495 1494 return STG_E_ACCESSDENIED; 1496 1495 } 1497 1496 1498 1497 /* 1499 1498 * create a new storage in destination storage … … 1512 1511 NULL, 0, &pstgTmp ); 1513 1512 } 1514 1513 1515 1514 if (hr != S_OK) 1516 1515 break; 1517 1516 1518 1517 1519 1518 /* 1520 1519 * do the copy recursively … … 1522 1521 hr = IStorage_CopyTo( pstgChild, ciidExclude, rgiidExclude, 1523 1522 snbExclude, pstgTmp ); 1524 1523 1525 1524 IStorage_Release( pstgTmp ); 1526 1525 IStorage_Release( pstgChild ); … … 1558 1557 */ 1559 1558 IStream_SetSize(pstrTmp, strStat.cbSize); 1560 1559 1561 1560 /* 1562 1561 * do the copy … … 1564 1563 hr = IStream_CopyTo( pstrChild, pstrTmp, strStat.cbSize, 1565 1564 NULL, NULL ); 1566 1565 1567 1566 IStream_Release( pstrTmp ); 1568 1567 IStream_Release( pstrChild ); … … 1579 1578 */ 1580 1579 IEnumSTATSTG_Release(elements); 1581 1580 1582 1581 return hr; 1583 1582 } 1584 1583 1585 1584 /************************************************************************* 1586 1585 * MoveElementTo (IStorage) 1587 1586 */ 1588 HRESULT WINAPI StorageImpl_MoveElementTo( 1587 HRESULT WINAPI StorageImpl_MoveElementTo( 1589 1588 IStorage* iface, 1590 const OLECHAR *pwcsName, /* [string][in] */ 1591 IStorage *pstgDest, /* [unique][in] */ 1592 const OLECHAR *pwcsNewName,/* [string][in] */ 1593 DWORD grfFlags) /* [in] */ 1589 const OLECHAR *pwcsName, /* [string][in] */ 1590 IStorage *pstgDest, /* [unique][in] */ 1591 const OLECHAR *pwcsNewName,/* [string][in] */ 1592 DWORD grfFlags) /* [in] */ 1594 1593 { 1595 1594 FIXME("not implemented!\n"); 1596 1595 return E_NOTIMPL; 1597 1596 } 1598 1597 1599 1598 /************************************************************************* 1600 1599 * Commit (IStorage) 1601 1600 */ 1602 HRESULT WINAPI StorageImpl_Commit( 1601 HRESULT WINAPI StorageImpl_Commit( 1603 1602 IStorage* iface, 1604 DWORD grfCommitFlags)/* [in] */ 1603 DWORD grfCommitFlags)/* [in] */ 1605 1604 { 1606 1605 FIXME("(%ld): stub!\n", grfCommitFlags); 1607 1606 return S_OK; 1608 1607 } 1609 1608 1610 1609 /************************************************************************* 1611 1610 * Revert (IStorage) 1612 1611 */ 1613 HRESULT WINAPI StorageImpl_Revert( 1612 HRESULT WINAPI StorageImpl_Revert( 1614 1613 IStorage* iface) 1615 1614 { … … 1621 1620 * DestroyElement (IStorage) 1622 1621 * 1623 * Stategy: This implementation is build this way for simplicity not for speed. 1622 * Stategy: This implementation is build this way for simplicity not for speed. 1624 1623 * I always delete the top most element of the enumeration and adjust 1625 * the deleted element pointer all the time. This takes longer to 1626 * do but allow to reinvoke DestroyElement whenever we encounter a 1624 * the deleted element pointer all the time. This takes longer to 1625 * do but allow to reinvoke DestroyElement whenever we encounter a 1627 1626 * storage object. The optimisation reside in the usage of another 1628 * enumeration stategy that would give all the leaves of a storage 1627 * enumeration stategy that would give all the leaves of a storage 1629 1628 * first. (postfix order) 1630 1629 */ 1631 HRESULT WINAPI StorageImpl_DestroyElement( 1630 HRESULT WINAPI StorageImpl_DestroyElement( 1632 1631 IStorage* iface, 1633 const OLECHAR *pwcsName)/* [string][in] */ 1632 const OLECHAR *pwcsName)/* [string][in] */ 1634 1633 { 1635 1634 StorageImpl* const This=(StorageImpl*)iface; … … 1644 1643 ULONG parentPropertyId; 1645 1644 1646 TRACE("(%p, %s)\n", 1645 TRACE("(%p, %s)\n", 1647 1646 iface, debugstr_w(pwcsName)); 1648 1647 … … 1650 1649 * Perform a sanity check on the parameters. 1651 1650 */ 1652 if (pwcsName==NULL) 1651 if (pwcsName==NULL) 1653 1652 return STG_E_INVALIDPOINTER; 1654 1653 1655 1654 /* 1656 1655 * Create a property enumeration to search the property with the given name 1657 1656 */ 1658 1657 propertyEnumeration = IEnumSTATSTGImpl_Construct( 1659 This->ancestorStorage, 1658 This->ancestorStorage, 1660 1659 This->rootPropertySetIndex); 1661 1660 1662 1661 foundPropertyIndexToDelete = IEnumSTATSTGImpl_FindProperty( 1663 1662 propertyEnumeration, … … 1667 1666 IEnumSTATSTGImpl_Destroy(propertyEnumeration); 1668 1667 1669 if ( foundPropertyIndexToDelete == PROPERTY_NULL ) 1668 if ( foundPropertyIndexToDelete == PROPERTY_NULL ) 1670 1669 { 1671 1670 return STG_E_FILENOTFOUND; 1672 1671 } 1673 1672 1674 /* 1675 * Find the parent property of the property to delete (the one that 1676 * link to it). If This->dirProperty == foundPropertyIndexToDelete, 1673 /* 1674 * Find the parent property of the property to delete (the one that 1675 * link to it). If This->dirProperty == foundPropertyIndexToDelete, 1677 1676 * the parent is This. Otherwise, the parent is one of it's sibling... 1678 1677 */ 1679 1678 1680 /* 1679 /* 1681 1680 * First, read This's StgProperty.. 1682 1681 */ 1683 res = StorageImpl_ReadProperty( 1682 res = StorageImpl_ReadProperty( 1684 1683 This->ancestorStorage, 1685 1684 This->rootPropertySetIndex, … … 1688 1687 assert(res==TRUE); 1689 1688 1690 /* 1689 /* 1691 1690 * Second, check to see if by any chance the actual storage (This) is not 1692 1691 * the parent of the property to delete... We never know... … … 1694 1693 if ( parentProperty.dirProperty == foundPropertyIndexToDelete ) 1695 1694 { 1696 /* 1695 /* 1697 1696 * Set data as it would have been done in the else part... 1698 1697 */ … … 1700 1699 parentPropertyId = This->rootPropertySetIndex; 1701 1700 } 1702 else 1703 { 1704 /* 1705 * Create a property enumeration to search the parent properties, and 1701 else 1702 { 1703 /* 1704 * Create a property enumeration to search the parent properties, and 1706 1705 * delete it once done. 1707 1706 */ … … 1709 1708 1710 1709 propertyEnumeration2 = IEnumSTATSTGImpl_Construct( 1711 This->ancestorStorage, 1710 This->ancestorStorage, 1712 1711 This->rootPropertySetIndex); 1713 1712 1714 1713 typeOfRelation = IEnumSTATSTGImpl_FindParentProperty( 1715 1714 propertyEnumeration2, … … 1721 1720 } 1722 1721 1723 if ( propertyToDelete.propertyType == PROPTYPE_STORAGE ) 1722 if ( propertyToDelete.propertyType == PROPTYPE_STORAGE ) 1724 1723 { 1725 1724 hr = deleteStorageProperty( 1726 This, 1725 This, 1727 1726 foundPropertyIndexToDelete, 1728 1727 propertyToDelete); 1729 } 1728 } 1730 1729 else if ( propertyToDelete.propertyType == PROPTYPE_STREAM ) 1731 1730 { 1732 1731 hr = deleteStreamProperty( 1733 This, 1732 This, 1734 1733 foundPropertyIndexToDelete, 1735 1734 propertyToDelete); 1736 1735 } 1737 1736 1738 if (hr!=S_OK) 1737 if (hr!=S_OK) 1739 1738 return hr; 1740 1739 … … 1744 1743 hr = adjustPropertyChain( 1745 1744 This, 1746 propertyToDelete, 1745 propertyToDelete, 1747 1746 parentProperty, 1748 1747 parentPropertyId, … … 1753 1752 1754 1753 1755 /************************************************************************ 1756 * StorageImpl_Stat (IStorage) 1757 * 1758 * This method will retrieve information about this storage object. 1759 * 1760 * See Windows documentation for more details on IStorage methods. 1754 /************************************************************************ 1755 * StorageImpl_Stat (IStorage) 1756 * 1757 * This method will retrieve information about this storage object. 1758 * 1759 * See Windows documentation for more details on IStorage methods. 1761 1760 */ 1762 1761 HRESULT WINAPI StorageImpl_Stat( IStorage* iface, … … 1814 1813 } 1815 1814 1816 /* 1815 /* 1817 1816 * Enumerate the elements 1818 1817 */ … … 1828 1827 { 1829 1828 destroyHr = StorageImpl_DestroyElement( 1830 (IStorage*)childStorage, 1829 (IStorage*)childStorage, 1831 1830 (OLECHAR*)currentElement.pwcsName); 1832 1831 … … 1853 1852 IStorage_Release(childStorage); 1854 1853 IEnumSTATSTG_Release(elements); 1855 1854 1856 1855 return destroyHr; 1857 1856 } … … 1883 1882 0, 1884 1883 &pis); 1885 1884 1886 1885 if (hr!=S_OK) 1887 1886 { … … 1889 1888 } 1890 1889 1891 /* 1892 * Zap the stream 1893 */ 1894 hr = IStream_SetSize(pis, size); 1890 /* 1891 * Zap the stream 1892 */ 1893 hr = IStream_SetSize(pis, size); 1895 1894 1896 1895 if(hr != S_OK) … … 1904 1903 IStream_Release(pis); 1905 1904 1906 /* 1905 /* 1907 1906 * Invalidate the property by zeroing it's name member. 1908 1907 */ 1909 1908 propertyToDelete.sizeOfNameString = 0; 1910 1909 1911 /* 1910 /* 1912 1911 * Here we should re-read the property so we get the updated pointer 1913 1912 * but since we are here to zap it, I don't do it... 1914 1913 */ 1915 1914 StorageImpl_WriteProperty( 1916 parentStorage->ancestorStorage, 1915 parentStorage->ancestorStorage, 1917 1916 indexOfPropertyToDelete, 1918 1917 &propertyToDelete); … … 1943 1942 res = StorageImpl_ReadProperty( 1944 1943 storage->ancestorStorage, 1945 storePropertyIndex, 1944 storePropertyIndex, 1946 1945 &storeProperty); 1947 1946 … … 1957 1956 return findPlaceholder( 1958 1957 storage, 1959 propertyIndexToStore, 1958 propertyIndexToStore, 1960 1959 storeProperty.previousProperty, 1961 1960 typeOfRelation); … … 1972 1971 return findPlaceholder( 1973 1972 storage, 1974 propertyIndexToStore, 1973 propertyIndexToStore, 1975 1974 storeProperty.nextProperty, 1976 1975 typeOfRelation); … … 1980 1979 storeProperty.nextProperty = propertyIndexToStore; 1981 1980 } 1982 } 1981 } 1983 1982 else if (typeOfRelation == PROPERTY_RELATION_DIR) 1984 1983 { … … 1987 1986 return findPlaceholder( 1988 1987 storage, 1989 propertyIndexToStore, 1988 propertyIndexToStore, 1990 1989 storeProperty.dirProperty, 1991 1990 typeOfRelation); … … 1999 1998 hr = StorageImpl_WriteProperty( 2000 1999 storage->ancestorStorage, 2001 storePropertyIndex, 2000 storePropertyIndex, 2002 2001 &storeProperty); 2003 2002 … … 2014 2013 * Internal Method 2015 2014 * 2016 * This method takes the previous and the next property link of a property 2015 * This method takes the previous and the next property link of a property 2017 2016 * to be deleted and find them a place in the Storage. 2018 2017 */ 2019 static HRESULT adjustPropertyChain( 2018 static HRESULT adjustPropertyChain( 2020 2019 StorageImpl *This, 2021 2020 StgProperty propertyToDelete, … … 2031 2030 HRESULT hr = S_OK; 2032 2031 BOOL res = TRUE; 2033 2034 if (typeOfRelation == PROPERTY_RELATION_PREVIOUS) 2035 { 2036 if (propertyToDelete.previousProperty != PROPERTY_NULL) 2037 { 2038 /* 2032 2033 if (typeOfRelation == PROPERTY_RELATION_PREVIOUS) 2034 { 2035 if (propertyToDelete.previousProperty != PROPERTY_NULL) 2036 { 2037 /* 2039 2038 * Set the parent previous to the property to delete previous 2040 2039 */ 2041 2040 newLinkProperty = propertyToDelete.previousProperty; 2042 2041 2043 if (propertyToDelete.nextProperty != PROPERTY_NULL) 2042 if (propertyToDelete.nextProperty != PROPERTY_NULL) 2044 2043 { 2045 2044 /* 2046 * We also need to find a storage for the other link, setup variables 2045 * We also need to find a storage for the other link, setup variables 2047 2046 * to do this at the end... 2048 */ 2047 */ 2049 2048 needToFindAPlaceholder = TRUE; 2050 2049 storeNode = propertyToDelete.previousProperty; … … 2052 2051 relationType = PROPERTY_RELATION_NEXT; 2053 2052 } 2054 } 2055 else if (propertyToDelete.nextProperty != PROPERTY_NULL) 2056 { 2057 /* 2053 } 2054 else if (propertyToDelete.nextProperty != PROPERTY_NULL) 2055 { 2056 /* 2058 2057 * Set the parent previous to the property to delete next 2059 2058 */ 2060 2059 newLinkProperty = propertyToDelete.nextProperty; 2061 2060 } 2062 2063 /* 2061 2062 /* 2064 2063 * Link it for real... 2065 */ 2064 */ 2066 2065 parentProperty.previousProperty = newLinkProperty; 2067 2068 } 2069 else if (typeOfRelation == PROPERTY_RELATION_NEXT) 2070 { 2071 if (propertyToDelete.previousProperty != PROPERTY_NULL) 2072 { 2073 /* 2066 2067 } 2068 else if (typeOfRelation == PROPERTY_RELATION_NEXT) 2069 { 2070 if (propertyToDelete.previousProperty != PROPERTY_NULL) 2071 { 2072 /* 2074 2073 * Set the parent next to the property to delete next previous 2075 2074 */ 2076 2075 newLinkProperty = propertyToDelete.previousProperty; 2077 2078 if (propertyToDelete.nextProperty != PROPERTY_NULL) 2076 2077 if (propertyToDelete.nextProperty != PROPERTY_NULL) 2079 2078 { 2080 2079 /* 2081 * We also need to find a storage for the other link, setup variables 2080 * We also need to find a storage for the other link, setup variables 2082 2081 * to do this at the end... 2083 */ 2082 */ 2084 2083 needToFindAPlaceholder = TRUE; 2085 2084 storeNode = propertyToDelete.previousProperty; … … 2087 2086 relationType = PROPERTY_RELATION_NEXT; 2088 2087 } 2089 } 2090 else if (propertyToDelete.nextProperty != PROPERTY_NULL) 2091 { 2092 /* 2088 } 2089 else if (propertyToDelete.nextProperty != PROPERTY_NULL) 2090 { 2091 /* 2093 2092 * Set the parent next to the property to delete next 2094 2093 */ … … 2096 2095 } 2097 2096 2098 /* 2097 /* 2099 2098 * Link it for real... 2100 */ 2099 */ 2101 2100 parentProperty.nextProperty = newLinkProperty; 2102 } 2101 } 2103 2102 else /* (typeOfRelation == PROPERTY_RELATION_DIR) */ 2104 2103 { 2105 if (propertyToDelete.previousProperty != PROPERTY_NULL) 2106 { 2107 /* 2104 if (propertyToDelete.previousProperty != PROPERTY_NULL) 2105 { 2106 /* 2108 2107 * Set the parent dir to the property to delete previous 2109 2108 */ 2110 2109 newLinkProperty = propertyToDelete.previousProperty; 2111 2110 2112 if (propertyToDelete.nextProperty != PROPERTY_NULL) 2111 if (propertyToDelete.nextProperty != PROPERTY_NULL) 2113 2112 { 2114 2113 /* 2115 * We also need to find a storage for the other link, setup variables 2114 * We also need to find a storage for the other link, setup variables 2116 2115 * to do this at the end... 2117 */ 2116 */ 2118 2117 needToFindAPlaceholder = TRUE; 2119 2118 storeNode = propertyToDelete.previousProperty; … … 2121 2120 relationType = PROPERTY_RELATION_NEXT; 2122 2121 } 2123 } 2124 else if (propertyToDelete.nextProperty != PROPERTY_NULL) 2125 { 2126 /* 2122 } 2123 else if (propertyToDelete.nextProperty != PROPERTY_NULL) 2124 { 2125 /* 2127 2126 * Set the parent dir to the property to delete next 2128 2127 */ … … 2130 2129 } 2131 2130 2132 /* 2131 /* 2133 2132 * Link it for real... 2134 */ 2133 */ 2135 2134 parentProperty.dirProperty = newLinkProperty; 2136 2135 } 2137 2136 2138 /* 2139 * Write back the parent property 2137 /* 2138 * Write back the parent property 2140 2139 */ 2141 2140 res = StorageImpl_WriteProperty( 2142 This->ancestorStorage, 2141 This->ancestorStorage, 2143 2142 parentPropertyId, 2144 2143 &parentProperty); … … 2149 2148 2150 2149 /* 2151 * If a placeholder is required for the other link, then, find one and 2150 * If a placeholder is required for the other link, then, find one and 2152 2151 * get out of here... 2153 2152 */ 2154 if (needToFindAPlaceholder) 2153 if (needToFindAPlaceholder) 2155 2154 { 2156 2155 hr = findPlaceholder( 2157 This, 2158 toStoreNode, 2156 This, 2157 toStoreNode, 2159 2158 storeNode, 2160 2159 relationType); … … 2168 2167 * SetElementTimes (IStorage) 2169 2168 */ 2170 HRESULT WINAPI StorageImpl_SetElementTimes( 2169 HRESULT WINAPI StorageImpl_SetElementTimes( 2171 2170 IStorage* iface, 2172 const OLECHAR *pwcsName,/* [string][in] */ 2173 const FILETIME *pctime, /* [in] */ 2174 const FILETIME *patime, /* [in] */ 2175 const FILETIME *pmtime) /* [in] */ 2171 const OLECHAR *pwcsName,/* [string][in] */ 2172 const FILETIME *pctime, /* [in] */ 2173 const FILETIME *patime, /* [in] */ 2174 const FILETIME *pmtime) /* [in] */ 2176 2175 { 2177 2176 FIXME("(%s,...), stub!\n",debugstr_w(pwcsName)); … … 2182 2181 * SetStateBits (IStorage) 2183 2182 */ 2184 HRESULT WINAPI StorageImpl_SetStateBits( 2183 HRESULT WINAPI StorageImpl_SetStateBits( 2185 2184 IStorage* iface, 2186 DWORD grfStateBits,/* [in] */ 2187 DWORD grfMask) /* [in] */ 2185 DWORD grfStateBits,/* [in] */ 2186 DWORD grfMask) /* [in] */ 2188 2187 { 2189 2188 FIXME("not implemented!\n"); … … 2209 2208 2210 2209 memset(This, 0, sizeof(StorageImpl)); 2211 2210 2212 2211 /* 2213 2212 * Initialize the virtual function table. … … 2215 2214 ICOM_VTBL(This) = &Storage32Impl_Vtbl; 2216 2215 This->v_destructor = &StorageImpl_Destroy; 2217 2216 2218 2217 /* 2219 2218 * This is the top-level storage so initialize the ancestor pointer … … 2221 2220 */ 2222 2221 This->ancestorStorage = This; 2223 2222 2224 2223 /* 2225 2224 * Initialize the physical support of the storage. 2226 2225 */ 2227 2226 This->hFile = hFile; 2228 2227 2229 2228 /* 2230 2229 * Store copy of file path. 2231 2230 */ 2232 2231 if(pwcsName) { 2233 This->pwcsName = HeapAlloc(GetProcessHeap(), 0, 2232 This->pwcsName = HeapAlloc(GetProcessHeap(), 0, 2234 2233 (lstrlenW(pwcsName)+1)*sizeof(WCHAR)); 2235 2234 if (!This->pwcsName) 2236 2235 return STG_E_INSUFFICIENTMEMORY; 2237 strcpyW(This->pwcsName, pwcsName); 2236 strcpyW(This->pwcsName, pwcsName); 2238 2237 } 2239 2238 … … 2251 2250 if (This->bigBlockFile == 0) 2252 2251 return E_FAIL; 2253 2252 2254 2253 if (fileCreate) 2255 2254 { … … 2263 2262 * - There is no small block depot 2264 2263 */ 2265 memset( This->bigBlockDepotStart, 2266 BLOCK_UNUSED, 2264 memset( This->bigBlockDepotStart, 2265 BLOCK_UNUSED, 2267 2266 sizeof(This->bigBlockDepotStart)); 2268 2267 … … 2318 2317 */ 2319 2318 This->prevFreeBlock = 0; 2320 2319 2321 2320 /* 2322 2321 * Create the block chain abstractions. 2323 2322 */ 2324 This->rootBlockChain = 2323 This->rootBlockChain = 2325 2324 BlockChainStream_Construct(This, &This->rootStartBlock, PROPERTY_NULL); 2326 2325 2327 2326 This->smallBlockDepotChain = BlockChainStream_Construct( 2328 This, 2329 &This->smallBlockDepotStart, 2327 This, 2328 &This->smallBlockDepotStart, 2330 2329 PROPERTY_NULL); 2331 2330 2332 2331 /* 2333 * Write the root property 2332 * Write the root property 2334 2333 */ 2335 2334 if (fileCreate) … … 2358 2357 */ 2359 2358 currentPropertyIndex = 0; 2360 2359 2361 2360 do 2362 2361 { 2363 2362 readSuccessful = StorageImpl_ReadProperty( 2364 This, 2365 currentPropertyIndex, 2363 This, 2364 currentPropertyIndex, 2366 2365 ¤tProperty); 2367 2366 2368 2367 if (readSuccessful) 2369 2368 { … … 2376 2375 2377 2376 currentPropertyIndex++; 2378 2377 2379 2378 } while (readSuccessful && (This->rootPropertySetIndex == PROPERTY_NULL) ); 2380 2379 2381 2380 if (!readSuccessful) 2382 2381 { … … 2389 2388 */ 2390 2389 This->smallBlockRootChain = BlockChainStream_Construct( 2391 This, 2392 NULL, 2390 This, 2391 NULL, 2393 2392 This->rootPropertySetIndex); 2394 2393 2395 2394 return hr; 2396 2395 } … … 2928 2927 2929 2928 StorageUtl_ReadWord( 2930 headerBigBlock, 2931 OFFSET_BIGBLOCKSIZEBITS, 2929 headerBigBlock, 2930 OFFSET_BIGBLOCKSIZEBITS, 2932 2931 &This->bigBlockSizeBits); 2933 2932 2934 2933 StorageUtl_ReadWord( 2935 headerBigBlock, 2936 OFFSET_SMALLBLOCKSIZEBITS, 2934 headerBigBlock, 2935 OFFSET_SMALLBLOCKSIZEBITS, 2937 2936 &This->smallBlockSizeBits); 2938 2937 2939 2938 StorageUtl_ReadDWord( 2940 headerBigBlock, 2941 OFFSET_BBDEPOTCOUNT, 2939 headerBigBlock, 2940 OFFSET_BBDEPOTCOUNT, 2942 2941 &This->bigBlockDepotCount); 2943 2942 2944 2943 StorageUtl_ReadDWord( 2945 headerBigBlock, 2946 OFFSET_ROOTSTARTBLOCK, 2944 headerBigBlock, 2945 OFFSET_ROOTSTARTBLOCK, 2947 2946 &This->rootStartBlock); 2948 2947 2949 2948 StorageUtl_ReadDWord( 2950 headerBigBlock, 2951 OFFSET_SBDEPOTSTART, 2949 headerBigBlock, 2950 OFFSET_SBDEPOTSTART, 2952 2951 &This->smallBlockDepotStart); 2953 2952 2954 StorageUtl_ReadDWord( 2955 headerBigBlock, 2956 OFFSET_EXTBBDEPOTSTART, 2953 StorageUtl_ReadDWord( 2954 headerBigBlock, 2955 OFFSET_EXTBBDEPOTSTART, 2957 2956 &This->extBigBlockDepotStart); 2958 2957 2959 2958 StorageUtl_ReadDWord( 2960 headerBigBlock, 2961 OFFSET_EXTBBDEPOTCOUNT, 2959 headerBigBlock, 2960 OFFSET_EXTBBDEPOTCOUNT, 2962 2961 &This->extBigBlockDepotCount); 2963 2962 2964 2963 for (index = 0; index < COUNT_BBDEPOTINHEADER; index ++) 2965 2964 { 2966 2965 StorageUtl_ReadDWord( 2967 headerBigBlock, 2966 headerBigBlock, 2968 2967 OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index), 2969 2968 &(This->bigBlockDepotStart[index])); 2970 2969 } 2971 2970 2972 2971 /* 2973 2972 * Make the bitwise arithmetic to get the size of the blocks in bytes. … … 2983 2982 This->smallBlockSize = 0x000000001 >> (DWORD)This->smallBlockSizeBits; 2984 2983 } 2985 2986 /* 2987 * Right now, the code is making some assumptions about the size of the 2984 2985 /* 2986 * Right now, the code is making some assumptions about the size of the 2988 2987 * blocks, just make sure they are what we're expecting. 2989 2988 */ … … 2996 2995 else 2997 2996 hr = S_OK; 2998 2997 2999 2998 /* 3000 2999 * Release the block. … … 3002 3001 StorageImpl_ReleaseBigBlock(This, headerBigBlock); 3003 3002 } 3004 3003 3005 3004 return hr; 3006 3005 } … … 3022 3021 */ 3023 3022 success = StorageImpl_ReadBigBlock(This, -1, headerBigBlock); 3024 3023 3025 3024 /* 3026 3025 * If the block read failed, the file is probably new. … … 3032 3031 */ 3033 3032 memset(headerBigBlock, 0, BIG_BLOCK_SIZE); 3034 3033 3035 3034 /* 3036 3035 * Initialize the magic number. 3037 3036 */ 3038 3037 memcpy(headerBigBlock, STORAGE_magic, sizeof(STORAGE_magic)); 3039 3038 3040 3039 /* 3041 3040 * And a bunch of things we don't know what they mean … … 3047 3046 StorageUtl_WriteDWord(headerBigBlock, 0x40, (DWORD)0x0001); 3048 3047 } 3049 3048 3050 3049 /* 3051 3050 * Write the information to the header. … … 3054 3053 { 3055 3054 StorageUtl_WriteWord( 3056 headerBigBlock, 3057 OFFSET_BIGBLOCKSIZEBITS, 3055 headerBigBlock, 3056 OFFSET_BIGBLOCKSIZEBITS, 3058 3057 This->bigBlockSizeBits); 3059 3058 3060 3059 StorageUtl_WriteWord( 3061 headerBigBlock, 3062 OFFSET_SMALLBLOCKSIZEBITS, 3060 headerBigBlock, 3061 OFFSET_SMALLBLOCKSIZEBITS, 3063 3062 This->smallBlockSizeBits); 3064 3063 3065 3064 StorageUtl_WriteDWord( 3066 headerBigBlock, 3067 OFFSET_BBDEPOTCOUNT, 3065 headerBigBlock, 3066 OFFSET_BBDEPOTCOUNT, 3068 3067 This->bigBlockDepotCount); 3069 3068 3070 3069 StorageUtl_WriteDWord( 3071 headerBigBlock, 3072 OFFSET_ROOTSTARTBLOCK, 3070 headerBigBlock, 3071 OFFSET_ROOTSTARTBLOCK, 3073 3072 This->rootStartBlock); 3074 3073 3075 3074 StorageUtl_WriteDWord( 3076 headerBigBlock, 3077 OFFSET_SBDEPOTSTART, 3075 headerBigBlock, 3076 OFFSET_SBDEPOTSTART, 3078 3077 This->smallBlockDepotStart); 3079 3078 3080 3079 StorageUtl_WriteDWord( 3081 headerBigBlock, 3082 OFFSET_EXTBBDEPOTSTART, 3080 headerBigBlock, 3081 OFFSET_EXTBBDEPOTSTART, 3083 3082 This->extBigBlockDepotStart); 3084 3083 3085 3084 StorageUtl_WriteDWord( 3086 headerBigBlock, 3087 OFFSET_EXTBBDEPOTCOUNT, 3085 headerBigBlock, 3086 OFFSET_EXTBBDEPOTCOUNT, 3088 3087 This->extBigBlockDepotCount); 3089 3088 … … 3091 3090 { 3092 3091 StorageUtl_WriteDWord( 3093 headerBigBlock, 3092 headerBigBlock, 3094 3093 OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index), 3095 3094 (This->bigBlockDepotStart[index])); 3096 3095 } 3097 3096 } 3098 3097 3099 3098 /* 3100 3099 * Write the big block back to the file. … … 3120 3119 offsetInPropSet.s.HighPart = 0; 3121 3120 offsetInPropSet.s.LowPart = index * PROPSET_BLOCK_SIZE; 3122 3121 3123 3122 readSuccessful = BlockChainStream_ReadAt( 3124 3123 This->rootBlockChain, … … 3136 3135 memset(buffer->name, 0, sizeof(buffer->name)); 3137 3136 memcpy( 3138 buffer->name, 3139 propName, 3137 buffer->name, 3138 propName, 3140 3139 PROPERTY_NAME_BUFFER_LEN ); 3141 3140 TRACE("storage name: %s\n", debugstr_w(buffer->name)); 3142 3141 3143 3142 memcpy(&buffer->propertyType, currentProperty + OFFSET_PS_PROPERTYTYPE, 1); 3144 3143 3145 3144 StorageUtl_ReadWord( 3146 currentProperty, 3147 OFFSET_PS_NAMELENGTH, 3145 currentProperty, 3146 OFFSET_PS_NAMELENGTH, 3148 3147 &buffer->sizeOfNameString); 3149 3148 3150 3149 StorageUtl_ReadDWord( 3151 currentProperty, 3152 OFFSET_PS_PREVIOUSPROP, 3150 currentProperty, 3151 OFFSET_PS_PREVIOUSPROP, 3153 3152 &buffer->previousProperty); 3154 3153 3155 3154 StorageUtl_ReadDWord( 3156 currentProperty, 3157 OFFSET_PS_NEXTPROP, 3155 currentProperty, 3156 OFFSET_PS_NEXTPROP, 3158 3157 &buffer->nextProperty); 3159 3158 3160 3159 StorageUtl_ReadDWord( 3161 currentProperty, 3162 OFFSET_PS_DIRPROP, 3160 currentProperty, 3161 OFFSET_PS_DIRPROP, 3163 3162 &buffer->dirProperty); 3164 3163 3165 3164 StorageUtl_ReadGUID( 3166 currentProperty, 3167 OFFSET_PS_GUID, 3165 currentProperty, 3166 OFFSET_PS_GUID, 3168 3167 &buffer->propertyUniqueID); 3169 3168 3170 3169 StorageUtl_ReadDWord( 3171 currentProperty, 3172 OFFSET_PS_TSS1, 3170 currentProperty, 3171 OFFSET_PS_TSS1, 3173 3172 &buffer->timeStampS1); 3174 3173 3175 3174 StorageUtl_ReadDWord( 3176 currentProperty, 3177 OFFSET_PS_TSD1, 3175 currentProperty, 3176 OFFSET_PS_TSD1, 3178 3177 &buffer->timeStampD1); 3179 3178 3180 3179 StorageUtl_ReadDWord( 3181 currentProperty, 3182 OFFSET_PS_TSS2, 3180 currentProperty, 3181 OFFSET_PS_TSS2, 3183 3182 &buffer->timeStampS2); 3184 3183 3185 3184 StorageUtl_ReadDWord( 3186 currentProperty, 3187 OFFSET_PS_TSD2, 3185 currentProperty, 3186 OFFSET_PS_TSD2, 3188 3187 &buffer->timeStampD2); 3189 3188 3190 3189 StorageUtl_ReadDWord( 3191 currentProperty, 3192 OFFSET_PS_STARTBLOCK, 3190 currentProperty, 3191 OFFSET_PS_STARTBLOCK, 3193 3192 &buffer->startingBlock); 3194 3193 3195 3194 StorageUtl_ReadDWord( 3196 currentProperty, 3197 OFFSET_PS_SIZE, 3195 currentProperty, 3196 OFFSET_PS_SIZE, 3198 3197 &buffer->size.s.LowPart); 3199 3198 … … 3223 3222 3224 3223 memcpy( 3225 currentProperty + OFFSET_PS_NAME, 3226 buffer->name, 3224 currentProperty + OFFSET_PS_NAME, 3225 buffer->name, 3227 3226 PROPERTY_NAME_BUFFER_LEN ); 3228 3227 … … 3230 3229 3231 3230 StorageUtl_WriteWord( 3232 currentProperty, 3233 OFFSET_PS_NAMELENGTH, 3231 currentProperty, 3232 OFFSET_PS_NAMELENGTH, 3234 3233 buffer->sizeOfNameString); 3235 3234 3236 3235 StorageUtl_WriteDWord( 3237 currentProperty, 3238 OFFSET_PS_PREVIOUSPROP, 3236 currentProperty, 3237 OFFSET_PS_PREVIOUSPROP, 3239 3238 buffer->previousProperty); 3240 3239 3241 3240 StorageUtl_WriteDWord( 3242 currentProperty, 3243 OFFSET_PS_NEXTPROP, 3241 currentProperty, 3242 OFFSET_PS_NEXTPROP, 3244 3243 buffer->nextProperty); 3245 3244 3246 3245 StorageUtl_WriteDWord( 3247 currentProperty, 3248 OFFSET_PS_DIRPROP, 3246 currentProperty, 3247 OFFSET_PS_DIRPROP, 3249 3248 buffer->dirProperty); 3250 3249 3251 3250 StorageUtl_WriteGUID( 3252 currentProperty, 3253 OFFSET_PS_GUID, 3251 currentProperty, 3252 OFFSET_PS_GUID, 3254 3253 &buffer->propertyUniqueID); 3255 3254 3256 3255 StorageUtl_WriteDWord( 3257 currentProperty, 3258 OFFSET_PS_TSS1, 3256 currentProperty, 3257 OFFSET_PS_TSS1, 3259 3258 buffer->timeStampS1); 3260 3259 3261 3260 StorageUtl_WriteDWord( 3262 currentProperty, 3263 OFFSET_PS_TSD1, 3261 currentProperty, 3262 OFFSET_PS_TSD1, 3264 3263 buffer->timeStampD1); 3265 3264 3266 3265 StorageUtl_WriteDWord( 3267 currentProperty, 3268 OFFSET_PS_TSS2, 3266 currentProperty, 3267 OFFSET_PS_TSS2, 3269 3268 buffer->timeStampS2); 3270 3269 3271 3270 StorageUtl_WriteDWord( 3272 currentProperty, 3273 OFFSET_PS_TSD2, 3271 currentProperty, 3272 OFFSET_PS_TSD2, 3274 3273 buffer->timeStampD2); 3275 3274 3276 3275 StorageUtl_WriteDWord( 3277 currentProperty, 3278 OFFSET_PS_STARTBLOCK, 3276 currentProperty, 3277 OFFSET_PS_STARTBLOCK, 3279 3278 buffer->startingBlock); 3280 3279 3281 3280 StorageUtl_WriteDWord( 3282 currentProperty, 3283 OFFSET_PS_SIZE, 3281 currentProperty, 3282 OFFSET_PS_SIZE, 3284 3283 buffer->size.s.LowPart); 3285 3284 … … 3327 3326 3328 3327 StorageImpl_ReleaseBigBlock(This, bigBlockBuffer); 3329 3328 3330 3329 return TRUE; 3331 3330 } 3332 3331 3333 3332 return FALSE; 3334 3333 } … … 3460 3459 3461 3460 StorageInternalImpl* StorageInternalImpl_Construct( 3462 StorageImpl* ancestorStorage, 3461 StorageImpl* ancestorStorage, 3463 3462 ULONG rootPropertyIndex) 3464 3463 { … … 3511 3510 ** does nothing. 3512 3511 */ 3513 HRESULT WINAPI StorageInternalImpl_Commit( 3512 HRESULT WINAPI StorageInternalImpl_Commit( 3514 3513 IStorage* iface, 3515 DWORD grfCommitFlags) /* [in] */ 3514 DWORD grfCommitFlags) /* [in] */ 3516 3515 { 3517 3516 return S_OK; 3518 3517 } 3519 3518 3520 3519 /****************************************************************************** 3521 3520 ** … … 3525 3524 ** does nothing. 3526 3525 */ 3527 HRESULT WINAPI StorageInternalImpl_Revert( 3526 HRESULT WINAPI StorageInternalImpl_Revert( 3528 3527 IStorage* iface) 3529 3528 { … … 3542 3541 3543 3542 newEnumeration = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumSTATSTGImpl)); 3544 3543 3545 3544 if (newEnumeration!=0) 3546 3545 { … … 3550 3549 ICOM_VTBL(newEnumeration) = &IEnumSTATSTGImpl_Vtbl; 3551 3550 newEnumeration->ref = 0; 3552 3551 3553 3552 /* 3554 3553 * We want to nail-down the reference to the storage in case the … … 3557 3556 newEnumeration->parentStorage = parentStorage; 3558 3557 IStorage_AddRef((IStorage*)newEnumeration->parentStorage); 3559 3558 3560 3559 newEnumeration->firstPropertyNode = firstPropertyNode; 3561 3560 3562 3561 /* 3563 3562 * Initialize the search stack … … 3565 3564 newEnumeration->stackSize = 0; 3566 3565 newEnumeration->stackMaxSize = ENUMSTATSGT_SIZE_INCREMENT; 3567 newEnumeration->stackToVisit = 3566 newEnumeration->stackToVisit = 3568 3567 HeapAlloc(GetProcessHeap(), 0, sizeof(ULONG)*ENUMSTATSGT_SIZE_INCREMENT); 3569 3568 3570 3569 /* 3571 3570 * Make sure the current node of the iterator is the first one. … … 3573 3572 IEnumSTATSTGImpl_Reset((IEnumSTATSTG*)newEnumeration); 3574 3573 } 3575 3574 3576 3575 return newEnumeration; 3577 3576 } … … 3605 3604 * Compare the riid with the interface IDs implemented by this object. 3606 3605 */ 3607 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 3606 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 3608 3607 { 3609 3608 *ppvObject = (IEnumSTATSTG*)This; 3610 3609 } 3611 else if (memcmp(&IID_IStorage, riid, sizeof(IID_IEnumSTATSTG)) == 0) 3610 else if (memcmp(&IID_IStorage, riid, sizeof(IID_IEnumSTATSTG)) == 0) 3612 3611 { 3613 3612 *ppvObject = (IEnumSTATSTG*)This; … … 3628 3627 return S_OK; 3629 3628 } 3630 3629 3631 3630 ULONG WINAPI IEnumSTATSTGImpl_AddRef( 3632 3631 IEnumSTATSTG* iface) … … 3637 3636 return This->ref; 3638 3637 } 3639 3638 3640 3639 ULONG WINAPI IEnumSTATSTGImpl_Release( 3641 3640 IEnumSTATSTG* iface) … … 3656 3655 } 3657 3656 3658 return newRef; ;3657 return newRef; 3659 3658 } 3660 3659 … … 3676 3675 */ 3677 3676 if ( (rgelt==0) || ( (celt!=1) && (pceltFetched==0) ) ) 3678 return E_INVALIDARG; 3679 3677 return E_INVALIDARG; 3678 3680 3679 /* 3681 3680 * To avoid the special case, get another pointer to a ULONG value if … … 3684 3683 if (pceltFetched==0) 3685 3684 pceltFetched = &objectFetched; 3686 3685 3687 3686 /* 3688 3687 * Start the iteration, we will iterate until we hit the end of the … … 3696 3695 currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE); 3697 3696 3698 while ( ( *pceltFetched < celt) && 3697 while ( ( *pceltFetched < celt) && 3699 3698 ( currentSearchNode!=PROPERTY_NULL) ) 3700 3699 { 3701 /* 3700 /* 3702 3701 * Remove the top node from the stack 3703 3702 */ … … 3708 3707 */ 3709 3708 StorageImpl_ReadProperty(This->parentStorage, 3710 currentSearchNode, 3709 currentSearchNode, 3711 3710 ¤tProperty); 3712 3711 … … 3717 3716 ¤tProperty, 3718 3717 STATFLAG_DEFAULT); 3719 3718 3720 3719 /* 3721 3720 * Step to the next item in the iteration … … 3741 3740 } 3742 3741 3743 3742 3744 3743 HRESULT WINAPI IEnumSTATSTGImpl_Skip( 3745 3744 IEnumSTATSTG* iface, … … 3757 3756 currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE); 3758 3757 3759 while ( (objectFetched < celt) && 3758 while ( (objectFetched < celt) && 3760 3759 (currentSearchNode!=PROPERTY_NULL) ) 3761 3760 { 3762 /* 3761 /* 3763 3762 * Remove the top node from the stack 3764 3763 */ … … 3769 3768 */ 3770 3769 StorageImpl_ReadProperty(This->parentStorage, 3771 currentSearchNode, 3770 currentSearchNode, 3772 3771 ¤tProperty); 3773 3772 3774 3773 /* 3775 3774 * Step to the next item in the iteration … … 3793 3792 return S_FALSE; 3794 3793 } 3795 3794 3796 3795 HRESULT WINAPI IEnumSTATSTGImpl_Reset( 3797 3796 IEnumSTATSTG* iface) … … 3812 3811 readSuccessful = StorageImpl_ReadProperty( 3813 3812 This->parentStorage, 3814 This->firstPropertyNode, 3813 This->firstPropertyNode, 3815 3814 &rootProperty); 3816 3815 … … 3827 3826 return S_OK; 3828 3827 } 3829 3828 3830 3829 HRESULT WINAPI IEnumSTATSTGImpl_Clone( 3831 3830 IEnumSTATSTG* iface, … … 3841 3840 if (ppenum==0) 3842 3841 return E_INVALIDARG; 3843 3842 3844 3843 newClone = IEnumSTATSTGImpl_Construct(This->parentStorage, 3845 3844 This->firstPropertyNode); 3846 3845 3847 3846 3848 3847 /* 3849 3848 * The new clone enumeration must point to the same current node as … … 3852 3851 newClone->stackSize = This->stackSize ; 3853 3852 newClone->stackMaxSize = This->stackMaxSize ; 3854 newClone->stackToVisit = 3853 newClone->stackToVisit = 3855 3854 HeapAlloc(GetProcessHeap(), 0, sizeof(ULONG) * newClone->stackMaxSize); 3856 3855 3857 3856 memcpy( 3858 newClone->stackToVisit, 3859 This->stackToVisit, 3857 newClone->stackToVisit, 3858 This->stackToVisit, 3860 3859 sizeof(ULONG) * newClone->stackSize); 3861 3860 … … 3873 3872 INT IEnumSTATSTGImpl_FindParentProperty( 3874 3873 IEnumSTATSTGImpl *This, 3875 ULONG childProperty, 3874 ULONG childProperty, 3876 3875 StgProperty *currentProperty, 3877 3876 ULONG *thisNodeId) … … 3891 3890 */ 3892 3891 currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE); 3893 3892 3894 3893 3895 3894 while (currentSearchNode!=PROPERTY_NULL) … … 3900 3899 *thisNodeId = currentSearchNode; 3901 3900 3902 /* 3901 /* 3903 3902 * Remove the top node from the stack 3904 3903 */ … … 3910 3909 StorageImpl_ReadProperty( 3911 3910 This->parentStorage, 3912 currentSearchNode, 3911 currentSearchNode, 3913 3912 currentProperty); 3914 3913 3915 3914 if (currentProperty->previousProperty == childProperty) 3916 3915 return PROPERTY_RELATION_PREVIOUS; 3917 3916 3918 else if (currentProperty->nextProperty == childProperty) 3917 else if (currentProperty->nextProperty == childProperty) 3919 3918 return PROPERTY_RELATION_NEXT; 3920 3919 3921 3920 else if (currentProperty->dirProperty == childProperty) 3922 3921 return PROPERTY_RELATION_DIR; 3923 3922 3924 3923 /* 3925 3924 * Push the next search node in the search stack. … … 3950 3949 while (currentSearchNode!=PROPERTY_NULL) 3951 3950 { 3952 /* 3951 /* 3953 3952 * Remove the top node from the stack 3954 3953 */ … … 3959 3958 */ 3960 3959 StorageImpl_ReadProperty(This->parentStorage, 3961 currentSearchNode, 3960 currentSearchNode, 3962 3961 currentProperty); 3963 3962 3964 3963 if ( propertyNameCmp( 3965 (OLECHAR*)currentProperty->name, 3964 (OLECHAR*)currentProperty->name, 3966 3965 (OLECHAR*)lpszPropName) == 0) 3967 3966 return currentSearchNode; … … 4002 4001 4003 4002 This->stackToVisit = HeapReAlloc( 4004 GetProcessHeap(), 4003 GetProcessHeap(), 4005 4004 0, 4006 4005 This->stackToVisit, … … 4016 4015 readSuccessful = StorageImpl_ReadProperty( 4017 4016 This->parentStorage, 4018 nodeToPush, 4017 nodeToPush, 4019 4018 &rootProperty); 4020 4019 … … 4103 4102 else 4104 4103 { 4105 destination->pwcsName = 4104 destination->pwcsName = 4106 4105 CoTaskMemAlloc((lstrlenW(source->name)+1)*sizeof(WCHAR)); 4107 4106 4108 4107 strcpyW((LPWSTR)destination->pwcsName, source->name); 4109 4108 } 4110 4109 4111 4110 switch (source->propertyType) 4112 4111 { … … 4120 4119 default: 4121 4120 destination->type = STGTY_STREAM; 4122 break; 4121 break; 4123 4122 } 4124 4123 4125 4124 destination->cbSize = source->size; 4126 /* 4125 /* 4127 4126 currentReturnStruct->mtime = {0}; TODO 4128 4127 currentReturnStruct->ctime = {0}; 4129 currentReturnStruct->atime = {0}; 4128 currentReturnStruct->atime = {0}; 4130 4129 */ 4131 4130 destination->grfMode = 0; 4132 destination->grfLocksSupported = 0; 4131 destination->grfLocksSupported = 0; 4133 4132 destination->clsid = source->propertyUniqueID; 4134 destination->grfStateBits = 0; 4135 destination->reserved = 0; 4133 destination->grfStateBits = 0; 4134 destination->reserved = 0; 4136 4135 } 4137 4136 … … 4141 4140 4142 4141 BlockChainStream* BlockChainStream_Construct( 4143 StorageImpl* parentStorage, 4142 StorageImpl* parentStorage, 4144 4143 ULONG* headOfStreamPlaceHolder, 4145 4144 ULONG propertyIndex) … … 4214 4213 * Returns the number of blocks that comprises this chain. 4215 4214 * This is not the size of the stream as the last block may not be full! 4216 * 4215 * 4217 4216 */ 4218 4217 ULONG BlockChainStream_GetCount(BlockChainStream* This) … … 4228 4227 4229 4228 blockIndex = StorageImpl_GetNextBlockInChain( 4230 This->parentStorage, 4229 This->parentStorage, 4231 4230 blockIndex); 4232 4231 } … … 4236 4235 4237 4236 /****************************************************************************** 4238 * BlockChainStream_ReadAt 4237 * BlockChainStream_ReadAt 4239 4238 * 4240 4239 * Reads a specified number of bytes from this chain at the specified offset. … … 4276 4275 while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) 4277 4276 { 4278 blockIndex = 4277 blockIndex = 4279 4278 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4280 4279 4281 4280 blockNoInSequence--; 4282 4281 } … … 4289 4288 *bytesRead = 0; 4290 4289 bufferWalker = buffer; 4291 4290 4292 4291 while ( (size > 0) && (blockIndex != BLOCK_END_OF_CHAIN) ) 4293 4292 { … … 4295 4294 * Calculate how many bytes we can copy from this big block. 4296 4295 */ 4297 bytesToReadInBuffer = 4296 bytesToReadInBuffer = 4298 4297 min(This->parentStorage->bigBlockSize - offsetInBlock, size); 4299 4298 4300 4299 /* 4301 4300 * Copy those bytes to the buffer 4302 4301 */ 4303 bigBlockBuffer = 4302 bigBlockBuffer = 4304 4303 StorageImpl_GetROBigBlock(This->parentStorage, blockIndex); 4305 4304 4306 4305 memcpy(bufferWalker, bigBlockBuffer + offsetInBlock, bytesToReadInBuffer); 4307 4306 4308 4307 StorageImpl_ReleaseBigBlock(This->parentStorage, bigBlockBuffer); 4309 4308 4310 4309 /* 4311 4310 * Step to the next big block. 4312 4311 */ 4313 blockIndex = 4312 blockIndex = 4314 4313 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4315 4314 … … 4320 4319 4321 4320 } 4322 4321 4323 4322 return (size == 0); 4324 4323 } … … 4365 4364 while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) 4366 4365 { 4367 blockIndex = 4366 blockIndex = 4368 4367 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4369 4368 4370 4369 blockNoInSequence--; 4371 4370 } … … 4385 4384 * Calculate how many bytes we can copy from this big block. 4386 4385 */ 4387 bytesToWrite = 4386 bytesToWrite = 4388 4387 min(This->parentStorage->bigBlockSize - offsetInBlock, size); 4389 4388 4390 4389 /* 4391 4390 * Copy those bytes to the buffer 4392 4391 */ 4393 4392 bigBlockBuffer = StorageImpl_GetBigBlock(This->parentStorage, blockIndex); 4394 4393 4395 4394 memcpy(bigBlockBuffer + offsetInBlock, bufferWalker, bytesToWrite); 4396 4395 4397 4396 StorageImpl_ReleaseBigBlock(This->parentStorage, bigBlockBuffer); 4398 4397 4399 4398 /* 4400 4399 * Step to the next big block. 4401 4400 */ 4402 blockIndex = 4401 blockIndex = 4403 4402 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4404 4403 … … 4408 4407 offsetInBlock = 0; /* There is no offset on the next block */ 4409 4408 } 4410 4409 4411 4410 return (size == 0); 4412 4411 } … … 4445 4444 while (count < numBlocks) 4446 4445 { 4447 blockIndex = 4446 blockIndex = 4448 4447 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4449 4448 … … 4452 4451 4453 4452 /* Get the next block before marking the new end */ 4454 extraBlock = 4453 extraBlock = 4455 4454 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4456 4455 4457 4456 /* Mark the new end of chain */ 4458 4457 StorageImpl_SetNextBlockInChain( 4459 This->parentStorage, 4460 blockIndex, 4458 This->parentStorage, 4459 blockIndex, 4461 4460 BLOCK_END_OF_CHAIN); 4462 4461 … … 4469 4468 while (extraBlock != BLOCK_END_OF_CHAIN) 4470 4469 { 4471 blockIndex = 4470 blockIndex = 4472 4471 StorageImpl_GetNextBlockInChain(This->parentStorage, extraBlock); 4473 4472 … … 4513 4512 4514 4513 StorageImpl_ReadProperty( 4515 This->parentStorage, 4514 This->parentStorage, 4516 4515 This->ownerPropertyIndex, 4517 4516 &chainProp); 4518 4517 4519 chainProp.startingBlock = blockIndex; 4518 chainProp.startingBlock = blockIndex; 4520 4519 4521 4520 StorageImpl_WriteProperty( 4522 This->parentStorage, 4521 This->parentStorage, 4523 4522 This->ownerPropertyIndex, 4524 4523 &chainProp); … … 4569 4568 4570 4569 StorageImpl_SetNextBlockInChain( 4571 This->parentStorage, 4572 currentBlock, 4570 This->parentStorage, 4571 currentBlock, 4573 4572 blockIndex); 4574 4573 4575 4574 StorageImpl_SetNextBlockInChain( 4576 This->parentStorage, 4577 blockIndex, 4575 This->parentStorage, 4576 blockIndex, 4578 4577 BLOCK_END_OF_CHAIN); 4579 4578 … … 4597 4596 * TODO: Free the actual blocks in the file when we shrink the chain. 4598 4597 * Currently, the blocks are still in the file. So the file size 4599 * doesn't shrink even if we shrink streams. 4598 * doesn't shrink even if we shrink streams. 4600 4599 */ 4601 4600 BOOL BlockChainStream_SetSize( … … 4614 4613 else 4615 4614 { 4616 ULARGE_INTEGER fileSize = 4615 ULARGE_INTEGER fileSize = 4617 4616 BIGBLOCKFILE_GetSize(This->parentStorage->bigBlockFile); 4618 4617 … … 4623 4622 */ 4624 4623 if ((diff % This->parentStorage->bigBlockSize) != 0) 4625 diff += (This->parentStorage->bigBlockSize - 4624 diff += (This->parentStorage->bigBlockSize - 4626 4625 (diff % This->parentStorage->bigBlockSize) ); 4627 4626 … … 4647 4646 if(This->headOfStreamPlaceHolder == NULL) 4648 4647 { 4649 /* 4650 * This chain is a data stream read the property and return 4648 /* 4649 * This chain is a data stream read the property and return 4651 4650 * the appropriate size 4652 4651 */ … … 4661 4660 { 4662 4661 /* 4663 * this chain is a chain that does not have a property, figure out the 4664 * size by making the product number of used blocks times the 4662 * this chain is a chain that does not have a property, figure out the 4663 * size by making the product number of used blocks times the 4665 4664 * size of them 4666 4665 */ … … 4668 4667 result.s.HighPart = 0; 4669 4668 4670 result.s.LowPart = 4671 BlockChainStream_GetCount(This) * 4669 result.s.LowPart = 4670 BlockChainStream_GetCount(This) * 4672 4671 This->parentStorage->bigBlockSize; 4673 4672 … … 4681 4680 4682 4681 SmallBlockChainStream* SmallBlockChainStream_Construct( 4683 StorageImpl* parentStorage, 4682 StorageImpl* parentStorage, 4684 4683 ULONG propertyIndex) 4685 4684 { … … 4732 4731 * 4733 4732 * Returns the index of the next small block in this chain. 4734 * 4733 * 4735 4734 * Return Values: 4736 4735 * - BLOCK_END_OF_CHAIN: end of this chain … … 4859 4858 else 4860 4859 { 4861 ULONG count = 4860 ULONG count = 4862 4861 BlockChainStream_GetCount(This->parentStorage->smallBlockDepotChain); 4863 4862 … … 4870 4869 { 4871 4870 sbdIndex = nextBlock; 4872 nextBlock = 4871 nextBlock = 4873 4872 StorageImpl_GetNextBlockInChain(This->parentStorage, sbdIndex); 4874 4873 } … … 4877 4876 if (sbdIndex != BLOCK_END_OF_CHAIN) 4878 4877 StorageImpl_SetNextBlockInChain( 4879 This->parentStorage, 4880 sbdIndex, 4878 This->parentStorage, 4879 sbdIndex, 4881 4880 newsbdIndex); 4882 4881 4883 4882 StorageImpl_SetNextBlockInChain( 4884 This->parentStorage, 4885 newsbdIndex, 4883 This->parentStorage, 4884 newsbdIndex, 4886 4885 BLOCK_END_OF_CHAIN); 4887 4886 … … 4889 4888 * Initialize all the small blocks to free 4890 4889 */ 4891 smallBlockDepot = 4890 smallBlockDepot = 4892 4891 StorageImpl_GetBigBlock(This->parentStorage, newsbdIndex); 4893 4892 … … 4901 4900 */ 4902 4901 StgProperty rootProp; 4903 ULONG sbStartIndex; 4902 ULONG sbStartIndex; 4904 4903 4905 4904 /* … … 4910 4909 4911 4910 /* 4912 * And allocate the first big block that will contain small blocks 4911 * And allocate the first big block that will contain small blocks 4913 4912 */ 4914 sbStartIndex = 4913 sbStartIndex = 4915 4914 StorageImpl_GetNextFreeBigBlock(This->parentStorage); 4916 4915 4917 4916 StorageImpl_SetNextBlockInChain( 4918 This->parentStorage, 4919 sbStartIndex, 4917 This->parentStorage, 4918 sbStartIndex, 4920 4919 BLOCK_END_OF_CHAIN); 4921 4920 4922 4921 StorageImpl_ReadProperty( 4923 This->parentStorage, 4924 This->parentStorage->rootPropertySetIndex, 4922 This->parentStorage, 4923 This->parentStorage->rootPropertySetIndex, 4925 4924 &rootProp); 4926 4925 … … 4930 4929 4931 4930 StorageImpl_WriteProperty( 4932 This->parentStorage, 4933 This->parentStorage->rootPropertySetIndex, 4931 This->parentStorage, 4932 This->parentStorage->rootPropertySetIndex, 4934 4933 &rootProp); 4935 4934 } … … 4937 4936 } 4938 4937 4939 smallBlocksPerBigBlock = 4938 smallBlocksPerBigBlock = 4940 4939 This->parentStorage->bigBlockSize / This->parentStorage->smallBlockSize; 4941 4940 … … 4949 4948 4950 4949 StorageImpl_ReadProperty( 4951 This->parentStorage, 4952 This->parentStorage->rootPropertySetIndex, 4950 This->parentStorage, 4951 This->parentStorage->rootPropertySetIndex, 4953 4952 &rootProp); 4954 4953 4955 if (rootProp.size.s.LowPart < 4954 if (rootProp.size.s.LowPart < 4956 4955 (blocksRequired * This->parentStorage->bigBlockSize)) 4957 4956 { … … 4959 4958 4960 4959 BlockChainStream_SetSize( 4961 This->parentStorage->smallBlockRootChain, 4960 This->parentStorage->smallBlockRootChain, 4962 4961 rootProp.size); 4963 4962 4964 4963 StorageImpl_WriteProperty( 4965 This->parentStorage, 4966 This->parentStorage->rootPropertySetIndex, 4964 This->parentStorage, 4965 This->parentStorage->rootPropertySetIndex, 4967 4966 &rootProp); 4968 4967 } … … 4977 4976 * Reads a specified number of bytes from this chain at the specified offset. 4978 4977 * bytesRead may be NULL. 4979 * Failure will be returned if the specified number of bytes has not been read. 4978 * Failure will be returned if the specified number of bytes has not been read. 4980 4979 */ 4981 4980 BOOL SmallBlockChainStream_ReadAt( … … 4987 4986 { 4988 4987 ULARGE_INTEGER offsetInBigBlockFile; 4989 ULONG blockNoInSequence = 4988 ULONG blockNoInSequence = 4990 4989 offset.s.LowPart / This->parentStorage->smallBlockSize; 4991 4990 … … 5024 5023 * Calculate how many bytes we can copy from this small block. 5025 5024 */ 5026 bytesToReadInBuffer = 5025 bytesToReadInBuffer = 5027 5026 min(This->parentStorage->smallBlockSize - offsetInBlock, size); 5028 5027 … … 5031 5030 */ 5032 5031 offsetInBigBlockFile.s.HighPart = 0; 5033 offsetInBigBlockFile.s.LowPart = 5032 offsetInBigBlockFile.s.LowPart = 5034 5033 blockIndex * This->parentStorage->smallBlockSize; 5035 5034 … … 5075 5074 { 5076 5075 ULARGE_INTEGER offsetInBigBlockFile; 5077 ULONG blockNoInSequence = 5076 ULONG blockNoInSequence = 5078 5077 offset.s.LowPart / This->parentStorage->smallBlockSize; 5079 5078 … … 5083 5082 ULONG bytesWrittenFromBigBlockFile; 5084 5083 BYTE* bufferWalker; 5085 5084 5086 5085 /* 5087 5086 * This should never happen on a small block file. 5088 5087 */ 5089 5088 assert(offset.s.HighPart==0); 5090 5089 5091 5090 /* 5092 5091 * Find the first block in the stream that contains part of the buffer. 5093 5092 */ 5094 5093 blockIndex = SmallBlockChainStream_GetHeadOfChain(This); 5095 5094 5096 5095 while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) 5097 5096 { 5098 5097 blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); 5099 5098 5100 5099 blockNoInSequence--; 5101 5100 } 5102 5101 5103 5102 /* 5104 5103 * Start writing the buffer. … … 5114 5113 * Calculate how many bytes we can copy to this small block. 5115 5114 */ 5116 bytesToWriteInBuffer = 5115 bytesToWriteInBuffer = 5117 5116 min(This->parentStorage->smallBlockSize - offsetInBlock, size); 5118 5117 5119 5118 /* 5120 5119 * Calculate the offset of the small block in the small block file. 5121 5120 */ 5122 5121 offsetInBigBlockFile.s.HighPart = 0; 5123 offsetInBigBlockFile.s.LowPart = 5122 offsetInBigBlockFile.s.LowPart = 5124 5123 blockIndex * This->parentStorage->smallBlockSize; 5125 5124 5126 5125 offsetInBigBlockFile.s.LowPart += offsetInBlock; 5127 5126 5128 5127 /* 5129 5128 * Write those bytes in the buffer to the small block file. … … 5134 5133 bufferWalker, 5135 5134 &bytesWrittenFromBigBlockFile); 5136 5135 5137 5136 assert(bytesWrittenFromBigBlockFile == bytesToWriteInBuffer); 5138 5137 5139 5138 /* 5140 5139 * Step to the next big block. … … 5146 5145 offsetInBlock = 0; /* There is no offset on the next block */ 5147 5146 } 5148 5147 5149 5148 return (size == 0); 5150 5149 } … … 5153 5152 * SmallBlockChainStream_Shrink 5154 5153 * 5155 * Shrinks this chain in the small block depot. 5154 * Shrinks this chain in the small block depot. 5156 5155 */ 5157 5156 BOOL SmallBlockChainStream_Shrink( … … 5181 5180 /* 5182 5181 * If the count is 0, we have a special case, the head of the chain was 5183 * just freed. 5182 * just freed. 5184 5183 */ 5185 5184 if (count == 0) … … 5187 5186 StgProperty chainProp; 5188 5187 5189 StorageImpl_ReadProperty(This->parentStorage, 5188 StorageImpl_ReadProperty(This->parentStorage, 5190 5189 This->ownerPropertyIndex, 5191 5190 &chainProp); … … 5209 5208 /* Mark the new end of chain */ 5210 5209 SmallBlockChainStream_SetNextBlockInChain( 5211 This, 5212 blockIndex, 5210 This, 5211 blockIndex, 5213 5212 BLOCK_END_OF_CHAIN); 5214 5213 } … … 5224 5223 } 5225 5224 5226 return TRUE; 5225 return TRUE; 5227 5226 } 5228 5227 … … 5260 5259 blockIndex = chainProp.startingBlock; 5261 5260 SmallBlockChainStream_SetNextBlockInChain( 5262 This, 5263 blockIndex, 5261 This, 5262 blockIndex, 5264 5263 BLOCK_END_OF_CHAIN); 5265 5264 } … … 5294 5293 5295 5294 SmallBlockChainStream_SetNextBlockInChain( 5296 This, 5297 blockIndex, 5295 This, 5296 blockIndex, 5298 5297 BLOCK_END_OF_CHAIN); 5299 5298 … … 5336 5335 * TODO: Free the actual blocks in the file when we shrink the chain. 5337 5336 * Currently, the blocks are still in the file. So the file size 5338 * doesn't shrink even if we shrink streams. 5337 * doesn't shrink even if we shrink streams. 5339 5338 */ 5340 5339 BOOL SmallBlockChainStream_SetSize( … … 5394 5393 WCHAR tempFileName[MAX_PATH]; 5395 5394 5396 TRACE("(%s, %lx, %ld, %p)\n", 5397 debugstr_w(pwcsName), grfMode, 5395 TRACE("(%s, %lx, %ld, %p)\n", 5396 debugstr_w(pwcsName), grfMode, 5398 5397 reserved, ppstgOpen); 5399 5398 … … 5442 5441 5443 5442 /* 5444 * Interpret the STGM value grfMode 5443 * Interpret the STGM value grfMode 5445 5444 */ 5446 5445 shareMode = GetShareModeFromSTGM(grfMode); … … 5467 5466 fileAttributes, 5468 5467 0); 5469 5468 5470 5469 if (hFile == INVALID_HANDLE_VALUE) 5471 5470 { … … 5477 5476 */ 5478 5477 newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl)); 5479 5478 5480 5479 if (newStorage == 0) 5481 5480 return STG_E_INSUFFICIENTMEMORY; … … 5489 5488 TRUE, 5490 5489 TRUE); 5491 5490 5492 5491 if (FAILED(hr)) 5493 5492 { … … 5515 5514 DWORD grfMode, 5516 5515 SNB snbExclude, 5517 DWORD reserved, 5516 DWORD reserved, 5518 5517 IStorage **ppstgOpen) 5519 5518 { … … 5526 5525 DWORD length; 5527 5526 5528 TRACE("(%s, %p, %lx, %p, %ld, %p)\n", 5527 TRACE("(%s, %p, %lx, %p, %ld, %p)\n", 5529 5528 debugstr_w(pwcsName), pstgPriority, grfMode, 5530 5529 snbExclude, reserved, ppstgOpen); … … 5558 5557 */ 5559 5558 *ppstgOpen = 0; 5560 5561 hFile = CreateFileW( pwcsName, 5559 5560 hFile = CreateFileW( pwcsName, 5562 5561 accessMode, 5563 5562 shareMode, … … 5566 5565 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, 5567 5566 0); 5568 5567 5569 5568 length = GetFileSize(hFile, NULL); 5570 5569 5571 5570 if (hFile==INVALID_HANDLE_VALUE) 5572 5571 { … … 5605 5604 */ 5606 5605 newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl)); 5607 5606 5608 5607 if (newStorage == 0) 5609 5608 { … … 5621 5620 TRUE, 5622 5621 !length ); 5623 5622 5624 5623 if (FAILED(hr)) 5625 5624 { … … 5632 5631 goto end; 5633 5632 } 5634 5633 5635 5634 /* prepare the file name string given in lieu of the root property name */ 5636 5635 GetFullPathNameW(pwcsName, MAX_PATH, fullname, NULL); … … 5645 5644 (REFIID)&IID_IStorage, 5646 5645 (void**)ppstgOpen); 5647 5646 5648 5647 end: 5649 5648 TRACE("<-- %08lx, IStorage %p\n", hr, ppstgOpen ? *ppstgOpen : NULL); … … 5700 5699 (void**)ppstgOpen); 5701 5700 5702 return hr; 5701 return hr; 5703 5702 } 5704 5703 … … 5738 5737 */ 5739 5738 newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl)); 5740 5739 5741 5740 if (newStorage == 0) 5742 5741 return STG_E_INSUFFICIENTMEMORY; … … 5826 5825 STATSTG pstatstg; 5827 5826 HRESULT hRes; 5828 5827 5829 5828 TRACE("()\n"); 5830 5829 … … 5887 5886 CLSID clsid; 5888 5887 HRESULT res; 5889 5888 5890 5889 TRACE("(%p,%p)\n",pPStm,pStm); 5891 5890 … … 5893 5892 5894 5893 if (SUCCEEDED(res)){ 5895 5894 5896 5895 res=WriteClassStm(pStm,&clsid); 5897 5896 … … 5911 5910 * STGM_TRANSACTED 0x00010000 5912 5911 * STGM_SIMPLE 0x08000000 5913 * 5912 * 5914 5913 * STGM_READ 0x00000000 5915 5914 * STGM_WRITE 0x00000001 5916 5915 * STGM_READWRITE 0x00000002 5917 * 5916 * 5918 5917 * STGM_SHARE_DENY_NONE 0x00000040 5919 5918 * STGM_SHARE_DENY_READ 0x00000030 5920 5919 * STGM_SHARE_DENY_WRITE 0x00000020 5921 5920 * STGM_SHARE_EXCLUSIVE 0x00000010 5922 * 5921 * 5923 5922 * STGM_PRIORITY 0x00040000 5924 5923 * STGM_DELETEONRELEASE 0x04000000 … … 5936 5935 BOOL bSTGM_SIMPLE = ((stgm & STGM_SIMPLE) == STGM_SIMPLE); 5937 5936 BOOL bSTGM_DIRECT = ! (bSTGM_TRANSACTED || bSTGM_SIMPLE); 5938 5937 5939 5938 BOOL bSTGM_WRITE = ((stgm & STGM_WRITE) == STGM_WRITE); 5940 5939 BOOL bSTGM_READWRITE = ((stgm & STGM_READWRITE) == STGM_READWRITE); 5941 5940 BOOL bSTGM_READ = ! (bSTGM_WRITE || bSTGM_READWRITE); 5942 5941 5943 5942 BOOL bSTGM_SHARE_DENY_NONE = 5944 5943 ((stgm & STGM_SHARE_DENY_NONE) == STGM_SHARE_DENY_NONE); … … 5955 5954 BOOL bSTGM_CREATE = ((stgm & STGM_CREATE) == STGM_CREATE); 5956 5955 BOOL bSTGM_CONVERT = ((stgm & STGM_CONVERT) == STGM_CONVERT); 5957 5956 5958 5957 BOOL bSTGM_NOSCRATCH = ((stgm & STGM_NOSCRATCH) == STGM_NOSCRATCH); 5959 5958 BOOL bSTGM_NOSNAPSHOT = ((stgm & STGM_NOSNAPSHOT) == STGM_NOSNAPSHOT); 5960 5959 5961 /* 5960 /* 5962 5961 * STGM_DIRECT | STGM_TRANSACTED | STGM_SIMPLE 5963 5962 */ … … 5966 5965 return E_FAIL; 5967 5966 5968 /* 5967 /* 5969 5968 * STGM_WRITE | STGM_READWRITE | STGM_READ 5970 5969 */ … … 5974 5973 5975 5974 /* 5976 * STGM_SHARE_DENY_NONE | others 5975 * STGM_SHARE_DENY_NONE | others 5977 5976 * (I assume here that DENY_READ implies DENY_WRITE) 5978 5977 */ 5979 5978 if ( bSTGM_SHARE_DENY_NONE ) 5980 5979 if ( bSTGM_SHARE_DENY_READ || 5981 bSTGM_SHARE_DENY_WRITE || 5982 bSTGM_SHARE_EXCLUSIVE) 5980 bSTGM_SHARE_DENY_WRITE || 5981 bSTGM_SHARE_EXCLUSIVE) 5983 5982 return E_FAIL; 5984 5983 … … 5995 5994 if ( bSTGM_NOSCRATCH && ! bSTGM_TRANSACTED ) 5996 5995 return E_FAIL; 5997 5998 /* 5999 * STGM_NOSNAPSHOT requires STGM_TRANSACTED and 5996 5997 /* 5998 * STGM_NOSNAPSHOT requires STGM_TRANSACTED and 6000 5999 * not STGM_SHARE_EXCLUSIVE or STGM_SHARE_DENY_WRITE` 6001 6000 */ 6002 6001 if (bSTGM_NOSNAPSHOT) 6003 6002 { 6004 if ( ! ( bSTGM_TRANSACTED && 6003 if ( ! ( bSTGM_TRANSACTED && 6005 6004 !(bSTGM_SHARE_EXCLUSIVE || bSTGM_SHARE_DENY_WRITE)) ) 6006 6005 return E_FAIL; … … 6014 6013 * 6015 6014 * This method will return a share mode flag from a STGM value. 6016 * The STGM value is assumed valid. 6015 * The STGM value is assumed valid. 6017 6016 */ 6018 6017 static DWORD GetShareModeFromSTGM(DWORD stgm) … … 6090 6089 6091 6090 /************************************************************************* 6092 * OLECONVERT_LoadOLE10 [Internal] 6093 * 6094 * Loads the OLE10 STREAM to memory 6091 * OLECONVERT_LoadOLE10 [Internal] 6092 * 6093 * Loads the OLE10 STREAM to memory 6095 6094 * 6096 6095 * PARAMS … … 6105 6104 * NOTES 6106 6105 * This function is used by OleConvertOLESTREAMToIStorage only. 6107 * 6106 * 6108 6107 * Memory allocated for pData must be freed by the caller 6109 6108 */ … … 6260 6259 6261 6260 /************************************************************************* 6262 * OLECONVERT_SaveOLE10 [Internal] 6263 * 6264 * Saves the OLE10 STREAM From memory 6261 * OLECONVERT_SaveOLE10 [Internal] 6262 * 6263 * Saves the OLE10 STREAM From memory 6265 6264 * 6266 6265 * PARAMS … … 6274 6273 * NOTES 6275 6274 * This function is used by OleConvertIStorageToOLESTREAM only. 6276 * 6275 * 6277 6276 */ 6278 6277 HRESULT OLECONVERT_SaveOLE10(OLECONVERT_OLESTREAM_DATA *pData, LPOLESTREAM pOleStream) … … 6368 6367 6369 6368 /************************************************************************* 6370 * OLECONVERT_GetOLE20FromOLE10[Internal] 6369 * OLECONVERT_GetOLE20FromOLE10[Internal] 6371 6370 * 6372 6371 * This function copies OLE10 Data (the IStorage in the OLESTREAM) to disk, 6373 * opens it, and copies the content to the dest IStorage for 6372 * opens it, and copies the content to the dest IStorage for 6374 6373 * OleConvertOLESTREAMToIStorage 6375 * 6374 * 6376 6375 * 6377 6376 * PARAMS … … 6384 6383 * 6385 6384 * NOTES 6386 * 6387 * 6385 * 6386 * 6388 6387 */ 6389 6388 void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, BYTE *pBuffer, DWORD nBufferLength) … … 6420 6419 6421 6420 /************************************************************************* 6422 * OLECONVERT_WriteOLE20ToBuffer [Internal] 6423 * 6424 * Saves the OLE10 STREAM From memory 6421 * OLECONVERT_WriteOLE20ToBuffer [Internal] 6422 * 6423 * Saves the OLE10 STREAM From memory 6425 6424 * 6426 6425 * PARAMS … … 6435 6434 * 6436 6435 * Used by OleConvertIStorageToOLESTREAM only. 6437 * 6436 * 6438 6437 */ 6439 6438 DWORD OLECONVERT_WriteOLE20ToBuffer(LPSTORAGE pStorage, BYTE **pData) … … 6447 6446 6448 6447 *pData = NULL; 6449 6448 6450 6449 /* Create temp Storage */ 6451 6450 GetTempPathW(MAX_PATH, wstrTempDir); … … 6474 6473 6475 6474 /************************************************************************* 6476 * OLECONVERT_CreateOleStream [Internal] 6475 * OLECONVERT_CreateOleStream [Internal] 6477 6476 * 6478 6477 * Creates the "\001OLE" stream in the IStorage if neccessary. … … 6489 6488 * This stream is still unknown, MS Word seems to have extra data 6490 6489 * but since the data is stored in the OLESTREAM there should be 6491 * no need to recreate the stream. If the stream is manually 6490 * no need to recreate the stream. If the stream is manually 6492 6491 * deleted it will create it with this default data. 6493 * 6492 * 6494 6493 */ 6495 6494 void OLECONVERT_CreateOleStream(LPSTORAGE pStorage) … … 6498 6497 IStream *pStream; 6499 6498 WCHAR wstrStreamName[] = {1,'O', 'l', 'e', 0}; 6500 BYTE pOleStreamHeader [] = 6501 { 6502 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 6503 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 6504 0x00, 0x00, 0x00, 0x00 6499 BYTE pOleStreamHeader [] = 6500 { 6501 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 6502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 6503 0x00, 0x00, 0x00, 0x00 6505 6504 }; 6506 6505 6507 6506 /* Create stream if not present */ 6508 hRes = IStorage_CreateStream(pStorage, wstrStreamName, 6507 hRes = IStorage_CreateStream(pStorage, wstrStreamName, 6509 6508 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); 6510 6509 … … 6519 6518 6520 6519 /************************************************************************* 6521 * OLECONVERT_CreateCompObjStream [Internal] 6520 * OLECONVERT_CreateCompObjStream [Internal] 6522 6521 * 6523 6522 * Creates a "\001CompObj" is the destination IStorage if necessary. 6524 6523 * 6525 6524 * PARAMS 6526 * pStorage [I] The dest IStorage to create the CompObj Stream 6525 * pStorage [I] The dest IStorage to create the CompObj Stream 6527 6526 * if necessary. 6528 6527 * strOleTypeName [I] The ProgID … … 6536 6535 * 6537 6536 * The stream data is stored in the OLESTREAM and there should be 6538 * no need to recreate the stream. If the stream is manually 6537 * no need to recreate the stream. If the stream is manually 6539 6538 * deleted it will attempt to create it by querying the registry. 6540 6539 * 6541 * 6540 * 6542 6541 */ 6543 6542 HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName) … … 6558 6557 6559 6558 /* Create a CompObj stream if it doesn't exist */ 6560 hStorageRes = IStorage_CreateStream(pStorage, wstrStreamName, 6559 hStorageRes = IStorage_CreateStream(pStorage, wstrStreamName, 6561 6560 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); 6562 6561 if(hStorageRes == S_OK) … … 6579 6578 LONG hErr; 6580 6579 /* Get the CLSID Default Name from the Registry */ 6581 hErr = RegOpenKeyA(HKEY_CLASSES_ROOT, IStorageCompObj.strProgIDName, &hKey); 6580 hErr = RegOpenKeyA(HKEY_CLASSES_ROOT, IStorageCompObj.strProgIDName, &hKey); 6582 6581 if(hErr == ERROR_SUCCESS) 6583 6582 { … … 6621 6620 6622 6621 /************************************************************************* 6623 * OLECONVERT_CreateOlePresStream[Internal] 6622 * OLECONVERT_CreateOlePresStream[Internal] 6624 6623 * 6625 6624 * Creates the "\002OlePres000" Stream with the Metafile data … … 6628 6627 * pStorage [I] The dest IStorage to create \002OLEPres000 stream in. 6629 6628 * dwExtentX [I] Width of the Metafile 6630 * dwExtentY [I] Height of the Metafile 6629 * dwExtentY [I] Height of the Metafile 6631 6630 * pData [I] Metafile data 6632 6631 * dwDataLength [I] Size of the Metafile data … … 6638 6637 * NOTES 6639 6638 * This function is used by OleConvertOLESTREAMToIStorage only. 6640 * 6639 * 6641 6640 */ 6642 6641 void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX, DWORD dwExtentY , BYTE *pData, DWORD dwDataLength) … … 6645 6644 IStream *pStream; 6646 6645 WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0}; 6647 BYTE pOlePresStreamHeader [] = 6648 { 6649 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 6650 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 6646 BYTE pOlePresStreamHeader [] = 6647 { 6648 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 6649 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 6651 6650 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 6652 6651 0x00, 0x00, 0x00, 0x00 6653 6652 }; 6654 6653 6655 BYTE pOlePresStreamHeaderEmpty [] = 6656 { 6657 0x00, 0x00, 0x00, 0x00, 6658 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 6654 BYTE pOlePresStreamHeaderEmpty [] = 6655 { 6656 0x00, 0x00, 0x00, 0x00, 6657 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 6659 6658 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 6660 6659 0x00, 0x00, 0x00, 0x00 6661 6660 }; 6662 6661 6663 6662 /* Create the OlePres000 Stream */ 6664 hRes = IStorage_CreateStream(pStorage, wstrStreamName, 6663 hRes = IStorage_CreateStream(pStorage, wstrStreamName, 6665 6664 STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); 6666 6665 … … 6706 6705 6707 6706 /************************************************************************* 6708 * OLECONVERT_CreateOle10NativeStream [Internal] 6707 * OLECONVERT_CreateOle10NativeStream [Internal] 6709 6708 * 6710 6709 * Creates the "\001Ole10Native" Stream (should contain a BMP) … … 6722 6721 * 6723 6722 * Might need to verify the data and return appropriate error message 6724 * 6723 * 6725 6724 */ 6726 6725 void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, BYTE *pData, DWORD dwDataLength) … … 6729 6728 IStream *pStream; 6730 6729 WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0}; 6731 6730 6732 6731 /* Create the Ole10Native Stream */ 6733 hRes = IStorage_CreateStream(pStorage, wstrStreamName, 6732 hRes = IStorage_CreateStream(pStorage, wstrStreamName, 6734 6733 STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); 6735 6734 … … 6745 6744 6746 6745 /************************************************************************* 6747 * OLECONVERT_GetOLE10ProgID [Internal] 6746 * OLECONVERT_GetOLE10ProgID [Internal] 6748 6747 * 6749 6748 * Finds the ProgID (or OleTypeID) from the IStorage … … 6761 6760 * This function is used by OleConvertIStorageToOLESTREAM only. 6762 6761 * 6763 * 6762 * 6764 6763 */ 6765 6764 HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DWORD *dwSize) … … 6772 6771 6773 6772 /* Open the CompObj Stream */ 6774 hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 6773 hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 6775 6774 STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream ); 6776 6775 if(hRes == S_OK) … … 6809 6808 *dwSize = WideCharToMultiByte(CP_ACP, 0, wstrProgID, -1, strProgID, *dwSize, NULL, FALSE); 6810 6809 } 6811 6810 6812 6811 } 6813 6812 return hRes; … … 6815 6814 6816 6815 /************************************************************************* 6817 * OLECONVERT_GetOle10PresData [Internal] 6816 * OLECONVERT_GetOle10PresData [Internal] 6818 6817 * 6819 6818 * Converts IStorage "/001Ole10Native" stream to a OLE10 Stream … … 6830 6829 * 6831 6830 * Memory allocated for pData must be freed by the caller 6832 * 6833 * 6831 * 6832 * 6834 6833 */ 6835 6834 void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA *pOleStreamData) … … 6851 6850 6852 6851 /* Open Ole10Native Stream */ 6853 hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 6852 hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 6854 6853 STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream ); 6855 6854 if(hRes == S_OK) … … 6870 6869 6871 6870 /************************************************************************* 6872 * OLECONVERT_GetOle20PresData[Internal] 6871 * OLECONVERT_GetOle20PresData[Internal] 6873 6872 * 6874 6873 * Converts IStorage "/002OlePres000" stream to a OLE10 Stream … … 6883 6882 * NOTES 6884 6883 * This function is used by OleConvertIStorageToOLESTREAM only. 6885 * 6884 * 6886 6885 * Memory allocated for pData must be freed by the caller 6887 6886 */ … … 6910 6909 6911 6910 /* Open OlePress000 stream */ 6912 hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 6911 hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 6913 6912 STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream ); 6914 6913 if(hRes == S_OK) … … 6958 6957 6959 6958 /************************************************************************* 6960 * OleConvertOLESTREAMToIStorage [OLE32.87] 6959 * OleConvertOLESTREAMToIStorage [OLE32.87] 6961 6960 * 6962 6961 * Read info on MSDN … … 6967 6966 * Still some unknowns for the IStorage: "\002OlePres000", "\001CompObj", 6968 6967 * and "\001OLE" streams 6969 * 6968 * 6970 6969 */ 6971 6970 HRESULT WINAPI OleConvertOLESTREAMToIStorage ( 6972 LPOLESTREAM pOleStream, 6973 LPSTORAGE pstg, 6971 LPOLESTREAM pOleStream, 6972 LPSTORAGE pstg, 6974 6973 const DVTARGETDEVICE* ptd) 6975 6974 { … … 7062 7061 * Still some unknowns for the IStorage: "\002OlePres000", "\001CompObj", 7063 7062 * and "\001OLE" streams. 7064 * 7063 * 7065 7064 */ 7066 7065 HRESULT WINAPI OleConvertIStorageToOLESTREAM ( 7067 LPSTORAGE pstg, 7066 LPSTORAGE pstg, 7068 7067 LPOLESTREAM pOleStream) 7069 7068 { … … 7090 7089 { 7091 7090 /* Was it originally Ole10 */ 7092 hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream); 7091 hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream); 7093 7092 if(hRes == S_OK) 7094 7093 {
Note:
See TracChangeset
for help on using the changeset viewer.