EldoS | Feel safer!

Software components for data protection, secure storage and transfer

problem with reading files

Posted: 05/25/2012 09:23:09
by Daniel Tietze (Basic support level)
Joined: 05/25/2012
Posts: 1


I buildt a virtual structure using the vdisk sample. I added in the Private Sub CbFsOpenFile(ByVal sender As CallbackFileSystem, _ ... following code:

Dim thisVirtualFile As New VirtualFile(myChilds.FolderList(i).Name)
                                    thisVirtualFile.Attributes = FileAttributes.Directory

Dim thisVirtualFile As New VirtualFile(myChilds.DocList(i).Title + "." + myChilds.DocList(i).Extension)
                                        thisVirtualFile.Attributes = FileAttributes.Normal

Navigation through the structure works as expected.

But I don´t get a file opened. I added the binarydata as seen below to the vfile.

If vfile.Attributes = FileAttributes.Normal Then
If FilePath <> "" Then

                            Dim gch As GCHandle = GCHandle.Alloc(vfile)

                            FileHandleContext = GCHandle.ToIntPtr(gch)

                            Dim Buffer() As Byte = My.Computer.FileSystem.ReadAllBytes(FilePath)
                            Dim Position As Long = 0
                            Dim BytesToRead As Integer = Buffer.Length - 1
                            Dim BytesRead As Integer
                            vfile.Write(Buffer, Position, BytesToRead, BytesRead)

                        End If


                    End If

If I doubleclick in explorer , no matter what fileformat (txt, doc, xls), only an emty file is opened.

Private Sub CbFsFsRead( _ ... never raised. Is this the reason, and if, why it don´t raise?


[ Download ]
Posted: 05/25/2012 10:11:07
by Volodymyr Zinin (Team)

Use the CallbackFS samples as a base for your code. Also you can use Process Monitor from sysinternals.com to see what happens in the system after your CallbackFS have callbacks finished. Often it helps to find out what's wrong in your implementation. In order to minimize Process Monitor logs set there a filter to show operations only for your virtual disk (the filter is: "Path"->"Begins with"->"X:", where "X:" is your drive letter).
Posted: 05/25/2012 10:30:27
by Eugene Mayevski (Team)

Also re-check your implementation of OnEnumerateDirectory and OnGetFileInfo callbacks. It's possible that the OS requests file size and other information and you don't provide them right. Eg. OnEnumerateDirectory can be called not with file mask but also with full file name (thus working in the same way as OnGetFileInfo).

Sincerely yours
Eugene Mayevski
Posted: 06/01/2012 15:40:50
by Aether Works (Standard support level)
Joined: 06/01/2012
Posts: 18

I have the same problem.

I will try to reproduce it with the CBFS sample later, but it seems like the same problem as described above:

onEnumerateDirectory is called and my code specifies a non-zero length, but onReadFile is never called. onGetFileInfo is not called for the file.

I have one file which works correctly (and onReadFile is called), and another with almost no difference but for the name that doesn't work (because onReadFile is not called).
Posted: 06/04/2012 04:11:51
by Volodymyr Zinin (Team)

Try to reproduce it with the Mapper sample and report the problem to HelpDesk.



Topic viewed 1165 times

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


Back to top

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

Got it!