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.

67 lines
2.0 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. // CProxy_InstallEvent
  3. template <class T>
  4. class CProxy_InstallEvents : public IConnectionPointImpl<T, &DIID__InstallEvent, CComDynamicUnkArray>
  5. {
  6. public:
  7. //methods:
  8. //_InstallEvent : IDispatch
  9. public:
  10. void Fire_OnProgress(
  11. long lProgress)
  12. {
  13. VARIANTARG* pvars = new VARIANTARG[1];
  14. if (pvars != NULL) {
  15. for (int i = 0; i < 1; i++)
  16. VariantInit(&pvars[i]);
  17. T* pT = (T*)this;
  18. pT->Lock();
  19. IUnknown** pp = m_vec.begin();
  20. while (pp < m_vec.end())
  21. {
  22. if (*pp != NULL)
  23. {
  24. pvars[0].vt = VT_I4;
  25. pvars[0].lVal= lProgress;
  26. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  27. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(*pp);
  28. pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  29. }
  30. pp++;
  31. }
  32. pT->Unlock();
  33. delete[] pvars;
  34. }
  35. }
  36. void Fire_InstallError(
  37. long lErrCode)
  38. {
  39. VARIANTARG* pvars = new VARIANTARG[1];
  40. if (pvars != NULL) {
  41. for (int i = 0; i < 1; i++)
  42. VariantInit(&pvars[i]);
  43. T* pT = (T*)this;
  44. pT->Lock();
  45. IUnknown** pp = m_vec.begin();
  46. while (pp < m_vec.end())
  47. {
  48. if (*pp != NULL)
  49. {
  50. pvars[0].vt = VT_I4;
  51. pvars[0].lVal= lErrCode;
  52. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  53. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(*pp);
  54. pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  55. }
  56. pp++;
  57. }
  58. pT->Unlock();
  59. delete[] pvars;
  60. }
  61. }
  62. };