PDA

View Full Version : How can I use a WIN32 structure needed by Windows API?



draby1
05-12-2004, 06:43 PM
Hello - I need to use a return value structure from a Win32 API called WIN32_FIND_DATA (the purpose is to be able to enumerate contents of an FTP server so I can copy files via FTP without knowing the names of each file). I am already set up with the code provided in another article that uses FTP and it is working okay - I just need to be able to enumerate. The structure is defined like this:

typedef struct _WIN32_FIND_DATA
{ DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[MAX_PATH];
TCHAR cAlternateFileName[14];
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;

What is the process to be able to use this data within Install script?

Thanks very much...

RobertDickau
05-12-2004, 07:04 PM
Please search your DevStudio distribution folder for the file Winapi.h; you should find that that structure has already been prototyped there...

draby1
05-13-2004, 06:28 PM
Fantastic - that is a great piece of help.

Now that I have access to the Find_Data structure from WinApi.h, how would I export in WininetHeader.h the functions that use them? For instance, for FtpFindFirstFileA, I just made it up hoping it would work (since it isn't in WininetHeader.h):

export prototype int wininet.FtpFindFirstFileA( int, //hConnect
byval string,
int, //LPWIN32_FIND_DATA
int, //DWORD dwFlags
int, /*DWORD_PTR dwContext*/ );

But I am concerned about using "int" for the Find_Data structure (parameter 3) in this export....any additional advice here? If I use "FIND_DATA" as the type, I get an error message during compilation.

Thanks very much

RobertDickau
05-16-2004, 02:26 PM
Perhaps try FIND_DATA POINTER?