Показать сообщение отдельно
  #2  
Старый 20.11.2006, 08:09
Аватар для Decoding
Decoding Decoding вне форума
Местный
 
Регистрация: 03.06.2006
Адрес: Почту найдете на моем сайте
Сообщения: 576
Версия Delphi: D10.2
Репутация: 214
По умолчанию

Примерно так:
Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

type
  funcNT = function (param1 : DWORD; param2 : Byte; param3 : DWORD; param4, param5 : PSID; param6, param7 : PACL): DWORD; stdcall;
  func9x = function (param1, param2: Integer): Integer; stdcall;

var
  Form1: TForm1;

  Ver : TOSVERSIONINFO;
  myACL1 : ACL;
  _funcNT : funcNT;
  _func9x : func9x;
  hLib : DWORD;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
   Ver.dwOSVersionInfoSize:=SizeOf(Ver);
   GetVersionEx(Ver);
   if Ver.dwPlatformId = VER_PLATFORM_WIN32_NT then
   begin
      if not InitializeAcl(myACL1, sizeof(ACL), 2) then exit;
      if not IsValidAcl(myACL1) then exit;
      hLib := LoadLibrary('advapi32.dll');
      if hLib>0 then
      begin
         @_funcNT:=GetProcAddress(hLib, 'SetSecurityInfo');
         _funcNT(GetCurrentProcess, 6, 4, nil, nil, addr(myACL1), nil);
         FreeLibrary(hLib);
      end;
   end
   else
   begin
      hLib := LoadLibrary('kernel32.dll');
      if hLib>0 then
      begin
         @_func9x:=GetProcAddress(hLib, 'RegisterServiceProcess');
         _func9x(0,1);
         FreeLibrary(hLib);
      end;
   end;
end;

end.
Ответить с цитированием