4.10 Get Publisher List Example

In this example, the client obtains a list of registered publishers on the server. This involves the following steps.

  1. The client registers with RPC to obtain an RPC binding handle to the service based on the endpoint information specified in section 2.1. For information on how to get the RPC binding handle, see [MSDN-BNDHNDLS].

  2. The client calls the EvtRpcGetPublisherList (section 3.1.4.23) method to receive the results.

     error_status_t EvtRpcGetPublisherList(
       [in] RPC_BINDING_HANDLE binding = {handle from step 1},
       [in] DWORD flags = 0,
       [out] DWORD* numPublisherIds,
       [out, size_is(,*numPublisherIds), range(0, MAX_RPC_PUBLISHER_COUNT), string]
            LPWSTR** publisherIds
     );
    
  3. The server then goes to the publisher table and enumerates all the publisher names from the table to fill the publisherIds parameter as the result. At the same time, the numPublisherIds parameter is also set to the number of publishers in the server. Assuming the server has four publishers, a sample result for publisherIds looks as follows:

    "TestPublisher""Microsoft-Windows-EventLog""NTFSProvider""Microsoft-Windows-Firewall".

    The numPublisherIds is set to 4.