Coder Social home page Coder Social logo

cassia's People

Contributors

danports avatar

Watchers

 avatar

cassia's Issues

Not a valid Win32 FileTime

I'm getting this error when I try to enumerate sessions on 2003 server. 
The remote server is not under any heavy load.

Exception calling "GetSessions" with "0" argument(s): "Not a valid Win32 
FileTime. Parameter name: fileTime"


It happens many times and I need to close the connection and connect 
again, which doesn't always resolves the problem.

Original issue reported on code.google.com by [email protected] on 31 Jan 2010 at 7:12

Idletime/lastlogontime

Hi there,

I am using CASSIA 2.0.0.60 on windows server 2003 in vb.net

As per issue 20 (sorry if I am repeating) I am looking to logoff users 
after 30 minutes of idle time however I have noticed (not always, just 
sometimes) my idletime / lastlogintimes are +7 minutes out?

Is there a manual fix I need to apply?

P.s GREAT job on this project - could not have completed my first project 
without this!

Original issue reported on code.google.com by [email protected] on 15 Oct 2009 at 4:32

  • Merged into: #20

Win32 Exception When Enumerating Sessions in a Down State

What steps will reproduce the problem?

1.  Terminal server has a session in the Down state, typically due to a 
hung user process or a hung thread in csrss.exe

2.Call the GetSessions method of an ITerminalServer object


What is the expected output? What do you see instead?

Sessions should be enumerated;  a Win32 Exception occurs with the message 
'A close operation is pending on the session'


What version of the product are you using? On what operating system?

Version 2.0.0.60 on Windows Server 2003 SP2 (both 32 and 64bit)


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 27 May 2010 at 10:12

  • Merged into: #24

The connection address of the RDP server.

Hi There.

I have a need to be able to see on which address the client connected to the 
RDP server. Eg. If the client was using the IP-address or using dns. Is it 
possible using Cassia, to get this information, to get the serveraddress which 
the client used to establish the connection?

Been browsing a bit on my own, but couldn’t really find a structure
In which this information should be found.

Hope I make myself clear in this matter.

Help would be very much appreciated.

Original issue reported on code.google.com by [email protected] on 11 Apr 2011 at 8:15

Enhancement: session.NetworkIPAddress

What steps will reproduce the problem?
Is not a problem, the library is great (saved a lot of time for me), it's 
an enhancement request:
Get the public IP of the network the user is connected from.

What is the expected output?
Something like this:
session.ClientIPAddress: 192.168.0.47 (already implemented)
session.NetworkIPAddress: 85.204.102.165 (enhancement request)

What version of the product are you using? On what operating system?
Version 2.0.0.60 on Windows Server 2008

Please provide any additional information below.
No additional information, just want to say congratulations for your work !

Original issue reported on code.google.com by [email protected] on 17 Nov 2009 at 11:42

  • Merged into: #15

Set up public continuous integration server

Perhaps CodeBetter would be willing to host the project CI.
http://codebetter.com/blogs/james.kovacs/archive/2009/02/24/announcing-
teamcity-codebetter-com.aspx

Original issue reported on code.google.com by danports on 15 Oct 2009 at 5:28

Access Denied on GetSessions() VB.Net

What steps will reproduce the problem?
1.GetSessions()

What is the expected output? What do you see instead?
The usernames that are connected to the terminal server( the sessions). Instead 
i get access denied. I have enabled RPC connections on both server and client 
PC. still get access denied issue. 

What version of the product are you using? On what operating system?
The Latest version. Running software on Windows 7, Terminal Server is 2008 R2 
Enterprise

Please provide any additional information below.
Here is my code. 
Imports Cassia
Imports System
Imports System.Security.Principal
Imports System.Web
Imports System.Net.Security
Imports System.Runtime
Imports System.Runtime.InteropServices
Imports System.ComponentModel

