mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 08:13:01 +00:00
[KERNEL32] Little fixes for FindFirstFileExW() behavior (#5592)
- Don't forget to release RTL_RELATIVE_NAME_U before return - Ignore lpSearchFilter correctly as on Windows Fixes 6 failures in kernel32:FindFiles test in LiveCD.
This commit is contained in:
parent
017004a0ac
commit
657f728767
1 changed files with 6 additions and 7 deletions
|
@ -653,6 +653,8 @@ FindFirstFileExW(IN LPCWSTR lpFileName,
|
||||||
LPVOID lpSearchFilter,
|
LPVOID lpSearchFilter,
|
||||||
IN DWORD dwAdditionalFlags)
|
IN DWORD dwAdditionalFlags)
|
||||||
{
|
{
|
||||||
|
UNREFERENCED_PARAMETER(lpSearchFilter);
|
||||||
|
|
||||||
TRACE("FindFirstFileExW(lpFileName %S)\n", lpFileName);
|
TRACE("FindFirstFileExW(lpFileName %S)\n", lpFileName);
|
||||||
|
|
||||||
if ((fInfoLevelId != FindExInfoStandard && fInfoLevelId != FindExInfoBasic) ||
|
if ((fInfoLevelId != FindExInfoStandard && fInfoLevelId != FindExInfoBasic) ||
|
||||||
|
@ -692,13 +694,6 @@ FindFirstFileExW(IN LPCWSTR lpFileName,
|
||||||
DECLSPEC_ALIGN(4) BYTE DirectoryInfo[FIND_DATA_SIZE];
|
DECLSPEC_ALIGN(4) BYTE DirectoryInfo[FIND_DATA_SIZE];
|
||||||
DIR_INFORMATION DirInfo = { .DirInfo = &DirectoryInfo };
|
DIR_INFORMATION DirInfo = { .DirInfo = &DirectoryInfo };
|
||||||
|
|
||||||
/* The search filter is always unused */
|
|
||||||
if (lpSearchFilter)
|
|
||||||
{
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return INVALID_HANDLE_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&FileName, lpFileName);
|
RtlInitUnicodeString(&FileName, lpFileName);
|
||||||
if (FileName.Length != 0 && FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1] == L'.')
|
if (FileName.Length != 0 && FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1] == L'.')
|
||||||
{
|
{
|
||||||
|
@ -735,6 +730,7 @@ FindFirstFileExW(IN LPCWSTR lpFileName,
|
||||||
DeviceNameInfo = RtlIsDosDeviceName_U(lpFileName);
|
DeviceNameInfo = RtlIsDosDeviceName_U(lpFileName);
|
||||||
if (DeviceNameInfo != 0)
|
if (DeviceNameInfo != 0)
|
||||||
{
|
{
|
||||||
|
RtlReleaseRelativeName(&RelativePath);
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
|
||||||
|
|
||||||
/* OK, it's really a DOS device */
|
/* OK, it's really a DOS device */
|
||||||
|
@ -798,6 +794,7 @@ FindFirstFileExW(IN LPCWSTR lpFileName,
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
RtlReleaseRelativeName(&RelativePath);
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
|
||||||
|
|
||||||
/* Adjust the last error codes */
|
/* Adjust the last error codes */
|
||||||
|
@ -817,6 +814,7 @@ FindFirstFileExW(IN LPCWSTR lpFileName,
|
||||||
if (FilePattern.Length == 0)
|
if (FilePattern.Length == 0)
|
||||||
{
|
{
|
||||||
NtClose(hDirectory);
|
NtClose(hDirectory);
|
||||||
|
RtlReleaseRelativeName(&RelativePath);
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
|
||||||
|
|
||||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||||
|
@ -891,6 +889,7 @@ FindFirstFileExW(IN LPCWSTR lpFileName,
|
||||||
&FilePattern,
|
&FilePattern,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
|
RtlReleaseRelativeName(&RelativePath);
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue