Allan,

At quick glance you have some of your parameters wrong.

DECLARE "wininet",FtpGetCurrentDirectoryA(hConnect:INT,
lpszCurrentDirectory:STRING, lpdwCurrentDirectory:INT),INT

Should be:

DECLARE "wininet",FtpGetCurrentDirectoryA(hConnect:INT,
lpszCurrentDirectory:STRING, lpdwCurrentDirectory:POINTER),INT


The lpdwCurrentDirectory is a POINTER to a dword (INT) not a dword itself.

So to use it you have to define the max length of the buffer returned:

DEF lpdw:INT
lpdw = 254
....
 FtpGetCurrentDirectoryA(hconnect, sOrgPath, lpdw)

This works because if the DELCARE defines a pointer parameter and you pass a
numeric variable then IBasic will pass the address of the variable to the function.

Haven't had the chance to check the rest of your declares yet but any time
you see LP* (such as LPDWORD) for a numeric type then the function is
expecting a pointer to the value not the value itself.

Paul.


Attached is a working version.

Your WIN32_FIND_DATA type was modified to use ISTRINGS instead of a char
array. also I changed the subroutine GetRemoteFolder to read the file entry
into a block of allocated memory first, and then used READMEM to fill 
in the UDT.

This is because IBasic passes all arrays by reference (including character
arrays) but the function expects the members of WIN32_FIND_DATA to all be
passed by value. Reading into a block of memory alleviates this 
problem.

Have fun!
Paul.
