[ros-diffs] [reactos] 01/01: [KERNEL32_APITEST]: Add tests for IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME that show its usage is "one-shot". Once queried, it gets forgotten.

2017-10-08 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d788a52c79f5822cc8a21920de421b77519ebd94

commit d788a52c79f5822cc8a21920de421b77519ebd94
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Oct 8 10:12:08 2017 +0200

[KERNEL32_APITEST]: Add tests for IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME 
that show its usage is "one-shot". Once queried, it gets forgotten.
---
 .../rostests/apitests/kernel32/DeviceIoControl.c   | 37 ++
 1 file changed, 37 insertions(+)

diff --git a/modules/rostests/apitests/kernel32/DeviceIoControl.c 
b/modules/rostests/apitests/kernel32/DeviceIoControl.c
index faa10d5465..be3086edda 100644
--- a/modules/rostests/apitests/kernel32/DeviceIoControl.c
+++ b/modules/rostests/apitests/kernel32/DeviceIoControl.c
@@ -183,6 +183,42 @@ QueryUniqueId(VOID)
 HeapFree(GetProcessHeap(), 0, AllocatedMUI);
 }
 
+static
+VOID
+QuerySuggestedLinkName(VOID)
+{
+UINT Ret;
+DWORD Size, Error;
+MOUNTDEV_SUGGESTED_LINK_NAME MSLN;
+
+Size = 0;
+Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME, 
NULL, 0, , sizeof(MSLN) - 1, , NULL);
+ok_type(Ret == 0, "DeviceIoControl succeed\n");
+Error = GetLastError();
+if (DriveType == DRIVE_FIXED)
+{
+ok_type(Error == ERROR_INVALID_PARAMETER, "Expecting 
ERROR_INVALID_PARAMETER, got %ld\n", Error);
+}
+else
+{
+ok_type(Error == ERROR_INSUFFICIENT_BUFFER, "Expecting 
ERROR_INSUFFICIENT_BUFFER, got %ld\n", Error);
+}
+ok_type(Size == 0, "Invalid output size: %ld\n", Size);
+
+Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME, 
NULL, 0, , sizeof(MSLN), , NULL);
+ok_type(Ret == 0, "DeviceIoControl succeed\n");
+Error = GetLastError();
+if (DriveType == DRIVE_FIXED)
+{
+ok_type(Error == ERROR_NOT_FOUND, "Expecting ERROR_NOT_FOUND, got 
%ld\n", Error);
+}
+else
+{
+ok_type(Error == ERROR_FILE_NOT_FOUND, "Expecting 
ERROR_FILE_NOT_FOUND, got %ld\n", Error);
+}
+ok_type(Size == 0, "Invalid output size: %ld\n", Size);
+}
+
 START_TEST(DeviceIoControl)
 {
 UINT Ret;
@@ -221,6 +257,7 @@ START_TEST(DeviceIoControl)
 {
 QueryDeviceName();
 QueryUniqueId();
+QuerySuggestedLinkName();
 }
 
 CloseHandle(Device);



[ros-diffs] [reactos] 01/02: [CLASS2]: - In ScsiClassCreateDeviceObject() don't drop received object name and store it in the device extension - Implement support for the IOCTL_MOUNTDEV_QUERY_DEVICE_N

2017-10-03 Thread Pierre Schweitzer
This is an automated email from the git hooks/post-receive script.

root pushed a commit to branch master
in repository reactos.

View the commit online:
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fdb72d7f85a3fd65eb1f51c2ad0be61f46357527

commit fdb72d7f85a3fd65eb1f51c2ad0be61f46357527
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Tue Oct 3 20:57:50 2017 +0200

[CLASS2]: - In ScsiClassCreateDeviceObject() don't drop received object 
name and store it in the device extension
- Implement support for the IOCTL_MOUNTDEV_QUERY_DEVICE_NAME IOCTL; return 
the store device name
---
 drivers/storage/class/class2/class2.c  | 48 +++---
 drivers/storage/class/include/class2.h |  1 +
 2 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/drivers/storage/class/class2/class2.c 
b/drivers/storage/class/class2/class2.c
index 20f55efc07..48598e37b8 100644
--- a/drivers/storage/class/class2/class2.c
+++ b/drivers/storage/class/class2/class2.c
@@ -4041,9 +4041,9 @@ Return Value:
 goto SetStatusAndReturn;
 }
 
-if (irpStack->Parameters.DeviceIoControl.IoControlCode == 
IOCTL_MOUNTDEV_QUERY_DEVICE_NAME || 
-irpStack->Parameters.DeviceIoControl.IoControlCode == 
IOCTL_MOUNTDEV_QUERY_UNIQUE_ID ||
+if (irpStack->Parameters.DeviceIoControl.IoControlCode == 
IOCTL_MOUNTDEV_QUERY_UNIQUE_ID ||
 irpStack->Parameters.DeviceIoControl.IoControlCode == 
IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME) {
+
 UNIMPLEMENTED;
 Irp->IoStatus.Information = 0;
 Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
@@ -4052,6 +4052,40 @@ Return Value:
 goto SetStatusAndReturn;
 }
 
+if (irpStack->Parameters.DeviceIoControl.IoControlCode == 
IOCTL_MOUNTDEV_QUERY_DEVICE_NAME) {
+
+PMOUNTDEV_NAME name = Irp->AssociatedIrp.SystemBuffer;
+
+if (irpStack->Parameters.DeviceIoControl.OutputBufferLength < 
sizeof(MOUNTDEV_NAME)) {
+
+Irp->IoStatus.Information = 0;
+Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
+IoCompleteRequest(Irp, IO_NO_INCREMENT);
+status = STATUS_BUFFER_TOO_SMALL;
+goto SetStatusAndReturn;
+}
+
+RtlZeroMemory(name, sizeof(MOUNTDEV_NAME));
+name->NameLength = deviceExtension->DeviceName.Length;
+
+if (irpStack->Parameters.DeviceIoControl.OutputBufferLength < 
sizeof(USHORT) + name->NameLength) {
+
+Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME);
+Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW;
+IoCompleteRequest(Irp, IO_NO_INCREMENT);
+status = STATUS_BUFFER_OVERFLOW;
+goto SetStatusAndReturn;
+}
+
+RtlCopyMemory(name->Name, deviceExtension->DeviceName.Buffer,
+  name->NameLength);
+status = STATUS_SUCCESS;
+Irp->IoStatus.Status = STATUS_SUCCESS;
+Irp->IoStatus.Information = sizeof(USHORT) + name->NameLength;
+IoCompleteRequest(Irp, IO_NO_INCREMENT);
+goto SetStatusAndReturn;
+}
+
 srb = ExAllocatePool(NonPagedPool, SCSI_REQUEST_BLOCK_SIZE);
 
 if (srb == NULL) {
@@ -4691,20 +4725,14 @@ Return Value:
 } else {
 deviceExtension->PhysicalDevice = deviceObject;
 }
+
+deviceExtension->DeviceName = ntUnicodeString;
 }
 
 deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
 
 *DeviceObject = deviceObject;
 
-RtlFreeUnicodeString();
-
-//
-// Indicate the ntUnicodeString is free.
-//
-
-ntUnicodeString.Buffer = NULL;
-
 return status;
 }
 
diff --git a/drivers/storage/class/include/class2.h 
b/drivers/storage/class/include/class2.h
index 047e48d4ac..e1e0cf01ef 100644
--- a/drivers/storage/class/include/class2.h
+++ b/drivers/storage/class/include/class2.h
@@ -132,6 +132,7 @@ typedef struct _DEVICE_EXTENSION
   HANDLE MediaChangeEventHandle;
   BOOLEAN MediaChangeNoMedia;
   ULONG MediaChangeCount;
+  UNICODE_STRING DeviceName;
 } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.



[ros-diffs] [reactos] 02/02: [CLASS2]: Cosmetic fixes by Thomas

2017-10-03 Thread Pierre Schweitzer
This is an automated email from the git hooks/post-receive script.

root pushed a commit to branch master
in repository reactos.

View the commit online:
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e48d6a658fa214bc624ee58e6d87b4ac0d573db6

commit e48d6a658fa214bc624ee58e6d87b4ac0d573db6
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Tue Oct 3 21:21:09 2017 +0200

[CLASS2]: Cosmetic fixes by Thomas
---
 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 48598e37b8..2f81022c5d 100644
--- a/drivers/storage/class/class2/class2.c
+++ b/drivers/storage/class/class2/class2.c
@@ -4068,7 +4068,7 @@ Return Value:
 RtlZeroMemory(name, sizeof(MOUNTDEV_NAME));
 name->NameLength = deviceExtension->DeviceName.Length;
 
-if (irpStack->Parameters.DeviceIoControl.OutputBufferLength < 
sizeof(USHORT) + name->NameLength) {
+if (irpStack->Parameters.DeviceIoControl.OutputBufferLength < 
FIELD_OFFSET(MOUNTDEV_NAME, Name) + name->NameLength) {
 
 Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME);
 Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW;
@@ -4081,7 +4081,7 @@ Return Value:
   name->NameLength);
 status = STATUS_SUCCESS;
 Irp->IoStatus.Status = STATUS_SUCCESS;
-Irp->IoStatus.Information = sizeof(USHORT) + name->NameLength;
+Irp->IoStatus.Information = FIELD_OFFSET(MOUNTDEV_NAME, Name) + 
name->NameLength;
 IoCompleteRequest(Irp, IO_NO_INCREMENT);
 goto SetStatusAndReturn;
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.



[ros-diffs] [reactos] 01/01: [KERNEL32] Use proper size for allocating buffer in GetVolumeInformationA(). This was leading to allocate a too small buffer under certain conditions and to overrun it. Th

2017-10-14 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dc8bfeabcffeaf2bcdc6907af1313e7a7866314e

commit dc8bfeabcffeaf2bcdc6907af1313e7a7866314e
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Oct 14 23:19:12 2017 +0200

[KERNEL32] Use proper size for allocating buffer in 
GetVolumeInformationA(). This was leading to allocate a too small buffer under 
certain conditions and to overrun it.
This fixes JRE7 setup.
This regression was brought in by r75969.

CORE-13888
---
 dll/win32/kernel32/client/file/volume.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dll/win32/kernel32/client/file/volume.c 
