mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +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
|
typedef struct _KERNEL32_FIND_FILE_DATA
|
||||||
{
|
{
|
||||||
HANDLE DirectoryHandle;
|
HANDLE DirectoryHandle;
|
||||||
FILE_DIRECTORY_INFORMATION FileInfo;
|
FILE_BOTH_DIRECTORY_INFORMATION FileInfo;
|
||||||
WCHAR FileNameExtra[MAX_PATH];
|
WCHAR FileNameExtra[MAX_PATH];
|
||||||
UNICODE_STRING PatternStr;
|
UNICODE_STRING PatternStr;
|
||||||
} KERNEL32_FIND_FILE_DATA, *PKERNEL32_FIND_FILE_DATA;
|
} KERNEL32_FIND_FILE_DATA, *PKERNEL32_FIND_FILE_DATA;
|
||||||
|
@ -73,7 +73,7 @@ WINBOOL STDCALL InternalFindNextFile(HANDLE hFindFile,
|
||||||
(PVOID)&IData->FileInfo,
|
(PVOID)&IData->FileInfo,
|
||||||
sizeof(IData->FileInfo) +
|
sizeof(IData->FileInfo) +
|
||||||
sizeof(IData->FileNameExtra),
|
sizeof(IData->FileNameExtra),
|
||||||
FileDirectoryInformation,
|
FileBothDirectoryInformation,
|
||||||
TRUE,
|
TRUE,
|
||||||
&(IData->PatternStr),
|
&(IData->PatternStr),
|
||||||
FALSE);
|
FALSE);
|
||||||
|
@ -86,6 +86,28 @@ WINBOOL STDCALL InternalFindNextFile(HANDLE hFindFile,
|
||||||
return(TRUE);
|
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,
|
HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
||||||
LPWIN32_FIND_DATA lpFindFileData)
|
LPWIN32_FIND_DATA lpFindFileData)
|
||||||
{
|
{
|
||||||
|
@ -136,7 +158,7 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
||||||
FILE_LIST_DIRECTORY,
|
FILE_LIST_DIRECTORY,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
FILE_OPEN_IF,
|
FILE_OPEN_IF,
|
||||||
OPEN_EXISTING)!=STATUS_SUCCESS)
|
OPEN_EXISTING)!=STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
@ -152,13 +174,13 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
||||||
(PVOID)&IData->FileInfo,
|
(PVOID)&IData->FileInfo,
|
||||||
sizeof(IData->FileInfo) +
|
sizeof(IData->FileInfo) +
|
||||||
sizeof(IData->FileNameExtra),
|
sizeof(IData->FileNameExtra),
|
||||||
FileDirectoryInformation,
|
FileBothDirectoryInformation,
|
||||||
TRUE,
|
TRUE,
|
||||||
&(IData->PatternStr),
|
&(IData->PatternStr),
|
||||||
FALSE);
|
FALSE);
|
||||||
DPRINT("Found %w\n",IData->FileInfo.FileName);
|
DPRINT("Found %w\n",IData->FileInfo.FileName);
|
||||||
|
|
||||||
lpFindFileData->dwFileAttributes = IData->FileInfo.FileAttributes;
|
|
||||||
return(IData);
|
return(IData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,10 +190,7 @@ HANDLE FindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PKERNEL32_FIND_FILE_DATA IData;
|
PKERNEL32_FIND_FILE_DATA IData;
|
||||||
PWIN32_FIND_DATA_ASCII Ret;
|
PWIN32_FIND_DATA_ASCII Ret;
|
||||||
|
|
||||||
DPRINT("FindFirstFileA(lpFileName %s, lpFindFileData %x)\n",
|
|
||||||
lpFileName,lpFindFileData);
|
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (lpFileName[i]!=0)
|
while (lpFileName[i]!=0)
|
||||||
{
|
{
|
||||||
|
@ -186,14 +205,8 @@ HANDLE FindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
|
||||||
DPRINT("Failing request\n");
|
DPRINT("Failing request\n");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
FileDataToWin32Data(lpFindFileData,IData);
|
||||||
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;
|
|
||||||
|
|
||||||
return(IData);
|
return(IData);
|
||||||
}
|
}
|
||||||
|
@ -204,25 +217,18 @@ WINBOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATA lpFindFileData)
|
||||||
PKERNEL32_FIND_FILE_DATA IData;
|
PKERNEL32_FIND_FILE_DATA IData;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
|
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
|
||||||
if (IData == NULL)
|
if (IData == NULL)
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InternalFindNextFile(hFindFile, lpFindFileData))
|
if (!InternalFindNextFile(hFindFile, lpFindFileData))
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = (PWIN32_FIND_DATA_ASCII)lpFindFileData;
|
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(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,13 +249,21 @@ HANDLE STDCALL FindFirstFileW(LPCWSTR lpFileName,
|
||||||
{
|
{
|
||||||
PWIN32_FIND_DATA_UNICODE Ret;
|
PWIN32_FIND_DATA_UNICODE Ret;
|
||||||
PKERNEL32_FIND_FILE_DATA IData;
|
PKERNEL32_FIND_FILE_DATA IData;
|
||||||
|
int i;
|
||||||
|
|
||||||
IData = InternalFindFirstFile(lpFileName,lpFindFileData);
|
IData = InternalFindFirstFile(lpFileName,lpFindFileData);
|
||||||
Ret = (PWIN32_FIND_DATA_UNICODE)lpFindFileData;
|
Ret = (PWIN32_FIND_DATA_UNICODE)lpFindFileData;
|
||||||
|
FileDataToWin32Data(lpFindFileData,IData);
|
||||||
|
|
||||||
memcpy(Ret->cFileName, IData->FileInfo.FileName,
|
for (i=0; i<IData->FileInfo.FileNameLength; i++)
|
||||||
IData->FileInfo.FileNameLength);
|
{
|
||||||
memset(Ret->cAlternateFileName, 0, 14);
|
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);
|
return(IData);
|
||||||
}
|
}
|
||||||
|
@ -259,6 +273,7 @@ WINBOOL STDCALL FindNextFileW(HANDLE hFindFile,
|
||||||
{
|
{
|
||||||
PWIN32_FIND_DATA_UNICODE Ret;
|
PWIN32_FIND_DATA_UNICODE Ret;
|
||||||
PKERNEL32_FIND_FILE_DATA IData;
|
PKERNEL32_FIND_FILE_DATA IData;
|
||||||
|
int i;
|
||||||
|
|
||||||
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
|
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
|
||||||
if (!InternalFindNextFile(hFindFile, lpFindFileData))
|
if (!InternalFindNextFile(hFindFile, lpFindFileData))
|
||||||
|
@ -267,10 +282,17 @@ WINBOOL STDCALL FindNextFileW(HANDLE hFindFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
Ret = (PWIN32_FIND_DATA_UNICODE)lpFindFileData;
|
Ret = (PWIN32_FIND_DATA_UNICODE)lpFindFileData;
|
||||||
|
FileDataToWin32Data(lpFindFileData,IData);
|
||||||
|
|
||||||
memcpy(Ret->cFileName, IData->FileInfo.FileName,
|
for (i=0; i<IData->FileInfo.FileNameLength; i++)
|
||||||
IData->FileInfo.FileNameLength);
|
{
|
||||||
memset(Ret->cAlternateFileName, 0, 14);
|
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);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue