Click here to Skip to main content
15,908,115 members

H. Tony - Professional Profile



Summary

    Blog RSS
1,458
Author
20
Authority
9
Debator
5
Editor
119
Organiser
248
Participant
0
Enquirer
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
GeneralIdle time on a terminal service session Pin
H. Tony21-Feb-08 4:51
H. Tony21-Feb-08 4:51 
http://groups.google.com/group/microsoft.public.win32.programmer.kernel/browse_thread/thread/c6dd86e7df6d26e4/91fc4e79a5d6c495?lnk=st&q=%22terminal+services%22+api+session+idle+time&rnum=1&hl=en[^]

1) The function WinStationQueryInformationW() should be accessed
dynamically via the use of LoadLibrary() and GetProcAddress(). Towards that
end, there's a type definition for a pointer-to-a-function.

2) The system console session cannot go into an idle/disconnected state.
As such, the LastInputTime value will always math CurrentTime for the
console session.

3) The LastInputTime value will be zero if the session has gone
disconnected. In that case, use the DisconnectTime value in place of
LastInputTime when calculating the current idle time for a disconnected session.

4) All of these time values are GMT time values.

5) The disconnect time value will be zero if the sesson has never been
disconnected.

#define LOGONID_CURRENT ((ULONG)-1)
#define SERVERNAME_CURRENT ((HANDLE)NULL)

typedef enum _WINSTATIONINFOCLASS {
WinStationInformation = 8

} WINSTATIONINFOCLASS;

typedef struct _WINSTATIONINFORMATIONW {
BYTE Reserved1[72];
ULONG SessionId;
BYTE Reserved2[4];
FILETIME ConnectTime;
FILETIME DisconnectTime;
FILETIME LastInputTime;
FILETIME LoginTime;
BYTE Reserved3[1096];
FILETIME CurrentTime;

} WINSTATIONINFORMATIONW, * PWINSTATIONINFORMATIONW;

typedef BOOLEAN (WINAPI * PWINSTATIONQUERYINFORMATIONW)(
HANDLE, ULONG, WINSTATIONINFOCLASS, PVOID, ULONG, PULONG );

BOOL Result;
HANDLE hServer = NULL;
HANDLE hWinSta = NULL;
ULONG SessId;
ULONG BufLen;
ULONG RetLen;
WINSTATIONINFORMATION Buf;
PWINSTATIONQUERYINFORMATIONW WinStationQueryInformationW = NULL;

hWinSta = LoadLibrary("WINSTA.DLL");

WinStatonQueryInformationW =
GetProcAddress(hWinSta,"WinStationQueryInformatoinW");

BufLen = sizeof(Buf);

// Assume that hServer is a valid server handle previously obtained from
// WTSOpenServer().
//
// Assume that SessId has been set to the desired session id value. The
// term "logon id" is synonymous with "session id".

Result =
WinStationQueryInformationW(hServer,SessId,WinStationInformation,&Buf,BufLen,&RetLen);

if (Result)
{
// Use the SYSTEMTIME structure and the FileTimeToSystemTime() function
// to convert from FILETIME to SYSTEMTIME format. Remember, these time
// values are GMT values; they don't have the local time zone offset
// applied to them.
}

{
// handle the error

}

No man is an island, entire of itself
every man is a piece of the continent, a part of the main
if a clod be washed away by the sea,
Europe is the less, as well as if a promontory were,
as well as if a manor of thy friends or of thine own were
any man's death diminishes me, because I am involved in mankind
and therefore never send to know for whom the bell tolls
it tolls for thee.


-- John Donne

GeneralMy first posts today! [modified] Pin
H. Tony8-Nov-07 8:26
H. Tony8-Nov-07 8:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.