home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 April / Chip_2002-04_cd1.bin / zkuste / delphi / kolekce / d56 / NT.ZIP / NTLocalSetInfo.pas < prev    next >
Pascal/Delphi Source File  |  2002-01-14  |  2KB  |  62 lines

  1. unit NTLocalSetInfo;
  2.  
  3. interface
  4.  
  5. uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
  6.  
  7. type
  8.   TNTLocalSetInfo = class(TComponent)
  9.   private
  10.     { Private declarations }
  11.     FServer:String;
  12.     FGroup:String;
  13.     FName:String;
  14.     FComment:String;
  15.   protected
  16.     { Protected declarations }
  17.   public
  18.     { Public declarations }
  19.   published
  20.     { Published declarations }
  21.     property Server:String read FServer write FServer;
  22.     property Group:String read FGroup write FGroup;
  23.     property Name:String read FName write FName;
  24.     property Comment:String read FComment write FComment;
  25.     function Execute:LongInt;
  26.   end;
  27.  
  28. Type LOCALGROUP_INFO_1=record
  29.     lgrpi1_name:LPWSTR;    lgrpi1_comment:LPWSTR;End;
  30.  
  31. function NetLocalGroupSetInfo(Server:PWideChar;GroupName:PWideChar;Level:DWORD;Buffer:PChar;ParmError:LPDWORD):LongInt; stdcall; external 'netapi32.dll';
  32.  
  33. procedure Register;
  34.  
  35. implementation
  36.  
  37. function TNTLocalSetInfo.Execute:LongInt;
  38. var
  39.    tServer:Array[0..255] Of WideChar;
  40.    tGroup:Array[0..255] Of WideChar;
  41.    tName:Array[0..255] Of WideChar;
  42.    tComment:Array[0..255] Of WideChar;
  43.    MyInfo:LOCALGROUP_INFO_1;
  44.    Where:LPDWORD;
  45. begin
  46.      Where:=nil;
  47.      StringToWideChar(FServer,@tServer,255);
  48.      StringToWideChar(FGroup,@tGroup,255);
  49.      StringToWideChar(FName,@tName,255);
  50.      StringToWideChar(FComment,@tComment,255);
  51.      MyInfo.lgrpi1_name:=@tName;
  52.      MyInfo.lgrpi1_comment:=@tComment;
  53.      Result:=NetLocalGroupSetInfo(@tServer,@tGroup,1,@MyInfo,Where);
  54. end;
  55.  
  56. procedure Register;
  57. begin
  58.   RegisterComponents('NT Tools - Local', [TNTLocalSetInfo]);
  59. end;
  60.  
  61. end.
  62.