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.

119 lines
3.6 KiB

  1. // McsVarSetMin.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To merge the proxy/stub code into the object DLL, add the file
  4. // dlldatax.c to the project. Make sure precompiled headers
  5. // are turned off for this file, and add _MERGE_PROXYSTUB to the
  6. // defines for the project.
  7. //
  8. // If you are not running WinNT4.0 or Win95 with DCOM, then you
  9. // need to remove the following define from dlldatax.c
  10. // #define _WIN32_WINNT 0x0400
  11. //
  12. // Further, if you are running MIDL without /Oicf switch, you also
  13. // need to remove the following define from dlldatax.c.
  14. // #define USE_STUBLESS_PROXY
  15. //
  16. // Modify the custom build rule for McsVarSetMin.idl by adding the following
  17. // files to the Outputs.
  18. // McsVarSetMin_p.c
  19. // dlldata.c
  20. // To build a separate proxy/stub DLL,
  21. // run nmake -f McsVarSetMinps.mk in the project directory.
  22. #include "stdafx.h"
  23. #include "resource.h"
  24. #include <initguid.h>
  25. #include "Varset.h"
  26. #include "dlldatax.h"
  27. #include "VarSet_i.c"
  28. #include "VarSetI_i.c"
  29. #include "VSet.h"
  30. CComModule _Module;
  31. BEGIN_OBJECT_MAP(ObjectMap)
  32. OBJECT_ENTRY(CLSID_VarSet, CVSet)
  33. END_OBJECT_MAP()
  34. class CVarSetApp : public CWinApp
  35. {
  36. public:
  37. // Overrides
  38. // ClassWizard generated virtual function overrides
  39. //{{AFX_VIRTUAL(CVarSetApp)
  40. public:
  41. virtual BOOL InitInstance();
  42. virtual int ExitInstance();
  43. //}}AFX_VIRTUAL
  44. //{{AFX_MSG(CVarSetApp)
  45. // NOTE - the ClassWizard will add and remove member functions here.
  46. // DO NOT EDIT what you see in these blocks of generated code !
  47. //}}AFX_MSG
  48. DECLARE_MESSAGE_MAP()
  49. };
  50. BEGIN_MESSAGE_MAP(CVarSetApp, CWinApp)
  51. //{{AFX_MSG_MAP(CVarSetApp)
  52. // NOTE - the ClassWizard will add and remove mapping macros here.
  53. // DO NOT EDIT what you see in these blocks of generated code!
  54. //}}AFX_MSG_MAP
  55. END_MESSAGE_MAP()
  56. CVarSetApp theApp;
  57. BOOL CVarSetApp::InitInstance()
  58. {
  59. ATLTRACE(_T("{McsVarSetMin.dll}CVarSetApp::InitInstance() : m_hInstance=0x%08lX\n"), m_hInstance);
  60. _Module.Init(ObjectMap, m_hInstance, &LIBID_MCSVARSETMINLib);
  61. BOOL bInit = CWinApp::InitInstance();
  62. _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
  63. return bInit;
  64. }
  65. int CVarSetApp::ExitInstance()
  66. {
  67. ATLTRACE(_T("{McsVarSetMin.dll}CVarSetApp::ExitInstance() : m_hInstance=0x%08lX\n"), m_hInstance);
  68. _Module.Term();
  69. return CWinApp::ExitInstance();
  70. }
  71. /////////////////////////////////////////////////////////////////////////////
  72. // Used to determine whether the DLL can be unloaded by OLE
  73. STDAPI DllCanUnloadNow(void)
  74. {
  75. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  76. return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
  77. }
  78. /////////////////////////////////////////////////////////////////////////////
  79. // Returns a class factory to create an object of the requested type
  80. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  81. {
  82. return _Module.GetClassObject(rclsid, riid, ppv);
  83. }
  84. /////////////////////////////////////////////////////////////////////////////
  85. // DllRegisterServer - Adds entries to the system registry
  86. STDAPI DllRegisterServer(void)
  87. {
  88. // registers object, typelib and all interfaces in typelib
  89. return _Module.RegisterServer(FALSE);
  90. }
  91. /////////////////////////////////////////////////////////////////////////////
  92. // DllUnregisterServer - Removes entries from the system registry
  93. STDAPI DllUnregisterServer(void)
  94. {
  95. return _Module.UnregisterServer(FALSE);
  96. }