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.

104 lines
3.4 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // FILE : MsFxsSnp.cpp //
  3. // //
  4. // DESCRIPTION : Implementation of DLL Exports. //
  5. // //
  6. // AUTHOR : yossg //
  7. // //
  8. // HISTORY : //
  9. // Oct 27 1999 yossg create //
  10. // Nov 3 1999 yossg add GlobalStringTable //
  11. // //
  12. // Copyright (C) 1999 Microsoft Corporation All Rights Reserved //
  13. /////////////////////////////////////////////////////////////////////////////
  14. // Note: Proxy/Stub Information
  15. // To build a separate proxy/stub DLL,
  16. // run nmake -f MsFxsSnpps.mk in the project directory.
  17. #include "stdafx.h"
  18. #include "initguid.h"
  19. #include "MsFxsSnp.h"
  20. #include "MsFxsSnp_i.c"
  21. #include "Snapin.h"
  22. #include <faxres.h>
  23. CComModule _Module;
  24. BEGIN_OBJECT_MAP(ObjectMap)
  25. OBJECT_ENTRY(CLSID_Snapin, CSnapin)
  26. OBJECT_ENTRY(CLSID_SnapinAbout, CSnapinAbout)
  27. END_OBJECT_MAP()
  28. /////////////////////////////////////////////////////////////////////////////
  29. // DLL Entry Point
  30. extern "C"
  31. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  32. {
  33. DEBUG_FUNCTION_NAME( _T("MsFxsSnp.dll - DllMain"));
  34. DebugPrintEx(DEBUG_MSG, _T("MsFxsSnp.dll - DllMain, reason=%d"), dwReason );
  35. if (dwReason == DLL_PROCESS_ATTACH)
  36. {
  37. _Module.Init(ObjectMap, hInstance);
  38. _Module.m_hInstResource = GetResInstance(hInstance);
  39. if(!_Module.m_hInstResource)
  40. {
  41. return FALSE;
  42. }
  43. CSnapInItem::Init();
  44. DisableThreadLibraryCalls(hInstance);
  45. }
  46. else if(dwReason == DLL_PROCESS_DETACH)
  47. {
  48. _Module.Term();
  49. FreeResInstance();
  50. HeapCleanup();
  51. }
  52. return TRUE; // ok
  53. }
  54. /////////////////////////////////////////////////////////////////////////////
  55. // Used to determine whether the DLL can be unloaded by OLE
  56. STDAPI DllCanUnloadNow(void)
  57. {
  58. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  59. }
  60. /////////////////////////////////////////////////////////////////////////////
  61. // Returns a class factory to create an object of the requested type
  62. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  63. {
  64. return _Module.GetClassObject(rclsid, riid, ppv);
  65. }
  66. /////////////////////////////////////////////////////////////////////////////
  67. // DllRegisterServer - Adds entries to the system registry
  68. STDAPI DllRegisterServer(void)
  69. {
  70. //
  71. // registers object, typelib and all interfaces in typelib
  72. //
  73. return _Module.RegisterServer(TRUE);
  74. }
  75. /////////////////////////////////////////////////////////////////////////////
  76. // DllUnregisterServer - Removes entries from the system registry
  77. STDAPI DllUnregisterServer(void)
  78. {
  79. //
  80. // unregisters object, typelib and all interfaces in typelib
  81. //
  82. return _Module.UnregisterServer(TRUE);
  83. }