IBITSExtensionSetupFactory interface (bitscfg.h)

Use the IBITSExtensionSetupFactory interface to get a pointer to the IBITSExtensionSetup interface. Only use this interface if you use the IBITSExtensionSetup interface in a setup program that also installs the BITS server. Because the IIS cache does not contain the BITS extensions added during setup, the extensions are not available using the ADsGetObject ADSI function. The IBITSExtensionSetupFactory interface provides a GetObject method, which accesses the BITS extensions and performs the same binding as the ADsGetObject function.

To get a pointer to the IBITSExtensionSetupFactory interface, call the CoCreateInstance function as shown in Example Code.

Inheritance

The IBITSExtensionSetupFactory interface inherits from the IUnknown interface. IBITSExtensionSetupFactory also has these types of members:

Methods

The IBITSExtensionSetupFactory interface has these methods.

 
IBITSExtensionSetupFactory::GetObject

Use the GetObject method to retrieve a pointer to the IBITSExtensionSetup interface. This method performs the same binding that the ADsGetObject ADSI function performs.

Remarks

This interface is registered on the server when you install the BITS server extension.

On Windows Server 2003, use the Windows Components Wizard to install the BITS server extension. From Control Panel, select Add or Remove Programs. Then, select Add/Remove Windows Components to display the Windows Components Wizard. The BITS server extension is a sub-component of Internet Information Services (IIS) which is a sub-component of Web Application Server.

Examples

The following example shows how to use the IBITSExtensionSetupFactory interface to get a pointer to the IBITSExtensionSetup interface.

//Set the BITSUploadEnabled IIS configuration setting.
//The pszPath parameter contains the path to the directory service. 
//For example, "IIS://<machine name>/w3svc/1/<virtual directory>".
//The Enable parameter contains true (enable) or false (disable).
HRESULT SetBITSUploadEnabledSetting(LPWSTR pszPath, bool Enable)
{
  HRESULT hr;
  IBITSExtensionSetupFactory* pExtensionSetupFactory = NULL;
  IBITSExtensionSetup* pExtensionSetup = NULL;

  hr = CoCreateInstance(__uuidof(BITSExtensionSetupFactory),
    NULL, CLSCTX_INPROC_SERVER,
    __UUIDOF(IBITSExtensionSetupFactory),
    (void**)&pExtensionSetupFactory);

  if (SUCCEEDED(hr))
  {
    hr = pExtensionSetupFactory->GetObject(BSTR(pszPath), &pExtensionSetup);
    if (SUCCEEDED(hr))
    {
      if (Enable)
      {
        hr = pExtensionSetup->EnableBITSUploads();
      }
      else
      {
        hr = pExtensionSetup->DisableBITSUploads();
      }

      pExtensionSetup->Release();
    }
    pExtensionSetupFactory->Release();
  }

  return hr;
}

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2003
Target Platform Windows
Header bitscfg.h
Redistributable BITS 1.5 on Windows XP

See also

IBITSExtensionSetup