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.

135 lines
3.0 KiB

  1. //
  2. // Copyright (c) 2001 Microsoft Corporation
  3. //
  4. //
  5. #include "shcut.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. GetShortcutClassObject(REFIID iid, void** ppv)
  60. {
  61. HRESULT hr = E_OUTOFMEMORY;
  62. CFusionShortcutClassFactory *pFusionShortcutClassFactory = new CFusionShortcutClassFactory();
  63. if (pFusionShortcutClassFactory != NULL)
  64. {
  65. hr = pFusionShortcutClassFactory->QueryInterface(iid, ppv);
  66. pFusionShortcutClassFactory->Release();
  67. }
  68. return hr;
  69. }
  70. // ----------------------------------------------------------------------------
  71. /*
  72. HRESULT
  73. GetMimeFilterClassObject(REFIID iid, void** ppv)
  74. {
  75. HRESULT hr = E_OUTOFMEMORY;
  76. CFusionMimeFilterClassFactory *pFusionMimeFilterClassFactory = new CFusionMimeFilterClassFactory();
  77. if (pFusionMimeFilterClassFactory != NULL)
  78. {
  79. hr = pFusionMimeFilterClassFactory->QueryInterface(iid, ppv);
  80. pFusionMimeFilterClassFactory->Release();
  81. }
  82. return hr;
  83. }
  84. */
  85. // ----------------------------------------------------------------------------
  86. STDAPI
  87. DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *ppv)
  88. {
  89. HRESULT hr = S_OK;
  90. if (clsid == CLSID_FusionShortcut)
  91. {
  92. hr = GetShortcutClassObject(iid, ppv);
  93. }
  94. /*
  95. else if (clsid == CLSID_FusionMimeFilter)
  96. {
  97. hr = GetMimeFilterClassObject(iid, ppv);
  98. }
  99. */
  100. else
  101. {
  102. hr = CLASS_E_CLASSNOTAVAILABLE;
  103. }
  104. return hr;
  105. }