Sobieg

GPEdit.h

Apr 20th, 2019
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 27.22 KB | None | 0 0
  1. //-----------------------------------------------------------------------------
  2. //
  3. // GPEDIT.H - Definitions and prototypes for Group Policy
  4. //
  5. // Copyright 1997-2000, Microsoft Corporation
  6. //
  7. //-----------------------------------------------------------------------------
  8.  
  9. //
  10. // Terminology
  11. //
  12. // Group Policy Editor  -  The tool to view a Group Policy Object.
  13. //
  14. // Group Policy Object  -  A collection of administrator defined policies.
  15. //                         Each Group Policy Object (GPO) has both file system
  16. //                         and Active Directory storage available to it.
  17. //
  18. // IGPEInformation      -  The interface MMC Snapin Extensions use to
  19. //                         talk to the Group Policy Editor.
  20. //
  21. // IGroupPolicyObject   -  The interface used to create/edit a GPO directly
  22. //                         without going through the Group Policy Editor
  23. //
  24.  
  25.  
  26. //
  27. // Group Policy Editor MMC SnapIn GUID
  28. //
  29. // {8FC0B734-A0E1-11d1-A7D3-0000F87571E3}
  30.  
  31. DEFINE_GUID(CLSID_GPESnapIn, 0x8fc0b734, 0xa0e1, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3);
  32.  
  33.  
  34. //
  35. // Group Policy Editor node ids
  36. //
  37.  
  38. //
  39. // Computer Configuration\Windows Settings
  40. // {8FC0B737-A0E1-11d1-A7D3-0000F87571E3}
  41. //
  42.  
  43. DEFINE_GUID(NODEID_Machine, 0x8fc0b737, 0xa0e1, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3);
  44.  
  45.  
  46. //
  47. // Computer Configuration\Software Settings
  48. // {8FC0B73A-A0E1-11d1-A7D3-0000F87571E3}
  49. //
  50.  
  51. DEFINE_GUID(NODEID_MachineSWSettings, 0x8fc0b73a, 0xa0e1, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3);
  52.  
  53.  
  54. //
  55. // User Configuration\Windows Settings
  56. // {8FC0B738-A0E1-11d1-A7D3-0000F87571E3}
  57. //
  58.  
  59. DEFINE_GUID(NODEID_User, 0x8fc0b738, 0xa0e1, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3);
  60.  
  61.  
  62. //
  63. // User Configuration\Software Settings
  64. // {8FC0B73C-A0E1-11d1-A7D3-0000F87571E3}
  65. //
  66.  
  67. DEFINE_GUID(NODEID_UserSWSettings, 0x8fc0b73c, 0xa0e1, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3);
  68.  
  69.  
  70. //
  71. // IGPEInformation interface id
  72. //
  73. // {8FC0B735-A0E1-11d1-A7D3-0000F87571E3}
  74.  
  75. DEFINE_GUID(IID_IGPEInformation, 0x8fc0b735, 0xa0e1, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3);
  76.  
  77.  
  78. //
  79. // Group Policy Object class id
  80. //
  81. // {EA502722-A23D-11d1-A7D3-0000F87571E3}
  82.  
  83. DEFINE_GUID(CLSID_GroupPolicyObject, 0xea502722, 0xa23d, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3);
  84.  
  85.  
  86. //
  87. // Group Policy Object interface id
  88. //
  89. // {EA502723-A23D-11d1-A7D3-0000F87571E3}
  90.  
  91. DEFINE_GUID(IID_IGroupPolicyObject, 0xea502723, 0xa23d, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3);
  92.  
  93.  
  94. //
  95. // GUID that identifies the registry extension
  96. //
  97.  
  98. #define REGISTRY_EXTENSION_GUID  { 0x35378EAC, 0x683F, 0x11D2, 0xA8, 0x9A, 0x00, 0xC0, 0x4F, 0xBB, 0xCF, 0xA2 }
  99.  
  100.  
  101. //
  102. // GUID that identifies the comments extension
  103. //
  104.  
  105. #define ADMXCOMMENTS_EXTENSION_GUID  { 0x6C5A2A86, 0x9EB3, 0x42b9, 0xAA, 0x83, 0xA7, 0x37, 0x1B, 0xA0, 0x11, 0xB9 }
  106.  
  107.  
  108. //========================================================================================
  109. //
  110. // Resultant Set of Policy node ids
  111. //
  112. //========================================================================================
  113.  
  114. //
  115. // Resultant Set of Policy MMC SnapIn GUID
  116. //
  117. // {6DC3804B-7212-458D-ADB0-9A07E2AE1FA2}
  118.  
  119. DEFINE_GUID(CLSID_RSOPSnapIn, 0x6dc3804b, 0x7212, 0x458d, 0xad, 0xb0, 0x9a, 0x07, 0xe2, 0xae, 0x1f, 0xa2);
  120.  
  121.  
  122. //
  123. // Computer Configuration\Windows Settings
  124. // {BD4C1A2E-0B7A-4A62-A6B0-C0577539C97E}
  125. //
  126.  
  127. DEFINE_GUID(NODEID_RSOPMachine, 0xbd4c1a2e, 0x0b7a, 0x4a62, 0xa6, 0xb0, 0xc0, 0x57, 0x75, 0x39, 0xc9, 0x7e);
  128.  
  129.  
  130. //
  131. // Computer Configuration\Software Settings
  132. // {6A76273E-EB8E-45DB-94C5-25663A5f2C1A}
  133. //
  134.  
  135. DEFINE_GUID(NODEID_RSOPMachineSWSettings, 0x6a76273e, 0xeb8e, 0x45db, 0x94, 0xc5, 0x25, 0x66, 0x3a, 0x5f, 0x2c, 0x1a);
  136.  
  137.  
  138. //
  139. // User Configuration\Windows Settings
  140. // {AB87364F-0CEC-4CD8-9BF8-898F34628FB8}
  141. //
  142.  
  143. DEFINE_GUID(NODEID_RSOPUser, 0xab87364f, 0x0cec, 0x4cd8, 0x9b, 0xf8, 0x89, 0x8f, 0x34, 0x62, 0x8f, 0xb8);
  144.  
  145.  
  146. //
  147. // User Configuration\Software Settings
  148. // {E52C5CE3-FD27-4402-84DE-D9A5F2858910}
  149. //
  150.  
  151. DEFINE_GUID(NODEID_RSOPUserSWSettings, 0xe52c5ce3, 0xfd27, 0x4402, 0x84, 0xde, 0xd9, 0xa5, 0xf2, 0x85, 0x89, 0x10);
  152.  
  153.  
  154. //
  155. // IRSOPInformation interface id
  156. //
  157. // {9A5A81B5-D9C7-49EF-9D11-DDF50968C48D}
  158.  
  159. DEFINE_GUID(IID_IRSOPInformation, 0x9a5a81b5, 0xd9c7, 0x49ef, 0x9d, 0x11, 0xdd, 0xf5, 0x09, 0x68, 0xc4, 0x8d);
  160.  
  161.  
  162. #ifndef _GPEDIT_H_
  163. #define _GPEDIT_H_
  164. #include <winapifamily.h>
  165.  
  166. #pragma region Desktop Family
  167. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  168.  
  169.  
  170.  
  171. //
  172. // Define API decoration for direct importing of DLL references.
  173. //
  174.  
  175. #if !defined(_GPEDIT_)
  176. #define GPEDITAPI DECLSPEC_IMPORT
  177. #else
  178. #define GPEDITAPI
  179. #endif
  180.  
  181.  
  182. #ifdef __cplusplus
  183. extern "C" {
  184. #endif
  185.  
  186.  
  187. #include <objbase.h>
  188.  
  189.  
  190. //
  191. // Group Policy Object Section flags
  192. //
  193.  
  194. #define GPO_SECTION_ROOT                 0  // Root
  195. #define GPO_SECTION_USER                 1  // User
  196. #define GPO_SECTION_MACHINE              2  // Machine
  197.  
  198.  
  199. //
  200. // Group Policy Object types
  201. //
  202.  
  203. #ifndef GROUP_POLICY_OBJECT_TYPE_ENUM_DEFINED
  204. #define GROUP_POLICY_OBJECT_TYPE_ENUM_DEFINED
  205.  
  206. typedef enum _GROUP_POLICY_OBJECT_TYPE {
  207.     GPOTypeLocal = 0,                       // Default GPO on the local machine
  208.     GPOTypeRemote,                          // GPO on a remote machine
  209.     GPOTypeDS,                              // GPO in the Active Directory
  210.     GPOTypeLocalUser,                       // User-specific GPO on the local machine
  211.     GPOTypeLocalGroup                       // Group-specific GPO on the local machine
  212. } GROUP_POLICY_OBJECT_TYPE, *PGROUP_POLICY_OBJECT_TYPE;
  213.  
  214. #endif // GROUP_POLICY_OBJECT_TYPE_ENUM_DEFINED
  215.  
  216. //
  217. // Group Policy Hint types
  218. //
  219.  
  220. typedef enum _GROUP_POLICY_HINT_TYPE {
  221.     GPHintUnknown = 0,                      // No link information available
  222.     GPHintMachine,                          // GPO linked to a machine (local or remote)
  223.     GPHintSite,                             // GPO linked to a site
  224.     GPHintDomain,                           // GPO linked to a domain
  225.     GPHintOrganizationalUnit,               // GPO linked to a organizational unit
  226. } GROUP_POLICY_HINT_TYPE, *PGROUP_POLICY_HINT_TYPE;
  227.  
  228.  
  229. #undef INTERFACE
  230. #define INTERFACE   IGPEInformation
  231. DECLARE_INTERFACE_(IGPEInformation, IUnknown)
  232. {
  233.     // *** IUnknown methods ***
  234.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  235.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  236.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  237.  
  238.  
  239.     // *** IGPEInformation methods ***
  240.  
  241.     //
  242.     // Returns the unique Group Policy Object name (a GUID)
  243.     //
  244.     // pszName contains the name on return
  245.     // cchMaxLength is the max number of characters that can be stored in pszName
  246.     //
  247.  
  248.     STDMETHOD(GetName) (THIS_ _Out_writes_(cchMaxLength) LPOLESTR pszName, int cchMaxLength) PURE;
  249.  
  250.  
  251.     //
  252.     // Returns the friendly display name for this Group Policy Object
  253.     //
  254.     // pszName contains the name on return
  255.     // cchMaxLength is the max number of characters that can be stored in pszName
  256.     //
  257.  
  258.     STDMETHOD(GetDisplayName) (THIS_ _Out_writes_(cchMaxLength) LPOLESTR pszName, int cchMaxLength) PURE;
  259.  
  260.  
  261.     //
  262.     // Returns a registry key handle for the requested section.  The returned
  263.     // key is the root of the registry, not the Policies subkey.  To set / read
  264.     // a value in the Policies subkey, you will need to call RegOpenKeyEx to
  265.     // open Software\Policies subkey first.
  266.     //
  267.     // The handle has been opened with ALL ACCESS rights.  Call RegCloseKey
  268.     // on the handle when finished.
  269.     //
  270.     // dwSection is either GPO_SECTION_USER or GPO_SECTION_MACHINE
  271.     // hKey contains the registry key on return
  272.     //
  273.  
  274.     STDMETHOD(GetRegistryKey) (THIS_ DWORD dwSection, HKEY *hKey) PURE;
  275.  
  276.  
  277.     //
  278.     // Returns the Active Directory path to the root of the request section.
  279.     // The path is in ADSI name format.
  280.     //
  281.     // dwSection is one of the GPO_SECTION_* flags
  282.     // pszPath contains the path on return
  283.     // cchMaxPath is the max number of characters that can be stored in pszPath
  284.     //
  285.  
  286.     STDMETHOD(GetDSPath) (THIS_ DWORD dwSection, _Out_writes_(cchMaxPath) LPOLESTR pszPath, int cchMaxPath) PURE;
  287.  
  288.  
  289.     //
  290.     // Returns the UNC path to the root of the requested section.
  291.     //
  292.     // dwSection is one of the GPO_SECTION_* flags
  293.     // pszPath contains the path on return
  294.     // cchMaxPath is the number of characters that can be stored in pszPath.
  295.     //
  296.  
  297.     STDMETHOD(GetFileSysPath) (THIS_ DWORD dwSection, _Out_writes_(cchMaxPath) LPOLESTR pszPath, int cchMaxPath) PURE;
  298.  
  299.  
  300.     //
  301.     // Returns the user preferences (options)
  302.     //
  303.     // Currently, there are no options defined.  This is reserved for future use.
  304.     //
  305.     // dwOptions receives a bitmask value
  306.     //
  307.  
  308.     STDMETHOD(GetOptions) (THIS_ DWORD *dwOptions) PURE;
  309.  
  310.  
  311.     //
  312.     // Returns the type of GPO being edited.
  313.     //
  314.     // The three types are:  a GPO in the Active Directory, the GPO on the local machine,
  315.     // and the GPO on a remote machine.
  316.     //
  317.     // Machine GPOs only have file system storage (no Active Directory storage available).
  318.     // If GetDSPath is called for a machine GPO, the function will succeed
  319.     // and the returned buffer will be the empty string ""
  320.     //
  321.     // Active Directory GPOs have both file system and Active Directory storage available to them.
  322.     //
  323.     // gpoType receives one of the type flags listed above.
  324.     //
  325.  
  326.     STDMETHOD(GetType) (THIS_ GROUP_POLICY_OBJECT_TYPE *gpoType) PURE;
  327.  
  328.  
  329.     //
  330.     // Returns the type of Active Directory object (or machine) that could be linked to
  331.     // this GPO
  332.     //
  333.     // This is a hint api only.  The GPE does not know which Active Directory objects are
  334.     // linked to a particular GPO, but it can offer a hint based upon how the
  335.     // user started the GPE.
  336.     //
  337.     // Use this method with great caution.  Some extensions might want to
  338.     // customize their user interface based upon the scoping for this GPO,
  339.     // but it is easy to offer the wrong namespace.  Best advice is to
  340.     // always offer your full user interface, but if you choose to use this
  341.     // method, always offer your full user interface if you recieve the
  342.     // unknown hint back.
  343.     //
  344.     // gpHint receives one of the hint flags listed above.
  345.     //
  346.  
  347.     STDMETHOD(GetHint) (THIS_ GROUP_POLICY_HINT_TYPE *gpHint) PURE;
  348.  
  349.  
  350.     //
  351.     // Informs the Group Policy Editor that policy settings have changed.
  352.     // Extensions MUST call this methold every time a change is made
  353.     // to a Group Policy Object.
  354.     //
  355.     // bMachine specifies if machine or user policy has changed.
  356.     // bAdd specifies whether this is an add or delete.
  357.     // pGuidExtension is the guid or unique name of extension that
  358.     //    will process this GPO.
  359.     // pGuidSnapin is the guid or unique name of snapin that is making
  360.     //    this call
  361.     //
  362.  
  363.     STDMETHOD(PolicyChanged) (THIS_ BOOL bMachine, BOOL bAdd, GUID *pGuidExtension, GUID *pGuidSnapin ) PURE;
  364. };
  365. typedef IGPEInformation *LPGPEINFORMATION;
  366.  
  367.  
  368. //
  369. // Group Policy Object open / creation flags
  370. //
  371.  
  372. #define GPO_OPEN_LOAD_REGISTRY      0x00000001  // Load the registry files
  373. #define GPO_OPEN_READ_ONLY          0x00000002  // Open the GPO as read only
  374.  
  375.  
  376.  
  377. //
  378. // Group Policy Object option flags
  379. //
  380.  
  381. #define GPO_OPTION_DISABLE_USER     0x00000001  // The user portion of this GPO is disabled
  382. #define GPO_OPTION_DISABLE_MACHINE  0x00000002  // The machine portion of this GPO is disabled
  383.  
  384.  
  385. #undef INTERFACE
  386. #define INTERFACE   IGroupPolicyObject
  387. DECLARE_INTERFACE_(IGroupPolicyObject, IUnknown)
  388. {
  389.     // *** IUnknown methods ***
  390.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  391.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  392.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  393.  
  394.  
  395.     // *** IGroupPolicyObject methods ***
  396.  
  397.     //
  398.     // Creates a new GPO in the Active Directory with the given friendly name
  399.     // and opens it via OpenDSGPO().  If pszDomainName contains a domain
  400.     // controller name, the GPO will be created on that DC.  If it does not
  401.     // specify a domain controller name, the method will select a DC on
  402.     // the callers behalf.
  403.     //
  404.     // pszDomainName contains the ADSI path of the domain root
  405.     // pszDisplayName contains the friendly display name
  406.     // dwFlags is a bitmask of GPO open / creation flags listed above
  407.     //
  408.  
  409.     STDMETHOD(New) (THIS_ _In_ LPOLESTR pszDomainName, _In_opt_ LPOLESTR pszDisplayName,
  410.                     DWORD dwFlags) PURE;
  411.  
  412.  
  413.     //
  414.     // Opens the specified Group Policy Object in the Active Directory
  415.     // based upon the passed in flags.  If pszPath contains a domain
  416.     // controller name, the GPO will be opened on that DC.  If it does
  417.     // not contain a domain controller name, the method will select a
  418.     // DC on the callers behalf.  If the registry is not loaded,
  419.     // GetRegistryKey() will return E_FAIL.
  420.     //
  421.     // pszPath contains the ADSI path to the GPO to open
  422.     // dwFlags is a bitmask of GPO open / creation flags listed above
  423.     //
  424.  
  425.     STDMETHOD(OpenDSGPO) (THIS_ _In_ LPOLESTR pszPath, DWORD dwFlags) PURE;
  426.  
  427.  
  428.     //
  429.     // Opens the default Group Policy Object on this machine with the
  430.     // dwFlags options listed above.  If the registry is not loaded,
  431.     // GetRegistryKey() will return E_FAIL.
  432.     //
  433.     // dwFlags is a bitmask of GPO open / creation flags listed above
  434.     //
  435.  
  436.     STDMETHOD(OpenLocalMachineGPO) (THIS_ DWORD dwFlags) PURE;
  437.  
  438.  
  439.     //
  440.     // Opens the default Group Policy Object on a remote machine with the
  441.     // dwFlags options listed above.  If the registry is not loaded,
  442.     // GetRegistryKey() will return E_FAIL.
  443.     //
  444.     // pszComputerName contains the machine name in \\machine format
  445.     // dwFlags is a bitmask of GPO open / creation flags listed above
  446.     //
  447.  
  448.     STDMETHOD(OpenRemoteMachineGPO) (THIS_ _In_ LPOLESTR pszComputerName, DWORD dwFlags) PURE;
  449.  
  450.  
  451.     //
  452.     // Flushes the registry settings to disk and updates the revision
  453.     // number of the GPO.
  454.     //
  455.     // bMachine specifies if machine or user should be saved.
  456.     // bAdd specifies whether this is an add or delete.
  457.     // pGuidExtension is the guid or unique name of extension that
  458.     //    will process this GPO.
  459.     // pGuid is a guid
  460.     //
  461.  
  462.     STDMETHOD(Save) (THIS_ BOOL bMachine, BOOL bAdd, GUID *pGuidExtension, GUID *pGuid ) PURE;
  463.  
  464.  
  465.     //
  466.     // Deletes this Group Policy Object.
  467.     //
  468.     // After calling this method, no other methods are valid to call
  469.     // since the data will have been deleted.
  470.     //
  471.  
  472.     STDMETHOD(Delete) (THIS) PURE;
  473.  
  474.  
  475.     //
  476.     // Returns the unique Group Policy Object name
  477.     //
  478.     // For Active Directory policy objects, this is a GUID
  479.     // For the local policy object, it is the string "Local"
  480.     // For remote policy objects, it is the computername
  481.     //
  482.     // pszName contains the name on return
  483.     // cchMaxLength is the max number of characters that can be stored in pszName
  484.     //
  485.  
  486.     STDMETHOD(GetName) (THIS_ _Out_writes_(cchMaxLength) LPOLESTR pszName, int cchMaxLength) PURE;
  487.  
  488.  
  489.     //
  490.     // Returns the friendly display name for this Group Policy Object
  491.     //
  492.     // pszName contains the name on return
  493.     // cchMaxLength is the max number of characters that can be stored in pszName
  494.     //
  495.  
  496.     STDMETHOD(GetDisplayName) (THIS_ _Out_writes_(cchMaxLength) LPOLESTR pszName, int cchMaxLength) PURE;
  497.  
  498.  
  499.     //
  500.     // Sets the friendly display name for this Group Policy Object
  501.     //
  502.     // pszName is the new display name
  503.     //
  504.  
  505.     STDMETHOD(SetDisplayName) (THIS_ _In_ LPOLESTR pszName) PURE;
  506.  
  507.  
  508.     //
  509.     // Returns the path to the Group Policy Object
  510.     //
  511.     //
  512.     // If the GPO is an Active Directory object, the path is in ADSI name format.
  513.     // If the GPO is a machine object, it is a file system path
  514.     //
  515.     // pszPath contains the path on return
  516.     // cchMaxPath is the max number of characters that can be stored in pszPath
  517.     //
  518.  
  519.     STDMETHOD(GetPath) (THIS_ _Out_writes_(cchMaxLength) LPOLESTR pszPath, int cchMaxLength) PURE;
  520.  
  521.  
  522.     //
  523.     // Returns the Active Directory path to the root of the request section.
  524.     // The path is in DN name format.
  525.     //
  526.     // dwSection is one of the GPO_SECTION_* flags
  527.     // pszPath contains the path on return
  528.     // cchMaxPath is the max number of characters that can be stored in pszPath
  529.     //
  530.  
  531.     STDMETHOD(GetDSPath) (THIS_ DWORD dwSection, _Out_writes_(cchMaxPath) LPOLESTR pszPath, int cchMaxPath) PURE;
  532.  
  533.  
  534.     //
  535.     // Returns the UNC path to the root of the requested section.
  536.     //
  537.     // dwSection is one of the GPO_SECTION_* flags
  538.     // pszPath contains the path on return
  539.     // cchMaxPath is the number of characters that can be stored in pszPath.
  540.     //
  541.  
  542.     STDMETHOD(GetFileSysPath) (THIS_ DWORD dwSection, _Out_writes_(cchMaxPath) LPOLESTR pszPath, int cchMaxPath) PURE;
  543.  
  544.  
  545.     //
  546.     // Returns a registry key handle for the requested section.  The returned
  547.     // key is the root of the registry, not the Policies subkey.  To set / read
  548.     // a value in the Policies subkey, you will need to call RegOpenKeyEx to
  549.     // open Software\Policies subkey first.
  550.     //
  551.     // The handle has been opened with ALL ACCESS rights.  Call RegCloseKey
  552.     // on the handle when finished.
  553.     //
  554.     // If the GPO was loaded / created without the registry being loaded
  555.     // this method will return E_FAIL.
  556.     //
  557.     // dwSection is either GPO_SECTION_USER or GPO_SECTION_MACHINE
  558.     // hKey contains the registry key on return
  559.     //
  560.  
  561.     STDMETHOD(GetRegistryKey) (THIS_ DWORD dwSection, HKEY *hKey) PURE;
  562.  
  563.  
  564.     //
  565.     // Returns any options for this Group Policy Object
  566.     //
  567.     // dwOptions receives the GPO_OPTION_* flags
  568.     //
  569.  
  570.     STDMETHOD(GetOptions) (THIS_ DWORD *dwOptions) PURE;
  571.  
  572.  
  573.     //
  574.     // Sets any options for this Group Policy Object
  575.     //
  576.     // This method sets any options for this GPO.  To change
  577.     // an option, that flag must be set in the mask field.
  578.     // If the flag is in the mask field, then the dwOptions
  579.     // field is read for the current state.
  580.     //
  581.     // For example:  to disable the GPO, make this call
  582.     //
  583.     //    SetOptions (GPO_OPTION_DISABLED, GPO_OPTION_DISABLED);
  584.     //
  585.     // dwOptions specifies one or more GPO_OPTION_* flags
  586.     // dwMask specificies which of the dwOptions to change
  587.     //
  588.  
  589.     STDMETHOD(SetOptions) (THIS_ DWORD dwOptions, DWORD dwMask) PURE;
  590.  
  591.  
  592.     //
  593.     // Returns the type of GPO being edited.
  594.     //
  595.     // The three types are:  a GPO in the Active Directory, the GPO on the local machine,
  596.     // and the GPO on a remote machine.
  597.     //
  598.     // Machine GPOs only have file system storage (no Active Directory storage available).
  599.     // If GetDSPath is called for a machine GPO, the function will succeed
  600.     // and the returned buffer will be the empty string ""
  601.     //
  602.     // Active Directory GPOs have both file system and Active Directory storage available to them.
  603.     //
  604.     // gpoType receives one of the type flags
  605.     //
  606.  
  607.     STDMETHOD(GetType) (THIS_ GROUP_POLICY_OBJECT_TYPE *gpoType) PURE;
  608.  
  609.  
  610.     //
  611.     // Returns the machine name of the remote GPO
  612.     //
  613.     // This method returns the name passed to OpenRemoteMachineGPO.
  614.     //
  615.     // pszName contains the name on return
  616.     // cchMaxLength is the max number of characters that can be stored in pszName
  617.     //
  618.  
  619.     STDMETHOD(GetMachineName) (THIS_ _Out_writes_(cchMaxLength) LPOLESTR pszName, int cchMaxLength) PURE;
  620.  
  621.  
  622.     //
  623.     // Returns an array of property sheet pages and the number of pages
  624.     // in the array
  625.     //
  626.     // Note, this method will allocate memory for the array with
  627.     // LocalAlloc.  When finished, the caller should free the array
  628.     // with LocalFree
  629.     //
  630.     // hPages address of the pointer for the array of property sheet pages
  631.     // uPageCount receives the number of pages in the array
  632.     //
  633.  
  634.     STDMETHOD(GetPropertySheetPages) (THIS_ HPROPSHEETPAGE **hPages, UINT *uPageCount) PURE;
  635. };
  636. typedef IGroupPolicyObject *LPGROUPPOLICYOBJECT;
  637.  
  638.  
  639. //
  640. // RSOP flags
  641. //
  642.  
  643. #define RSOP_INFO_FLAG_DIAGNOSTIC_MODE  0x00000001      // Running in diagnostic mode vs planning mode
  644.  
  645. #undef INTERFACE
  646. #define INTERFACE   IRSOPInformation
  647. DECLARE_INTERFACE_(IRSOPInformation, IUnknown)
  648. {
  649.     // *** IUnknown methods ***
  650.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  651.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  652.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  653.  
  654.  
  655.     // *** IRSOPInformation methods ***
  656.  
  657.     //
  658.     // Returns the namespace for the RSOP data
  659.     //
  660.     // dwSection is either GPO_SECTION_USER or GPO_SECTION_MACHINE
  661.     // pszName contains the namespace on return
  662.     // cchMaxLength is the max number of characters that can be stored in pszName
  663.     //
  664.  
  665.     STDMETHOD(GetNamespace) (THIS_ DWORD dwSection, _Out_writes_(cchMaxLength) LPOLESTR pszName, int cchMaxLength) PURE;
  666.  
  667.  
  668.     //
  669.     // Returns information about the RSOP session
  670.     //
  671.     // pdwFlags points to a DWORD which contains the flags on return
  672.     //
  673.  
  674.     STDMETHOD(GetFlags) (THIS_ DWORD * pdwFlags) PURE;
  675.  
  676.  
  677.     //
  678.     // Returns the event log text for a specific entry
  679.     //
  680.     // lpEventSource - event log source name
  681.     // lpEventLogName - event log name
  682.     // lpEventTime - event log time in WMI datetime format
  683.     // dwEventID - event ID
  684.     // lpText - Receives a pointer to a buffer containing the text.
  685.     //          The caller should free this buffer with CoTaskMemFree.
  686.     //
  687.  
  688.     STDMETHOD(GetEventLogEntryText) (THIS_ _In_ LPOLESTR pszEventSource, _In_ LPOLESTR pszEventLogName,
  689.                                            _In_ LPOLESTR pszEventTime, DWORD dwEventID,  _Outptr_ LPOLESTR *ppszText) PURE;
  690.  
  691. };
  692. typedef IRSOPInformation *LPRSOPINFORMATION;
  693.  
  694.  
  695. //=============================================================================
  696. //
  697. // CreateGPOLink
  698. //
  699. // Creates a link to a GPO for the specified Site, Domain, or Organizational Unit
  700. //
  701. // lpGPO         - ADSI path to the GPO
  702. // lpContainer   - ADSI path to the Site, Domain, or Organizational Unit
  703. // fHighPriority - Create the link as the highest or lowest priority
  704. //
  705. // Returns:  S_OK if successful
  706. //
  707. //=============================================================================
  708.  
  709. GPEDITAPI
  710. HRESULT
  711. WINAPI
  712. CreateGPOLink(
  713.     _In_ LPOLESTR lpGPO,
  714.     _In_ LPOLESTR lpContainer,
  715.          BOOL fHighPriority);
  716.  
  717.  
  718. //=============================================================================
  719. //
  720. // DeleteGPOLink
  721. //
  722. // Deletes a link to a GPO for the specified Site, Domain, or Organizational Unit
  723. //
  724. // lpGPO         - ADSI path to the GPO
  725. // lpContainer   - ADSI path to the Site, Domain, or Organizational Unit
  726. //
  727. // Returns:  S_OK if successful
  728. //
  729. //=============================================================================
  730.  
  731. GPEDITAPI
  732. HRESULT
  733. WINAPI
  734. DeleteGPOLink(
  735.     _In_ LPOLESTR lpGPO,
  736.     _In_ LPOLESTR lpContainer);
  737.  
  738.  
  739. //=============================================================================
  740. //
  741. // DeleteAllGPOLinks
  742. //
  743. // Deletes all GPO links for the specified Site, Domain, or Organizational Unit
  744. //
  745. // lpContainer   - ADSI path to the Site, Domain, or Organizational Unit
  746. //
  747. // Returns:  S_OK if successful
  748. //
  749. //=============================================================================
  750.  
  751. GPEDITAPI
  752. HRESULT
  753. WINAPI
  754. DeleteAllGPOLinks(
  755.     _In_ LPOLESTR lpContainer);
  756.  
  757.  
  758. //=============================================================================
  759. //
  760. // BrowseForGPO
  761. //
  762. // Displays the GPO browser dialog
  763. //
  764. // lpBrowseInfo   - Address of a GPOBROWSEINFO structure
  765. //
  766. // Returns:  S_OK if successful
  767. //
  768. //=============================================================================
  769.  
  770. //
  771. // Flags passed in the dwFlags field of the GPOBROWSEINFO structure
  772. //
  773.  
  774. #define GPO_BROWSE_DISABLENEW           0x00000001   // Disables the New GPO functionality on all pages except "All"
  775. #define GPO_BROWSE_NOCOMPUTERS          0x00000002   // Removes the Computers tab
  776. #define GPO_BROWSE_NODSGPOS             0x00000004   // Removes the Domain/OU and Sites tabs
  777. #define GPO_BROWSE_OPENBUTTON           0x00000008   // Change the Ok button to say Open
  778. #define GPO_BROWSE_INITTOALL            0x00000010   // Initialize the dialog focused on the All pane
  779. #define GPO_BROWSE_NOUSERGPOS           0x00000020   // Removes the Users tab
  780. #define GPO_BROWSE_SENDAPPLYONEDIT      0x00000040   // Send the apply event if edit menu is selected
  781.  
  782. typedef struct tag_GPOBROWSEINFO
  783. {
  784.     DWORD       dwSize;                   // [in] Initialized to the size of this structure
  785.     DWORD       dwFlags;                  // [in] Flags defined above
  786.     HWND        hwndOwner;                // [in] Parent window handle (can be NULL)
  787.     LPOLESTR    lpTitle;                  // [in] Title bar text.  If NULL, "Browse for a Group Policy Object" will be the default text
  788.     LPOLESTR    lpInitialOU;              // [in] Initial Domain/Organizational Unit to open focus on
  789.     _Field_size_(dwDSPathSize) LPOLESTR    lpDSPath;                 // [in/out] Pointer to the buffer that receives the Active Directory GPO path
  790.     DWORD       dwDSPathSize;             // [in] Size in characters of buffer given in lpDSPath
  791.     _Field_size_bytes_( dwNameSize) LPOLESTR    lpName;                   // [in/out] Pointer to a buffer that receives either the computer name or
  792.                                           //      the friendly name of the GPO (can be NULL)
  793.     DWORD       dwNameSize;               // [in] Size in characters of buffer given in lpName
  794.     GROUP_POLICY_OBJECT_TYPE    gpoType;  // [out] Specifies the type of GPO
  795.     GROUP_POLICY_HINT_TYPE      gpoHint;  // [out] Specifies a hint of the GPO association
  796. } GPOBROWSEINFO, *LPGPOBROWSEINFO;
  797.  
  798.  
  799. GPEDITAPI
  800. HRESULT
  801. WINAPI
  802. BrowseForGPO(
  803.     LPGPOBROWSEINFO lpBrowseInfo);
  804.  
  805.  
  806. //=============================================================================
  807. //
  808. // ImportRSoPData
  809. //
  810. // Imports a data file generated by ExportRSoPData
  811. //
  812. // lpNameSpace   - Namespace to place the data in
  813. // lpFileName    - Filename containing the data
  814. //
  815. // Returns:  S_OK if successful
  816. //
  817. // Notes:    The namespace specified in lpNameSpace must exist prior to calling
  818. //           this function.
  819. //
  820. //=============================================================================
  821.  
  822. GPEDITAPI
  823. HRESULT
  824. WINAPI
  825. ImportRSoPData(
  826.     _In_ LPOLESTR lpNameSpace,
  827.     _In_ LPOLESTR lpFileName);
  828.  
  829.  
  830. //=============================================================================
  831. //
  832. // ExportRSoPData
  833. //
  834. // Exports a WBEM namespace containing RSoP information to a data file.
  835. // This data file can be imported to a WBEM namespace using ImportRSoPData.
  836. //
  837. // lpNameSpace   - Namespace to read the data from
  838. // lpFileName    - Filename to receive the data
  839. //
  840. // Returns:  S_OK if successful
  841. //
  842. // Notes:    This function should be called twice.  Once for the user data
  843. //           and once for the computer data.
  844. //
  845. //=============================================================================
  846.  
  847. GPEDITAPI
  848. HRESULT
  849. WINAPI
  850. ExportRSoPData(
  851.     _In_ LPOLESTR lpNameSpace,
  852.     _In_ LPOLESTR lpFileName);
  853.  
  854. #ifdef __cplusplus
  855. }
  856. #endif
  857.  
  858.  
  859.  
  860. #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
  861. #pragma endregion
  862.  
  863. #endif  /* _GPEDIT_H_ */
Add Comment
Please, Sign In to add comment