mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
return both alternate and long filename
return file size svn path=/trunk/; revision=185
This commit is contained in:
parent
efa169ca61
commit
f9a230ad49
1 changed files with 54 additions and 32 deletions
|
@ -22,7 +22,7 @@
|
|||
typedef struct _KERNEL32_FIND_FILE_DATA
|
||||
{
|
||||
HANDLE DirectoryHandle;
|
||||
FILE_DIRECTORY_INFORMATION FileInfo;
|
||||
FILE_BOTH_DIRECTORY_INFORMATION FileInfo;
|
||||
WCHAR FileNameExtra[MAX_PATH];
|
||||
UNICODE_STRING PatternStr;
|
||||
} KERNEL32_FIND_FILE_DATA, *PKERNEL32_FIND_FILE_DATA;
|
||||
|
@ -73,7 +73,7 @@ WINBOOL STDCALL InternalFindNextFile(HANDLE hFindFile,
|
|||
(PVOID)&IData->FileInfo,
|
||||
sizeof(IData->FileInfo) +
|
||||
sizeof(IData->FileNameExtra),
|
||||
FileDirectoryInformation,
|
||||
FileBothDirectoryInformation,
|
||||
TRUE,
|
||||
&(IData->PatternStr),
|
||||
FALSE);
|
||||
|
@ -86,6 +86,28 @@ WINBOOL STDCALL InternalFindNextFile(HANDLE hFindFile,
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
static FileDataToWin32Data(LPWIN32_FIND_DATA lpFindFileData
|
||||
,PKERNEL32_FIND_FILE_DATA IData)
|
||||
{
|
||||
int i;
|
||||
lpFindFileData->dwFileAttributes = IData->FileInfo.FileAttributes;
|
||||
// memcpy(&lpFindFileData->ftCreationTime,&IData->FileInfo.CreationTime,sizeof(FILETIME));
|
||||
// memcpy(&lpFindFileData->ftLastAccessTime,&IData->FileInfo.LastAccessTime,sizeof(FILETIME));
|
||||
// memcpy(&lpFindFileData->ftLastWriteTime,&IData->FileInfo.LastWriteTime,sizeof(FILETIME));
|
||||
lpFindFileData->nFileSizeHigh = IData->FileInfo.EndOfFile>>32;
|
||||
lpFindFileData->nFileSizeLow = IData->FileInfo.EndOfFile;
|
||||
for (i=0; i<IData->FileInfo.FileNameLength; i++)
|
||||
{
|
||||
lpFindFileData->cFileName[i] = IData->FileInfo.FileName[i];
|
||||
}
|
||||
lpFindFileData->cFileName[i] = 0;
|
||||
for(i=0;i<IData->FileInfo.ShortNameLength;i++)
|
||||
{
|
||||
lpFindFileData->cAlternateFileName[i] = IData->FileInfo.ShortName[i];
|
||||
}
|
||||
lpFindFileData->cAlternateFileName[i] = 0;
|
||||
}
|
||||
|
||||
HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
||||
LPWIN32_FIND_DATA lpFindFileData)
|
||||
{
|
||||
|
@ -136,7 +158,7 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
|||
FILE_LIST_DIRECTORY,
|
||||
&ObjectAttributes,
|
||||
&IoStatusBlock,
|
||||
FILE_OPEN_IF,
|
||||
FILE_OPEN_IF,
|
||||
OPEN_EXISTING)!=STATUS_SUCCESS)
|
||||
{
|
||||
return(NULL);
|
||||
|
@ -152,13 +174,13 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
|||
(PVOID)&IData->FileInfo,
|
||||
sizeof(IData->FileInfo) +
|
||||
sizeof(IData->FileNameExtra),
|
||||
FileDirectoryInformation,
|
||||
FileBothDirectoryInformation,
|
||||
TRUE,
|
||||
&(IData->PatternStr),
|
||||
FALSE);
|
||||
DPRINT("Found %w\n",IData->FileInfo.FileName);
|
||||
|
||||
lpFindFileData->dwFileAttributes = IData->FileInfo.FileAttributes;
|
||||
|
||||
return(IData);
|
||||
}
|
||||
|
||||
|
@ -168,10 +190,7 @@ HANDLE FindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
|
|||
ULONG i;
|
||||
PKERNEL32_FIND_FILE_DATA IData;
|
||||
PWIN32_FIND_DATA_ASCII Ret;
|
||||
|
||||
DPRINT("FindFirstFileA(lpFileName %s, lpFindFileData %x)\n",
|
||||
lpFileName,lpFindFileData);
|
||||
|
||||
|
||||
i = 0;
|
||||
while (lpFileName[i]!=0)
|
||||
{
|
||||
|
@ -186,14 +205,8 @@ HANDLE FindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
|
|||
DPRINT("Failing request\n");
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
Ret = (PWIN32_FIND_DATA_ASCII)lpFindFileData;
|
||||
FileDataToWin32Data(lpFindFileData,IData);
|
||||
|
||||
for (i=0; i<IData->FileInfo.FileNameLength; i++)
|
||||
{
|
||||
Ret->cFileName[i] = IData->FileInfo.FileName[i];
|
||||
}
|
||||
Ret->cFileName[i] = 0;
|
||||
|
||||
return(IData);
|
||||
}
|
||||
|
@ -204,25 +217,18 @@ WINBOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATA lpFindFileData)
|
|||
PKERNEL32_FIND_FILE_DATA IData;
|
||||
ULONG i;
|
||||
|
||||
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
|
||||
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
|
||||
if (IData == NULL)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if (!InternalFindNextFile(hFindFile, lpFindFileData))
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
Ret = (PWIN32_FIND_DATA_ASCII)lpFindFileData;
|
||||
|
||||
for (i=0; i<IData->FileInfo.FileNameLength; i++)
|
||||
{
|
||||
Ret->cFileName[i] = IData->FileInfo.FileName[i];
|
||||
}
|
||||
Ret->cFileName[i] = 0;
|
||||
|
||||
FileDataToWin32Data(lpFindFileData,IData);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
@ -243,13 +249,21 @@ HANDLE STDCALL FindFirstFileW(LPCWSTR lpFileName,
|
|||
{
|
||||
PWIN32_FIND_DATA_UNICODE Ret;
|
||||
PKERNEL32_FIND_FILE_DATA IData;
|
||||
|
||||
int i;
|
||||
|
||||
IData = InternalFindFirstFile(lpFileName,lpFindFileData);
|
||||
Ret = (PWIN32_FIND_DATA_UNICODE)lpFindFileData;
|
||||
FileDataToWin32Data(lpFindFileData,IData);
|
||||
|
||||
memcpy(Ret->cFileName, IData->FileInfo.FileName,
|
||||
IData->FileInfo.FileNameLength);
|
||||
memset(Ret->cAlternateFileName, 0, 14);
|
||||
for (i=0; i<IData->FileInfo.FileNameLength; i++)
|
||||
{
|
||||
Ret->cFileName[i] = IData->FileInfo.FileName[i];
|
||||
}
|
||||
Ret->cFileName[i] = 0;
|
||||
for(i=0;i<IData->FileInfo.ShortNameLength;i++)
|
||||
{
|
||||
Ret->cAlternateFileName[i] = IData->FileInfo.ShortName[i];
|
||||
}
|
||||
|
||||
return(IData);
|
||||
}
|
||||
|
@ -259,6 +273,7 @@ WINBOOL STDCALL FindNextFileW(HANDLE hFindFile,
|
|||
{
|
||||
PWIN32_FIND_DATA_UNICODE Ret;
|
||||
PKERNEL32_FIND_FILE_DATA IData;
|
||||
int i;
|
||||
|
||||
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
|
||||
if (!InternalFindNextFile(hFindFile, lpFindFileData))
|
||||
|
@ -267,10 +282,17 @@ WINBOOL STDCALL FindNextFileW(HANDLE hFindFile,
|
|||
}
|
||||
|
||||
Ret = (PWIN32_FIND_DATA_UNICODE)lpFindFileData;
|
||||
FileDataToWin32Data(lpFindFileData,IData);
|
||||
|
||||
memcpy(Ret->cFileName, IData->FileInfo.FileName,
|
||||
IData->FileInfo.FileNameLength);
|
||||
memset(Ret->cAlternateFileName, 0, 14);
|
||||
for (i=0; i<IData->FileInfo.FileNameLength; i++)
|
||||
{
|
||||
Ret->cFileName[i] = IData->FileInfo.FileName[i];
|
||||
}
|
||||
Ret->cFileName[i] = 0;
|
||||
for(i=0;i<IData->FileInfo.ShortNameLength;i++)
|
||||
{
|
||||
Ret->cAlternateFileName[i] = IData->FileInfo.ShortName[i];
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue