/////////////////////////////////////////////////////////////////////////////
// mm.idl
//		IDL description of the interfaces used in the mergemod.dll
//		Copyright (C) Microsoft Corp 1998.  All Rights Reserved.
// 
// typedefs and guids are placed in header files so clients can just include them and have the GUIDs they need
cpp_quote("#ifndef __FORWARD_IID_IMSMMERGETYPELIB")
cpp_quote("#define __FORWARD_IID_IMSMMERGETYPELIB")

typedef
[
	uuid(0ADDA825-2C26-11D2-AD65-00A0C9AF11A6),
	helpstring("MSM Merge Error Types")
]
enum msmErrorType
{
	msmErrorLanguageUnsupported = 1,	// language does not exist in merge module
	msmErrorLanguageFailed = 2,		// failed to change the language of the merge module
	msmErrorExclusion = 3,				// failed to merge because there is an exclusion
	msmErrorTableMerge = 4,				// merge conflict in table
	msmErrorResequenceMerge = 5,		// failed to merge in a resequenced action
	msmErrorFileCreate = 6,				// error creating file
	msmErrorDirCreate = 7,				// error creating directory
	msmErrorFeatureRequired = 8,     // feature substitution with no feature specified
	msmErrorBadNullSubstitution = 9,    // substitution attempted to place NULL in a non-nullable column
	msmErrorBadSubstitutionType = 10,   // substitution attempted to mismatch text/int/binary column types
	msmErrorMissingConfigItem = 11,     // substitution attempted to use an undefined property
	msmErrorBadNullResponse = 12,       // client returned NULL when not allowed
	msmErrorDataRequestFailed = 13,     // client failed during callback
   msmErrorPlatformMismatch = 14       // merging 64bit module into 32bit package
} msmErrorType;

typedef
[
	uuid(26903062-AC65-493D-8976-29D399FA7268),
	helpstring("MSM Configurable Item Types")
]
enum msmConfigurableItemFormat
{
	msmConfigurableItemText = 0,
	msmConfigurableItemKey = 1,
	msmConfigurableItemInteger = 2,
	msmConfigurableItemBitfield = 3
} msmConfigurableItemFormat;


typedef
[
	uuid(8BA37820-9523-4772-8272-52EAB038DA0C),
	helpstring("MSM Configurable Item Options")
]
enum msmConfigurableItemOptions
{
	msmConfigurableOptionKeyNoOrphan = 1,
	msmConfigurableOptionNonNullable = 2
} msmConfigurableItemOptions;

cpp_quote("#endif // __FORWARD_IID_IMSMMERGETYPELIB")


/////////////////////////////////////////////////////////////////////////////
// String Collection

///////////////////////////////////////////////////////////
// IEnumMsmString
[
	object,
	uuid(0ADDA826-2C26-11D2-AD65-00A0C9AF11A6),
	helpstring("MSM Merge String Enumerator"),
	pointer_default(unique)
]
interface IEnumMsmString : IUnknown
{
	HRESULT Next([in] unsigned long cFetch, [out] BSTR* rgbstrStrings, [out, retval] unsigned long* pcFetched);
	HRESULT Skip([in] unsigned long cSkip);
	HRESULT Reset(void);
	HRESULT Clone([out, retval] IEnumMsmString** pemsmStrings);
};

///////////////////////////////////////////////////////////
// IMsmStrings
[
	object,
	uuid(0ADDA827-2C26-11D2-AD65-00A0C9AF11A6),
	helpstring("MSM Merge String Collection"),
	pointer_default(unique),
	oleautomation,
	dual
]
interface IMsmStrings : IDispatch
{
	[propget, id(0), helpstring("Given an index, returns that string from the collection.")] 
		HRESULT Item([in] long Item, [out, retval] BSTR* Return);
	[propget, id(4), helpstring("Return the number of items in the collection.")] 
		HRESULT Count([out, retval] long* Count);
	[propget, id(-4), hidden] HRESULT _NewEnum([out, retval] IUnknown** NewEnum);
};


/////////////////////////////////////////////////////////////////////////////
// Error Information

///////////////////////////////////////////////////////////
// IMsmError
[
	object,
	uuid(0ADDA828-2C26-11D2-AD65-00A0C9AF11A6),
	helpstring("MSM Merge Error Interface"),
	pointer_default(unique),
	oleautomation,
	dual
]
interface IMsmError : IDispatch
{
	[propget, id(1), helpstring("Returns the type of error.")] 
		HRESULT Type([out, retval] msmErrorType* ErrorType);
	[propget, id(2), helpstring("Returns path to the error.")] 
		HRESULT Path([out, retval] BSTR* ErrorPath);
	[propget, id(3), helpstring("Returns the LANGID of the error.")] 
		HRESULT Language([out, retval] short* ErrorLanguage);
	
