Can anyone convert some C code to VB .NET for me?
Thanks in advance!!
#define LOGONID_CURRENT ((ULONG)-1)
#define SERVERNAME_CURR ENT ((HANDLE)NULL)
typedef enum _WINSTATIONINFO CLASS {
WinStationInfor mation = 8
} WINSTATIONINFOC LASS;
typedef struct _WINSTATIONINFO RMATIONW {
BYTE Reserved1[72];
ULONG SessionId;
BYTE Reserved2[4];
FILETIME ConnectTime;
FILETIME DisconnectTime;
FILETIME LastInputTime;
FILETIME LoginTime;
BYTE Reserved3[1096];
FILETIME CurrentTime;
} WINSTATIONINFOR MATIONW, * PWINSTATIONINFO RMATIONW;
typedef BOOLEAN (WINAPI * PWINSTATIONQUER YINFORMATIONW)(
HANDLE, ULONG, WINSTATIONINFOC LASS, PVOID, ULONG, PULONG );
BOOL Result;
HANDLE hServer = NULL;
HANDLE hWinSta = NULL;
ULONG SessId;
ULONG BufLen;
ULONG RetLen;
WINSTATIONINFOR MATION Buf;
PWINSTATIONQUER YINFORMATIONW WinStationQuery InformationW = NULL;
hWinSta = LoadLibrary("WI NSTA.DLL");
WinStatonQueryI nformationW =
GetProcAddress( hWinSta,"WinSta tionQueryInform atoinW");
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 =
WinStationQuery InformationW(hS erver,SessId,Wi nStationInforma tion,&Buf,BufLe n,&RetLen);
if (Result)
{
// Use the SYSTEMTIME structure and the FileTimeToSyste mTime()
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_CURR ENT ((HANDLE)NULL)
typedef enum _WINSTATIONINFO CLASS {
WinStationInfor mation = 8
} WINSTATIONINFOC LASS;
typedef struct _WINSTATIONINFO RMATIONW {
BYTE Reserved1[72];
ULONG SessionId;
BYTE Reserved2[4];
FILETIME ConnectTime;
FILETIME DisconnectTime;
FILETIME LastInputTime;
FILETIME LoginTime;
BYTE Reserved3[1096];
FILETIME CurrentTime;
} WINSTATIONINFOR MATIONW, * PWINSTATIONINFO RMATIONW;
typedef BOOLEAN (WINAPI * PWINSTATIONQUER YINFORMATIONW)(
HANDLE, ULONG, WINSTATIONINFOC LASS, PVOID, ULONG, PULONG );
BOOL Result;
HANDLE hServer = NULL;
HANDLE hWinSta = NULL;
ULONG SessId;
ULONG BufLen;
ULONG RetLen;
WINSTATIONINFOR MATION Buf;
PWINSTATIONQUER YINFORMATIONW WinStationQuery InformationW = NULL;
hWinSta = LoadLibrary("WI NSTA.DLL");
WinStatonQueryI nformationW =
GetProcAddress( hWinSta,"WinSta tionQueryInform atoinW");
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 =
WinStationQuery InformationW(hS erver,SessId,Wi nStationInforma tion,&Buf,BufLe n,&RetLen);
if (Result)
{
// Use the SYSTEMTIME structure and the FileTimeToSyste mTime()
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
}
Comment