⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jwauserenv.pas

📁 比较全面的win32api开发包
💻 PAS
📖 第 1 页 / 共 5 页
字号:
//
//=============================================================================

//
// Each Group Policy Object is associated (linked) with a site, domain,
// organizational unit, or machine.
//

type
  _GPO_LINK = (
    GPLinkUnknown,                         // No link information available
    GPLinkMachine,                         // GPO linked to a machine (local or remote)
    GPLinkSite,                            // GPO linked to a site
    GPLinkDomain,                          // GPO linked to a domain
    GPLinkOrganizationalUnit);             // GPO linked to a organizational unit
  {$EXTERNALSYM _GPO_LINK}
  GPO_LINK = _GPO_LINK;
  {$EXTERNALSYM GPO_LINK}
  PGPO_LINK = ^GPO_LINK;
  {$EXTERNALSYM PGPO_LINK}
  TGpoLink = GPO_LINK;
  PGpoLink = PGPO_LINK;

  PGROUP_POLICY_OBJECTA = ^GROUP_POLICY_OBJECTA;
  {$EXTERNALSYM PGROUP_POLICY_OBJECTA}
  _GROUP_POLICY_OBJECTA = record
    dwOptions: DWORD;             // See GPLink option flags above
    dwVersion: DWORD;             // Revision number of the GPO
    lpDSPath: LPSTR;              // Path to the Active Directory portion of the GPO
    lpFileSysPath: LPSTR;         // Path to the file system portion of the GPO
    lpDisplayName: LPSTR;         // Friendly display name
    szGPOName: array [0..49] of CHAR; // Unique name
    GPOLink: GPO_LINK;            // Link information
    lParam: LPARAM;               // Free space for the caller to store GPO specific information
    pNext: PGROUP_POLICY_OBJECTA; // Next GPO in the list
    pPrev: PGROUP_POLICY_OBJECTA; // Previous GPO in the list
    lpExtensions: LPSTR;          // Extensions that are relevant for this GPO
    lParam2: LPARAM;              // Free space for the caller to store GPO specific information
    lpLink: LPSTR;                // Path to the Active Directory site, domain, or organizational unit this GPO is linked to
                                  // If this is the local GPO, this points to the word "Local"
  end;
  {$EXTERNALSYM _GROUP_POLICY_OBJECTA}
  GROUP_POLICY_OBJECTA = _GROUP_POLICY_OBJECTA;
  {$EXTERNALSYM GROUP_POLICY_OBJECTA}
  TGroupPolicyObjectA = GROUP_POLICY_OBJECTA;
  PGroupPolicyObjectA = PGROUP_POLICY_OBJECTA;

  PGROUP_POLICY_OBJECTW = ^GROUP_POLICY_OBJECTW;
  {$EXTERNALSYM PGROUP_POLICY_OBJECTW}
  _GROUP_POLICY_OBJECTW = record
    dwOptions: DWORD;             // See GPLink option flags above
    dwVersion: DWORD;             // Revision number of the GPO
    lpDSPath: LPWSTR;             // Path to the Active Directory portion of the GPO
    lpFileSysPath: LPWSTR;        // Path to the file system portion of the GPO
    lpDisplayName: LPWSTR;        // Friendly display name
    szGPOName: array [0..49] of WCHAR; // Unique name
    GPOLink: GPO_LINK;            // Link information
    lParam: LPARAM;               // Free space for the caller to store GPO specific information
    pNext: PGROUP_POLICY_OBJECTW; // Next GPO in the list
    pPrev: PGROUP_POLICY_OBJECTW; // Previous GPO in the list
    lpExtensions: LPWSTR;         // Extensions that are relevant for this GPO
    lParam2: LPARAM;              // Free space for the caller to store GPO specific information
    lpLink: LPWSTR;               // Path to the Active Directory site, domain, or organizational unit this GPO is linked to
                                  // If this is the local GPO, this points to the word "Local"
  end;
  {$EXTERNALSYM _GROUP_POLICY_OBJECTW}
  GROUP_POLICY_OBJECTW = _GROUP_POLICY_OBJECTW;
  {$EXTERNALSYM GROUP_POLICY_OBJECTW}
  TGroupPolicyObjectW = GROUP_POLICY_OBJECTW;
  PGroupPolicyObjectW = PGROUP_POLICY_OBJECTW;

  PPGROUP_POLICY_OBJECTA = ^PGROUP_POLICY_OBJECTA;
  {$NODEFINE PPGROUP_POLICY_OBJECTA}
  PPGROUP_POLICY_OBJECTW = ^PGROUP_POLICY_OBJECTW;
  {$NODEFINE PPGROUP_POLICY_OBJECTW}

