home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 April
/
Chip_2002-04_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d56
/
NT.ZIP
/
NTWksSetInfo.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1999-06-19
|
2KB
|
73 lines
unit NTWksSetInfo;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TNTWksSetInfo = class(TComponent)
private
{ Private declarations }
FServer:String;
FPlatform:DWORD;
FComputerName:String;
FLanGroup:String;
FMajor:DWORD;
FMinor:DWORD;
FLanRoot:String;
FUsers:DWORD;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property Server:String read FServer write FServer;
property PlatformID:DWORD read FPlatform write FPlatform default 0;
property ComputerName:String read FComputerName write FComputerName;
property LanGroup:String read FLanGroup write FLanGroup;
property VersionMajor:DWORD read FMajor write FMajor default 0;
property VersionMinor:DWORD read FMinor write FMinor default 0;
property LanRoot:String read FLanRoot write FLanRoot;
property LoggedOnUsers:DWORD read FUsers write FUsers default 0;
function Execute:LongInt;
end;
Type WKSTA_INFO_102=record
wki102_platform_id:DWORD; wki102_computername:LPWSTR; wki102_langroup:LPWSTR; wki102_ver_major:DWORD; wki102_ver_minor:DWORD; wki102_lanroot:LPWSTR; wki102_logged_on_users:DWORD;End;
function NetWkstaSetInfo(Server:PChar;Level:DWORD;Buf:PChar;Parm_Error:LPDWORD):LongInt; stdcall; external 'netapi32.dll';
procedure Register;
implementation
function TNTWksSetInfo.Execute:LongInt;
var
tServer:Array[0..255] Of WideChar;
tLanRoot:Array[0..255] Of WideChar;
tComputerName:Array[0..255] Of WideChar;
tLanGroup:Array[0..255] Of WideChar;
MyInfo:WKSTA_INFO_102;
begin
StringToWideChar(FServer,@tServer,255);
StringToWideChar(FLanRoot,@tLanRoot,255);
StringToWideChar(FComputerName,@tComputerName,255);
StringToWideChar(FLanGroup,@tLanGroup,255);
MyInfo.wki102_lanroot:=@tLanRoot;
MyInfo.wki102_computername:=@tComputerName;
MyInfo.wki102_langroup:=@tLanGroup;
MyInfo.wki102_platform_id:=FPlatform;
MyInfo.wki102_ver_major:=FMajor;
MyInfo.wki102_ver_minor:=FMinor;
MyInfo.wki102_logged_on_users:=FUsers;
Result:=NetWkstaSetInfo(@tServer,102,@MyInfo,nil);
end;
procedure Register;
begin
RegisterComponents('NT Tools - Workstation', [TNTWksSetInfo]);
end;
end.