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

📄 jwagpedit.pas

📁 比较全面的win32api开发包
💻 PAS
📖 第 1 页 / 共 3 页
字号:
    // in the array
    //
    // Note, this method will allocate memory for the array with
    // LocalAlloc.  When finished, the caller should free the array
    // with LocalFree
    //
    // hPages address of the pointer for the array of property sheet pages
    // uPageCount receives the number of pages in the array
    //

    function GetPropertySheetPages(var hPages: PHPROPSHEETPAGE; var uPageCount: UINT): HRESULT; stdcall;
    
  end;
  {$EXTERNALSYM IGroupPolicyObject}

  LPGROUPPOLICYOBJECT = ^IGroupPolicyObject;
  {$EXTERNALSYM LPGROUPPOLICYOBJECT}

//
// RSOP flags
//

const
  RSOP_INFO_FLAG_DIAGNOSTIC_MODE = $00000001; // Running in diagnostic mode vs planning mode
  {$EXTERNALSYM RSOP_INFO_FLAG_DIAGNOSTIC_MODE}

type
  IRSOPInformation = interface (IUnknown)
  ['{9A5A81B5-D9C7-49EF-9D11-DDF50968C48D}']

    // *** IRSOPInformation methods ***

    //
    // Returns the namespace for the RSOP data
    //
    // dwSection is either GPO_SECTION_USER or GPO_SECTION_MACHINE
    // pszName contains the namespace on return
    // cchMaxLength is the max number of characters that can be stored in pszName
    //

    function GetNamespace(dwSection: DWORD; pszName: LPOLESTR; cchMaxLength: Integer): HRESULT; stdcall;

    //
    // Returns information about the RSOP session
    //
    // pdwFlags points to a DWORD which contains the flags on return
    //

    function GetFlags(var pdwFlags: DWORD): HRESULT; stdcall;

    //
    // Returns the event log text for a specific entry
    //
    // lpEventSource - event log source name
    // lpEventLogName - event log name
    // lpEventTime - event log time in WMI datetime format
    // dwEventID - event ID
    // lpText - Receives a pointer to a buffer containing the text.
    //          The caller should free this buffer with CoTaskMemFree.
    //

    function GetEventLogEntryText(pszEventSource, pszEventLogName, pszEventTime: LPOLESTR;
      dwEventID: DWORD; out ppszText: LPOLESTR): HRESULT; stdcall;

  end;
  {$EXTERNALSYM IRSOPInformation}

  LPRSOPINFORMATION = IRSOPInformation;
  {$EXTERNALSYM LPRSOPINFORMATION}

//=============================================================================
//
// CreateGPOLink
//
// Creates a link to a GPO for the specified Site, Domain, or Organizational Unit
//
// lpGPO         - ADSI path to the GPO
// lpContainer   - ADSI path to the Site, Domain, or Organizational Unit
// fHighPriority - Create the link as the highest or lowest priority
//
// Returns:  S_OK if successful
//
//=============================================================================

function CreateGPOLink(lpGPO, lpContainer: LPOLESTR; fHighPriority: BOOL): HRESULT; stdcall;
{$EXTERNALSYM CreateGPOLink}


//=============================================================================
//
// DeleteGPOLink
//
// Deletes a link to a GPO for the specified Site, Domain, or Organizational Unit
//
// lpGPO         - ADSI path to the GPO
// lpContainer   - ADSI path to the Site, Domain, or Organizational Unit
//
// Returns:  S_OK if successful
//
//=============================================================================

function DeleteGPOLink(lpGPO, lpContainer: LPOLESTR): HRESULT; stdcall;
{$EXTERNALSYM DeleteGPOLink}

//=============================================================================
//
// DeleteAllGPOLinks
//
// Deletes all GPO links for the specified Site, Domain, or Organizational Unit
//
// lpContainer   - ADSI path to the Site, Domain, or Organizational Unit
//
// Returns:  S_OK if successful
//
//=============================================================================

function DeleteAllGPOLinks(lpContainer: LPOLESTR): HRESULT; stdcall;
{$EXTERNALSYM DeleteAllGPOLinks}

//=============================================================================
//
// BrowseForGPO
//
// Displays the GPO browser dialog
//
// lpBrowseInfo   - Address of a GPOBROWSEINFO structure
//
// Returns:  S_OK if successful
//
//=============================================================================

//
// Flags passed in the dwFlags field of the GPOBROWSEINFO structure
//

const
  GPO_BROWSE_DISABLENEW          = $00000001;   // Disables the New GPO functionality on all pages except "All"
  {$EXTERNALSYM GPO_BROWSE_DISABLENEW}
  GPO_BROWSE_NOCOMPUTERS         = $00000002;   // Removes the Computers tab
  {$EXTERNALSYM GPO_BROWSE_NOCOMPUTERS}
  GPO_BROWSE_NODSGPOS            = $00000004;   // Removes the Domain/OU and Sites tabs
  {$EXTERNALSYM GPO_BROWSE_NODSGPOS}
  GPO_BROWSE_OPENBUTTON          = $00000008;   // Change the Ok button to say Open
  {$EXTERNALSYM GPO_BROWSE_OPENBUTTON}
  GPO_BROWSE_INITTOALL           = $00000010;   // Initialize the dialog focused on the All pane
  {$EXTERNALSYM GPO_BROWSE_INITTOALL}