	[propget, id(4), helpstring("Returns the name of the table in the database where this error can be found.")] 
		HRESULT DatabaseTable([out, retval] BSTR* ErrorTable);
	[propget, id(5), helpstring("Returns the primary keys of the record in the module causing this error.")] 
		HRESULT DatabaseKeys([out, retval] IMsmStrings** ErrorKeys);
	[propget, id(6), helpstring("Returns the name of the table in the module where this error can be found.")] 
		HRESULT ModuleTable([out, retval] BSTR* ErrorTable);
	[propget, id(7), helpstring("Returns the primary keys of the record in the module causing this error.")] 
		HRESULT ModuleKeys([out, retval] IMsmStrings** ErrorKeys);
};

///////////////////////////////////////////////////////////
// IEnumMsmError
[
	object,
	uuid(0ADDA829-2C26-11D2-AD65-00A0C9AF11A6),
	helpstring("MSM Merge Error Enumerator"),
	pointer_default(unique)
]
interface IEnumMsmError : IUnknown
{
	HRESULT Next([in] unsigned long cFetch, [out] IMsmError** rgmsmErrors, [out, retval] unsigned long* pcFetched);
	HRESULT Skip([in] unsigned long cSkip);
	HRESULT Reset(void);
	HRESULT Clone([out, retval] IEnumMsmError** pemsmErrors);
};

///////////////////////////////////////////////////////////
// IMsmErrors
[
	object,
	uuid(0ADDA82A-2C26-11D2-AD65-00A0C9AF11A6),
	helpstring("MSM Merge Error Collection"),
	pointer_default(unique),
	oleautomation,
	dual
]
interface IMsmErrors : IDispatch
{
	[propget, id(0), helpstring("Given an index, return that error from the collection.")] 
		HRESULT Item([in] long Item, [out, retval] IMsmError** Return);

	[propget, id(4), helpstring("Return the number of errors in the collection.")] 
		HRESULT Count([out, retval] long* Count);

	[propget, id(-4), hidden] HRESULT _NewEnum([out, retval] IUnknown** NewEnum);
};


/////////////////////////////////////////////////////////////////////////////
// Dependency Information

///////////////////////////////////////////////////////////
// IMsmDependency
[
	object,
	uuid(0ADDA82B-2C26-11D2-AD65-00A0C9AF11A6),
	helpstring("MSM Merge Dependency"),
	pointer_default(unique),
	oleautomation,
	dual
]
interface IMsmDependency : IDispatch
{
	[propget, id(1), helpstring("Get the module name of the required module.")] 
		HRESULT Module([out, retval] BSTR* Module);

	[propget, id(2), helpstring("Get the LANGID of the required module.")] 
		HRESULT Language([out, retval] short* Language);

	[propget, id(3), helpstring("Get the version of the required module.")] 
		HRESULT Version([out, retval] BSTR* Version);
};

///////////////////////////////////////////////////////////
// IEnumMsmDependency
[
	object,
	uuid(0ADDA82C-2C26-11D2-AD65-00A0C9AF11A6),
	helpstring("MSM Merge Dependency Enumerator"),
	pointer_default(unique)
]
interface IEnumMsmDependency : IUnknown
{
	HRESULT Next([in] unsigned long cFetch, [out] IMsmDependency** rgmsmDependencies, [out, retval] unsigned long* pcFetched);
	HRESULT Skip([in] unsigned long cSkip);
	HRESULT Reset(void);
	HRESULT Clone([out, retval] IEnumMsmDependency** pemsmDependencies);
};

///////////////////////////////////////////////////////////
// IMsmDependencies
[
	object,
	uuid(0ADDA82D-2C26-11D2-AD65-00A0C9AF11A6),
	helpstring("MSM Merge Dependency Collection"),
	pointer_default(unique),
	oleautomation,
	dual
]
interface IMsmDependencies : IDispatch
{
	[propget, id(0), helpstring("Given an index, retrieve the dependency information from the collection.")] 
		HRESULT Item([in] long Item, [out, retval] IMsmDependency** Return);

	[propget, id(4), helpstring("Return the number of dependencies in the collection.")] 
		HRESULT Count([out, retval] long* Count);

	[propget, id(-4), hidden] HRESULT _NewEnum([out, retval] IUnknown** NewEnum);
};


