home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 April
/
Chip_2002-04_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d56
/
NT.ZIP
/
NTSetUserInfo.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1999-08-04
|
2KB
|
66 lines
unit NTSetUserInfo;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TNTSetUserInfo = class(TComponent)
private
{ Private declarations }
FUserName:String;
FServer:String;
FFullName:String;
FComment:String;
FFlags:DWORD;
FUserID:DWORD;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property Server:string read FServer write FServer;
property UserName:String read FUserName write FUserName;
property FullName:String read FFullName write FFullName;
property Comment:String read FComment write FComment;
property Flags:DWORD read FFlags write FFlags;
property UserID:DWORD read FUserID write FUserID;
function Execute:LongInt;
end;
Type USER_INFO_20=record
usri20_name:LPWSTR; usri20_full_name:LPWSTR; usri20_comment:LPWSTR; usri20_flags:DWORD; usri20_user_id:DWORD;End;
function NetUserSetInfo(Server:PWideChar;UserName:PWideChar;Level:DWORD;Buffer:PChar;ParmError:PChar):LongInt; stdcall; external 'netapi32.dll';
procedure Register;
implementation
function TNTSetUserInfo.Execute:LongInt;
var TheUser:Array[0..255] Of WideChar;
TheServer:Array[0..255] Of WideChar;
TheFullName:Array[0..255] Of WideChar;
TheComment:Array[0..255] Of WideChar;
MyInfo:USER_INFO_20;
begin
StringToWideChar(FUserName,@TheUser,255);
StringToWideChar(FServer,@TheServer,255);
StringToWideChar(FFullName,@TheFullName,255);
StringToWideChar(FComment,@TheComment,255);
MyInfo.usri20_name:=@TheUser;
MyInfo.usri20_full_name:=@TheFullName;
MyInfo.usri20_comment:=@TheComment;
MyInfo.usri20_flags:=FFlags;
MyInfo.usri20_user_id:=FUserID;
Result:=NetUserSetInfo(@TheServer,@TheUser,20,@MyInfo,nil);
end;
procedure Register;
begin
RegisterComponents('NT Tools - User Management', [TNTSetUserInfo]);
end;
end.