Public Class Main

    Dim LOGON32_LOGON_INTERACTIVE As Integer = 2
    Dim LOGON32_PROVIDER_DEFAULT As Integer = 0

    Dim impersonationContext As WindowsImpersonationContext

    Declare Function LogonUserA Lib "advapi32.dll" (ByVal lpszUsername As String, _
                            ByVal lpszDomain As String, _
                            ByVal lpszPassword As String, _
                            ByVal dwLogonType As Integer, _
                            ByVal dwLogonProvider As Integer, _
                            ByRef phToken As IntPtr) As Integer

    Declare Auto Function DuplicateToken Lib "advapi32.dll" ( _
                            ByVal ExistingTokenHandle As IntPtr, _
                            ByVal ImpersonationLevel As Integer, _
                            ByRef DuplicateTokenHandle As IntPtr) As Integer

    Declare Auto Function RevertToSelf Lib "advapi32.dll" () As Long
    Declare Auto Function CloseHandle Lib "kernel32.dll" (ByVal handle As IntPtr) As Long

    Public Function RunAsAdmin() As String
        impersonateValidUser(tbusername.Text, tbdomain.Text, tbpassword.Text)
    End Function

    Public Function RunAsUser()
        undoImpersonation()
    End Function

    Private Function impersonateValidUser(ByVal userName As String, _
    ByVal domain As String, ByVal password As String) As Boolean
        Dim tempWindowsIdentity As WindowsIdentity
        Dim token As IntPtr = IntPtr.Zero
        Dim tokenDuplicate As IntPtr = IntPtr.Zero
        impersonateValidUser = False

        If RevertToSelf() Then
            If LogonUserA(userName, domain, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, token) <> 0 Then
                If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then
                    tempWindowsIdentity = New WindowsIdentity(tokenDuplicate)
                    impersonationContext = tempWindowsIdentity.Impersonate()
                    If Not impersonationContext Is Nothing Then
                        impersonateValidUser = True
                    End If
                End If
            End If
        End If
        If Not tokenDuplicate.Equals(IntPtr.Zero) Then
            CloseHandle(tokenDuplicate)
        End If
        If Not token.Equals(IntPtr.Zero) Then
            CloseHandle(token)
        End If
    End Function

    Private Sub undoImpersonation()
        impersonationContext.Undo()
    End Sub
    Private Sub Main_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        tbdomain.Text = My.Settings.Domain
        tbserver.Text = My.Settings.Server
        tbusername.Text = My.Settings.Username
        tbpassword.Text = My.Settings.Password
        tbFirstRun.Text = My.Settings.FirstRun
        If tbFirstRun.Text = "1" Then
            FirstRunSetup.Show()
        End If
    End Sub
    Private Sub Main_FormClosing(sender As System.Object, e As System.EventArgs) Handles MyBase.FormClosing
        My.Settings.Domain = tbdomain.Text
        My.Settings.Server = tbserver.Text
        My.Settings.Username = tbusername.Text
        My.Settings.Password = tbpassword.Text
        My.Settings.FirstRun = tbFirstRun.Text
        undoImpersonation()
    End Sub
    Private Sub btnreset_Click(sender As System.Object, e As System.EventArgs) Handles btnreset.Click
        Dim ser As String = tbserver.Text
        RunAsAdmin()
        Dim manager As ITerminalServicesManager = New TerminalServicesManager()
        Using server As ITerminalServer = manager.GetRemoteServer(ser)
            server.Open()


            For Each session As ITerminalServicesSession In server.GetSessions()
                Dim SelectedItems As ListView.SelectedListViewItemCollection = _
CType(sender, ListView).SelectedItems
                If (SelectedItems.Count > 0) Then
                    If session.UserName = SelectedItems(0).SubItems(0).Text Then
                        manager.CurrentSession.Disconnect()
                    End If
                End If
            Next
        End Using
    End Sub

    Private Sub btnconnect_Click(sender As System.Object, e As System.EventArgs) Handles btnconnect.Click
        Dim mgr As Cassia.ITerminalServicesManager = New Cassia.TerminalServicesManager()
        Dim serverAddr As String = tbserver.Text
        Dim serverDomain As String = tbdomain.Text
        Dim serverUsername As String = tbusername.Text
        Dim serverPassword As String = tbpassword.Text
        Using serverInstance = mgr.GetRemoteServer(serverAddr)
            serverInstance.Open()
            MsgBox(serverInstance.ServerName.ToString)
            For Each sessions As ITerminalServicesSession In serverInstance.GetSessions()
                If (sessions.ConnectionState = ConnectionState.Disconnected) OrElse (sessions.ConnectionState = ConnectionState.Active) AndAlso (sessions.IdleTime > TimeSpan.FromMinutes(1)) Then
                    Dim SubItems(4) As String
                    SubItems(0) = sessions.UserName
                    SubItems(1) = sessions.ClientName
                    SubItems(2) = sessions.CurrentTime
                    SubItems(3) = sessions.ConnectionState
                    lvusers.Items.Add(New ListViewItem(SubItems))

                    serverInstance.Close()
                End If
            Next
        End Using
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        FirstRunSetup.Show()
    End Sub
End Class

Any help would be much appreciated. 
Cheers
Chris

Original issue reported on code.google.com by [email protected] on 5 Nov 2011 at 2:47

Memory leak

Hi,

I think there is a memory leak, but I couldn't figure out where is it.

if I call the following function several times, with some delay of 20 sec, then 
I can see that my program memory is going up and up:

public static IList<ITerminalServicesSession> GetMachinesSessions(string 
machineName)
        {
            ITerminalServicesManager manager = new TerminalServicesManager();
            using (ITerminalServer server = manager.GetRemoteServer(machineName))
            {
                server.Open();
                return server.GetSessions();
            }
        }

So do you think that maybe there is some memory leak?

Thanks,
Tomer

Original issue reported on code.google.com by [email protected] on 9 Mar 2011 at 9:51

Set up a IPv6 network for testing

Need to add IPv6 support in a couple of places in TerminalServicesSession.

Original issue reported on code.google.com by danports on 11 May 2009 at 1:37

  • Merged into: #39

Add support for resetting a session

Not sure if this does anything different than logging off a session.

Original issue reported on code.google.com by danports on 17 Nov 2009 at 2:56

WTSSendMessage does not support a length of 0 for the title of the text box.

What steps will reproduce the problem?
1.Connect to a server
2.use ITerminalServicesSession.MessageBox(string text)
or
2. use ITerminalServicesSession.MessageBox(string text, string caption) and
have caption = to "" or null;

What is the expected output? What do you see instead?
Received a error code of -2147467259 ("The stub received bad data") from
line 132 in NativeMethodsHelper.cs

What version of the product are you using? On what operating system?
Cassia 2.0.50727.1433 Server is Server 2003 x64

Can replicate issue by using the send message feature in task manager on
the server, this issue appears to be a windows issue not a cassia issue.

Attached is a edited version of the source to correct issue. uses " "
instead of "" for a null title, also checks for empty titles.

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 5 May 2010 at 7:54

Attachments:

Giving Access Denied Error

What steps will reproduce the problem?
1.Running The program
2.Server.open() // Throws Error 
3.

What is the expected output? What do you see instead?
It Should Connect To Remote Pc cause i am having admin privilage on remote 
pc and my pc both but when it goes to server.open() it throws this error

What version of the product are you using? On what operating system?
Windows XP and 2.0.0.6.0

Please provide any additional information below.

I dont have terminal service manager so is this the reason of error! well 
i can connect to remote pc through mstsc without any issue

Any Help Would be appreciated
Thanks in Advance and For Nice Work you have done!

Original issue reported on code.google.com by [email protected] on 11 Aug 2009 at 3:56

Idle time not accurate when Windows 7 client system time not synchronized with Windows Server 2008 R2 server system time

I'm using the TimeSpan IdleTime.TotalMinutes to get remote servers sessions 
idle times.

1. on any version of server 2008 x64 the reported idle time is adding 4.31 
seconds to the actual idle time.
for example: if the actual idle time is 0, the reported idle time using 
IdleTime.TotalMinutes is 4.31.

2. no problem with server 2003.
3. I didn't test on server 2008 x86 platform.
4. the test was made from Windows 7 x64 using Cassia version 2.0.0.60.
5. no problem when running the solution locally on the remote server.

Original issue reported on code.google.com by [email protected] on 13 Apr 2011 at 2:36

Update documentation for GetServers to indicate dependency on NetBIOS and to suggest alternatives

hi i want to use this code the get all terminal servers.
i want to use this code in asp.net.

foreach (ITerminalServer server in _manager.GetServers(null))
{
  //
}

at the function GetServers i recieved the exeption wrong domain format. i have 
the same problme when i give the domainname theis function.

i use the cassia verasion 2.0.0.60

the as.net app run as a local administrator account

Original issue reported on code.google.com by [email protected] on 16 Jul 2011 at 12:18

Vista 6.0.6000 and TerminalServicesSession constructor

What steps will reproduce the problem?
1. Creation of a TerminalServicesSession class

What is the expected output? What do you see instead?

The QuerySessionInformationForStruct returns Success but it fails retrieving 
the WTSSessionInfo informations, because the value is not supported. (ref: 
http://msdn.microsoft.com/en-us/library/aa383861%28v=vs.85%29.aspx)

What version of the product are you using? On what operating system?

Version 2.0.0.60, Windows Vista 6.0.6000, without Service Pack 1.

Please provide any additional information below.

I think it can be fixed restricting the usage of 
QuerySessionInformationForStruct call with OS Version(6,0,6001) instead of OS 
Version(6,0) (line 54 on TerminalServicesSession.cs).

Original issue reported on code.google.com by [email protected] on 1 Sep 2011 at 11:04

Access is denied

1. Worked fine in development
2. Production server on windows 2008 threw an exception on 
manager.GetRemoteServer(_serverName). There is no way to send crendentials.


   at Cassia.Impl.NativeMethodsHelper.GetSessionInfos
(ITerminalServerHandle server)\r\n   at 
Cassia.Impl.TerminalServer.GetSessions()\r\n   at 
mw.Operations.Plugin.Editorial.FilingDocumentControl.GetActiveSessionInfo()
\r\n   at 
mw.Operations.Plugin.Editorial.FilingDocumentControl.InvokeRemoteConnection
()\r\n   at 
mw.Operations.Plugin.Editorial.FilingDocumentControl.OpenDocument()\r\n   
at mw.Operations.Plugin.Editorial.ReleaseForm.Open(String releaseID, 
String sourceID, String regionId, String officeId, String contentTypeId, 
String customerId, String releaseCode, String company, String 
grdJobStatus, String languageCode, String language, String loginName)
\r\n   at mw.Operations.Plugin.Editorial.EditorialControl.OpenRelease
(String ReleaseID, String SourceID, String regionId, String officeId, 
String contentTypeId, String customerId, String releaseTypeId, String 
Company, String grdJobStatus, String languageCode, String language)\r\n   
at mw.Operations.Plugin.Editorial.EditorialControl.OpenSelectedRelease()
\r\n   at mw.Operations.Plugin.Editorial.EditorialControl.mnuOpen_Click
(Object sender, EventArgs e)\r\n   at Telerik.WinControls.RadItem.OnClick
(EventArgs e)\r\n   at Telerik.WinControls.UI.RadButtonItem.OnClick
(EventArgs e)\r\n   at Telerik.WinControls.UI.RadMenuItem.OnClick
(EventArgs e)\r\n   at Telerik.WinControls.RadItem.DoClick(EventArgs e)
\r\n   at Telerik.WinControls.RadItem.PerformClick()\r\n   at 
Telerik.WinControls.UI.RadDropDownMenu.OnMouseClick(MouseEventArgs e)
\r\n   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons 
button, Int32 clicks)\r\n   at System.Windows.Forms.Control.WndProc
(Message& m)\r\n   at Telerik.WinControls.RadControl.WndProc(Message& m)
\r\n   at Telerik.WinControls.UI.RadPopupControlBase.WndProc(Message& m)
\r\n   at System.Windows.Forms.Control.ControlNativeWindow.WndProc
(Message& m)\r\n   at System.Windows.Forms.NativeWindow.Callback(IntPtr 
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)"

