Using the FesfUtility DLL

The FESFUtility DLL is a COM in-process server.  It exports the methods describe in this section for use by Client Solutions when FESF is installed and running on the system.  Note FesfUtility exports two interfaces as described below.

Type Library:  \UM_FESF\UMLIB\FESFUTILITY.TLB

CLSID:         FesfUtil    {A5CF6C1A-FBA3-46E9-9A06-99E3879337A3}

IID:   IFesfUtil   {287AE2AC-D46B-478A-B843-FB49D0818958}

IID:   IFesfUtil2 {F2A5ED4B-2B5D-4CCA-ABE4-2246C994EDC3}

 

Note: Please use the definitions provided in the type library as the GUIDs are subject to change.

The Interface IFesfUtil2 provides support for all the original methods available via the IFesfUtil Interface, as well the ReadHeaderUnsafe and UpdateHeaderUpdate families of methods, which are exclusively available via the IFesfUtil2 Interface.

Methods in the FESFUtility DLL can be invoked using standard COM mechanisms.  This is illustrated in the following example.

In the Header file:

  #import "..\..\UM_FESF\UMLib\FESFUTILITY.tlb" no_namespace raw_interfaces_only

  IFesfUtil *m_spUtil;

 

In the executable function:

  // Initialize COM

  ::CoInitializeEx(nullptrCOINIT_MULTITHREADED);

 

  hr = ::CoCreateInstance(__uuidof(FesfUtil),

                            nullptr,

                            CLSCTX_ALL,

                            IID_PPV_ARGS(&m_spUtil));

  if (FAILED(hr)) {

           // Could not find the FesfUtil DLL

           ATLTRACE(L"Failed to access FesfUtil: 0x%X\n"hr);

           return E_UNEXPECTED;

  }

 

  //

  // Is the FESF Policy Service running?

  //

  VARIANT_BOOL running = VARIANT_FALSE;

 

  hr = m_spUtil->IsFESFServiceRunning(&running);

 

         if (FAILED(hr)) 

  {

      // the call FAILED?  That's odd…

      ::MessageBox(nullptr, L"Call to IsFESFServiceRunning failed?",

                             L"Testing"MB_ICONEXCLAMATION | MB_OK);

      return E_FAIL;

  }

 

  if (!running)

  {

      // service is unavailable

      ::MessageBox(nullptr, L"Service is unavailable or not running",

                     L"Testing"MB_ICONEXCLAMATION | MB_OK);

  }

 

  return S_OK;