Author: pschweitzer
Date: Mon Jan 2 10:02:50 2012
New Revision: 54807
URL:
http://svn.reactos.org/svn/reactos?rev=54807&view=rev
Log:
[KERNEL32]
Esthetical fixes.
Modified:
trunk/reactos/dll/win32/kernel32/client/file/dir.c
Modified: trunk/reactos/dll/win32/kernel32/client/file/dir.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/file/dir.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/file/dir.c [iso-8859-1] Mon Jan 2 10:02:50
2012
@@ -150,7 +150,7 @@
if (Length == 0)
{
RtlReleaseRelativeName(&RelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, NtPathU.Buffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathU.Buffer);
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return FALSE;
}
@@ -201,7 +201,7 @@
0);
RtlReleaseRelativeName(&RelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, PathUBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
if (NT_SUCCESS(Status))
{
@@ -229,15 +229,16 @@
{
DWORD Length;
NTSTATUS Status;
- ULONG EaLength = 0;
PVOID EaBuffer = NULL;
BOOL ReparsePoint = FALSE;
IO_STATUS_BLOCK IoStatusBlock;
FILE_EA_INFORMATION FileEaInfo;
+ ULONG EaLength = 0, StreamSize;
OBJECT_ATTRIBUTES ObjectAttributes;
FILE_BASIC_INFORMATION FileBasicInfo;
PREPARSE_DATA_BUFFER ReparseDataBuffer;
HANDLE TemplateHandle, DirectoryHandle;
+ PFILE_STREAM_INFORMATION FileStreamInfo;
FILE_ATTRIBUTE_TAG_INFORMATION FileTagInfo;
UNICODE_STRING NtPathU, NtTemplatePathU, NewDirectory;
RTL_RELATIVE_NAME_U RelativeName, TemplateRelativeName;
@@ -283,7 +284,7 @@
if (Status != STATUS_INVALID_PARAMETER)
{
RtlReleaseRelativeName(&TemplateRelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, TemplateBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, TemplateBuffer);
BaseSetLastNTError(Status);
return FALSE;
}
@@ -300,7 +301,7 @@
if (!NT_SUCCESS(Status))
{
RtlReleaseRelativeName(&TemplateRelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, TemplateBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, TemplateBuffer);
BaseSetLastNTError(Status);
return FALSE;
}
@@ -315,7 +316,7 @@
if (!NT_SUCCESS(Status))
{
RtlReleaseRelativeName(&TemplateRelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, TemplateBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, TemplateBuffer);
CloseHandle(TemplateHandle);
BaseSetLastNTError(Status);
return FALSE;
@@ -334,7 +335,7 @@
if (!NT_SUCCESS(Status))
{
RtlReleaseRelativeName(&TemplateRelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, TemplateBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, TemplateBuffer);
CloseHandle(TemplateHandle);
BaseSetLastNTError(Status);
return FALSE;
@@ -352,7 +353,7 @@
if (!NT_SUCCESS(Status))
{
RtlReleaseRelativeName(&TemplateRelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, TemplateBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, TemplateBuffer);
CloseHandle(TemplateHandle);
BaseSetLastNTError(Status);
return FALSE;
@@ -374,7 +375,7 @@
if (!RtlDosPathNameToRelativeNtPathName_U(lpNewDirectory, &NtPathU, NULL,
&RelativeName))
{
RtlReleaseRelativeName(&TemplateRelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, TemplateBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, TemplateBuffer);
NtClose(TemplateHandle);
SetLastError(ERROR_PATH_NOT_FOUND);
return FALSE;
@@ -390,15 +391,15 @@
{
RtlReleaseRelativeName(&RelativeName);
RtlReleaseRelativeName(&TemplateRelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, TemplateBuffer);
- RtlFreeHeap(GetProcessHeap(), 0, PathUBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, TemplateBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
NtClose(TemplateHandle);
SetLastError(ERROR_INVALID_NAME);
return FALSE;
}
RtlReleaseRelativeName(&TemplateRelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, TemplateBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, TemplateBuffer);
/* Check if path length is < MAX_PATH (with space for file name).
* If not, prefix is required.
@@ -411,7 +412,7 @@
if (Length == 0)
{
RtlReleaseRelativeName(&RelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, PathUBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
CloseHandle(TemplateHandle);
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return FALSE;
@@ -423,7 +424,7 @@
if (Length > MAX_PATH)
{
RtlReleaseRelativeName(&RelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, PathUBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
CloseHandle(TemplateHandle);
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return FALSE;
@@ -451,7 +452,7 @@
if (!NT_SUCCESS(Status))
{
RtlReleaseRelativeName(&RelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, PathUBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
CloseHandle(TemplateHandle);
BaseSetLastNTError(Status);
return FALSE;
@@ -467,7 +468,7 @@
if (!EaBuffer)
{
RtlReleaseRelativeName(&RelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, PathUBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
CloseHandle(TemplateHandle);
BaseSetLastNTError(STATUS_NO_MEMORY);
return FALSE;
@@ -485,7 +486,7 @@
TRUE);
if (!NT_SUCCESS(Status))
{
- RtlFreeHeap(GetProcessHeap(), 0, EaBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, EaBuffer);
IoStatusBlock.Information = 0;
}
@@ -548,10 +549,10 @@
else
{
RtlReleaseRelativeName(&RelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, PathUBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
if (EaBuffer)
{
- RtlFreeHeap(GetProcessHeap(), 0, EaBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, EaBuffer);
}
CloseHandle(TemplateHandle);
BaseSetLastNTError(Status);
@@ -561,7 +562,7 @@
}
RtlReleaseRelativeName(&RelativeName);
- RtlFreeHeap(GetProcessHeap(), 0, PathUBuffer);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
if (EaBuffer)
{
RtlFreeHeap(RtlGetProcessHeap(), 0, EaBuffer);
@@ -683,12 +684,10 @@
/* In case it's not a reparse point, handle streams on the file */
else
{
- PVOID StreamInfo;
- ULONG StreamSize = 0x1000;
- for (;;)
- {
- StreamInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, StreamSize);
- if (!StreamInfo)
+ for (StreamSize = 0x1000; ; StreamSize = StreamSize * 2)
+ {
+ FileStreamInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, StreamSize);
+ if (!FileStreamInfo)
{
BaseMarkFileForDelete(DirectoryHandle, FileBasicInfo.FileAttributes);
SetLastError(STATUS_NO_MEMORY);
@@ -698,15 +697,16 @@
/* Query stream information */
Status = NtQueryInformationFile(TemplateHandle,
&IoStatusBlock,
- StreamInfo,
+ FileStreamInfo,
StreamSize,
FileStreamInformation);
- if (!NT_SUCCESS(Status))
- {
- RtlFreeHeap(RtlGetProcessHeap(), 0, StreamInfo);
- StreamInfo = NULL;
- StreamSize << 1;
- }
+ if (NT_SUCCESS(Status))
+ {
+ break;
+ }
+
+ RtlFreeHeap(RtlGetProcessHeap(), 0, FileStreamInfo);
+ FileStreamInfo = NULL;
/* If it failed, ensure that's not because of too small buffer */
if (Status != STATUS_BUFFER_OVERFLOW &&
@@ -718,9 +718,9 @@
if (!NT_SUCCESS(Status) || IoStatusBlock.Information == 0)
{
- if (StreamInfo)
- {
- RtlFreeHeap(RtlGetProcessHeap(), 0, StreamInfo);
+ if (FileStreamInfo)
+ {
+ RtlFreeHeap(RtlGetProcessHeap(), 0, FileStreamInfo);
}
NtClose(TemplateHandle);
@@ -731,7 +731,7 @@
#if 1
/* FIXME: TODO */
DPRINT1("Warning: streams copying is unimplemented!\n");
- RtlFreeHeap(RtlGetProcessHeap(), 0, StreamInfo);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, FileStreamInfo);
NtClose(TemplateHandle);
NtClose(DirectoryHandle);
#endif
@@ -980,7 +980,7 @@
if (!NT_SUCCESS(Status))
{
- BaseSetLastNTError (Status);
+ BaseSetLastNTError(Status);
return FALSE;
}