home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 April
/
Chip_2002-04_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d56
/
NT.ZIP
/
NTWksUserSetInfo.pas
< prev
Wrap
Pascal/Delphi Source File
|
1999-06-17
|
2KB
|
63 lines
unit NTWksUserSetInfo;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TNTWksUserSetInfo = class(TComponent)
private
{ Private declarations }
FUserName:String;
FLogonDomain:String;
FLogonServer:String;
FOther:String;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property UserName:String read FUserName;
property LogonDomain:String read FLogonDomain;
property LogonServer:String read FLogonServer;
property OtherDomains:String read FOther;
function Execute:LongInt;
end;
function NetWkstaUserSetInfo(Reserved:PChar;Level:DWORD;BufPtr:Pointer;Parm_Error:LPDWORD):LongInt; stdcall; external 'netapi32.dll';
Type WKSTA_USER_INFO_1=record
wkui1_username:LPWSTR; wkui1_logon_domain:LPWSTR; wkui1_logon_server:LPWSTR;
wkui1_oth_domains:LPWSTR;End;
procedure Register;
implementation
function TNTWksUserSetInfo.Execute:LongInt;
var MyPtr:Pointer;
MyInfo:WKSTA_USER_INFO_1;
tUserName:Array[0..255] Of WideChar;
tLogonDomain:Array[0..255] Of WideChar;
tLogonServer:Array[0..255] Of WideChar;
tOther:Array[0..255] Of WideChar;
begin
StringToWideChar(FUserName,@tUserName,255);
StringToWideChar(FLogonDomain,@tLogonDomain,255);
StringToWideChar(FLogonServer,@tLogonServer,255);
StringToWideChar(FOther,@tOther,255);
MyInfo.wkui1_username:=@tUserName;
MyInfo.wkui1_logon_domain:=@tLogonDomain;
MyInfo.wkui1_logon_server:=@tLogonServer;
MyInfo.wkui1_oth_domains:=@tOther;
Result:=NetWkstaUserSetInfo(nil,1,@MyPtr,nil)
end;
procedure Register;
begin
RegisterComponents('NT Tools - Workstation', [TNTWksUserSetInfo]);
end;
end.