// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. //***************************************************************************** // ConfigHelper.h // //***************************************************************************** // // These are unmanaged definitions of interfaces used call Managed Node Factories // If you make any changes please do corresponding changes in \src\bcl\system\__xmlparser.cs // #ifndef _CONFIGHELPER_H #define _CONFIGHELPER_H #include #include #include #include "unknwn.h" #include "../xmlparser/_reference.h" #include "../xmlparser/_unknown.h" #include "comdelegate.h" class ConfigFactory : public _unknown { #define ICONFIGHANDLER_CALLBACK_COUNT 6 OBJECTREF *m_pManagedFactory; LPVOID eventCallbacks[ICONFIGHANDLER_CALLBACK_COUNT]; // We assume the offsets as per the object layout of ConfigTreeParser defined in CfgParser.cs // Any changes made at either place must be propagated to the other LPVOID GetCallbackAtOffset(DWORD dwOffset) { CONTRACTL { THROWS; GC_TRIGGERS; MODE_COOPERATIVE; PRECONDITION(dwOffset < ICONFIGHANDLER_CALLBACK_COUNT); } CONTRACTL_END; PTRARRAYREF refAllDelegates = (PTRARRAYREF)ObjectToOBJECTREF((Object *)((*m_pManagedFactory)->GetPtrOffset(0))); _ASSERTE(refAllDelegates->GetNumComponents()==ICONFIGHANDLER_CALLBACK_COUNT); return COMDelegate::ConvertToCallback(refAllDelegates->GetAt(dwOffset)); } void Initialize(OBJECTREF *pFactory) { CONTRACTL { NOTHROW; GC_TRIGGERS; MODE_COOPERATIVE; PRECONDITION(pFactory != NULL); } CONTRACTL_END; m_pManagedFactory = pFactory; EX_TRY { for(int i=0; i