Re: Faulty Terminal Services API in XP SP2?
From: Max Burmistrov (bugs-=do-not-spaam-pls=-bunny_at_e-mail.ru)
Date: 12/15/04
- Next message: Phil Taylor: "Re: Too many Windows open/created"
- Previous message: David Lowndes: "Re: Change background colour of static text control"
- In reply to: Max Burmistrov: "Faulty Terminal Services API in XP SP2?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 16 Dec 2004 00:02:04 +0300
That's how it looks in CPP (the problem still the same):
#include "windows.h"
#include "stdio.h"
#include <iostream>
#include "Wtsapi32.h"
using namespace std;
int __stdcall TimerProc(DWORD a, DWORD b, DWORD c, DWORD d)
{
DWORD SessionsCount;
PWTS_SESSION_INFO Sessions, CSession;
int i;
WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &Sessions,
&SessionsCount);
if (Sessions != NULL)
{
CSession = Sessions;
for (i = 0; i < SessionsCount; i++)
{
PCHAR Info;
DWORD BytesRet;
WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE,
CSession->SessionId, WTSUserName, &Info, &BytesRet);
cout << '<' << BytesRet << ">\n";
cout << "Session " << CSession->SessionId << '(' << i << ") ["
<< Info << "] ";
if (CSession->State == WTSActive) cout << "Active"; else
if (CSession->State == WTSListen) cout << "Listen"; else
if (CSession->State == WTSDisconnected) cout << "Disconnected";
else
if (CSession->State == WTSConnected) cout << "Connected"; else
cout << CSession->State;
cout << "\n";
WTSFreeMemory(Info); //Here the bug occurs
CSession++;
}
} else
{
i = GetLastError();
cout << "Terminal services are not installed or faulty (" << i << ')';
}
return 0;
}
int main(int argc, char *argv[])
{
SetTimer(0, 0, 500, (TIMERPROC)&TimerProc);
MSG Msg;
while (GetMessage(&Msg, 0, 0, 0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
- Next message: Phil Taylor: "Re: Too many Windows open/created"
- Previous message: David Lowndes: "Re: Change background colour of static text control"
- In reply to: Max Burmistrov: "Faulty Terminal Services API in XP SP2?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|