Adding RSoP Support to a Group Policy Snap-in Extension
This topic describes how to add support for Resultant Set of Policy (RSoP) to your Group Policy snap-in extension with the fewest number of changes to existing code.
The recommended way to support RSoP in an existing MMC snap-in is to add a property to the CComponentData and CComponent classes that are already implemented. The property must indicate whether the snap-in is running in RSoP mode or in editing mode. You should register two class IDs for the snap-in, one for RSoP mode and one for editing mode. (Mapping two class IDs to the same snap-in allows you to reuse user interface components such as dialog boxes and helper functions.) When you call the DllGetClassObject function, pass a flag that indicates the operation mode of the snap-in, as shown in the code sample following. For more information about MMC, see the Microsoft Management Console.
Note
After you add support for RSoP to your snap-in, you must communicate with the main RSoP snap-in by using the IRSOPInformation interface. You will also need to query for Group Policy WMI objects (instances).
For more information, see the following topics:
The following code example shows how to add support for Resultant Set of Policy (RSoP) to your Group Policy snap-in extension.
//
// Administrative Templates in editing mode
//
if (IsEqualCLSID (rclsid, CLSID_PolicySnapInUser)) {
//
// Second argument is the RSoP flag (FALSE).
//
CPolicyComponentDataCF *pComponentDataCF = new CPolicyComponentDataCF(TRUE, FALSE); // ref == 1
if (!pComponentDataCF)
return E_OUTOFMEMORY;
hr = pComponentDataCF->QueryInterface(riid, ppv);
pComponentDataCF->Release(); // release initial reference
return hr;
}
//
// Administrative Templates in RSoP mode
//
if (IsEqualCLSID (rclsid, CLSID_RSOPolicySnapInUser)) {
//
// Second argument is the RSoP flag (TRUE).
//
CPolicyComponentDataCF *pComponentDataCF = new CPolicyComponentDataCF(TRUE, TRUE); // ref == 1
if (!pComponentDataCF)
return E_OUTOFMEMORY;
hr = pComponentDataCF->QueryInterface(riid, ppv);
pComponentDataCF->Release(); // Release the initial reference
return hr;
}