- fix spec file for FTPFindFirstFileA/W functions

- implement parsing of NT directory format
This commit is contained in:
Lionel Ulmer 2003-07-15 20:51:02 +00:00 committed by Alexandre Julliard
parent 02c67f3114
commit 877f323161
2 changed files with 126 additions and 72 deletions

View File

@ -2521,18 +2521,18 @@ BOOL FTP_ParseDirectory(LPWININETFTPSESSIONA lpwfs, INT nSocket, LPFILEPROPERTIE
pszToken = strtok(pszLine, " \t" );
/* HACK! If this is not a file listing skip the line */
if (!pszToken || 10 != strlen(pszToken) || nBufLen <= MIN_LEN_DIR_ENTRY)
if (!pszToken || nBufLen <= MIN_LEN_DIR_ENTRY)
{
nBufLen = MAX_REPLY_LEN;
continue;
}
if (10 == strlen(pszToken)) {
/* Unix way of parsing ... */
FTP_ParsePermission(pszToken, curFileProp);
nTokenToSkip = 3;
nCount = 0;
do
{
do {
pszToken = strtok( NULL, " \t" );
nCount++;
} while( nCount <= nTokenToSkip );
@ -2564,8 +2564,7 @@ BOOL FTP_ParseDirectory(LPWININETFTPSESSIONA lpwfs, INT nSocket, LPFILEPROPERTIE
pszToken = strtok(NULL, " \t");
pszMinutes = strchr(pszToken, ':');
if( pszMinutes != NULL )
{
if( pszMinutes != NULL ) {
pszMinutes++;
nMinutes = atoi(pszMinutes);
pszHour = pszMinutes - 3;
@ -2574,9 +2573,7 @@ BOOL FTP_ParseDirectory(LPWININETFTPSESSIONA lpwfs, INT nSocket, LPFILEPROPERTIE
time(&aTime);
apTM = localtime( &aTime );
nYear = apTM->tm_year;
}
else
{
} else {
nYear = atoi(pszToken);
nYear -= 1900;
nHour = 12;
@ -2590,14 +2587,71 @@ BOOL FTP_ParseDirectory(LPWININETFTPSESSIONA lpwfs, INT nSocket, LPFILEPROPERTIE
curFileProp->tmLastModified.tm_year = nYear;
pszToken = strtok(NULL, " \t");
if(pszToken != NULL)
{
if(pszToken != NULL) {
curFileProp->lpszName = FTP_strdup(pszToken);
TRACE(": %s\n", curFileProp->lpszName);
}
nBufLen = MAX_REPLY_LEN;
indexFilePropArray++;
} else if (8 == strlen(pszToken)) {
/* NT way of parsing ... :
07-13-03 08:55PM <DIR> sakpatch
05-09-03 06:02PM 12656686 2003-04-21bgm_cmd_e.rgz
*/
curFileProp->permissions = 0xFFFF; /* No idea, put full permission :-) */
sscanf(pszToken, "%d-%d-%d",
&curFileProp->tmLastModified.tm_mon,
&curFileProp->tmLastModified.tm_mday,
&curFileProp->tmLastModified.tm_year); /* Do we check for Y2K problems ? */
pszToken = strtok(NULL, " \t");
if (pszToken == NULL) {
nBufLen = MAX_REPLY_LEN;
continue;
}
sscanf(pszToken, "%d:%d",
&curFileProp->tmLastModified.tm_hour,
&curFileProp->tmLastModified.tm_min);
if ((pszToken[5] == 'P') && (pszToken[6] == 'M')) {
curFileProp->tmLastModified.tm_hour += 12;
}
curFileProp->tmLastModified.tm_sec = 0;
TRACE("Mod time: %2d:%2d:%2d %2d/%2d/%2d\n",
curFileProp->tmLastModified.tm_hour, curFileProp->tmLastModified.tm_min, curFileProp->tmLastModified.tm_sec,
curFileProp->tmLastModified.tm_year, curFileProp->tmLastModified.tm_mon, curFileProp->tmLastModified.tm_mday);
pszToken = strtok(NULL, " \t");
if (pszToken == NULL) {
nBufLen = MAX_REPLY_LEN;
continue;
}
if (!strcasecmp(pszToken, "<DIR>")) {
curFileProp->bIsDirectory = TRUE;
TRACE("Is directory\n");
} else {
curFileProp->bIsDirectory = FALSE;
curFileProp->nSize = atol(pszToken);
TRACE("nSize: %ld\n", curFileProp->nSize);
}
pszToken = strtok(NULL, " \t");
if (pszToken == NULL) {
nBufLen = MAX_REPLY_LEN;
continue;
}
curFileProp->lpszName = FTP_strdup(pszToken);
TRACE("Name: %s\n", curFileProp->lpszName);
nBufLen = MAX_REPLY_LEN;
indexFilePropArray++;
} else {
nBufLen = MAX_REPLY_LEN;
}
}
if (bSuccess && indexFilePropArray)

View File

@ -35,8 +35,8 @@
@ stdcall FtpCreateDirectoryW(ptr wstr)
@ stdcall FtpDeleteFileA(ptr str)
@ stub FtpDeleteFileW
@ stdcall FtpFindFirstFileA(ptr str str long long)
@ stdcall FtpFindFirstFileW(ptr wstr wstr long long)
@ stdcall FtpFindFirstFileA(ptr str ptr long long)
@ stdcall FtpFindFirstFileW(ptr wstr ptr long long)
@ stdcall FtpGetCurrentDirectoryA(ptr str ptr)
@ stdcall FtpGetCurrentDirectoryW(ptr wstr ptr)
@ stdcall FtpGetFileA(ptr str str long long long long)