GME  13
Mga.cpp
Go to the documentation of this file.
00001 // Mga.cpp : Implementation of DLL Exports.
00002 
00003 
00004 // Note: Proxy/Stub Information
00005 //      To build a separate proxy/stub DLL, 
00006 //      run nmake -f Mgaps.mk in the project directory.
00007 
00008 #include "stdafx.h"
00009 #include "resource.h"
00010 #include <initguid.h>
00011 
00012 #include "Core_i.c"
00013 #include "CoreLib_i.c"
00014 #include "Meta_i.c"
00015 #include "Mga_i.c"
00016 #include "MgaLib_i.c"
00017 #include "Gme_i.c"
00018 
00019 #include "MgaProject.h"
00020 #include "MgaFCO.h"
00021 
00022 #pragma comment(linker, "\"/manifestdependency:type='win32' name='Core' version='1.0.0.0' language='*'\"")
00023 #pragma comment(linker, "\"/manifestdependency:type='win32' name='Meta' version='1.0.0.0' language='*'\"")
00024 
00025 
00026 CComModule _Module;
00027 
00028 BEGIN_OBJECT_MAP(ObjectMap)
00029 OBJECT_ENTRY(CLSID_MgaProject, CMgaProject)
00030 OBJECT_ENTRY(CLSID_MgaO, FCO)
00031 OBJECT_ENTRY(CLSID_MgaFCOs, CMgaFCOs)
00032 OBJECT_ENTRY(CLSID_MgaFolders, CMgaFolders)
00033 OBJECT_ENTRY(CLSID_MgaObjects, CMgaObjects)
00034 OBJECT_ENTRY(CLSID_MgaRegNodes, CMgaRegNodes)
00035 //OBJECT_ENTRY(CLSID_MgaFolder, CMgaFolder)
00036 //OBJECT_ENTRY(CLSID_MgaModel, CMgaModel)
00037 //OBJECT_ENTRY(CLSID_MgaAtom, CMgaAtom)
00038 //OBJECT_ENTRY(CLSID_MgaConnection, CMgaSimpleConnection)
00039 //OBJECT_ENTRY(CLSID_MgaReference, CMgaReference)
00040 //OBJECT_ENTRY(CLSID_MgaSet, CMgaSet)
00041 //OBJECT_ENTRY(CLSID_MgaSimpleConnection, CMgaSimpleConnection)
00042 //OBJECT_ENTRY(CLSID_MgaFilter, CMgaFilter)
00043 //OBJECT_ENTRY(CLSID_MgaConstraint, CMgaConstraint)
00044 //OBJECT_ENTRY(CLSID_MgaClient, CMgaClient)
00045 END_OBJECT_MAP()
00046 
00048 // DLL Entry Point
00049 
00050 extern "C"
00051 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
00052 {
00053     if (dwReason == DLL_PROCESS_ATTACH)
00054     {
00055         _Module.Init(ObjectMap, hInstance, &LIBID_MGALib);
00056         DisableThreadLibraryCalls(hInstance);
00057     }
00058     else if (dwReason == DLL_PROCESS_DETACH)
00059         _Module.Term();
00060     return TRUE;    // ok
00061 }
00062 
00064 // Used to determine whether the DLL can be unloaded by OLE
00065 
00066 STDAPI DllCanUnloadNow(void)
00067 {
00068     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
00069 }
00070 
00072 // Returns a class factory to create an object of the requested type
00073 
00074 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
00075 {
00076     return _Module.GetClassObject(rclsid, riid, ppv);
00077 }
00078 
00080 // DllRegisterServer - Adds entries to the system registry
00081 
00082 STDAPI DllRegisterServer(void)
00083 {
00084     // registers object, typelib and all interfaces in typelib
00085     HRESULT res = _Module.RegisterServer(TRUE);
00086         return res;
00087 }
00088 
00090 // DllUnregisterServer - Removes entries from the system registry
00091 
00092 STDAPI DllUnregisterServer(void)
00093 {
00094     HRESULT res = _Module.UnregisterServer(TRUE);
00095         return res;
00096 }
00097 
00099 
00100 const CoreObj NULLCOREOBJ;
00101 const CComVariant NULLVARIANT;
00102 
00103 /*
00104 HRESULT check_location_compatibility(IMgaFCO *newobj, IMgaFCO *oldobj) {
00105         CComPtr<IMgaProject> p;
00106         HRESULT hr;
00107         if((hr = newobj->get_Project(&p)) != S_OK) return hr;
00108         if(!oldobj) {
00109                 if(p->Open != CMgaProject::Open) return E_SAMEPROJECT;
00110         }
00111         else {
00112                 return oldobj->CheckProject(p);
00113         }
00114         return S_OK;
00115 }
00116 */
00117 
00119 
00120 
00121 #include <time.h>
00122 CComBSTR Now(void) {
00123         time_t t;
00124         time(&t);
00125         char *p = ctime(&t);
00126         *strchr(p,'\n') = '\0';
00127         return p;
00128 
00129 }
00130 
00131 
00132 #ifdef OWN_META
00133 #include "MgaMetaProject.cpp"
00134 #include "MgaMetaModel.cpp"
00135 #endif
00136 #include "MgaO.h"
00137