b/dll/win32/kernel32/client/file/volume.c
index e59c291b67..90016b8e08 100644
--- a/dll/win32/kernel32/client/file/volume.c
+++ b/dll/win32/kernel32/client/file/volume.c
@@ -87,7 +87,7 @@ GetVolumeInformationA(IN LPCSTR lpRootPathName,
 /* If caller wants file system name, allocate a buffer to receive it */
 if (lpFileSystemNameBuffer != NULL)
 {
-FileSystemNameU.MaximumLength = sizeof(WCHAR) * (nVolumeNameSize + 1);
+FileSystemNameU.MaximumLength = sizeof(WCHAR) * (nFileSystemNameSize + 
1);
 FileSystemNameU.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0,
 
FileSystemNameU.MaximumLength);
 if (FileSystemNameU.Buffer == NULL)



[ros-diffs] [reactos] 01/02: [KERNEL32] Fix buffer size for allocation in GetVolumeInformationW(). This fixes function failing with big enough buffer.

2017-10-15 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5bfc68cc14a4fd157f5f6df716648ac67542e528

commit 5bfc68cc14a4fd157f5f6df716648ac67542e528
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Oct 15 10:43:49 2017 +0200

[KERNEL32] Fix buffer size for allocation in GetVolumeInformationW(). This 
fixes function failing with big enough buffer.
---
 dll/win32/kernel32/client/file/volume.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/dll/win32/kernel32/client/file/volume.c 
b/dll/win32/kernel32/client/file/volume.c
index 90016b8e08..ba0ef82f5d 100644
--- a/dll/win32/kernel32/client/file/volume.c
+++ b/dll/win32/kernel32/client/file/volume.c
@@ -253,6 +253,10 @@ GetVolumeInformationW(IN LPCWSTR lpRootPathName,
 RootPathName = lpRootPathName;
 }
 
+/* Convert length to bytes */
+nVolumeNameSize *= sizeof(WCHAR);
+nFileSystemNameSize *= sizeof(WCHAR);
+
 /* Convert to NT name */
 if (!RtlDosPathNameToNtPathName_U(RootPathName, , NULL, NULL))
 {



[ros-diffs] [reactos] 02/02: [KERNEL32_APITEST] Add a few tests for GetVolumeInformation that were used to fix previous issues

2017-10-15 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eb05356a2615e0f0794389358f52676e8aaa3aae

commit eb05356a2615e0f0794389358f52676e8aaa3aae
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Oct 15 10:44:50 2017 +0200

[KERNEL32_APITEST] Add a few tests for GetVolumeInformation that were used 
to fix previous issues
---
 modules/rostests/apitests/kernel32/CMakeLists.txt  |   1 +
 .../apitests/kernel32/GetVolumeInformation.c   | 127 +
 modules/rostests/apitests/kernel32/testlist.c  |   2 +
 3 files changed, 130 insertions(+)

diff --git a/modules/rostests/apitests/kernel32/CMakeLists.txt 
b/modules/rostests/apitests/kernel32/CMakeLists.txt
index 32debf9476..86107d733d 100644
--- a/modules/rostests/apitests/kernel32/CMakeLists.txt
+++ b/modules/rostests/apitests/kernel32/CMakeLists.txt
@@ -13,6 +13,7 @@ list(APPEND SOURCE
 GetCurrentDirectory.c
 GetDriveType.c
 GetModuleFileName.c
+GetVolumeInformation.c
 interlck.c
 IsDBCSLeadByteEx.c
 LoadLibraryExW.c
diff --git a/modules/rostests/apitests/kernel32/GetVolumeInformation.c 
b/modules/rostests/apitests/kernel32/GetVolumeInformation.c
new file mode 100644
index 00..7d2cf8bf3f
--- /dev/null
+++ b/modules/rostests/apitests/kernel32/GetVolumeInformation.c
@@ -0,0 +1,127 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Tests for GetVolumeInformation
+ * PROGRAMMER:  Pierre Schweitzer <pie...@reactos.org>
+ */
+
+#include 
+
+#define WIN32_NO_STATUS
+#include 
+
+static VOID
+TestGetVolumeInformationA(VOID)
+{
+BOOL Ret;
+CHAR Outbuf[MAX_PATH];
+DWORD i, MCL, Flags, Len;
+
+memset(Outbuf, 0xAA, MAX_PATH);
+Ret = GetVolumeInformationA("C:\\", NULL, 0, NULL, , , Outbuf, 
MAX_PATH);
+ok(Ret != FALSE, "GetVolumeInformationA failed: %ld\n", GetLastError());
+for (i = 0; i < MAX_PATH; ++i)
+{
+if (Outbuf[i] == 0)
+{
+break;
+}
+}
+ok(i != MAX_PATH, "String was not null terminated!\n");
+
+memset(Outbuf, 0xAA, MAX_PATH);
+Len = i;
+Ret = GetVolumeInformationA("C:\\", NULL, 0, NULL, , , Outbuf, 
Len + 1);
+ok(Ret != FALSE, "GetVolumeInformationA failed: %ld\n", GetLastError());
+for (i = 0; i < MAX_PATH; ++i)
+{
+if (Outbuf[i] == 0)
+{
+break;
+}
+}
+ok(i != MAX_PATH, "String was not null terminated!\n");
+ok(i == Len, "String was truncated\n");
+
+memset(Outbuf, 0xAA, MAX_PATH);
+Len = i;
+SetLastError(0xdeadbeef);
+Ret = GetVolumeInformationA("C:\\", NULL, 0, NULL, , , Outbuf, 
Len);
+ok(Ret != TRUE, "GetVolumeInformationA succeed\n");
+ok(GetLastError() == ERROR_BAD_LENGTH, "Expected ERROR_BAD_LENGTH error, 
got %ld\n", GetLastError());
+ok(Outbuf[0] != 0xAA, "Output buffer was not written to\n");
+for (i = 0; i < MAX_PATH; ++i)
+{
+if (Outbuf[i] == 0)
+{
+break;
+}
+}
+ok(i == MAX_PATH, "String was null terminated!\n");
+for (i = 0; i < MAX_PATH; ++i)
+{
+if (Outbuf[i] != 0xAA)
+{
+break;
+}
+}
+ok(i != MAX_PATH, "String was not written to!\n");
+ok(i < Len, "Buffer has been overruned\n");
+}
+
+static VOID
+TestGetVolumeInformationW(VOID)
+{
+BOOL Ret;
+WCHAR Outbuf[MAX_PATH];
+DWORD i, MCL, Flags, Len;
+
+memset(Outbuf, 0xAA, MAX_PATH);
+Ret = GetVolumeInformationW(L"C:\\", NULL, 0, NULL, , , Outbuf, 
MAX_PATH);
+ok(Ret != FALSE, "GetVolumeInformationW failed: %ld\n", GetLastError());
+for (i = 0; i < MAX_PATH; ++i)
+{
+if (Outbuf[i] == 0)
+{
+break;
+}
+}
+ok(i != MAX_PATH, "String was not null terminated!\n");
+
+memset(Outbuf, 0xAA, MAX_PATH);
+Len = i;
+Ret = GetVolumeInformationW(L"C:\\", NULL, 0, NULL, , , Outbuf, 
Len + 1);
+ok(Ret != FALSE, "GetVolumeInformationW failed: %ld\n", GetLastError());
+for (i = 0; i < MAX_PATH; ++i)
+{
+if (Outbuf[i] == 0)
+{
+break;
+}
+}
+ok(i != MAX_PATH, "String was not null terminated!\n");
+ok(i == Len, "String was truncated\n");
+
+memset(Outbuf, 0xAA, MAX_PATH);
+Len = i;
+SetLastError(0xdeadbeef);
+Ret = GetVolumeInformationW(L"C:\\", NULL, 0, NULL, , , Outbuf, 
Len);
+ok(Ret != TRUE, "GetVolumeInformationW succeed\n");
+ok(GetLastError() == ERROR_BAD_LENGTH, "Expected ERROR_BAD_LENGTH error, 
got %ld\n", GetLastError());
+ok(Outbuf[0] != 0xAA, "Output buffer was not written to\n");
+for (i = 0; i < M

[ros-diffs] [reactos] 02/04: [SHELLBTRFS] Upgrade to 1.0.1 CID 1419312

2017-10-16 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fb2a56e02adafb7751c5bb1253323c716c1f1682

commit fb2a56e02adafb7751c5bb1253323c716c1f1682
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Oct 16 20:20:21 2017 +0200

[SHELLBTRFS] Upgrade to 1.0.1
CID 1419312

CORE-13896
---
 dll/shellext/shellbtrfs/send.cpp  |  2 +
 dll/shellext/shellbtrfs/shellbtrfs.rc | 86 +--
 2 files changed, 45 insertions(+), 43 deletions(-)

diff --git a/dll/shellext/shellbtrfs/send.cpp b/dll/shellext/shellbtrfs/send.cpp
index 7a582d4224..220d5e212c 100644
--- a/dll/shellext/shellbtrfs/send.cpp
+++ b/dll/shellext/shellbtrfs/send.cpp
@@ -562,6 +562,7 @@ void CALLBACK SendSubvolGUIW(HWND hwnd, HINSTANCE hinst, 
LPWSTR lpszCmdLine, int
 
 if (!LookupPrivilegeValueW(NULL, L"SeManageVolumePrivilege", )) {
 ShowError(hwnd, GetLastError());
+CloseHandle(token);
 return;
 }
 
@@ -571,6 +572,7 @@ void CALLBACK SendSubvolGUIW(HWND hwnd, HINSTANCE hinst, 
LPWSTR lpszCmdLine, int
 
 if (!AdjustTokenPrivileges(token, FALSE, , sizeof(TOKEN_PRIVILEGES), 
NULL, NULL)) {
 ShowError(hwnd, GetLastError());
+CloseHandle(token);
 return;
 }
 
diff --git a/dll/shellext/shellbtrfs/shellbtrfs.rc 
b/dll/shellext/shellbtrfs/shellbtrfs.rc
index bf4e7c080d..23d46d238b 100644
--- a/dll/shellext/shellbtrfs/shellbtrfs.rc
+++ b/dll/shellext/shellbtrfs/shellbtrfs.rc
@@ -13,13 +13,11 @@
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /
-// English (U.K.) resources
+// English (United Kingdom) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
-#ifdef _WIN32
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
 #pragma code_page(1252)
-#endif //_WIN32
 
 #ifdef APSTUDIO_INVOKED
 /
@@ -27,18 +25,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
 // TEXTINCLUDE
 //
 
-1 TEXTINCLUDE
+1 TEXTINCLUDE 
 BEGIN
 "resource.h\0"
 END
 
-2 TEXTINCLUDE
+2 TEXTINCLUDE 
 BEGIN
 "#include ""winres.h""\r\n"
 "\0"
 END
 
-3 TEXTINCLUDE
+3 TEXTINCLUDE 
 BEGIN
 "\r\n"
 "\0"
@@ -56,14 +54,15 @@ END
 // remains consistent on all systems.
 IDI_ICON1   ICON"subvol.ico"
 
+
 /
 //
 // Version
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
+ FILEVERSION 1,0,1,0
+ PRODUCTVERSION 1,0,1,0
  FILEFLAGSMASK 0x17L
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -79,12 +78,12 @@ BEGIN
 BLOCK "080904b0"
 BEGIN
 VALUE "FileDescription", "WinBtrfs shell extension"
-VALUE "FileVersion", "1.0"
+VALUE "FileVersion", "1.0.1"
 VALUE "InternalName", "btrfs"
 VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-17"
 VALUE "OriginalFilename", "shellbtrfs.dll"
 VALUE "ProductName", "WinBtrfs"
-VALUE "ProductVersion", "1.0"
+VALUE "ProductVersion", "1.0.1"
 END
 END
 BLOCK "VarFileInfo"
@@ -484,6 +483,7 @@ END
 
 2   RT_MANIFEST "shellbtrfs.manifest"
 
+
 /
 //
 // String Table
@@ -575,9 +575,9 @@ BEGIN
 IDS_DEVLIST_READONLY_NO "No"
 IDS_DEVLIST_ALLOC   "Allocated"
 IDS_DEVLIST_ALLOC_PC"%"
-IDS_BALANCE_RUNNING_REMOVAL
+IDS_BALANCE_RUNNING_REMOVAL 
 "Currently removing device %llu (%llu out of %llu 
chunks processed, %1.1f%%)"
-IDS_BALANCE_PAUSED_REMOVAL
+IDS_BALANCE_PAUSED_REMOVAL 
 "Removal of device %llu paused (%llu out of %llu 
chunks processed, %1.1f%%)"
 IDS_BALANCE_CANCELLED_REMOVAL "Device removal cancelled."
 IDS_BALANCE_COMPLETE_REMOVAL "Device removal completed successfully."
@@ -588,12 +588,12 @@ END
 STRINGTABLE
 BEGIN
 IDS_CANNOT_REMOVE_RAID  "The current RAID levels do not allow this device 
to be removed. You must do a conversion balance before you will be able to 
proceed."
-IDS_REMOVE_DEVICE_CONFIRMATION
+IDS_REMOVE_DEVICE_CONFIRMATION 
 "Are you sure that you want to remove device %s, 
%s?"
 IDS_CONFIRMATION_TITLE  "Confirmation"
-IDS_ADD_DEVICE_CONFIRMATION
+IDS_ADD_DEVICE_CONFIRMATION 
 "Are you sure that you want to add this device?

[ros-diffs] [reactos] 01/04: [BTRFS] Upgrade to BtrFS 1.0.1 CID 1419459, 1419378

2017-10-16 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4672b2ba5e111fe9730cdbf4e51fb28c1ce7d473

commit 4672b2ba5e111fe9730cdbf4e51fb28c1ce7d473
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Oct 16 20:05:33 2017 +0200

[BTRFS] Upgrade to BtrFS 1.0.1
CID 1419459, 1419378

CORE-13896
---
 drivers/filesystems/btrfs/balance.c |   4 +-
 drivers/filesystems/btrfs/btrfs.c   |  66 +++---
 drivers/filesystems/btrfs/btrfs.rc  |   8 +-
 drivers/filesystems/btrfs/btrfs_drv.h   |  54 -
 drivers/filesystems/btrfs/create.c  | 208 ++--
 drivers/filesystems/btrfs/dirctrl.c |  11 +-
 drivers/filesystems/btrfs/fileinfo.c|  22 ++--
 drivers/filesystems/btrfs/flushthread.c |   9 +-
 drivers/filesystems/btrfs/fsctl.c   |  37 +++---
 drivers/filesystems/btrfs/pnp.c |   8 +-
 drivers/filesystems/btrfs/read.c|  21 ++--
 drivers/filesystems/btrfs/reparse.c |  16 ++-
 drivers/filesystems/btrfs/search.c  |   3 +-
 drivers/filesystems/btrfs/volume.c  |   2 +-
 drivers/filesystems/btrfs/write.c   |  12 +-
 15 files changed, 329 insertions(+), 152 deletions(-)

diff --git a/drivers/filesystems/btrfs/balance.c 
b/drivers/filesystems/btrfs/balance.c
index cf9717480d..980089618a 100644
--- a/drivers/filesystems/btrfs/balance.c
+++ b/drivers/filesystems/btrfs/balance.c
@@ -2112,7 +2112,7 @@ end:
 // update open FCBs
 // FIXME - speed this up(?)
 
-ExAcquireResourceSharedLite(>fcb_lock, TRUE);
+acquire_fcb_lock_shared(Vcb);
 
 le = Vcb->all_fcbs.Flink;
 while (le != >all_fcbs) {
@@ -2153,7 +2153,7 @@ end:
 le = le->Flink;
 }
 
-ExReleaseResourceLite(>fcb_lock);
+release_fcb_lock(Vcb);
 } else
 do_rollback(Vcb, );
 
diff --git a/drivers/filesystems/btrfs/btrfs.c 
b/drivers/filesystems/btrfs/btrfs.c
index 0e3e917531..236184eafa 100644
--- a/drivers/filesystems/btrfs/btrfs.c
+++ b/drivers/filesystems/btrfs/btrfs.c
@@ -1352,7 +1352,7 @@ void send_notification_fcb(_In_ file_ref* fileref, _In_ 
ULONG filter_match, _In_
 return;
 }
 
-ExAcquireResourceExclusiveLite(>Vcb->fcb_lock, TRUE);
+acquire_fcb_lock_exclusive(fcb->Vcb);
 
 le = fcb->hardlinks.Flink;
 while (le != >hardlinks) {
@@ -1419,7 +1419,7 @@ void send_notification_fcb(_In_ file_ref* fileref, _In_ 
ULONG filter_match, _In_
 le = le->Flink;
 }
 
-ExReleaseResourceLite(>Vcb->fcb_lock);
+release_fcb_lock(fcb->Vcb);
 }
 
 void mark_fcb_dirty(_In_ fcb* fcb) {
@@ -1698,14 +1698,14 @@ static NTSTATUS close_file(_In_ PFILE_OBJECT 
FileObject, _In_ PIRP Irp) {
 
 Vcb = fcb->Vcb;
 
-ExAcquireResourceExclusiveLite(>fcb_lock, TRUE);
+acquire_fcb_lock_exclusive(Vcb);
 
 if (fileref)
 free_fileref(fcb->Vcb, fileref);
 else
 free_fcb(Vcb, fcb);
 
-ExReleaseResourceLite(>fcb_lock);
+release_fcb_lock(Vcb);
 
 return STATUS_SUCCESS;
 }
@@ -1804,10 +1804,10 @@ void uninit(_In_ device_extension* Vcb, _In_ BOOL 
flush) {
 KeSetTimer(>flush_thread_timer, time, NULL); // trigger the timer 
early
 KeWaitForSingleObject(>flush_thread_finished, Executive, KernelMode, 
FALSE, NULL);
 
-ExAcquireResourceExclusiveLite(>fcb_lock, TRUE);
+acquire_fcb_lock_exclusive(Vcb);
 free_fcb(Vcb, Vcb->volume_fcb);
 free_fcb(Vcb, Vcb->dummy_fcb);
-ExReleaseResourceLite(>fcb_lock);
+release_fcb_lock(Vcb);
 
 if (Vcb->root_file)
 ObDereferenceObject(Vcb->root_file);
@@ -1817,9 +1817,9 @@ void uninit(_In_ device_extension* Vcb, _In_ BOOL flush) {
 chunk* c = CONTAINING_RECORD(le, chunk, list_entry);
 
 if (c->cache) {
-ExAcquireResourceExclusiveLite(>fcb_lock, TRUE);
+acquire_fcb_lock_exclusive(Vcb);
 free_fcb(Vcb, c->cache);
-ExReleaseResourceLite(>fcb_lock);
+release_fcb_lock(Vcb);
 c->cache = NULL;
 }
 
@@ -1855,9 +1855,9 @@ void uninit(_In_ device_extension* Vcb, _In_ BOOL flush) {
 ExFreePool(c->devices);
 
 if (c->cache) {
-ExAcquireResourceExclusiveLite(>fcb_lock, TRUE);
+acquire_fcb_lock_exclusive(Vcb);
 free_fcb(Vcb, c->cache);
-ExReleaseResourceLite(>fcb_lock);
+release_fcb_lock(Vcb);
 }
 
 ExDeleteResourceLite(>range_locks_lock);
@@ -1915,7 +1915,7 @@ void uninit(_In_ device_extension* Vcb, _In_ BOOL flush) {
 ZwClose(Vcb->flush_thread_handle);
 }
 
-NTSTATUS delete_fileref(_In_ file_ref* fileref, _In_ PFILE_OBJECT FileObject, 
_In_opt_ PIRP Irp, _In_ LIST_ENTRY* rollback) {
+NTSTATUS delete_fileref(_In_ file_ref* fileref, _In_opt_ PFILE_OBJECT 
FileObject, _In_opt_ PIRP Irp, _In_ LIST_ENTRY* rollback) {
 LARGE_INTEGER newlength, time

[ros-diffs] [reactos] 04/04: [DOC] Reflect BtrFS Update

2017-10-16 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=36abd95390c4962102f08178c15b0c0f9bb3a04c

commit 36abd95390c4962102f08178c15b0c0f9bb3a04c
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Oct 16 20:26:53 2017 +0200

[DOC] Reflect BtrFS Update

CORE-13896
---
 media/doc/README.FSD | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/media/doc/README.FSD b/media/doc/README.FSD
index f81290939f..14c6d60eca 100644
--- a/media/doc/README.FSD
+++ b/media/doc/README.FSD
@@ -3,9 +3,9 @@
 
 The following FSD are shared with: https://github.com/maharmstone/btrfs.
 
-reactos/drivers/filesystems/btrfs   # Synced to 1.0
-reactos/dll/shellext/shellbtrfs # Synced to 1.0
-reactos/sdk/lib/fslib/btrfslib  # Synced to 1.0
+reactos/drivers/filesystems/btrfs   # Synced to 1.0.1
+reactos/dll/shellext/shellbtrfs # Synced to 1.0.1
+reactos/sdk/lib/fslib/btrfslib  # Synced to 1.0.1
 
 The following FSD are shared with: http://www.ext2fsd.com/
 



[ros-diffs] [reactos] 01/01: [NTDLL_APITEST] Add simple tests for RtlUnicodeStringToAnsiString() that were used to test the kernel32 regression

2017-10-16 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3a33ab96380c1ed213a083e490027a11ca5fbb58

commit 3a33ab96380c1ed213a083e490027a11ca5fbb58
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Oct 16 22:04:22 2017 +0200

[NTDLL_APITEST] Add simple tests for RtlUnicodeStringToAnsiString() that 
were used to test the kernel32 regression
---
 modules/rostests/apitests/ntdll/CMakeLists.txt |  1 +
 .../apitests/ntdll/RtlUnicodeStringToAnsiString.c  | 52 ++
 modules/rostests/apitests/ntdll/testlist.c |  2 +
 3 files changed, 55 insertions(+)

diff --git a/modules/rostests/apitests/ntdll/CMakeLists.txt 
b/modules/rostests/apitests/ntdll/CMakeLists.txt
index 7a56d74a85..23da6c5570 100644
--- a/modules/rostests/apitests/ntdll/CMakeLists.txt
+++ b/modules/rostests/apitests/ntdll/CMakeLists.txt
@@ -50,6 +50,7 @@ list(APPEND SOURCE
 RtlNtPathNameToDosPathName.c
 RtlpEnsureBufferSize.c
 RtlReAllocateHeap.c
+RtlUnicodeStringToAnsiString.c
 RtlUpcaseUnicodeStringToCountedOemString.c
 StackOverflow.c
 SystemInfo.c
diff --git a/modules/rostests/apitests/ntdll/RtlUnicodeStringToAnsiString.c 
b/modules/rostests/apitests/ntdll/RtlUnicodeStringToAnsiString.c
new file mode 100644
index 00..a517299568
--- /dev/null
+++ b/modules/rostests/apitests/ntdll/RtlUnicodeStringToAnsiString.c
@@ -0,0 +1,52 @@
+/*
+ * PROJECT: ReactOS API tests
+ * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE: Test for RtlUnicodeStringToAnsiString
+ * PROGRAMMERS: Pierre Schweitzer <pie...@reactos.org>
+ */
+
+#include 
+#include 
+
+START_TEST(RtlUnicodeStringToAnsiString)
+{
+WCHAR BufferU[10];
+CHAR BufferA[10];
+UNICODE_STRING StringU;
+ANSI_STRING StringA;
+NTSTATUS Status;
+DWORD i;
+
+memset(BufferU, 0xAA, sizeof(BufferU));
+memset(BufferA, 0xAA, sizeof(BufferA));
+
+BufferU[0] = L'A';
+BufferU[1] = UNICODE_NULL;
+
+StringU.Buffer = BufferU;
+StringU.MaximumLength = 10 * sizeof(WCHAR);
+
+RtlInitUnicodeString(, BufferU);
+ok(StringU.Length == 1 * sizeof(WCHAR), "Invalid size: %d\n", 
StringU.Length);
+ok(StringU.MaximumLength == 2 * sizeof(WCHAR), "Invalid size: %d\n", 
StringU.MaximumLength);
+ok(StringU.Buffer == BufferU, "Invalid buffer: %p\n", StringU.Buffer);
+
+StringA.Buffer = BufferA;
+StringA.MaximumLength = 10 * sizeof(CHAR);
+
+Status = RtlUnicodeStringToAnsiString(, , FALSE);
+ok(NT_SUCCESS(Status), "RtlUnicodeStringToAnsiString failed: %lx\n", 
Status);
+ok(StringA.Length == 1 * sizeof(CHAR), "Invalid size: %d\n", 
StringA.Length);
+ok(StringA.MaximumLength == 10 * sizeof(CHAR), "Invalid size: %d\n", 
StringA.MaximumLength);
+ok(StringA.Buffer == BufferA, "Invalid buffer: %p\n", StringA.Buffer);
+
+for (i = 0; i < 10; ++i)
+{
+if (BufferA[i] == 0)
+{
+break;
+}
+}
+
+ok(i != 10, "String was not null terminated!\n");
+}
diff --git a/modules/rostests/apitests/ntdll/testlist.c 
b/modules/rostests/apitests/ntdll/testlist.c
index 8b4f8f657d..f17f87267c 100644
--- a/modules/rostests/apitests/ntdll/testlist.c
+++ b/modules/rostests/apitests/ntdll/testlist.c
@@ -54,6 +54,7 @@ extern void func_RtlMemoryStream(void);
 extern void func_RtlNtPathNameToDosPathName(void);
 extern void func_RtlpEnsureBufferSize(void);
 extern void func_RtlReAllocateHeap(void);
+extern void func_RtlUnicodeStringToAnsiString(void);
 extern void func_RtlUpcaseUnicodeStringToCountedOemString(void);
 extern void func_StackOverflow(void);
 extern void func_TimerResolution(void);
@@ -111,6 +112,7 @@ const struct test winetest_testlist[] =
 { "RtlNtPathNameToDosPathName", func_RtlNtPathNameToDosPathName },
 { "RtlpEnsureBufferSize",   func_RtlpEnsureBufferSize },
 { "RtlReAllocateHeap",  func_RtlReAllocateHeap },
+{ "RtlUnicodeStringToAnsiString",   func_RtlUnicodeStringToAnsiString },
 { "RtlUpcaseUnicodeStringToCountedOemString", 
func_RtlUpcaseUnicodeStringToCountedOemString },
 { "StackOverflow",  func_StackOverflow },
 { "TimerResolution",func_TimerResolution },



[ros-diffs] [reactos] 01/05: [KERNEL32]: Reimplement GetDiskFreeSpaceW() to fix various issues in it. It also brings support for appcompat

2017-10-05 Thread Pierre Schweitzer
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=5bee374c82209d347088a42901e77d4d1a11b839

commit 5bee374c82209d347088a42901e77d4d1a11b839
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Wed Oct 4 22:27:14 2017 +0200

[KERNEL32]: Reimplement GetDiskFreeSpaceW() to fix various issues in it. It 
also brings support for appcompat
---
 dll/win32/kernel32/client/file/disk.c | 135 +++---
 1 file changed, 108 insertions(+), 27 deletions(-)

diff --git a/dll/win32/kernel32/client/file/disk.c 
b/dll/win32/kernel32/client/file/disk.c
index fd97a0e3a8..7ff6e88f1a 100644
--- a/dll/win32/kernel32/client/file/disk.c
+++ b/dll/win32/kernel32/client/file/disk.c
@@ -215,50 +215,131 @@ GetDiskFreeSpaceW(IN LPCWSTR lpRootPathName,
   OUT LPDWORD lpNumberOfFreeClusters,
   OUT LPDWORD lpTotalNumberOfClusters)
 {
-FILE_FS_SIZE_INFORMATION FileFsSize;
+BOOL Below2GB;
+PCWSTR RootPath;
+NTSTATUS Status;
+HANDLE RootHandle;
+UNICODE_STRING FileName;
 IO_STATUS_BLOCK IoStatusBlock;
-WCHAR RootPathName[MAX_PATH];
-HANDLE hFile;
-NTSTATUS errCode;
+OBJECT_ATTRIBUTES ObjectAttributes;
+FILE_FS_SIZE_INFORMATION FileFsSize;
 
-if (lpRootPathName)
+/* If no path provided, get root path */
+RootPath = lpRootPathName;
+if (lpRootPathName == NULL)
 {
-wcsncpy (RootPathName, lpRootPathName, 3);
+RootPath = L"\\";
 }
-else
+
+/* Convert the path to NT path */
+if (!RtlDosPathNameToNtPathName_U(RootPath, , NULL, NULL))
 {
-GetCurrentDirectoryW (MAX_PATH, RootPathName);
+SetLastError(ERROR_PATH_NOT_FOUND);
+return FALSE;
 }
-RootPathName[3] = 0;
 
-hFile = InternalOpenDirW(RootPathName, FALSE);
-if (INVALID_HANDLE_VALUE == hFile)
+/* Open it for disk space query! */
+InitializeObjectAttributes(, ,
+   OBJ_CASE_INSENSITIVE, NULL, NULL);
+Status = NtOpenFile(, SYNCHRONIZE, , 
,
+FILE_SHARE_READ | FILE_SHARE_WRITE,
+FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | 
FILE_OPEN_FOR_FREE_SPACE_QUERY);
+if (!NT_SUCCESS(Status))
 {
-SetLastError(ERROR_PATH_NOT_FOUND);
+BaseSetLastNTError(Status);
+RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer);
+if (lpBytesPerSector != NULL)
+{
+*lpBytesPerSector = 0;
+}
+
 return FALSE;
 }
 
-errCode = NtQueryVolumeInformationFile(hFile,
-   ,
-   ,
-   sizeof(FILE_FS_SIZE_INFORMATION),
-   FileFsSizeInformation);
-if (!NT_SUCCESS(errCode))
+/* We don't need the name any longer */
+RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer);
+
+/* Query disk space! */
+Status = NtQueryVolumeInformationFile(RootHandle, , 
,
+  sizeof(FILE_FS_SIZE_INFORMATION),
+  FileFsSizeInformation);
+NtClose(RootHandle);
+if (!NT_SUCCESS(Status))
 {
-CloseHandle(hFile);
-BaseSetLastNTError (errCode);
+BaseSetLastNTError(Status);
 return FALSE;
 }
 
-if (lpSectorsPerCluster)
+/* Are we in some compatibility mode where size must be below 2GB? */
+Below2GB = ((NtCurrentPeb()->AppCompatFlags.LowPart & GetDiskFreeSpace2GB) 
== GetDiskFreeSpace2GB);
+
+/* If we're to overflow output, make sure we return the maximum */
+if (FileFsSize.TotalAllocationUnits.HighPart != 0)
+{
+FileFsSize.TotalAllocationUnits.LowPart = -1;
+}
+
+if (FileFsSize.AvailableAllocationUnits.HighPart != 0)
+{
+FileFsSize.AvailableAllocationUnits.LowPart = -1;
+}
+
+/* Return what user asked for */
+if (lpSectorsPerCluster != NULL)
+{
 *lpSectorsPerCluster = FileFsSize.SectorsPerAllocationUnit;
-if (lpBytesPerSector)
+}
+
+if (lpBytesPerSector != NULL)
+{
 *lpBytesPerSector = FileFsSize.BytesPerSector;
-if (lpNumberOfFreeClusters)
-*lpNumberOfFreeClusters = 
FileFsSize.AvailableAllocationUnits.u.LowPart;
-if (lpTotalNumberOfClusters)
-*lpTotalNumberOfClusters = FileFsSize.TotalAllocationUnits.u.LowPart;
-CloseHandle(hFile);
+}
+
+if (lpNumberOfFreeClusters != NULL)
+{
+if (!Below2GB)
+{
+*lpNumberOfFreeClusters = 
FileFsSize.AvailableAllocationUnits.LowPart;
+}
+/* If we have to remain below 2GB... */
+else
+{
+DWORD FreeClusters;
+
+/* Compute how many clusters there are in 

[ros-diffs] [reactos] 02/05: [KERNEL32]: Reimplement GetDiskFreeSpaceA() to make it w2k3 compliant

2017-10-05 Thread Pierre Schweitzer
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=87448f3d8b26a6696f143872874200ef5799565d

commit 87448f3d8b26a6696f143872874200ef5799565d
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Wed Oct 4 22:30:18 2017 +0200

[KERNEL32]: Reimplement GetDiskFreeSpaceA() to make it w2k3 compliant
---
 dll/win32/kernel32/client/file/disk.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/dll/win32/kernel32/client/file/disk.c 
b/dll/win32/kernel32/client/file/disk.c
index 7ff6e88f1a..5854b2320e 100644
--- a/dll/win32/kernel32/client/file/disk.c
+++ b/dll/win32/kernel32/client/file/disk.c
@@ -189,19 +189,24 @@ GetDiskFreeSpaceA(IN LPCSTR lpRootPathName,
   OUT LPDWORD lpNumberOfFreeClusters,
   OUT LPDWORD lpTotalNumberOfClusters)
 {
-PWCHAR RootPathNameW=NULL;
+PCSTR RootPath;
+PUNICODE_STRING RootPathU;
 
-if (lpRootPathName)
+RootPath = lpRootPathName;
+if (RootPath == NULL)
 {
-if (!(RootPathNameW = FilenameA2W(lpRootPathName, FALSE)))
-return FALSE;
+RootPath = "\\";
+}
+
+RootPathU = Basep8BitStringToStaticUnicodeString(RootPath);
+if (RootPathU == NULL)
+{
+return FALSE;
 }
 
-return GetDiskFreeSpaceW (RootPathNameW,
-  lpSectorsPerCluster,
-  lpBytesPerSector,
-  lpNumberOfFreeClusters,
-  lpTotalNumberOfClusters);
+return GetDiskFreeSpaceW(RootPathU->Buffer, lpSectorsPerCluster,
+ lpBytesPerSector, lpNumberOfFreeClusters,
+ lpTotalNumberOfClusters);
 }
 
 /*

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.



[ros-diffs] [reactos] 03/05: [KERNEL32]: Refactor a bit GetDiskFreeSpaceExW(), no ground breaking changes

2017-10-05 Thread Pierre Schweitzer
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=1e2424ee98bd12d6a5a7ebffdfa138546a5c7a5b

commit 1e2424ee98bd12d6a5a7ebffdfa138546a5c7a5b
Author: Pierre Schweitzer <pie...@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, , NULL, NULL))
 {
+SetLastError(ERROR_PATH_NOT_FOUND);
 return FALSE;
 }
 
-if (lpFreeBytesAvailableToCaller != NULL || lpTotalNumberOfBytes != NULL)
+/* Open it for disk space query! */
+InitializeObjectAttributes(, ,
+   OBJ_CASE_INSENSITIVE, NULL, NULL);
+Status = NtOpenFile(, SYNCHRONIZE, , 
,
+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,
-  ,
-  ,
-  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, , 
,
+  
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.Q

[ros-diffs] [reactos] 04/05: [KERNEL32]: Reimplement GetDiskFreeSpaceExA() to make it w2k3 compliant

2017-10-05 Thread Pierre Schweitzer
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=8b6518139db31655a395a1547dd475f06f79b934

commit 8b6518139db31655a395a1547dd475f06f79b934
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Wed Oct 4 23:02:22 2017 +0200

[KERNEL32]: Reimplement GetDiskFreeSpaceExA() to make it w2k3 compliant
---
 dll/win32/kernel32/client/file/disk.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/dll/win32/kernel32/client/file/disk.c 
b/dll/win32/kernel32/client/file/disk.c
index 1ba1b73549..1b7d1e3a9d 100644
--- a/dll/win32/kernel32/client/file/disk.c
+++ b/dll/win32/kernel32/client/file/disk.c
@@ -359,18 +359,23 @@ GetDiskFreeSpaceExA(IN LPCSTR lpDirectoryName OPTIONAL,
 OUT PULARGE_INTEGER lpTotalNumberOfBytes,
 OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
 {
-PWCHAR DirectoryNameW=NULL;
+PCSTR RootPath;
+PUNICODE_STRING RootPathU;
 
-if (lpDirectoryName)
+RootPath = lpDirectoryName;
+if (RootPath == NULL)
 {
-if (!(DirectoryNameW = FilenameA2W(lpDirectoryName, FALSE)))
-return FALSE;
+RootPath = "\\";
+}
+
+RootPathU = Basep8BitStringToStaticUnicodeString(RootPath);
+if (RootPathU == NULL)
+{
+return FALSE;
 }
 
-return GetDiskFreeSpaceExW (DirectoryNameW ,
-lpFreeBytesAvailableToCaller,
-lpTotalNumberOfBytes,
-lpTotalNumberOfFreeBytes);
+return GetDiskFreeSpaceExW(RootPathU->Buffer, lpFreeBytesAvailableToCaller,
+  lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes);
 }
 
 /*

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.



[ros-diffs] [reactos] 05/05: [KERNEL32]: Finally get rid of no longer used function InternalOpenDirW()

2017-10-05 Thread Pierre Schweitzer
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=676bd0cf37d1fd9c2ef2879b061358b512cf00a1

commit 676bd0cf37d1fd9c2ef2879b061358b512cf00a1
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Wed Oct 4 23:03:07 2017 +0200

[KERNEL32]: Finally get rid of no longer used function InternalOpenDirW()
---
 dll/win32/kernel32/client/file/disk.c | 47 ---
 1 file changed, 47 deletions(-)

diff --git a/dll/win32/kernel32/client/file/disk.c 
b/dll/win32/kernel32/client/file/disk.c
index 1b7d1e3a9d..74ca5713f0 100644
--- a/dll/win32/kernel32/client/file/disk.c
+++ b/dll/win32/kernel32/client/file/disk.c
@@ -27,53 +27,6 @@ DEBUG_CHANNEL(kernel32file);
 
 #define MAX_DOS_DRIVES 26
 
-HANDLE
-WINAPI
-InternalOpenDirW(IN LPCWSTR DirName,
- IN BOOLEAN Write)
-{
-UNICODE_STRING NtPathU;
-OBJECT_ATTRIBUTES ObjectAttributes;
-NTSTATUS errCode;
-IO_STATUS_BLOCK IoStatusBlock;
-HANDLE hFile;
-
-if (!RtlDosPathNameToNtPathName_U(DirName, , NULL, NULL))
-{
-WARN("Invalid path\n");
-SetLastError(ERROR_BAD_PATHNAME);
-return INVALID_HANDLE_VALUE;
-}
-
-InitializeObjectAttributes(,
-   ,
-   OBJ_CASE_INSENSITIVE,
-   NULL,
-   NULL);
-
-errCode = NtCreateFile(,
-   Write ? FILE_GENERIC_WRITE : FILE_GENERIC_READ,
-   ,
-   ,
-   NULL,
-   0,
-   FILE_SHARE_READ | FILE_SHARE_WRITE,
-   FILE_OPEN,
-   0,
-   NULL,
-   0);
-
-RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathU.Buffer);
-
-if (!NT_SUCCESS(errCode))
-{
-BaseSetLastNTError(errCode);
-return INVALID_HANDLE_VALUE;
-}
-
-return hFile;
-}
-
 /*
  * @implemented
  */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.



[ros-diffs] [reactos] 01/01: [CLASS2]: Fix status code on too small as exposed by kernel32:DeviceIoControl

2017-10-04 Thread Pierre Schweitzer
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=75f1637f37d8f5ae700e766aed7cc848e37e5f8f

commit 75f1637f37d8f5ae700e766aed7cc848e37e5f8f
Author: Pierre Schweitzer <pie...@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.



[ros-diffs] [reactos] 01/01: [KERNEL32]: Reimplement GetDriveTypeW(). This allows providing a quick path for DOS drives and fixes a few detection cases. It allows brings in support for mount points.

2017-10-05 Thread Pierre Schweitzer
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=cb17d5dba4a5e1cee30f47776821f52890b9b4e0

commit cb17d5dba4a5e1cee30f47776821f52890b9b4e0
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Thu Oct 5 23:41:26 2017 +0200

[KERNEL32]: Reimplement GetDriveTypeW(). This allows providing a quick path 
for DOS drives and fixes a few detection cases. It allows brings in support for 
mount points.
---
 dll/win32/kernel32/client/file/disk.c | 244 +-
 dll/win32/kernel32/client/file/mntpoint.c |   2 +-
 dll/win32/kernel32/client/file/volume.c   |   2 +-
 dll/win32/kernel32/include/kernel32.h |  14 ++
 4 files changed, 188 insertions(+), 74 deletions(-)

diff --git a/dll/win32/kernel32/client/file/disk.c 
b/dll/win32/kernel32/client/file/disk.c
index 74ca5713f0..e7843067fc 100644
--- a/dll/win32/kernel32/client/file/disk.c
+++ b/dll/win32/kernel32/client/file/disk.c
@@ -23,7 +23,6 @@
 
 #define NDEBUG
 #include 
-DEBUG_CHANNEL(kernel32file);
 
 #define MAX_DOS_DRIVES 26
 
@@ -482,127 +481,228 @@ UINT
 WINAPI
 GetDriveTypeW(IN LPCWSTR lpRootPathName)
 {
-FILE_FS_DEVICE_INFORMATION FileFsDevice;
-OBJECT_ATTRIBUTES ObjectAttributes;
-IO_STATUS_BLOCK IoStatusBlock;
-UNICODE_STRING PathName;
-HANDLE FileHandle;
+BOOL RetryOpen;
+PCWSTR RootPath;
 NTSTATUS Status;
-PWSTR CurrentDir = NULL;
-PCWSTR lpRootPath;
+WCHAR DriveLetter;
+HANDLE RootHandle;
+IO_STATUS_BLOCK IoStatusBlock;
+OBJECT_ATTRIBUTES ObjectAttributes;
+UNICODE_STRING PathName, VolumeString;
+FILE_FS_DEVICE_INFORMATION FileFsDevice;
+WCHAR Buffer[MAX_PATH], VolumeName[MAX_PATH];
 
-if (!lpRootPathName)
+/* If no path, get one */
+if (lpRootPathName == NULL)
 {
-/* If NULL is passed, use current directory path */
-DWORD BufferSize = GetCurrentDirectoryW(0, NULL);
-CurrentDir = HeapAlloc(GetProcessHeap(), 0, BufferSize * 
sizeof(WCHAR));
-if (!CurrentDir)
-return DRIVE_UNKNOWN;
-if (!GetCurrentDirectoryW(BufferSize, CurrentDir))
+RootPath = Buffer;
+/* This will be current drive (:\ - drop the rest)*/
+if (RtlGetCurrentDirectory_U(sizeof(Buffer), Buffer) > 3 * 
sizeof(WCHAR))
 {
-HeapFree(GetProcessHeap(), 0, CurrentDir);
-return DRIVE_UNKNOWN;
+Buffer[3] = UNICODE_NULL;
 }
-
-if (wcslen(CurrentDir) > 3)
-CurrentDir[3] = 0;
-
-lpRootPath = CurrentDir;
 }
 else
 {
-size_t Length = wcslen(lpRootPathName);
-
-TRACE("lpRootPathName: %S\n", lpRootPathName);
-
-lpRootPath = lpRootPathName;
-if (Length == 2)
+/* Handle broken value */
+if (lpRootPathName == (PVOID)-1)
 {
-WCHAR DriveLetter = RtlUpcaseUnicodeChar(lpRootPathName[0]);
+return DRIVE_UNKNOWN;
+}
 
+RootPath = lpRootPathName;
+/* If provided path is 2-len, it might be a drive letter... */
+if (wcslen(lpRootPathName) == 2)
+{
+/* Check it! */
+DriveLetter = RtlUpcaseUnicodeChar(lpRootPathName[0]);
+/* That's a drive letter! */
 if (DriveLetter >= L'A' && DriveLetter <= L'Z' && 
lpRootPathName[1] == L':')
 {
-Length = (Length + 2) * sizeof(WCHAR);
-
-CurrentDir = HeapAlloc(GetProcessHeap(), 0, Length);
-if (!CurrentDir)
-return DRIVE_UNKNOWN;
+/* Make it a volume */
+Buffer[0] = DriveLetter;
+Buffer[1] = L':';
+Buffer[2] = L'\\';
+Buffer[3] = UNICODE_NULL;
+RootPath = Buffer;
+}
+}
+}
 
-StringCbPrintfW(CurrentDir, Length, L"%s\\", lpRootPathName);
+/* If the provided looks like a DOS device... Like :\<0> */
+DriveLetter = RtlUpcaseUnicodeChar(RootPath[0]);
+/* We'll take the quick path!
+ * We'll find the device type looking at the device map (and types ;-))
+ * associated with the current process
+ */
+if (DriveLetter >= L'A' && DriveLetter <= L'Z' && RootPath[1] == L':' &&
+RootPath[2] == L'\\' && RootPath[3] == UNICODE_NULL)
+{
+USHORT Index;
+PROCESS_DEVICEMAP_INFORMATION DeviceMap;
+
+/* Query the device map */
+Status = NtQueryInformationProcess(NtCurrentProcess(), 
ProcessDeviceMap,
+   ,
+   
sizeof(PROCESS_DEVICEMAP_INFORMATION),
+   NULL);
+/* Zero outpu

[ros-diffs] [reactos] 01/01: [KERNEL32]: w2k3ify GetDriveTypeA()

2017-10-05 Thread Pierre Schweitzer
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=d7ee95b28ba5232027378e8918317118b1eac9f4

commit d7ee95b28ba5232027378e8918317118b1eac9f4
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Thu Oct 5 23:43:10 2017 +0200

[KERNEL32]: w2k3ify GetDriveTypeA()
---
 dll/win32/kernel32/client/file/disk.c | 23 +--
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/dll/win32/kernel32/client/file/disk.c 
b/dll/win32/kernel32/client/file/disk.c
index e7843067fc..041f4b197b 100644
--- a/dll/win32/kernel32/client/file/disk.c
+++ b/dll/win32/kernel32/client/file/disk.c
@@ -463,15 +463,26 @@ UINT
 WINAPI
 GetDriveTypeA(IN LPCSTR lpRootPathName)
 {
-PWCHAR RootPathNameW;
+PWSTR RootPathU;
 
-if (!lpRootPathName)
-return GetDriveTypeW(NULL);
+if (lpRootPathName != NULL)
+{
+PUNICODE_STRING RootPathUStr;
 
-if (!(RootPathNameW = FilenameA2W(lpRootPathName, FALSE)))
-return DRIVE_UNKNOWN;
+RootPathUStr = Basep8BitStringToStaticUnicodeString(lpRootPathName);
+if (RootPathUStr == NULL)
+{
+return DRIVE_NO_ROOT_DIR;
+}
+
+RootPathU = RootPathUStr->Buffer;
+}
+else
+{
+RootPathU = NULL;
+}
 
-return GetDriveTypeW(RootPathNameW);
+return GetDriveTypeW(RootPathU);
 }
 
 /*

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.



[ros-diffs] [reactos] 01/01: [KERNEL32_APITEST]: Rewrite DeviceIoControl to test both disk.sys and cdrom.sys

2017-10-07 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ac8d04546131c5b54977a462de88ee22adb1b660

commit ac8d04546131c5b54977a462de88ee22adb1b660
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Oct 7 14:06:34 2017 +0200

[KERNEL32_APITEST]: Rewrite DeviceIoControl to test both disk.sys and 
cdrom.sys
---
 .../rostests/apitests/kernel32/DeviceIoControl.c   | 177 ++---
 1 file changed, 120 insertions(+), 57 deletions(-)

diff --git a/modules/rostests/apitests/kernel32/DeviceIoControl.c 
b/modules/rostests/apitests/kernel32/DeviceIoControl.c
index 2f993eb25e..faa10d5465 100644
--- a/modules/rostests/apitests/kernel32/DeviceIoControl.c
+++ b/modules/rostests/apitests/kernel32/DeviceIoControl.c
@@ -13,9 +13,13 @@
 
 WCHAR Letter;
 HANDLE Device;
+UINT DriveType;
+
+#define ok_type(condition, format, ...) ok(condition, "(%d): " format, 
DriveType,  ##__VA_ARGS__)
+#define skip_type(format, ...) skip("(%d): " format, DriveType, ##__VA_ARGS__)
 
 static
-VOID
+BOOL
 GetDiskGeometry(VOID)
 {
 UINT Ret;
@@ -25,32 +29,47 @@ GetDiskGeometry(VOID)
 
 Size = 0;
 Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, , 
sizeof(DG) - 1, , NULL);
-ok(Ret == 0, "DeviceIoControl succeed\n");
+ok_type(Ret == 0, "DeviceIoControl succeed\n");
 Error = GetLastError();
-ok(Error == ERROR_INSUFFICIENT_BUFFER, "Expecting 
ERROR_INSUFFICIENT_BUFFER, got %ld\n", Error);
-ok(Size == 0, "Invalid output size: %ld\n", Size);
+ok_type(Error == ERROR_INSUFFICIENT_BUFFER, "Expecting 
ERROR_INSUFFICIENT_BUFFER, got %ld\n", Error);
+ok_type(Size == 0, "Invalid output size: %ld\n", Size);
 
 Size = 0;
 Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, , 
sizeof(DG), , NULL);
-ok(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError());
-ok(Size == sizeof(DG), "Invalid output size: %ld\n", Size);
+/* Specific for CDROM, no disk present */
+if (Ret == 0 && GetLastError() == ERROR_NOT_READY)
+{
+skip_type("No CDROM present\n");
+return FALSE;
+}
+ok_type(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError());
+ok_type(Size == sizeof(DG), "Invalid output size: %ld\n", Size);
 
 Size = 0;
 Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, 
, FIELD_OFFSET(DISK_GEOMETRY_EX, Data) - 1, , NULL);
-ok(Ret == 0, "DeviceIoControl succeed\n");
+ok_type(Ret == 0, "DeviceIoControl succeed\n");
 Error = GetLastError();
-ok(Error == ERROR_INSUFFICIENT_BUFFER, "Expecting 
ERROR_INSUFFICIENT_BUFFER, got %ld\n", Error);
-ok(Size == 0, "Invalid output size: %ld\n", Size);
+ok_type(Error == ERROR_INSUFFICIENT_BUFFER, "Expecting 
ERROR_INSUFFICIENT_BUFFER, got %ld\n", Error);
+ok_type(Size == 0, "Invalid output size: %ld\n", Size);
 
 Size = 0;
 Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, 
, FIELD_OFFSET(DISK_GEOMETRY_EX, Data), , NULL);
-ok(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError());
-ok(Size == FIELD_OFFSET(DISK_GEOMETRY_EX, Data), "Invalid output size: 
%ld\n", Size);
+ok_type(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError());
+ok_type(Size == FIELD_OFFSET(DISK_GEOMETRY_EX, Data), "Invalid output 
size: %ld\n", Size);
 
 Size = 0;
 Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, 
, sizeof(DGE), , NULL);
-ok(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError());
-ok(Size == sizeof(DGE), "Invalid output size: %ld\n", Size);
+ok_type(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError());
+if (DriveType == DRIVE_FIXED)
+{
+ok_type(Size == sizeof(DGE), "Invalid output size: %ld\n", Size);
+}
+else
+{
+ok_type(Size == FIELD_OFFSET(DISK_GEOMETRY_EX, Data), "Invalid output 
size: %ld\n", Size);
+}
+
+return TRUE;
 }
 
 static
@@ -64,36 +83,44 @@ QueryDeviceName(VOID)
 
 Size = 0;
 Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_DEVICE_NAME, NULL, 0, 
, sizeof(MDN) - 1, , NULL);
-ok(Ret == 0, "DeviceIoControl succeed\n");
+ok_type(Ret == 0, "DeviceIoControl succeed\n");
 Error = GetLastError();
-ok(Error == ERROR_INVALID_PARAMETER, "Expecting ERROR_INVALID_PARAMETER, 
got %ld\n", Error);
-ok(Size == 0, "Invalid output size: %ld\n", Size);
+if (DriveType == DRIVE_FIXED)
+{
+ok_type(Error == ERROR_INVALID_PARAMETER, "Expecting 
ERROR_INVALID_PARAMETER, got %ld\n", Error);
+}
+else
+{
+ok_type(Error == ERROR_INSUFFICIENT_BUFFER, "Expecting 
ERROR_INSUFFIC

[ros-diffs] [reactos] 01/01: Add modules/optional to .gitignore

2017-10-07 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dcff3c92987104a4ee532e15d2666359c5fc9d27

commit dcff3c92987104a4ee532e15d2666359c5fc9d27
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Oct 7 13:26:01 2017 +0200

Add modules/optional to .gitignore
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 3be9623e90..a9817100ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 output-*
+modules/optional



[ros-diffs] [reactos] 01/02: [KERNEL32_APITEST]: Add few tests for IOCTL_MOUNTDEV_QUERY_UNIQUE_ID

2017-10-07 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a6b61b855c49e5ce8a4503fa29b5ddbbbe55fe32

commit a6b61b855c49e5ce8a4503fa29b5ddbbbe55fe32
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Oct 7 12:09:27 2017 +0200

[KERNEL32_APITEST]: Add few tests for IOCTL_MOUNTDEV_QUERY_UNIQUE_ID
---
 .../rostests/apitests/kernel32/DeviceIoControl.c   | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/modules/rostests/apitests/kernel32/DeviceIoControl.c 
b/modules/rostests/apitests/kernel32/DeviceIoControl.c
index a7edb8678a..ed1c6f7fa3 100644
--- a/modules/rostests/apitests/kernel32/DeviceIoControl.c
+++ b/modules/rostests/apitests/kernel32/DeviceIoControl.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 WCHAR Letter;
 HANDLE Device;
@@ -110,6 +111,42 @@ QueryDeviceName(VOID)
 HeapFree(GetProcessHeap(), 0, AllocatedMDN);
 }
 
+static
+VOID
+QueryUniqueId(VOID)
+{
+UINT Ret;
+DWORD Size, Error;
+MOUNTDEV_UNIQUE_ID MUI, *AllocatedMUI;
+
+Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_UNIQUE_ID, NULL, 0, 
, sizeof(MUI) - 1, , NULL);
+ok(Ret == 0, "DeviceIoControl succeed\n");
+Error = GetLastError();
+ok(Error == ERROR_INVALID_PARAMETER, "Expecting ERROR_INVALID_PARAMETER, 
got %ld\n", Error);
+ok(Size == 48 /* ?! */, "Invalid output size: %ld\n", Size);
+
+Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_UNIQUE_ID, NULL, 0, 
, sizeof(MUI), , NULL);
+ok(Ret == 0, "DeviceIoControl succeed\n");
+Error = GetLastError();
+ok(Error == ERROR_MORE_DATA, "Expecting ERROR_MORE_DATA, got %ld\n", 
Error);
+ok(Size == sizeof(MOUNTDEV_UNIQUE_ID), "Invalid output size: %ld\n", Size);
+
+AllocatedMUI = HeapAlloc(GetProcessHeap(), 0, 
FIELD_OFFSET(MOUNTDEV_UNIQUE_ID, UniqueId) + MUI.UniqueIdLength + 
sizeof(UNICODE_NULL));
+if (AllocatedMUI == NULL)
+{
+skip("Memory allocation failure\n");
+return;
+}
+
+Size = 0;
+Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_UNIQUE_ID, NULL, 0, 
AllocatedMUI, FIELD_OFFSET(MOUNTDEV_UNIQUE_ID, UniqueId) + MUI.UniqueIdLength, 
, NULL);
+ok(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError());
+ok(Size == FIELD_OFFSET(MOUNTDEV_UNIQUE_ID, UniqueId) + 
MUI.UniqueIdLength, "Invalid output size: %ld\n", Size);
+ok(AllocatedMUI->UniqueIdLength == MUI.UniqueIdLength, "Mismatching sizes: 
%d %d\n", AllocatedMUI->UniqueIdLength, MUI.UniqueIdLength);
+
+HeapFree(GetProcessHeap(), 0, AllocatedMUI);
+}
+
 START_TEST(DeviceIoControl)
 {
 UINT Ret;
@@ -137,6 +174,7 @@ START_TEST(DeviceIoControl)
 
 GetDiskGeometry();
 QueryDeviceName();
+QueryUniqueId();
 
 CloseHandle(Device);
 }



[ros-diffs] [reactos] 02/02: [KERNEL32_APITEST]: Fix uninit stack var usage

2017-10-07 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d3b4f09eb3610865e21f0e6f78eb9dea69adc695

commit d3b4f09eb3610865e21f0e6f78eb9dea69adc695
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Oct 7 12:11:17 2017 +0200

[KERNEL32_APITEST]: Fix uninit stack var usage
---
 modules/rostests/apitests/kernel32/DeviceIoControl.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/rostests/apitests/kernel32/DeviceIoControl.c 
b/modules/rostests/apitests/kernel32/DeviceIoControl.c
index ed1c6f7fa3..2f993eb25e 100644
--- a/modules/rostests/apitests/kernel32/DeviceIoControl.c
+++ b/modules/rostests/apitests/kernel32/DeviceIoControl.c
@@ -62,11 +62,12 @@ QueryDeviceName(VOID)
 DWORD Size, Error;
 MOUNTDEV_NAME MDN, *AllocatedMDN;
 
+Size = 0;
 Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_DEVICE_NAME, NULL, 0, 
, sizeof(MDN) - 1, , NULL);
 ok(Ret == 0, "DeviceIoControl succeed\n");
 Error = GetLastError();
 ok(Error == ERROR_INVALID_PARAMETER, "Expecting ERROR_INVALID_PARAMETER, 
got %ld\n", Error);
-ok(Size == 40 /* ?! */, "Invalid output size: %ld\n", Size);
+ok(Size == 0, "Invalid output size: %ld\n", Size);
 
 Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_DEVICE_NAME, NULL, 0, 
, sizeof(MDN), , NULL);
 ok(Ret == 0, "DeviceIoControl succeed\n");
@@ -119,11 +120,12 @@ QueryUniqueId(VOID)
 DWORD Size, Error;
 MOUNTDEV_UNIQUE_ID MUI, *AllocatedMUI;
 
+Size = 0;
 Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_UNIQUE_ID, NULL, 0, 
, sizeof(MUI) - 1, , NULL);
 ok(Ret == 0, "DeviceIoControl succeed\n");
 Error = GetLastError();
 ok(Error == ERROR_INVALID_PARAMETER, "Expecting ERROR_INVALID_PARAMETER, 
got %ld\n", Error);
-ok(Size == 48 /* ?! */, "Invalid output size: %ld\n", Size);
+ok(Size == 0, "Invalid output size: %ld\n", Size);
 
 Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_UNIQUE_ID, NULL, 0, 
, sizeof(MUI), , NULL);
 ok(Ret == 0, "DeviceIoControl succeed\n");



[ros-diffs] [reactos] 03/03: [RDBSS] Fix broken cast when comparing DFS magic values CID 1419139

2017-10-11 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=78e5caaec2ae983794f3ab01ab234a1ef7d1882d

commit 78e5caaec2ae983794f3ab01ab234a1ef7d1882d
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Wed Oct 11 08:38:26 2017 +0200

[RDBSS] Fix broken cast when comparing DFS magic values
CID 1419139
---
 sdk/lib/drivers/rdbsslib/rdbss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdk/lib/drivers/rdbsslib/rdbss.c b/sdk/lib/drivers/rdbsslib/rdbss.c
index 0163a2425d..4591f3bd72 100644
--- a/sdk/lib/drivers/rdbsslib/rdbss.c
+++ b/sdk/lib/drivers/rdbsslib/rdbss.c
@@ -4946,7 +4946,7 @@ RxCreateFromNetRoot(
 if (Context->pFobx != NULL)
 {
 /* If so, reflect this in the FOBX */
-if (NodeType(FileObject->FsContext2) == DFS_OPEN_CONTEXT)
+if (FileObject->FsContext2 == UIntToPtr(DFS_OPEN_CONTEXT))
 {
 SetFlag(Context->pFobx->Flags, FOBX_FLAG_DFS_OPEN);
 }



[ros-diffs] [reactos] 02/03: [RXCE] Don't remove uninitialized list entry CID 1419234

2017-10-11 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f9b26bc0f2be8aba6484fce1e1343e1eae6d

commit f9b26bc0f2be8aba6484fce1e1343e1eae6d
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Wed Oct 11 08:31:36 2017 +0200

[RXCE] Don't remove uninitialized list entry
CID 1419234
---
 sdk/lib/drivers/rxce/rxce.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sdk/lib/drivers/rxce/rxce.c b/sdk/lib/drivers/rxce/rxce.c
index 4f67abcfdb..2c91c0ba17 100644
--- a/sdk/lib/drivers/rxce/rxce.c
+++ b/sdk/lib/drivers/rxce/rxce.c
@@ -6834,6 +6834,9 @@ RxpUndoScavengerFinalizationMarking(
 --Scavenger->SrvOpensToBeFinalized;
 ListEntry = &((PSRV_OPEN)Instance)->ScavengerFinalizationList;
 break;
+
+default:
+return;
 }
 
 /* Also, remove the extra ref from the scavenger */



[ros-diffs] [reactos] 01/03: [RDBSS] Avoid uninit var usage. CID 1419475

2017-10-11 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=151869c6ef34e9d2d5582b9c15aaa025904dfdc5

commit 151869c6ef34e9d2d5582b9c15aaa025904dfdc5
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Wed Oct 11 08:20:48 2017 +0200

[RDBSS] Avoid uninit var usage.
CID 1419475
---
 sdk/lib/drivers/rdbsslib/rdbss.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sdk/lib/drivers/rdbsslib/rdbss.c b/sdk/lib/drivers/rdbsslib/rdbss.c
index 84b172e735..0163a2425d 100644
--- a/sdk/lib/drivers/rdbsslib/rdbss.c
+++ b/sdk/lib/drivers/rdbsslib/rdbss.c
@@ -1052,6 +1052,9 @@ RxCancelNotifyChangeDirectoryRequestsForVNetRoot(
 /* Lock our list lock */
 KeAcquireSpinLock(, );
 
+/* Assume success */
+Status = STATUS_SUCCESS;
+
 /* Now, browse all the active contexts, to find the associated ones */
 Entry = RxActiveContexts.Flink;
 while (Entry != )



[ros-diffs] [reactos] 01/01: [KERNEL32] Check NtQueryInformationFile succeed before using its return. Also fix coding style CID 512966

2017-10-23 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=19f1cd78c15f7bd3002871796d69a14711971e2d

commit 19f1cd78c15f7bd3002871796d69a14711971e2d
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Oct 23 12:36:43 2017 +0200

[KERNEL32] Check NtQueryInformationFile succeed before using its return. 
Also fix coding style
CID 512966
---
 dll/win32/kernel32/client/file/fileinfo.c | 134 +-
 1 file changed, 77 insertions(+), 57 deletions(-)

diff --git a/dll/win32/kernel32/client/file/fileinfo.c 
b/dll/win32/kernel32/client/file/fileinfo.c
index 4b8df966c0..2721c82631 100644
--- a/dll/win32/kernel32/client/file/fileinfo.c
+++ b/dll/win32/kernel32/client/file/fileinfo.c
@@ -325,70 +325,90 @@ SetFilePointer(HANDLE hFile,
 BOOL
 WINAPI
 SetFilePointerEx(HANDLE hFile,
-LARGE_INTEGER liDistanceToMove,
-PLARGE_INTEGER lpNewFilePointer,
-DWORD dwMoveMethod)
+ LARGE_INTEGER liDistanceToMove,
+ PLARGE_INTEGER lpNewFilePointer,
+ DWORD dwMoveMethod)
 {
-   FILE_POSITION_INFORMATION FilePosition;
-   FILE_STANDARD_INFORMATION FileStandard;
-   NTSTATUS errCode;
-   IO_STATUS_BLOCK IoStatusBlock;
+NTSTATUS Status;
+IO_STATUS_BLOCK IoStatusBlock;
+FILE_POSITION_INFORMATION FilePosition;
+FILE_STANDARD_INFORMATION FileStandard;
 
-   if(IsConsoleHandle(hFile))
-   {
- SetLastError(ERROR_INVALID_HANDLE);
- return FALSE;
-   }
+if (IsConsoleHandle(hFile))
+{
+BaseSetLastNTError(STATUS_INVALID_HANDLE);
+return FALSE;
+}
 
-   switch(dwMoveMethod)
-   {
- case FILE_CURRENT:
-   NtQueryInformationFile(hFile,
-  ,
-  ,
-  sizeof(FILE_POSITION_INFORMATION),
-  FilePositionInformation);
-   FilePosition.CurrentByteOffset.QuadPart += liDistanceToMove.QuadPart;
-   break;
- case FILE_END:
-   NtQueryInformationFile(hFile,
-   ,
-   ,
-   sizeof(FILE_STANDARD_INFORMATION),
-   FileStandardInformation);
-FilePosition.CurrentByteOffset.QuadPart =
-  FileStandard.EndOfFile.QuadPart + liDistanceToMove.QuadPart;
-   break;
- case FILE_BEGIN:
-FilePosition.CurrentByteOffset.QuadPart = liDistanceToMove.QuadPart;
-   break;
- default:
-SetLastError(ERROR_INVALID_PARAMETER);
-   return FALSE;
-   }
+switch (dwMoveMethod)
+{
+case FILE_CURRENT:
+{
+Status = NtQueryInformationFile(hFile, ,
+   ,
+   
sizeof(FILE_POSITION_INFORMATION),
+   
FilePositionInformation);
+if (!NT_SUCCESS(Status))
+{
+BaseSetLastNTError(Status);
+return FALSE;
+}
+
+   FilePosition.CurrentByteOffset.QuadPart += 
liDistanceToMove.QuadPart;
+break;
+}
 
-   if(FilePosition.CurrentByteOffset.QuadPart < 0)
-   {
- SetLastError(ERROR_NEGATIVE_SEEK);
- return FALSE;
-   }
+case FILE_END:
+{
+Status = NtQueryInformationFile(hFile, ,
+,
+sizeof(FILE_STANDARD_INFORMATION),
+FileStandardInformation);
+if (!NT_SUCCESS(Status))
+{
+BaseSetLastNTError(Status);
+return FALSE;
+}
+
+FilePosition.CurrentByteOffset.QuadPart = 
FileStandard.EndOfFile.QuadPart +
+  
liDistanceToMove.QuadPart;
+break;
+}
 
-   errCode = NtSetInformationFile(hFile,
- ,
- ,
- sizeof(FILE_POSITION_INFORMATION),
- FilePositionInformation);
-   if (!NT_SUCCESS(errCode))
- {
-   BaseSetLastNTError(errCode);
-   return FALSE;
- }
+case FILE_BEGIN:
+{
+FilePosition.CurrentByteOffset.QuadPart = 
liDistanceToMove.QuadPart;
+break;
+}
 
-   if (lpNewFilePointer)
- {
+default:
+{
+SetLastError(ERROR_INVALID_PARAMETER);
+return FALSE;
+}
+}
+
+if (FilePosition.CurrentByteOffset.QuadPart < 0)
+{
+SetLastError(ERROR_NEGATIVE_SEEK);
+return FALSE;
+}
+
+Status = NtSetInformationFile(hFile, , ,
+  sizeof(FILE_POSITION_INFORMATION),
+  FilePositionInformation);
+if (!NT_SU

[ros-diffs] [reactos] 02/03: [FFS] Don't leak memory on volume mount CID 1363583

2017-10-23 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=34d74fbd17ce6046c363301df9e67444c205529f

commit 34d74fbd17ce6046c363301df9e67444c205529f
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Oct 23 10:25:40 2017 +0200

[FFS] Don't leak memory on volume mount
CID 1363583
---
 drivers/filesystems/ffs/src/fsctl.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/filesystems/ffs/src/fsctl.c 
b/drivers/filesystems/ffs/src/fsctl.c
index 251ea88b83..175b325820 100644
--- a/drivers/filesystems/ffs/src/fsctl.c
+++ b/drivers/filesystems/ffs/src/fsctl.c
@@ -183,6 +183,9 @@ FFSLoadDiskLabel(
 Vcb->FSOffset[0] = 0;
 Vcb->PartitionNumber = 0;
Vcb->ffs_super_block = FFSSb;
+#ifdef __REACTOS__
+ExFreePoolWithTag(Disklabel, FFS_POOL_TAG);
+#endif
Status = STATUS_SUCCESS;
 return Status;
}
@@ -202,12 +205,18 @@ FFSLoadDiskLabel(
 Vcb->FSOffset[0] = 0;
 Vcb->PartitionNumber = 0;
Vcb->ffs_super_block = FFSSb;
+#ifdef __REACTOS__
+ExFreePoolWithTag(Disklabel, FFS_POOL_TAG);
+#endif
Status = STATUS_SUCCESS;
 return Status;
}
 else
 {
 KdPrint(("FFSLoadDiskLabel() No BSD file system was found on 
the \"normal\" partition.\n"));
+#ifdef __REACTOS__
+ExFreePoolWithTag(Disklabel, FFS_POOL_TAG);
+#endif
 Status = STATUS_UNRECOGNIZED_VOLUME;
 return Status;
 }
@@ -217,6 +226,9 @@ FFSLoadDiskLabel(
if (!NT_SUCCESS(Status))
{
KdPrint(("FFSLoadDiskLabel() Slice info failed, Status %u\n", 
Status));
+#ifdef __REACTOS__
+ExFreePoolWithTag(Disklabel, FFS_POOL_TAG);
+#endif
return Status;
}
 
@@ -303,6 +315,10 @@ FFSLoadDiskLabel(
if (Vcb->ffs_super_block == NULL)
Status = STATUS_UNRECOGNIZED_VOLUME;
 
+#ifdef __REACTOS__
+ExFreePoolWithTag(Disklabel, FFS_POOL_TAG);
+#endif
+
return Status;
 }
 



[ros-diffs] [reactos] 01/03: [FFS] Don't allocate (and leak :-)) an unused event CID 1363607

2017-10-23 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=19bf484a5b5bf50483552aa5bd628203c2cd91e1

commit 19bf484a5b5bf50483552aa5bd628203c2cd91e1
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Oct 23 10:21:32 2017 +0200

[FFS] Don't allocate (and leak :-)) an unused event
CID 1363607
---
 drivers/filesystems/ffs/src/shutdown.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/filesystems/ffs/src/shutdown.c 
b/drivers/filesystems/ffs/src/shutdown.c
index 67062dab9b..ecfcf25ff4 100644
--- a/drivers/filesystems/ffs/src/shutdown.c
+++ b/drivers/filesystems/ffs/src/shutdown.c
@@ -33,7 +33,9 @@ FFSShutDown(
 {
NTSTATUSStatus;
 
+#ifndef __REACTOS__
PKEVENT Event;
+#endif
 
PIRPIrp;
PIO_STACK_LOCATION  IrpSp;
@@ -70,8 +72,10 @@ FFSShutDown(
 
GlobalResourceAcquired = TRUE;
 
+#ifndef __REACTOS__
Event = ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), 
FFS_POOL_TAG);
KeInitializeEvent(Event, NotificationEvent, FALSE);
+#endif
 
for (ListEntry = FFSGlobal->VcbList.Flink;
ListEntry != &(FFSGlobal->VcbList);



[ros-diffs] [reactos] 03/03: [FFS] Don't leak on failure CID 1363596

2017-10-23 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=361664d57fca98f01ec5c6d430d8901873d1ea7a

commit 361664d57fca98f01ec5c6d430d8901873d1ea7a
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Oct 23 10:30:27 2017 +0200

[FFS] Don't leak on failure
CID 1363596
---
 drivers/filesystems/ffs/src/block.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/filesystems/ffs/src/block.c 
b/drivers/filesystems/ffs/src/block.c
index 423842f51b..8507695974 100644
--- a/drivers/filesystems/ffs/src/block.c
+++ b/drivers/filesystems/ffs/src/block.c
@@ -255,6 +255,10 @@ FFSReadWriteBlocks(

(CCHAR)(Vcb->TargetDeviceObject->StackSize + 1));
if (!Irp)
{
+#ifdef __REACTOS__
+ExFreePoolWithTag(pContext, FFS_POOL_TAG);
+pContext = NULL;
+#endif
Status = STATUS_INSUFFICIENT_RESOURCES;
_SEH2_LEAVE;
}
@@ -268,6 +272,10 @@ FFSReadWriteBlocks(
 
if (!Mdl)
{
+#ifdef __REACTOS__
+ExFreePoolWithTag(pContext, FFS_POOL_TAG);
+pContext = NULL;
+#endif
Status = STATUS_INSUFFICIENT_RESOURCES;
_SEH2_LEAVE;
}



[ros-diffs] [reactos] 01/01: [KERNEL32] Check Basep8BitStringToDynamicUnicodeString() return and only call -W in case of success CID 1419330

2017-10-23 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3832f83a32040e17c195513f5671ecec2387e6b0

commit 3832f83a32040e17c195513f5671ecec2387e6b0
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Oct 23 13:39:44 2017 +0200

[KERNEL32] Check Basep8BitStringToDynamicUnicodeString() return and only 
call -W in case of success
CID 1419330
---
 dll/win32/kernel32/client/file/npipe.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/dll/win32/kernel32/client/file/npipe.c 
b/dll/win32/kernel32/client/file/npipe.c
index 535f648e59..ee341580c2 100644
--- a/dll/win32/kernel32/client/file/npipe.c
+++ b/dll/win32/kernel32/client/file/npipe.c
@@ -344,17 +344,18 @@ WINAPI
 WaitNamedPipeA(LPCSTR lpNamedPipeName,
DWORD nTimeOut)
 {
-BOOL r;
+BOOL r = FALSE;
 UNICODE_STRING NameU;
 
 /* Convert the name to Unicode */
-Basep8BitStringToDynamicUnicodeString(, lpNamedPipeName);
-
-/* Call the Unicode API */
-r = WaitNamedPipeW(NameU.Buffer, nTimeOut);
+if (Basep8BitStringToDynamicUnicodeString(, lpNamedPipeName))
+{
+/* Call the Unicode API */
+r = WaitNamedPipeW(NameU.Buffer, nTimeOut);
 
-/* Free the Unicode string */
-RtlFreeUnicodeString();
+/* Free the Unicode string */
+RtlFreeUnicodeString();
+}
 
 /* Return result */
 return r;



[ros-diffs] [reactos] 01/01: [KERNEL32] Fix a FIXME in GetNamedPipeHandleStateW and stub a private function for a left unimplemented function

2017-10-23 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=19cef7806c43e34a00e1eb13dbb9444e722249a8

commit 19cef7806c43e34a00e1eb13dbb9444e722249a8
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Oct 23 14:36:18 2017 +0200

[KERNEL32] Fix a FIXME in GetNamedPipeHandleStateW and stub a private 
function for a left unimplemented function
---
 dll/win32/kernel32/client/file/npipe.c | 36 --
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/dll/win32/kernel32/client/file/npipe.c 
b/dll/win32/kernel32/client/file/npipe.c
index ee341580c2..3ed0c555e3 100644
--- a/dll/win32/kernel32/client/file/npipe.c
+++ b/dll/win32/kernel32/client/file/npipe.c
@@ -20,6 +20,20 @@ LONG ProcessPipeId;
 
 /* FUNCTIONS 
**/
 
+static
+BOOL
+NpGetUserNamep(HANDLE hNamedPipe,
+   LPWSTR lpUserName,
+   DWORD nMaxUserNameSize)
+{
+/* FIXME - open the thread token, call ImpersonateNamedPipeClient() and
+   retrieve the user name with GetUserName(), revert the 
impersonation
+   and finally restore the thread token */
+UNIMPLEMENTED;
+return TRUE;
+}
+
+
 /*
  * @implemented
  */
@@ -935,18 +949,28 @@ GetNamedPipeHandleStateW(HANDLE hNamedPipe,
 *lpMaxCollectionCount = RemoteInfo.MaximumCollectionCount;
 }
 
-if(lpCollectDataTimeout != NULL)
+if (lpCollectDataTimeout != NULL)
 {
-/* FIXME */
-   *lpCollectDataTimeout = 0;
+LARGE_INTEGER CollectDataTime;
+
+/* Convert time and return it */
+RemoteInfo.CollectDataTime.QuadPart *= -1;
+CollectDataTime = 
RtlExtendedLargeIntegerDivide(RemoteInfo.CollectDataTime, 1, NULL);
+/* In case of overflow, just return MAX - 1 */
+if (CollectDataTime.HighPart != 0)
+{
+*lpCollectDataTimeout = -2;
+}
+else
+{
+*lpCollectDataTimeout = CollectDataTime.LowPart;
+}
 }
 }
 
 if (lpUserName != NULL)
 {
-  /* FIXME - open the thread token, call ImpersonateNamedPipeClient() and
- retrieve the user name with GetUserName(), revert the 
impersonation
- and finally restore the thread token */
+return NpGetUserNamep(hNamedPipe, lpUserName, nMaxUserNameSize);
 }
 
 return TRUE;



[ros-diffs] [reactos] 01/01: [CDFS_NEW] Fix broken cast. Spotted by Thomas

2017-11-25 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9d67a24799e29e832933311a8e6ba21787e40f6a

commit 9d67a24799e29e832933311a8e6ba21787e40f6a
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 25 20:15:28 2017 +0100

[CDFS_NEW] Fix broken cast.
Spotted by Thomas
---
 drivers/filesystems/cdfs_new/cddata.c  | 1 +
 drivers/filesystems/cdfs_new/cdprocs.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/filesystems/cdfs_new/cddata.c 
b/drivers/filesystems/cdfs_new/cddata.c
index ff2c61cfaf..70af0b127b 100755
--- a/drivers/filesystems/cdfs_new/cddata.c
+++ b/drivers/filesystems/cdfs_new/cddata.c
@@ -211,6 +211,7 @@ __drv_dispatchType(IRP_MJ_CLEANUP)
 __drv_dispatchType(IRP_MJ_PNP)
 __drv_dispatchType(IRP_MJ_SHUTDOWN)
 NTSTATUS
+NTAPI
 CdFsdDispatch (
 _In_ PDEVICE_OBJECT DeviceObject,
 _Inout_ PIRP Irp
diff --git a/drivers/filesystems/cdfs_new/cdprocs.h 
b/drivers/filesystems/cdfs_new/cdprocs.h
index 6c957aebba..1d788b28e1 100755
--- a/drivers/filesystems/cdfs_new/cdprocs.h
+++ b/drivers/filesystems/cdfs_new/cdprocs.h
@@ -1761,6 +1761,7 @@ __drv_dispatchType(IRP_MJ_CLEANUP)
 __drv_dispatchType(IRP_MJ_PNP)
 __drv_dispatchType(IRP_MJ_SHUTDOWN)
 NTSTATUS
+NTAPI
 CdFsdDispatch (
 _In_ PDEVICE_OBJECT DeviceObject,
 _Inout_ PIRP Irp



[ros-diffs] [reactos] 01/01: [FASTFAT_NEW] Fix build with FASTFATDBG set

2017-11-24 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3013e153b0e085de0abd2b2eeb83bdfaf6eded13

commit 3013e153b0e085de0abd2b2eeb83bdfaf6eded13
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Fri Nov 24 12:00:10 2017 +0100

[FASTFAT_NEW] Fix build with FASTFATDBG set
---
 drivers/filesystems/fastfat_new/fatdata.h | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/filesystems/fastfat_new/fatdata.h 
b/drivers/filesystems/fastfat_new/fatdata.h
index 18fb891aab..ad4d1fb812 100644
--- a/drivers/filesystems/fastfat_new/fatdata.h
+++ b/drivers/filesystems/fastfat_new/fatdata.h
@@ -234,6 +234,7 @@ extern LONG FatDebugTraceIndent;
 }   \
 }
 
+#ifdef _MSC_VER
 #define DebugDump(STR,LEVEL,PTR) {  \
 __pragma(warning(push)) \
 __pragma(warning(disable:4210)) \
@@ -248,9 +249,22 @@ extern LONG FatDebugTraceIndent;
 }   \
 __pragma(warning(pop))  \
 }
+#else
+#define DebugDump(STR,LEVEL,PTR) {  \
+ULONG _i;   \
+VOID FatDump(IN PVOID Ptr); \
+if (((LEVEL) == 0) || (FatDebugTraceLevel & (LEVEL))) { \
+_i = (ULONG)PsGetCurrentThread();   \
+DbgPrint("%08lx:",_i);  \
+DbgPrint(STR);  \
+if (PTR != NULL) {FatDump(PTR);}\
+NT_ASSERT(FALSE);   \
+}   \
+}
+#endif
 
 #define DebugUnwind(X) {  \
-if (AbnormalTermination()) { \
+if (_SEH2_AbnormalTermination()) {\
 DebugTrace(0, DEBUG_TRACE_UNWIND, #X ", Abnormal termination.\n", 0); \
 } \
 }



[ros-diffs] [reactos] 01/02: [NTOSKRNL] Use cache aligned buffer for devioctrl

2017-11-26 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d01184b16460b014fe9b19c5a142eb0ed88e6455

commit d01184b16460b014fe9b19c5a142eb0ed88e6455
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 26 13:56:48 2017 +0100

[NTOSKRNL] Use cache aligned buffer for devioctrl
---
 ntoskrnl/io/iomgr/iofunc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ntoskrnl/io/iomgr/iofunc.c b/ntoskrnl/io/iomgr/iofunc.c
index 46fcce201d..bde78e4f96 100644
--- a/ntoskrnl/io/iomgr/iofunc.c
+++ b/ntoskrnl/io/iomgr/iofunc.c
@@ -213,6 +213,7 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
 ACCESS_MASK DesiredAccess;
 KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
 ULONG BufferLength;
+POOL_TYPE PoolType;
 
 PAGED_CODE();
 
@@ -495,6 +496,8 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
 StackPtr->Parameters.DeviceIoControl.OutputBufferLength =
 OutputBufferLength;
 
+PoolType = IsDevIoCtl ? NonPagedPoolCacheAligned : NonPagedPool;
+
 /* Handle the Methods */
 switch (AccessType)
 {
@@ -513,7 +516,7 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
 {
 /* Allocate the System Buffer */
 Irp->AssociatedIrp.SystemBuffer =
-ExAllocatePoolWithTag(NonPagedPool,
+ExAllocatePoolWithTag(PoolType,
   BufferLength,
   TAG_SYS_BUF);
 
@@ -560,7 +563,7 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
 {
 /* Allocate the System Buffer */
 Irp->AssociatedIrp.SystemBuffer =
-ExAllocatePoolWithTag(NonPagedPool,
+ExAllocatePoolWithTag(PoolType,
   InputBufferLength,
   TAG_SYS_BUF);
 



[ros-diffs] [reactos] 02/02: [NTOSKRNL] Use ExAllocatePoolWithQuotaTag() when allocating SystemBuffer for the IRP That way, in case the system lacks memory, an exception is thrown and IRP isn't sent t

2017-11-26 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9ecbbe2a338619c9d9f7c52a6e7af24adc5fb174

commit 9ecbbe2a338619c9d9f7c52a6e7af24adc5fb174
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 26 14:01:04 2017 +0100

[NTOSKRNL] Use ExAllocatePoolWithQuotaTag() when allocating SystemBuffer 
for the IRP
That way, in case the system lacks memory, an exception is thrown and IRP 
isn't sent
to the device with NULL SystemBuffer.

CORE-14048
---
 ntoskrnl/io/iomgr/iofunc.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ntoskrnl/io/iomgr/iofunc.c b/ntoskrnl/io/iomgr/iofunc.c
index bde78e4f96..19f54e070d 100644
--- a/ntoskrnl/io/iomgr/iofunc.c
+++ b/ntoskrnl/io/iomgr/iofunc.c
@@ -516,9 +516,9 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
 {
 /* Allocate the System Buffer */
 Irp->AssociatedIrp.SystemBuffer =
-ExAllocatePoolWithTag(PoolType,
-  BufferLength,
-  TAG_SYS_BUF);
+ExAllocatePoolWithQuotaTag(PoolType,
+   BufferLength,
+   TAG_SYS_BUF);
 
 /* Check if we got a buffer */
 if (InputBuffer)
@@ -563,9 +563,9 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
 {
 /* Allocate the System Buffer */
 Irp->AssociatedIrp.SystemBuffer =
-ExAllocatePoolWithTag(PoolType,
-  InputBufferLength,
-  TAG_SYS_BUF);
+ExAllocatePoolWithQuotaTag(PoolType,
+   InputBufferLength,
+   TAG_SYS_BUF);
 
 /* Copy into the System Buffer */
 RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer,



[ros-diffs] [reactos] 01/01: [LIBTIRPC] Match rtime() propotype and implementation

2017-11-26 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1feb8e627efd1515097505a675aa4f2e6d8cf15c

commit 1feb8e627efd1515097505a675aa4f2e6d8cf15c
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 26 14:44:26 2017 +0100

[LIBTIRPC] Match rtime() propotype and implementation
---
 dll/3rdparty/libtirpc/tirpc/rpc/auth_des.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/dll/3rdparty/libtirpc/tirpc/rpc/auth_des.h 
b/dll/3rdparty/libtirpc/tirpc/rpc/auth_des.h
index f3f9f31fef..9aa96cb11e 100644
--- a/dll/3rdparty/libtirpc/tirpc/rpc/auth_des.h
+++ b/dll/3rdparty/libtirpc/tirpc/rpc/auth_des.h
@@ -121,8 +121,12 @@ __END_DECLS
 __BEGIN_DECLS
 extern bool_t  xdr_authdes_cred(XDR *, struct authdes_cred *);
 extern bool_t  xdr_authdes_verf(XDR *, struct authdes_verf *);
+#ifndef __REACTOS__
 extern int rtime(dev_t, struct netbuf *, int, struct timeval *,
struct timeval *);
+#else
+extern int rtime(struct sockaddr_in *, struct timeval *, struct timeval *);
+#endif
 extern voidkgetnetname(char *);
 extern enum auth_stat _svcauth_des(struct svc_req *, struct rpc_msg *);
 __END_DECLS



[ros-diffs] [reactos] 01/01: [FASTFAT_NEW] Fix build with FASTFATDBG set

2017-11-23 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f15769d95863bb17bd12188ff40fd8e04e4b3820

commit f15769d95863bb17bd12188ff40fd8e04e4b3820
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Thu Nov 23 14:18:15 2017 +0100

[FASTFAT_NEW] Fix build with FASTFATDBG set
---
 drivers/filesystems/fastfat_new/dirsup.c  | 4 
 drivers/filesystems/fastfat_new/fatdata.h | 2 +-
 drivers/filesystems/fastfat_new/pnp.c | 4 
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/filesystems/fastfat_new/dirsup.c 
b/drivers/filesystems/fastfat_new/dirsup.c
index 71689e8d90..8ca1f6ad53 100644
--- a/drivers/filesystems/fastfat_new/dirsup.c
+++ b/drivers/filesystems/fastfat_new/dirsup.c
@@ -1991,7 +1991,11 @@ Return Value:
 ULONG ByteOffset;
 PDIRENT Dirent;
 
+#ifndef __REACTOS__
 BOOLEAN IsDirectoryEmpty;
+#else
+BOOLEAN IsDirectoryEmpty = FALSE;
+#endif
 
 NTSTATUS Status;
 
diff --git a/drivers/filesystems/fastfat_new/fatdata.h 
b/drivers/filesystems/fastfat_new/fatdata.h
index 0d0493f4e7..4d8aa2eeeb 100644
--- a/drivers/filesystems/fastfat_new/fatdata.h
+++ b/drivers/filesystems/fastfat_new/fatdata.h
@@ -243,7 +243,7 @@ extern LONG FatDebugTraceIndent;
 }
 
 #define DebugUnwind(X) {  \
-if (AbnormalTermination()) { \
+if (_SEH2_AbnormalTermination()) {\
 DebugTrace(0, DEBUG_TRACE_UNWIND, #X ", Abnormal termination.\n", 0); \
 } \
 }
diff --git a/drivers/filesystems/fastfat_new/pnp.c 
b/drivers/filesystems/fastfat_new/pnp.c
index 9604a961e8..26a9ed533f 100644
--- a/drivers/filesystems/fastfat_new/pnp.c
+++ b/drivers/filesystems/fastfat_new/pnp.c
@@ -22,6 +22,10 @@ Abstract:
 
 #define BugCheckFileId   (FAT_BUG_CHECK_PNP)
 
+#ifdef __REACTOS__
+#define Dbg  (DEBUG_TRACE_PNP)
+#endif
+
 NTSTATUS
 FatPnpQueryRemove (
 PIRP_CONTEXT IrpContext,



[ros-diffs] [reactos] 01/02: [PSDK] Add various defines needed to build fastfat_new

2017-11-23 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d8a15d0cc739197143cefe50a083466964809a8a

commit d8a15d0cc739197143cefe50a083466964809a8a
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Thu Nov 23 23:23:16 2017 +0100

[PSDK] Add various defines needed to build fastfat_new
---
 sdk/include/psdk/ntdddisk.h |  3 +++
 sdk/include/psdk/ntddscsi.h | 22 ++
 sdk/include/psdk/ntstatus.h |  1 +
 3 files changed, 26 insertions(+)

diff --git a/sdk/include/psdk/ntdddisk.h b/sdk/include/psdk/ntdddisk.h
index 44ab027a22..064ebbfd76 100644
--- a/sdk/include/psdk/ntdddisk.h
+++ b/sdk/include/psdk/ntdddisk.h
@@ -182,6 +182,9 @@ extern "C" {
 #define IOCTL_DISK_VERIFY \
   CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
+#define IOCTL_DISK_COPY_DATA \
+  CTL_CODE(IOCTL_DISK_BASE, 0x0019, METHOD_BUFFERED, FILE_READ_ACCESS | 
FILE_WRITE_ACCESS)
+
 #define SMART_GET_VERSION \
   CTL_CODE(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
 
diff --git a/sdk/include/psdk/ntddscsi.h b/sdk/include/psdk/ntddscsi.h
index 2e8e5d9ab8..14a9cef230 100644
--- a/sdk/include/psdk/ntddscsi.h
+++ b/sdk/include/psdk/ntddscsi.h
@@ -34,6 +34,8 @@ extern "C" {
 #define IOCTL_SCSI_RESCAN_BUS 
CTL_CODE(IOCTL_SCSI_BASE,0x0407,METHOD_BUFFERED,FILE_ANY_ACCESS)
 #define IOCTL_SCSI_GET_DUMP_POINTERS 
CTL_CODE(IOCTL_SCSI_BASE,0x0408,METHOD_BUFFERED,FILE_ANY_ACCESS)
 #define IOCTL_SCSI_FREE_DUMP_POINTERS 
CTL_CODE(IOCTL_SCSI_BASE,0x0409,METHOD_BUFFERED,FILE_ANY_ACCESS)
+#define IOCTL_SCSI_PASS_THROUGH_EX CTL_CODE(IOCTL_SCSI_BASE, 0x0411, 
METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+#define IOCTL_SCSI_PASS_THROUGH_DIRECT_EX CTL_CODE(IOCTL_SCSI_BASE, 0x0412, 
METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
 #define IOCTL_IDE_PASS_THROUGH 
CTL_CODE(IOCTL_SCSI_BASE,0x040a,METHOD_BUFFERED,FILE_READ_ACCESS | 
FILE_WRITE_ACCESS)
 #define IOCTL_ATA_PASS_THROUGH 
CTL_CODE(IOCTL_SCSI_BASE,0x040b,METHOD_BUFFERED,FILE_READ_ACCESS | 
FILE_WRITE_ACCESS)
 #define IOCTL_ATA_PASS_THROUGH_DIRECT 
CTL_CODE(IOCTL_SCSI_BASE,0x040c,METHOD_BUFFERED,FILE_READ_ACCESS | 
FILE_WRITE_ACCESS)
@@ -104,6 +106,26 @@ extern "C" {
   } SCSI_PASS_THROUGH_DIRECT32,*PSCSI_PASS_THROUGH_DIRECT32;
 #endif /* _WIN64 */
 
+
+  typedef struct _SCSI_PASS_THROUGH_EX {
+ULONG Version;
+ULONG Length;
+ULONG CdbLength;
+ULONG StorAddressLength;
+UCHAR ScsiStatus;
+UCHAR SenseInfoLength;
+UCHAR DataDirection;
+UCHAR Reserved;
+ULONG TimeOutValue;
+ULONG StorAddressOffset;
+ULONG SenseInfoOffset;
+ULONG DataOutTransferLength;
+ULONG DataInTransferLength;
+ULONG_PTR DataOutBufferOffset;
+ULONG_PTR DataInBufferOffset;
+UCHAR Cdb[ANYSIZE_ARRAY];
+  } SCSI_PASS_THROUGH_EX, *PSCSI_PASS_THROUGH_EX;
+
   typedef struct _ATA_PASS_THROUGH_EX {
 USHORT Length;
 USHORT AtaFlags;
diff --git a/sdk/include/psdk/ntstatus.h b/sdk/include/psdk/ntstatus.h
index a9552633e7..1879503517 100644
--- a/sdk/include/psdk/ntstatus.h
+++ b/sdk/include/psdk/ntstatus.h
@@ -947,6 +947,7 @@ extern "C" {
 #define STATUS_CALLBACK_POP_STACK   ((NTSTATUS)0xC423)
 #define STATUS_HIVE_UNLOADED((NTSTATUS)0xC425)
 #define STATUS_ELEVATION_REQUIRED   ((NTSTATUS)0xC42C)
+#define STATUS_PURGE_FAILED ((NTSTATUS)0xC435)
 #define STATUS_ALREADY_REGISTERED   ((NTSTATUS)0xC718)
 #define STATUS_WOW_ASSERTION((NTSTATUS)0xC0009898)
 #define STATUS_INVALID_SIGNATURE((NTSTATUS)0xC000A000)



[ros-diffs] [reactos] 01/01: [VFATLIB] Never touch the file system if not in interactive or RW mode. It's critical not to perform any write on a volume without an exclusive lock on it. That lock is on

2017-12-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b0bf7dfb62400227e8fb33fbeafcb0da02145439

commit b0bf7dfb62400227e8fb33fbeafcb0da02145439
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Dec 17 13:59:20 2017 +0100

[VFATLIB] Never touch the file system if not in interactive or RW mode.
It's critical not to perform any write on a volume without an exclusive 
lock on it.
That lock is only acquired if ChkDsk is started in RW mode.
Also added an assert in write routine, to make sure that when we're about 
to perform
a write operation, we're really allowed to do so.

This will avoid volume corruptions when a simple "chkdsk" is issued from 
cmd.
To put it simple: check will really check now, and won't attempt any repair.

CORE-14119
---
 sdk/lib/fslib/vfatlib/check/check.c | 198 +++-
 sdk/lib/fslib/vfatlib/check/fat.c   |  54 +-
 sdk/lib/fslib/vfatlib/check/io.c|   2 +
 3 files changed, 137 insertions(+), 117 deletions(-)

diff --git a/sdk/lib/fslib/vfatlib/check/check.c 
b/sdk/lib/fslib/vfatlib/check/check.c
index 5315e3684c..dcf1808687 100644
--- a/sdk/lib/fslib/vfatlib/check/check.c
+++ b/sdk/lib/fslib/vfatlib/check/check.c
@@ -493,23 +493,25 @@ static int handle_dot(DOS_FS * fs, DOS_FILE * file, int 
dots)
if (interactive)
printf("1) Drop it\n2) Auto-rename\n3) Rename\n"
   "4) Convert to directory\n");
-   else
+   else if (rw)
printf("  Auto-renaming it.\n");
-   switch (interactive ? get_key("1234", "?") : '2') {
-   case '1':
-   drop_file(fs, file);
-   return 1;
-   case '2':
-   auto_rename(file);
-   printf("  Renamed to %s\n", file_name(file->dir_ent.name));
-   return 0;
-   case '3':
-   rename_file(file);
+   if (rw || interactive) {
+   switch (interactive ? get_key("1234", "?") : '2') {
+   case '1':
+   drop_file(fs, file);
+   return 1;
+   case '2':
+   auto_rename(file);
+   printf("  Renamed to %s\n", file_name(file->dir_ent.name));
+   return 0;
+   case '3':
+   rename_file(file);
return 0;
-   case '4':
-   MODIFY(file, size, htole32(0));
-   MODIFY(file, attr, file->dir_ent.attr | ATTR_DIR);
-   break;
+   case '4':
+   MODIFY(file, size, htole32(0));
+   MODIFY(file, attr, file->dir_ent.attr | ATTR_DIR);
+   break;
+   }
}
 }
 if (!dots) {
@@ -528,9 +530,9 @@ static int check_file(DOS_FS * fs, DOS_FILE * file)
 
 if (file->dir_ent.attr & ATTR_DIR) {
if (le32toh(file->dir_ent.size)) {
-   printf("%s\n  Directory has non-zero size. Fixing it.\n",
-  path_name(file));
-   MODIFY(file, size, htole32(0));
+   printf("%s\n  Directory has non-zero size.%s\n",
+  path_name(file), (rw) ? " Fixing it." : "");
+   if (rw) MODIFY(file, size, htole32(0));
}
if (file->parent
&& !strncmp((const char *)file->dir_ent.name, MSDOS_DOT,
@@ -539,7 +541,7 @@ static int check_file(DOS_FS * fs, DOS_FILE * file)
if (FSTART(file, fs) != expect) {
printf("%s\n  Start (%lu) does not point to parent (%lu)\n",
   path_name(file), (unsigned long)FSTART(file, fs), 
(long)expect);
-   MODIFY_START(file, expect, fs);
+   if (rw) MODIFY_START(file, expect, fs);
}
return 0;
}
@@ -553,14 +555,14 @@ static int check_file(DOS_FS * fs, DOS_FILE * file)
if (FSTART(file, fs) != expect) {
printf("%s\n  Start (%lu) does not point to .. (%lu)\n",
   path_name(file), (unsigned long)FSTART(file, fs), 
(unsigned long)expect);
-   MODIFY_START(file, expect, fs);
+   if (rw) MODIFY_START(file, expect, fs);
}
return 0;
}
if (FSTART(file, fs) == 0) {
-   printf("%s\n Start does point to root directory. Deleting dir. \n",
-  path_name(file));
-   MODIFY(file, name[0], DELETED_FLAG);
+   printf("%s\n Start does point to root directory.%s\n",
+  path_name(file), (rw) ? " Deleting dir. " : "");
+   if (rw) MODIFY(file, name[0], DELETED_FLAG);
return 0;
}
 }
@@ -569,18 +571,19 @@ static int check_file(DOS_FS * fs, DOS_FILE * file)
   path_name(file));
if (!file->offset)
die(&qu

[ros-diffs] [reactos] 01/03: [FASTFAT] When not able to lock a volume due to open handles, print open handles

2017-12-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=27773dbb3f1ab3f93a24a742bec91676bf3a70a4

commit 27773dbb3f1ab3f93a24a742bec91676bf3a70a4
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Dec 17 18:19:03 2017 +0100

[FASTFAT] When not able to lock a volume due to open handles, print open 
handles
---
 drivers/filesystems/fastfat/fsctl.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/filesystems/fastfat/fsctl.c 
b/drivers/filesystems/fastfat/fsctl.c
index a406276ee6..f059410044 100644
--- a/drivers/filesystems/fastfat/fsctl.c
+++ b/drivers/filesystems/fastfat/fsctl.c
@@ -1115,6 +1115,22 @@ VfatLockOrUnlockVolume(
 /* Deny locking if we're not alone */
 if (Lock && DeviceExt->OpenHandleCount != 1)
 {
+PLIST_ENTRY ListEntry;
+
+DPRINT1("Can't lock: %u opened\n", DeviceExt->OpenHandleCount);
+
+ListEntry = DeviceExt->FcbListHead.Flink;
+while (ListEntry != >FcbListHead)
+{
+Fcb = CONTAINING_RECORD(ListEntry, VFATFCB, FcbListEntry);
+ListEntry = ListEntry->Flink;
+
+if (Fcb->OpenHandleCount  > 0)
+{
+DPRINT1("Opened (%u - %u): %wZ\n", Fcb->OpenHandleCount, 
Fcb->RefCount, >PathNameU);
+}
+}
+
 return STATUS_ACCESS_DENIED;
 }
 



[ros-diffs] [reactos] 02/03: [FASTFAT] Fix a handle count leak on volume close. This can prevent locking a volume!

2017-12-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=de0368614814293c40517551911c0057bde7dfed

commit de0368614814293c40517551911c0057bde7dfed
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Dec 17 18:20:04 2017 +0100

[FASTFAT] Fix a handle count leak on volume close. This can prevent locking 
a volume!
---
 drivers/filesystems/fastfat/cleanup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/filesystems/fastfat/cleanup.c 
b/drivers/filesystems/fastfat/cleanup.c
index 85b4ea2d2c..d584dee859 100644
--- a/drivers/filesystems/fastfat/cleanup.c
+++ b/drivers/filesystems/fastfat/cleanup.c
@@ -41,6 +41,7 @@ VfatCleanupFile(
 if (IsVolume)
 {
 pFcb->OpenHandleCount--;
+DeviceExt->OpenHandleCount--;
 
 if (pFcb->OpenHandleCount != 0)
 {



[ros-diffs] [reactos] 03/03: [FASTFAT] While closing FCBs on dismount, release from tail to head and not the contrary. It fixes assertion failure in vfatDestroyFCB() where we would have release parent

2017-12-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=64bc96558e878cc91da148ec5892a7e2bf58e052

commit 64bc96558e878cc91da148ec5892a7e2bf58e052
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Dec 17 18:21:51 2017 +0100

[FASTFAT] While closing FCBs on dismount, release from tail to head and not 
the contrary.
It fixes assertion failure in vfatDestroyFCB() where we would have release 
parent before child.
This is still not perfect, but less bug prone...

With this commits (and ENABLE_SWAPOUT defined), ReactOS seems to unmount 
FAT volumes quite nice! :-)
(Tried with fsutil volume dismount X:)
---
 drivers/filesystems/fastfat/fsctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/filesystems/fastfat/fsctl.c 
b/drivers/filesystems/fastfat/fsctl.c
index f059410044..abd772648a 100644
--- a/drivers/filesystems/fastfat/fsctl.c
+++ b/drivers/filesystems/fastfat/fsctl.c
@@ -1203,7 +1203,7 @@ VfatDismountVolume(
 /* Rebrowse the FCB in order to free them now */
 while (!IsListEmpty(>FcbListHead))
 {
-NextEntry = RemoveHeadList(>FcbListHead);
+NextEntry = RemoveTailList(>FcbListHead);
 Fcb = CONTAINING_RECORD(NextEntry, VFATFCB, FcbListEntry);
 vfatDestroyFCB(Fcb);
 }



[ros-diffs] [reactos] 01/01: [FASTFAT] Add a comment (and an ASSERT) in VfatCreateFile() that shows that my stats code is broken...

2017-12-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dcd95c1a85d88c2adc98af14194e9b3057cbcb27

commit dcd95c1a85d88c2adc98af14194e9b3057cbcb27
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Dec 17 18:25:43 2017 +0100

[FASTFAT] Add a comment (and an ASSERT) in VfatCreateFile() that shows that 
my stats code is broken...
---
 drivers/filesystems/fastfat/create.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/filesystems/fastfat/create.c 
b/drivers/filesystems/fastfat/create.c
index 248d99e7f7..20a4bc0d04 100644
--- a/drivers/filesystems/fastfat/create.c
+++ b/drivers/filesystems/fastfat/create.c
@@ -982,6 +982,8 @@ VfatCreateFile(
 
 /* FIXME : test write access if requested */
 
+/* FIXME: That is broken, we cannot reach this code path with failure */
+ASSERT(NT_SUCCESS(Status));
 if (NT_SUCCESS(Status))
 {
 vfatAddToStat(DeviceExt, Fat.SuccessfulCreates, 1);



[ros-diffs] [reactos] 01/01: [FS] During 1st stage, disable any FS we don't support install to in order to let RawFS these volumes. This avoids bloated setup and avoids potential bugs in 3rd party dri

2017-12-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5a650f6ba50a270faf37c36f8054b931dd9b4272

commit 5a650f6ba50a270faf37c36f8054b931dd9b4272
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Dec 18 08:44:24 2017 +0100

[FS] During 1st stage, disable any FS we don't support install to in order 
to let RawFS these volumes.
This avoids bloated setup and avoids potential bugs in 3rd party drivers.

This is following 806cd1.
---
 boot/bootdata/txtsetup.sif  | 4 
 drivers/filesystems/ext2/CMakeLists.txt | 2 +-
 drivers/filesystems/ffs/CMakeLists.txt  | 2 +-
 drivers/filesystems/reiserfs/CMakeLists.txt | 2 +-
 drivers/filesystems/udfs/CMakeLists.txt | 2 +-
 5 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/boot/bootdata/txtsetup.sif b/boot/bootdata/txtsetup.sif
index 822c19c8c8..7a86befd28 100644
--- a/boot/bootdata/txtsetup.sif
+++ b/boot/bootdata/txtsetup.sif
@@ -57,7 +57,6 @@ scsiport.sys=,,x,,4
 storport.sys=,,x,,4
 fastfat.sys=,,x,,4
 ramdisk.sys=,,x,,4
-ext2fs.sys=,,x,,4
 classpnp.sys=4
 pciide.sys=4
 pciidex.sys=4
@@ -68,9 +67,6 @@ ntdll.dll=2
 wmilib.sys=4
 ksecdd.sys=4
 mountmgr.sys=,,x,,4
-reiserfs.sys=,,x,,4
-ffs.sys=,,x,,4
-udfs.sys=,,x,,4
 
 [SystemPartitionFiles]
 
diff --git a/drivers/filesystems/ext2/CMakeLists.txt 
b/drivers/filesystems/ext2/CMakeLists.txt
index 6d0bdb7d01..94b077b0c4 100644
--- a/drivers/filesystems/ext2/CMakeLists.txt
+++ b/drivers/filesystems/ext2/CMakeLists.txt
@@ -118,4 +118,4 @@ if(NOT USE_CLANG_CL)
 add_pch(ext2fs inc/ext2fs.h SOURCE)
 endif()
 
-add_cd_file(TARGET ext2fs DESTINATION reactos/system32/drivers NO_CAB FOR all)
+add_cd_file(TARGET ext2fs DESTINATION reactos/system32/drivers FOR all)
diff --git a/drivers/filesystems/ffs/CMakeLists.txt 
b/drivers/filesystems/ffs/CMakeLists.txt
index 8138a15a5a..6f371875b2 100644
--- a/drivers/filesystems/ffs/CMakeLists.txt
+++ b/drivers/filesystems/ffs/CMakeLists.txt
@@ -45,5 +45,5 @@ set_module_type(ffs kernelmodedriver)
 target_link_libraries(ffs memcmp ${PSEH_LIB})
 add_importlibs(ffs ntoskrnl hal)
 add_pch(ffs inc/ffsdrv.h SOURCE)
-add_cd_file(TARGET ffs DESTINATION reactos/system32/drivers NO_CAB FOR all)
+add_cd_file(TARGET ffs DESTINATION reactos/system32/drivers FOR all)
 
diff --git a/drivers/filesystems/reiserfs/CMakeLists.txt 
b/drivers/filesystems/reiserfs/CMakeLists.txt
index 7990886489..95d70eaf01 100644
--- a/drivers/filesystems/reiserfs/CMakeLists.txt
+++ b/drivers/filesystems/reiserfs/CMakeLists.txt
@@ -95,4 +95,4 @@ add_definitions(-D__KERNEL__)
 set_module_type(reiserfs kernelmodedriver)
 add_importlibs(reiserfs ntoskrnl hal)
 add_pch(reiserfs inc/rfsd.h SOURCE)
-add_cd_file(TARGET reiserfs DESTINATION reactos/system32/drivers NO_CAB FOR 
all)
+add_cd_file(TARGET reiserfs DESTINATION reactos/system32/drivers FOR all)
diff --git a/drivers/filesystems/udfs/CMakeLists.txt 
b/drivers/filesystems/udfs/CMakeLists.txt
index 8b5df85fcf..8bb85aa627 100644
--- a/drivers/filesystems/udfs/CMakeLists.txt
+++ b/drivers/filesystems/udfs/CMakeLists.txt
@@ -60,5 +60,5 @@ set_module_type(udfs kernelmodedriver)
 target_link_libraries(udfs ${PSEH_LIB})
 add_importlibs(udfs ntoskrnl hal)
 add_pch(udfs udffs.h SOURCE)
-add_cd_file(TARGET udfs DESTINATION reactos/system32/drivers NO_CAB FOR all)
+add_cd_file(TARGET udfs DESTINATION reactos/system32/drivers FOR all)
 add_registry_inf(udfs_reg.inf)



[ros-diffs] [reactos] 01/01: [KERNEL32_APITEST] Add a test for FormatMessage backed with MC file.

2017-12-16 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=72094e637d788448f4e1f3c121e1881343e17c07

commit 72094e637d788448f4e1f3c121e1881343e17c07
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Dec 16 19:39:37 2017 +0100

[KERNEL32_APITEST] Add a test for FormatMessage backed with MC file.
---
 modules/rostests/apitests/kernel32/CMakeLists.txt  |  6 ++-
 modules/rostests/apitests/kernel32/FormatMessage.c | 51 ++
 .../rostests/apitests/kernel32/FormatMessage.mc| 14 ++
 .../rostests/apitests/kernel32/kernel32_apitest.rc |  6 +++
 modules/rostests/apitests/kernel32/testlist.c  |  2 +
 5 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/modules/rostests/apitests/kernel32/CMakeLists.txt 
b/modules/rostests/apitests/kernel32/CMakeLists.txt
index 06edd1b9c3..c329031929 100644
--- a/modules/rostests/apitests/kernel32/CMakeLists.txt
+++ b/modules/rostests/apitests/kernel32/CMakeLists.txt
@@ -1,6 +1,8 @@
 
 add_subdirectory(redirptest)
 
+add_message_headers(ANSI FormatMessage.mc)
+
 list(APPEND SOURCE
 Console.c
 CreateProcess.c
@@ -9,6 +11,7 @@ list(APPEND SOURCE
 dosdev.c
 FindActCtxSectionStringW.c
 FindFiles.c
+FormatMessage.c
 GetComputerNameEx.c
 GetCurrentDirectory.c
 GetDriveType.c
@@ -30,11 +33,12 @@ list(APPEND SOURCE
 WideCharToMultiByte.c
 precomp.h)
 
-add_executable(kernel32_apitest ${SOURCE} testlist.c)
+add_executable(kernel32_apitest ${SOURCE} testlist.c kernel32_apitest.rc)
 target_link_libraries(kernel32_apitest wine ${PSEH_LIB})
 set_module_type(kernel32_apitest win32cui)
 add_delay_importlibs(kernel32_apitest advapi32 shlwapi)
 add_importlibs(kernel32_apitest msvcrt kernel32 ntdll)
+add_dependencies(kernel32_apitest FormatMessage)
 add_pch(kernel32_apitest precomp.h SOURCE)
 add_rostests_file(TARGET kernel32_apitest)
 
diff --git a/modules/rostests/apitests/kernel32/FormatMessage.c 
b/modules/rostests/apitests/kernel32/FormatMessage.c
new file mode 100644
index 00..ed2284daa1
--- /dev/null
+++ b/modules/rostests/apitests/kernel32/FormatMessage.c
@@ -0,0 +1,51 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Test for FormatMessage and resources
+ * PROGRAMMERS: Pierre Schweitzer
+ */
+
+#include 
+#include 
+
+WCHAR First[] = L"This is a test message.\r\n";
+WCHAR Second[] = L"This is a second test message.\r\n";
+
+START_TEST(FormatMessage)
+{
+PWSTR Buffer;
+DWORD Written;
+
+Buffer = NULL;
+Written = FormatMessageW(FORMAT_MESSAGE_FROM_HMODULE | 
FORMAT_MESSAGE_ALLOCATE_BUFFER,
+ NULL, MSG_FIRST_MESSAGE, 0, (LPWSTR), 0, 
NULL);
+ok(Written != 0, "Unexpected error: %lx\n", GetLastError());
+ok(Buffer != NULL, "No buffer allocated\n");
+ok(Written == (sizeof(First) - sizeof(UNICODE_NULL)) / sizeof(WCHAR),
+   "Invalid size: %ld (expected: %d)\n",
+   Written, (sizeof(First) - sizeof(UNICODE_NULL)) / sizeof(WCHAR));
+ok(RtlCompareMemory(Buffer, First, sizeof(First) - sizeof(UNICODE_NULL)) ==
+sizeof(First) - sizeof(UNICODE_NULL),
+   "Mismatching string: %S (expected : %S)\n", Buffer, First);
+LocalFree(Buffer);
+
+Buffer = NULL;
+Written = FormatMessageW(FORMAT_MESSAGE_FROM_HMODULE | 
FORMAT_MESSAGE_ALLOCATE_BUFFER,
+ NULL, MSG_SECOND_MESSAGE, 0, (LPWSTR), 0, 
NULL);
+ok(Written != 0, "Unexpected error: %lx\n", GetLastError());
+ok(Buffer != NULL, "No buffer allocated\n");
+ok(Written == (sizeof(Second) - sizeof(UNICODE_NULL)) / sizeof(WCHAR),
+   "Invalid size: %ld (expected: %d)\n",
+   Written, (sizeof(Second) - sizeof(UNICODE_NULL)) / sizeof(WCHAR));
+ok(RtlCompareMemory(Buffer, Second, sizeof(Second) - sizeof(UNICODE_NULL)) 
==
+   sizeof(Second) - sizeof(UNICODE_NULL),
+   "Mismatching string: %S (expected: %S)\n", Buffer, Second);
+LocalFree(Buffer);
+
+Buffer = NULL;
+Written = FormatMessageW(FORMAT_MESSAGE_FROM_HMODULE | 
FORMAT_MESSAGE_ALLOCATE_BUFFER,
+ NULL, MSG_SECOND_MESSAGE + 1, 0, (LPWSTR), 
0, NULL);
+ok(Written == 0, "Unexpected success: %ld\n", Written);
+ok(Buffer == NULL, "Unexpected success: %p\n", Buffer);
+ok(GetLastError() == 0x13d, "Unexpected error: %lx\n", GetLastError());
+}
diff --git a/modules/rostests/apitests/kernel32/FormatMessage.mc 
b/modules/rostests/apitests/kernel32/FormatMessage.mc
new file mode 100644
index 00..f13ba1269e
--- /dev/null
+++ b/modules/rostests/apitests/kernel32/FormatMessage.mc
@@ -0,0 +1,14 @@
+MessageIdTypedef=DWORD
+LanguageNames=(English=0x409:MSG0409)
+
+MessageId=
+SymbolicName=MSG_FIRST_MESSAGE
+Language=English
+This is a test message.
+.
+
+MessageId=
+SymbolicName=MSG_SE

[ros-diffs] [reactos] 01/01: [VFD] Build with debug information on debug builds

2017-12-16 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=753d87468c8f5e350d34bb48141493698ae65e8c

commit 753d87468c8f5e350d34bb48141493698ae65e8c
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Dec 16 21:57:11 2017 +0100

[VFD] Build with debug information on debug builds

CORE-14090
---
 modules/rosapps/lib/vfdlib/CMakeLists.txt | 4 
 1 file changed, 4 insertions(+)

diff --git a/modules/rosapps/lib/vfdlib/CMakeLists.txt 
b/modules/rosapps/lib/vfdlib/CMakeLists.txt
index 2ceeb8f41f..b0ff8b9e7c 100644
--- a/modules/rosapps/lib/vfdlib/CMakeLists.txt
+++ b/modules/rosapps/lib/vfdlib/CMakeLists.txt
@@ -19,6 +19,10 @@ list(APPEND SOURCE
 vfdshutil.cpp
 vfdzip.c)
 
+if(DBG)
+add_definitions(-D_DEBUG)
+endif()
+
 add_library(vfd SHARED
 ${SOURCE}
 vfdlib.rc



[ros-diffs] [reactos] 01/02: [PSDK] Add some missing defines

2017-12-16 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d82796778f91d61eaa9ca0e1086d263227b7fbe4

commit d82796778f91d61eaa9ca0e1086d263227b7fbe4
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Dec 16 21:43:49 2017 +0100

[PSDK] Add some missing defines

CORE-14090
---
 sdk/include/psdk/ntdddisk.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/sdk/include/psdk/ntdddisk.h b/sdk/include/psdk/ntdddisk.h
index 064ebbfd76..9deb6abc79 100644
--- a/sdk/include/psdk/ntdddisk.h
+++ b/sdk/include/psdk/ntdddisk.h
@@ -109,6 +109,9 @@ extern "C" {
 #define IOCTL_DISK_INTERNAL_SET_VERIFY \
   CTL_CODE(IOCTL_DISK_BASE, 0x0100, METHOD_NEITHER, FILE_ANY_ACCESS)
 
+#define IOCTL_DISK_INTERNAL_SET_NOTIFY \
+  CTL_CODE(IOCTL_DISK_BASE, 0x0102, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
 #define IOCTL_DISK_IS_WRITABLE \
   CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
@@ -185,6 +188,9 @@ extern "C" {
 #define IOCTL_DISK_COPY_DATA \
   CTL_CODE(IOCTL_DISK_BASE, 0x0019, METHOD_BUFFERED, FILE_READ_ACCESS | 
FILE_WRITE_ACCESS)
 
+#define IOCTL_DISK_SIMBAD \
+  CTL_CODE(IOCTL_DISK_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS | 
FILE_WRITE_ACCESS)
+
 #define SMART_GET_VERSION \
   CTL_CODE(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
 



[ros-diffs] [reactos] 01/01: [VFD] Remove no longer required ReactOS specific change

2017-12-16 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=132c7d926bedeaebbccaeed21ac179bdb122b0ee

commit 132c7d926bedeaebbccaeed21ac179bdb122b0ee
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Dec 16 22:53:32 2017 +0100

[VFD] Remove no longer required ReactOS specific change

CORE-14090
---
 modules/rosapps/lib/vfdlib/vfdctl.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/modules/rosapps/lib/vfdlib/vfdctl.c 
b/modules/rosapps/lib/vfdlib/vfdctl.c
index 69f8cd5abd..eb09da84d3 100644
--- a/modules/rosapps/lib/vfdlib/vfdctl.c
+++ b/modules/rosapps/lib/vfdlib/vfdctl.c
@@ -2928,15 +2928,8 @@ DWORD WINAPI VfdCheckDriverFile(
fixedinfo->dwFileType   != VFT_DRV  
||
fixedinfo->dwFileSubtype!= VFT2_DRV_SYSTEM) {
 
-#ifndef __REACTOS__
VFDTRACE(0,
(FUNC ": Invalid file type flags\n"));
-#else
-   VFDTRACE(0,
-   (FUNC ": Invalid file type flags. os: %x (%x), type: %x 
(%x), subtype: %x (%x)\n",
-   fixedinfo->dwFileOS, VOS_NT_WINDOWS32, 
fixedinfo->dwFileType, VFT_DRV,
-   fixedinfo->dwFileSubtype, VFT2_DRV_SYSTEM));
-#endif
 
ret = ERROR_BAD_DRIVER;
 



[ros-diffs] [reactos] 01/01: [VFD] Fix build

2017-12-16 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2a146533a5c6d279c519e047e91bf06379a0f1d6

commit 2a146533a5c6d279c519e047e91bf06379a0f1d6
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Dec 16 22:00:41 2017 +0100

[VFD] Fix build
---
 modules/rosapps/lib/vfdlib/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/rosapps/lib/vfdlib/CMakeLists.txt 
b/modules/rosapps/lib/vfdlib/CMakeLists.txt
index b0ff8b9e7c..07244f8045 100644
--- a/modules/rosapps/lib/vfdlib/CMakeLists.txt
+++ b/modules/rosapps/lib/vfdlib/CMakeLists.txt
@@ -26,7 +26,7 @@ endif()
 add_library(vfd SHARED
 ${SOURCE}
 vfdlib.rc
-${CMAKE_CURRENT_BINARY_DIR}/vfdlib.def)
+${CMAKE_CURRENT_BINARY_DIR}/vfd.def)
 
 include_directories(${REACTOS_SOURCE_DIR}/modules/rosapps/include/vfd
 ${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib)



[ros-diffs] [reactos] 01/01: [SETUP] Remove FSDs which have broken dismount implementation. This avoids issues when these partitions are formatted to FAT for setup.

2017-12-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=806cd16328799771b89397f5c51a3d46884bce0a

commit 806cd16328799771b89397f5c51a3d46884bce0a
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Dec 17 23:13:56 2017 +0100

[SETUP] Remove FSDs which have broken dismount implementation.
This avoids issues when these partitions are formatted to FAT for setup.

For now, this commit doesn't change anything, but once IopParseDevice hack
gets removed, this will make a difference!

CORE-6305
---
 boot/bootdata/txtsetup.sif   | 2 --
 drivers/filesystems/btrfs/CMakeLists.txt | 2 +-
 drivers/filesystems/ntfs/CMakeLists.txt  | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/boot/bootdata/txtsetup.sif b/boot/bootdata/txtsetup.sif
index 3ea62974b5..822c19c8c8 100644
--- a/boot/bootdata/txtsetup.sif
+++ b/boot/bootdata/txtsetup.sif
@@ -52,7 +52,6 @@ usbstor.sys=,,x,,4
 kbdhid.sys=4
 kbdclass.sys=,,x,,4
 l_intl.nls=2
-ntfs.sys=4
 pci.sys=4
 scsiport.sys=,,x,,4
 storport.sys=,,x,,4
@@ -69,7 +68,6 @@ ntdll.dll=2
 wmilib.sys=4
 ksecdd.sys=4
 mountmgr.sys=,,x,,4
-btrfs.sys=,,x,,4
 reiserfs.sys=,,x,,4
 ffs.sys=,,x,,4
 udfs.sys=,,x,,4
diff --git a/drivers/filesystems/btrfs/CMakeLists.txt 
b/drivers/filesystems/btrfs/CMakeLists.txt
index 65e61d255a..123c9f0522 100644
--- a/drivers/filesystems/btrfs/CMakeLists.txt
+++ b/drivers/filesystems/btrfs/CMakeLists.txt
@@ -41,4 +41,4 @@ add_definitions(-D__KERNEL__)
 set_module_type(btrfs kernelmodedriver)
 target_link_libraries(btrfs rtlver ntoskrnl_vista zlib_solo wdmguid 
${PSEH_LIB})
 add_importlibs(btrfs ntoskrnl hal)
-add_cd_file(TARGET btrfs DESTINATION reactos/system32/drivers NO_CAB FOR all)
+add_cd_file(TARGET btrfs DESTINATION reactos/system32/drivers FOR all)
diff --git a/drivers/filesystems/ntfs/CMakeLists.txt 
b/drivers/filesystems/ntfs/CMakeLists.txt
index 0b1af78947..5a193b449d 100644
--- a/drivers/filesystems/ntfs/CMakeLists.txt
+++ b/drivers/filesystems/ntfs/CMakeLists.txt
@@ -25,4 +25,4 @@ set_module_type(ntfs kernelmodedriver)
 target_link_libraries(ntfs ${PSEH_LIB})
 add_importlibs(ntfs ntoskrnl hal)
 add_pch(ntfs ntfs.h SOURCE)
-add_cd_file(TARGET ntfs DESTINATION reactos/system32/drivers NO_CAB FOR all)
+add_cd_file(TARGET ntfs DESTINATION reactos/system32/drivers FOR all)



[ros-diffs] [reactos] 01/03: [USETUP] Our current FAT ChkDsk being a bit slow when using the right path make it only perform a full check if dirty bit is set (which should never happen *cough*).

2017-12-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c8f2befb5ff1465123d0bceb4595a00add62326f

commit c8f2befb5ff1465123d0bceb4595a00add62326f
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Dec 17 23:26:38 2017 +0100

[USETUP] Our current FAT ChkDsk being a bit slow when using the right path 
make
it only perform a full check if dirty bit is set (which should never happen 
*cough*).

This is needed because otherwise, ReactOS installation takes forever when 
IopParseDevice is gone
due to slow ChkDsk.
---
 base/setup/usetup/chkdsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/base/setup/usetup/chkdsk.c b/base/setup/usetup/chkdsk.c
index 1ad582a4be..6d8df5d214 100644
--- a/base/setup/usetup/chkdsk.c
+++ b/base/setup/usetup/chkdsk.c
@@ -77,7 +77,7 @@ ChkdskPartition(
 Status = FileSystem->ChkdskFunc(DriveRoot,
 TRUE,/* FixErrors */
 FALSE,   /* Verbose */
-FALSE,   /* CheckOnlyIfDirty */
+TRUE,/* CheckOnlyIfDirty */
 FALSE,   /* ScanDrive */
 ChkdskCallback); /* Callback */
 



[ros-diffs] [reactos] 03/03: [NTOSKRNL] Make again an attempt at killing the IopParseDevice() hack.

2017-12-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4ef08871ee67cafc1b3566f408bd4f7a86df9a80

commit 4ef08871ee67cafc1b3566f408bd4f7a86df9a80
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Dec 17 23:30:58 2017 +0100

[NTOSKRNL] Make again an attempt at killing the IopParseDevice() hack.

For the record, the only place it was remaining was 1st stage, notably 
because
FSD (FastAT <3) was missing a few features. As this features weren't 
triggered
in 3rd stage (unless forced), it was not needed there any longer.

Now that they are implemented, and seem working out of the box, this hack 
might
not be longer anymore.

This is my ... ?! pfff attempt at killing it. It might not be the last, so 
just
disabling the hack for now. If there are no regressions (who can really 
believe that?)
we'll be clear for dropping it once for all.
---
 ntoskrnl/io/iomgr/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ntoskrnl/io/iomgr/file.c b/ntoskrnl/io/iomgr/file.c
index 71863ccb42..11ad0529b3 100644
--- a/ntoskrnl/io/iomgr/file.c
+++ b/ntoskrnl/io/iomgr/file.c
@@ -533,7 +533,7 @@ IopParseDevice(IN PVOID ParseObject,
 /* Check if we can simply use a dummy file */
 UseDummyFile = ((OpenPacket->QueryOnly) || (OpenPacket->DeleteOnly));
 
-#if 1
+#if 0
 /* FIXME: Small hack still exists, have to check why...
  * This is triggered multiple times by usetup and then once per boot.
  */



[ros-diffs] [reactos] 02/03: [FASFAT] Enable FAT volume dismount using VPB swapout

2017-12-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bd1e7bf85e01ccaece3c3da4a701f7911f63cd7e

commit bd1e7bf85e01ccaece3c3da4a701f7911f63cd7e
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Dec 17 23:29:33 2017 +0100

[FASFAT] Enable FAT volume dismount using VPB swapout
---
 drivers/filesystems/fastfat/vfat.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/filesystems/fastfat/vfat.h 
b/drivers/filesystems/fastfat/vfat.h
index b84b320573..50b83b1afb 100644
--- a/drivers/filesystems/fastfat/vfat.h
+++ b/drivers/filesystems/fastfat/vfat.h
@@ -13,11 +13,7 @@
 #endif
 
 #define USE_ROS_CC_AND_FS
-#if 0
-#ifndef _MSC_VER
 #define ENABLE_SWAPOUT
-#endif
-#endif
 
 #define ROUND_DOWN(n, align) \
 (((ULONG)n) & ~((align) - 1l))



[ros-diffs] [reactos] 01/01: [CDFS_NEW] _SEH2_FINALLY implement SEH support for real instead of its current stub. This notably fixes BSOD on media change

2017-11-17 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f723d230a0bc4b7b78ca125abecce137bb96bed6

commit f723d230a0bc4b7b78ca125abecce137bb96bed6
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Fri Nov 17 22:18:53 2017 +0100

[CDFS_NEW] _SEH2_FINALLY implement SEH support for real instead of its 
current stub.
This notably fixes BSOD on media change
---
 drivers/filesystems/cdfs_new/allocsup.c   |  6 ++--
 drivers/filesystems/cdfs_new/cachesup.c   |  6 ++--
 drivers/filesystems/cdfs_new/cddata.c | 16 +-
 drivers/filesystems/cdfs_new/cdprocs.h| 15 +-
 drivers/filesystems/cdfs_new/cleanup.c| 12 
 drivers/filesystems/cdfs_new/create.c | 26 
 drivers/filesystems/cdfs_new/deviosup.c   | 20 ++---
 drivers/filesystems/cdfs_new/dirctrl.c| 20 ++---
 drivers/filesystems/cdfs_new/fileinfo.c   | 36 +++
 drivers/filesystems/cdfs_new/fsctrl.c | 34 ++---
 drivers/filesystems/cdfs_new/fspdisp.c|  8 ++---
 drivers/filesystems/cdfs_new/lockctrl.c   | 24 +++
 drivers/filesystems/cdfs_new/read.c   | 12 
 drivers/filesystems/cdfs_new/strucsup.c   | 26 
 drivers/filesystems/cdfs_new/verfysup.c   |  8 ++---
 drivers/filesystems/cdfs_new/volinfo.c|  6 ++--
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 31 ---
 17 files changed, 138 insertions(+), 168 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/allocsup.c 
b/drivers/filesystems/cdfs_new/allocsup.c
index b875eca143..93b35bcfda 100755
--- a/drivers/filesystems/cdfs_new/allocsup.c
+++ b/drivers/filesystems/cdfs_new/allocsup.c
@@ -149,7 +149,7 @@ Return Value:
 //  Use a try finally to facilitate cleanup.
 //
 
-try {
+_SEH2_TRY {
 
 //
 //  We use a loop to perform the lookup.  If we don't find the mapping 
in the
@@ -296,7 +296,7 @@ Return Value:
 FirstPass = FALSE;
 }
 
-} finally {
+} _SEH2_FINALLY {
 
 if (CleanupParent) {
 
@@ -311,7 +311,7 @@ Return Value:
 }
 
 if (UnlockFcb) { CdUnlockFcb( IrpContext, Fcb ); }
-}
+} _SEH2_END;
 
 return;
 }
diff --git a/drivers/filesystems/cdfs_new/cachesup.c 
b/drivers/filesystems/cdfs_new/cachesup.c
index 87b75bbc51..600262f84a 100755
--- a/drivers/filesystems/cdfs_new/cachesup.c
+++ b/drivers/filesystems/cdfs_new/cachesup.c
@@ -94,7 +94,7 @@ Return Value:
 //  Use a try-finally to facilitate cleanup.
 //
 
-try {
+_SEH2_TRY {
 
 //
 //  Create the internal stream.  The Vpb should be pointing at our 
volume
@@ -272,7 +272,7 @@ Return Value:
 }
 }
 
-} finally {
+} _SEH2_FINALLY {
 
 //
 //  Cleanup any dirent structures we may have used.
@@ -306,7 +306,7 @@ Return Value:
 }
 
 CdUnlockFcb( IrpContext, Fcb );
-}
+} _SEH2_END;
 
 return;
 }
diff --git a/drivers/filesystems/cdfs_new/cddata.c 
b/drivers/filesystems/cdfs_new/cddata.c
index dbd572a797..c8367233ab 100755
--- a/drivers/filesystems/cdfs_new/cddata.c
+++ b/drivers/filesystems/cdfs_new/cddata.c
@@ -259,7 +259,7 @@ Return Value:
 //  Use a try-except to handle the exception cases.
 //
 
-try {
+_SEH2_TRY {
 
 //
 //  If the IrpContext is NULL then this is the first pass through
@@ -398,10 +398,10 @@ Return Value:
 CdCompleteRequest( IrpContext, Irp, Status );
 }
 
-} except( CdExceptionFilter( IrpContext, GetExceptionInformation() )) {
+} _SEH2_EXCEPT( CdExceptionFilter( IrpContext, 
_SEH2_GetExceptionInformation() )) {
 
-Status = CdProcessException( IrpContext, Irp, GetExceptionCode() );
-}
+Status = CdProcessException( IrpContext, Irp, 
_SEH2_GetExceptionCode() );
+} _SEH2_END;
 
 } while (Status == STATUS_CANT_WAIT);
 
@@ -653,7 +653,7 @@ Return Value:
 //  Note that (children of) CdFsdPostRequest can raise (Mdl allocation).
 //
 
-try {
+_SEH2_TRY {
 
 if (ExceptionCode == STATUS_CANT_WAIT) {
 
@@ -670,10 +670,10 @@ Return Value:
 }
 }
 }
-except( CdExceptionFilter( IrpContext, GetExceptionInformation() ))  {
+_SEH2_EXCEPT( CdExceptionFilter( IrpContext, 
_SEH2_GetExceptionInformation() ))  {
 
-ExceptionCode = GetExceptionCode();
-}
+ExceptionCode = _SEH2_GetExceptionCode();
+} _SEH2_END;
 
 //
 //  If we posted the request or our caller will retry then just return 
here.
diff --git a/drivers/filesystems/cdfs_new/cdprocs.h 
b/drivers/filesystems/cdfs_new/cdprocs.h
index 921f523720..2b066e7192 100755
--- a/drivers/filesystems/cdfs_new/cdprocs.h
+++ b/drivers/filesystems/cdfs_new/cdp

[ros-diffs] [reactos] 01/01: [EXT2] Upgrade to 0.69 CORE-13980

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a1d7e9936d8e58bc07ff2cc73a937ce845c7d542

commit a1d7e9936d8e58bc07ff2cc73a937ce845c7d542
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 10:47:29 2017 +0100

[EXT2] Upgrade to 0.69
CORE-13980
---
 drivers/filesystems/ext2/CMakeLists.txt  |2 +
 drivers/filesystems/ext2/inc/ext2fs.h|   63 +-
 drivers/filesystems/ext2/inc/linux/errno.h   |2 +
 drivers/filesystems/ext2/inc/linux/ext4_xattr.h  |  205 
 drivers/filesystems/ext2/inc/linux/fs.h  |   19 -
 drivers/filesystems/ext2/inc/linux/module.h  |2 +
 drivers/filesystems/ext2/src/create.c|  190 +++-
 drivers/filesystems/ext2/src/dirctl.c|6 +
 drivers/filesystems/ext2/src/dispatch.c  |6 +
 drivers/filesystems/ext2/src/ea.c|  604 ++
 drivers/filesystems/ext2/src/ext3/generic.c  |  616 +++---
 drivers/filesystems/ext2/src/ext3/recover.c  |7 +-
 drivers/filesystems/ext2/src/ext4/ext4_extents.c |1 +
 drivers/filesystems/ext2/src/ext4/ext4_xattr.c   | 1295 ++
 drivers/filesystems/ext2/src/fastio.c|5 +
 drivers/filesystems/ext2/src/fileinfo.c  |   34 +-
 drivers/filesystems/ext2/src/flush.c |   94 +-
 drivers/filesystems/ext2/src/fsctl.c |5 +
 drivers/filesystems/ext2/src/init.c  |8 +
 drivers/filesystems/ext2/src/linux.c |   33 +-
 drivers/filesystems/ext2/src/memory.c|  107 +-
 drivers/filesystems/ext2/src/volinfo.c   |2 +-
 drivers/filesystems/ext2/src/write.c |   18 +-
 media/doc/README.FSD |2 +-
 24 files changed, 3027 insertions(+), 299 deletions(-)

diff --git a/drivers/filesystems/ext2/CMakeLists.txt 
b/drivers/filesystems/ext2/CMakeLists.txt
index 4291b27a46..abc1c2489d 100644
--- a/drivers/filesystems/ext2/CMakeLists.txt
+++ b/drivers/filesystems/ext2/CMakeLists.txt
@@ -11,6 +11,7 @@ list(APPEND SOURCE
 src/ext4/ext4_bh.c
 src/ext4/ext4_extents.c
 src/ext4/ext4_jbd2.c
+src/ext4/ext4_xattr.c
 src/ext4/extents.c
 src/jbd/recovery.c
 src/jbd/replay.c
@@ -66,6 +67,7 @@ list(APPEND SOURCE
 src/devctl.c
 src/dirctl.c
 src/dispatch.c
+src/ea.c
 src/except.c
 src/fastio.c
 src/fileinfo.c
diff --git a/drivers/filesystems/ext2/inc/ext2fs.h 
b/drivers/filesystems/ext2/inc/ext2fs.h
index 7792ed18ac..525a1d1bc9 100644
--- a/drivers/filesystems/ext2/inc/ext2fs.h
+++ b/drivers/filesystems/ext2/inc/ext2fs.h
@@ -47,7 +47,7 @@
 
 /* STRUCTS & CONSTS**/
 
-#define EXT2FSD_VERSION "0.68"
+#define EXT2FSD_VERSION "0.69"
 
 
 /* WDK DEFINITIONS **/
@@ -720,7 +720,7 @@ typedef struct _EXT2_VCB {
 // Sector size in bits
 ULONG   SectorBits;
 
-// Aligned size (Page or Block)
+// Minimal i/o size: min(PageSize, BlockSize)
 ULONGLONG   IoUnitSize;
 
 // Bits of aligned size
@@ -783,6 +783,7 @@ typedef struct _EXT2_VCB {
 #define VCB_BEING_CLOSED0x0020
 #define VCB_USER_IDS0x0040  /* uid/gid specified by user */
 #define VCB_USER_EIDS   0x0080  /* euid/egid specified by user */
+#define VCB_GD_LOADED   0x0100  /* group desc loaded */
 
 #define VCB_BEING_DROPPED   0x2000
 #define VCB_FORCE_WRITING   0x4000
@@ -929,6 +930,8 @@ struct _EXT2_MCB {
 // List Link to Vcb->McbList
 LIST_ENTRY  Link;
 
+   
+
 struct inodeInode;
 struct dentry  *de;
 };
@@ -1006,6 +1009,9 @@ typedef struct _EXT2_CCB {
 /* Open handle control block */
 struct file filp;
 
+   /* The EA index we are on */
+   ULONG   EaIndex;
+
 } EXT2_CCB, *PEXT2_CCB;
 
 //
@@ -1116,6 +1122,10 @@ typedef struct _EXT2_EXTENT {
 #define FSCTL_GET_RETRIEVAL_POINTER_BASECTL_CODE(FILE_DEVICE_FILE_SYSTEM, 
141, METHOD_BUFFERED, FILE_ANY_ACCESS) // RETRIEVAL_POINTER_BASE
 #endif
 
+#ifndef FILE_SUPPORTS_EXTENDED_ATTRIBUTES
+#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES   0x0080
+#endif
+
 //
 //  The following macro is used to determine if an FSD thread can block
 //  for I/O or wait for a resource.  It returns TRUE if the thread can
@@ -1605,6 +1615,26 @@ Ext2BuildRequest (
 IN PIRP Irp
 );
 
+//
+// ea.c
+//
+
+NTSTATUS
+Ext2QueryEa(
+   IN PEXT2_IRP_CONTEXTIrpContext
+);
+
+BOOLEAN
+Ext2IsEaNameValid(
+   IN OEM_STRING Name
+);
+
+NTSTATUS
+Ext2SetEa(
+   IN PEXT2_IRP_CONTEXTIrpContext
+);
+
+
 //
 // Except.c
 //
@@ -1765,15 +1795,24 @@ Ext2RefreshSuper(
 IN PEXT2_VCBVcb
 );
 
+BOOLEAN
+Ext2LoadGroupBH(IN PEXT2_VCB Vcb);
+
 BOOLEA

[ros-diffs] [reactos] 01/01: [MSGINA] Fix buttons alignment in French translation

2017-11-21 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9904aafd12eb017bf43b7e3fd3cbb512ac64c383

commit 9904aafd12eb017bf43b7e3fd3cbb512ac64c383
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Tue Nov 21 11:49:01 2017 +0100

[MSGINA] Fix buttons alignment in French translation
---
 dll/win32/msgina/lang/fr-FR.rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dll/win32/msgina/lang/fr-FR.rc b/dll/win32/msgina/lang/fr-FR.rc
index fd6d0b61aa..cb4a9cb978 100644
--- a/dll/win32/msgina/lang/fr-FR.rc
+++ b/dll/win32/msgina/lang/fr-FR.rc
@@ -49,7 +49,7 @@ BEGIN
 PUSHBUTTON "Verrouiller l'ordinateur", IDC_LOCK, 4, 135, 82, 14
 PUSHBUTTON "Déconnecter", IDC_LOGOFF, 93, 135, 85, 14
 PUSHBUTTON "Éteindre", IDC_SHUTDOWN, 184, 135, 70, 14
-PUSHBUTTON "Changer le mot de passe", IDC_CHANGEPWD, 10, 154, 76, 14
+PUSHBUTTON "Changer le mot de passe", IDC_CHANGEPWD, 4, 154, 82, 14
 PUSHBUTTON "Gestionnaire de tâches", IDC_TASKMGR, 93, 154, 85, 14
 PUSHBUTTON "Annuler", IDCANCEL, 184, 154, 70, 14
 END



[ros-diffs] [reactos] 01/01: [NFS41_NP] Attempt to fix MSVC build

2017-11-18 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2ddebe3291568bb18d03207337315d4f38d4d630

commit 2ddebe3291568bb18d03207337315d4f38d4d630
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 18 21:36:57 2017 +0100

[NFS41_NP] Attempt to fix MSVC build
---
 dll/np/nfs/nfs41_np.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dll/np/nfs/nfs41_np.c b/dll/np/nfs/nfs41_np.c
index 42aa46730d..ce03c41999 100644
--- a/dll/np/nfs/nfs41_np.c
+++ b/dll/np/nfs/nfs41_np.c
@@ -649,10 +649,11 @@ NPCancelConnection(
 
 DbgP((TEXT("NPCancelConnection: Name %S EntryName %S\n"),
 lpName,pNetResource->LocalName));
-DbgP((TEXT("NPCancelConnection: Name Length %d Entry Name 
Length %d\n"),
 #ifndef __REACTOS__
+DbgP((TEXT("NPCancelConnection: Name Length %d Entry Name 
Length %d\n"),

pNetResource->LocalNameLength,pNetResource->LocalName));
 #else
+DbgP((TEXT("NPCancelConnection: Name Length %d Entry Name 
Length %d\n"),
(wcslen(lpName) + 1) * sizeof(WCHAR), 
pNetResource->LocalNameLength));
 #endif
 



[ros-diffs] [reactos] 01/02: [NFS41_NP] Fix debug print in case of connection cancel failure

2017-11-18 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=764b2b6ef72cff60729184284d654c6a47699539

commit 764b2b6ef72cff60729184284d654c6a47699539
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 18 21:25:00 2017 +0100

[NFS41_NP] Fix debug print in case of connection cancel failure
---
 dll/np/nfs/nfs41_np.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/dll/np/nfs/nfs41_np.c b/dll/np/nfs/nfs41_np.c
index 7dea7f3548..42aa46730d 100644
--- a/dll/np/nfs/nfs41_np.c
+++ b/dll/np/nfs/nfs41_np.c
@@ -650,7 +650,11 @@ NPCancelConnection(
 DbgP((TEXT("NPCancelConnection: Name %S EntryName %S\n"),
 lpName,pNetResource->LocalName));
 DbgP((TEXT("NPCancelConnection: Name Length %d Entry Name 
Length %d\n"),
+#ifndef __REACTOS__

pNetResource->LocalNameLength,pNetResource->LocalName));
+#else
+   (wcslen(lpName) + 1) * sizeof(WCHAR), 
pNetResource->LocalNameLength));
+#endif
 
 }
 }



[ros-diffs] [reactos] 02/02: [SHELL32] Drop slash when dismounting a remote drive. MPR and NP are expecting a drive letter. This fixes dismounting a network drive using explorer.

2017-11-18 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=45b543202d7e1927833d84faebdb39924d2b4e09

commit 45b543202d7e1927833d84faebdb39924d2b4e09
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 18 21:26:18 2017 +0100

[SHELL32] Drop slash when dismounting a remote drive. MPR and NP are 
expecting a drive letter.
This fixes dismounting a network drive using explorer.
---
 dll/win32/shell32/folders/CDrivesFolder.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dll/win32/shell32/folders/CDrivesFolder.cpp 
b/dll/win32/shell32/folders/CDrivesFolder.cpp
index a708dc4d49..701a10643f 100644
--- a/dll/win32/shell32/folders/CDrivesFolder.cpp
+++ b/dll/win32/shell32/folders/CDrivesFolder.cpp
@@ -253,6 +253,7 @@ HRESULT CALLBACK DrivesContextMenuCallback(IShellFolder 
*psf,
 else if (wParam == CMDID_DISCONNECT)
 {
 /* do disconnect */
+wszBuf[2] = UNICODE_NULL;
 dwError = WNetCancelConnection2W(wszBuf, 0, FALSE);
 if (dwError == NO_ERROR)
 {



[ros-diffs] [reactos] 02/02: [NTOSKRNL] In CcPurgeCacheSection(), don't assume the file being purged isn't used. Handle that case properly instead of asserting. This fixes a triggerable ASSERT from um

2017-11-18 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=64cb138a673fa02d76922963c680bfeb05f1d715

commit 64cb138a673fa02d76922963c680bfeb05f1d715
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 18 17:53:07 2017 +0100

[NTOSKRNL] In CcPurgeCacheSection(), don't assume the file being purged 
isn't used. Handle that case properly instead of asserting.
This fixes a triggerable ASSERT from umode where you open a file on a CDFS 
(with MS CDFS) and attempt to lock the volume.
---
 ntoskrnl/cc/fs.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/ntoskrnl/cc/fs.c b/ntoskrnl/cc/fs.c
index 6f6b5568fe..fb5f99aab2 100644
--- a/ntoskrnl/cc/fs.c
+++ b/ntoskrnl/cc/fs.c
@@ -143,6 +143,7 @@ CcPurgeCacheSection (
 PLIST_ENTRY ListEntry;
 PROS_VACB Vacb;
 LONGLONG ViewEnd;
+BOOLEAN Success;
 
 CCTRACE(CC_API_DEBUG, "SectionObjectPointer=%p\n FileOffset=%p Length=%lu 
UninitializeCacheMaps=%d",
 SectionObjectPointer, FileOffset, Length, UninitializeCacheMaps);
@@ -169,6 +170,9 @@ CcPurgeCacheSection (
 
 InitializeListHead();
 
+/* Assume success */
+Success = TRUE;
+
 KeAcquireGuardedMutex();
 KeAcquireSpinLock(>CacheMapLock, );
 ListEntry = SharedCacheMap->CacheMapVacbListHead.Flink;
@@ -189,8 +193,12 @@ CcPurgeCacheSection (
 break;
 }
 
-ASSERT((Vacb->ReferenceCount == 0) ||
-   (Vacb->ReferenceCount == 1 && Vacb->Dirty));
+/* Still in use, it cannot be purged, fail */
+if (Vacb->ReferenceCount != 0 && !Vacb->Dirty)
+{
+Success = FALSE;
+break;
+}
 
 /* This VACB is in range, so unlink it and mark for free */
 RemoveEntryList(>VacbLruListEntry);
@@ -213,7 +221,7 @@ CcPurgeCacheSection (
 CcRosInternalFreeVacb(Vacb);
 }
 
-return TRUE;
+return Success;
 }
 
 



[ros-diffs] [reactos] 01/02: [NTOSKRNL] When CcPurgeCacheSection() succeed, make it return TRUE so that callers don't believe it always fail

2017-11-18 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4768a371f4f8cb4387a902037e42d387086f334a

commit 4768a371f4f8cb4387a902037e42d387086f334a
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 18 17:51:08 2017 +0100

[NTOSKRNL]
When CcPurgeCacheSection() succeed, make it return TRUE so that callers 
don't believe it always fail
---
 ntoskrnl/cc/fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ntoskrnl/cc/fs.c b/ntoskrnl/cc/fs.c
index 4ecd55352a..6f6b5568fe 100644
--- a/ntoskrnl/cc/fs.c
+++ b/ntoskrnl/cc/fs.c
@@ -213,7 +213,7 @@ CcPurgeCacheSection (
 CcRosInternalFreeVacb(Vacb);
 }
 
-return FALSE;
+return TRUE;
 }
 
 



[ros-diffs] [reactos] 01/01: [NTOSKRNL] Don't make CcSetReadAheadGranularity() whine for every single file opened by FSDs making use of it.

2017-11-18 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2b217e4ecf942126c4672f8d1c0a2fb55530d731

commit 2b217e4ecf942126c4672f8d1c0a2fb55530d731
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 18 18:00:48 2017 +0100

[NTOSKRNL]
Don't make CcSetReadAheadGranularity() whine for every single file opened 
by FSDs making use of it.
---
 ntoskrnl/cc/cacheman.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ntoskrnl/cc/cacheman.c b/ntoskrnl/cc/cacheman.c
index 2369cad546..4d62314ccd 100644
--- a/ntoskrnl/cc/cacheman.c
+++ b/ntoskrnl/cc/cacheman.c
@@ -158,8 +158,10 @@ CcSetReadAheadGranularity (
IN  ULONG   Granularity
)
 {
+static ULONG Warn;
+
 CCTRACE(CC_API_DEBUG, "FileObject=%p Granularity=%lu\n",
 FileObject, Granularity);
 
-   UNIMPLEMENTED;
+if (!Warn++) UNIMPLEMENTED;
 }



[ros-diffs] [reactos] 01/01: [NTOSKRNL] Implement FsRtlCheckOplock(), FsRtlCurrentBatchOplock(), FsRtlInitializeOplock(), FsRtlOplockFsctrl(), FsRtlOplockIsFastIoPossible(), FsRtlUninitializeOplock().

2017-11-18 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d3d585395684b96df9782fe0af253f2c3e9cffc4

commit d3d585395684b96df9782fe0af253f2c3e9cffc4
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 18 18:23:57 2017 +0100

[NTOSKRNL] Implement FsRtlCheckOplock(), FsRtlCurrentBatchOplock(), 
FsRtlInitializeOplock(), FsRtlOplockFsctrl(), FsRtlOplockIsFastIoPossible(), 
FsRtlUninitializeOplock().
But also, implement FsRtlNotifyCompletion(), FsRtlCompletionRoutinePriv(), 
FsRtlRemoveAndCompleteWaitIrp(), FsRtlCancelWaitIrp(), FsRtlWaitOnIrp(), 
FsRtlOplockBreakNotify(), FsRtlRemoveAndCompleteIrp(), 
FsRtlCancelOplockIIIrp(), FsRtlAcknowledgeOplockBreak(), 
FsRtlOpBatchBreakClosePending(), FsRtlAllocateOplock(), 
FsRtlCancelExclusiveIrp(), FsRtlRequestExclusiveOplock(), 
FsRtlRequestOplockII(), FsRtlOplockCleanup(), FsRtlOplockBreakToNone(), 
FsRtlOplockBreakToII().
In short... Implement oplocks support in ReactOS.
---
 ntoskrnl/fsrtl/oplock.c | 1556 ++-
 1 file changed, 1543 insertions(+), 13 deletions(-)

diff --git a/ntoskrnl/fsrtl/oplock.c b/ntoskrnl/fsrtl/oplock.c
index ce31dfbab7..250f0fce3f 100644
--- a/ntoskrnl/fsrtl/oplock.c
+++ b/ntoskrnl/fsrtl/oplock.c
@@ -3,7 +3,7 @@
  * LICENSE: GPL - See COPYING in the top level directory
  * FILE:ntoskrnl/fsrtl/oplock.c
  * PURPOSE: Provides an Opportunistic Lock for file system drivers.
- * PROGRAMMERS: None.
+ * PROGRAMMERS: Pierre Schweitzer (pie...@reactos.org)
  */
 
 /* INCLUDES **/
@@ -12,6 +12,1133 @@
 #define NDEBUG
 #include 
 
+#define NO_OPLOCK   0x1
+#define LEVEL_1_OPLOCK  0x2
+#define BATCH_OPLOCK0x4
+#define FILTER_OPLOCK   0x8
+#define LEVEL_2_OPLOCK  0x10
+
+#define EXCLUSIVE_LOCK  0x40
+#define PENDING_LOCK0x80
+
+#define BROKEN_TO_LEVEL_2   0x100
+#define BROKEN_TO_NONE  0x200
+#define BROKEN_TO_NONE_FROM_LEVEL_2 0x400
+#define BROKEN_TO_CLOSE_PENDING 0x800
+#define BROKEN_ANY  (BROKEN_TO_LEVEL_2 | BROKEN_TO_NONE  | 
BROKEN_TO_NONE_FROM_LEVEL_2 | BROKEN_TO_CLOSE_PENDING)
+
+#define TAG_OPLOCK 'orSF'
+
+typedef struct _INTERNAL_OPLOCK
+{
+/* Level I IRP */
+PIRP ExclusiveIrp;
+/* Level I FILE_OBJECT */
+PFILE_OBJECT FileObject;
+/* Level II IRPs */
+LIST_ENTRY SharedListHead;
+/* IRPs waiting on level I */
+LIST_ENTRY WaitListHead;
+ULONG Flags;
+PFAST_MUTEX IntLock;
+} INTERNAL_OPLOCK, *PINTERNAL_OPLOCK;
+
+typedef struct _WAIT_CONTEXT
+{
+LIST_ENTRY WaitListEntry;
+PIRP Irp;
+POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine;
+PVOID CompletionContext;
+ULONG Reserved;
+ULONG_PTR SavedInformation;
+} WAIT_CONTEXT, *PWAIT_CONTEXT;
+
+VOID
+NTAPI
+FsRtlNotifyCompletion(IN PVOID Context,
+  IN PIRP Irp)
+{
+PAGED_CODE();
+
+DPRINT("FsRtlNotifyCompletion(%p, %p)\n", Context, Irp);
+
+/* Just complete the IRP */
+return IoCompleteRequest(Irp, IO_DISK_INCREMENT);
+}
+
+VOID
+NTAPI
+FsRtlCompletionRoutinePriv(IN PVOID Context,
+   IN PIRP Irp)
+{
+PKEVENT WaitEvent;
+
+PAGED_CODE();
+
+DPRINT("FsRtlCompletionRoutinePriv(%p, %p)\n", Context, Irp);
+
+/* Set the event */
+WaitEvent = (PKEVENT)Context;
+KeSetEvent(WaitEvent, IO_NO_INCREMENT, FALSE);
+}
+
+VOID
+FsRtlRemoveAndCompleteWaitIrp(IN PWAIT_CONTEXT WaitCtx)
+{
+PIRP Irp;
+
+PAGED_CODE();
+
+DPRINT("FsRtlRemoveAndCompleteWaitIrp(%p)\n", WaitCtx);
+
+RemoveEntryList(>WaitListEntry);
+Irp = WaitCtx->Irp;
+
+/* No cancel routine anymore */
+IoAcquireCancelSpinLock(>CancelIrql);
+IoSetCancelRoutine(Irp, NULL);
+IoReleaseCancelSpinLock(Irp->CancelIrql);
+
+/* Set the information */
+Irp->IoStatus.Information = WaitCtx->SavedInformation;
+/* Set the status according to the fact it got cancel or not */
+Irp->IoStatus.Status = (Irp->Cancel ? STATUS_CANCELLED : STATUS_SUCCESS);
+
+/* Call the completion routine */
+WaitCtx->CompletionRoutine(WaitCtx->CompletionContext, Irp);
+
+/* And get rid of the now useless wait context */
+ExFreePoolWithTag(WaitCtx, TAG_OPLOCK);
+}
+
+VOID
+NTAPI
+FsRtlCancelWaitIrp(IN PDEVICE_OBJECT DeviceObject,
+   IN PIRP Irp)
+{
+PINTERNAL_OPLOCK Oplock;
+PLIST_ENTRY NextEntry;
+PWAIT_CONTEXT WaitCtx;
+
+DPRINT("FsRtlCancelWaitIrp(%p, %p)\n", DeviceObject, Irp);
+
+/* Get the associated oplock */
+Oplock = (PINTERNAL_OPLOCK)Irp->IoStatus.Information;
+
+/* Remove the cancel routine (we're being called!) */
+IoSetCancelRoutine(Irp, NULL);
+/* And release the cancel spin lock (always locked when cancel routine is 
called) */
+IoReleaseCan

[ros-diffs] [reactos] 01/01: [CDFS] Attempt to a switch to the MS CDFS driver. To be reverted if it brings in too many regressions, even though I tried to do my best to address them.

2017-11-18 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ec6b3ecbe48ad51c366563196cc93a6ae74e8b69

commit ec6b3ecbe48ad51c366563196cc93a6ae74e8b69
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 18 18:32:36 2017 +0100

[CDFS] Attempt to a switch to the MS CDFS driver.
To be reverted if it brings in too many regressions, even though I tried to 
do my best to address them.

Leaving the old driver in place, for now; if no regressions are reported 
regarding CDFS in 0.4.8, then old driver could be dropped for 0.4.9.
---
 drivers/filesystems/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/filesystems/CMakeLists.txt 
b/drivers/filesystems/CMakeLists.txt
index 7485d433b5..24937d7f13 100644
--- a/drivers/filesystems/CMakeLists.txt
+++ b/drivers/filesystems/CMakeLists.txt
@@ -1,6 +1,6 @@
 
 add_subdirectory(btrfs)
-add_subdirectory(cdfs)
+add_subdirectory(cdfs_new)
 add_subdirectory(ext2)
 add_subdirectory(fastfat)
 add_subdirectory(ffs)



[ros-diffs] [reactos] 01/01: [NTOSKRNL] Fix MSVC build: don't attempt to return in a void function

2017-11-18 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2284a457a36a9ce7e2b28bf38b6456ff0a6de471

commit 2284a457a36a9ce7e2b28bf38b6456ff0a6de471
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 18 18:38:36 2017 +0100

[NTOSKRNL] Fix MSVC build: don't attempt to return in a void function
---
 ntoskrnl/fsrtl/oplock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ntoskrnl/fsrtl/oplock.c b/ntoskrnl/fsrtl/oplock.c
index 250f0fce3f..7ab457d399 100644
--- a/ntoskrnl/fsrtl/oplock.c
+++ b/ntoskrnl/fsrtl/oplock.c
@@ -63,7 +63,7 @@ FsRtlNotifyCompletion(IN PVOID Context,
 DPRINT("FsRtlNotifyCompletion(%p, %p)\n", Context, Irp);
 
 /* Just complete the IRP */
-return IoCompleteRequest(Irp, IO_DISK_INCREMENT);
+IoCompleteRequest(Irp, IO_DISK_INCREMENT);
 }
 
 VOID



[ros-diffs] [reactos] 01/01: [SHELL32] Update French translation, following 6465705

2017-11-18 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0701527f200a37e29f94fb7f4d350274f0b344bb

commit 0701527f200a37e29f94fb7f4d350274f0b344bb
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 18 18:56:59 2017 +0100

[SHELL32] Update French translation, following 6465705
---
 dll/win32/shell32/lang/fr-FR.rc | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dll/win32/shell32/lang/fr-FR.rc b/dll/win32/shell32/lang/fr-FR.rc
index 16aaf76420..325487e4fe 100644
--- a/dll/win32/shell32/lang/fr-FR.rc
+++ b/dll/win32/shell32/lang/fr-FR.rc
@@ -683,8 +683,8 @@ BEGIN
 IDS_FORMATDRIVE "Formater..."
 IDS_RENAME "Renommer"
 IDS_PASTE "Insérer"
-IDS_EJECT "Eject"
-IDS_DISCONNECT "Disconnect"
+IDS_EJECT "Éjecter"
+IDS_DISCONNECT "Déconnecter"
 
 IDS_CREATEFOLDER_DENIED "Impossible de créer le dossier '%1'"
 IDS_CREATEFOLDER_CAPTION "Impossible de créer un dossier"
@@ -753,7 +753,7 @@ BEGIN
 IDS_NEWFOLDER "Nouveau dossier"
 
 IDS_DRIVE_FIXED "Disque local"
-IDS_DRIVE_CDROM "CD Drive"
+IDS_DRIVE_CDROM "Lecteur CD"
 IDS_DRIVE_NETWORK "Disque réseau"
 IDS_DRIVE_FLOPPY "Disquette 3.5"
 IDS_DRIVE_REMOVABLE "Disque amovible"
@@ -778,11 +778,11 @@ BEGIN
 IDS_PICK_ICON_FILTER "Fichiers d'icônes (*.ico, *.icl, *.exe, 
*.dll)\0*.ico;*.icl;*.exe;*.dll\0All Files (*.*)\0*.*\0"
 IDS_OPEN_WITH_FILTER "Fichiers exécutables (*.exe)\0*.exe\0All Files 
(*.*)\0*.*\0"
 
-IDS_CANTLOCKVOLUME "Unable to lock volume (Error Code: %lu)."
-IDS_CANTDISMOUNTVOLUME "Unable to dismount volume (Error Code: %lu)."
-IDS_CANTEJECTMEDIA "Unable to eject media (Error Code: %lu)."
-IDS_CANTSHOWPROPERTIES "Unable to show properties (Error Code: %lu)."
-IDS_CANTDISCONNECT "Unable to disconnect (Error Code: %lu)."
+IDS_CANTLOCKVOLUME "Impossible de verrouiller le volume (code d'erreur : 
%lu)."
+IDS_CANTDISMOUNTVOLUME "Impossible de démonter le volume (code d'erreur : 
%lu)."
+IDS_CANTEJECTMEDIA "Impossible d'éjecter le média (code d'erreur : %lu)."
+IDS_CANTSHOWPROPERTIES "Impossible de montrer les propriétés (code 
d'erreur : %lu)."
+IDS_CANTDISCONNECT "Impossible de déconnecter (code d'erreur : %lu)."
 
 IDS_DIRECTORY "Dossier"
 IDS_BAT_FILE "Fichier Batch ReactOS"



[ros-diffs] [reactos] 01/01: [SHELL32] Update French translation

2017-11-21 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=63dcfd2de3e3b8d75fd111fb41b9b18cb7523c7c

commit 63dcfd2de3e3b8d75fd111fb41b9b18cb7523c7c
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Tue Nov 21 18:24:08 2017 +0100

[SHELL32] Update French translation
---
 dll/win32/shell32/lang/fr-FR.rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dll/win32/shell32/lang/fr-FR.rc b/dll/win32/shell32/lang/fr-FR.rc
index 325487e4fe..a16d160512 100644
--- a/dll/win32/shell32/lang/fr-FR.rc
+++ b/dll/win32/shell32/lang/fr-FR.rc
@@ -807,7 +807,7 @@ BEGIN
 IDS_ANY_FILE "%s-file" 
 
 IDS_OPEN_VERB "Ouvrir"
-IDS_EXPLORE_VERB "Explore"
+IDS_EXPLORE_VERB "Explorer"
 IDS_RUNAS_VERB "Exécuter en tant que..."
 IDS_EDIT_VERB "Éditer"
 IDS_FIND_VERB "Chercher"



[ros-diffs] [reactos] 01/01: [FASTFAT] More FS statistics

2017-11-21 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8503842309018f02eb43c714d6d385f7bb75d0da

commit 8503842309018f02eb43c714d6d385f7bb75d0da
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Tue Nov 21 22:18:11 2017 +0100

[FASTFAT] More FS statistics
---
 drivers/filesystems/fastfat/rw.c | 30 ++
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/drivers/filesystems/fastfat/rw.c b/drivers/filesystems/fastfat/rw.c
index 0ac467d87d..c945ee6044 100644
--- a/drivers/filesystems/fastfat/rw.c
+++ b/drivers/filesystems/fastfat/rw.c
@@ -673,6 +673,9 @@ VfatRead(
 Status = /*STATUS_END_OF_FILE*/STATUS_SUCCESS;
 }
 
+vfatAddToStat(IrpContext->DeviceExt, Base.UserFileReads, 1);
+vfatAddToStat(IrpContext->DeviceExt, Base.UserFileReadBytes, Length);
+
 _SEH2_TRY
 {
 if (IrpContext->FileObject->PrivateCacheMap == NULL)
@@ -722,8 +725,16 @@ VfatRead(
 Length = (ULONG)(ROUND_UP_64(Fcb->RFCB.FileSize.QuadPart, 
BytesPerSector) - ByteOffset.QuadPart);
 }
 
-vfatAddToStat(IrpContext->DeviceExt, Fat.NonCachedReads, 1);
-vfatAddToStat(IrpContext->DeviceExt, Fat.NonCachedReadBytes, Length);
+if (!IsVolume)
+{
+vfatAddToStat(IrpContext->DeviceExt, Fat.NonCachedReads, 1);
+vfatAddToStat(IrpContext->DeviceExt, Fat.NonCachedReadBytes, 
Length);
+}
+else
+{
+vfatAddToStat(IrpContext->DeviceExt, Base.MetaDataReads, 1);
+vfatAddToStat(IrpContext->DeviceExt, Base.MetaDataReadBytes, 
Length);
+}
 
 Status = VfatReadFileData(IrpContext, Length, ByteOffset, 
);
 if (NT_SUCCESS(Status))
@@ -954,6 +965,9 @@ VfatWrite(
 {
 // cached write
 
+vfatAddToStat(IrpContext->DeviceExt, Base.UserFileWrites, 1);
+vfatAddToStat(IrpContext->DeviceExt, Base.UserFileWriteBytes, Length);
+
 _SEH2_TRY
 {
 if (IrpContext->FileObject->PrivateCacheMap == NULL)
@@ -1006,8 +1020,16 @@ VfatWrite(
 CcZeroData(IrpContext->FileObject, , , 
TRUE);
 }
 
-vfatAddToStat(IrpContext->DeviceExt, Fat.NonCachedWrites, 1);
-vfatAddToStat(IrpContext->DeviceExt, Fat.NonCachedWriteBytes, Length);
+if (!IsVolume)
+{
+vfatAddToStat(IrpContext->DeviceExt, Fat.NonCachedWrites, 1);
+vfatAddToStat(IrpContext->DeviceExt, Fat.NonCachedWriteBytes, 
Length);
+}
+else
+{
+vfatAddToStat(IrpContext->DeviceExt, Base.MetaDataWrites, 1);
+vfatAddToStat(IrpContext->DeviceExt, Base.MetaDataWriteBytes, 
Length);
+}
 
 Status = VfatWriteFileData(IrpContext, Length, ByteOffset);
 if (NT_SUCCESS(Status))



[ros-diffs] [reactos] 01/01: [NTOSKRNL] It is forbidden to call DbgPrint at DISPATCH_LEVEL with %wZ

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f88fe43abd6a039f25cc08a8dfd65f9a56ef9da7

commit f88fe43abd6a039f25cc08a8dfd65f9a56ef9da7
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 18:51:07 2017 +0100

[NTOSKRNL] It is forbidden to call DbgPrint at DISPATCH_LEVEL with %wZ
---
 ntoskrnl/io/iomgr/device.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ntoskrnl/io/iomgr/device.c b/ntoskrnl/io/iomgr/device.c
index 5d7f31e147..9342d5a22d 100644
--- a/ntoskrnl/io/iomgr/device.c
+++ b/ntoskrnl/io/iomgr/device.c
@@ -357,9 +357,8 @@ IopEditDeviceList(IN PDRIVER_OBJECT DriverObject,
 /* Not this one, keep moving */
 if (!Previous->NextDevice)
 {
-DPRINT1("Failed to remove PDO %p on driver %wZ (not 
found)\n",
-DeviceObject,
->DriverObject->DriverName);
+DPRINT1("Failed to remove PDO %p (not found)\n",
+DeviceObject);
 
 ASSERT(FALSE);
 KeReleaseQueuedSpinLock(LockQueueIoDatabaseLock, OldIrql);



[ros-diffs] [reactos] 01/01: [CDFS_NEW] Restore the ability to restore installing from disk image. CORE-13184

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6c733856258ebfac4b62ffb7733202dddb74a4be

commit 6c733856258ebfac4b62ffb7733202dddb74a4be
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 18:36:20 2017 +0100

[CDFS_NEW]
Restore the ability to restore installing from disk image.
CORE-13184
---
 drivers/filesystems/cdfs_new/cdinit.c   | 58 +
 drivers/filesystems/cdfs_new/cdstruc.h  |  4 +++
 drivers/filesystems/cdfs_new/fsctrl.c   | 44 +
 drivers/filesystems/cdfs_new/strucsup.c | 10 ++
 4 files changed, 116 insertions(+)

diff --git a/drivers/filesystems/cdfs_new/cdinit.c 
b/drivers/filesystems/cdfs_new/cdinit.c
index e66bd75377..aac879a235 100755
--- a/drivers/filesystems/cdfs_new/cdinit.c
+++ b/drivers/filesystems/cdfs_new/cdinit.c
@@ -38,6 +38,10 @@ NTSTATUS
 CdInitializeGlobalData (
 IN PDRIVER_OBJECT DriverObject,
 IN PDEVICE_OBJECT FileSystemDeviceObject
+#ifdef __REACTOS__
+,
+IN PDEVICE_OBJECT HddFileSystemDeviceObject
+#endif
 );
 
 NTSTATUS
@@ -89,6 +93,9 @@ Return Value:
 NTSTATUS Status;
 UNICODE_STRING UnicodeString;
 PDEVICE_OBJECT CdfsFileSystemDeviceObject;
+#ifdef __REACTOS__
+PDEVICE_OBJECT HddFileSystemDeviceObject;
+#endif
 
 //
 // Create the device object.
@@ -107,6 +114,27 @@ Return Value:
 if (!NT_SUCCESS( Status )) {
 return Status;
 }
+
+#ifdef __REACTOS__
+//
+// Create the HDD device object.
+//
+
+RtlInitUnicodeString( , L"\\CdfsHdd" );
+
+Status = IoCreateDevice( DriverObject,
+ 0,
+ ,
+ FILE_DEVICE_DISK_FILE_SYSTEM,
+ 0,
+ FALSE,
+  );
+
+if (!NT_SUCCESS( Status )) {
+IoDeleteDevice (CdfsFileSystemDeviceObject);
+return Status;
+}
+#endif
 DriverObject->DriverUnload = CdUnload;
 //
 //  Note that because of the way data caching is done, we set neither
@@ -141,6 +169,9 @@ Return Value:
 Status = IoRegisterShutdownNotification (CdfsFileSystemDeviceObject);
 if (!NT_SUCCESS (Status)) {
 IoDeleteDevice (CdfsFileSystemDeviceObject);
+#ifdef __REACTOS__
+IoDeleteDevice (HddFileSystemDeviceObject);
+#endif
 return Status;
 }
 
@@ -148,9 +179,16 @@ Return Value:
 //  Initialize the global data structures
 //
 
+#ifndef __REACTOS__
 Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject 
);
+#else
+Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject, 
HddFileSystemDeviceObject );
+#endif
 if (!NT_SUCCESS (Status)) {
 IoDeleteDevice (CdfsFileSystemDeviceObject);
+#ifdef __REACTOS__
+IoDeleteDevice (HddFileSystemDeviceObject);
+#endif
 return Status;
 }
 
@@ -161,9 +199,16 @@ Return Value:
 //
 
 CdfsFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM;
+#ifdef __REACTOS__
+HddFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM;
+#endif
 
 IoRegisterFileSystem( CdfsFileSystemDeviceObject );
 ObReferenceObject (CdfsFileSystemDeviceObject);
+#ifdef __REACTOS__
+IoRegisterFileSystem( HddFileSystemDeviceObject );
+ObReferenceObject (HddFileSystemDeviceObject);
+#endif
 
 //
 //  And return to our caller
@@ -198,6 +243,9 @@ Return Value:
 {
 IoUnregisterFileSystem (DeviceObject);
 IoDeleteDevice (CdData.FileSystemDeviceObject);
+#ifdef __REACTOS__
+IoDeleteDevice (CdData.HddFileSystemDeviceObject);
+#endif
 
 CdCompleteRequest( NULL, Irp, STATUS_SUCCESS );
 return STATUS_SUCCESS;
@@ -241,6 +289,9 @@ Return Value:
 IoFreeWorkItem (CdData.CloseItem);
 ExDeleteResourceLite(  );
 ObDereferenceObject (CdData.FileSystemDeviceObject);
+#ifdef __REACTOS__
+ObDereferenceObject (CdData.HddFileSystemDeviceObject);
+#endif
 }
 
 //
@@ -251,6 +302,10 @@ NTSTATUS
 CdInitializeGlobalData (
 IN PDRIVER_OBJECT DriverObject,
 IN PDEVICE_OBJECT FileSystemDeviceObject
+#ifdef __REACTOS__
+,
+IN PDEVICE_OBJECT HddFileSystemDeviceObject
+#endif
 )
 
 /*++
@@ -307,6 +362,9 @@ Return Value:
 
 CdData.DriverObject = DriverObject;
 CdData.FileSystemDeviceObject = FileSystemDeviceObject;
+#ifdef __REACTOS__
+CdData.HddFileSystemDeviceObject = HddFileSystemDeviceObject;
+#endif
 
 InitializeListHead(  );
 
diff --git a/drivers/filesystems/cdfs_new/cdstruc.h 
b/drivers/filesystems/cdfs_new/cdstruc.h
index e120ee27d0..1259349db2 100755
--- a/drivers/filesystems/cdfs_new/cdstruc.h
+++ b/drivers/filesystems/cdfs_new/cdstruc.h
@@ -349,6 +349,10 @@ typedef struct _CD_DATA {
 
 PDEVICE_OBJECT FileSystemDeviceObject;
 
+#ifdef __REACTOS__
+PDEVICE_OBJECT HddFileSystemDeviceObject;
+#endif
+
 //
 //  Following are used to manage the async and delayed close queue.
   

[ros-diffs] [reactos] 01/01: [CDFS_NEW] Bugfix for f88fe43: don't delete devices twice on shutdown. With that bugfix, I can install ROS from ISO on HDD without troubles :-) CORE-13184

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cbf0430b56b600c29c1f615117574afcce1a9027

commit cbf0430b56b600c29c1f615117574afcce1a9027
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 18:57:11 2017 +0100

[CDFS_NEW] Bugfix for f88fe43: don't delete devices twice on shutdown.
With that bugfix, I can install ROS from ISO on HDD without troubles :-)
CORE-13184
---
 drivers/filesystems/cdfs_new/cdinit.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/cdinit.c 
b/drivers/filesystems/cdfs_new/cdinit.c
index aac879a235..b6bec14c45 100755
--- a/drivers/filesystems/cdfs_new/cdinit.c
+++ b/drivers/filesystems/cdfs_new/cdinit.c
@@ -241,10 +241,16 @@ Return Value:
 
 --*/
 {
+#ifdef __REACTOS__
+ASSERT(DeviceObject == CdData.FileSystemDeviceObject ||
+   DeviceObject == CdData.HddFileSystemDeviceObject);
+#endif
+
 IoUnregisterFileSystem (DeviceObject);
+#ifndef __REACTOS__
 IoDeleteDevice (CdData.FileSystemDeviceObject);
-#ifdef __REACTOS__
-IoDeleteDevice (CdData.HddFileSystemDeviceObject);
+#else
+IoDeleteDevice (DeviceObject);
 #endif
 
 CdCompleteRequest( NULL, Irp, STATUS_SUCCESS );



[ros-diffs] [reactos] 01/05: [NTOSKRNL] Implement IoComputeDesiredAccessFileObject() based on checks performed in NtFlushBuffersFile() CORE-14003

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7eefe702949da68e49c4365d466c5373099c3b1f

commit 7eefe702949da68e49c4365d466c5373099c3b1f
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 22:26:18 2017 +0100

[NTOSKRNL] Implement IoComputeDesiredAccessFileObject() based on checks 
performed in NtFlushBuffersFile()
CORE-14003
---
 ntoskrnl/include/internal/io.h |  7 +++
 ntoskrnl/io/iomgr/util.c   | 27 +++
 2 files changed, 34 insertions(+)

diff --git a/ntoskrnl/include/internal/io.h b/ntoskrnl/include/internal/io.h
index 54a46906db..2a4c62f42d 100644
--- a/ntoskrnl/include/internal/io.h
+++ b/ntoskrnl/include/internal/io.h
@@ -1230,6 +1230,13 @@ IopDoNameTransmogrify(
 IN PREPARSE_DATA_BUFFER DataBuffer
 );
 
+NTSTATUS
+NTAPI
+IoComputeDesiredAccessFileObject(
+IN PFILE_OBJECT FileObject,
+IN PACCESS_MASK DesiredAccess
+);
+
 //
 // I/O Timer Routines
 //
diff --git a/ntoskrnl/io/iomgr/util.c b/ntoskrnl/io/iomgr/util.c
index 14bfafda7c..7329dbf8f1 100644
--- a/ntoskrnl/io/iomgr/util.c
+++ b/ntoskrnl/io/iomgr/util.c
@@ -19,6 +19,33 @@ NTAPI
 RtlpGetStackLimits(PULONG_PTR StackBase,
PULONG_PTR StackLimit);
 
+/* PRIVATE FUNCTIONS */
+
+NTSTATUS
+NTAPI
+IoComputeDesiredAccessFileObject(IN PFILE_OBJECT FileObject,
+ IN PACCESS_MASK DesiredAccess)
+{
+/* Assume failure */
+*DesiredAccess = 0;
+
+/* First check we really have a FileObject */
+if (OBJECT_TO_OBJECT_HEADER(FileObject)->Type != IoFileObjectType)
+{
+return STATUS_OBJECT_TYPE_MISMATCH;
+}
+
+/* Then compute desired access:
+ * Check if the handle has either FILE_WRITE_DATA or FILE_APPEND_DATA was
+ * granted. However, if this is a named pipe, make sure we don't ask for
+ * FILE_APPEND_DATA as it interferes with the FILE_CREATE_PIPE_INSTANCE
+ * access right!
+ */
+*DesiredAccess = ((!(FileObject->Flags & FO_NAMED_PIPE) ? FILE_APPEND_DATA 
: 0) | FILE_WRITE_DATA);
+
+return STATUS_SUCCESS;
+}
+
 /* FUNCTIONS */
 
 /*



[ros-diffs] [reactos] 02/05: [NTOSKRNL] Implement (with many FIXMEs) ObReferenceFileObjectForWrite() so that it can already do the job! CORE-14003

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3b64f7f8fbbc64ada4dfdb6bdd1feff4bac10c1d

commit 3b64f7f8fbbc64ada4dfdb6bdd1feff4bac10c1d
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 22:28:54 2017 +0100

[NTOSKRNL] Implement (with many FIXMEs) ObReferenceFileObjectForWrite() so 
that it can already do the job!
CORE-14003
---
 ntoskrnl/include/internal/ob.h |   9 
 ntoskrnl/ob/obref.c| 108 +
 2 files changed, 117 insertions(+)

diff --git a/ntoskrnl/include/internal/ob.h b/ntoskrnl/include/internal/ob.h
index a78b5ad457..374f4a2c3e 100644
--- a/ntoskrnl/include/internal/ob.h
+++ b/ntoskrnl/include/internal/ob.h
@@ -384,6 +384,15 @@ ObpDeleteObjectType(
 IN PVOID Object
 );
 
+NTSTATUS
+NTAPI
+ObReferenceFileObjectForWrite(
+IN HANDLE Handle,
+IN KPROCESSOR_MODE AccessMode,
+OUT PFILE_OBJECT *FileObject,
+OUT POBJECT_HANDLE_INFORMATION HandleInformation
+);
+
 //
 // DOS Devices Functions
 //
diff --git a/ntoskrnl/ob/obref.c b/ntoskrnl/ob/obref.c
index 00e2188069..2f4da20149 100644
--- a/ntoskrnl/ob/obref.c
+++ b/ntoskrnl/ob/obref.c
@@ -15,6 +15,8 @@
 #define NDEBUG
 #include 
 
+extern ULONG ObpAccessProtectCloseBit;
+
 /* PRIVATE FUNCTIONS */
 
 BOOLEAN
@@ -195,6 +197,112 @@ ObFastReplaceObject(IN PEX_FAST_REF FastRef,
 return OldObject;
 }
 
+NTSTATUS
+NTAPI
+ObReferenceFileObjectForWrite(IN HANDLE Handle,
+  IN KPROCESSOR_MODE AccessMode,
+  OUT PFILE_OBJECT *FileObject,
+  OUT POBJECT_HANDLE_INFORMATION HandleInformation)
+{
+NTSTATUS Status;
+PHANDLE_TABLE HandleTable;
+POBJECT_HEADER ObjectHeader;
+PHANDLE_TABLE_ENTRY HandleEntry;
+ACCESS_MASK GrantedAccess, DesiredAccess;
+
+/* Assume failure */
+*FileObject = NULL;
+
+/* Check if this is a special handle */
+if (HandleToLong(Handle) < 0)
+{
+/* Make sure we have a valid kernel handle */
+if (AccessMode != KernelMode || Handle == NtCurrentProcess() || Handle 
== NtCurrentThread())
+{
+return STATUS_INVALID_HANDLE;
+}
+
+/* Use the kernel handle table and get the actual handle value */
+Handle = ObKernelHandleToHandle(Handle);
+HandleTable = ObpKernelHandleTable;
+}
+else
+{
+/* Otherwise use this process's handle table */
+HandleTable = PsGetCurrentProcess()->ObjectTable;
+}
+
+ASSERT(HandleTable != NULL);
+KeEnterCriticalRegion();
+
+/* Get the handle entry */
+HandleEntry = ExMapHandleToPointer(HandleTable, Handle);
+if (HandleEntry)
+{
+/* Get the object header and validate the type*/
+ObjectHeader = ObpGetHandleObject(HandleEntry);
+
+/* Get the desired access from the file object */
+if 
(!NT_SUCCESS(IoComputeDesiredAccessFileObject((PFILE_OBJECT)>Body,
+)))
+{
+Status = STATUS_OBJECT_TYPE_MISMATCH;
+}
+else
+{
+/* Extract the granted access from the handle entry */
+if (BooleanFlagOn(NtGlobalFlag, FLG_KERNEL_STACK_TRACE_DB))
+{
+/* FIXME: Translate granted access */
+GrantedAccess = HandleEntry->GrantedAccess;
+}
+else
+{
+GrantedAccess = HandleEntry->GrantedAccess & 
~ObpAccessProtectCloseBit;
+}
+
+/* FIXME: Get handle information for audit */
+
+HandleInformation->GrantedAccess = GrantedAccess;
+
+/* FIXME: Get handle attributes */
+HandleInformation->HandleAttributes = 0;
+
+/* Do granted and desired access match? */
+if (GrantedAccess & DesiredAccess)
+{
+/* FIXME: Audit access if required */
+
+/* Reference the object directly since we have its header */
+InterlockedIncrement(>PointerCount);
+
+/* Unlock the handle */
+ExUnlockHandleTableEntry(HandleTable, HandleEntry);
+KeLeaveCriticalRegion();
+
+*FileObject = (PFILE_OBJECT)>Body;
+
+/* Return success */
+ASSERT(*FileObject != NULL);
+return STATUS_SUCCESS;
+}
+
+/* No match, deny write access */
+Status = STATUS_ACCESS_DENIED;
+
+ExUnlockHandleTableEntry(HandleTable, HandleEntry);
+}
+}
+else
+{
+Status = STATUS_INVALID_HANDLE;
+}
+
+/* Return failure status */
+KeLeaveCriticalRegion();
+return Status;
+}
+
 /* PUBLIC FUNCTIONS */
 
 LONG_PTR



[ros-diffs] [reactos] 03/05: [NTOSKRNL] In NtWriteFile, quit using ObReferenceObjectByHandle in favor of ObReferenceFileObjectForWrite(). This avoids RO FSDs being called for write operations. CORE-14

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c3d5a3f2bdff97f03b802fe95dce9d0c9375e53e

commit c3d5a3f2bdff97f03b802fe95dce9d0c9375e53e
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 22:32:16 2017 +0100

[NTOSKRNL] In NtWriteFile, quit using ObReferenceObjectByHandle in favor of 
ObReferenceFileObjectForWrite().
This avoids RO FSDs being called for write operations.
CORE-14003
---
 ntoskrnl/io/iomgr/iofunc.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/ntoskrnl/io/iomgr/iofunc.c b/ntoskrnl/io/iomgr/iofunc.c
index 93f1fe4e5f..9ab983ac21 100644
--- a/ntoskrnl/io/iomgr/iofunc.c
+++ b/ntoskrnl/io/iomgr/iofunc.c
@@ -3499,19 +3499,11 @@ NtWriteFile(IN HANDLE FileHandle,
 CapturedByteOffset.QuadPart = 0;
 IOTRACE(IO_API_DEBUG, "FileHandle: %p\n", FileHandle);
 
-/* Get File Object
- * FIXME: We should call ObReferenceFileObjectForWrite() instead to
- * check whether write access was actually granted. If not it will
- * fail and we will return.
- * That would allow avoiding ASSERT on FastIO later on if the FSD
- * is read-only
- */
-Status = ObReferenceObjectByHandle(FileHandle,
-   0,
-   IoFileObjectType,
-   PreviousMode,
-   (PVOID*),
-   );
+/* Get File Object for write */
+Status = ObReferenceFileObjectForWrite(FileHandle,
+   PreviousMode,
+   ,
+   );
 if (!NT_SUCCESS(Status)) return Status;
 
 /* Validate User-Mode Buffers */



[ros-diffs] [reactos] 05/05: [CDFS_NEW] Now NtWriteFile is fixed, revert 5f25582, ie remove FastIO hack from the driver CORE-14003

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=faee3753ea79c7e332c7a1b5eb74ca2c6614e23d

commit faee3753ea79c7e332c7a1b5eb74ca2c6614e23d
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 22:36:47 2017 +0100

[CDFS_NEW] Now NtWriteFile is fixed, revert 5f25582, ie remove FastIO hack 
from the driver
CORE-14003
---
 drivers/filesystems/cdfs_new/cdinit.c | 36 ---
 1 file changed, 36 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/cdinit.c 
b/drivers/filesystems/cdfs_new/cdinit.c
index 1f086fe61d..b6bec14c45 100755
--- a/drivers/filesystems/cdfs_new/cdinit.c
+++ b/drivers/filesystems/cdfs_new/cdinit.c
@@ -58,29 +58,6 @@ CdShutdown (
 #pragma alloc_text(INIT, CdInitializeGlobalData)
 #endif
 
-#ifdef __REACTOS__
-
-//
-// Stub for CcWrite, this is a hack
-//
-BOOLEAN
-NTAPI
-CdFastIoWrite (
-IN PFILE_OBJECT FileObject,
-IN PLARGE_INTEGER FileOffset,
-IN ULONG Length,
-IN BOOLEAN Wait,
-IN ULONG LockKey,
-IN PVOID Buffer,
-OUT PIO_STATUS_BLOCK IoStatus,
-IN PDEVICE_OBJECT DeviceObject)
-{
-ASSERT(FALSE);
-return FALSE;
-}
-
-#endif
-
 
 //
 //  Local support routine
@@ -365,19 +342,6 @@ Return Value:
 CdFastIoDispatch.SizeOfFastIoDispatch =sizeof(FAST_IO_DISPATCH);
 CdFastIoDispatch.FastIoCheckIfPossible =   CdFastIoCheckIfPossible;  //  
CheckForFastIo
 CdFastIoDispatch.FastIoRead =  FsRtlCopyRead;//  
Read
-#ifdef __REACTOS__
-
-//
-// Add a stub for CdFastIoWrite. This is a hack required because
-// our current implementation of NtWriteFile won't validate
-// access granted to files opened. And some applications may attempt
-// to write to a file. In case it is cached, the kernel will 
null-dereference
-// the fastIO routine, trying to call it.
-// FIXME: remove once NtWriteFile got fixed!
-//
-
-CdFastIoDispatch.FastIoWrite = CdFastIoWrite;// 
Write
-#endif
 CdFastIoDispatch.FastIoQueryBasicInfo =CdFastQueryBasicInfo; //  
QueryBasicInfo
 CdFastIoDispatch.FastIoQueryStandardInfo = CdFastQueryStdInfo;   //  
QueryStandardInfo
 CdFastIoDispatch.FastIoLock =  CdFastLock;   //  
Lock



[ros-diffs] [reactos] 04/05: [NTOSKNRL] In NtWriteFile, remove the check that is now redundant with ObReferenceFileObjectForWrite(). CORE-14003

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1d777ffab5458495c04f250cf7ced379f306a7af

commit 1d777ffab5458495c04f250cf7ced379f306a7af
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 22:33:58 2017 +0100

[NTOSKNRL] In NtWriteFile, remove the check that is now redundant with 
ObReferenceFileObjectForWrite().
CORE-14003
---
 ntoskrnl/io/iomgr/iofunc.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/ntoskrnl/io/iomgr/iofunc.c b/ntoskrnl/io/iomgr/iofunc.c
index 9ab983ac21..46fcce201d 100644
--- a/ntoskrnl/io/iomgr/iofunc.c
+++ b/ntoskrnl/io/iomgr/iofunc.c
@@ -3511,21 +3511,6 @@ NtWriteFile(IN HANDLE FileHandle,
 {
 _SEH2_TRY
 {
-/*
- * Check if the handle has either FILE_WRITE_DATA or
- * FILE_APPEND_DATA granted. However, if this is a named pipe,
- * make sure we don't ask for FILE_APPEND_DATA as it interferes
- * with the FILE_CREATE_PIPE_INSTANCE access right!
- */
-if (!(ObjectHandleInfo.GrantedAccess &
- ((!(FileObject->Flags & FO_NAMED_PIPE) ?
-   FILE_APPEND_DATA : 0) | FILE_WRITE_DATA)))
-{
-/* We failed */
-ObDereferenceObject(FileObject);
-_SEH2_YIELD(return STATUS_ACCESS_DENIED);
-}
-
 /* Probe the status block */
 ProbeForWriteIoStatusBlock(IoStatusBlock);
 



[ros-diffs] [reactos] 01/01: [NTOSKRNL] Add a FIXME in NtWriteFile() that explains how broken is our current implementation regarding read-only FSDs

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1bef48796e4df655c71ddd92a00417dbe9e530ca

commit 1bef48796e4df655c71ddd92a00417dbe9e530ca
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 21:11:22 2017 +0100

[NTOSKRNL] Add a FIXME in NtWriteFile() that explains how broken is our 
current implementation regarding read-only FSDs
---
 ntoskrnl/io/iomgr/iofunc.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ntoskrnl/io/iomgr/iofunc.c b/ntoskrnl/io/iomgr/iofunc.c
index 5aa67ee3e1..93f1fe4e5f 100644
--- a/ntoskrnl/io/iomgr/iofunc.c
+++ b/ntoskrnl/io/iomgr/iofunc.c
@@ -3499,7 +3499,13 @@ NtWriteFile(IN HANDLE FileHandle,
 CapturedByteOffset.QuadPart = 0;
 IOTRACE(IO_API_DEBUG, "FileHandle: %p\n", FileHandle);
 
-/* Get File Object */
+/* Get File Object
+ * FIXME: We should call ObReferenceFileObjectForWrite() instead to
+ * check whether write access was actually granted. If not it will
+ * fail and we will return.
+ * That would allow avoiding ASSERT on FastIO later on if the FSD
+ * is read-only
+ */
 Status = ObReferenceObjectByHandle(FileHandle,
0,
IoFileObjectType,



[ros-diffs] [reactos] 01/01: [CDFS_NEW] Following 1bef487, add a hack and stub FastIO write routine to avoid bugchecks on write attempts. This allows booting the ReactOS LiveCD as HDD image in Qemu wi

2017-11-12 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5f255827d3282b2dea1bc6d5ba77607550742ced

commit 5f255827d3282b2dea1bc6d5ba77607550742ced
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 12 21:16:31 2017 +0100

[CDFS_NEW] Following 1bef487, add a hack and stub FastIO write routine to 
avoid bugchecks on write attempts.
This allows booting the ReactOS LiveCD as HDD image in Qemu without issues 
:-)
---
 drivers/filesystems/cdfs_new/cdinit.c | 36 +++
 1 file changed, 36 insertions(+)

diff --git a/drivers/filesystems/cdfs_new/cdinit.c 
b/drivers/filesystems/cdfs_new/cdinit.c
index b6bec14c45..1f086fe61d 100755
--- a/drivers/filesystems/cdfs_new/cdinit.c
+++ b/drivers/filesystems/cdfs_new/cdinit.c
@@ -58,6 +58,29 @@ CdShutdown (
 #pragma alloc_text(INIT, CdInitializeGlobalData)
 #endif
 
+#ifdef __REACTOS__
+
+//
+// Stub for CcWrite, this is a hack
+//
+BOOLEAN
+NTAPI
+CdFastIoWrite (
+IN PFILE_OBJECT FileObject,
+IN PLARGE_INTEGER FileOffset,
+IN ULONG Length,
+IN BOOLEAN Wait,
+IN ULONG LockKey,
+IN PVOID Buffer,
+OUT PIO_STATUS_BLOCK IoStatus,
+IN PDEVICE_OBJECT DeviceObject)
+{
+ASSERT(FALSE);
+return FALSE;
+}
+
+#endif
+
 
 //
 //  Local support routine
@@ -342,6 +365,19 @@ Return Value:
 CdFastIoDispatch.SizeOfFastIoDispatch =sizeof(FAST_IO_DISPATCH);
 CdFastIoDispatch.FastIoCheckIfPossible =   CdFastIoCheckIfPossible;  //  
CheckForFastIo
 CdFastIoDispatch.FastIoRead =  FsRtlCopyRead;//  
Read
+#ifdef __REACTOS__
+
+//
+// Add a stub for CdFastIoWrite. This is a hack required because
+// our current implementation of NtWriteFile won't validate
+// access granted to files opened. And some applications may attempt
+// to write to a file. In case it is cached, the kernel will 
null-dereference
+// the fastIO routine, trying to call it.
+// FIXME: remove once NtWriteFile got fixed!
+//
+
+CdFastIoDispatch.FastIoWrite = CdFastIoWrite;// 
Write
+#endif
 CdFastIoDispatch.FastIoQueryBasicInfo =CdFastQueryBasicInfo; //  
QueryBasicInfo
 CdFastIoDispatch.FastIoQueryStandardInfo = CdFastQueryStdInfo;   //  
QueryStandardInfo
 CdFastIoDispatch.FastIoLock =  CdFastLock;   //  
Lock



[ros-diffs] [reactos] 01/01: [CDFS] Remove the VPB field from the VCB. Not only it was never set, but the only times it was used was broken!

2017-11-04 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fa0327d6c5f28d59838b240f3e363f82a90606ee

commit fa0327d6c5f28d59838b240f3e363f82a90606ee
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 4 19:46:01 2017 +0100

[CDFS] Remove the VPB field from the VCB. Not only it was never set, but 
the only times it was used was broken!
---
 drivers/filesystems/cdfs/cdfs.h  | 1 -
 drivers/filesystems/cdfs/fsctl.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/filesystems/cdfs/cdfs.h b/drivers/filesystems/cdfs/cdfs.h
index 3d77e5b645..dff86cec2e 100644
--- a/drivers/filesystems/cdfs/cdfs.h
+++ b/drivers/filesystems/cdfs/cdfs.h
@@ -161,7 +161,6 @@ typedef struct
   KSPIN_LOCK FcbListLock;
   LIST_ENTRY FcbListHead;
 
-  PVPB Vpb;
   PDEVICE_OBJECT VolumeDevice;
   PDEVICE_OBJECT StorageDevice;
   PFILE_OBJECT StreamFileObject;
diff --git a/drivers/filesystems/cdfs/fsctl.c b/drivers/filesystems/cdfs/fsctl.c
index f153077017..44ad59cf22 100644
--- a/drivers/filesystems/cdfs/fsctl.c
+++ b/drivers/filesystems/cdfs/fsctl.c
@@ -419,7 +419,7 @@ CdfsMountVolume(
 DeviceExt->StreamFileObject->FsContext2 = Ccb;
 DeviceExt->StreamFileObject->SectionObjectPointer = 
>SectionObjectPointers;
 DeviceExt->StreamFileObject->PrivateCacheMap = NULL;
-DeviceExt->StreamFileObject->Vpb = DeviceExt->Vpb;
+DeviceExt->StreamFileObject->Vpb = DeviceToMount->Vpb;
 Ccb->PtrFileObject = DeviceExt->StreamFileObject;
 Fcb->FileObject = DeviceExt->StreamFileObject;
 Fcb->DevExt = (PDEVICE_EXTENSION)DeviceExt->StorageDevice;



[ros-diffs] [reactos] 01/01: [CDFS] Implement open handle count

2017-11-04 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=95447d2fd11604eeea4870ed7a6e9b3610eb1173

commit 95447d2fd11604eeea4870ed7a6e9b3610eb1173
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 4 21:14:50 2017 +0100

[CDFS] Implement open handle count
---
 drivers/filesystems/cdfs/cdfs.h| 3 +++
 drivers/filesystems/cdfs/cleanup.c | 2 ++
 drivers/filesystems/cdfs/create.c  | 3 +++
 3 files changed, 8 insertions(+)

diff --git a/drivers/filesystems/cdfs/cdfs.h b/drivers/filesystems/cdfs/cdfs.h
index dff86cec2e..f5a8185834 100644
--- a/drivers/filesystems/cdfs/cdfs.h
+++ b/drivers/filesystems/cdfs/cdfs.h
@@ -170,6 +170,9 @@ typedef struct
   /* Notifications */
   LIST_ENTRY NotifyList;
   PNOTIFY_SYNC NotifySync;
+
+  /* Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP */
+  ULONG OpenHandleCount;
 } DEVICE_EXTENSION, *PDEVICE_EXTENSION, VCB, *PVCB;
 
 
diff --git a/drivers/filesystems/cdfs/cleanup.c 
b/drivers/filesystems/cdfs/cleanup.c
index 5ee39b1616..10d7704636 100644
--- a/drivers/filesystems/cdfs/cleanup.c
+++ b/drivers/filesystems/cdfs/cleanup.c
@@ -55,6 +55,8 @@ CdfsCleanupFile(PCDFS_IRP_CONTEXT IrpContext,
 return STATUS_SUCCESS;
 }
 
+DeviceExt->OpenHandleCount--;
+
 /* Notify about the cleanup */
 FsRtlNotifyCleanup(DeviceExt->NotifySync,
&(DeviceExt->NotifyList),
diff --git a/drivers/filesystems/cdfs/create.c 
b/drivers/filesystems/cdfs/create.c
index 6271893b67..de53b1e74a 100644
--- a/drivers/filesystems/cdfs/create.c
+++ b/drivers/filesystems/cdfs/create.c
@@ -241,6 +241,8 @@ CdfsCreateFile(PDEVICE_OBJECT DeviceObject,
 CdfsCloseFile (DeviceExt, FileObject);
 return STATUS_NOT_A_DIRECTORY;
 }
+
+DeviceExt->OpenHandleCount++;
 }
 
 /*
@@ -271,6 +273,7 @@ CdfsCreate(
 /* DeviceObject represents FileSystem instead of logical volume */
 DPRINT("Opening file system\n");
 IrpContext->Irp->IoStatus.Information = FILE_OPENED;
+DeviceExt->OpenHandleCount++;
 return STATUS_SUCCESS;
 }
 



[ros-diffs] [reactos] 01/01: [CDFS] Implement volume un/locking. CORE-13957

2017-11-04 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=03a9d8c7ca880006b4aa37098e885206ddc106cc

commit 03a9d8c7ca880006b4aa37098e885206ddc106cc
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 4 21:29:51 2017 +0100

[CDFS] Implement volume un/locking.
CORE-13957
---
 drivers/filesystems/cdfs/cdfs.h  |  4 +++
 drivers/filesystems/cdfs/fsctl.c | 69 
 2 files changed, 73 insertions(+)

diff --git a/drivers/filesystems/cdfs/cdfs.h b/drivers/filesystems/cdfs/cdfs.h
index f5a8185834..b23846f647 100644
--- a/drivers/filesystems/cdfs/cdfs.h
+++ b/drivers/filesystems/cdfs/cdfs.h
@@ -153,6 +153,8 @@ typedef struct _CDINFO
 } CDINFO, *PCDINFO;
 
 
+#define VCB_VOLUME_LOCKED 0x0001
+
 typedef struct
 {
   ERESOURCE VcbResource;
@@ -165,6 +167,8 @@ typedef struct
   PDEVICE_OBJECT StorageDevice;
   PFILE_OBJECT StreamFileObject;
 
+  ULONG Flags;
+
   CDINFO CdInfo;
 
   /* Notifications */
diff --git a/drivers/filesystems/cdfs/fsctl.c b/drivers/filesystems/cdfs/fsctl.c
index 44ad59cf22..925819fb8e 100644
--- a/drivers/filesystems/cdfs/fsctl.c
+++ b/drivers/filesystems/cdfs/fsctl.c
@@ -23,6 +23,7 @@
 * PURPOSE:  CDROM (ISO 9660) filesystem driver
 * PROGRAMMER:   Art Yerkes
 *   Eric Kohl
+*   Pierre Schweitzer
 */
 
 /* INCLUDES */
@@ -549,6 +550,64 @@ CdfsVerifyVolume(
 }
 
 
+static
+NTSTATUS
+CdfsLockOrUnlockVolume(
+IN PCDFS_IRP_CONTEXT IrpContext,
+IN BOOLEAN LockVolume)
+{
+PFCB Fcb;
+PVPB Vpb;
+PFILE_OBJECT FileObject;
+PDEVICE_EXTENSION DeviceExt;
+
+FileObject = IrpContext->FileObject;
+Fcb = FileObject->FsContext;
+DeviceExt = IrpContext->DeviceObject->DeviceExtension;
+Vpb = DeviceExt->StreamFileObject->Vpb;
+
+/* Only allow locking with the volume open */
+if (!BooleanFlagOn(Fcb->Flags, FCB_IS_VOLUME_STREAM))
+{
+return STATUS_ACCESS_DENIED;
+}
+
+/* Bail out if it's already in the demanded state */
+if ((BooleanFlagOn(DeviceExt->Flags, VCB_VOLUME_LOCKED) && LockVolume) ||
+(!BooleanFlagOn(DeviceExt->Flags, VCB_VOLUME_LOCKED) && !LockVolume))
+{
+return STATUS_ACCESS_DENIED;
+}
+
+/* Bail out if it's already in the demanded state */
+if ((BooleanFlagOn(Vpb->Flags, VPB_LOCKED) && LockVolume) ||
+(!BooleanFlagOn(Vpb->Flags, VPB_LOCKED) && !LockVolume))
+{
+return STATUS_ACCESS_DENIED;
+}
+
+/* Deny locking if we're not alone */
+if (LockVolume && DeviceExt->OpenHandleCount != 1)
+{
+return STATUS_ACCESS_DENIED;
+}
+
+/* Finally, proceed */
+if (LockVolume)
+{
+DeviceExt->Flags |= VCB_VOLUME_LOCKED;
+Vpb->Flags |= VPB_LOCKED;
+}
+else
+{
+DeviceExt->Flags &= ~VCB_VOLUME_LOCKED;
+Vpb->Flags &= ~VPB_LOCKED;
+}
+
+return STATUS_SUCCESS;
+}
+
+
 NTSTATUS
 NTAPI
 CdfsSetCompression(
@@ -604,6 +663,16 @@ CdfsFileSystemControl(
 Status = CdfsSetCompression(DeviceObject, Irp);
 break;
 
+case FSCTL_LOCK_VOLUME:
+DPRINT("CDFS: IRP_MN_USER_FS_REQUEST / 
FSCTL_LOCK_VOLUME\n");
+Status = CdfsLockOrUnlockVolume(IrpContext, TRUE);
+break;
+
+case FSCTL_UNLOCK_VOLUME:
+DPRINT("CDFS: IRP_MN_USER_FS_REQUEST / 
FSCTL_UNLOCK_VOLUME\n");
+Status = CdfsLockOrUnlockVolume(IrpContext, FALSE);
+break;
+
 default:
 DPRINT1("CDFS: IRP_MN_USER_FS_REQUEST / Unknown 
IoControlCode 0x%x\n",
 Stack->Parameters.DeviceIoControl.IoControlCode);



[ros-diffs] [reactos] 01/01: [CDFS] Don't use uninit var. Fixes MSVC build (good boy :-))

2017-11-04 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b30670ba43ec5b8901ddbc98aff11f0f8be5d70d

commit b30670ba43ec5b8901ddbc98aff11f0f8be5d70d
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 4 21:23:11 2017 +0100

[CDFS] Don't use uninit var. Fixes MSVC build (good boy :-))
---
 drivers/filesystems/cdfs/create.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/filesystems/cdfs/create.c 
b/drivers/filesystems/cdfs/create.c
index de53b1e74a..09a054bf1b 100644
--- a/drivers/filesystems/cdfs/create.c
+++ b/drivers/filesystems/cdfs/create.c
@@ -268,6 +268,7 @@ CdfsCreate(
 ASSERT(IrpContext);
 
 DeviceObject = IrpContext->DeviceObject;
+DeviceExt = DeviceObject->DeviceExtension;
 if (DeviceObject == CdfsGlobalData->CdFsDeviceObject || DeviceObject == 
CdfsGlobalData->HddFsDeviceObject)
 {
 /* DeviceObject represents FileSystem instead of logical volume */
@@ -277,8 +278,6 @@ CdfsCreate(
 return STATUS_SUCCESS;
 }
 
-DeviceExt = DeviceObject->DeviceExtension;
-
 KeEnterCriticalRegion();
 ExAcquireResourceExclusiveLite(>DirResource,
 TRUE);



[ros-diffs] [reactos] 01/01: [CDFS] Addendum to 03a9d8c: check for volume state (locked?) before opening a file CORE-13957

2017-11-04 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a2ed758a205cedcafbc836e4ca5ac6b87d60c2e6

commit a2ed758a205cedcafbc836e4ca5ac6b87d60c2e6
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Nov 4 21:31:35 2017 +0100

[CDFS] Addendum to 03a9d8c: check for volume state (locked?) before opening 
a file
CORE-13957
---
 drivers/filesystems/cdfs/create.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/filesystems/cdfs/create.c 
b/drivers/filesystems/cdfs/create.c
index 09a054bf1b..dde7a2404d 100644
--- a/drivers/filesystems/cdfs/create.c
+++ b/drivers/filesystems/cdfs/create.c
@@ -222,6 +222,11 @@ CdfsCreateFile(PDEVICE_OBJECT DeviceObject,
 return STATUS_ACCESS_DENIED;
 }
 
+if (BooleanFlagOn(DeviceExt->Flags, VCB_VOLUME_LOCKED))
+{
+return STATUS_ACCESS_DENIED;
+}
+
 Status = CdfsOpenFile(DeviceExt,
 FileObject,
 >FileName);



[ros-diffs] [reactos] 02/02: [CDFS] Set the FO_CLEANUP_COMPLETE on cleanup

2017-11-05 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f65b294f21549e7331c6117372d245d45317417e

commit f65b294f21549e7331c6117372d245d45317417e
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 5 13:47:58 2017 +0100

[CDFS] Set the FO_CLEANUP_COMPLETE on cleanup
---
 drivers/filesystems/cdfs/cleanup.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/filesystems/cdfs/cleanup.c 
b/drivers/filesystems/cdfs/cleanup.c
index 10d7704636..63ae24f7d9 100644
--- a/drivers/filesystems/cdfs/cleanup.c
+++ b/drivers/filesystems/cdfs/cleanup.c
@@ -77,6 +77,9 @@ CdfsCleanupFile(PCDFS_IRP_CONTEXT IrpContext,
 CcUninitializeCacheMap (FileObject, NULL, NULL);
 }
 
+/* Inform cleanup is complete */
+FileObject->Flags |= FO_CLEANUP_COMPLETE;
+
 return STATUS_SUCCESS;
 }
 



[ros-diffs] [reactos] 01/02: [CDFS] Don't allow FS opening when volume is locked

2017-11-05 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=244b4f99b384c921a16e5b39e9a0af608c263ad8

commit 244b4f99b384c921a16e5b39e9a0af608c263ad8
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Nov 5 10:59:49 2017 +0100

[CDFS] Don't allow FS opening when volume is locked
---
 drivers/filesystems/cdfs/create.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/filesystems/cdfs/create.c 
b/drivers/filesystems/cdfs/create.c
index dde7a2404d..704a4cfc91 100644
--- a/drivers/filesystems/cdfs/create.c
+++ b/drivers/filesystems/cdfs/create.c
@@ -222,11 +222,6 @@ CdfsCreateFile(PDEVICE_OBJECT DeviceObject,
 return STATUS_ACCESS_DENIED;
 }
 
-if (BooleanFlagOn(DeviceExt->Flags, VCB_VOLUME_LOCKED))
-{
-return STATUS_ACCESS_DENIED;
-}
-
 Status = CdfsOpenFile(DeviceExt,
 FileObject,
 >FileName);
@@ -274,6 +269,11 @@ CdfsCreate(
 
 DeviceObject = IrpContext->DeviceObject;
 DeviceExt = DeviceObject->DeviceExtension;
+if (BooleanFlagOn(DeviceExt->Flags, VCB_VOLUME_LOCKED))
+{
+return STATUS_ACCESS_DENIED;
+}
+
 if (DeviceObject == CdfsGlobalData->CdFsDeviceObject || DeviceObject == 
CdfsGlobalData->HddFsDeviceObject)
 {
 /* DeviceObject represents FileSystem instead of logical volume */



[ros-diffs] [reactos] 02/09: [CDFS_NEW] Remove a no longer required build hack

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=755bdb5d0b09e1df374f197c59639c0d78b86d6f

commit 755bdb5d0b09e1df374f197c59639c0d78b86d6f
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 19:42:27 2017 +0100

[CDFS_NEW] Remove a no longer required build hack
---
 drivers/filesystems/cdfs_new/cdprocs.h| 46 ++--
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 53 ---
 2 files changed, 22 insertions(+), 77 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/cdprocs.h 
b/drivers/filesystems/cdfs_new/cdprocs.h
index c9d34d2517..4cb7da2098 100755
--- a/drivers/filesystems/cdfs_new/cdprocs.h
+++ b/drivers/filesystems/cdfs_new/cdprocs.h
@@ -44,30 +44,28 @@ Abstract:
 //  Here are the different pool tags.
 //
 
-/* ReactOS Change: GCC doesn't understand this, use TAG macro */
-#include 
-#define TAG_CCB TAG('c','c','d','C')  //  Ccb
-#define TAG_CDROM_TOC   TAG('c','t','d','C')  //  TOC
-#define TAG_DIRENT_NAME TAG('n','d','d','C')  //  CdName in dirent
-#define TAG_ENUM_EXPRESSION TAG('e','e','d','C')  //  Search 
expression for enumeration
-#define TAG_FCB_DATATAG('d','f','d','C')  //  Data Fcb
-#define TAG_FCB_INDEX   TAG('i','f','d','C')  //  Index Fcb
-#define TAG_FCB_NONPAGEDTAG('n','f','d','C')  //  Nonpaged Fcb
-#define TAG_FCB_TABLE   TAG('t','f','d','C')  //  Fcb Table entry
-#define TAG_FILE_NAME   TAG('n','F','d','C')  //  Filename buffer
-#define TAG_GEN_SHORT_NAME  TAG('s','g','d','C')  //  Generated short 
name
-#define TAG_IO_BUFFER   TAG('f','b','d','C')  //  Temporary IO 
buffer
-#define TAG_IO_CONTEXT  TAG('o','i','d','C')  //  Io context for 
async reads
-#define TAG_IRP_CONTEXT TAG('c','i','d','C')  //  Irp Context
-#define TAG_IRP_CONTEXT_LITETAG('l','i','d','C')  //  Irp Context lite
-#define TAG_MCB_ARRAY   TAG('a','m','d','C')  //  Mcb array
-#define TAG_PATH_ENTRY_NAME TAG('n','P','d','C')  //  CdName in path 
entry
-#define TAG_PREFIX_ENTRYTAG('e','p','d','C')  //  Prefix Entry
-#define TAG_PREFIX_NAME TAG('n','p','d','C')  //  Prefix Entry name
-#define TAG_SPANNING_PATH_TABLE TAG('p','s','d','C')  //  Buffer for 
spanning path table
-#define TAG_UPCASE_NAME TAG('n','u','d','C')  //  Buffer for 
upcased name
-#define TAG_VOL_DESCTAG('d','v','d','C')  //  Buffer for 
volume descriptor
-#define TAG_VPB TAG('p','v','d','C')  //  Vpb allocated in 
filesystem
+#define TAG_CCB 'ccdC'  //  Ccb
+#define TAG_CDROM_TOC   'ctdC'  //  TOC
+#define TAG_DIRENT_NAME 'nddC'  //  CdName in dirent
+#define TAG_ENUM_EXPRESSION 'eedC'  //  Search expression for 
enumeration
+#define TAG_FCB_DATA'dfdC'  //  Data Fcb
+#define TAG_FCB_INDEX   'ifdC'  //  Index Fcb
+#define TAG_FCB_NONPAGED'nfdC'  //  Nonpaged Fcb
+#define TAG_FCB_TABLE   'tfdC'  //  Fcb Table entry
+#define TAG_FILE_NAME   'nFdC'  //  Filename buffer
+#define TAG_GEN_SHORT_NAME  'sgdC'  //  Generated short name
+#define TAG_IO_BUFFER   'fbdC'  //  Temporary IO buffer
+#define TAG_IO_CONTEXT  'oidC'  //  Io context for async reads
+#define TAG_IRP_CONTEXT 'cidC'  //  Irp Context
+#define TAG_IRP_CONTEXT_LITE'lidC'  //  Irp Context lite
+#define TAG_MCB_ARRAY   'amdC'  //  Mcb array
+#define TAG_PATH_ENTRY_NAME 'nPdC'  //  CdName in path entry
+#define TAG_PREFIX_ENTRY'epdC'  //  Prefix Entry
+#define TAG_PREFIX_NAME 'npdC'  //  Prefix Entry name
+#define TAG_SPANNING_PATH_TABLE 'psdC'  //  Buffer for spanning path table
+#define TAG_UPCASE_NAME 'nudC'  //  Buffer for upcased name
+#define TAG_VOL_DESC'dvdC'  //  Buffer for volume descriptor
+#define TAG_VPB 'pvdC'  //  Vpb allocated in filesystem
 
 //
 //  Tag all of our allocations if tagging is turned on
diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff 
b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
index 5893bed5cd..1bcaa33c9a 100644
--- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
+++ b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
@@ -403,59 +403,6 @@ Index: drivers/filesystems/cdfs_new/cdprocs.h
 ===
 --- drivers/filesystems/cdfs_new/cdprocs.h (revision 34615)
 +++ drivers/filesystems/cdfs_new/cdprocs.h (working copy)
-@@ -44,28 +44,30 @@
- //  Here are the different pool tags.
- //
- 
--#define TAG_CCB 'ccdC'  //  Ccb
--#define TAG_CDROM_TOC   'ctdC'  //  TOC
--#define TAG_DIRENT_NAME 'nddC'  //  CdName in dirent
--#

[ros-diffs] [reactos] 04/09: [CDFS_NEW] Remove a no longer required build hack

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=818025ecc8006c19ce6f6139b21294795f51bafd

commit 818025ecc8006c19ce6f6139b21294795f51bafd
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 19:46:43 2017 +0100

[CDFS_NEW] Remove a no longer required build hack
---
 drivers/filesystems/cdfs_new/fsctrl.c | 2 +-
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 7 ++-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/fsctrl.c 
b/drivers/filesystems/cdfs_new/fsctrl.c
index 95dda725a6..31c4965f9f 100755
--- a/drivers/filesystems/cdfs_new/fsctrl.c
+++ b/drivers/filesystems/cdfs_new/fsctrl.c
@@ -2295,7 +2295,7 @@ Return Value:
 
 Status = ObReferenceObjectByHandle( Handle,
 0,
-IoFileObjectType, /* ReactOS Change: 
GCC/LD Incompatibility with exported kernel data */
+*IoFileObjectType,
 KernelMode,
 (PVOID*), /* ReactOS 
Change: GCC "passing argument 5 of 'ObReferenceObjectByHandle' from 
incompatible pointer type" */
 NULL );
diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff 
b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
index 9221a7f0d7..ed075d0a1a 100644
--- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
+++ b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
@@ -935,12 +935,9 @@ Index: drivers/filesystems/cdfs_new/fsctrl.c
  CdIsVolumeDirty (
  IN PIRP_CONTEXT IrpContext,
  IN PIRP Irp
-@@ -2294,9 +2295,9 @@
- 
- Status = ObReferenceObjectByHandle( Handle,
+@@ -2296,9 +2297,9 @@
  0,
--*IoFileObjectType,
-+IoFileObjectType, /* ReactOS Change: 
GCC/LD Incompatibility with exported kernel data */
+ *IoFileObjectType,
  KernelMode,
 -,
 +(PVOID*), /* ReactOS 
Change: GCC "passing argument 5 of 'ObReferenceObjectByHandle' from 
incompatible pointer type" */



[ros-diffs] [reactos] 01/09: [CDFS_NEW] Fix headers inclusion so that it can work on a *nix platform

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3cbcb1badee213fdbadaa2db99086d21a8775fe8

commit 3cbcb1badee213fdbadaa2db99086d21a8775fe8
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 19:38:01 2017 +0100

[CDFS_NEW] Fix headers inclusion so that it can work on a *nix platform
---
 drivers/filesystems/cdfs_new/allocsup.c | 2 +-
 drivers/filesystems/cdfs_new/cachesup.c | 2 +-
 drivers/filesystems/cdfs_new/cddata.c   | 2 +-
 drivers/filesystems/cdfs_new/cdinit.c   | 2 +-
 drivers/filesystems/cdfs_new/cdprocs.h  | 6 +++---
 drivers/filesystems/cdfs_new/cleanup.c  | 2 +-
 drivers/filesystems/cdfs_new/close.c| 2 +-
 drivers/filesystems/cdfs_new/create.c   | 2 +-
 drivers/filesystems/cdfs_new/devctrl.c  | 2 +-
 drivers/filesystems/cdfs_new/deviosup.c | 2 +-
 drivers/filesystems/cdfs_new/dirctrl.c  | 2 +-
 drivers/filesystems/cdfs_new/dirsup.c   | 2 +-
 drivers/filesystems/cdfs_new/fieldoff.c | 2 +-
 drivers/filesystems/cdfs_new/fileinfo.c | 2 +-
 drivers/filesystems/cdfs_new/filobsup.c | 2 +-
 drivers/filesystems/cdfs_new/fsctrl.c   | 2 +-
 drivers/filesystems/cdfs_new/fspdisp.c  | 2 +-
 drivers/filesystems/cdfs_new/lockctrl.c | 2 +-
 drivers/filesystems/cdfs_new/namesup.c  | 2 +-
 drivers/filesystems/cdfs_new/pathsup.c  | 2 +-
 drivers/filesystems/cdfs_new/pnp.c  | 2 +-
 drivers/filesystems/cdfs_new/prefxsup.c | 2 +-
 drivers/filesystems/cdfs_new/read.c | 2 +-
 drivers/filesystems/cdfs_new/resrcsup.c | 2 +-
 drivers/filesystems/cdfs_new/strucsup.c | 2 +-
 drivers/filesystems/cdfs_new/verfysup.c | 2 +-
 drivers/filesystems/cdfs_new/volinfo.c  | 2 +-
 drivers/filesystems/cdfs_new/workque.c  | 2 +-
 28 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/allocsup.c 
b/drivers/filesystems/cdfs_new/allocsup.c
index d3129a3b46..b875eca143 100755
--- a/drivers/filesystems/cdfs_new/allocsup.c
+++ b/drivers/filesystems/cdfs_new/allocsup.c
@@ -44,7 +44,7 @@ Abstract:
 
 --*/
 
-#include "CdProcs.h"
+#include "cdprocs.h"
 
 //
 //  The Bug check file id for this module
diff --git a/drivers/filesystems/cdfs_new/cachesup.c 
b/drivers/filesystems/cdfs_new/cachesup.c
index b31422f97e..87b75bbc51 100755
--- a/drivers/filesystems/cdfs_new/cachesup.c
+++ b/drivers/filesystems/cdfs_new/cachesup.c
@@ -14,7 +14,7 @@ Abstract:
 
 --*/
 
-#include "CdProcs.h"
+#include "cdprocs.h"
 
 //
 //  The Bug check file id for this module
diff --git a/drivers/filesystems/cdfs_new/cddata.c 
b/drivers/filesystems/cdfs_new/cddata.c
index db9d8940de..dbd572a797 100755
--- a/drivers/filesystems/cdfs_new/cddata.c
+++ b/drivers/filesystems/cdfs_new/cddata.c
@@ -17,7 +17,7 @@ Abstract:
 
 --*/
 
-#include "CdProcs.h"
+#include "cdprocs.h"
 
 #ifdef CD_SANITY
 BOOLEAN CdTestTopLevel = TRUE;
diff --git a/drivers/filesystems/cdfs_new/cdinit.c 
b/drivers/filesystems/cdfs_new/cdinit.c
index f0faef6af3..e66bd75377 100755
--- a/drivers/filesystems/cdfs_new/cdinit.c
+++ b/drivers/filesystems/cdfs_new/cdinit.c
@@ -13,7 +13,7 @@ Abstract:
 
 --*/
 
-#include "CdProcs.h"
+#include "cdprocs.h"
 
 //
 //  The Bug check file id for this module
diff --git a/drivers/filesystems/cdfs_new/cdprocs.h 
b/drivers/filesystems/cdfs_new/cdprocs.h
index 87fcc5a37d..c9d34d2517 100755
--- a/drivers/filesystems/cdfs_new/cdprocs.h
+++ b/drivers/filesystems/cdfs_new/cdprocs.h
@@ -28,9 +28,9 @@ Abstract:
 #endif
 
 #include "nodetype.h"
-#include "Cd.h"
-#include "CdStruc.h"
-#include "CdData.h"
+#include "cd.h"
+#include "cdstruc.h"
+#include "cddata.h"
 
 
 // x86 compiler bug 
diff --git a/drivers/filesystems/cdfs_new/cleanup.c 
b/drivers/filesystems/cdfs_new/cleanup.c
index 70faad7209..4c621e5c2f 100755
--- a/drivers/filesystems/cdfs_new/cleanup.c
+++ b/drivers/filesystems/cdfs_new/cleanup.c
@@ -14,7 +14,7 @@ Abstract:
 
 --*/
 
-#include "CdProcs.h"
+#include "cdprocs.h"
 
 //
 //  The Bug check file id for this module
diff --git a/drivers/filesystems/cdfs_new/close.c 
b/drivers/filesystems/cdfs_new/close.c
index 9090c6e2c8..d2827793c6 100755
--- a/drivers/filesystems/cdfs_new/close.c
+++ b/drivers/filesystems/cdfs_new/close.c
@@ -42,7 +42,7 @@ Abstract:
 
 --*/
 
-#include "CdProcs.h"
+#include "cdprocs.h"
 
 //
 //  The Bug check file id for this module
diff --git a/drivers/filesystems/cdfs_new/create.c 
b/drivers/filesystems/cdfs_new/create.c
index 1458ea2d44..bb072da107 100755
--- a/drivers/filesystems/cdfs_new/create.c
+++ b/drivers/filesystems/cdfs_new/create.c
@@ -14,7 +14,7 @@ Abstract:
 
 --*/
 
-#include "CdProcs.h"
+#include "cdprocs.h"
 
 //
 //  The Bug check file id for this module
diff --git a/drivers/filesystems/cdfs_new/devctrl.c 
b/drivers/filesystems/cdfs_new/devctrl.c
index 7efebef13a..786a36d924 100755
--- a/drivers/filesystems/cdfs_new/devctrl.c
+

[ros-diffs] [reactos] 08/09: [CDFS_NEW] Add a CMakeFile and a registry file. When using both, you get a driver that builds and works in ROS. Could install ROS with it! :-)

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8b2fd60829eeeb28fcafc0ef2511f7bed04ffd64

commit 8b2fd60829eeeb28fcafc0ef2511f7bed04ffd64
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 19:58:49 2017 +0100

[CDFS_NEW] Add a CMakeFile and a registry file. When using both, you get a 
driver that builds and works in ROS. Could install ROS with it! :-)
---
 drivers/filesystems/cdfs_new/CMakeLists.txt | 37 +
 drivers/filesystems/cdfs_new/cdfs_reg.inf   |  7 ++
 2 files changed, 44 insertions(+)

diff --git a/drivers/filesystems/cdfs_new/CMakeLists.txt 
b/drivers/filesystems/cdfs_new/CMakeLists.txt
new file mode 100644
index 00..c0b56e99db
--- /dev/null
+++ b/drivers/filesystems/cdfs_new/CMakeLists.txt
@@ -0,0 +1,37 @@
+
+include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers)
+
+list(APPEND SOURCE
+allocsup.c
+cachesup.c
+cddata.c
+cdinit.c
+cleanup.c
+close.c
+create.c
+devctrl.c
+deviosup.c
+dirctrl.c
+dirsup.c
+fileinfo.c
+filobsup.c
+fsctrl.c
+fspdisp.c
+lockctrl.c
+namesup.c
+pathsup.c
+pnp.c
+prefxsup.c
+read.c
+resrcsup.c
+strucsup.c
+verfysup.c
+volinfo.c
+workque.c)
+
+add_library(cdfs SHARED ${SOURCE} cdfs.rc)
+set_module_type(cdfs kernelmodedriver)
+target_link_libraries(cdfs ${PSEH_LIB} memcmp)
+add_importlibs(cdfs ntoskrnl hal)
+add_cd_file(TARGET cdfs DESTINATION reactos/system32/drivers NO_CAB FOR all)
+add_registry_inf(cdfs_reg.inf)
diff --git a/drivers/filesystems/cdfs_new/cdfs_reg.inf 
b/drivers/filesystems/cdfs_new/cdfs_reg.inf
new file mode 100644
index 00..9ae7413c61
--- /dev/null
+++ b/drivers/filesystems/cdfs_new/cdfs_reg.inf
@@ -0,0 +1,7 @@
+; Cdfs (ISO96660) filesystem driver
+[AddReg]
+HKLM,"SYSTEM\CurrentControlSet\Services\Cdfs","ErrorControl",0x00010001,0x
+HKLM,"SYSTEM\CurrentControlSet\Services\Cdfs","Group",0x,"File System"
+HKLM,"SYSTEM\CurrentControlSet\Services\Cdfs","ImagePath",0x0002,"system32\drivers\cdfs.sys"
+HKLM,"SYSTEM\CurrentControlSet\Services\Cdfs","Start",0x00010001,0x0003
+HKLM,"SYSTEM\CurrentControlSet\Services\Cdfs","Type",0x00010001,0x0002



[ros-diffs] [reactos] 05/09: [CDFS_NEW] Force calling convention to allow build

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3d4b8783fd0b9b8231a46e7b914447b86255e35b

commit 3d4b8783fd0b9b8231a46e7b914447b86255e35b
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 19:49:47 2017 +0100

[CDFS_NEW] Force calling convention to allow build
---
 drivers/filesystems/cdfs_new/pnp.c|  2 ++
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 20 
 2 files changed, 22 insertions(+)

diff --git a/drivers/filesystems/cdfs_new/pnp.c 
b/drivers/filesystems/cdfs_new/pnp.c
index c9106fe958..596ac288c7 100755
--- a/drivers/filesystems/cdfs_new/pnp.c
+++ b/drivers/filesystems/cdfs_new/pnp.c
@@ -51,6 +51,7 @@ CdPnpCancelRemove (
 );
 
 NTSTATUS
+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
 CdPnpCompletionRoutine (
 IN PDEVICE_OBJECT DeviceObject,
 IN PIRP Irp,
@@ -774,6 +775,7 @@ Return Value:
 //
 
 NTSTATUS
+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
 CdPnpCompletionRoutine (
 IN PDEVICE_OBJECT DeviceObject,
 IN PIRP Irp,
diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff 
b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
index ed075d0a1a..738aacd9ef 100644
--- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
+++ b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
@@ -973,6 +973,26 @@ Index: drivers/filesystems/cdfs_new/fsctrl.c
  VOLUME_ID_LENGTH,
  (PCHAR) Vcb->Vpb->VolumeLabel );
  
+Index: drivers/filesystems/cdfs_new/pnp.c
+===
+--- drivers/filesystems/cdfs_new/pnp.c (revision 34615)
 drivers/filesystems/cdfs_new/pnp.c (working copy)
+@@ -51,6 +51,7 @@
+ );
+ 
+ NTSTATUS
++NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
+ CdPnpCompletionRoutine (
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+@@ -774,6 +775,7 @@
+ //
+ 
+ NTSTATUS
++NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
+ CdPnpCompletionRoutine (
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
 Index: drivers/filesystems/cdfs_new/workque.c
 ===
 --- drivers/filesystems/cdfs_new/workque.c (revision 34615)



[ros-diffs] [reactos] 01/01: [CDFS_NEW] Add a hack that allows locking a volume and thus, unmounting it. All that work, just to be able to do this...

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=03d5be6437a1f2e4376ac117421133ebfdde799e

commit 03d5be6437a1f2e4376ac117421133ebfdde799e
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 20:09:23 2017 +0100

[CDFS_NEW] Add a hack that allows locking a volume and thus, unmounting it. 
All that work, just to be able to do this...
---
 drivers/filesystems/cdfs_new/fsctrl.c | 10 ++
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 17 +
 2 files changed, 27 insertions(+)

diff --git a/drivers/filesystems/cdfs_new/fsctrl.c 
b/drivers/filesystems/cdfs_new/fsctrl.c
index 31c4965f9f..562bdc6482 100755
--- a/drivers/filesystems/cdfs_new/fsctrl.c
+++ b/drivers/filesystems/cdfs_new/fsctrl.c
@@ -225,6 +225,16 @@ Return Value:
 CdReleaseVcb( IrpContext, Vcb );
 
 Status = CcWaitForCurrentLazyWriterActivity();
+#ifdef __REACTOS__
+if (Status == STATUS_NOT_IMPLEMENTED)
+{
+Status = STATUS_SUCCESS;
+}
+else
+{
+DbgPrint("CcWaitForCurrentLazyWriterActivity got implemented! Remove 
hack in %s:%s\n", __FILE__, __LINE__);
+}
+#endif
 
 //
 //  This is intentional. If we were able to get the Vcb before, just
diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff 
b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
index a4bface2e4..b27df5692d 100644
--- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
+++ b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
@@ -895,6 +895,23 @@ Index: drivers/filesystems/cdfs_new/fsctrl.c
  CdIsVolumeDirty (
  IN PIRP_CONTEXT IrpContext,
  IN PIRP Irp
+@@ -225,6 +225,16 @@
+ CdReleaseVcb( IrpContext, Vcb );
+ 
+ Status = CcWaitForCurrentLazyWriterActivity();
++#ifdef __REACTOS__
++if (Status == STATUS_NOT_IMPLEMENTED)
++{
++Status = STATUS_SUCCESS;
++}
++else
++{
++DbgPrint("CcWaitForCurrentLazyWriterActivity got implemented! Remove 
hack in %s:%s\n", __FILE__, __LINE__);
++}
++#endif
+ 
+ //
+ //  This is intentional. If we were able to get the Vcb before, just
 @@ -918,7 +919,7 @@
  
  if (CdIsRemount( IrpContext, Vcb,  )) {



[ros-diffs] [reactos] 07/09: [CDFS_NEW] Remove a broken change (lol?!) that prevented the driver to properly work in ROS... Dropping SEH doesn't mean dropping code!

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e4da7ecc50b59b9f8283d84b3707fa69c595a57d

commit e4da7ecc50b59b9f8283d84b3707fa69c595a57d
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 19:55:34 2017 +0100

[CDFS_NEW] Remove a broken change (lol?!) that prevented the driver to 
properly work in ROS... Dropping SEH doesn't mean dropping code!
---
 drivers/filesystems/cdfs_new/cdprocs.h| 4 ++--
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 6 ++
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/cdprocs.h 
b/drivers/filesystems/cdfs_new/cdprocs.h
index 4cb7da2098..921f523720 100755
--- a/drivers/filesystems/cdfs_new/cdprocs.h
+++ b/drivers/filesystems/cdfs_new/cdprocs.h
@@ -1889,8 +1889,8 @@ CdCommonPnp (   //  
Implemented in Pnp.c
 #define GetExceptionCode() 0
 #define AbnormalTermination() 0
 
-#define try_return(S) { goto try_exit; }
-#define try_leave(S) { leave; }
+#define try_return(S) { S; goto try_exit; }
+#define try_leave(S) { S; leave; }
 
 
 //
diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff 
b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
index 46023ebfb9..b785ad9107 100644
--- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
+++ b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
@@ -564,10 +564,8 @@ Index: drivers/filesystems/cdfs_new/cdprocs.h
 +#define GetExceptionCode() 0
 +#define AbnormalTermination() 0
  
--#define try_return(S) { S; goto try_exit; }
--#define try_leave(S) { S; leave; }
-+#define try_return(S) { goto try_exit; }
-+#define try_leave(S) { leave; }
+ #define try_return(S) { S; goto try_exit; }
+ #define try_leave(S) { S; leave; }
  
 +
  //



[ros-diffs] [reactos] 06/09: [CDFS_NEW] Force calling convention to allow build

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7b19676e2b541983f1062ba1c563099284646010

commit 7b19676e2b541983f1062ba1c563099284646010
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 19:52:43 2017 +0100

[CDFS_NEW] Force calling convention to allow build
---
 drivers/filesystems/cdfs_new/devctrl.c|  2 ++
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 20 
 2 files changed, 22 insertions(+)

diff --git a/drivers/filesystems/cdfs_new/devctrl.c 
b/drivers/filesystems/cdfs_new/devctrl.c
index 786a36d924..41461526df 100755
--- a/drivers/filesystems/cdfs_new/devctrl.c
+++ b/drivers/filesystems/cdfs_new/devctrl.c
@@ -27,6 +27,7 @@ Abstract:
 //
 
 NTSTATUS
+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
 CdDevCtrlCompletionRoutine (
 IN PDEVICE_OBJECT DeviceObject,
 IN PIRP Irp,
@@ -171,6 +172,7 @@ Return Value:
 //
 
 NTSTATUS
+NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
 CdDevCtrlCompletionRoutine (
 IN PDEVICE_OBJECT DeviceObject,
 IN PIRP Irp,
diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff 
b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
index 738aacd9ef..46023ebfb9 100644
--- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
+++ b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
@@ -844,6 +844,26 @@ Index: drivers/filesystems/cdfs_new/cleanup.c
  
  //
  //  If appropriate, try to spark teardown by purging the volume.  Should
+Index: drivers/filesystems/cdfs_new/devctrl.c
+===
+--- drivers/filesystems/cdfs_new/devctrl.c (revision 34615)
 drivers/filesystems/cdfs_new/devctrl.c (working copy)
+@@ -27,6 +27,7 @@
+ //
+ 
+ NTSTATUS
++NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
+ CdDevCtrlCompletionRoutine (
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+@@ -171,6 +172,7 @@
+ //
+ 
+ NTSTATUS
++NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
+ CdDevCtrlCompletionRoutine (
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
 Index: drivers/filesystems/cdfs_new/strucsup.c
 ===
 --- drivers/filesystems/cdfs_new/strucsup.c(revision 34615)



[ros-diffs] [reactos] 09/09: [CDFS_NEW] You know... RBuild has been gone for ages!

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fa1c60db50d456fe39e315fbbe18bbee78af4105

commit fa1c60db50d456fe39e315fbbe18bbee78af4105
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 20:01:36 2017 +0100

[CDFS_NEW] You know... RBuild has been gone for ages!
---
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 22 --
 1 file changed, 22 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff 
b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
index b785ad9107..a4bface2e4 100644
--- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
+++ b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
@@ -269,28 +269,6 @@ Index: drivers/filesystems/cdfs_new/volinfo.c
  //
  //  Set the information field to the number of bytes actually filled 
in
  //
-Index: drivers/filesystems/cdfs_new/cdfs.rbuild
-===
 drivers/filesystems/cdfs_new/cdfs.rbuild   (revision 34615)
-+++ drivers/filesystems/cdfs_new/cdfs.rbuild   (working copy)
-@@ -1,8 +1,8 @@
- 
- 
--
-+
-   
--  .
-+  .
-   ntoskrnl
-   hal
- allocsup.c
-@@ -32,6 +32,5 @@
- volinfo.c
- workque.c
-   cdfs.rc
---fms-extensions
-   cdprocs.h
- 
 Index: drivers/filesystems/cdfs_new/cddata.c
 ===
 --- drivers/filesystems/cdfs_new/cddata.c  (revision 34615)



[ros-diffs] [reactos] 03/09: [CDFS_NEW] Remove a no longer required build hack

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2639dd673636e4848a4fe33b9a4cd142efcc84f8

commit 2639dd673636e4848a4fe33b9a4cd142efcc84f8
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 19:44:13 2017 +0100

[CDFS_NEW] Remove a no longer required build hack
---
 drivers/filesystems/cdfs_new/nodetype.h   |  2 --
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 13 -
 2 files changed, 15 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/nodetype.h 
b/drivers/filesystems/cdfs_new/nodetype.h
index 6793954815..b227332b03 100755
--- a/drivers/filesystems/cdfs_new/nodetype.h
+++ b/drivers/filesystems/cdfs_new/nodetype.h
@@ -97,8 +97,6 @@ typedef CSHORT NODE_BYTE_SIZE;
 #define CDFS_BUG_CHECK_VOLINFO   (0x001b)
 #define CDFS_BUG_CHECK_WORKQUE   (0x001c)
 
-/* ReactOS Change: Need to add to reactos.mc */
-#define CDFS_FILE_SYSTEM ((ULONG)0x0026L)
 #define CdBugCheck(A,B,C) { KeBugCheckEx(CDFS_FILE_SYSTEM, BugCheckFileId | 
__LINE__, A, B, C ); }
 
 #endif // _NODETYPE_
diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff 
b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
index 1bcaa33c9a..9221a7f0d7 100644
--- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
+++ b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
@@ -885,19 +885,6 @@ Index: drivers/filesystems/cdfs_new/fileinfo.c
  CdFastQueryNetworkInfo (
  IN PFILE_OBJECT FileObject,
  IN BOOLEAN Wait,
-Index: drivers/filesystems/cdfs_new/nodetype.h
-===
 drivers/filesystems/cdfs_new/nodetype.h(revision 34615)
-+++ drivers/filesystems/cdfs_new/nodetype.h(working copy)
-@@ -97,6 +97,8 @@
- #define CDFS_BUG_CHECK_VOLINFO   (0x001b)
- #define CDFS_BUG_CHECK_WORKQUE   (0x001c)
- 
-+/* ReactOS Change: Need to add to reactos.mc */
-+#define CDFS_FILE_SYSTEM ((ULONG)0x0026L)
- #define CdBugCheck(A,B,C) { KeBugCheckEx(CDFS_FILE_SYSTEM, BugCheckFileId | 
__LINE__, A, B, C ); }
- 
- #endif // _NODETYPE_
 Index: drivers/filesystems/cdfs_new/fsctrl.c
 ===
 --- drivers/filesystems/cdfs_new/fsctrl.c  (revision 34615)



[ros-diffs] [reactos] 01/01: [NTOSKRNL] Make the CcWaitForCurrentLazyWriterActivity() stub return success instead of hacking FSDs. Suggested by Thomas

2017-11-06 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e88eeb21af4b778f19b10e2d0e9f1c4361d6838d

commit e88eeb21af4b778f19b10e2d0e9f1c4361d6838d
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Mon Nov 6 21:45:55 2017 +0100

[NTOSKRNL] Make the CcWaitForCurrentLazyWriterActivity() stub return 
success instead of hacking FSDs.
Suggested by Thomas
---
 drivers/filesystems/cdfs_new/fsctrl.c | 10 --
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 17 -
 ntoskrnl/cc/copy.c|  2 +-
 3 files changed, 1 insertion(+), 28 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/fsctrl.c 
b/drivers/filesystems/cdfs_new/fsctrl.c
index 562bdc6482..31c4965f9f 100755
--- a/drivers/filesystems/cdfs_new/fsctrl.c
+++ b/drivers/filesystems/cdfs_new/fsctrl.c
@@ -225,16 +225,6 @@ Return Value:
 CdReleaseVcb( IrpContext, Vcb );
 
 Status = CcWaitForCurrentLazyWriterActivity();
-#ifdef __REACTOS__
-if (Status == STATUS_NOT_IMPLEMENTED)
-{
-Status = STATUS_SUCCESS;
-}
-else
-{
-DbgPrint("CcWaitForCurrentLazyWriterActivity got implemented! Remove 
hack in %s:%s\n", __FILE__, __LINE__);
-}
-#endif
 
 //
 //  This is intentional. If we were able to get the Vcb before, just
diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff 
b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
index b27df5692d..a4bface2e4 100644
--- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
+++ b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
@@ -895,23 +895,6 @@ Index: drivers/filesystems/cdfs_new/fsctrl.c
  CdIsVolumeDirty (
  IN PIRP_CONTEXT IrpContext,
  IN PIRP Irp
-@@ -225,6 +225,16 @@
- CdReleaseVcb( IrpContext, Vcb );
- 
- Status = CcWaitForCurrentLazyWriterActivity();
-+#ifdef __REACTOS__
-+if (Status == STATUS_NOT_IMPLEMENTED)
-+{
-+Status = STATUS_SUCCESS;
-+}
-+else
-+{
-+DbgPrint("CcWaitForCurrentLazyWriterActivity got implemented! Remove 
hack in %s:%s\n", __FILE__, __LINE__);
-+}
-+#endif
- 
- //
- //  This is intentional. If we were able to get the Vcb before, just
 @@ -918,7 +919,7 @@
  
  if (CdIsRemount( IrpContext, Vcb,  )) {
diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c
index 9f6cead1c9..15c6ceb81b 100644
--- a/ntoskrnl/cc/copy.c
+++ b/ntoskrnl/cc/copy.c
@@ -524,7 +524,7 @@ CcWaitForCurrentLazyWriterActivity (
 VOID)
 {
 UNIMPLEMENTED;
-return STATUS_NOT_IMPLEMENTED;
+return STATUS_SUCCESS;
 }
 
 /*



[ros-diffs] [reactos] 03/03: [RDBSS] Start defining the RxCapture* macros and start using them (to be continued)

2017-11-01 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2511ba8f8f4c26fc8043af37102a3a664ebffe7d

commit 2511ba8f8f4c26fc8043af37102a3a664ebffe7d
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Wed Nov 1 11:45:43 2017 +0100

[RDBSS] Start defining the RxCapture* macros and start using them (to be 
continued)
---
 sdk/include/ddk/ntrxdef.h| 16 +
 sdk/lib/drivers/rdbsslib/rdbss.c | 78 +++-
 2 files changed, 53 insertions(+), 41 deletions(-)

diff --git a/sdk/include/ddk/ntrxdef.h b/sdk/include/ddk/ntrxdef.h
index da3a9ac75f..996e3ee29c 100644
--- a/sdk/include/ddk/ntrxdef.h
+++ b/sdk/include/ddk/ntrxdef.h
@@ -6,6 +6,22 @@
 #define INVALID_HANDLE_VALUE ((HANDLE)-1)
 #endif
 
+#ifndef MINIRDR__NAME
+#define RxCaptureFcb PFCB __C_Fcb = (PFCB)(RxContext->pFcb)
+#define RxCaptureFobx PFOBX __C_Fobx = (PFOBX)(RxContext->pFobx)
+#else
+#define RxCaptureFcb PMRX_FCB __C_Fcb = (RxContext->pFcb)
+#define RxCaptureFobx PMRX_FOBX __C_Fobx = (RxContext->pFobx)
+#endif
+
+#define RxCaptureParamBlock PIO_STACK_LOCATION __C_IrpSp = 
RxContext->CurrentIrpSp
+#define RxCaptureFileObject PFILE_OBJECT __C_FileObject = __C_IrpSp-> 
FileObject
+
+#define capFcb __C_Fcb
+#define capFobx __C_Fobx
+#define capPARAMS __C_IrpSp
+#define capFileObject __C_FileObject
+
 #define RxAllocatePoolWithTag ExAllocatePoolWithTag
 #define RxFreePool ExFreePool
 
diff --git a/sdk/lib/drivers/rdbsslib/rdbss.c b/sdk/lib/drivers/rdbsslib/rdbss.c
index d25171ce64..01b1bd9a7a 100644
--- a/sdk/lib/drivers/rdbsslib/rdbss.c
+++ b/sdk/lib/drivers/rdbsslib/rdbss.c
@@ -643,6 +643,8 @@ VOID
 CheckForLoudOperations(
 PRX_CONTEXT RxContext)
 {
+RxCaptureFcb;
+
 PAGED_CODE();
 
 #define ALLSCR_LENGTH (sizeof(L"all.scr") - sizeof(UNICODE_NULL))
@@ -650,11 +652,9 @@ CheckForLoudOperations(
 /* Are loud operations enabled? */
 if (RxLoudLowIoOpsEnabled)
 {
-PFCB Fcb;
-
 /* If so, the operation will be loud only if filename ends with 
all.scr */
-Fcb = (PFCB)RxContext->pFcb;
-if (RtlCompareMemory(Add2Ptr(Fcb->PrivateAlreadyPrefixedName.Buffer, 
(Fcb->PrivateAlreadyPrefixedName.Length - ALLSCR_LENGTH)),
+if (RtlCompareMemory(Add2Ptr(capFcb->PrivateAlreadyPrefixedName.Buffer,
+ (capFcb->PrivateAlreadyPrefixedName.Length - 
ALLSCR_LENGTH)),
  L"all.scr", ALLSCR_LENGTH) == ALLSCR_LENGTH)
 {
 SetFlag(RxContext->LowIoContext.Flags, LOWIO_CONTEXT_FLAG_LOUDOPS);
@@ -701,14 +701,12 @@ __RxWriteReleaseResources(
 PCSTR FileName,
 ULONG SerialNumber)
 {
-PFCB Fcb;
+RxCaptureFcb;
 
 PAGED_CODE();
 
 ASSERT(RxContext != NULL);
-
-Fcb = (PFCB)RxContext->pFcb;
-ASSERT(Fcb != NULL);
+ASSERT(capFcb != NULL);
 
 /* If FCB resource was acquired, release it */
 if (RxContext->FcbResourceAcquired)
@@ -716,11 +714,11 @@ __RxWriteReleaseResources(
 /* Taking care of owner */
 if (ResourceOwnerSet)
 {
-RxReleaseFcbForThread(RxContext, Fcb, 
RxContext->LowIoContext.ResourceThreadId);
+RxReleaseFcbForThread(RxContext, capFcb, 
RxContext->LowIoContext.ResourceThreadId);
 }
 else
 {
-RxReleaseFcb(RxContext, Fcb);
+RxReleaseFcb(RxContext, capFcb);
 }
 
 RxContext->FcbResourceAcquired = FALSE;
@@ -732,11 +730,11 @@ __RxWriteReleaseResources(
 /* Taking care of owner */
 if (ResourceOwnerSet)
 {
-RxReleasePagingIoResourceForThread(RxContext, Fcb, 
RxContext->LowIoContext.ResourceThreadId);
+RxReleasePagingIoResourceForThread(RxContext, capFcb, 
RxContext->LowIoContext.ResourceThreadId);
 }
 else
 {
-RxReleasePagingIoResource(RxContext, Fcb);
+RxReleasePagingIoResource(RxContext, capFcb);
 }
 
 /* No need to release boolean here, RxReleasePagingIoResource() takes 
care of it */
@@ -774,14 +772,13 @@ RxAddToWorkque(
 ULONG Queued;
 KIRQL OldIrql;
 WORK_QUEUE_TYPE Queue;
-PIO_STACK_LOCATION Stack;
+RxCaptureParamBlock;
 
-Stack = RxContext->CurrentIrpSp;
 RxContext->PostRequest = FALSE;
 
 /* First of all, select the appropriate queue - delayed for prefix claim, 
critical for the rest */
 if (RxContext->MajorFunction == IRP_MJ_DEVICE_CONTROL &&
-Stack->Parameters.DeviceIoControl.IoControlCode == 
IOCTL_REDIR_QUERY_PATH)
+capPARAMS->Parameters.DeviceIoControl.IoControlCode == 
IOCTL_REDIR_QUERY_PATH)
 {
 Queue = DelayedWorkQueue;
 SetFlag(RxContext->Flags, RX_CONTEXT_FLAG_FSP_DELAYED_OVERFLOW_QUEUE);
@@ -793,7 +790,7 @@ RxAddToWorkque(
 }
 
 /* Check for overflow */
-if (Stack->FileObject != NULL)
+if (capPARAMS->FileObject != NUL

[ros-diffs] [reactos] 01/03: [RDBSS] Implement RxCheckFcbStructuresForAlignment()

2017-11-01 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ac3e4a48958b1edeca3998be977cee8d09d284b0

commit ac3e4a48958b1edeca3998be977cee8d09d284b0
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Wed Nov 1 11:05:32 2017 +0100

[RDBSS] Implement RxCheckFcbStructuresForAlignment()
---
 sdk/lib/drivers/rdbsslib/rdbss.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sdk/lib/drivers/rdbsslib/rdbss.c b/sdk/lib/drivers/rdbsslib/rdbss.c
index 154c63ad72..44467fe69b 100644
--- a/sdk/lib/drivers/rdbsslib/rdbss.c
+++ b/sdk/lib/drivers/rdbsslib/rdbss.c
@@ -1323,12 +1323,15 @@ RxCanonicalizeNameAndObtainNetRoot(
 return Status;
 }
 
+/*
+ * @implemented
+ */
 VOID
 NTAPI
 RxCheckFcbStructuresForAlignment(
 VOID)
 {
-UNIMPLEMENTED;
+PAGED_CODE();
 }
 
 #if DBG



[ros-diffs] [reactos] 02/03: [RXCE] Implement RxInitializeDebugSupport()

2017-11-01 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b840f6536247a172db987a8b46a20168137fb4fe

commit b840f6536247a172db987a8b46a20168137fb4fe
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Wed Nov 1 11:20:28 2017 +0100

[RXCE] Implement RxInitializeDebugSupport()
---
 sdk/lib/drivers/rdbsslib/rdbss.c |  8 
 sdk/lib/drivers/rxce/rxce.c  | 11 +++
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/sdk/lib/drivers/rdbsslib/rdbss.c b/sdk/lib/drivers/rdbsslib/rdbss.c
index 44467fe69b..d25171ce64 100644
--- a/sdk/lib/drivers/rdbsslib/rdbss.c
+++ b/sdk/lib/drivers/rdbsslib/rdbss.c
@@ -6771,14 +6771,6 @@ RxIndicateChangeOfBufferingStateForSrvOpen(
 UNIMPLEMENTED;
 }
 
-VOID
-NTAPI
-RxInitializeDebugSupport(
-VOID)
-{
-UNIMPLEMENTED;
-}
-
 /*
  * @implemented
  */
diff --git a/sdk/lib/drivers/rxce/rxce.c b/sdk/lib/drivers/rxce/rxce.c
index 7473a2a4fa..6aad39ced3 100644
--- a/sdk/lib/drivers/rxce/rxce.c
+++ b/sdk/lib/drivers/rxce/rxce.c
@@ -4609,6 +4609,17 @@ RxInitializeContext(
 }
 }
 
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+RxInitializeDebugSupport(
+VOID)
+{
+/* Nothing to do */
+}
+
 /*
  * @implemented
  */



[ros-diffs] [reactos] 01/01: [RDBSS] Fix a bug in RxQueryNameInfo(): don't only return name length, but also the whole structure. Avoids corruption

2017-11-02 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3c679fc6b4abd351a443d0affacd01554a96a044

commit 3c679fc6b4abd351a443d0affacd01554a96a044
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Thu Nov 2 23:03:08 2017 +0100

[RDBSS] Fix a bug in RxQueryNameInfo(): don't only return name length, but 
also the whole structure. Avoids corruption
---
 sdk/lib/drivers/rdbsslib/rdbss.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sdk/lib/drivers/rdbsslib/rdbss.c b/sdk/lib/drivers/rdbsslib/rdbss.c
index 46c006d0a7..15e4a2d28c 100644
--- a/sdk/lib/drivers/rdbsslib/rdbss.c
+++ b/sdk/lib/drivers/rdbsslib/rdbss.c
@@ -8155,6 +8155,8 @@ RxQueryNameInfo(
 return STATUS_BUFFER_OVERFLOW;
 }
 
+RxContext->Info.LengthRemaining -= FIELD_OFFSET(FILE_NAME_INFORMATION, 
FileName);
+
 Fcb = (PFCB)RxContext->pFcb;
 Fobx = (PFOBX)RxContext->pFobx;
 /* Get the UNC name */



  1   2   3   4   5   6   7   8   9   >