EldoS | Feel safer!

Software components for data protection, secure storage and transfer

The handle value was invalid.

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#4189
Posted: 10/31/2007 11:52:14
by Bob Burnett (Standard support level)
Joined: 10/31/2007
Posts: 3

Hi, I'm using the sample project 'SimpleSftpDemo', and I can connect to the server and upload files, but when I try to download any file I got the following error: "The handle value was invalid". I haven't change anything on the code but I can't find more info about this error and what handle the code is looking for. In fact, the DestFilename is created but with a length of 0 (zero) bytes but after that the error is raised, I'm using Visual Basic 6. The code for download the file is:

Private Sub Download()
Dim info As IElSftpFileInfoX
Dim i As Integer
Dim SizeL As Long, SizeH As Long

If SftpClient.Active Then
If (lvFiles.SelectedItem <> Empty) Then
If lvFiles.SelectedItem.Index <= dirList.Count Then
Exit Sub
Else
Set info = fileList.item(lvFiles.SelectedItem.Index - dirList.Count)
End If
CommonDialog.DialogTitle = "Download"
CommonDialog.FileName = info.Name
On Error Resume Next
CommonDialog.ShowSave
i = Err
Err.Clear
On Error GoTo 0
If i = 32755 Then
Exit Sub
End If

On Error GoTo HandleErr
Call Log("Downloading file " & info.Name, False)
dlgProgress.Canceled = False
dlgProgress.Caption = "Download"
dlgProgress.pbProgress.Value = 0
dlgProgress.lSourceFilename.Caption = currentDir & "/" & info.Name
dlgProgress.lDestFilename.Caption = CommonDialog.FileName
Call info.Attributes.GetSize(SizeL, SizeH)
dlgProgress.lProgress.Caption = "0 / " & CStr(SizeL)
dlgProgress.Show

TransferOperationActive = True
Call SftpClient.DownloadFile(currentDir & "/" & info.Name, CommonDialog.FileName)
TransferOperationActive = False

dlgProgress.Hide
Call Log("Download finished", False)
End If
End If

Exit Sub
HandleErr:
TransferOperationActive = False
If dlgProgress.Visible Then
Call dlgProgress.Hide
End If
Call Log("Error: " & Err.Description, True)
End Sub



I put in red the line where the error is rised

I hope somebody can help me.
#4190
Posted: 10/31/2007 12:24:15
by Eugene Mayevski (EldoS Corp.)

I remember this to be a bug of some specific server, but I can't recall the details. Can you please tell us the name of the server software? If you don't know it, it can be checked by reading SftpClient.ServerSoftwareName property somewhere between Open and DownloadFile.


Sincerely yours
Eugene Mayevski
#4191
Posted: 10/31/2007 12:49:32
by Bob Burnett (Standard support level)
Joined: 10/31/2007
Posts: 3

Eugene, this is the server software that I got from that property: VShell_2_2_5_596 VShell

Regards,

Bob
#4192
Posted: 10/31/2007 13:05:35
by Eugene Mayevski (EldoS Corp.)

I start to recall something. Please check that your account has rights to access the file and that the path to the file is correct (you are sending the absolute path, the file is there etc.). Some servers report Invalid Handle when there's no access to the file, or when the file is not found. I.e. they return an invalid handle (instead of error) to OpenFile request, and the further attempt to use this invalid handle causes the given error.

Unfortunately my eval.copy of VShell server has expired. If the above instructions won't help, I will have to setup the server under VMWare and attempt to reproduce the issue myself.


Sincerely yours
Eugene Mayevski
#4194
Posted: 10/31/2007 15:22:30
by Bob Burnett (Standard support level)
Joined: 10/31/2007
Posts: 3

I checked the rights and I have complete access to the folder and to the files, even I can download the files with commercial software but not by the code with SSB. After some tests I checked that the handle given for the file is "000000". I must assume that this error is because of the server?
#4195
Posted: 11/01/2007 01:25:04
by Ken Ivanov (EldoS Corp.)

Quote
After some tests I checked that the handle given for the file is "000000".

Actually, SFTP specification does not restrict the format of the file handle, so every non-empty handle value is correct (and the "000000" value too). We will try to reproduce the issue in our conditions and get back to you then.
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

Topic viewed 2964 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!