{$IFDEF UNICODE}
  GROUP_POLICY_OBJECT = GROUP_POLICY_OBJECTW;
  {$EXTERNALSYM GROUP_POLICY_OBJECT}
  PGROUP_POLICY_OBJECT = PGROUP_POLICY_OBJECTW;
  {$EXTERNALSYM PGROUP_POLICY_OBJECT}
  PPGROUP_POLICY_OBJECT = PPGROUP_POLICY_OBJECTW;
  {$NODEFINE PPGROUP_POLICY_OBJECT}
  TGroupPolicyObject = TGroupPolicyObjectW;
  PGroupPolicyObject = PGroupPolicyObjectW;
{$ELSE}
  GROUP_POLICY_OBJECT = GROUP_POLICY_OBJECTA;
  {$EXTERNALSYM GROUP_POLICY_OBJECT}
  PGROUP_POLICY_OBJECT = PGROUP_POLICY_OBJECTA;
  {$EXTERNALSYM PGROUP_POLICY_OBJECT}
  PPGROUP_POLICY_OBJECT = PPGROUP_POLICY_OBJECTA;
  {$NODEFINE PPGROUP_POLICY_OBJECT}
  TGroupPolicyObject = TGroupPolicyObjectA;
  PGroupPolicyObject = PGroupPolicyObjectA;
{$ENDIF}

//
// dwFlags for GetGPOList()
//

const
  GPO_LIST_FLAG_MACHINE  = $00000001; // Return machine policy information
  {$EXTERNALSYM GPO_LIST_FLAG_MACHINE}
  GPO_LIST_FLAG_SITEONLY = $00000002; // Return site policy information only
  {$EXTERNALSYM GPO_LIST_FLAG_SITEONLY}

function GetGPOListA(hToken: HANDLE; lpName: LPCSTR; lpHostName: LPCSTR;
  lpComputerName: LPCSTR; dwFlags: DWORD; pGPOList: PPGROUP_POLICY_OBJECTA): BOOL; stdcall;
{$EXTERNALSYM GetGPOListA}
function GetGPOListW(hToken: HANDLE; lpName: LPCWSTR; lpHostName: LPCWSTR;
  lpComputerName: LPCWSTR; dwFlags: DWORD; pGPOList: PPGROUP_POLICY_OBJECTW): BOOL; stdcall;
{$EXTERNALSYM GetGPOListW}

{$IFDEF UNICODE}
function GetGPOList(hToken: HANDLE; lpName: LPCWSTR; lpHostName: LPCWSTR;
  lpComputerName: LPCWSTR; dwFlags: DWORD; pGPOList: PPGROUP_POLICY_OBJECT): BOOL; stdcall;
{$EXTERNALSYM GetGPOList}
{$ELSE}
function GetGPOList(hToken: HANDLE; lpName: LPCSTR; lpHostName: LPCSTR;
lpComputerName: LPCSTR; dwFlags: DWORD; pGPOList: PPGROUP_POLICY_OBJECT): BOOL; stdcall;
{$EXTERNALSYM GetGPOList}
{$ENDIF}

//=============================================================================
//
// FreeGPOList
//
//
// Frees the linked list returned from GetGPOList
//
// pGPOList - Pointer to the linked list of GPOs
//
//
// Returns:  TRUE if successful
//           FALSE if not
//
//=============================================================================

function FreeGPOListA(pGPOList: PGROUP_POLICY_OBJECTA): BOOL; stdcall;
{$EXTERNALSYM FreeGPOListA}
function FreeGPOListW(pGPOList: PGROUP_POLICY_OBJECTW): BOOL; stdcall;
{$EXTERNALSYM FreeGPOListW}

