This is an automated email from the git hooks/post-receive script.
www-data pushed a commit to branch master
in repository reactos.
View the commit online:
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1e2424ee98bd12d6a5a7e…
commit 1e2424ee98bd12d6a5a7ebffdfa138546a5c7a5b
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Wed Oct 4 23:00:12 2017 +0200
[KERNEL32]: Refactor a bit GetDiskFreeSpaceExW(), no ground breaking changes
---
dll/win32/kernel32/client/file/disk.c | 124 +++++++++++++++++++---------------
1 file changed, 69 insertions(+), 55 deletions(-)
diff --git a/dll/win32/kernel32/client/file/disk.c b/dll/win32/kernel32/client/file/disk.c
index 5854b2320e..1ba1b73549 100644
--- a/dll/win32/kernel32/client/file/disk.c
+++ b/dll/win32/kernel32/client/file/disk.c
@@ -383,103 +383,117 @@ GetDiskFreeSpaceExW(IN LPCWSTR lpDirectoryName OPTIONAL,
OUT PULARGE_INTEGER lpTotalNumberOfBytes,
OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
{
- union
- {
- FILE_FS_SIZE_INFORMATION FsSize;
- FILE_FS_FULL_SIZE_INFORMATION FsFullSize;
- } FsInfo;
- IO_STATUS_BLOCK IoStatusBlock;
- ULARGE_INTEGER BytesPerCluster;
- HANDLE hFile;
+ PCWSTR RootPath;
NTSTATUS Status;
+ HANDLE RootHandle;
+ UNICODE_STRING FileName;
+ DWORD BytesPerAllocationUnit;
+ IO_STATUS_BLOCK IoStatusBlock;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ FILE_FS_SIZE_INFORMATION FileFsSize;
+ /* If no path provided, get root path */
+ RootPath = lpDirectoryName;
if (lpDirectoryName == NULL)
- lpDirectoryName = L"\\";
+ {
+ RootPath = L"\\";
+ }
- hFile = InternalOpenDirW(lpDirectoryName, FALSE);
- if (INVALID_HANDLE_VALUE == hFile)
+ /* Convert the path to NT path */
+ if (!RtlDosPathNameToNtPathName_U(RootPath, &FileName, NULL, NULL))
{
+ SetLastError(ERROR_PATH_NOT_FOUND);
return FALSE;
}
- if (lpFreeBytesAvailableToCaller != NULL || lpTotalNumberOfBytes != NULL)
+ /* Open it for disk space query! */
+ InitializeObjectAttributes(&ObjectAttributes, &FileName,
+ OBJ_CASE_INSENSITIVE, NULL, NULL);
+ Status = NtOpenFile(&RootHandle, SYNCHRONIZE, &ObjectAttributes, &IoStatusBlock,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_FREE_SPACE_QUERY);
+ if (!NT_SUCCESS(Status))
{
- /* To get the free space available to the user associated with the
- current thread, try FileFsFullSizeInformation. If this is not
- supported by the file system, fall back to FileFsSize */
+ BaseSetLastNTError(Status);
+ /* If error conversion lead to file not found, override to use path not found
+ * which is more accurate
+ */
+ if (GetLastError() == ERROR_FILE_NOT_FOUND)
+ {
+ SetLastError(ERROR_PATH_NOT_FOUND);
+ }
- Status = NtQueryVolumeInformationFile(hFile,
- &IoStatusBlock,
- &FsInfo.FsFullSize,
- sizeof(FsInfo.FsFullSize),
- FileFsFullSizeInformation);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer);
+
+ return FALSE;
+ }
+
+ RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer);
+ /* If user asks for lpTotalNumberOfFreeBytes, try to use full size information */
+ if (lpTotalNumberOfFreeBytes != NULL)
+ {
+ FILE_FS_FULL_SIZE_INFORMATION FileFsFullSize;
+
+ /* Issue the full fs size request */
+ Status = NtQueryVolumeInformationFile(RootHandle, &IoStatusBlock, &FileFsFullSize,
+ sizeof(FILE_FS_FULL_SIZE_INFORMATION),
+ FileFsFullSizeInformation);
+ /* If it succeed, complete out buffers */
if (NT_SUCCESS(Status))
{
- /* Close the handle before returning data
- to avoid a handle leak in case of a fault! */
- CloseHandle(hFile);
+ /* We can close here, we'll return */
+ NtClose(RootHandle);
- BytesPerCluster.QuadPart =
- FsInfo.FsFullSize.BytesPerSector * FsInfo.FsFullSize.SectorsPerAllocationUnit;
+ /* Compute the size of an AU */
+ BytesPerAllocationUnit = FileFsFullSize.SectorsPerAllocationUnit * FileFsFullSize.BytesPerSector;
+ /* And then return what was asked */
if (lpFreeBytesAvailableToCaller != NULL)
{
- lpFreeBytesAvailableToCaller->QuadPart =
- BytesPerCluster.QuadPart * FsInfo.FsFullSize.CallerAvailableAllocationUnits.QuadPart;
+ lpFreeBytesAvailableToCaller->QuadPart = FileFsFullSize.CallerAvailableAllocationUnits.QuadPart * BytesPerAllocationUnit;
}
if (lpTotalNumberOfBytes != NULL)
{
- lpTotalNumberOfBytes->QuadPart =
- BytesPerCluster.QuadPart * FsInfo.FsFullSize.TotalAllocationUnits.QuadPart;
+ lpTotalNumberOfBytes->QuadPart = FileFsFullSize.TotalAllocationUnits.QuadPart * BytesPerAllocationUnit;
}
- if (lpTotalNumberOfFreeBytes != NULL)
- {
- lpTotalNumberOfFreeBytes->QuadPart =
- BytesPerCluster.QuadPart * FsInfo.FsFullSize.ActualAvailableAllocationUnits.QuadPart;
- }
+ /* No need to check for nullness ;-) */
+ lpTotalNumberOfFreeBytes->QuadPart = FileFsFullSize.ActualAvailableAllocationUnits.QuadPart * BytesPerAllocationUnit;
return TRUE;
}
}
- Status = NtQueryVolumeInformationFile(hFile,
- &IoStatusBlock,
- &FsInfo.FsSize,
- sizeof(FsInfo.FsSize),
+ /* Otherwise, fallback to normal size information */
+ Status = NtQueryVolumeInformationFile(RootHandle, &IoStatusBlock,
+ &FileFsSize, sizeof(FILE_FS_SIZE_INFORMATION),
FileFsSizeInformation);
-
- /* Close the handle before returning data
- to avoid a handle leak in case of a fault! */
- CloseHandle(hFile);
-
+ NtClose(RootHandle);
if (!NT_SUCCESS(Status))
{
- BaseSetLastNTError (Status);
+ BaseSetLastNTError(Status);
return FALSE;
}
- BytesPerCluster.QuadPart =
- FsInfo.FsSize.BytesPerSector * FsInfo.FsSize.SectorsPerAllocationUnit;
+ /* Compute the size of an AU */
+ BytesPerAllocationUnit = FileFsSize.SectorsPerAllocationUnit * FileFsSize.BytesPerSector;
- if (lpFreeBytesAvailableToCaller)
+ /* And then return what was asked, available is free, the same! */
+ if (lpFreeBytesAvailableToCaller != NULL)
{
- lpFreeBytesAvailableToCaller->QuadPart =
- BytesPerCluster.QuadPart * FsInfo.FsSize.AvailableAllocationUnits.QuadPart;
+ lpFreeBytesAvailableToCaller->QuadPart = FileFsSize.AvailableAllocationUnits.QuadPart * BytesPerAllocationUnit;
}
- if (lpTotalNumberOfBytes)
+ if (lpTotalNumberOfBytes != NULL)
{
- lpTotalNumberOfBytes->QuadPart =
- BytesPerCluster.QuadPart * FsInfo.FsSize.TotalAllocationUnits.QuadPart;
+ lpTotalNumberOfBytes->QuadPart = FileFsSize.TotalAllocationUnits.QuadPart * BytesPerAllocationUnit;
}
- if (lpTotalNumberOfFreeBytes)
+ if (lpTotalNumberOfFreeBytes != NULL)
{
- lpTotalNumberOfFreeBytes->QuadPart =
- BytesPerCluster.QuadPart * FsInfo.FsSize.AvailableAllocationUnits.QuadPart;
+ lpTotalNumberOfFreeBytes->QuadPart = FileFsSize.AvailableAllocationUnits.QuadPart * BytesPerAllocationUnit;
}
return TRUE;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
This is an automated email from the git hooks/post-receive script.
www-data pushed a commit to branch master
in repository reactos.
View the commit online:
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=55ae20931f5a4b356055b…
commit 55ae20931f5a4b356055b139fab898fd3e361caf
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Wed Oct 4 18:04:35 2017 +0200
[FREELDR] Properly check for end-of-memory-map entries when skipping ranges smaller than page size.
CORE-12881
Signed-off-by: Timo Kreuzer <timo.kreuzer(a)reactos.org>
---
boot/freeldr/freeldr/arch/i386/pcmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/boot/freeldr/freeldr/arch/i386/pcmem.c b/boot/freeldr/freeldr/arch/i386/pcmem.c
index 169070ee6f..61cd694070 100644
--- a/boot/freeldr/freeldr/arch/i386/pcmem.c
+++ b/boot/freeldr/freeldr/arch/i386/pcmem.c
@@ -318,7 +318,7 @@ PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSi
PcBiosMapCount,
PcBiosMemoryMap[PcBiosMapCount].BaseAddress,
PcBiosMemoryMap[PcBiosMapCount].Length);
- continue;
+ goto nextRange;
}
/* Calculate the length of the aligned range */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
This is an automated email from the git hooks/post-receive script.
www-data pushed a commit to branch master
in repository reactos.
View the commit online:
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f588de2e79e67fc7878e7…
commit f588de2e79e67fc7878e71dccb4ea67debdacf5e
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Tue Oct 3 09:00:03 2017 +0200
[FREELDR] Improve trace prints in pcmem.c, no logical changes
CORE-12881
Signed-off-by: Timo Kreuzer <timo.kreuzer(a)reactos.org>
---
boot/freeldr/freeldr/arch/i386/pcmem.c | 60 ++++++++++++++++++++++++----------
1 file changed, 43 insertions(+), 17 deletions(-)
diff --git a/boot/freeldr/freeldr/arch/i386/pcmem.c b/boot/freeldr/freeldr/arch/i386/pcmem.c
index 3f15155fdb..bb38762bc7 100644
--- a/boot/freeldr/freeldr/arch/i386/pcmem.c
+++ b/boot/freeldr/freeldr/arch/i386/pcmem.c
@@ -129,7 +129,7 @@ GetExtendedMemoryConfiguration(ULONG* pMemoryAtOneMB /* in KB */, ULONG* pMemory
*pMemoryAtOneMB = (*pMemoryAtOneMB << 8);
TRACE("Int15h Failed\n");
- TRACE("CMOS reports: 0x%x\n", *pMemoryAtOneMB);
+ TRACE("CMOS reports: 0x%lx\n", *pMemoryAtOneMB);
if (*pMemoryAtOneMB != 0)
{
@@ -144,7 +144,7 @@ PcMemGetConventionalMemorySize(VOID)
{
REGS Regs;
- TRACE("GetConventionalMemorySize()\n");
+ TRACE("PcMemGetConventionalMemorySize()\n");
/* Int 12h
* BIOS - GET MEMORY SIZE
@@ -204,9 +204,10 @@ PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSi
ULONGLONG RealBaseAddress, EndAddress, RealSize;
TYPE_OF_MEMORY MemoryType;
ULONG Size, RequiredSize;
+
ASSERT(PcBiosMapCount == 0);
- TRACE("GetBiosMemoryMap()\n");
+ TRACE("PcMemGetBiosMemoryMap()\n");
/* Make sure the usable memory is large enough. To do this we check the 16
bit value at address 0x413 inside the BDA, which gives us the usable size
@@ -219,8 +220,8 @@ PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSi
MEMORY_INIT_FAILURE,
__FILE__,
__LINE__,
- "The BIOS reported a usable memory range up to 0x%x, which is too small!\n"
- "Required size is 0x%x\n\n"
+ "The BIOS reported a usable memory range up to 0x%lx, which is too small!\n"
+ "Required size is 0x%lx\n\n"
"If you see this, please report to the ReactOS team!",
Size, RequiredSize);
}
@@ -256,17 +257,26 @@ PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSi
Regs.w.di = BIOSCALLBUFOFFSET;
Int386(0x15, &Regs, &Regs);
- TRACE("Memory Map Entry %d\n", PcBiosMapCount);
+ TRACE("Memory Map Entry %lu\n", PcBiosMapCount);
TRACE("Int15h AX=E820h\n");
- TRACE("EAX = 0x%x\n", Regs.x.eax);
- TRACE("EBX = 0x%x\n", Regs.x.ebx);
- TRACE("ECX = 0x%x\n", Regs.x.ecx);
+ TRACE("EAX = 0x%lx\n", Regs.x.eax);
+ TRACE("EBX = 0x%lx\n", Regs.x.ebx);
+ TRACE("ECX = 0x%lx\n", Regs.x.ecx);
TRACE("CF set = %s\n", (Regs.x.eflags & EFLAGS_CF) ? "TRUE" : "FALSE");
/* If the BIOS didn't return 'SMAP' in EAX then
- * it doesn't support this call. If CF is set, we're done */
- if (Regs.x.eax != 0x534D4150 || !INT386_SUCCESS(Regs))
+ * it doesn't support this call. */
+ if (Regs.x.eax != 0x534D4150)
+ {
+ WARN("BIOS doesn't support Int15h AX=E820h!\n\n");
+ break;
+ }
+
+ /* If the carry flag is set,
+ * then this call was past the last entry, so we're done. */
+ if (!INT386_SUCCESS(Regs))
{
+ TRACE("End of System Memory Map! (Past last)\n\n");
break;
}
@@ -297,6 +307,10 @@ PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSi
if (EndAddress <= RealBaseAddress)
{
/* This doesn't span any page, so continue with next range */
+ TRACE("Skipping aligned range < PAGE_SIZE. (PcBiosMapCount = %lu, BaseAddress = %lu, Length = %lu)\n",
+ PcBiosMapCount,
+ PcBiosMemoryMap[PcBiosMapCount].BaseAddress,
+ PcBiosMemoryMap[PcBiosMapCount].Length);
continue;
}
@@ -321,7 +335,19 @@ PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSi
}
/* Check if we can add this descriptor */
- if ((RealSize >= MM_PAGE_SIZE) && (PcMapCount < MaxMemoryMapSize))
+ if (RealSize < MM_PAGE_SIZE)
+ {
+ TRACE("Skipping aligned range < MM_PAGE_SIZE. (PcBiosMapCount = %lu, BaseAddress = %lu, Length = %lu)\n",
+ PcBiosMapCount,
+ PcBiosMemoryMap[PcBiosMapCount].BaseAddress,
+ PcBiosMemoryMap[PcBiosMapCount].Length);
+ }
+ else if (PcMapCount >= MaxMemoryMapSize)
+ {
+ ERR("PcMemoryMap is already full! (PcBiosMapCount = %lu, PcMapCount = %lu (>= %lu))\n",
+ PcBiosMapCount, PcMapCount, MaxMemoryMapSize);
+ }
+ else
{
/* Add the descriptor */
PcMapCount = AddMemoryDescriptor(PcMemoryMap,
@@ -333,17 +359,16 @@ PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSi
PcBiosMapCount++;
- /* If the continuation value is zero or the
- * carry flag is set then this was
- * the last entry so we're done */
+ /* If the continuation value is zero,
+ * then this was the last entry, so we're done. */
if (Regs.x.ebx == 0x00000000)
{
- TRACE("End Of System Memory Map!\n\n");
+ TRACE("End of System Memory Map! (Reset)\n\n");
break;
}
}
- TRACE("GetBiosMemoryMap end, PcBiosMapCount = %ld\n", PcBiosMapCount);
+ TRACE("PcMemGetBiosMemoryMap end: PcBiosMapCount = %lu\n", PcBiosMapCount);
return PcBiosMapCount;
}
@@ -415,6 +440,7 @@ PcMemGetMemoryMap(ULONG *MemoryMapSize)
ULONG ExtendedMemorySizeAtOneMB;
ULONG ExtendedMemorySizeAtSixteenMB;
ULONG EbdaBase, EbdaSize;
+
TRACE("PcMemGetMemoryMap()\n");
EntryCount = PcMemGetBiosMemoryMap(PcMemoryMap, MAX_BIOS_DESCRIPTORS);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
This is an automated email from the git hooks/post-receive script.
www-data pushed a commit to branch master
in repository reactos.
View the commit online:
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=75f1637f37d8f5ae700e7…
commit 75f1637f37d8f5ae700e766aed7cc848e37e5f8f
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Wed Oct 4 21:13:25 2017 +0200
[CLASS2]: Fix status code on too small as exposed by kernel32:DeviceIoControl
---
drivers/storage/class/class2/class2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/storage/class/class2/class2.c b/drivers/storage/class/class2/class2.c
index 2f81022c5d..52fdf53d5e 100644
--- a/drivers/storage/class/class2/class2.c
+++ b/drivers/storage/class/class2/class2.c
@@ -4059,9 +4059,9 @@ Return Value:
if (irpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUNTDEV_NAME)) {
Irp->IoStatus.Information = 0;
- Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
+ Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
- status = STATUS_BUFFER_TOO_SMALL;
+ status = STATUS_INVALID_PARAMETER;
goto SetStatusAndReturn;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
This is an automated email from the git hooks/post-receive script.
www-data pushed a commit to branch master
in repository reactos.
View the commit online:
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9f8693a4e4861a36d4dc7…
commit 9f8693a4e4861a36d4dc7145f23201571a518f54
Author: Alexander Shaposhnikov <sanchaez(a)hotmail.com>
AuthorDate: Wed Oct 4 21:58:32 2017 +0300
Delete README
---
README | 32 --------------------------------
1 file changed, 32 deletions(-)
diff --git a/README b/README
deleted file mode 100644
index dcb2d9bddd..0000000000
--- a/README
+++ /dev/null
@@ -1,32 +0,0 @@
-========================
-ReactOS� Version 0.4.x
-Updated January 5, 2016
-========================
-
-1. What is ReactOS?
--------------------
-
-ReactOS� is an Open Source effort to develop a quality operating system that is
-compatible with applications and drivers written for the Microsoft� Windows� NT
-family of operating systems (NT4, 2000, XP, 2003, Vista, Seven).
-
-The ReactOS project, although currently focused on Windows Server 2003
-compatibility, is always keeping an eye toward compatibility with
-Windows Vista and future Windows NT releases.
-
-More information is available at: https://www.reactos.org
-
-2. Building ReactOS
--------------------
-
-See the INSTALL file for more details.
-
-3. More information
--------------------
-
-See the media\doc subdirectory for some sparse notes.
-
-4. Who is responsible
----------------------
-
-See the CREDITS file.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.