///////////////////////////////////////////////////////////
// IMsmConfigurableItem
[
	object,
	uuid(4D6E6284-D21D-401E-84F6-909E00B50F71),
	helpstring("MSM Configurable Item"),
	pointer_default(unique),
	oleautomation,
	dual
]
interface IMsmConfigurableItem : IDispatch
{
	[propget, id(1), helpstring("Get the name of the configurable item.")] 
		HRESULT Name([out, retval] BSTR* Name);
	[propget, id(2), helpstring("Get the format of the configurable item.")] 
		HRESULT Format([out, retval] msmConfigurableItemFormat* Format);
	[propget, id(3), helpstring("Get the type of the configurable item.")] 
		HRESULT Type([out, retval] BSTR* Type);
	[propget, id(4), helpstring("Get the context information of the configurable item.")] 
		HRESULT Context([out, retval] BSTR* Context);
	[propget, id(5), helpstring("Get the default value of the configurable item.")] 
		HRESULT DefaultValue([out, retval] BSTR* DefaultValue);
	[propget, id(6), helpstring("Get the attributes of the configurable item.")] 
		HRESULT Attributes([out, retval] long* Attributes);
	[propget, id(7), helpstring("Get the display name of the configurable item.")] 
		HRESULT DisplayName([out, retval] BSTR* DisplayName);
	[propget, id(8), helpstring("Get the verbose description of the configurable item.")] 
		HRESULT Description([out, retval] BSTR* Description);
	[propget, id(9), helpstring("Get help location of the configurable item.")] 
		HRESULT HelpLocation([out, retval] BSTR* HelpLocation);
	[propget, id(10), helpstring("Get the help keyword of the configurable item.")] 
		HRESULT HelpKeyword([out, retval] BSTR* HelpKeyword);
};

///////////////////////////////////////////////////////////
// IEnumMsmConfigurableItem
[
	object,
	uuid(832C6969-4826-4C24-A397-B7002D8196E6),
	helpstring("MSM Configurable Item Enumerator"),
	pointer_default(unique)
]
interface IEnumMsmConfigurableItem : IUnknown
{
	HRESULT Next([in] unsigned long cFetch, [out] IMsmConfigurableItem** rgmsmItems, [out, retval] unsigned long* pcFetched);
	HRESULT Skip([in] unsigned long cSkip);
	HRESULT Reset(void);
	HRESULT Clone([out, retval] IEnumMsmConfigurableItem** pemsmConfigurableItem);
};

///////////////////////////////////////////////////////////
// IMsmConfigurableItems
[
	object,
	uuid(55BF723C-9A0D-463E-B42B-B4FBC7BE3C7C),
	helpstring("MSM Configurable Item Collection"),
	pointer_default(unique),
	oleautomation,
	dual
]
interface IMsmConfigurableItems : IDispatch
{
	[propget, id(0), helpstring("Given an index, retrieve the configurable item from the collection.")] 
		HRESULT Item([in] long Item, [out, retval] IMsmConfigurableItem** Return);

	[propget, id(4), helpstring("Return the number of configurable items in the collection.")] 
		HRESULT Count([out, retval] long* Count);

	[propget, id(-4), hidden] HRESULT _NewEnum([out, retval] IUnknown** NewEnum);
};

///////////////////////////////////////////////////////////
// IMsmConfigureModule
[
	object,
	uuid(AC013209-18A7-4851-8A21-2353443D70A0),
	helpstring("Interface implemented by authoring tool to provide configuration information."),
	pointer_default(unique),
	oleautomation,
	dual
]
interface IMsmConfigureModule : IDispatch
{
	[id(1), helpstring("Called to retrieve text data from the authoring tool.")] 
		HRESULT ProvideTextData([in] const BSTR Name, [out, retval] BSTR* ConfigData);
	[id(2), helpstring("Called to retrieve integer data from the authoring tool.")] 
		HRESULT ProvideIntegerData([in] const BSTR Name, [out, retval] long* ConfigData);
}


///////////////////////////////////////////////////////////
// IMsmMerge
[
	object,
	uuid(0ADDA82E-2C26-11D2-AD65-00A0C9AF11A6),
	helpstring("MSM Merge Interface"),
	pointer_default(unique),
	oleautomation,
	dual
]
interface IMsmMerge : IDispatch
{
	[id(1), helpstring("Opens the specified database.")] HRESULT OpenDatabase([in] const BSTR Path);
	[id(2), helpstring("Opens the specified module.")] HRESULT OpenModule([in] const BSTR Path, [in] const short Language);
	[id(3), helpstring("Close the currently open database.")] HRESULT CloseDatabase([in] const VARIANT_BOOL Commit);
	[id(4), helpstring("Close the currently open module.")] HRESULT CloseModule(void);

	[id(5), helpstring("Open a log file with the specified path.")] HRESULT OpenLog([in] const BSTR Path);
	[id(6), helpstring("Close the current log file.")] HRESULT CloseLog(void);
	[id(7), helpstring("Output a string to the open log file.")] HRESULT Log([in] const BSTR Message);

