home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 April
/
Chip_2002-04_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d56
/
NT.ZIP
/
NTWksUserGetInfo.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1999-06-17
|
2KB
|
59 lines
unit NTWksUserGetInfo;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TNTWksUserGetInfo = 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;
Type WKSTA_USER_INFO_1=record
wkui1_username:LPWSTR; wkui1_logon_domain:LPWSTR; wkui1_logon_server:LPWSTR;
wkui1_oth_domains:LPWSTR;End;
function NetWkstaUserGetInfo(Reserved:PChar;Level:DWORD;BufPtr:Pointer):LongInt; stdcall; external 'netapi32.dll';
procedure Register;
implementation
function TNTWksUserGetInfo.Execute:LongInt;
var MyPtr:Pointer;
MyInfo:WKSTA_USER_INFO_1;
begin
Result:=NetWkstaUserGetInfo(nil,1,@MyPtr);
If MyPtr<>nil Then
Begin
MyInfo:=WKSTA_USER_INFO_1(MyPtr^);
FUserName:=WideCharToString(MyInfo.wkui1_username);
FLogonDomain:=WideCharToString(MyInfo.wkui1_logon_domain);
FLogonServer:=WideCharToString(MyInfo.wkui1_logon_server);
FOther:=WideCharToString(MyInfo.wkui1_oth_domains);
End;
end;
procedure Register;
begin
RegisterComponents('NT Tools - Workstation', [TNTWksUserGetInfo]);
end;
end.