如何使用 C++ 配置 Windows 组策略?

如何使用 C++ 配置 Windows 组策略?

问题描述:

我正在研究 IE BHO 工具栏.当我为 IE 8 安装它时,它工作正常.如果是 IE 9,它会弹出一个信息栏,询问是否启用它.我知道要手动更改组策略中的哪些设置.我只是不知道如何在编程中做到这一点.

I am working on IE BHO toolbar. When I install it for IE 8, it works fine. In case of IE 9, It pops up an info bar asking if to enable it. I know what settings to change in group policy manually. I just do not know how to do it in programming.

要在组策略中进行更改:

Changes to make are in Group Policy:

  • 位置:用户配置
    • 管理模板
      • Windows 组件
        • 浏览器
          • 安全功能插件管理

          修改:

          • 将加载项列表设置为已启用
          • 在加载项列表中添加条目

          是否有任何直接的 API 来完成这项工作?

          Are there any straight forward APIs to do this job?

          我主要是在寻找 C++ API,但我也很擅长基于 C#/WMI 的方法.

          I am primarily looking for C++ APIs but I am fine with C# / WMI based approach too.

存在几种处理 Windows 组策略的方法

Exists a couple of ways to handle the Windows Group Policies

1) 您可以使用 组策略 API 其中有一组 接口从 C++ 访问.

1) You can use the Group Policy API which has a set of interfaces to access from C++.

2) 使用 RSoP WMI 类

3) 使用 Windows 和 Windows Server 的组策略设置参考