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.

114 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. tapi3.cpp
  5. Abstract:
  6. Implementation of DLL Exports.
  7. Author:
  8. mquinton - 6/12/97
  9. Notes:
  10. Revision History:
  11. --*/
  12. // Note: Proxy/Stub Information
  13. // To build a separate proxy/stub DLL,
  14. // run nmake -f tapi3ps.mk in the project directory.
  15. #include "stdafx.h"
  16. //#include "initguid.h"
  17. //#include "dlldatax.h"
  18. //
  19. // For the ntbuild environment we need to include this file to get the base
  20. // class implementations.
  21. //
  22. #ifdef _ATL_STATIC_REGISTRY
  23. #include <statreg.h>
  24. #include <statreg.cpp>
  25. #endif
  26. #include <atlimpl.cpp>
  27. /////////////////////////////////////////////////////////////////////////////
  28. // DLL Entry Point
  29. /*extern "C"
  30. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
  31. {
  32. if (dwReason == DLL_PROCESS_ATTACH)
  33. {
  34. _Module.Init(ObjectMap, hInstance);
  35. DisableThreadLibraryCalls(hInstance);
  36. }
  37. else if (dwReason == DLL_PROCESS_DETACH)
  38. {
  39. _Module.Term();
  40. }
  41. return TRUE; // ok
  42. }*/
  43. /////////////////////////////////////////////////////////////////////////////
  44. // Used to determine whether the DLL can be unloaded by OLE
  45. STDAPI DllCanUnloadNow(void)
  46. {
  47. #ifdef _MERGE_PROXYSTUB
  48. if (PrxDllCanUnloadNow() != S_OK)
  49. return S_FALSE;
  50. #endif
  51. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  52. }
  53. /////////////////////////////////////////////////////////////////////////////
  54. // Returns a class factory to create an object of the requested type
  55. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  56. {
  57. #ifdef _MERGE_PROXYSTUB
  58. if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
  59. return S_OK;
  60. #endif
  61. return _Module.GetClassObject(rclsid, riid, ppv);
  62. }
  63. /////////////////////////////////////////////////////////////////////////////
  64. // DllRegisterServer - Adds entries to the system registry
  65. STDAPI DllRegisterServer(void)
  66. {
  67. #ifdef _MERGE_PROXYSTUB
  68. HRESULT hRes = PrxDllRegisterServer();
  69. if (FAILED(hRes))
  70. return hRes;
  71. #endif
  72. // registers object, typelib and all interfaces in typelib
  73. return _Module.RegisterServer(TRUE);
  74. }
  75. /////////////////////////////////////////////////////////////////////////////
  76. // DllUnregisterServer - Removes entries from the system registry
  77. STDAPI DllUnregisterServer(void)
  78. {
  79. #ifdef _MERGE_PROXYSTUB
  80. PrxDllUnregisterServer();
  81. #endif
  82. _Module.UnregisterServer();
  83. return S_OK;
  84. }