EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Visual FoxPro

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
Posted: 10/27/2006 08:56:29
by Keith Trangmar (Standard support level)
Joined: 10/27/2006
Posts: 6

I appreciate that there's only a slim chance of this, but does anyone happen to have any examples (or even just experience) of SecureBlackBox being utilised under Visual FoxPro? I know enough about Visual Basic to have managed to translate the sample "SFTPClient.vbs" and get that working, but I'm specifically now trying to read the contents of a remote folder to determine what files it contains and have struggled mightily.

Unfortunately there doesn't appear to be an example of how to do this, and I'm stalling on the ReadDirectory() method - VFP's implementation of arrays doesn't seem to be compatible with the required parameter type, and no matter what I pass it, I get nothing back in the way of results. I'm pretty sure it's actually working because it takes ten seconds or so before it returns control to my program, which isn't unreasonable given the nature of the request.

I'm obviously expecting to purchase a license if I can get this working, but for the time being I'm using the unregistered trial version. Even an example of how you'd implement this in VB might help - I'm completely stuck at the moment and this is a sudden urgent requirement which has been dropped in my lap, so at a push I might even have to write a VB wrapper that I can use to return the results as XML or something like that...

Many thanks

Keith Trangmar
Posted: 02/02/2007 09:59:09
by Thomas Ganss (Standard support level)
Joined: 02/02/2007
Posts: 6


we are currently evaluating the SFTP-Client and have also run into troubles reading a directory - and yes we are trying from Visual Foxpro as well, Version 9 SP1. The other methods we tried (up/download, remove...) worked without any problems. We get a string handle of "00000000" using the absolute path or ".", but we cannot get the second parameter filled up when calling the ReadDirectory-Method with this handle.

The idea of a parseble string containing the directory information returned from a VB component also came to mind , as COM SafeArrays are problematic if not impossible with VFP<g>. Did you have any success either in VFP directly or in writing a VB wrapper ?

Many Thanks

Posted: 02/02/2007 10:48:25
by Keith Trangmar (Standard support level)
Joined: 10/27/2006
Posts: 6