{$IFDEF UNICODE}
function FreeGPOList(pGPOList: PGROUP_POLICY_OBJECT): BOOL; stdcall;
{$EXTERNALSYM FreeGPOList}
{$ELSE}
function FreeGPOList(pGPOList: PGROUP_POLICY_OBJECT): BOOL; stdcall;
{$EXTERNALSYM FreeGPOList}
{$ENDIF}

//=============================================================================
//
// GetAppliedGPOList
//
// Queries for the list of applied Group Policy Objects for the specified
// user or machine and specified client side extension. This function will return
// a linked listof Group Policy Objects.  Call FreeGPOList to free the list.
//
// dwFlags          - User or machine policy, if it is GPO_LIST_FLAG_MACHINE then
//                    return machine policy information
// pMachineName     - Name of remote computer in the form \\computername. If null
//                    then local computer is used.
// pSidUser         - Security id of user (relevant for user policy). If pMachineName is
//                    null and pSidUser is null then it means current logged on user.
//                    If pMachine is null and pSidUser is non-null then it means user
//                    represented by pSidUser on local machine. If pMachineName is non-null
//                    then and if dwFlags specifies user policy, then pSidUser must be
//                    non-null.
// pGuidExtension   - Guid of the specified extension
// ppGPOList        - Address of a pointer which receives the link list of GPOs
//
// The return value is a Win32 error code. ERROR_SUCCESS means the GetAppliedGPOList
// function completed successfully. Otherwise it indicates that the function failed.
//
//=============================================================================

function GetAppliedGPOListA(dwFlags: DWORD; pMachineName: LPCSTR; pSidUser: PSID;
  pGuidExtension: LPGUID; ppGPOList: PPGROUP_POLICY_OBJECTA): DWORD; stdcall;
{$EXTERNALSYM GetAppliedGPOListA}
function GetAppliedGPOListW(dwFlags: DWORD; pMachineName: LPCWSTR; pSidUser: PSID;
  pGuidExtension: LPGUID; ppGPOList: PPGROUP_POLICY_OBJECTW): DWORD; stdcall;
{$EXTERNALSYM GetAppliedGPOListW}

{$IFDEF UNICODE}
function GetAppliedGPOList(dwFlags: DWORD; pMachineName: LPCWSTR; pSidUser: PSID;
  pGuidExtension: LPGUID; ppGPOList: PPGROUP_POLICY_OBJECT): DWORD; stdcall;
{$EXTERNALSYM GetAppliedGPOList}
{$ELSE}
function GetAppliedGPOList(dwFlags: DWORD; pMachineName: LPCSTR; pSidUser: PSID;
  pGuidExtension: LPGUID; ppGPOList: PPGROUP_POLICY_OBJECT): DWORD; stdcall;
{$EXTERNALSYM GetAppliedGPOList}
{$ENDIF}

