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.

112 lines
2.4 KiB

  1. //
  2. // Copyright (c) 2001 Microsoft Corporation
  3. //
  4. //
  5. #include "activexmime.h"
  6. HINSTANCE g_DllInstance = NULL;
  7. LONG g_cRef=0;
  8. //----------------------------------------------------------------------------
  9. BOOL WINAPI DllMain( HINSTANCE hInst, DWORD dwReason, LPVOID pvReserved )
  10. {
  11. BOOL ret = TRUE;
  12. switch (dwReason)
  13. {
  14. case DLL_PROCESS_ATTACH:
  15. // remember the instance
  16. g_DllInstance = hInst;
  17. DisableThreadLibraryCalls(hInst);
  18. break;
  19. case DLL_PROCESS_DETACH:
  20. break;
  21. default:
  22. break;
  23. }
  24. return ret;
  25. }
  26. //----------------------------------------------------------------------------
  27. STDAPI DllRegisterServer(void)
  28. {
  29. // BUGBUG: should implement the registerserver
  30. return S_OK;
  31. }
  32. STDAPI DllUnregisterServer(void)
  33. {
  34. // BUGBUG: should implement the unregisterserver
  35. return S_OK;
  36. }
  37. // ----------------------------------------------------------------------------
  38. // DllAddRef
  39. // ----------------------------------------------------------------------------
  40. ULONG DllAddRef(void)
  41. {
  42. return (ULONG)InterlockedIncrement(&g_cRef);
  43. }
  44. // ----------------------------------------------------------------------------
  45. // DllRelease
  46. // ----------------------------------------------------------------------------
  47. ULONG DllRelease(void)
  48. {
  49. return (ULONG)InterlockedDecrement(&g_cRef);
  50. }
  51. // ----------------------------------------------------------------------------
  52. STDAPI
  53. DllCanUnloadNow()
  54. {
  55. return g_cRef > 0 ? S_FALSE : S_OK;
  56. }
  57. // ----------------------------------------------------------------------------
  58. HRESULT
  59. GetActiveXMimeClassObject(REFIID iid, void** ppv)
  60. {
  61. HRESULT hr = E_OUTOFMEMORY;
  62. CActiveXMimeClassFactory *pActiveXMimeClassFactory = new CActiveXMimeClassFactory();
  63. if (pActiveXMimeClassFactory != NULL)
  64. {
  65. hr = pActiveXMimeClassFactory->QueryInterface(iid, ppv);
  66. pActiveXMimeClassFactory->Release();
  67. }
  68. return hr;
  69. }
  70. // ----------------------------------------------------------------------------
  71. STDAPI
  72. DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *ppv)
  73. {
  74. HRESULT hr = S_OK;
  75. if (clsid == CLSID_ActiveXMimePlayer)
  76. {
  77. hr = GetActiveXMimeClassObject(iid, ppv);
  78. }
  79. else
  80. {
  81. hr = CLASS_E_CLASSNOTAVAILABLE;
  82. }
  83. return hr;
  84. }