Sadly not (as you'll probably already have seen from my response to your other query), my VB experience is very limited and I didn't get any responses to this query from Eldos themselves.

My experience of the online support for this module has been pretty disappointing, although I have actually gone ahead & purchased it anyway - at this price it was considerably cheaper than any others I could find, and despite these issues with reading the directory contents, I also found that the rest of the methods (that I've had to use, at least) seem to be working fine.


Posted: 02/02/2007 11:30:12
by Phillip Grant (Basic support level)
Joined: 07/21/2006
Posts: 10

Hey Guys,

Post some example code of what your attempting, and maybe somebody can shed some light...

I'm no VFP guru, but I've been using it since before MS bought it.
Posted: 02/02/2007 12:14:37
by Keith Trangmar (Standard support level)
Joined: 10/27/2006
Posts: 6

Thanks for the offer, but actually as it happens I've now had a response to this on [URL=http://www.eldos.com/forum/read.php?FID=7&TID=314&MID=2165#message2165read.php?FID=7&TID=314&MID=2165message2165]another thread[/URL], and stone me if they aren't offering to implement a new method which is VFP-compatible!


Posted: 02/02/2007 14:33:26
by Eugene Mayevski (EldoS Corp.)

Can you please clarify if VFP users can access so-called secondary interfaces? For example, can you see and use DownloadFiles function?
If you can, than adding some ReadDirectoryAsText method is trivial.

Another question is whether you can use IElStringListX interface from VPF. If yes, ReadDirectoryAsText can return a reference to IElStringListX object instead of a text string (which is slow to parse). If no, we would end up with a large string, but this is not optimal from performance point of view.

Sincerely yours
Eugene Mayevski
Posted: 02/02/2007 16:41:16
by Keith Trangmar (Standard support level)
Joined: 10/27/2006
Posts: 6

Re. the DownloadFiles function, yes that works fine under VFP.

Re. the IElStringListX interface I'm afraid I have no idea - can you suggest an example of another function that uses it which I can test?

Posted: 02/03/2007 11:56:29
by Eugene Mayevski (EldoS Corp.)

Nevermind, I'll implement methods for both IElStringListX and for a string with \x13\x10 (CRLF) as separators.

Sincerely yours
Eugene Mayevski
Posted: 02/04/2007 08:21:13
by Thomas Ganss (Standard support level)
Joined: 02/02/2007
Posts: 6

Hi Eugene,

on a installation without access to a SFTP-server I did some further checking.
VFP's CREATEOBJECT() returns an object which shows all the properties if the IElSimpleSftpClientX4 interface.

I can ask this object for different interfaces and VFP's internal intellisense
shows only the properties for that particular interface (X3 Missing ASCIIMode,
X2 Missing PipelineLength, X Missing SocketTimeOut).

see http://msdn2.microsoft.com/pt-br/library/0k968234(VS.80).aspx
FOR COM functionality IN vfp (esp. GETINTERFACE())

and also on http://msdn2.microsoft.com/pt-br/library/65zx7k19(VS.80).aspx
SYS(3095) IDispatch Pointer.
SYS(3096) IDispatch Object Reference.
SYS(3097) Add Reference to Object.
SYS(3098) Release Object Reference.

Keith wrote that he can use the downloadFiles-Method,
which momentarily I can not test as I have no test server.

I can access the array properties (for instance KexAlgorithms shows 6 Booleans)
defined on ElSimpleSftpClientX, which is in line with my second post to the tracker item:
vfp is better when accessing arrays defined on a class compared to safearrays in a method signature.

VFP produced some slight errors generating the code for interface implementation,
which at first sight seem to be easily fixable: some parameter definitions are
concatenated in the code - not tested as of now if other errors exist.
COM Hooking via EVENTHANDLER() might be possible if those errors are fixed manually.

Working with the base type ElStringListX is not problematic at all:
loList= CREATEOBJECT("BaseBBox.ElStringListX")
? loList.Count
? loList.add("Hallo")
? loList.Count
? loList.add("Hallo")
? loList.Count
? loList.add("Nr. 2")
? loList.add("Nr. 3")
? loList.add("Nr. 4")
? loList.add("Nr. 5")
? loList.Count
? loList.GetString(3)
? loList.GetString(4)
? loList.GetString(5)

A method returning such an object or an object property should be accessible.
Such an object as a reference parameter might work as well, but I'ld try the other 2 ways first.

vfp programmers are used to directory info grouped by ADIR()
see: http://msdn2.microsoft.com/pt-br/library/0tf1t016(VS.80).aspx

IF the info is in the string, I can reformat it, but it will be faster if the
row/column approach maps the vfp-target in ordered layout.

Your fear of bad performance might be unneccessary, as vfp is a p-code interpreter
and walking a COM array marshalling at each cell access might not be the fastest approach.

Giving vfp a formated string (marshalled only once) might actually be faster, depending
ON how much time is spent creating the string on the C side, since parsing a string into
a 1 or 2 dimensional array is done via internal commands and quite fast compared to
interpreted line by line parsing - which would at least be necessary to create the correctly
typed columns 2 and 3, but still much better than a full parsing of a line.
Vfp is also quite adept reading CSV and fixed line length formats
via the internal engine - but I don't expect performance problems on the interfacing
on the scales my app prepares for anyhow.


Posted: 02/04/2007 09:41:15
by Eugene Mayevski (EldoS Corp.)

I've uploaded a build (private one) to http://www.eldos.com/files/sbb/pr/secbboxax.zip

It includes ReadDirectoryAsString and ReadDirectoryAsStringList.

The interface is self-explanatory except the string format.

When NamesOnly = true, only the names of the files are returned.

When NamesOnly = false, the following information is returned:


Time is expressed in GeneralizedTime format.
If some parameter is not returned by the server, dash ("-") is put instead.
The list can be extended further, so the parser should not expect CreationTime to be the last parameter, followed by any specific character.

Sincerely yours
Eugene Mayevski
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.



Topic viewed 11939 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!