1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| fhserveur := WTSOpenServer(pchar(strNomServeur));
booOk := WTSEnumerateSessions(fhserveur,0,1,ppsession,nbSession );
if booOk and (nbsession > 0 )then
begin
fbooServeurOK := true;
for indexSession := 0 to nbSession-1 do
begin
Session := PWTS_SESSION_INFO(integer(ppsession)+indexsession * sizeof(wts_session_info))^;
strTemp := lowercase(session.pWinStationName);
if (pos('ica-',strtemp)<> 0)and(pos('#',strtemp)<>0) then inc(fnbICA ,1);
if pos('rdp-tcp#',strtemp)<> 0 then inc(fnbRDP ,1);
if strTemp = 'ica-tcp' then fbooListenICA := session.State = WTSListen;
if strTemp = 'rdp-tcp' then fbooListenRDP := session.State = WTSListen;
ttemp := tfbSession.Create ;
ttemp.fstrSession := strTemp;
ttemp.fintID := session.SessionId;
ttemp.fsrtetat := sessionstatetostr(Session.State);
ttemp.fstrUtilistauer := getStrInfo(fhserveur,WTSUserName,Session.SessionId);
ttemp.fstrClient := getStrInfo(fhserveur,WTSClientName,Session.SessionId);
add(ttemp);
end;
end;
WTSFreeMemory (ppsession ); |
Partager