Changeset 6648 for trunk/src/oleaut32/connpt.c
- Timestamp:
- Sep 5, 2001, 3:19:02 PM (24 years ago)
- File:
-
- 1 edited
-
trunk/src/oleaut32/connpt.c (modified) (30 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/oleaut32/connpt.c
r4837 r6648 1 /* $Id: connpt.c,v 1.2 2001-09-05 13:18:59 bird Exp $ */ 1 2 /* 2 3 * Implementation of a generic ConnectionPoint object. … … 72 73 CONNECTDATA *pCD; 73 74 DWORD nConns; 74 75 75 76 /* Next connection to enumerate from */ 76 77 DWORD nCur; … … 79 80 80 81 static EnumConnectionsImpl *EnumConnectionsImpl_Construct(IUnknown *pUnk, 81 DWORD nSinks,82 CONNECTDATA *pCD);82 DWORD nSinks, 83 CONNECTDATA *pCD); 83 84 84 85 … … 87 88 */ 88 89 static ConnectionPointImpl *ConnectionPointImpl_Construct(IUnknown *pUnk, 89 REFIID riid)90 REFIID riid) 90 91 { 91 92 ConnectionPointImpl *Obj; … … 97 98 Obj->iid = *riid; 98 99 Obj->maxSinks = MAXSINKS; 99 Obj->sinks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 100 sizeof(IUnknown*) * MAXSINKS);100 Obj->sinks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 101 sizeof(IUnknown*) * MAXSINKS); 101 102 Obj->nSinks = 0; 102 103 return Obj; … … 139 140 if ( (This==0) || (ppvObject==0) ) 140 141 return E_INVALIDARG; 141 142 142 143 /* 143 144 * Initialize the return parameter. 144 145 */ 145 146 *ppvObject = 0; 146 147 147 148 /* 148 149 * Compare the riid with the interface IDs implemented by this object. 149 150 */ 150 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 151 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 151 152 { 152 153 *ppvObject = (IConnectionPoint*)This; 153 154 } 154 else if (memcmp(&IID_IConnectionPoint, riid, sizeof(IID_IConnectionPoint)) == 0) 155 else if (memcmp(&IID_IConnectionPoint, riid, sizeof(IID_IConnectionPoint)) == 0) 155 156 { 156 157 *ppvObject = (IConnectionPoint*)This; 157 158 } 158 159 159 160 /* 160 161 * Check that we obtained an interface. … … 165 166 return E_NOINTERFACE; 166 167 } 167 168 168 169 /* 169 170 * Query Interface always increases the reference count by one when it is … … 189 190 return This->ref; 190 191 } 191 192 192 193 /************************************************************************ 193 194 * ConnectionPointImpl_Release (IUnknown) … … 195 196 * See Windows documentation for more details on IUnknown methods. 196 197 */ 197 static ULONG WINAPI ConnectionPointImpl_Release( 198 static ULONG WINAPI ConnectionPointImpl_Release( 198 199 IConnectionPoint* iface) 199 200 { … … 215 216 return 0; 216 217 } 217 218 218 219 return This->ref; 219 220 } … … 224 225 */ 225 226 static HRESULT WINAPI ConnectionPointImpl_GetConnectionInterface( 226 IConnectionPoint *iface,227 IID *piid)227 IConnectionPoint *iface, 228 IID *piid) 228 229 { 229 230 ICOM_THIS(ConnectionPointImpl, iface); … … 238 239 */ 239 240 static HRESULT WINAPI ConnectionPointImpl_GetConnectionPointContainer( 240 IConnectionPoint *iface,241 IConnectionPointContainer **ppCPC)241 IConnectionPoint *iface, 242 IConnectionPointContainer **ppCPC) 242 243 { 243 244 ICOM_THIS(ConnectionPointImpl, iface); … … 245 246 246 247 return IUnknown_QueryInterface(This->Obj, 247 &IID_IConnectionPointContainer,248 (LPVOID)ppCPC);248 &IID_IConnectionPointContainer, 249 (LPVOID)ppCPC); 249 250 } 250 251 … … 254 255 */ 255 256 static HRESULT WINAPI ConnectionPointImpl_Advise(IConnectionPoint *iface, 256 IUnknown *lpUnk,257 DWORD *pdwCookie)257 IUnknown *lpUnk, 258 DWORD *pdwCookie) 258 259 { 259 260 DWORD i; … … 273 274 This->maxSinks += MAXSINKS; 274 275 This->sinks = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->sinks, 275 This->maxSinks * sizeof(IUnknown *));276 This->maxSinks * sizeof(IUnknown *)); 276 277 } 277 278 This->sinks[i] = lpSink; … … 287 288 */ 288 289 static HRESULT WINAPI ConnectionPointImpl_Unadvise(IConnectionPoint *iface, 289 DWORD dwCookie)290 DWORD dwCookie) 290 291 { 291 292 ICOM_THIS(ConnectionPointImpl, iface); … … 307 308 */ 308 309 static HRESULT WINAPI ConnectionPointImpl_EnumConnections( 309 IConnectionPoint *iface,310 LPENUMCONNECTIONS *ppEnum)311 { 310 IConnectionPoint *iface, 311 LPENUMCONNECTIONS *ppEnum) 312 { 312 313 ICOM_THIS(ConnectionPointImpl, iface); 313 314 CONNECTDATA *pCD; … … 317 318 318 319 TRACE("(%p)->(%p)\n", This, ppEnum); 319 320 320 321 *ppEnum = NULL; 321 322 … … 339 340 EnumObj = EnumConnectionsImpl_Construct((IUnknown*)This, This->nSinks, pCD); 340 341 hr = IEnumConnections_QueryInterface((IEnumConnections*)EnumObj, 341 &IID_IEnumConnections, (LPVOID)ppEnum);342 &IID_IEnumConnections, (LPVOID)ppEnum); 342 343 IEnumConnections_Release((IEnumConnections*)EnumObj); 343 344 … … 367 368 */ 368 369 static EnumConnectionsImpl *EnumConnectionsImpl_Construct(IUnknown *pUnk, 369 DWORD nSinks,370 CONNECTDATA *pCD)370 DWORD nSinks, 371 CONNECTDATA *pCD) 371 372 { 372 373 EnumConnectionsImpl *Obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*Obj)); … … 420 421 if ( (This==0) || (ppvObject==0) ) 421 422 return E_INVALIDARG; 422 423 423 424 /* 424 425 * Initialize the return parameter. 425 426 */ 426 427 *ppvObject = 0; 427 428 428 429 /* 429 430 * Compare the riid with the interface IDs implemented by this object. 430 431 */ 431 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 432 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 432 433 { 433 434 *ppvObject = (IEnumConnections*)This; 434 435 } 435 else if (memcmp(&IID_IEnumConnections, riid, sizeof(IID_IEnumConnections)) == 0) 436 else if (memcmp(&IID_IEnumConnections, riid, sizeof(IID_IEnumConnections)) == 0) 436 437 { 437 438 *ppvObject = (IEnumConnections*)This; 438 439 } 439 440 440 441 /* 441 442 * Check that we obtained an interface. … … 446 447 return E_NOINTERFACE; 447 448 } 448 449 449 450 /* 450 451 * Query Interface always increases the reference count by one when it is … … 470 471 return This->ref; 471 472 } 472 473 473 474 /************************************************************************ 474 475 * EnumConnectionsImpl_Release (IUnknown) … … 497 498 return 0; 498 499 } 499 500 500 501 return This->ref; 501 502 } … … 506 507 */ 507 508 static HRESULT WINAPI EnumConnectionsImpl_Next(IEnumConnections* iface, 508 ULONG cConn, LPCONNECTDATA pCD,509 ULONG *pEnum)509 ULONG cConn, LPCONNECTDATA pCD, 510 ULONG *pEnum) 510 511 { 511 512 ICOM_THIS(EnumConnectionsImpl, iface); … … 542 543 */ 543 544 static HRESULT WINAPI EnumConnectionsImpl_Skip(IEnumConnections* iface, 544 ULONG cSkip)545 ULONG cSkip) 545 546 { 546 547 ICOM_THIS(EnumConnectionsImpl, iface); … … 576 577 */ 577 578 static HRESULT WINAPI EnumConnectionsImpl_Clone(IEnumConnections* iface, 578 LPENUMCONNECTIONS *ppEnum)579 LPENUMCONNECTIONS *ppEnum) 579 580 { 580 581 ICOM_THIS(EnumConnectionsImpl, iface); 581 582 EnumConnectionsImpl *newObj; 582 583 TRACE("(%p)->(%p)\n", This, ppEnum); 583 584 584 585 newObj = EnumConnectionsImpl_Construct(This->pUnk, This->nConns, This->pCD); 585 586 newObj->nCur = This->nCur; … … 588 589 return S_OK; 589 590 } 590 591 591 592 static ICOM_VTABLE(IEnumConnections) EnumConnectionsImpl_VTable = 592 593 { … … 616 617 */ 617 618 HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid, 618 IConnectionPoint **pCP)619 IConnectionPoint **pCP) 619 620 { 620 621 ConnectionPointImpl *Obj; … … 624 625 if(!Obj) return E_OUTOFMEMORY; 625 626 626 hr = IConnectionPoint_QueryInterface((IConnectionPoint *)Obj, 627 &IID_IConnectionPoint, (LPVOID)pCP);627 hr = IConnectionPoint_QueryInterface((IConnectionPoint *)Obj, 628 &IID_IConnectionPoint, (LPVOID)pCP); 628 629 IConnectionPoint_Release((IConnectionPoint *)Obj); 629 630 return hr;
Note:
See TracChangeset
for help on using the changeset viewer.