	[propget, id(8), helpstring("Return a collection that contains all errors.")] 
		HRESULT Errors([out, retval] IMsmErrors** Errors);
	[propget, id(9), helpstring("Return a collection containing all unsatisfied dependencies.")] 
		HRESULT Dependencies([out, retval] IMsmDependencies** Dependencies);

	[id(10), helpstring("Merge the open module to the specified feature, redirecting files to the specified directory.")] 
		HRESULT Merge([in] const BSTR Feature, [in] const BSTR RedirectDir);
	[id(11), helpstring("Connect the open module to the specified feature.")] 
		HRESULT Connect([in] const BSTR Feature);

	[id(12), helpstring("Extract the CAB from the current module and save it to disk.")] 
		HRESULT ExtractCAB([in] const BSTR FileName);
	[id(13), helpstring("Create a source tree from the current module.")] 
		HRESULT ExtractFiles([in] const BSTR Path);
};

///////////////////////////////////////////////////////////
// IMsmMerge2
[
	object,
	uuid(351A72AB-21CB-47AB-B7AA-C4D7B02EA305),
	helpstring("MSM Merge2 Interface"),
	pointer_default(unique),
	dual,
	oleautomation
]
interface IMsmMerge2 : IDispatch
{
	[id(1), helpstring("Opens the specified database.")] HRESULT OpenDatabase([in] const BSTR Path);
	[id(2), helpstring("Opens the specified module.")] HRESULT OpenModule([in] const BSTR Path, [in] const short Language);
	[id(3), helpstring("Close the currently open database.")] HRESULT CloseDatabase([in] const VARIANT_BOOL Commit);
	[id(4), helpstring("Close the currently open module.")] HRESULT CloseModule(void);

	[id(5), helpstring("Open a log file with the specified path.")] HRESULT OpenLog([in] const BSTR Path);
	[id(6), helpstring("Close the current log file.")] HRESULT CloseLog(void);
	[id(7), helpstring("Output a string to the open log file.")] HRESULT Log([in] const BSTR Message);

	[propget, id(8), helpstring("Return a collection that contains all errors.")] 
		HRESULT Errors([out, retval] IMsmErrors** Errors);
	[propget, id(9), helpstring("Return a collection containing all unsatisfied dependencies.")] 
		HRESULT Dependencies([out, retval] IMsmDependencies** Dependencies);

	[id(10), helpstring("Merge the open module to the specified feature, redirecting files to the specified directory.")] 
		HRESULT Merge([in] const BSTR Feature, [in] const BSTR RedirectDir);
	[id(11), helpstring("Connect the open module to the specified feature.")] 
		HRESULT Connect([in] const BSTR Feature);

	[id(12), helpstring("Extract the CAB from the current module and save it to disk.")] 
		HRESULT ExtractCAB([in] const BSTR FileName);
	[id(13), helpstring("Create a source tree from the current module.")] 
		HRESULT ExtractFiles([in] const BSTR Path);

	// Additional functions on MergeEx interface
	[id(14), helpstring("Merge the open module to the specified feature, requesting configuration data as needed.")] 
		HRESULT MergeEx([in] const BSTR Feature, [in] const BSTR RedirectDir, [in] IUnknown* pConfiguration);
	[id(15), helpstring("Create a source tree from the current module.")] 
		HRESULT ExtractFilesEx([in] const BSTR Path, [in] VARIANT_BOOL fLongFileNames, [out] IMsmStrings** pFilePaths);
	[propget, id(16), helpstring("Retrieves information about each configurable item in this merge module.")] 
		HRESULT ConfigurableItems([out, retval] IMsmConfigurableItems** ConfigurableItems);
	[id(17), helpstring("Create a source image from a configured merge module and database.")] 
		HRESULT CreateSourceImage([in] const BSTR Path, [in] VARIANT_BOOL fLongFileNames, [out] IMsmStrings** pFilePaths);
	[propget, id(18), helpstring("Return a collection of files referenced in the module.")] 
		HRESULT ModuleFiles([out, retval] IMsmStrings** Files);
};


///////////////////////////////////////////////////////////
// IMsmGetFiles
[
	object,
	uuid(7041AE26-2D78-11d2-888A-00A0C981B015),
	helpstring("MSM File Retrieval Interface"),
	pointer_default(unique),
	oleautomation,
	dual
]
interface IMsmGetFiles : IDispatch
{
	[propget, id(1), helpstring("Return a collection of files referenced in the module.")] 
		HRESULT ModuleFiles([out, retval] IMsmStrings** Files);
};



