N
Nikolay Petrov
Can anyone convert some C code to VB .NET for me?
Thanks in advance!!
#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
}
Thanks in advance!!
#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
}