Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

  1. //
  2. // sink.h
  3. //
  4. #ifndef SINK_H
  5. #define SINK_H
  6. #include "private.h"
  7. #include "strary.h"
  8. #define GENERIC_ERROR_COOKIE 0xffffffff
  9. typedef struct _GENERICSINK
  10. {
  11. IUnknown *pSink;
  12. DWORD dwCookie;
  13. UINT_PTR uPrivate; // private state associated with the sink, for use of owner
  14. } GENERICSINK;
  15. inline UINT GenericCookieToGUIDIndex(DWORD dwCookie) { return (dwCookie & 0xff000000) >> 24; }
  16. inline DWORD GenericChainToCookie(DWORD dwCookie, UINT cPreceedingCPs)
  17. {
  18. Assert((dwCookie >> 24) + cPreceedingCPs < 128); // watch out for overflow
  19. return (dwCookie + (cPreceedingCPs << 24));
  20. }
  21. inline DWORD GenericUnchainToCookie(DWORD dwCookie, UINT cPreceedingCPs)
  22. {
  23. Assert((int)(dwCookie - (cPreceedingCPs << 24)) >= 0); // underflow?
  24. return (dwCookie - (cPreceedingCPs << 24));
  25. }
  26. HRESULT GenericAdviseSink(REFIID riid, IUnknown *punk, const IID **rgiidConnectionPts, CStructArray<GENERICSINK> *rgSinkArrays, UINT cConnectionPts, DWORD *pdwCookie, GENERICSINK **ppSink = NULL);
  27. HRESULT GenericUnadviseSink(CStructArray<GENERICSINK> *rgSinkArrays, UINT cConnectionPts, DWORD dwCookie, UINT_PTR *puPrivate = NULL);
  28. HRESULT RequestCookie(CStructArray<DWORD> *rgCookies, DWORD *pdwCookie);
  29. HRESULT ReleaseCookie(CStructArray<DWORD> *rgCookies, DWORD dwCookie);
  30. #endif // SINK_H