Source code of Windows XP (NT5)
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.

93 lines
2.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: fssnapin.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // fssnapin.cpp : Implementation of DLL Exports.
  11. // Note: Proxy/Stub Information
  12. // To build a separate proxy/stub DLL,
  13. // run nmake -f fssnapinps.mk in the project directory.
  14. #include "stdafx.h"
  15. #include "resource.h"
  16. #include "initguid.h"
  17. #include "CompData.h"
  18. #include "Compont.h"
  19. DECLARE_INFOLEVEL(FSSnapIn);
  20. CComModule _Module;
  21. BEGIN_OBJECT_MAP(ObjectMap)
  22. OBJECT_ENTRY(CLSID_ComponentData, CComponentData)
  23. END_OBJECT_MAP()
  24. class CFssnapinApp : public CWinApp
  25. {
  26. public:
  27. virtual BOOL InitInstance();
  28. virtual int ExitInstance();
  29. };
  30. CFssnapinApp theApp;
  31. extern long g_cookieCount = 0;
  32. BOOL CFssnapinApp::InitInstance()
  33. {
  34. _Module.Init(ObjectMap, m_hInstance);
  35. return CWinApp::InitInstance();
  36. }
  37. int CFssnapinApp::ExitInstance()
  38. {
  39. _Module.Term();
  40. Dbg(DEB_USER1, _T("Number of cookies leaked = %d\n"), g_cookieCount);
  41. ASSERT(g_cookieCount == 0);
  42. return CWinApp::ExitInstance();
  43. }
  44. /////////////////////////////////////////////////////////////////////////////
  45. // Used to determine whether the DLL can be unloaded by OLE
  46. STDAPI DllCanUnloadNow(void)
  47. {
  48. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  49. return (AfxDllCanUnloadNow()==S_OK && _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(TRUE);
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. // DllUnregisterServer - Removes entries from the system registry
  66. STDAPI DllUnregisterServer(void)
  67. {
  68. _Module.UnregisterServer();
  69. return S_OK;
  70. }