Bonjour

lorsque que je cherche à lister les session sur un serveur TSE
via le code suivant en 64 bit cela marche bien mais en 32 bit WTSQuerySessionInformation me renvoie rien
et getlasterror me revoie ERROR_INVALID_PARAMETER
Voici la fonction pour avoir le nom du user ou son pc c'est là qu'en 32 çà marche pas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function getStrInfo(fhserveur : cardinal;infoClass : _WTS_INFO_CLASS ; id : cardinal):string;
var
  ptemp : pointer ;
  inttemp : cardinal;
begin
  ptemp := nil;
  result := '';
  if WTSQuerySessionInformation(fhserveur,id ,infoClass,ptemp,inttemp) then
  try
    result := pchar(ptemp);
  finally
    WTSFreeMemory(ptemp);
  end;
end;
Voici un bout de la procedure qui liste les sessions
cette partie fonctionne bien
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 );
cela fait un moment que je galère avec cette partie