windows-nt/Source/XPSP1/NT/admin/admt/migdrvr/migdrvr.cpp
2020-09-26 16:20:57 +08:00

128 lines
3.6 KiB
C++

/*---------------------------------------------------------------------------
File: McsMigrationDriver.cpp
Comments: Main program for COM object that drives the migration process.
This file is mostly generated by the ATL wizard.
(c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
Proprietary and confidential to Mission Critical Software, Inc.
REVISION LOG ENTRY
Revision By: Christy Boles
---------------------------------------------------------------------------
*/// McsMigrationDriver.cpp : Implementation of DLL Exports.
// Note: Proxy/Stub Information
// To build a separate proxy/stub DLL,
// run nmake -f McsMigrationDriverps.mk in the project directory.
#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include <locale.h>
#include "MigDrvr.h"
#include "MigDrvr_i.c"
//#import "\bin\McsVarSetMin.tlb" no_namespace
#import "VarSet.tlb" no_namespace rename("property", "aproperty")
#include "Migrator.h"
#include "ErrDct.hpp"
#include "ResStr.h"
TErrorDct errTrace;
TError & errCommon = errTrace;
StringLoader gString;
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_Migrator, CMigrator)
END_OBJECT_MAP()
class CMcsMigrationDriverApp : public CWinApp
{
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMcsMigrationDriverApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
//{{AFX_MSG(CMcsMigrationDriverApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CMcsMigrationDriverApp, CWinApp)
//{{AFX_MSG_MAP(CMcsMigrationDriverApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CMcsMigrationDriverApp theApp;
BOOL CMcsMigrationDriverApp::InitInstance()
{
ATLTRACE(_T("{McsMigrationDriver.dll}CDomMigSIApp::InitInstance() : m_hInstance=0x%08lX\n"), m_hInstance);
_wsetlocale( LC_ALL, L".ACP" );
_Module.Init(ObjectMap, m_hInstance, &LIBID_MCSMIGRATIONDRIVERLib);
BOOL bInit = CWinApp::InitInstance();
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
return bInit;
}
int CMcsMigrationDriverApp::ExitInstance()
{
ATLTRACE(_T("{McsMigrationDriver.dll}CDomMigSIApp::ExitInstance() : m_hInstance=0x%08lX\n"), m_hInstance);
_Module.Term();
return CWinApp::ExitInstance();
}
/////////////////////////////////////////////////////////////////////////////
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
return _Module.GetClassObject(rclsid, riid, ppv);
}
/////////////////////////////////////////////////////////////////////////////
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
return _Module.RegisterServer(FALSE);
}
/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
return _Module.UnregisterServer(FALSE);
}