[commit] r1393 - trunk/GME/MgaUtil

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Tue Jun 28 17:05:27 CDT 2011


Author: ksmyth
Date: Tue Jun 28 17:05:27 2011
New Revision: 1393

Log:
Convert to #import instead of MIDL .hs. CMgaRegistrar implements ISupportErrorInfo

Modified:
   trunk/GME/MgaUtil/CompDlg.cpp
   trunk/GME/MgaUtil/ComponentProxy.h
   trunk/GME/MgaUtil/MgaClosure.h
   trunk/GME/MgaUtil/MgaEventLogger.h
   trunk/GME/MgaUtil/MgaLauncher.cpp
   trunk/GME/MgaUtil/MgaLauncher.h
   trunk/GME/MgaUtil/MgaProgressDlg.h
   trunk/GME/MgaUtil/MgaRegistrar.cpp
   trunk/GME/MgaUtil/MgaRegistrar.h
   trunk/GME/MgaUtil/MgaResolver.h
   trunk/GME/MgaUtil/MgaUtilApp.cpp
   trunk/GME/MgaUtil/StdAfx.cpp
   trunk/GME/MgaUtil/StdAfx.h

Modified: trunk/GME/MgaUtil/CompDlg.cpp
==============================================================================
--- trunk/GME/MgaUtil/CompDlg.cpp	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/CompDlg.cpp	Tue Jun 28 17:05:27 2011	(r1393)
@@ -342,7 +342,7 @@
 			CComPtr<IMgaRegistrar> registrar;
 			HRESULT registrarHr;
 			if (CUACUtils::isVistaOrLater()) {
-				registrarHr = CUACUtils::CreateElevatedInstance(CLSID_MgaRegistrar, &registrar, GetSafeHwnd());
+				registrarHr = CUACUtils::CreateElevatedInstance(__uuidof(MgaRegistrar), &registrar, GetSafeHwnd());
 			}
 			else {
 				registrarHr = registrar.CoCreateInstance(OLESTR("Mga.MgaRegistrar"));
@@ -391,7 +391,7 @@
 			CComPtr<IMgaRegistrar> registrar;
 			HRESULT registrarHr;
 			if (CUACUtils::isVistaOrLater() && (regacc_translate(m_accessmode) != REGACCESS_USER) ) {
-				registrarHr = CUACUtils::CreateElevatedInstance(CLSID_MgaRegistrar, &registrar);
+				registrarHr = CUACUtils::CreateElevatedInstance(__uuidof(MgaRegistrar), &registrar);
 			}
 			else {
 				registrarHr = registrar.CoCreateInstance(OLESTR("Mga.MgaRegistrar"));
@@ -464,7 +464,7 @@
 	CComPtr<IMgaRegistrar> registrar;
 	HRESULT hr;
 	if (CUACUtils::isVistaOrLater()) {
-		hr = CUACUtils::CreateElevatedInstance(CLSID_MgaRegistrar, &registrar, GetSafeHwnd());
+		hr = CUACUtils::CreateElevatedInstance(__uuidof(MgaRegistrar), &registrar, GetSafeHwnd());
 	} else {
 		hr = registrar.CoCreateInstance(OLESTR("Mga.MgaRegistrar"));
 	}
@@ -499,7 +499,7 @@
 	CComPtr<IMgaRegistrar> registrar;
 	HRESULT registrarHr;
 	if (CUACUtils::isVistaOrLater() && (acmode != REGACCESS_USER) ) {
-		registrarHr = CUACUtils::CreateElevatedInstance(CLSID_MgaRegistrar, &registrar);
+		registrarHr = CUACUtils::CreateElevatedInstance(__uuidof(MgaRegistrar), &registrar);
 	}
 	else {
 		registrarHr = registrar.CoCreateInstance(OLESTR("Mga.MgaRegistrar"));

Modified: trunk/GME/MgaUtil/ComponentProxy.h
==============================================================================
--- trunk/GME/MgaUtil/ComponentProxy.h	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/ComponentProxy.h	Tue Jun 28 17:05:27 2011	(r1393)
@@ -9,7 +9,7 @@
 // CComponentProxy
 class ATL_NO_VTABLE CComponentProxy : 
 	public CComObjectRootEx<CComSingleThreadModel>,
-	public CComCoClass<CComponentProxy, &CLSID_ComponentProxy>,
+	public CComCoClass<CComponentProxy, &__uuidof(ComponentProxy)>,
 	public IMgaComponentProxy,
 	public IMgaComponentEx,
 	public IGMEVersionInfo

Modified: trunk/GME/MgaUtil/MgaClosure.h
==============================================================================
--- trunk/GME/MgaUtil/MgaClosure.h	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/MgaClosure.h	Tue Jun 28 17:05:27 2011	(r1393)
@@ -6,8 +6,8 @@
 
 class ATL_NO_VTABLE CMgaClosure 
 	: public CComObjectRootEx<CComSingleThreadModel>
-	, public CComCoClass<CMgaClosure, &CLSID_MgaClosure>
-	, public IDispatchImpl<IMgaClosure, &IID_IMgaClosure, &LIBID_MGAUtilLib>  
+	, public CComCoClass<CMgaClosure, &__uuidof(MgaClosure)>
+	, public IDispatchImpl<IMgaClosure, &__uuidof(IMgaClosure), &__uuidof(__MGAUtilLib)>  
 {
 public:
 	CMgaClosure() { }

Modified: trunk/GME/MgaUtil/MgaEventLogger.h
==============================================================================
--- trunk/GME/MgaUtil/MgaEventLogger.h	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/MgaEventLogger.h	Tue Jun 28 17:05:27 2011	(r1393)
@@ -10,8 +10,8 @@
 
 class ATL_NO_VTABLE CMgaEventLogger :
 	public CComObjectRootEx<CComSingleThreadModel>,
-	public CComCoClass<CMgaEventLogger, &CLSID_MgaEventLogger>,
-	public IDispatchImpl<IMgaEventLogger, &IID_IMgaEventLogger, &LIBID_MGAUtilLib>  
+	public CComCoClass<CMgaEventLogger, &__uuidof(MgaEventLogger)>,
+	public IDispatchImpl<IMgaEventLogger, &__uuidof(IMgaEventLogger), &__uuidof(__MGAUtilLib)>  
 {
 public:
 	CMgaEventLogger();

Modified: trunk/GME/MgaUtil/MgaLauncher.cpp
==============================================================================
--- trunk/GME/MgaUtil/MgaLauncher.cpp	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/MgaLauncher.cpp	Tue Jun 28 17:05:27 2011	(r1393)
@@ -814,8 +814,8 @@
 					try	{
 						COMTHROW(component->Initialize(project));
 						CComPtr<IMgaTerritory> terr;
-						COMTHROW(project->CreateTerritory(NULL, &terr));
-						COMTHROW(project->BeginTransaction(terr));
+						COMTHROW(project->CreateTerritory(NULL, &terr, 0));
+						COMTHROW(project->BeginTransaction(terr, TRANSACTION_GENERAL));
 						try	{
 							COMTHROW( component->Invoke(project, selectedobjs, param) );
 							COMTHROW(project->CommitTransaction());
@@ -848,8 +848,8 @@
 					}
 					else {
 						CComPtr<IMgaTerritory> terr;
-						COMTHROW(project->CreateTerritory(NULL, &terr));
-						COMTHROW(project->BeginTransaction(terr));
+						COMTHROW(project->CreateTerritory(NULL, &terr, 0));
+						COMTHROW(project->BeginTransaction(terr, TRANSACTION_GENERAL));
 						try	{		
 							COMTHROW( component->Invoke(project, selectedobjs, param) );
 							COMTHROW(project->CommitTransaction());

Modified: trunk/GME/MgaUtil/MgaLauncher.h
==============================================================================
--- trunk/GME/MgaUtil/MgaLauncher.h	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/MgaLauncher.h	Tue Jun 28 17:05:27 2011	(r1393)
@@ -6,8 +6,8 @@
 
 class ATL_NO_VTABLE CMgaLauncher : 
 	public CComObjectRootEx<CComSingleThreadModel>,
-	public CComCoClass<CMgaLauncher, &CLSID_MgaLauncher>,
-	public IDispatchImpl<IMgaLauncher, &IID_IMgaLauncher, &LIBID_MGAUtilLib>
+	public CComCoClass<CMgaLauncher, &__uuidof(MgaLauncher)>,
+	public IDispatchImpl<IMgaLauncher, &__uuidof(IMgaLauncher), &__uuidof(__MGAUtilLib)>
 {
 public:
 	CMgaLauncher() { }

Modified: trunk/GME/MgaUtil/MgaProgressDlg.h
==============================================================================
--- trunk/GME/MgaUtil/MgaProgressDlg.h	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/MgaProgressDlg.h	Tue Jun 28 17:05:27 2011	(r1393)
@@ -6,7 +6,7 @@
 
 class ATL_NO_VTABLE CMgaProgressDlg : 
 	public CComObjectRootEx<CComSingleThreadModel>,
-	public CComCoClass<CMgaProgressDlg, &CLSID_MgaProgressDlg>,
+	public CComCoClass<CMgaProgressDlg, &__uuidof(MgaProgressDlg)>,
 	public IMgaProgressDlg
 {
 public:

Modified: trunk/GME/MgaUtil/MgaRegistrar.cpp
==============================================================================
--- trunk/GME/MgaUtil/MgaRegistrar.cpp	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/MgaRegistrar.cpp	Tue Jun 28 17:05:27 2011	(r1393)
@@ -1211,11 +1211,9 @@
 			  }
 			}
 
-			CComObjPtr<IMgaMetaParser> parser;
-			COMTHROW( parser.CoCreateInstance(OLESTR("MGA.MgaMetaParser")) );
-			ASSERT( parser != NULL );
-
-			COMTHROW( parser->Parse(PutInBstr(file), PutInBstr(conn)) );
+			IMgaMetaParserPtr parser;
+			COMTHROW(parser.CreateInstance(L"MGA.MgaMetaParser"));
+			parser->__Parse(_bstr_t(file), _bstr_t(conn));
 		}
 
 		CComBstrObj name;
@@ -1296,8 +1294,7 @@
 
 STDMETHODIMP CMgaRegistrar::RegisterParadigm(BSTR name, BSTR connstr, BSTR version, VARIANT guid, regaccessmode_enum mode)
 {
-	COLE2CT version2(version);
-	CString cver(version2); 
+	CString cver(version); 
 
 	if( guid.vt != (VT_UI1 | VT_ARRAY) || GetArrayLength(guid) != sizeof(GUID) )
 	COMRETURN(E_INVALIDARG);
@@ -1742,7 +1739,7 @@
 }
 
 // throws hresult_exception
-void GetComponents(HKEY hive, CStringArray& ret) {
+void GetComponents_(HKEY hive, CStringArray& ret) {
 	CRegKey comps;
 	LONG res = comps.Open(hive, rootreg + _T("\\Components"), KEY_READ);
 	if (res != ERROR_SUCCESS && res != ERROR_ACCESS_DENIED && res != ERROR_FILE_NOT_FOUND)
@@ -1786,9 +1783,9 @@
 	{
 		CStringArray ret;
 		if (mode & REGACCESS_USER)
-			GetComponents(HKEY_CURRENT_USER, ret);
+			GetComponents_(HKEY_CURRENT_USER, ret);
 		if (mode & REGACCESS_SYSTEM)
-			GetComponents(HKEY_LOCAL_MACHINE, ret);
+			GetComponents_(HKEY_LOCAL_MACHINE, ret);
 		CopyTo(ret, progids);
 	}
 	COMCATCH(;)
@@ -2116,9 +2113,9 @@
 
 		CStringArray components;
 		if (mode & REGACCESS_USER)
-			GetComponents(HKEY_CURRENT_USER, components);
+			GetComponents_(HKEY_CURRENT_USER, components);
 		if (mode & REGACCESS_SYSTEM)
-			GetComponents(HKEY_LOCAL_MACHINE, components);
+			GetComponents_(HKEY_LOCAL_MACHINE, components);
 		for (int i = 0; i < components.GetSize(); i++) {
 			componenttype_enum comptype = COMPONENTTYPE_NONE;
 			PutInBstr progid(components.GetAt(i));

Modified: trunk/GME/MgaUtil/MgaRegistrar.h
==============================================================================
--- trunk/GME/MgaUtil/MgaRegistrar.h	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/MgaRegistrar.h	Tue Jun 28 17:05:27 2011	(r1393)
@@ -7,8 +7,9 @@
 
 class ATL_NO_VTABLE CMgaRegistrar : 
 	public CComObjectRootEx<CComSingleThreadModel>,
-	public CComCoClass<CMgaRegistrar, &CLSID_MgaRegistrar>,
-	public IDispatchImpl<IMgaRegistrar, &IID_IMgaRegistrar, &LIBID_MGAUtilLib>,
+	public CComCoClass<CMgaRegistrar, &__uuidof(MgaRegistrar)>,
+	public IDispatchImpl<IMgaRegistrar, &__uuidof(IMgaRegistrar), &__uuidof(__MGAUtilLib)>,
+	public ISupportErrorInfoImpl<&__uuidof(IMgaRegistrar)>,
 	public IGMEVersionInfoImpl
 {
 public:
@@ -20,7 +21,8 @@
 BEGIN_COM_MAP(CMgaRegistrar)
 	COM_INTERFACE_ENTRY(IMgaRegistrar)
 	COM_INTERFACE_ENTRY(IDispatch)
-	COM_INTERFACE_ENTRY_IID(IID_IGMEVersionInfo, IGMEVersionInfoImpl)
+	COM_INTERFACE_ENTRY(ISupportErrorInfo)
+	COM_INTERFACE_ENTRY_IID(__uuidof(IGMEVersionInfo), IGMEVersionInfoImpl)
 END_COM_MAP()
 
 // ------- Methods

Modified: trunk/GME/MgaUtil/MgaResolver.h
==============================================================================
--- trunk/GME/MgaUtil/MgaResolver.h	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/MgaResolver.h	Tue Jun 28 17:05:27 2011	(r1393)
@@ -165,8 +165,8 @@
 // CMgaResolver
 class ATL_NO_VTABLE CMgaResolver : 
 	public CComObjectRootEx<CComSingleThreadModel>,
-	public CComCoClass<CMgaResolver, &CLSID_MgaResolver>,
-	public IDispatchImpl<IMgaResolver, &IID_IMgaResolver, &LIBID_MGAUtilLib>
+	public CComCoClass<CMgaResolver, &__uuidof(MgaResolver)>,
+	public IDispatchImpl<IMgaResolver, &__uuidof(IMgaResolver), &__uuidof(__MGAUtilLib)>
 {
 public:
 	CMgaResolver() : mb_is_interactive(true), mb_use_sticky(false)

Modified: trunk/GME/MgaUtil/MgaUtilApp.cpp
==============================================================================
--- trunk/GME/MgaUtil/MgaUtilApp.cpp	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/MgaUtilApp.cpp	Tue Jun 28 17:05:27 2011	(r1393)
@@ -5,9 +5,6 @@
 #include <initguid.h>
 #include "MgaUtilApp.h"
 
-#include "MgaUtil_i.c"
-#include "MgaUtilLib_i.c"
-#include "Core_i.c"
 
 #include "MgaResolver.h"
 #include "MgaRegistrar.h"
@@ -78,13 +75,13 @@
 CComModule _Module;
 
 BEGIN_OBJECT_MAP(ObjectMap)
-OBJECT_ENTRY(CLSID_MgaResolver, CMgaResolver)
-OBJECT_ENTRY(CLSID_MgaRegistrar, CMgaRegistrar)
-OBJECT_ENTRY(CLSID_MgaLauncher, CMgaLauncher)
-OBJECT_ENTRY(CLSID_MgaProgressDlg, CMgaProgressDlg)
-OBJECT_ENTRY(CLSID_ComponentProxy, CComponentProxy)
-OBJECT_ENTRY(CLSID_MgaClosure, CMgaClosure)
-OBJECT_ENTRY(CLSID_MgaEventLogger, CMgaEventLogger)
+OBJECT_ENTRY(__uuidof(MgaResolver), CMgaResolver)
+OBJECT_ENTRY(__uuidof(MgaRegistrar), CMgaRegistrar)
+OBJECT_ENTRY(__uuidof(MgaLauncher), CMgaLauncher)
+OBJECT_ENTRY(__uuidof(MgaProgressDlg), CMgaProgressDlg)
+OBJECT_ENTRY(__uuidof(ComponentProxy), CComponentProxy)
+OBJECT_ENTRY(__uuidof(MgaClosure), CMgaClosure)
+OBJECT_ENTRY(__uuidof(MgaEventLogger), CMgaEventLogger)
 END_OBJECT_MAP()
 
 STDAPI DllCanUnloadNow(void)

Modified: trunk/GME/MgaUtil/StdAfx.cpp
==============================================================================
--- trunk/GME/MgaUtil/StdAfx.cpp	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/StdAfx.cpp	Tue Jun 28 17:05:27 2011	(r1393)
@@ -9,3 +9,6 @@
 #ifdef _ATL_STATIC_REGISTRY
 #include <statreg.h>
 #endif
+
+#import "ParserLib.tlb" implementation_only auto_search no_namespace no_search_namespace raw_method_prefix("") high_method_prefix("__")
+

Modified: trunk/GME/MgaUtil/StdAfx.h
==============================================================================
--- trunk/GME/MgaUtil/StdAfx.h	Tue Jun 28 17:03:31 2011	(r1392)
+++ trunk/GME/MgaUtil/StdAfx.h	Tue Jun 28 17:05:27 2011	(r1393)
@@ -58,6 +58,31 @@
 extern CComModule _Module;
 #include <atlcom.h>
 
+#define wireHWND HWND
+
+#import "CoreLib.tlb" no_implementation auto_search no_namespace no_search_namespace raw_method_prefix("") high_method_prefix("__")
+#import "MetaLib.tlb" no_implementation auto_search no_namespace no_search_namespace raw_method_prefix("") high_method_prefix("__")
+#import "MgaLib.tlb" no_implementation auto_search no_namespace no_search_namespace raw_method_prefix("") high_method_prefix("__")
+#import "ParserLib.tlb" no_implementation auto_search no_namespace no_search_namespace raw_method_prefix("") high_method_prefix("__")
+#import "GMELib.tlb" no_implementation auto_search no_namespace no_search_namespace raw_method_prefix("") high_method_prefix("__")
+#import "MgaUtilLib.tlb" no_implementation auto_search no_namespace no_search_namespace raw_method_prefix("") high_method_prefix("__")
+
+#include "CommonImport.h"
+
+#define cpp_quote(x) 
+#include "Interfaceversion.h"
+#undef cpp_quote
+typedef GMEInterfaceVersion_enum GMEInterfaceVersion;
+
+// Don't load the MIDL-generated headers
+#define __Core_h__
+#define __Meta_h__
+#define __Mga_h__
+#define __MgaUtil_h__
+#define __MgaUtilLib_h__
+#define __Parser_h__
+#define __Gme_h__
+
 ///////////////////////////////////////////////////////////////////
 
 #define chSTR(x) #x
@@ -70,7 +95,6 @@
 #include <vector>
 #include <list>
 
-#include "MgaUtilLib.h"
 #include "CommonSmart.h"
 #include "CommonStl.h"
 #include "CommonError.h"


More information about the gme-commit mailing list