//=============================================================================
//
// Group Policy Object client side extension support
//
// Flags, data structures and function prototype
//
// To register your extension, create a subkey under this key
//
// Software\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions
//
// The subkey needs to be a guid so that it is unique. The noname value of the subkey
// can be the friendly name of the extension. Then add these values:
//
//     DllName                      REG_EXPAND_SZ  Path to your DLL
//     ProcessGroupPolicy           REG_SZ       Function name (see PFNPROCESSGROUPPOLICY prototype). This
//                                                 is obsolete, it has been superseded by ProcessGroupPolicyEx.
//                                                 It's here for backward compatibility reasons only.
//     ProcessGroupPolicyEx         REG_SZ       Function name (see PFNPROCESSGROUPPOLICYEX prototype)
//     GenerateGroupPolicy          REG_SZ       Function name for Rsop (see PFNGENERATEGROUPPOLICY prototype)
//     NoMachinePolicy              REG_DWORD    True, if extension does not have to be called when
//                                                 machine policies are being processed.
//     NoUserPolicy                 REG_DWORD    True, if extension does not have to be called when
//                                                 user policies are being processed.
//     NoSlowLink                   REG_DWORD    True, if extension does not have to be called on a slow link
//     NoBackgroundPolicy           REG_DWORD    True, if extension does not have to be called 
//                                                 for background policy processing.
//     NoGPOListChanges             REG_DWORD    True, if extension does not have to be called when
//                                                 there are no changes between cached and current GPO lists.
//     PerUserLocalSettings         REG_DWORD    True, if user policies have to be cached on a per user and
//                                                 per machine basis.
//     RequiresSuccessfulRegistry   REG_DWORD    True, if extension should be called only if registry extension
//                                                 was successfully processed.
//     EnableAsynchronousProcessing REG_DWORD    True, if registry extension will complete its processing
//                                                 asynchronously.
//     NotifyLinkTransition         REG_DWORD    True, if extension should be called when a change in link
//                                                 speed is detected between previous policy application and
//                                                 current policy application.
//
// The return value is a Win32 error code. ERROR_SUCCESS means the ProcessGroupPolicy
// function completed successfully. If return value is ERROR_OVERRIDE_NOCHANGES then it
// means that the extension will be called the next time even if NoGPOListChanges is set
// and there are no changes to the GPO list. Any other return value indicates that the
// ProcessGroupPolicy or ProcessGroupPolicyEx function failed.
//
//=============================================================================

const
  GP_DLLNAME                       = 'DllName';
  {$EXTERNALSYM GP_DLLNAME}
  GP_ENABLEASYNCHRONOUSPROCESSING  = 'EnableAsynchronousProcessing';
  {$EXTERNALSYM GP_ENABLEASYNCHRONOUSPROCESSING}
  GP_MAXNOGPOLISTCHANGESINTERVAL   = 'MaxNoGPOListChangesInterval';
  {$EXTERNALSYM GP_MAXNOGPOLISTCHANGESINTERVAL}
  GP_NOBACKGROUNDPOLICY            = 'NoBackgroundPolicy';
  {$EXTERNALSYM GP_NOBACKGROUNDPOLICY}
  GP_NOGPOLISTCHANGES              = 'NoGPOListChanges';
  {$EXTERNALSYM GP_NOGPOLISTCHANGES}
  GP_NOMACHINEPOLICY               = 'NoMachinePolicy';
  {$EXTERNALSYM GP_NOMACHINEPOLICY}
  GP_NOSLOWLINK                    = 'NoSlowLink';
  {$EXTERNALSYM GP_NOSLOWLINK}
  GP_NOTIFYLINKTRANSITION          = 'NotifyLinkTransition';
  {$EXTERNALSYM GP_NOTIFYLINKTRANSITION}
  GP_NOUSERPOLICY                  = 'NoUserPolicy';
  {$EXTERNALSYM GP_NOUSERPOLICY}
  GP_PERUSERLOCALSETTINGS          = 'PerUserLocalSettings';
  {$EXTERNALSYM GP_PERUSERLOCALSETTINGS}
  GP_PROCESSGROUPPOLICY            = 'ProcessGroupPolicy';
  {$EXTERNALSYM GP_PROCESSGROUPPOLICY}
  GP_REQUIRESSUCCESSFULREGISTRY    = 'RequiresSuccessfulRegistry';
  {$EXTERNALSYM GP_REQUIRESSUCCESSFULREGISTRY}

  GPO_INFO_FLAG_MACHINE        = $00000001;   // Apply machine policy rather than user policy
  {$EXTERNALSYM GPO_INFO_FLAG_MACHINE}
  GPO_INFO_FLAG_BACKGROUND     = $00000010;   // Background refresh of policy (ok to do slow stuff)
  {$EXTERNALSYM GPO_INFO_FLAG_BACKGROUND}
  GPO_INFO_FLAG_SLOWLINK       = $00000020;   // Policy is being applied across a slow link
  {$EXTERNALSYM GPO_INFO_FLAG_SLOWLINK}
  GPO_INFO_FLAG_VERBOSE        = $00000040;   // Verbose output to the eventlog
  {$EXTERNALSYM GPO_INFO_FLAG_VERBOSE}
  GPO_INFO_FLAG_NOCHANGES      = $00000080;   // No changes were detected to the Group Policy Objects
  {$EXTERNALSYM GPO_INFO_FLAG_NOCHANGES}
  GPO_INFO_FLAG_LINKTRANSITION = $00000100;   // A change in link speed was detected between previous policy
  {$EXTERNALSYM GPO_INFO_FLAG_LINKTRANSITION} // application and current policy application

  GPO_INFO_FLAG_LOGRSOP_TRANSITION = $00000200;   // A Change in Rsop Logging was detected between previous policy
  {$EXTERNALSYM GPO_INFO_FLAG_LOGRSOP_TRANSITION} // application and current policy application, (new intf only)

  GPO_INFO_FLAG_FORCED_REFRESH     = $00000400;  // Forced Refresh is being applied. redo policies.
  {$EXTERNALSYM GPO_INFO_FLAG_FORCED_REFRESH}
  GPO_INFO_FLAG_SAFEMODE_BOOT      = $00000800;  // windows safe mode boot flag
  {$EXTERNALSYM GPO_INFO_FLAG_SAFEMODE_BOOT}
  GPO_INFO_FLAG_ASYNC_FOREGROUND   = $00001000;  // Asynchronous foreground refresh of policy
  {$EXTERNALSYM GPO_INFO_FLAG_ASYNC_FOREGROUND}
  GPO_INFO_FLAG_REPORT             = $00002000;  // Report all settings for one GPO rather than the resultant settings across multiple GPOs
  {$EXTERNALSYM GPO_INFO_FLAG_REPORT}