type
  tag_GPOBROWSEINFO = record
    dwSize: DWORD;                      // [in] Initialized to the size of this structure
    dwFlags: DWORD;                     // [in] Flags defined above
    hwndOwner: HWND;                    // [in] Parent window handle (can be NULL)
    lpTitle: LPOLESTR;                  // [in] Title bar text.  If NULL, "Browse for a Group Policy Object" will be the default text
    lpInitialOU: LPOLESTR;              // [in] Initial Domain/Organizational Unit to open focus on
    lpDSPath: LPOLESTR;                 // [in/out] Pointer to the buffer that receives the Active Directory GPO path
    dwDSPathSize: DWORD;                // [in] Size in characters of buffer given in lpDSPath
    lpName: LPOLESTR;                   // [in/out] Pointer to a buffer that receives either the computer name or
                                        //          the friendly name of the GPO (can be NULL)
    dwNameSize: DWORD;                  // [in] Size in characters of buffer given in lpName
    gpoType: GROUP_POLICY_OBJECT_TYPE;  // [out] Specifies the type of GPO
    gpoHint: GROUP_POLICY_HINT_TYPE;    // [out] Specifies a hint of the GPO association
  end;
  {$EXTERNALSYM tag_GPOBROWSEINFO}
  GPOBROWSEINFO = tag_GPOBROWSEINFO;
  {$EXTERNALSYM GPOBROWSEINFO}
  LPGPOBROWSEINFO = ^GPOBROWSEINFO;
  TGpoBrowseInfo = GPOBROWSEINFO;
  PGpoBrowseInfo = LPGPOBROWSEINFO;

function BrowseForGPO(var lpBrowseInfo: GPOBROWSEINFO): HRESULT; stdcall;
{$EXTERNALSYM BrowseForGPO}

//=============================================================================
//
// ImportRSoPData
//
// Imports a data file generated by ExportRSoPData
//
// lpNameSpace   - Namespace to place the data in
// lpFileName    - Filename containing the data
//
// Returns:  S_OK if successful
//
// Notes:    The namespace specified in lpNameSpace must exist prior to calling
//           this function.
//
//=============================================================================

function ImportRSoPData(lpNameSpace, lpFileName: LPOLESTR): HRESULT; stdcall;
{$EXTERNALSYM ImportRSoPData}

//=============================================================================
//
// ExportRSoPData
//
// Exports a WBEM namespace containing RSoP information to a data file.
// This data file can be imported to a WBEM namespace using ImportRSoPData.
//
// lpNameSpace   - Namespace to read the data from
// lpFileName    - Filename to receive the data
//
// Returns:  S_OK if successful
//
// Notes:    This function should be called twice.  Once for the user data
//           and once for the computer data.
//
//=============================================================================

function ExportRSoPData(lpNameSpace, lpFileName: LPOLESTR): HRESULT; stdcall;
{$EXTERNALSYM ExportRSoPData}

implementation

const
  gpeditlib = 'gpedit.dll';


{$IFDEF DYNAMIC_LINK}
var
  _CreateGPOLink: Pointer;

function CreateGPOLink;
begin
  GetProcedureAddress(_CreateGPOLink, gpeditlib, 'CreateGPOLink');
  asm
    mov esp, ebp
    pop ebp
    jmp [_CreateGPOLink]
  end;
end;
{$ELSE}
function CreateGPOLink; external gpeditlib name 'CreateGPOLink';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _DeleteGPOLink: Pointer;

function DeleteGPOLink;
begin
  GetProcedureAddress(_DeleteGPOLink, gpeditlib, 'DeleteGPOLink');
  asm
    mov esp, ebp
    pop ebp
    jmp [_DeleteGPOLink]
  end;
end;
{$ELSE}
function DeleteGPOLink; external gpeditlib name 'DeleteGPOLink';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _DeleteAllGPOLinks: Pointer;

function DeleteAllGPOLinks;
begin
  GetProcedureAddress(_DeleteAllGPOLinks, gpeditlib, 'DeleteAllGPOLinks');
  asm
    mov esp, ebp
    pop ebp
    jmp [_DeleteAllGPOLinks]
  end;
end;
{$ELSE}
function DeleteAllGPOLinks; external gpeditlib name 'DeleteAllGPOLinks';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _BrowseForGPO: Pointer;

function BrowseForGPO;
begin
  GetProcedureAddress(_BrowseForGPO, gpeditlib, 'BrowseForGPO');
  asm
    mov esp, ebp
    pop ebp
    jmp [_BrowseForGPO]
  end;
end;
{$ELSE}
function BrowseForGPO; external gpeditlib name 'BrowseForGPO';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _ImportRSoPData: Pointer;

function ImportRSoPData;
begin
  GetProcedureAddress(_ImportRSoPData, gpeditlib, 'ImportRSoPData');
  asm
    mov esp, ebp
    pop ebp
    jmp [_ImportRSoPData]
  end;
end;
{$ELSE}
function ImportRSoPData; external gpeditlib name 'ImportRSoPData';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _ExportRSoPData: Pointer;

function ExportRSoPData;
begin
  GetProcedureAddress(_ExportRSoPData, gpeditlib, 'ExportRSoPData');
  asm
    mov esp, ebp
    pop ebp
    jmp [_ExportRSoPData]
  end;
end;
{$ELSE}
function ExportRSoPData; external gpeditlib name 'ExportRSoPData';
{$ENDIF DYNAMIC_LINK}

end.

⌨️ 快捷键说明

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