home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 April
/
Chip_2002-04_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d56
/
NT.ZIP
/
NTWksGetInfo.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1999-06-19
|
2KB
|
73 lines
unit NTWksGetInfo;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TNTWksGetInfo = 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;
property ComputerName:String read FComputerName;
property LanGroup:String read FLanGroup;
property VersionMajor:DWORD read FMajor;
property VersionMinor:DWORD read FMinor;
property LanRoot:String read FLanRoot;
property LoggedOnUsers:DWORD read FUsers;
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 NetWkstaGetInfo(Server:PChar;Level:DWORD;BufPtr:Pointer):LongInt; stdcall; external 'netapi32.dll';
procedure Register;
implementation
function TNTWksGetInfo.Execute:LongInt;
var
tServer:Array[0..255] Of WideChar;
MyPtr:Pointer;
MyInfo:WKSTA_INFO_102;
begin
StringToWideChar(FServer,@tServer,255);
Result:=NetWkstaGetInfo(@tServer,102,@MyPtr);
If MyPtr<>nil Then
Begin
MyInfo:=WKSTA_INFO_102(MyPtr^);
FPlatform:=MyInfo.wki102_platform_id;
FComputerName:=WideCharToString(MyInfo.wki102_computername);
FLanGroup:=WideCharToString(MyInfo.wki102_langroup);
FMajor:=MyInfo.wki102_ver_major;
FMinor:=MyInfo.wki102_ver_minor;
FLanRoot:=WideCharToString(MyInfo.wki102_lanroot);
FUsers:=MyInfo.wki102_logged_on_users;
End;
end;
procedure Register;
begin
RegisterComponents('NT Tools - Workstation', [TNTWksGetInfo]);
end;
end.