type
  ASYNCCOMPLETIONHANDLE = UINT_PTR;
  {$EXTERNALSYM ASYNCCOMPLETIONHANDLE}

  PFNSTATUSMESSAGECALLBACK = function (bVerbose: BOOL; lpMessage: LPWSTR): DWORD; stdcall;
  {$EXTERNALSYM PFNSTATUSMESSAGECALLBACK}

  PFNPROCESSGROUPPOLICY = function (
    dwFlags: DWORD;                              // GPO_INFO_FLAGS
    hToken: HANDLE;                              // User or machine token
    hKeyRoot: HKEY;                              // Root of registry
    pDeletedGPOList: PGROUP_POLICY_OBJECT;       // Linked list of deleted GPOs
    pChangedGPOList: PGROUP_POLICY_OBJECT;       // Linked list of changed GPOs
    pHandle: ASYNCCOMPLETIONHANDLE;              // For asynchronous completion
    pbAbort: LPBOOL;                             // If true, then abort GPO processing
    pStatusCallback: PFNSTATUSMESSAGECALLBACK    // Callback function for displaying status messages
    ): DWORD; stdcall;                           // Note, this can be NULL
  {$EXTERNALSYM PFNPROCESSGROUPPOLICY}

  PFNPROCESSGROUPPOLICYEX = function (
    dwFlags: DWORD;                              // GPO_INFO_FLAGS
    hToken: HANDLE;                              // User or machine token
    hKeyRoot: HKEY;                              // Root of registry
    pDeletedGPOList: PGROUP_POLICY_OBJECT;       // Linked list of deleted GPOs
    pChangedGPOList: PGROUP_POLICY_OBJECT;       // Linked list of changed GPOs
    pHandle: ASYNCCOMPLETIONHANDLE;              // For asynchronous completion
    pbAbort: PBOOL;                              // If true, then abort GPO processing
    pStatusCallback: PFNSTATUSMESSAGECALLBACK;   // Callback function for displaying status messages
                                                 // Note, this can be NULL
    pWbemServices: IWbemServices;                // Pointer to namespace to log diagnostic mode data
                                                 // Note, this will be NULL when Rsop logging is disabled
    var pRsopStatus: HRESULT                     // RSOP Logging succeeded or not.
    ): DWORD; stdcall;
  {$EXTERNALSYM PFNPROCESSGROUPPOLICYEX}

  PRSOPTOKEN = PVOID;
  {$EXTERNALSYM PRSOPTOKEN}

  _RSOP_TARGET = record
    pwszAccountName: PWCHAR;                   // Account name
    pwszNewSOM: PWCHAR;                        // New domain or OU location for account

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -