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

  1. unit NTServerSetInfo;
  2.  
  3. interface
  4.  
  5. uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
  6.  
  7. type
  8.   TNTServerSetInfo = class(TComponent)
  9.   private
  10.     { Private declarations }
  11.     FServer:String;
  12.     FPlatformID:DWORD;
  13.     FName:String;
  14.     FMajor:DWORD;
  15.     FMinor:DWORD;
  16.     FType:DWORD;
  17.     FComment:String;
  18.   protected
  19.     { Protected declarations }
  20.   public
  21.     { Public declarations }
  22.   published
  23.     { Published declarations }
  24.     property Server:String read FServer write FServer;
  25.     property PlatformID:DWORD read FPlatformID write FPlatformID default 0;
  26.     property Name:String read FName write FName;
  27.     property MajorVersion:DWORD read FMajor write FMajor default 0;
  28.     property MinorVersion:DWORD read FMinor write FMinor default 0;
  29.     property ServerType:DWORD read FType write FType default 0;
  30.     property Comment:String read FComment write FComment;
  31.     function Execute:LongInt;
  32.   end;
  33.  
  34. Type SERVER_INFO_101=record
  35.     sv101_platform_id:DWORD;    sv101_name:LPWSTR;    sv101_version_major:DWORD;    sv101_version_minor:DWORD;    sv101_type:DWORD;    sv101_comment:LPWSTR;End;
  36.  
  37. function NetServerSetInfo(Server:PChar;Level:DWORD;Buf:PChar;Parm_Error:LPDWORD):LongInt; stdcall; external 'netapi32.dll';
  38.  
  39. procedure Register;
  40.  
  41. implementation
  42.  
  43. function TNTServerSetInfo.Execute:LongInt;
  44. var MyInfo:SERVER_INFO_101;
  45.     tServer:Array[0..255] Of WideChar;
  46.     tName:Array[0..255] Of WideChar;
  47.     tComment:Array[0..255] Of WideChar;
  48. begin
  49.      StringToWideChar(FServer,@tServer,255);
  50.      StringToWideChar(FName,@tName,255);
  51.      StringToWideChar(FComment,@tComment,255);
  52.      MyInfo.sv101_platform_id:=FPlatFormID;
  53.      MyInfo.sv101_name:=@tName;
  54.      MyInfo.sv101_version_major:=FMajor;
  55.      MyInfo.sv101_version_minor:=FMinor;
  56.      MyInfo.sv101_type:=FType;
  57.      MyInfo.sv101_comment:=@tComment;
  58.      Result:=NetServerSetInfo(@tServer,101,@MyInfo,nil);
  59. end;
  60.  
  61. procedure Register;
  62. begin
  63.   RegisterComponents('NT Tools - Server', [TNTServerSetInfo]);
  64. end;
  65.  
  66. end.
  67.