DEFINE_GUID(CLSID_GPESnapIn,0x8fc0b734,0xa0e1,0x11d1,0xa7,0xd3,0x0,0x0,0xf8,0x75,0x71,0xe3);
DEFINE_GUID(NODEID_Machine,0x8fc0b737,0xa0e1,0x11d1,0xa7,0xd3,0x0,0x0,0xf8,0x75,0x71,0xe3);
DEFINE_GUID(NODEID_MachineSWSettings,0x8fc0b73a,0xa0e1,0x11d1,0xa7,0xd3,0x0,0x0,0xf8,0x75,0x71,0xe3);
DEFINE_GUID(NODEID_User,0x8fc0b738,0xa0e1,0x11d1,0xa7,0xd3,0x0,0x0,0xf8,0x75,0x71,0xe3);
DEFINE_GUID(NODEID_UserSWSettings,0x8fc0b73c,0xa0e1,0x11d1,0xa7,0xd3,0x0,0x0,0xf8,0x75,0x71,0xe3);
DEFINE_GUID(IID_IGPEInformation,0x8fc0b735,0xa0e1,0x11d1,0xa7,0xd3,0x0,0x0,0xf8,0x75,0x71,0xe3);
DEFINE_GUID(CLSID_GroupPolicyObject,0xea502722,0xa23d,0x11d1,0xa7,0xd3,0x0,0x0,0xf8,0x75,0x71,0xe3);
DEFINE_GUID(IID_IGroupPolicyObject,0xea502723,0xa23d,0x11d1,0xa7,0xd3,0x0,0x0,0xf8,0x75,0x71,0xe3);

#define REGISTRY_EXTENSION_GUID  {0x35378EAC,0x683F,0x11D2,0xA8,0x9A,0x00,0xC0,0x4F,0xBB,0xCF,0xA2}

#ifndef _GPEDIT_H
#define _GPEDIT_H

/* Group Policy definitions */

#if !defined(_GPEDIT_)
#define GPEDITAPI DECLSPEC_IMPORT
#else
#define GPEDITAPI
#endif

#ifdef __cplusplus
extern "C" {
#endif

#include <objbase.h>

#define GPO_SECTION_ROOT  0
#define GPO_SECTION_USER  1
#define GPO_SECTION_MACHINE  2

#define GPO_OPEN_LOAD_REGISTRY  0x00000001
#define GPO_OPEN_READ_ONLY  0x00000002

#define GPO_OPTION_DISABLE_USER  0x00000001
#define GPO_OPTION_DISABLE_MACHINE  0x00000002

#define GPO_BROWSE_DISABLENEW  0x00000001
#define GPO_BROWSE_NOCOMPUTERS  0x00000002
#define GPO_BROWSE_NODSGPOS  0x00000004
#define GPO_BROWSE_OPENBUTTON  0x00000008

typedef enum _GROUP_POLICY_OBJECT_TYPE {
    GPOTypeLocal = 0,
    GPOTypeRemote,
    GPOTypeDS
} GROUP_POLICY_OBJECT_TYPE, *PGROUP_POLICY_OBJECT_TYPE;

typedef enum _GROUP_POLICY_HINT_TYPE {
    GPHintUnknown = 0,
    GPHintMachine,
    GPHintSite,
    GPHintDomain,
    GPHintOrganizationalUnit
} GROUP_POLICY_HINT_TYPE, *PGROUP_POLICY_HINT_TYPE;

typedef struct tag_GPOBROWSEINFO {
    DWORD dwSize;
    DWORD dwFlags;
    HWND hwndOwner;
    LPOLESTR lpTitle;
    LPOLESTR lpInitialOU;
    LPOLESTR lpDSPath;
    DWORD dwDSPathSize;
    LPOLESTR lpName;

    DWORD dwNameSize;
    GROUP_POLICY_OBJECT_TYPE gpoType;
    GROUP_POLICY_HINT_TYPE gpoHint;
} GPOBROWSEINFO, *LPGPOBROWSEINFO;

#undef INTERFACE
#define INTERFACE IGPEInformation
DECLARE_INTERFACE_(IGPEInformation,IUnknown) {
    STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
    STDMETHOD_(ULONG,Release)(THIS) PURE;
    STDMETHOD(GetName)(THIS_ LPOLESTR,int) PURE;
    STDMETHOD(GetDisplayName)(THIS_ LPOLESTR,int)PURE;
    STDMETHOD(GetRegistryKey)(THIS_ DWORD,HKEY*) PURE;
    STDMETHOD(GetDSPath)(THIS_ DWORD,LPOLESTR,int)PURE;
    STDMETHOD(GetFileSysPath)(THIS_ DWORD,LPOLESTR,int)PURE;
    STDMETHOD(GetOptions)(THIS_ DWORD*) PURE;
    STDMETHOD(GetType)(THIS_ GROUP_POLICY_OBJECT_TYPE*) PURE;
    STDMETHOD(GetHint)(THIS_ GROUP_POLICY_HINT_TYPE*) PURE;
    STDMETHOD(PolicyChanged)(THIS_ BOOL,BOOL,GUID*,GUID*) PURE;
};
typedef IGPEInformation *LPGPEINFORMATION;

#undef INTERFACE
#define INTERFACE IGroupPolicyObject
DECLARE_INTERFACE_(IGroupPolicyObject,IUnknown) {
    STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
    STDMETHOD_(ULONG,Release)(THIS) PURE;
    STDMETHOD(New)(THIS_ LPOLESTR,LPOLESTR,DWORD) PURE;
    STDMETHOD(OpenDSGPO)(THIS_ LPOLESTR,DWORD) PURE;
    STDMETHOD(OpenLocalMachineGPO)(THIS_ DWORD) PURE;
    STDMETHOD(OpenRemoteMachineGPO)(THIS_ LPOLESTR,DWORD) PURE;
    STDMETHOD(Save)(THIS_ BOOL,BOOL,GUID*,GUID*) PURE;
    STDMETHOD(Delete)(THIS) PURE;
    STDMETHOD(GetName)(THIS_ LPOLESTR,int) PURE;
    STDMETHOD(GetDisplayName)(THIS_ LPOLESTR,int) PURE;
    STDMETHOD(SetDisplayName)(THIS_ LPOLESTR) PURE;
    STDMETHOD(GetPath)(THIS_ LPOLESTR,int) PURE;
    STDMETHOD(GetDSPath)(THIS_ DWORD,LPOLESTR,int) PURE;
    STDMETHOD(GetFileSysPath)(THIS_ DWORD,LPOLESTR,int) PURE;
    STDMETHOD(GetRegistryKey)(THIS_ DWORD,HKEY*) PURE;
    STDMETHOD(GetOptions)(THIS_ DWORD*) PURE;
    STDMETHOD(SetOptions)(THIS_ DWORD,DWORD) PURE;
    STDMETHOD(GetType)(THIS_ GROUP_POLICY_OBJECT_TYPE*) PURE;
    STDMETHOD(GetMachineName)(THIS_ LPOLESTR,int) PURE;
    STDMETHOD(GetPropertySheetPages)(THIS_ HPROPSHEETPAGE**,UINT*) PURE;
};
typedef IGroupPolicyObject *LPGROUPPOLICYOBJECT;

GPEDITAPI HRESULT WINAPI CreateGPOLink(LPOLESTR,LPOLESTR,BOOL);
GPEDITAPI HRESULT WINAPI DeleteGPOLink(LPOLESTR,LPOLESTR);
GPEDITAPI HRESULT WINAPI DeleteAllGPOLinks(LPOLESTR);
GPEDITAPI HRESULT WINAPI BrowseForGPO(LPGPOBROWSEINFO);

#ifdef __cplusplus
}
#endif

#endif /* _GPEDIT_H */
