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.

120 lines
2.4 KiB

  1. #include "inspch.h"
  2. #include "insobj.h"
  3. #include "insfact.h"
  4. //=--------------------------------------------------------------------------=
  5. // Function name here
  6. //=--------------------------------------------------------------------------=
  7. // Function description
  8. //
  9. // Parameters:
  10. //
  11. // Returns:
  12. //
  13. // Notes:
  14. //
  15. STDMETHODIMP CInstallEngineFactory::QueryInterface(REFIID riid, void **ppv)
  16. {
  17. if((riid == IID_IClassFactory) || (riid == IID_IUnknown))
  18. {
  19. cRef++;
  20. *ppv = (void *)this;
  21. return NOERROR;
  22. }
  23. *ppv = NULL;
  24. return E_NOINTERFACE;
  25. }
  26. //=--------------------------------------------------------------------------=
  27. // Function name here
  28. //=--------------------------------------------------------------------------=
  29. // Function description
  30. //
  31. // Parameters:
  32. //
  33. // Returns:
  34. //
  35. // Notes:
  36. //
  37. STDMETHODIMP_(ULONG) CInstallEngineFactory::AddRef()
  38. {
  39. return(++cRef);
  40. }
  41. //=--------------------------------------------------------------------------=
  42. // Function name here
  43. //=--------------------------------------------------------------------------=
  44. // Function description
  45. //
  46. // Parameters:
  47. //
  48. // Returns:
  49. //
  50. // Notes:
  51. //
  52. STDMETHODIMP_(ULONG) CInstallEngineFactory::Release()
  53. {
  54. return(--cRef);
  55. }
  56. //=--------------------------------------------------------------------------=
  57. // Function name here
  58. //=--------------------------------------------------------------------------=
  59. // Function description
  60. //
  61. // Parameters:
  62. //
  63. // Returns:
  64. //
  65. // Notes:
  66. //
  67. STDMETHODIMP CInstallEngineFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv)
  68. {
  69. CInstallEngine *pinseng = NULL;
  70. IUnknown *punk;
  71. HRESULT hr;
  72. if(pUnkOuter != NULL)
  73. return CLASS_E_NOAGGREGATION;
  74. pinseng = new CInstallEngine(&punk);
  75. if(!pinseng)
  76. return (E_OUTOFMEMORY);
  77. hr = punk->QueryInterface(riid, ppv);
  78. if(FAILED(hr))
  79. delete pinseng;
  80. else
  81. DllAddRef();
  82. punk->Release();
  83. return hr;
  84. }
  85. //=--------------------------------------------------------------------------=
  86. // Function name here
  87. //=--------------------------------------------------------------------------=
  88. // Function description
  89. //
  90. // Parameters:
  91. //
  92. // Returns:
  93. //
  94. // Notes:
  95. //
  96. STDMETHODIMP CInstallEngineFactory::LockServer(BOOL fLock)
  97. {
  98. if(fLock)
  99. DllAddRef();
  100. else
  101. DllRelease();
  102. return NOERROR;
  103. }