📄 jwagpedit.pas
字号:
{******************************************************************************}
{ }
{ Group Policy API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: gpedit.h, released June 2000. The original Pascal }
{ code is: GPEdit.pas, released December 2000. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl). }
{ }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
{ Marcel van Brakel. All Rights Reserved. }
{ }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project JEDI home }
{ page, located at http://delphi-jedi.org or my personal homepage located at }
{ http://members.chello.nl/m.vanbrakel2 }
{ }
{ The contents of this file are used with permission, subject to the Mozilla }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at }
{ http://www.mozilla.org/MPL/MPL-1.1.html }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License. }
{ }
{ Alternatively, the contents of this file may be used under the terms of the }
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
{ provisions of the LGPL License are applicable instead of those above. }
{ If you wish to allow use of your version of this file only under the terms }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting the provisions above and }
{ replace them with the notice and other provisions required by the LGPL }
{ License. If you do not delete the provisions above, a recipient may use }
{ your version of this file under either the MPL or the LGPL License. }
{ }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ }
{******************************************************************************}
unit JwaGPEdit;
{$WEAKPACKAGEUNIT}
{$HPPEMIT ''}
{$HPPEMIT '#include "GPEdit.h"'}
{$HPPEMIT ''}
{$I WINDEFINES.INC}
interface
uses
ActiveX {TODO}, JwaPrSht, JwaWinType;
type
LPOLESTR = POleStr;
{$NODEFINE LPOLESTR}
//-----------------------------------------------------------------------------
//
// GPEDIT.H - Definitions and prototypes for Group Policy
//
// Copyright 1997-1999, Microsoft Corporation
//
//-----------------------------------------------------------------------------
//
// Terminology
//
// Group Policy Editor - The tool to view a Group Policy Object.
//
// Group Policy Object - A collection of administrator defined policies.
// Each Group Policy Object (GPO) has both file system
// and Active Directory storage available to it.
//
// IGPEInformation - The interface MMC Snapin Extensions use to
// talk to the Group Policy Editor.
//
// IGroupPolicyObject - The interface used to create/edit a GPO directly
// without going through the Group Policy Editor
//
//
// Group Policy Editor MMC SnapIn GUID
//
// {8FC0B734-A0E1-11d1-A7D3-0000F87571E3}
const
CLSID_GPESnapIn: TGUID = (
D1:$8fc0b734; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
{$EXTERNALSYM CLSID_GPESnapIn}
//
// Group Policy Editor node ids
//
//
// Computer Configuration\Windows Settings
// {8FC0B737-A0E1-11d1-A7D3-0000F87571E3}
//
NODEID_Machine: TGUID = (
D1:$8fc0b737; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
{$EXTERNALSYM NODEID_Machine}
//
// Computer Configuration\Software Settings
// {8FC0B73A-A0E1-11d1-A7D3-0000F87571E3}
//
NODEID_MachineSWSettings: TGUID = (
D1:$8fc0b73a; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
{$EXTERNALSYM NODEID_MachineSWSettings}
//
// User Configuration\Windows Settings
// {8FC0B738-A0E1-11d1-A7D3-0000F87571E3}
//
NODEID_User: TGUID = (
D1:$8fc0b738; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
{$EXTERNALSYM NODEID_User}
//
// User Configuration\Software Settings
// {8FC0B73C-A0E1-11d1-A7D3-0000F87571E3}
//
NODEID_UserSWSettings: TGUID = (
D1:$8fc0b73c; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
{$EXTERNALSYM NODEID_UserSWSettings}
//
// IGPEInformation interface id
//
// {8FC0B735-A0E1-11d1-A7D3-0000F87571E3}
IID_IGPEInformation: TGUID = (
D1:$8fc0b735; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
{$EXTERNALSYM IID_IGPEInformation}
//
// Group Policy Object class id
//
// {EA502722-A23D-11d1-A7D3-0000F87571E3}
CLSID_GroupPolicyObject: TGUID = (
D1:$ea502722; D2:$a23d; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
{$EXTERNALSYM CLSID_GroupPolicyObject}
//
// Group Policy Object interface id
//
// {EA502723-A23D-11d1-A7D3-0000F87571E3}
IID_IGroupPolicyObject: TGUID = (
D1:$ea502723; D2:$a23d; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
{$EXTERNALSYM IID_IGroupPolicyObject}
//
// GUID that identifies the registry extension
//
REGISTRY_EXTENSION_GUID: TGUID = (
D1:$35378EAC; D2:$683F; D3:$11D2; D4:($A8, $9A, $00, $C0, $4F, $BB, $CF, $A2));
{$EXTERNALSYM IID_IGroupPolicyObject}
//========================================================================================
//
// Resultant Set of Policy node ids
//
//========================================================================================
//
// Resultant Set of Policy MMC SnapIn GUID
//
// {6DC3804B-7212-458D-ADB0-9A07E2AE1FA2}
CLSID_RSOPSnapIn: TGUID = (
D1:$6dc3804b; D2:$7212; D3:$458d; D4:($ad, $b0, $9a, $07, $e2, $ae, $1f, $a2));
{$EXTERNALSYM CLSID_RSOPSnapIn}
//
// Computer Configuration\Windows Settings
// {BD4C1A2E-0B7A-4A62-A6B0-C0577539C97E}
//
NODEID_RSOPMachine: TGUID = (
D1:$bd4c1a2e; D2:$0b7a; D3:$4a62; D4:($a6, $b0, $c0, $57, $75, $39, $c9, $7e));
{$EXTERNALSYM NODEID_RSOPMachine}
//
// Computer Configuration\Software Settings
// {6A76273E-EB8E-45DB-94C5-25663A5f2C1A}
//
NODEID_RSOPMachineSWSettings: TGUID = (
D1:$6a76273e; D2:$eb8e; D3:$45db; D4:($94, $c5, $25, $66, $3a, $5f, $2c, $1a));
{$EXTERNALSYM NODEID_RSOPMachineSWSettings}
//
// User Configuration\Windows Settings
// {AB87364F-0CEC-4CD8-9BF8-898F34628FB8}
//
NODEID_RSOPUser: TGUID = (
D1:$ab87364f; D2:$0cec; D3:$4cd8; D4:($9b, $f8, $89, $8f, $34, $62, $8f, $b8));
{$EXTERNALSYM NODEID_RSOPUser}
//
// User Configuration\Software Settings
// {E52C5CE3-FD27-4402-84DE-D9A5F2858910}
//
NODEID_RSOPUserSWSettings: TGUID = (
D1:$e52c5ce3; D2:$fd27; D3:$4402; D4:($84, $de, $d9, $a5, $f2, $85, $89, $10));
{$EXTERNALSYM NODEID_RSOPUserSWSettings}
//
// IRSOPInformation interface id
//
// {9A5A81B5-D9C7-49EF-9D11-DDF50968C48D}
IID_IRSOPInformation: TGUID = (
D1:$9a5a81b5; D2:$d9c7; D3:$49ef; D4:($9d, $11, $dd, $f5, $09, $68, $c4, $8d));
{$EXTERNALSYM IID_IRSOPInformation}
// #include <objbase.h>
//
// Group Policy Object Section flags
//
const
GPO_SECTION_ROOT = 0; // Root
{$EXTERNALSYM GPO_SECTION_ROOT}
GPO_SECTION_USER = 1; // User
{$EXTERNALSYM GPO_SECTION_USER}
GPO_SECTION_MACHINE = 2; // Machine
{$EXTERNALSYM GPO_SECTION_MACHINE}
//
// Group Policy Object types
//
type
_GROUP_POLICY_OBJECT_TYPE = (
GPOTypeLocal, // GPO on the local machine
GPOTypeRemote, // GPO on a remote machine
GPOTypeDS); // GPO in the Active Directory
{$EXTERNALSYM _GROUP_POLICY_OBJECT_TYPE}
GROUP_POLICY_OBJECT_TYPE = _GROUP_POLICY_OBJECT_TYPE;
{$EXTERNALSYM GROUP_POLICY_OBJECT_TYPE}
PGROUP_POLICY_OBJECT_TYPE = ^GROUP_POLICY_OBJECT_TYPE;
{$EXTERNALSYM PGROUP_POLICY_OBJECT_TYPE}
TGroupPolicyObjectType = GROUP_POLICY_OBJECT_TYPE;
PGroupPolicyObjectType = PGROUP_POLICY_OBJECT_TYPE;
//
// Group Policy Hint types
//
_GROUP_POLICY_HINT_TYPE = (
GPHintUnknown, // No link information available
GPHintMachine, // GPO linked to a machine (local or remote)
GPHintSite, // GPO linked to a site
GPHintDomain, // GPO linked to a domain
GPHintOrganizationalUnit); // GPO linked to a organizational unit
{$EXTERNALSYM _GROUP_POLICY_HINT_TYPE}
GROUP_POLICY_HINT_TYPE = _GROUP_POLICY_HINT_TYPE;
{$EXTERNALSYM GROUP_POLICY_HINT_TYPE}
PGROUP_POLICY_HINT_TYPE = ^GROUP_POLICY_HINT_TYPE;
{$EXTERNALSYM PGROUP_POLICY_HINT_TYPE}
TGroupPolicyHintType = GROUP_POLICY_HINT_TYPE;
PGroupPolicyHintType = PGROUP_POLICY_HINT_TYPE;
IGPEInformation = interface (IUnknown)
['{8FC0B735-A0E1-11d1-A7D3-0000F87571E3}']
// *** IGPEInformation methods ***
//
// Returns the unique Group Policy Object name (a GUID)
//
// pszName contains the name on return
// cchMaxLength is the max number of characters that can be stored in pszName
//
function GetName(pszName: LPOLESTR; cchMaxLength: Integer): HRESULT; stdcall;
//
// Returns the friendly display name for this Group Policy Object
//
// pszName contains the name on return
// cchMaxLength is the max number of characters that can be stored in pszName
//
function GetDisplayName(pszName: LPOLESTR; cchMaxLength: Integer): HRESULT; stdcall;
//
// Returns a registry key handle for the requested section. The returned
// key is the root of the registry, not the Policies subkey. To set / read
// a value in the Policies subkey, you will need to call RegOpenKeyEx to
// open Software\Policies subkey first.
//
// The handle has been opened with ALL ACCESS rights. Call RegCloseKey
// on the handle when finished.
//
// dwSection is either GPO_SECTION_USER or GPO_SECTION_MACHINE
// hKey contains the registry key on return
//
function GetRegistryKey(dwSection: DWORD; var hKey: HKEY): HRESULT; stdcall;
//
// Returns the Active Directory path to the root of the request section.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -