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.

127 lines
3.7 KiB

  1. /*---------------------------------------------------------------------------
  2. File: McsMigrationDriver.cpp
  3. Comments: Main program for COM object that drives the migration process.
  4. This file is mostly generated by the ATL wizard.
  5. (c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
  6. Proprietary and confidential to Mission Critical Software, Inc.
  7. REVISION LOG ENTRY
  8. Revision By: Christy Boles
  9. ---------------------------------------------------------------------------
  10. */// McsMigrationDriver.cpp : Implementation of DLL Exports.
  11. // Note: Proxy/Stub Information
  12. // To build a separate proxy/stub DLL,
  13. // run nmake -f McsMigrationDriverps.mk in the project directory.
  14. #include "stdafx.h"
  15. #include "resource.h"
  16. #include <initguid.h>
  17. #include <locale.h>
  18. #include "MigDrvr.h"
  19. #include "MigDrvr_i.c"
  20. //#import "\bin\McsVarSetMin.tlb" no_namespace
  21. #import "VarSet.tlb" no_namespace rename("property", "aproperty")
  22. #include "Migrator.h"
  23. #include "ErrDct.hpp"
  24. #include "ResStr.h"
  25. TErrorDct errTrace;
  26. TError & errCommon = errTrace;
  27. StringLoader gString;
  28. CComModule _Module;
  29. BEGIN_OBJECT_MAP(ObjectMap)
  30. OBJECT_ENTRY(CLSID_Migrator, CMigrator)
  31. END_OBJECT_MAP()
  32. class CMcsMigrationDriverApp : public CWinApp
  33. {
  34. public:
  35. // Overrides
  36. // ClassWizard generated virtual function overrides
  37. //{{AFX_VIRTUAL(CMcsMigrationDriverApp)
  38. public:
  39. virtual BOOL InitInstance();
  40. virtual int ExitInstance();
  41. //}}AFX_VIRTUAL
  42. //{{AFX_MSG(CMcsMigrationDriverApp)
  43. // NOTE - the ClassWizard will add and remove member functions here.
  44. // DO NOT EDIT what you see in these blocks of generated code !
  45. //}}AFX_MSG
  46. DECLARE_MESSAGE_MAP()
  47. };
  48. BEGIN_MESSAGE_MAP(CMcsMigrationDriverApp, CWinApp)
  49. //{{AFX_MSG_MAP(CMcsMigrationDriverApp)
  50. // NOTE - the ClassWizard will add and remove mapping macros here.
  51. // DO NOT EDIT what you see in these blocks of generated code!
  52. //}}AFX_MSG_MAP
  53. END_MESSAGE_MAP()
  54. CMcsMigrationDriverApp theApp;
  55. BOOL CMcsMigrationDriverApp::InitInstance()
  56. {
  57. ATLTRACE(_T("{McsMigrationDriver.dll}CDomMigSIApp::InitInstance() : m_hInstance=0x%08lX\n"), m_hInstance);
  58. _wsetlocale( LC_ALL, L".ACP" );
  59. _Module.Init(ObjectMap, m_hInstance, &LIBID_MCSMIGRATIONDRIVERLib);
  60. BOOL bInit = CWinApp::InitInstance();
  61. _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
  62. return bInit;
  63. }
  64. int CMcsMigrationDriverApp::ExitInstance()
  65. {
  66. ATLTRACE(_T("{McsMigrationDriver.dll}CDomMigSIApp::ExitInstance() : m_hInstance=0x%08lX\n"), m_hInstance);
  67. _Module.Term();
  68. return CWinApp::ExitInstance();
  69. }
  70. /////////////////////////////////////////////////////////////////////////////
  71. // Used to determine whether the DLL can be unloaded by OLE
  72. STDAPI DllCanUnloadNow(void)
  73. {
  74. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  75. return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
  76. }
  77. /////////////////////////////////////////////////////////////////////////////
  78. // Returns a class factory to create an object of the requested type
  79. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  80. {
  81. return _Module.GetClassObject(rclsid, riid, ppv);
  82. }
  83. /////////////////////////////////////////////////////////////////////////////
  84. // DllRegisterServer - Adds entries to the system registry
  85. STDAPI DllRegisterServer(void)
  86. {
  87. // registers object, typelib and all interfaces in typelib
  88. return _Module.RegisterServer(FALSE);
  89. }
  90. /////////////////////////////////////////////////////////////////////////////
  91. // DllUnregisterServer - Removes entries from the system registry
  92. STDAPI DllUnregisterServer(void)
  93. {
  94. return _Module.UnregisterServer(FALSE);
  95. }