Текущий архив: 2007.12.09;
Скачать: CL | DM;
Вниз
Необходимо определить имя залогиневшегося юзера Найти похожие ветки
← →
kolos_rus © (2007-05-23 13:00) [0]Сервис, работае по акаунтом SYSTEM. Как в нем определить имя активного в данный момент пользователя?
Спасибо.
← →
Игорь Шевченко © (2007-05-23 13:30) [1]активных пользователей, как и пассивных, в произвольный момент времени может быть немеряно. Тебе кто именно нужен ?
← →
kolos_rus © (2007-05-23 14:06) [2]Немерено может быть залогинившихся пользователей, а активный только один, либо не одного. Неплохо было бы узнать о всех, но главное кто в данный момент активен.
← →
SlymRO © (2007-05-23 14:27) [3]kolos_rus © (23.05.07 14:06) [2]
а активный только один
На однопроцессорной системе, на двух проц - 2 и так далее :)
по сабжу: WinStationы перебирай, и ищи там консолевую
← →
kolos_rus © (2007-05-23 14:31) [4]Попробую пояснить.
Основная задача отследить вход пользователя в систему и его выход. На отдельно взятом компьютере.
← →
Игорь Шевченко © (2007-05-23 16:42) [5]
> Немерено может быть залогинившихся пользователей, а активный
> только один, либо не одного
У вас, уважаемый, либо неверные представления о работе системы, либо неверная терминология.
> Основная задача отследить вход пользователя в систему и
> его выход. На отдельно взятом компьютере.
Аудит включи и читай eventlog
← →
SlymRO © (2007-05-23 16:52) [6]дарю: Vista unsupported
library LogonEvent;
//HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
//{$R "dialog.res" "dialog.rc"}
uses
Windows;//CheckPswd;
type
PFNMSGECALLBACK = function (bVerbose: BOOL; lpMessage: LPWSTR): DWORD; stdcall;
_WLX_NOTIFICATION_INFO = packed record
Size: ULONG;
Flags: ULONG;
UserName: PWideChar;
Domain: PWideChar;
WindowStation: PWideChar;
hToken: THandle;
hDesktop: HDESK;
pStatusCallback: PFNMSGECALLBACK;
end;
PWlxNotificationInfo=^TWlxNotificationInfo;
TWlxNotificationInfo=_WLX_NOTIFICATION_INFO;
function wvsprintf(Output: PChar; Format: PChar; arglist:array of integer): Integer; stdcall;
begin
result:=wsprintf(Output,Format);
end;
procedure OutputDebugString(const Event: String;pInfo: PWlxNotificationInfo);
const Path = "suser.log";
var
ST:TSystemTime;
STStr:String;
hFile: THandle;
BytesWrite, Len: DWORD;
Value,SystemPath,FilePath: String;
begin
GetLocalTime(ST);
SetLength(STStr,19);
wvsprintf(PChar(STStr),"%02d:%02d:%04d %02d:%02d:%02d",[ST.wDay,ST.wMonth,ST.wYear,ST.wHour,ST.wMinute,ST.wSecond]);
Len:=GetSystemDirectory(nil,0);
SetLength(SystemPath, Len-1);
if GetSystemDirectory(PChar(SystemPath),Len)>0 then
begin
if SystemPath[Len]="\" then FilePath :=SystemPath+Path else FilePath :=SystemPath+"\"+Path;
hFile:=CreateFile(PChar(FilePath),GENERIC_READ or GENERIC_WRITE,0,nil,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);
if hFile<>INVALID_HANDLE_VALUE then
try
SetFilePointer(hFile,0,nil,FILE_END);
Value:=STStr+"- "+ Event+" ""+pInfo.Domain+"\"+pInfo.UserName+"" on WindowStation "" + pInfo.WindowStation +"""#13#10;
WriteFile(hFile,Value[1],Length(Value),BytesWrite, nil);
finally
CloseHandle(hFile);
end;
end;
SetLength(STStr,0);
SetLength(SystemPath,0);
end;
procedure WLEventLogon(pInfo: PWlxNotificationInfo); stdcall;
begin
try
if SizeOf(_WLX_NOTIFICATION_INFO)<>pInfo.Size then Exit;
OutputDebugString("EventLogon",pInfo);
//CheckUser;
except
end;
end;
procedure WLEventLogoff(pInfo: PWlxNotificationInfo); stdcall;
begin
try
if SizeOf(_WLX_NOTIFICATION_INFO)<>pInfo.Size then Exit;
OutputDebugString("EventLogoff",pInfo);
except
end;
end;
procedure WLEventUnlock(pInfo: PWlxNotificationInfo); stdcall;
begin
try
if SizeOf(_WLX_NOTIFICATION_INFO)<>pInfo.Size then Exit;
OutputDebugString("EventUnlock",pInfo);
//CheckUser;
except
end;
end;
exports
WLEventLogon, WLEventLogoff,WLEventUnlock;
begin
DisableThreadLibraryCalls(HInstance);
end.
← →
Eraser © (2007-05-23 21:27) [7]> [0] kolos_rus © (23.05.07 13:00)
WTSGetActiveConsoleSessionId, WTSQueryUserToken + F1
← →
Eraser © (2007-05-23 21:31) [8]> отследить вход пользователя в систему и его выход
RegisterServiceCtrlHandlerEx, SERVICE_CONTROL_SESSIONCHANGE + F1
Страницы: 1 вся ветка
Текущий архив: 2007.12.09;
Скачать: CL | DM;
Память: 0.47 MB
Время: 0.042 c