Reverted back to 16420, because it contains too many bugs.
Modified: trunk/reactos/lib/kernel32/file/find.c
_____
Modified: trunk/reactos/lib/kernel32/file/find.c
--- trunk/reactos/lib/kernel32/file/find.c 2005-07-30 13:44:07 UTC
(rev 16892)
+++ trunk/reactos/lib/kernel32/file/find.c 2005-07-30 13:49:41 UTC
(rev 16893)
@@ -4,11 +4,9 @@
* PROJECT: ReactOS system libraries
* FILE: lib/kernel32/file/find.c
* PURPOSE: Find functions
- * PROGRAMMERS: Ariadne ( ariadne(a)xs4all.nl)
- Dmitry Philippov (
shedon(a)mail.ru )
+ * PROGRAMMER: Ariadne ( ariadne(a)xs4all.nl)
* UPDATE HISTORY:
* Created 01/11/98
- * DP (18/06/2005) remove
InternalFindFirstFile, implemented FindFirstFileExW
*/
/* INCLUDES
*****************************************************************/
@@ -82,278 +80,21 @@
return TRUE;
}
-/*
- * @implemented
- */
-BOOL
-STDCALL
-FindNextFileA (
- HANDLE hFindFile,
- LPWIN32_FIND_DATAA lpFindFileData)
-{
- PKERNEL32_FIND_FILE_DATA IData;
- UNICODE_STRING FileNameU;
- ANSI_STRING FileName;
- if (hFindFile == INVALID_HANDLE_VALUE)
- {
- SetLastError (ERROR_INVALID_HANDLE);
- DPRINT("Failing request\n");
- return FALSE;
- }
-
- IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
- if (!InternalFindNextFile (hFindFile))
- {
- DPRINT("InternalFindNextFile() failed\n");
- return FALSE;
- }
-
- DPRINT("IData->pFileInfo->FileNameLength %d\n",
- IData->pFileInfo->FileNameLength);
-
- /* copy data into WIN32_FIND_DATA structure */
- lpFindFileData->dwFileAttributes =
IData->pFileInfo->FileAttributes;
-
- lpFindFileData->ftCreationTime.dwHighDateTime =
IData->pFileInfo->CreationTime.u.HighPart;
- lpFindFileData->ftCreationTime.dwLowDateTime =
IData->pFileInfo->CreationTime.u.LowPart;
-
- lpFindFileData->ftLastAccessTime.dwHighDateTime =
IData->pFileInfo->LastAccessTime.u.HighPart;
- lpFindFileData->ftLastAccessTime.dwLowDateTime =
IData->pFileInfo->LastAccessTime.u.LowPart;
-
- lpFindFileData->ftLastWriteTime.dwHighDateTime =
IData->pFileInfo->LastWriteTime.u.HighPart;
- lpFindFileData->ftLastWriteTime.dwLowDateTime =
IData->pFileInfo->LastWriteTime.u.LowPart;
-
- lpFindFileData->nFileSizeHigh =
IData->pFileInfo->EndOfFile.u.HighPart;
- lpFindFileData->nFileSizeLow =
IData->pFileInfo->EndOfFile.u.LowPart;
-
- FileNameU.Length = IData->pFileInfo->FileNameLength;
- FileNameU.MaximumLength = FileNameU.Length + sizeof(WCHAR);
- FileNameU.Buffer = IData->pFileInfo->FileName;
-
- FileName.Length = 0;
- FileName.MaximumLength = MAX_PATH;
- FileName.Buffer = lpFindFileData->cFileName;
-
- /* convert unicode string to ansi (or oem) */
- if (bIsFileApiAnsi)
- RtlUnicodeStringToAnsiString (&FileName,
- &FileNameU,
- FALSE);
- else
- RtlUnicodeStringToOemString (&FileName,
- &FileNameU,
- FALSE);
-
- DPRINT("IData->pFileInfo->ShortNameLength %d\n",
- IData->pFileInfo->ShortNameLength);
-
- FileNameU.Length = IData->pFileInfo->ShortNameLength;
- FileNameU.MaximumLength = FileNameU.Length + sizeof(WCHAR);
- FileNameU.Buffer = IData->pFileInfo->ShortName;
-
- FileName.Length = 0;
- FileName.MaximumLength = 14;
- FileName.Buffer = lpFindFileData->cAlternateFileName;
-
- /* convert unicode string to ansi (or oem) */
- if (bIsFileApiAnsi)
- RtlUnicodeStringToAnsiString (&FileName,
- &FileNameU,
- FALSE);
- else
- RtlUnicodeStringToOemString (&FileName,
- &FileNameU,
- FALSE);
-
- return TRUE;
-}
-
-
/*
* @implemented
*/
-BOOL
-STDCALL
-FindClose (
- HANDLE hFindFile
- )
-{
- PKERNEL32_FIND_FILE_DATA IData;
-
- DPRINT("FindClose(hFindFile %x)\n",hFindFile);
-
- if (!hFindFile || hFindFile == INVALID_HANDLE_VALUE)
- {
- SetLastError (ERROR_INVALID_HANDLE);
- return FALSE;
- }
-
- IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
-
- CloseHandle (IData->DirectoryHandle);
- RtlFreeHeap (hProcessHeap, 0, IData);
-
- return TRUE;
-}
-
-/*
- * @implemented
- */
HANDLE
STDCALL
-FindFirstFileA (
- LPCSTR lpFileName,
- LPWIN32_FIND_DATAA lpFindFileData
+InternalFindFirstFile (
+ LPCWSTR lpFileName
)
{
- PKERNEL32_FIND_FILE_DATA IData;
- UNICODE_STRING FileNameU;
- ANSI_STRING FileName;
- WIN32_FIND_DATAW FindFileData;
-
- RtlInitAnsiString (&FileName,
- (LPSTR)lpFileName);
-
- /* convert ansi (or oem) string to unicode */
- if (bIsFileApiAnsi)
- RtlAnsiStringToUnicodeString (&FileNameU,
- &FileName,
- TRUE);
- else
- RtlOemStringToUnicodeString (&FileNameU,
- &FileName,
- TRUE);
-
- IData = FindFirstFileExW(FileNameU.Buffer,
-
FindExInfoStandard,
- &FindFileData,
-
FindExSearchNameMatch,
- NULL,
- 0);
-
- RtlFreeUnicodeString(&FileNameU);
-
- if(INVALID_HANDLE_VALUE != IData)
- {
- RtlInitUnicodeString(&FileNameU,
(PWSTR)FindFileData.cFileName);
- FileName.Buffer = lpFindFileData->cFileName;
- FileName.MaximumLength = MAX_PATH;
- if (bIsFileApiAnsi) {
- RtlUnicodeStringToAnsiString (&FileName,
-
&FileNameU,
-
FALSE);
- }
- else
- {
- RtlUnicodeStringToOemString (&FileName,
-
&FileNameU,
-
FALSE);
- }
- memcpy(lpFindFileData, &FindFileData,
offsetof(WIN32_FIND_DATAA, cFileName));
-
- }
-
-
- return (HANDLE)IData;
-}
-
-/*
- * @implemented
- */
-HANDLE
-STDCALL
-FindFirstFileW (
- LPCWSTR lpFileName,
- LPWIN32_FIND_DATAW lpFindFileData
- )
-{
- return FindFirstFileExW(
- lpFileName,
- FindExInfoStandard,
- lpFindFileData,
- FindExSearchNameMatch,
- NULL,
- 0
- );
-}
-
-
-/*
- * @implemented
- */
-BOOL
-STDCALL
-FindNextFileW (
- HANDLE hFindFile,
- LPWIN32_FIND_DATAW lpFindFileData
- )
-{
- PKERNEL32_FIND_FILE_DATA IData;
-
- if (hFindFile == INVALID_HANDLE_VALUE)
- {
- SetLastError (ERROR_INVALID_HANDLE);
- DPRINT("Failing request\n");
- return FALSE;
- }
-
- IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
- if (!InternalFindNextFile(hFindFile))
- {
- DPRINT("Failing request\n");
- return FALSE;
- }
-
- /* copy data into WIN32_FIND_DATA structure */
- lpFindFileData->dwFileAttributes =
IData->pFileInfo->FileAttributes;
-
- lpFindFileData->ftCreationTime.dwHighDateTime =
IData->pFileInfo->CreationTime.u.HighPart;
- lpFindFileData->ftCreationTime.dwLowDateTime =
IData->pFileInfo->CreationTime.u.LowPart;
-
- lpFindFileData->ftLastAccessTime.dwHighDateTime =
IData->pFileInfo->LastAccessTime.u.HighPart;
- lpFindFileData->ftLastAccessTime.dwLowDateTime =
IData->pFileInfo->LastAccessTime.u.LowPart;
-
- lpFindFileData->ftLastWriteTime.dwHighDateTime =
IData->pFileInfo->LastWriteTime.u.HighPart;
- lpFindFileData->ftLastWriteTime.dwLowDateTime =
IData->pFileInfo->LastWriteTime.u.LowPart;
-
- lpFindFileData->nFileSizeHigh =
IData->pFileInfo->EndOfFile.u.HighPart;
- lpFindFileData->nFileSizeLow =
IData->pFileInfo->EndOfFile.u.LowPart;
-
- lpFindFileData->nFileSizeHigh =
IData->pFileInfo->EndOfFile.u.HighPart;
- lpFindFileData->nFileSizeLow =
IData->pFileInfo->EndOfFile.u.LowPart;
-
- memcpy (lpFindFileData->cFileName,
- IData->pFileInfo->FileName,
- IData->pFileInfo->FileNameLength);
- lpFindFileData->cFileName[IData->pFileInfo->FileNameLength /
sizeof(WCHAR)] = 0;
- memcpy (lpFindFileData->cAlternateFileName,
- IData->pFileInfo->ShortName,
- IData->pFileInfo->ShortNameLength);
-
lpFindFileData->cAlternateFileName[IData->pFileInfo->ShortNameLength /
sizeof(WCHAR)] = 0;
- return TRUE;
-}
-
-
-/*
- * @implemented
- */
-HANDLE
-STDCALL
-FindFirstFileExW (
- LPCWSTR lpFileName,
- FINDEX_INFO_LEVELS fInfoLevelId,
- LPVOID lpFindFileData,
- FINDEX_SEARCH_OPS fSearchOp,
- LPVOID lpSearchFilter,
- DWORD dwAdditionalFlags
- )
-{
OBJECT_ATTRIBUTES ObjectAttributes;
PKERNEL32_FIND_FILE_DATA IData;
IO_STATUS_BLOCK IoStatusBlock;
UNICODE_STRING NtPathU;
- UNICODE_STRING PatternStr;
+ UNICODE_STRING PatternStr = RTL_CONSTANT_STRING(L"*");
NTSTATUS Status;
PWSTR e1, e2;
WCHAR CurrentDir[256];
@@ -363,20 +104,9 @@
ULONG Length;
BOOLEAN bResult;
-/*
-.....
-.....
-.....
-*/
- DPRINT("FindFirstFileExW(%S, %p, %p, %X, %p %d)\n",
- lpFileName,
- fInfoLevelId,
- lpFindFileData,
- fSearchOp,
- lpSearchFilter,
- dwAdditionalFlags);
+ DPRINT("FindFirstFileW(lpFileName %S)\n",
+ lpFileName);
-
Length = wcslen(lpFileName);
if (L'\\' == lpFileName[Length - 1])
{
@@ -386,7 +116,7 @@
if (NULL == SlashlessFileName)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return INVALID_HANDLE_VALUE;
+ return NULL;
}
memcpy(SlashlessFileName, lpFileName, (Length - 1) *
sizeof(WCHAR));
SlashlessFileName[Length - 1] = L'\0';
@@ -415,7 +145,7 @@
0,
SlashlessFileName);
}
- return INVALID_HANDLE_VALUE;
+ return NULL;
}
if (Length > sizeof(CurrentDir) / sizeof(WCHAR))
{
@@ -431,7 +161,7 @@
SlashlessFileName);
}
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return INVALID_HANDLE_VALUE;
+ return NULL;
}
GetCurrentDirectoryW(Length, SearchPath);
}
@@ -455,7 +185,7 @@
SlashlessFileName);
}
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return INVALID_HANDLE_VALUE;
+ return NULL;
}
}
memcpy(SearchPath, lpFileName, Length * sizeof(WCHAR));
@@ -480,7 +210,7 @@
0,
SlashlessFileName);
}
- return INVALID_HANDLE_VALUE;
+ return NULL;
}
DPRINT("NtPathU \'%S\'\n", NtPathU.Buffer);
@@ -500,16 +230,12 @@
SlashlessFileName);
}
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return INVALID_HANDLE_VALUE;
+ return NULL;
}
/* change pattern: "*.*" --> "*" */
- if (!wcscmp (SearchPattern, L"*.*"))
+ if (wcscmp (SearchPattern, L"*.*"))
{
- RtlInitUnicodeString(&PatternStr, L"*");
- }
- else
- {
RtlInitUnicodeString(&PatternStr, SearchPattern);
}
@@ -523,11 +249,11 @@
NULL);
Status = NtOpenFile (&IData->DirectoryHandle,
- SYNCHRONIZE|FILE_LIST_DIRECTORY,
+ FILE_LIST_DIRECTORY,
&ObjectAttributes,
&IoStatusBlock,
FILE_SHARE_READ|FILE_SHARE_WRITE,
-
FILE_DIRECTORY_FILE|FILE_SYNCHRONOUS_IO_NONALERT);
+ FILE_DIRECTORY_FILE);
RtlFreeHeap (hProcessHeap,
0,
@@ -543,10 +269,9 @@
SlashlessFileName);
}
SetLastErrorByStatus (Status);
- return INVALID_HANDLE_VALUE;
+ return(NULL);
}
IData->pFileInfo = (PVOID)((ULONG_PTR)IData +
sizeof(KERNEL32_FIND_FILE_DATA));
-
IData->pFileInfo->FileIndex = 0;
Status = NtQueryDirectoryFile (IData->DirectoryHandle,
@@ -572,36 +297,11 @@
CloseHandle (IData->DirectoryHandle);
RtlFreeHeap (hProcessHeap, 0, IData);
SetLastErrorByStatus (Status);
- return INVALID_HANDLE_VALUE;
+ return NULL;
}
DPRINT("Found
%.*S\n",IData->pFileInfo->FileNameLength/sizeof(WCHAR),
IData->pFileInfo->FileName);
- /* copy data into WIN32_FIND_DATA structure */
- ((LPWIN32_FIND_DATAW)lpFindFileData)->dwFileAttributes =
IData->pFileInfo->FileAttributes;
-
-
((LPWIN32_FIND_DATAW)lpFindFileData)->ftCreationTime.dwHighDateTime =
IData->pFileInfo->CreationTime.u.HighPart;
-
((LPWIN32_FIND_DATAW)lpFindFileData)->ftCreationTime.dwLowDateTime =
IData->pFileInfo->CreationTime.u.LowPart;
-
-
((LPWIN32_FIND_DATAW)lpFindFileData)->ftLastAccessTime.dwHighDateTime =
IData->pFileInfo->LastAccessTime.u.HighPart;
-
((LPWIN32_FIND_DATAW)lpFindFileData)->ftLastAccessTime.dwLowDateTime =
IData->pFileInfo->LastAccessTime.u.LowPart;
-
-
((LPWIN32_FIND_DATAW)lpFindFileData)->ftLastWriteTime.dwHighDateTime =
IData->pFileInfo->LastWriteTime.u.HighPart;
-
((LPWIN32_FIND_DATAW)lpFindFileData)->ftLastWriteTime.dwLowDateTime =
IData->pFileInfo->LastWriteTime.u.LowPart;
-
- ((LPWIN32_FIND_DATAW)lpFindFileData)->nFileSizeHigh =
IData->pFileInfo->EndOfFile.u.HighPart;
- ((LPWIN32_FIND_DATAW)lpFindFileData)->nFileSizeLow =
IData->pFileInfo->EndOfFile.u.LowPart;
-
- memcpy (((LPWIN32_FIND_DATAW)lpFindFileData)->cFileName,
- IData->pFileInfo->FileName,
- IData->pFileInfo->FileNameLength);
-
((LPWIN32_FIND_DATAW)lpFindFileData)->cFileName[IData->pFileInfo->FileNa
meLength / sizeof(WCHAR)] = 0;
- memcpy
(((LPWIN32_FIND_DATAW)lpFindFileData)->cAlternateFileName,
- IData->pFileInfo->ShortName,
- IData->pFileInfo->ShortNameLength);
-
((LPWIN32_FIND_DATAW)lpFindFileData)->cAlternateFileName[IData->pFileInf
o->ShortNameLength / sizeof(WCHAR)] = 0;
-
-
- return (HANDLE)IData;
+ return IData;
}
@@ -610,62 +310,353 @@
*/
HANDLE
STDCALL
-FindFirstFileExA (
- LPCSTR lpFileName,
- FINDEX_INFO_LEVELS fInfoLevelId,
- LPVOID lpFindFileData,
- FINDEX_SEARCH_OPS fSearchOp,
- LPVOID lpSearchFilter,
- DWORD dwAdditionalFlags
+FindFirstFileA (
+ LPCSTR lpFileName,
+ LPWIN32_FIND_DATAA lpFindFileData
)
{
PKERNEL32_FIND_FILE_DATA IData;
UNICODE_STRING FileNameU;
- ANSI_STRING FileNameA;
+ ANSI_STRING FileName;
- RtlInitAnsiString (&FileNameA,
+ RtlInitAnsiString (&FileName,
(LPSTR)lpFileName);
/* convert ansi (or oem) string to unicode */
if (bIsFileApiAnsi)
RtlAnsiStringToUnicodeString (&FileNameU,
- &FileNameA,
+ &FileName,
TRUE);
else
RtlOemStringToUnicodeString (&FileNameU,
- &FileNameA,
+ &FileName,
TRUE);
- IData = FindFirstFileExW(
- (LPCWSTR)FileNameU.Buffer,
- fInfoLevelId,
- lpFindFileData,
- fSearchOp,
- lpSearchFilter,
- dwAdditionalFlags
- );
+ IData = InternalFindFirstFile (FileNameU.Buffer);
- RtlFreeUnicodeString(&FileNameU);
+ RtlFreeUnicodeString (&FileNameU);
- if(INVALID_HANDLE_VALUE != IData)
+ if (IData == NULL)
{
- RtlInitUnicodeString(&FileNameU,
(PWSTR)((LPWIN32_FIND_DATAW)lpFindFileData)->cFileName);
- FileNameU.Buffer =
((LPWIN32_FIND_DATAW)lpFindFileData)->cFileName;
- FileNameU.MaximumLength = MAX_PATH;
-
- /* convert unicode string to ansi (or oem) */
- if (bIsFileApiAnsi)
- RtlUnicodeStringToAnsiString (&FileNameA,
- &FileNameU,
- FALSE);
- else
- RtlUnicodeStringToOemString (&FileNameA,
- &FileNameU,
- FALSE);
+ DPRINT("Failing request\n");
+ return INVALID_HANDLE_VALUE;
}
+ DPRINT("IData->pFileInfo->FileNameLength %d\n",
+ IData->pFileInfo->FileNameLength);
+
+ /* copy data into WIN32_FIND_DATA structure */
+ lpFindFileData->dwFileAttributes =
IData->pFileInfo->FileAttributes;
+
+ lpFindFileData->ftCreationTime.dwHighDateTime =
IData->pFileInfo->CreationTime.u.HighPart;
+ lpFindFileData->ftCreationTime.dwLowDateTime =
IData->pFileInfo->CreationTime.u.LowPart;
+
+ lpFindFileData->ftLastAccessTime.dwHighDateTime =
IData->pFileInfo->LastAccessTime.u.HighPart;
+ lpFindFileData->ftLastAccessTime.dwLowDateTime =
IData->pFileInfo->LastAccessTime.u.LowPart;
+
+ lpFindFileData->ftLastWriteTime.dwHighDateTime =
IData->pFileInfo->LastWriteTime.u.HighPart;
+ lpFindFileData->ftLastWriteTime.dwLowDateTime =
IData->pFileInfo->LastWriteTime.u.LowPart;
+
+ lpFindFileData->nFileSizeHigh =
IData->pFileInfo->EndOfFile.u.HighPart;
+ lpFindFileData->nFileSizeLow =
IData->pFileInfo->EndOfFile.u.LowPart;
+
+ FileNameU.Length = IData->pFileInfo->FileNameLength;
+ FileNameU.MaximumLength = FileNameU.Length + sizeof(WCHAR);
+ FileNameU.Buffer = IData->pFileInfo->FileName;
+
+ FileName.Length = 0;
+ FileName.MaximumLength = MAX_PATH;
+ FileName.Buffer = lpFindFileData->cFileName;
+
+ /* convert unicode string to ansi (or oem) */
+ if (bIsFileApiAnsi)
+ RtlUnicodeStringToAnsiString (&FileName,
+ &FileNameU,
+ FALSE);
+ else
+ RtlUnicodeStringToOemString (&FileName,
+ &FileNameU,
+ FALSE);
+
+ DPRINT("IData->pFileInfo->ShortNameLength %d\n",
+ IData->pFileInfo->ShortNameLength);
+
+ FileNameU.Length = IData->pFileInfo->ShortNameLength;
+ FileNameU.MaximumLength = FileNameU.Length + sizeof(WCHAR);
+ FileNameU.Buffer = IData->pFileInfo->ShortName;
+
+ FileName.Length = 0;
+ FileName.MaximumLength = 14;
+ FileName.Buffer = lpFindFileData->cAlternateFileName;
+
+ /* convert unicode string to ansi (or oem) */
+ if (bIsFileApiAnsi)
+ RtlUnicodeStringToAnsiString (&FileName,
+ &FileNameU,
+ FALSE);
+ else
+ RtlUnicodeStringToOemString (&FileName,
+ &FileNameU,
+ FALSE);
+
return (HANDLE)IData;
}
+/*
+ * @implemented
+ */
+BOOL
+STDCALL
+FindNextFileA (
+ HANDLE hFindFile,
+ LPWIN32_FIND_DATAA lpFindFileData)
+{
+ PKERNEL32_FIND_FILE_DATA IData;
+ UNICODE_STRING FileNameU;
+ ANSI_STRING FileName;
+
+ if (hFindFile == INVALID_HANDLE_VALUE)
+ {
+ SetLastError (ERROR_INVALID_HANDLE);
+ DPRINT("Failing request\n");
+ return FALSE;
+ }
+
+ IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
+ if (!InternalFindNextFile (hFindFile))
+ {
+ DPRINT("InternalFindNextFile() failed\n");
+ return FALSE;
+ }
+
+ DPRINT("IData->pFileInfo->FileNameLength %d\n",
+ IData->pFileInfo->FileNameLength);
+
+ /* copy data into WIN32_FIND_DATA structure */
+ lpFindFileData->dwFileAttributes =
IData->pFileInfo->FileAttributes;
+
+ lpFindFileData->ftCreationTime.dwHighDateTime =
IData->pFileInfo->CreationTime.u.HighPart;
+ lpFindFileData->ftCreationTime.dwLowDateTime =
IData->pFileInfo->CreationTime.u.LowPart;
+
+ lpFindFileData->ftLastAccessTime.dwHighDateTime =
IData->pFileInfo->LastAccessTime.u.HighPart;
+ lpFindFileData->ftLastAccessTime.dwLowDateTime =
IData->pFileInfo->LastAccessTime.u.LowPart;
+
+ lpFindFileData->ftLastWriteTime.dwHighDateTime =
IData->pFileInfo->LastWriteTime.u.HighPart;
+ lpFindFileData->ftLastWriteTime.dwLowDateTime =
IData->pFileInfo->LastWriteTime.u.LowPart;
+
+ lpFindFileData->nFileSizeHigh =
IData->pFileInfo->EndOfFile.u.HighPart;
+ lpFindFileData->nFileSizeLow =
IData->pFileInfo->EndOfFile.u.LowPart;
+
+ FileNameU.Length = IData->pFileInfo->FileNameLength;
+ FileNameU.MaximumLength = FileNameU.Length + sizeof(WCHAR);
+ FileNameU.Buffer = IData->pFileInfo->FileName;
+
+ FileName.Length = 0;
+ FileName.MaximumLength = MAX_PATH;
+ FileName.Buffer = lpFindFileData->cFileName;
+
+ /* convert unicode string to ansi (or oem) */
+ if (bIsFileApiAnsi)
+ RtlUnicodeStringToAnsiString (&FileName,
+ &FileNameU,
+ FALSE);
+ else
+ RtlUnicodeStringToOemString (&FileName,
+ &FileNameU,
+ FALSE);
+
+ DPRINT("IData->pFileInfo->ShortNameLength %d\n",
+ IData->pFileInfo->ShortNameLength);
+
+ FileNameU.Length = IData->pFileInfo->ShortNameLength;
+ FileNameU.MaximumLength = FileNameU.Length + sizeof(WCHAR);
+ FileNameU.Buffer = IData->pFileInfo->ShortName;
+
+ FileName.Length = 0;
+ FileName.MaximumLength = 14;
+ FileName.Buffer = lpFindFileData->cAlternateFileName;
+
+ /* convert unicode string to ansi (or oem) */
+ if (bIsFileApiAnsi)
+ RtlUnicodeStringToAnsiString (&FileName,
+ &FileNameU,
+ FALSE);
+ else
+ RtlUnicodeStringToOemString (&FileName,
+ &FileNameU,
+ FALSE);
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+STDCALL
+FindClose (
+ HANDLE hFindFile
+ )
+{
+ PKERNEL32_FIND_FILE_DATA IData;
+
+ DPRINT("FindClose(hFindFile %x)\n",hFindFile);
+
+ if (!hFindFile || hFindFile == INVALID_HANDLE_VALUE)
+ {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
+
+ CloseHandle (IData->DirectoryHandle);
+ RtlFreeHeap (hProcessHeap, 0, IData);
+
+ return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+HANDLE
+STDCALL
+FindFirstFileW (
+ LPCWSTR lpFileName,
+ LPWIN32_FIND_DATAW lpFindFileData
+ )
+{
+ PKERNEL32_FIND_FILE_DATA IData;
+
+ IData = InternalFindFirstFile (lpFileName);
+ if (IData == NULL)
+ {
+ DPRINT("Failing request\n");
+ return INVALID_HANDLE_VALUE;
+ }
+
+ /* copy data into WIN32_FIND_DATA structure */
+ lpFindFileData->dwFileAttributes =
IData->pFileInfo->FileAttributes;
+
+ lpFindFileData->ftCreationTime.dwHighDateTime =
IData->pFileInfo->CreationTime.u.HighPart;
+ lpFindFileData->ftCreationTime.dwLowDateTime =
IData->pFileInfo->CreationTime.u.LowPart;
+
+ lpFindFileData->ftLastAccessTime.dwHighDateTime =
IData->pFileInfo->LastAccessTime.u.HighPart;
+ lpFindFileData->ftLastAccessTime.dwLowDateTime =
IData->pFileInfo->LastAccessTime.u.LowPart;
+
+ lpFindFileData->ftLastWriteTime.dwHighDateTime =
IData->pFileInfo->LastWriteTime.u.HighPart;
+ lpFindFileData->ftLastWriteTime.dwLowDateTime =
IData->pFileInfo->LastWriteTime.u.LowPart;
+
+ lpFindFileData->nFileSizeHigh =
IData->pFileInfo->EndOfFile.u.HighPart;
+ lpFindFileData->nFileSizeLow =
IData->pFileInfo->EndOfFile.u.LowPart;
+
+ memcpy (lpFindFileData->cFileName,
+ IData->pFileInfo->FileName,
+ IData->pFileInfo->FileNameLength);
+ lpFindFileData->cFileName[IData->pFileInfo->FileNameLength /
sizeof(WCHAR)] = 0;
+ memcpy (lpFindFileData->cAlternateFileName,
+ IData->pFileInfo->ShortName,
+ IData->pFileInfo->ShortNameLength);
+
lpFindFileData->cAlternateFileName[IData->pFileInfo->ShortNameLength /
sizeof(WCHAR)] = 0;
+ return IData;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
+STDCALL
+FindNextFileW (
+ HANDLE hFindFile,
+ LPWIN32_FIND_DATAW lpFindFileData
+ )
+{
+ PKERNEL32_FIND_FILE_DATA IData;
+
+ if (hFindFile == INVALID_HANDLE_VALUE)
+ {
+ SetLastError (ERROR_INVALID_HANDLE);
+ DPRINT("Failing request\n");
+ return FALSE;
+ }
+
+ IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
+ if (!InternalFindNextFile(hFindFile))
+ {
+ DPRINT("Failing request\n");
+ return FALSE;
+ }
+
+ /* copy data into WIN32_FIND_DATA structure */
+ lpFindFileData->dwFileAttributes =
IData->pFileInfo->FileAttributes;
+
+ lpFindFileData->ftCreationTime.dwHighDateTime =
IData->pFileInfo->CreationTime.u.HighPart;
+ lpFindFileData->ftCreationTime.dwLowDateTime =
IData->pFileInfo->CreationTime.u.LowPart;
+
+ lpFindFileData->ftLastAccessTime.dwHighDateTime =
IData->pFileInfo->LastAccessTime.u.HighPart;
+ lpFindFileData->ftLastAccessTime.dwLowDateTime =
IData->pFileInfo->LastAccessTime.u.LowPart;
+
+ lpFindFileData->ftLastWriteTime.dwHighDateTime =
IData->pFileInfo->LastWriteTime.u.HighPart;
+ lpFindFileData->ftLastWriteTime.dwLowDateTime =
IData->pFileInfo->LastWriteTime.u.LowPart;
+
+ lpFindFileData->nFileSizeHigh =
IData->pFileInfo->EndOfFile.u.HighPart;
+ lpFindFileData->nFileSizeLow =
IData->pFileInfo->EndOfFile.u.LowPart;
+
+ lpFindFileData->nFileSizeHigh =
IData->pFileInfo->EndOfFile.u.HighPart;
+ lpFindFileData->nFileSizeLow =
IData->pFileInfo->EndOfFile.u.LowPart;
+
+ memcpy (lpFindFileData->cFileName,
+ IData->pFileInfo->FileName,
+ IData->pFileInfo->FileNameLength);
+ lpFindFileData->cFileName[IData->pFileInfo->FileNameLength /
sizeof(WCHAR)] = 0;
+ memcpy (lpFindFileData->cAlternateFileName,
+ IData->pFileInfo->ShortName,
+ IData->pFileInfo->ShortNameLength);
+
lpFindFileData->cAlternateFileName[IData->pFileInfo->ShortNameLength /
sizeof(WCHAR)] = 0;
+ return TRUE;
+}
+
+
+/*
+ * @unimplemented
+ */
+HANDLE
+STDCALL
+FindFirstFileExW (
+ LPCWSTR lpFileName,
+ FINDEX_INFO_LEVELS fInfoLevelId,
+ LPVOID lpFindFileData,
+ FINDEX_SEARCH_OPS fSearchOp,
+ LPVOID lpSearchFilter,
+ DWORD dwAdditionalFlags
+ )
+{
+ /* FIXME */
+ return (HANDLE) 0;
+}
+
+
+/*
+ * @unimplemented
+ */
+HANDLE
+STDCALL
+FindFirstFileExA (
+ LPCSTR lpFileName,
+ FINDEX_INFO_LEVELS fInfoLevelId,
+ LPVOID lpFindFileData,
+ FINDEX_SEARCH_OPS fSearchOp,
+ LPVOID lpSearchFilter,
+ DWORD dwAdditionalFlags
+ )
+{
+ /* FIXME */
+ return (HANDLE) 0;
+}
+
+
/* EOF */