Original issue reported on code.google.com by [email protected] on 17 Mar 2010 at 10:17

IPv6 support

ITerminalServicesSession.ClientIPAddress should be able to return an IPAddress 
when the underlying WinAPI function returns an IPv6 address.

Given that the IN6_ADDR structure via 
http://msdn.microsoft.com/en-us/library/ff554787%28v=VS.85%29.aspx is just a 
16-byte array, you can see that it's a simple modification. I believe this code 
would be sufficient to support this scenario and it works in my limited test 
case. (source: Impl\TerminalServicesSession.cs, function GetClientIPAddress, 
where the TODO comment is for this issue)

if (addressFamily == AddressFamily.InterNetwork)
{
   byte[] address = new byte[4];
   Array.Copy(clientAddress.Address, 2, address, 0, 4);
   return new IPAddress(address);
} else if(addressFamily == AddressFamily.InterNetworkV6) {
   byte[] address = new byte[16];
   Array.Copy(clientAddress.Address, 2, address, 0, 16);
   return new IPAddress(address);
}

Original issue reported on code.google.com by [email protected] on 20 Dec 2010 at 11:47

Support WTSQueryUserToken

Perhaps have a helper method like session.StartProcess(...).

Original issue reported on code.google.com by danports on 20 Dec 2010 at 2:22

Not a valid FileTime exception under load

Run some programs that put the Terminal Server service under load, like a 
loop that constantly prints the number of sessions on the server. You 
eventually get an exception like this (v1 stack trace; v2 is similar):

Not a valid Win32 FileTime.
Parameter name: fileTime
   at System.DateTime.FromFileTimeUtc(Int64 fileTime)
   at System.DateTime.FromFileTime(Int64 fileTime)
   at Cassia.TerminalServicesManager.FileTimeToDateTime(FILETIME ft) in 
c:\Projects\Cassia\Source\Cassia\TerminalServicesManager.cs:line 87
   at Cassia.TerminalServicesManager.GetSessionInfo(IntPtr server, UInt32 
sessionId) in 
c:\Projects\Cassia\Source\Cassia\TerminalServicesManager.cs:line 152
   at Cassia.TerminalServicesManager.GetSessions(String serverName) in 
c:\Projects\Cassia\Source\Cassia\TerminalServicesManager.cs:line 60

The error is reported while fetching session 2 of 3 (either the listening 
session or the console session, probably).

Original issue reported on code.google.com by danports on 4 Aug 2009 at 1:00

Add impersonation information to FAQ/docs, or managed wrapper for LogonUser

What steps will reproduce the problem?
1.  Dim session As ITerminalServicesSession = server.GetRemoteServer
("server-name")

I have a couple of terminal servers but on a different network connected 
via VPN. When I try to query them and open the connection I get "access 
denied" Is there a way to pass user/name password parameters?

What is the expected output? What do you see instead?
"Access-denied"

What version of the product are you using? On what operating system?

Latest version of your Libarary. I am building this in VB.net 2008

Please provide any additional information below.

Your library is really helpful and I'm building a program around it to 
help me do day to day tasks. 

Original issue reported on code.google.com by [email protected] on 29 Jan 2010 at 5:16

Occasional .NET engine execution errors in v1.0

Not sure if this affects v2.0. Seems to happen in the 
ServiceBase.SessionChange event handler. Haven't noticed this issue with 
web apps.

Original issue reported on code.google.com by danports on 4 Jun 2009 at 2:31

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.