Source code of Windows XP (NT5)
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.

71 lines
1.4 KiB

  1. #include "priv.h"
  2. #include "cryptmnu.h"
  3. CCryptMenuClassFactory::CCryptMenuClassFactory() {
  4. m_ObjRefCount = 1;
  5. g_DllRefCount++;
  6. }
  7. CCryptMenuClassFactory::~CCryptMenuClassFactory() {
  8. g_DllRefCount--;
  9. }
  10. STDMETHODIMP
  11. CCryptMenuClassFactory::QueryInterface( REFIID iid, void **ppvObject) {
  12. if (IsEqualIID(iid,IID_IUnknown)) {
  13. *ppvObject = (LPUNKNOWN)(LPCLASSFACTORY) this;
  14. m_ObjRefCount++;
  15. return(NOERROR);
  16. }
  17. if (IsEqualIID(iid,IID_IClassFactory)) {
  18. *ppvObject = (LPCLASSFACTORY) this;
  19. m_ObjRefCount++;
  20. return(NOERROR);
  21. }
  22. *ppvObject = NULL;
  23. return(E_NOINTERFACE);
  24. }
  25. STDMETHODIMP_(DWORD)
  26. CCryptMenuClassFactory::AddRef() {
  27. return(++m_ObjRefCount);
  28. }
  29. STDMETHODIMP_(DWORD)
  30. CCryptMenuClassFactory::Release() {
  31. if(--m_ObjRefCount ==0) {
  32. delete this;
  33. }
  34. return(m_ObjRefCount);
  35. }
  36. STDMETHODIMP
  37. CCryptMenuClassFactory::CreateInstance(LPUNKNOWN pUnkOuter,
  38. REFIID riid,
  39. void **ppvObject) {
  40. CCryptMenuExt *pCryptMenu;
  41. HRESULT hr;
  42. *ppvObject = NULL;
  43. if (pUnkOuter) {
  44. return(CLASS_E_NOAGGREGATION);
  45. }
  46. pCryptMenu = new CCryptMenuExt;
  47. if (!pCryptMenu) {
  48. return(E_OUTOFMEMORY);
  49. }
  50. hr = pCryptMenu->QueryInterface(riid,ppvObject);
  51. pCryptMenu->Release();
  52. return hr;
  53. }
  54. STDMETHODIMP
  55. CCryptMenuClassFactory::LockServer(BOOL) {
  56. return(E_NOTIMPL);
  57. }