Hi!
I want to get information about the state of TS-Sessions, and I've tried
it the following way:
------------------------------------------------------
enum WTS_CONNECTSTAT E_CLASS
{
WTSActive,
WTSConnected,
TSConnectQuery,
WTSShadow,
WTSDisconnected ,
WTSIdle,
WTSListen,
WTSReset,
WTSDown,
WTSInit
};
struct WTS_SESSION_INF O
{
public int SessionId;
public string pWinStationName ;
public WTS_CONNECTSTAT E_CLASS State;
}
[DllImport("wtsa pi32")]
private static extern bool WTSEnumerateSes sions(int hServer, int
reserved, int version, ref WTS_SESSION_INF O[] ppSessionInfo, ref int Count);
....
WTS_SESSION_INF O[] ppSessionInfo = new WTS_SESSION_INF O[20];
/*I must initialize it, because I can't pass it to a function
uninitialized*/
int Count = 0;
WTS_SESSION_INF O wts;
WTSEnumerateSes sions(0, 0, 1, ref ppSessionInfo, ref Count );
....
-----------------------------------------------------------------------
After the WTSEnumerateSes sions function returns, I can find the correct
number in the Count variable, but the ppSessionInfo allways has only one
element and it doesn't contain any information about the other sessions.
Could someone correct this code-part or send me a working example?
Thanks in advance,
Tamas Meszaros
I want to get information about the state of TS-Sessions, and I've tried
it the following way:
------------------------------------------------------
enum WTS_CONNECTSTAT E_CLASS
{
WTSActive,
WTSConnected,
TSConnectQuery,
WTSShadow,
WTSDisconnected ,
WTSIdle,
WTSListen,
WTSReset,
WTSDown,
WTSInit
};
struct WTS_SESSION_INF O
{
public int SessionId;
public string pWinStationName ;
public WTS_CONNECTSTAT E_CLASS State;
}
[DllImport("wtsa pi32")]
private static extern bool WTSEnumerateSes sions(int hServer, int
reserved, int version, ref WTS_SESSION_INF O[] ppSessionInfo, ref int Count);
....
WTS_SESSION_INF O[] ppSessionInfo = new WTS_SESSION_INF O[20];
/*I must initialize it, because I can't pass it to a function
uninitialized*/
int Count = 0;
WTS_SESSION_INF O wts;
WTSEnumerateSes sions(0, 0, 1, ref ppSessionInfo, ref Count );
....
-----------------------------------------------------------------------
After the WTSEnumerateSes sions function returns, I can find the correct
number in the Count variable, but the ppSessionInfo allways has only one
element and it doesn't contain any information about the other sessions.
Could someone correct this code-part or send me a working example?
Thanks in advance,
Tamas Meszaros
Comment