luizpapa / cassia

Automatically exported from code.google.com/p/cassia
0 stars 0 forks source link

Not a valid Win32 FileTime #33

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 scripto...@gmail.com on 31 Jan 2010 at 7:12

GoogleCodeExporter commented 8 years ago
I have the exact same issue on a 2003 Terminal Server.  Currently I just keep 
retrying the connection until it works.  This server is normally under a small 
load 
with 5-15 connections on it most of the time.

Original comment by gm...@chadman.net on 8 Mar 2010 at 3:27

GoogleCodeExporter commented 8 years ago
Oops, I thought that this issue had been replied to -- sorry for the late 
response! 
This issue should be fixed for Server 2003 on trunk. The trunk is quite 
stable, so if you'd like, you can grab the latest build from the build server 
(http://teamcity.codebetter.com/project.html?projectId=project51 -- use the 
artifacts 
link) and give it a shot.

Original comment by danports on 8 Mar 2010 at 3:49

GoogleCodeExporter commented 8 years ago
I was using the dll from your link and still had the error.  Am I using the 
code 
incorectly?  Below is the function I am using:

 Public Sub TSLogins()
        ListView1.Items.Clear()
        Dim strTSADMIN As ITerminalServicesManager = New TerminalServicesManager
        Dim strTSServer As ITerminalServer = strTSADMIN.GetRemoteServer("\\server03")
        Dim strTSSession As ITerminalServicesSession
        Dim strTSInfo As String = ""
        Dim strTSTotal As String = ""
        Dim strTSState As String = ""

        strTSServer.Open()

        Dim strCounter As Integer = 0

        Dim item1 As New ListViewItem
        Try
            For Each strTSSession In strTSServer.GetSessions '*****Here is where I 
get the error******************
                strTSState = ""

                If strTSSession.UserName.Trim.ToString <> "" Then
                    strCounter = strCounter + 1
                    item1 = New ListViewItem
                    item1.Text = GetUserInfo(strTSSession.UserName)
                    item1.SubItems.Add(strTSSession.UserName)
                    item1.SubItems.Add(strTSSession.LoginTime.ToString)
                    ListView1.Items.Add(item1)
                    strTSInfo = "User: " & strTSSession.UserName & "    Logon 
Time: " & strTSSession.LoginTime.ToString & "  State: " & 
strTSSession.ConnectionState & "    Session ID: " & strTSSession.SessionId

                    strTSTotal = strTSTotal & strTSInfo & vbCrLf
                End If

            Next
            strTSServer.Close()
            strTSServer.Dispose()
        Catch ex As Exception

            strTSServer.Close()
            strTSServer.Dispose()
            Application.DoEvents()
            'System.Threading.Thread.Sleep(100)
            TSLogins()

        End Try

        Label2.Text = strCounter

    End Sub

Original comment by gm...@chadman.net on 11 Mar 2010 at 7:14

GoogleCodeExporter commented 8 years ago
Is it the "Not a valid FileTime" exception you are getting, or a different one? 
You 
said server03 is running Windows Server 2003? What version of Windows is the 
computer 
executing the code running?

Original comment by danports on 14 Mar 2010 at 4:19

GoogleCodeExporter commented 8 years ago
I tried to reproduce the error today, and of course I was not able to.  The 
error is 
totally random and I have not been able to find what's causing it.  The error I 
was 
getting is "Not a valid Win32 FileTime".  The application is normally run 
directly 
on the  a terminal server (2003).  That is also the same server that I am 
gathering 
information about with the dll.  I am developing the application on an XP SP3 
machine and have gotten this error with both machines.

Original comment by gm...@chadman.net on 15 Mar 2010 at 6:00

GoogleCodeExporter commented 8 years ago
Here is the stack trace if this helps.  I was just able to reproduce the error. 
 I 
did try a few other times this morning and could not reproduce it.

{"Not a valid Win32 FileTime.
Parameter name: fileTime"}

   at System.DateTime.FromFileTimeUtc(Int64 fileTime)
   at System.DateTime.FromFileTime(Int64 fileTime)
   at Cassia.Impl.NativeMethodsHelper.FileTimeToDateTime(FILETIME ft)
   at Cassia.Impl.TerminalServicesSession..ctor(ITerminalServer server, Int32 
sessionId, String windowStationName, ConnectionState connectionState)
   at Cassia.Impl.TerminalServicesSession..ctor(ITerminalServer server, 
WTS_SESSION_INFO sessionInfo)
   at Cassia.Impl.TerminalServer.GetSessions()
   at WindowsApplication1.Form1.TSLogins() in C:\Temp\practicevb\vb2005\Clone 
Metrics\Clone Metrics\Form1.vb:line 220
   at WindowsApplication1.Form1.Form1_Load(Object sender, EventArgs e) in 
C:\Temp\practicevb\vb2005\Clone Metrics\Clone Metrics\Form1.vb:line 21
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, 
IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 
nCmdShow)
   at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Control.set_Visible(Boolean value)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 
reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, 
ApplicationContext context)
   at System.Windows.Forms.Application.Run(ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at 
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicat
ionMo
del()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run
(String[] commandLine)
   at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-
8281-53493378c1071.vb:line 81
   at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence 
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, 
ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Original comment by gm...@chadman.net on 15 Mar 2010 at 9:31

GoogleCodeExporter commented 8 years ago
Thanks for looking into this. Based on that stack trace, it looks like you are 
running 
the 2.0 release (2.0.0.60). Could you check the exact version of the assembly 
you are 
using? The latest trunk build is 2.1.0.93, and it should not have this problem 
-- not 
with that stack trace, anyways.

Original comment by danports on 16 Mar 2010 at 12:50

GoogleCodeExporter commented 8 years ago
Sheesh!  I thought I did that, but I did not see that it extrated the dll in 
/bin.  
Anyway you are correct and I was using the old ver.  I just startet to use the 
new 
version.  Thanks so much for the help.

Original comment by gm...@chadman.net on 16 Mar 2010 at 5:03

GoogleCodeExporter commented 8 years ago
No problem. I am going to close this issue unless scriptolog has anything to 
say about 
it.

Original comment by danports on 16 Mar 2010 at 5:50

GoogleCodeExporter commented 8 years ago
I've downloaded the beta build and didn't encounter the error again, though I 
didn't
test it extensively. You can close the thread. Thanks!

Original comment by scripto...@gmail.com on 17 Mar 2010 at 10:18