Saving Configuration Data in the Vendor Parameter Set

Using this procedure, add code to save the filter configuration data in the vendor parameter set.

To save the filter configuration data in the vendor parameter set

  1. Add the following function to store the values in the filter's vendor parameter set:
    HRESULT PutVendorData(FPCLib::IFPCApplicationFilterPtr spiApplicationFilter,
    					const _bstr_t& bsVirusString,
    					const _bstr_t& bsPrefixString,
    					const _bstr_t& bsFilterIPAddress)
    {
    	HRESULT hr = S_OK;
    	FPCLib::IFPCVendorParametersSetsPtr spIFPCVendorParametersSets;
    	FPCLib::IFPCVendorParametersSetPtr spIFPCVendorParametersSet;
    
    	try
    	{
    		spIFPCVendorParametersSets = spiApplicationFilter->VendorParametersSets;
      
    		try
    		{
    			spIFPCVendorParametersSet = spIFPCVendorParametersSets->Item(_bstr_t(PARAM_SET_GUID));
    	}
    		catch(_com_error&)
    		{
    			//Create a new parameter set
    			spIFPCVendorParametersSet = spIFPCVendorParametersSets->Add(_bstr_t(PARAM_SET_GUID),VARIANT_FALSE);
    	
    			spIFPCVendorParametersSets->Save();
    	}
     
    		spIFPCVendorParametersSet->Value[_bstr_t("VirusString")]   = bsVirusString;
    		spIFPCVendorParametersSet->Value[_bstr_t("PrefixString")]  = bsPrefixString;
    		spIFPCVendorParametersSet->Value[_bstr_t("Filter IPAddress")] = bsFilterIPAddress;
    		spIFPCVendorParametersSet->Save();
     
    }
    	catch(_com_error& err)
    	{
    		return err.Error();
    }
     
    	return S_OK;
    }
    
  2. You need to add a function that will call PutVendorData with the values from Forefront TMG Management. To implement this function, override the OnApply method of the CSnapInPropertyPageImpl class. This method is called whenever you click the Apply or OK buttons. Add the following code to your class:
    	// This member function is called when the user clicks the OK or the Apply button.
    	virtual BOOL OnApply()
    	{
    		HRESULT hr;
    		// _bstr_t bsVirusString, bsPrefixString;
    		char sVirusString[100], sPrefixString[100];
    	
    		::GetWindowTextA (::GetDlgItem (m_hWnd, IDC_VIRUS_STRING),
    							reinterpret_cast <char *> (&sVirusString),
    							100);
     
    		::GetWindowTextA (::GetDlgItem (m_hWnd, IDC_PREFIX_STRING),
    							 reinterpret_cast <char *> (&sPrefixString),
    							100);
     
    		hr = ::PutVendorData (m_spiApplicationFilter,
    					_bstr_t(sVirusString), 
    					_bstr_t(sPrefixString));
     
    		return TRUE;
    }
    
  3. Build.

Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.

508 Resource Limit Is Reached

Resource Limit Is Reached

The website is temporarily unable to service your request as it exceeded resource limit. Please try again later.