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.

86 lines
2.4 KiB

  1. // Note: Proxy/Stub Information
  2. // To build a separate proxy/stub DLL,
  3. // run nmake -f svrgrpsnapps.mk in the project directory.
  4. #include "stdafx.h"
  5. #include "resource.h"
  6. #include <initguid.h>
  7. #include "pop3.h"
  8. #include "Pop3_i.c"
  9. #include "pop3Snap.h"
  10. CComModule _Module;
  11. BEGIN_OBJECT_MAP(ObjectMap)
  12. OBJECT_ENTRY(CLSID_POP3ServerSnap, CPOP3ServerSnapData)
  13. OBJECT_ENTRY(CLSID_POP3ServerSnapAbout, CPOP3ServerSnapAbout)
  14. END_OBJECT_MAP()
  15. /////////////////////////////////////////////////////////////////////////////
  16. // DLL Entry Point
  17. extern "C"
  18. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  19. {
  20. if (dwReason == DLL_PROCESS_ATTACH)
  21. {
  22. _Module.Init(ObjectMap, hInstance, &LIBID_POP3ServerSNAPLib);
  23. DisableThreadLibraryCalls(hInstance);
  24. tstring strTemp = StrLoadString( IDS_SNAPINNAME );
  25. CRootNode::m_SZDISPLAY_NAME = new OLECHAR[strTemp.length()+1];
  26. if( CRootNode::m_SZDISPLAY_NAME )
  27. {
  28. ocscpy( (LPOLESTR)CRootNode::m_SZDISPLAY_NAME, strTemp.c_str() );
  29. }
  30. else
  31. {
  32. return FALSE;
  33. }
  34. }
  35. else if (dwReason == DLL_PROCESS_DETACH)
  36. {
  37. if( CRootNode::m_SZDISPLAY_NAME )
  38. {
  39. delete [] CRootNode::m_SZDISPLAY_NAME;
  40. }
  41. _Module.Term();
  42. }
  43. return TRUE; // ok
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. // Used to determine whether the DLL can be unloaded by OLE
  47. STDAPI DllCanUnloadNow(void)
  48. {
  49. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  50. }
  51. /////////////////////////////////////////////////////////////////////////////
  52. // Returns a class factory to create an object of the requested type
  53. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  54. {
  55. return _Module.GetClassObject(rclsid, riid, ppv);
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // DllRegisterServer - Adds entries to the system registry
  59. STDAPI DllRegisterServer(void)
  60. {
  61. // registers object, typelib and all interfaces in typelib
  62. return _Module.RegisterServer(FALSE);
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. // DllUnregisterServer - Removes entries from the system registry
  66. STDAPI DllUnregisterServer(void)
  67. {
  68. return _Module.UnregisterServer(TRUE);
  69. }