[ros-diffs] [reactos] 01/01: [STORORT] Allocate the miniport device extension and use it the calls to HwFindAdapter and HwInitialize. CORE-13866

2017-10-14 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=42cb5353b8ce9c85c04615beca9bab6245454153

commit 42cb5353b8ce9c85c04615beca9bab6245454153
Author: Eric Kohl 
AuthorDate: Sun Oct 15 00:06:22 2017 +0200

[STORORT] Allocate the miniport device extension and use it the calls to 
HwFindAdapter and HwInitialize.
CORE-13866
---
 drivers/storage/port/storport/fdo.c  | 11 ---
 drivers/storage/port/storport/miniport.c | 32 +---
 drivers/storage/port/storport/precomp.h  | 14 +++---
 3 files changed, 48 insertions(+), 9 deletions(-)

diff --git a/drivers/storage/port/storport/fdo.c 
b/drivers/storage/port/storport/fdo.c
index be6b693694..6338c48d12 100644
--- a/drivers/storage/port/storport/fdo.c
+++ b/drivers/storage/port/storport/fdo.c
@@ -38,9 +38,14 @@ PortFdoStartMiniport(
 return STATUS_NO_SUCH_DEVICE;
 
 /* Initialize the miniport */
-MiniportInitialize(&DeviceExtension->Miniport,
-   DeviceExtension,
-   InitData);
+Status = MiniportInitialize(&DeviceExtension->Miniport,
+DeviceExtension,
+InitData);
+if (!NT_SUCCESS(Status))
+{
+DPRINT1("MiniportInitialize() failed (Status 0x%08lx)\n", Status);
+return Status;
+}
 
 /* Call the miniports FindAdapter function */
 Status = MiniportFindAdapter(&DeviceExtension->Miniport);
diff --git a/drivers/storage/port/storport/miniport.c 
b/drivers/storage/port/storport/miniport.c
index 8e1346fe8b..4e0b37e182 100644
--- a/drivers/storage/port/storport/miniport.c
+++ b/drivers/storage/port/storport/miniport.c
@@ -15,14 +15,38 @@
 
 /* FUNCTIONS 
**/
 
-VOID
+NTSTATUS
 MiniportInitialize(
 _In_ PMINIPORT Miniport,
 _In_ PFDO_DEVICE_EXTENSION DeviceExtension,
 _In_ PHW_INITIALIZATION_DATA InitData)
 {
+PMINIPORT_DEVICE_EXTENSION MiniportExtension;
+ULONG Size;
+
+DPRINT1("MiniportInitialize(%p %p %p)\n",
+Miniport, DeviceExtension, InitData);
+
 Miniport->DeviceExtension = DeviceExtension;
 Miniport->InitData = InitData;
+
+/* Calculate the miniport device extension size */
+Size = sizeof(MINIPORT_DEVICE_EXTENSION) +
+   Miniport->InitData->DeviceExtensionSize;
+
+/* Allocate and initialize the miniport device extension */
+MiniportExtension = ExAllocatePoolWithTag(NonPagedPool,
+  Size,
+  TAG_MINIPORT_DATA);
+if (MiniportExtension == NULL)
+return STATUS_NO_MEMORY;
+
+RtlZeroMemory(MiniportExtension, Size);
+
+MiniportExtension->Miniport = Miniport;
+Miniport->MiniportExtension = MiniportExtension;
+
+return STATUS_SUCCESS;
 }
 
 
@@ -36,7 +60,8 @@ MiniportFindAdapter(
 
 DPRINT1("MiniportFindAdapter(%p)\n", Miniport);
 
-Result = Miniport->InitData->HwFindAdapter(NULL,
+/* Call the miniport HwFindAdapter routine */
+Result = 
Miniport->InitData->HwFindAdapter(&Miniport->MiniportExtension->HwDeviceExtension,
NULL,
NULL,
NULL,
@@ -84,7 +109,8 @@ MiniportHwInitialize(
 
 DPRINT1("MiniportHwInitialize(%p)\n", Miniport);
 
-Status = Miniport->InitData->HwInitialize(NULL);
+/* Call the miniport HwInitialize routine */
+Status = 
Miniport->InitData->HwInitialize(&Miniport->MiniportExtension->HwDeviceExtension);
 DPRINT1("HwInitialize() returned 0x%08lx\n", Status);
 
 return Status;
diff --git a/drivers/storage/port/storport/precomp.h 
b/drivers/storage/port/storport/precomp.h
index fc1224e851..350ca6854d 100644
--- a/drivers/storage/port/storport/precomp.h
+++ b/drivers/storage/port/storport/precomp.h
@@ -23,8 +23,9 @@
 #include 
 
 /* Memory Tags */
-#define TAG_GLOBAL_DATA 'DGtS'
-#define TAG_INIT_DATA   'DItS'
+#define TAG_GLOBAL_DATA'DGtS'
+#define TAG_INIT_DATA  'DItS'
+#define TAG_MINIPORT_DATA  'DMtS'
 
 typedef enum
 {
@@ -61,10 +62,17 @@ typedef struct _DRIVER_OBJECT_EXTENSION
 LIST_ENTRY InitDataListHead;
 } DRIVER_OBJECT_EXTENSION, *PDRIVER_OBJECT_EXTENSION;
 
+typedef struct _MINIPORT_DEVICE_EXTENSION
+{
+struct _MINIPORT *Miniport;
+UCHAR HwDeviceExtension[0];
+} MINIPORT_DEVICE_EXTENSION, *PMINIPORT_DEVICE_EXTENSION;
+
 typedef struct _MINIPORT
 {
 struct _FDO_DEVICE_EXTENSION *DeviceExtension;
 PHW_INITIALIZATION_DATA InitData;
+PMINIPORT_DEVICE_EXTENSION MiniportExtension;
 } MINIPORT, *PMINIPORT;
 
 typedef struct _FDO_DEVICE_EXTENSION
@@ -107,7 +115,7 @@ PortFdoPnp(
 
 /* miniport.c */
 
-VOID
+NTSTATUS
 MiniportInitialize(
 _In_ PMINIPORT Miniport,
 _In_ PFDO_DEVICE_EXTENSION DeviceExtension,



[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 
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/01: [STORPORT] Initialize a miniport object and call the miniport HwFindAdapter and HwInitialize routines. CORE-13866

2017-10-14 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8dea67f8ba2bd2b83afcd40a4c53235be4596d37

commit 8dea67f8ba2bd2b83afcd40a4c53235be4596d37
Author: Eric Kohl 
AuthorDate: Sat Oct 14 19:12:24 2017 +0200

[STORPORT] Initialize a miniport object and call the miniport HwFindAdapter 
and HwInitialize routines.
CORE-13866
---
 drivers/storage/port/storport/CMakeLists.txt |  2 +
 drivers/storage/port/storport/fdo.c  | 80 +--
 drivers/storage/port/storport/guid.c | 11 
 drivers/storage/port/storport/miniport.c | 93 ++
 drivers/storage/port/storport/misc.c | 27 
 drivers/storage/port/storport/precomp.h  | 51 ++-
 drivers/storage/port/storport/storport.c | 98 +++-
 drivers/storage/port/storport/storport.rc|  2 +-
 8 files changed, 353 insertions(+), 11 deletions(-)

diff --git a/drivers/storage/port/storport/CMakeLists.txt 
b/drivers/storage/port/storport/CMakeLists.txt
index c531ee6f00..25b35a555d 100644
--- a/drivers/storage/port/storport/CMakeLists.txt
+++ b/drivers/storage/port/storport/CMakeLists.txt
@@ -3,6 +3,7 @@ spec2def(storport.sys storport.spec ADD_IMPORTLIB)
 
 list(APPEND SOURCE
 fdo.c
+miniport.c
 misc.c
 pdo.c
 storport.c
@@ -11,6 +12,7 @@ list(APPEND SOURCE
 
 add_library(storport SHARED
 ${SOURCE}
+guid.c
 storport.rc
 ${CMAKE_CURRENT_BINARY_DIR}/storport.def)
 
diff --git a/drivers/storage/port/storport/fdo.c 
b/drivers/storage/port/storport/fdo.c
index c8508d0527..be6b693694 100644
--- a/drivers/storage/port/storport/fdo.c
+++ b/drivers/storage/port/storport/fdo.c
@@ -15,6 +15,53 @@
 
 /* FUNCTIONS 
**/
 
+static
+NTSTATUS
+PortFdoStartMiniport(
+_In_ PFDO_DEVICE_EXTENSION DeviceExtension)
+{
+PHW_INITIALIZATION_DATA InitData;
+INTERFACE_TYPE InterfaceType;
+NTSTATUS Status;
+
+DPRINT1("PortFdoStartDevice(%p)\n", DeviceExtension);
+
+/* Get the interface type of the lower device */
+InterfaceType = GetBusInterface(DeviceExtension->LowerDevice);
+if (InterfaceType == InterfaceTypeUndefined)
+return STATUS_NO_SUCH_DEVICE;
+
+/* Get the driver init data for the given interface type */
+InitData = PortGetDriverInitData(DeviceExtension->DriverExtension,
+ InterfaceType);
+if (InitData == NULL)
+return STATUS_NO_SUCH_DEVICE;
+
+/* Initialize the miniport */
+MiniportInitialize(&DeviceExtension->Miniport,
+   DeviceExtension,
+   InitData);
+
+/* Call the miniports FindAdapter function */
+Status = MiniportFindAdapter(&DeviceExtension->Miniport);
+if (!NT_SUCCESS(Status))
+{
+DPRINT1("MiniportFindAdapter() failed (Status 0x%08lx)\n", Status);
+return Status;
+}
+
+/* Call the miniports HwInitialize function */
+Status = MiniportHwInitialize(&DeviceExtension->Miniport);
+if (!NT_SUCCESS(Status))
+{
+DPRINT1("MiniportHwInitialize() failed (Status 0x%08lx)\n", Status);
+return Status;
+}
+
+return STATUS_SUCCESS;
+}
+
+
 static
 NTSTATUS
 NTAPI
@@ -22,12 +69,36 @@ PortFdoStartDevice(
 _In_ PFDO_DEVICE_EXTENSION DeviceExtension,
 _In_ PIRP Irp)
 {
+NTSTATUS Status;
+
 DPRINT1("PortFdoStartDevice(%p %p)\n",
 DeviceExtension, Irp);
 
 ASSERT(DeviceExtension->ExtensionType == FdoExtension);
 
-return STATUS_SUCCESS;
+/* Start the lower device if the FDO is in 'stopped' state */
+if (DeviceExtension->PnpState == dsStopped)
+{
+Status = ForwardIrpAndWait(DeviceExtension->LowerDevice, Irp);
+if (!NT_SUCCESS(Status))
+{
+DPRINT1("ForwardIrpAndWait() failed (Status 0x%08lx)\n", Status);
+return Status;
+}
+}
+
+/* Change to the 'started' state */
+DeviceExtension->PnpState = dsStarted;
+
+/* Start the miniport (FindAdapter & Initialize) */
+Status = PortFdoStartMiniport(DeviceExtension);
+if (!NT_SUCCESS(Status))
+{
+DPRINT1("FdoStartMiniport() failed (Status 0x%08lx)\n", Status);
+DeviceExtension->PnpState = dsStopped;
+}
+
+return Status;
 }
 
 
@@ -72,12 +143,7 @@ PortFdoPnp(
 {
 case IRP_MN_START_DEVICE: /* 0x00 */
 DPRINT1("IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
-/* Call lower driver */
-Status = ForwardIrpAndWait(DeviceExtension->LowerDevice, Irp);
-if (NT_SUCCESS(Status))
-{
-Status = PortFdoStartDevice(DeviceExtension, Irp);
-}
+Status = PortFdoStartDevice(DeviceExtension, Irp);
 break;
 
 case IRP_MN_QUERY_REMOVE_DEVICE: /* 0x01 */
diff --git a/drivers/storage/port/storport/guid.c 
b/drivers/storage/port/storport/guid.c
new file mode 100644
index 00..757901b422

[ros-diffs] [reactos] 01/01: [EXPLORER] Remove an unnecessary refresh of the rebar and its bands.

2017-10-14 Thread Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=da5b61f32fe6ef332fa226bf1653cd12e08dc64f

commit da5b61f32fe6ef332fa226bf1653cd12e08dc64f
Author: Giannis Adamopoulos 
AuthorDate: Sat Oct 14 18:36:02 2017 +0300

[EXPLORER] Remove an unnecessary refresh of the rebar and its bands.
---
 base/shell/explorer/traywnd.cpp | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/base/shell/explorer/traywnd.cpp b/base/shell/explorer/traywnd.cpp
index d15eabfac3..f9d1f2ae39 100644
--- a/base/shell/explorer/traywnd.cpp
+++ b/base/shell/explorer/traywnd.cpp
@@ -1532,13 +1532,6 @@ ChangePos:
 
 Horizontal = IsPosHorizontal();
 
-IUnknown_Exec(m_TrayBandSite,
-  IID_IDeskBand,
-  DBID_BANDINFOCHANGED,
-  0,
-  NULL,
-  NULL);
-
 /* We're about to resize/move the start button, the rebar control and
the tray notification control */
 dwp = BeginDeferWindowPos(3);