ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2017
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
14 participants
251 discussions
Start a n
N
ew thread
[pschweitzer] 74027: [DISK] Fix size checking for IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, and only copy what's possible to fit in the buffer. Also, make the code a bit more readable. CORE-12858
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Thu Mar 2 20:03:55 2017 New Revision: 74027 URL:
http://svn.reactos.org/svn/reactos?rev=74027&view=rev
Log: [DISK] Fix size checking for IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, and only copy what's possible to fit in the buffer. Also, make the code a bit more readable. CORE-12858 Modified: trunk/reactos/drivers/storage/class/disk/disk.c Modified: trunk/reactos/drivers/storage/class/disk/disk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/disk…
============================================================================== --- trunk/reactos/drivers/storage/class/disk/disk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/disk/disk.c [iso-8859-1] Thu Mar 2 20:03:55 2017 @@ -2054,16 +2054,27 @@ PDISK_DATA physicalDiskData; BOOLEAN removable = FALSE; BOOLEAN listInitialized = FALSE; - - if ((irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY && - irpStack->Parameters.DeviceIoControl.OutputBufferLength < - sizeof(DISK_GEOMETRY)) || - (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY_EX && - irpStack->Parameters.DeviceIoControl.OutputBufferLength < - sizeof(DISK_GEOMETRY_EX))) { - - status = STATUS_BUFFER_TOO_SMALL; - break; + ULONG copyLength; + + if (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY) { + if (irpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(DISK_GEOMETRY)) { + status = STATUS_BUFFER_TOO_SMALL; + break; + } + + copyLength = sizeof(DISK_GEOMETRY); + } else { + ASSERT(irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY_EX); + if (irpStack->Parameters.DeviceIoControl.OutputBufferLength < FIELD_OFFSET(DISK_GEOMETRY_EX, Data)) { + status = STATUS_BUFFER_TOO_SMALL; + break; + } + + if (irpStack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(DISK_GEOMETRY_EX)) { + copyLength = sizeof(DISK_GEOMETRY_EX); + } else { + copyLength = FIELD_OFFSET(DISK_GEOMETRY_EX, Data); + } } status = STATUS_SUCCESS; @@ -2121,15 +2132,10 @@ RtlMoveMemory(Irp->AssociatedIrp.SystemBuffer, deviceExtension->DiskGeometry, - (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY) ? - sizeof(DISK_GEOMETRY) : - sizeof(DISK_GEOMETRY_EX)); + copyLength); status = STATUS_SUCCESS; - Irp->IoStatus.Information = - (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY) ? - sizeof(DISK_GEOMETRY) : - sizeof(DISK_GEOMETRY_EX); + Irp->IoStatus.Information = copyLength; } break;
7 years, 9 months
1
0
0
0
[pschweitzer] 74026: [DISK] Fix return code when buffer is too small, as exposed in r74025. CORE-12858
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Thu Mar 2 19:39:07 2017 New Revision: 74026 URL:
http://svn.reactos.org/svn/reactos?rev=74026&view=rev
Log: [DISK] Fix return code when buffer is too small, as exposed in r74025. CORE-12858 Modified: trunk/reactos/drivers/storage/class/disk/disk.c Modified: trunk/reactos/drivers/storage/class/disk/disk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/disk…
============================================================================== --- trunk/reactos/drivers/storage/class/disk/disk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/disk/disk.c [iso-8859-1] Thu Mar 2 19:39:07 2017 @@ -2062,7 +2062,7 @@ irpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(DISK_GEOMETRY_EX))) { - status = STATUS_INFO_LENGTH_MISMATCH; + status = STATUS_BUFFER_TOO_SMALL; break; }
7 years, 9 months
1
0
0
0
[pschweitzer] 74025: [KERNEL32_APITEST] Add tests for DeviceIoControl. These are mainly used to test our storage stack CORE-12858
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Thu Mar 2 19:33:25 2017 New Revision: 74025 URL:
http://svn.reactos.org/svn/reactos?rev=74025&view=rev
Log: [KERNEL32_APITEST] Add tests for DeviceIoControl. These are mainly used to test our storage stack CORE-12858 Added: trunk/rostests/apitests/kernel32/DeviceIoControl.c (with props) Modified: trunk/rostests/apitests/kernel32/CMakeLists.txt trunk/rostests/apitests/kernel32/testlist.c Modified: trunk/rostests/apitests/kernel32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/CMakeLi…
============================================================================== --- trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] Thu Mar 2 19:33:25 2017 @@ -3,6 +3,7 @@ list(APPEND SOURCE DefaultActCtx.c + DeviceIoControl.c dosdev.c FindActCtxSectionStringW.c FindFiles.c Added: trunk/rostests/apitests/kernel32/DeviceIoControl.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/DeviceI…
============================================================================== --- trunk/rostests/apitests/kernel32/DeviceIoControl.c (added) +++ trunk/rostests/apitests/kernel32/DeviceIoControl.c [iso-8859-1] Thu Mar 2 19:33:25 2017 @@ -0,0 +1,68 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for DeviceIoControl + * PROGRAMMER: Pierre Schweitzer <pierre(a)reactos.org> + */ + +#include <apitest.h> +#include <strsafe.h> +#include <winioctl.h> + +START_TEST(DeviceIoControl) +{ + UINT Ret; + WCHAR Letter; + HANDLE Device; + DISK_GEOMETRY DG; + DWORD Size, Error; + WCHAR Path[MAX_PATH]; + DISK_GEOMETRY_EX DGE; + + Path[0] = 'C'; + Path[1] = ':'; + Path[2] = '\\'; + Ret = GetSystemDirectoryW(Path, MAX_PATH); + ok(Ret > 0, "GetSystemDirectory failed\n"); + + Letter = Path[0]; + ok(Path[1] == ':', "Not a drive letter: %c\n", Path[1]); + ok(Path[2] == '\\', "Not a drive letter: %c\n", Path[2]); + + Ret = StringCchPrintfW(Path, MAX_PATH, L"%\\\\?\\c:", Letter); + ok(Ret == S_OK, "StringCchPrintfW failed: %d\n", Ret); + + Device = CreateFileW(Path, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ok(Device != INVALID_HANDLE_VALUE, "CreateFileW for %S failed: %ld\n", Path, GetLastError()); + + Size = 0; + Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &DG, sizeof(DG) - 1, &Size, NULL); + ok(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); + + Size = 0; + Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &DG, sizeof(DG), &Size, NULL); + ok(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError()); + ok(Size == sizeof(DG), "Invalid output size: %ld\n", Size); + + Size = 0; + Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &DGE, FIELD_OFFSET(DISK_GEOMETRY_EX, Data) - 1, &Size, NULL); + ok(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); + + Size = 0; + Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &DGE, FIELD_OFFSET(DISK_GEOMETRY_EX, Data), &Size, NULL); + ok(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError()); + ok(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, &DGE, sizeof(DGE), &Size, NULL); + ok(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError()); + ok(Size == sizeof(DGE), "Invalid output size: %ld\n", Size); + + CloseHandle(Device); +} Propchange: trunk/rostests/apitests/kernel32/DeviceIoControl.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/kernel32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/testlis…
============================================================================== --- trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] Thu Mar 2 19:33:25 2017 @@ -4,6 +4,7 @@ #include <apitest.h> extern void func_DefaultActCtx(void); +extern void func_DeviceIoControl(void); extern void func_dosdev(void); extern void func_FindActCtxSectionStringW(void); extern void func_FindFiles(void); @@ -27,6 +28,7 @@ const struct test winetest_testlist[] = { { "DefaultActCtx", func_DefaultActCtx }, + { "DeviceIoControl", func_DeviceIoControl }, { "dosdev", func_dosdev }, { "FindActCtxSectionStringW", func_FindActCtxSectionStringW }, { "FindFiles", func_FindFiles },
7 years, 9 months
1
0
0
0
[tfaber] 74024: [NTOS:PNP] - Move generation of the device instance path into its own function
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Mar 2 13:42:04 2017 New Revision: 74024 URL:
http://svn.reactos.org/svn/reactos?rev=74024&view=rev
Log: [NTOS:PNP] - Move generation of the device instance path into its own function Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Thu Mar 2 13:42:04 2017 @@ -1847,6 +1847,128 @@ return Status; } +NTSTATUS +IopCreateDeviceInstancePath( + _In_ PDEVICE_NODE DeviceNode, + _Out_ PUNICODE_STRING InstancePathU) +{ + IO_STATUS_BLOCK IoStatusBlock; + PWSTR InformationString; + WCHAR InstancePath[MAX_PATH]; + IO_STACK_LOCATION Stack; + NTSTATUS Status; + UNICODE_STRING ParentIdPrefix = { 0, 0, NULL }; + DEVICE_CAPABILITIES DeviceCapabilities; + + DPRINT("Sending IRP_MN_QUERY_ID.BusQueryDeviceID to device stack\n"); + + Stack.Parameters.QueryId.IdType = BusQueryDeviceID; + Status = IopInitiatePnpIrp(DeviceNode->PhysicalDeviceObject, + &IoStatusBlock, + IRP_MN_QUERY_ID, + &Stack); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IopInitiatePnpIrp() failed (Status %x)\n", Status); + return Status; + } + + /* Copy the device id string */ + InformationString = (PWSTR)IoStatusBlock.Information; + wcscpy(InstancePath, InformationString); + + /* + * FIXME: Check for valid characters, if there is invalid characters + * then bugcheck. + */ + + ExFreePoolWithTag(InformationString, 0); + + DPRINT("Sending IRP_MN_QUERY_CAPABILITIES to device stack (after enumeration)\n"); + + Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IopInitiatePnpIrp() failed (Status 0x%08lx)\n", Status); + return Status; + } + + /* This bit is only check after enumeration */ + if (DeviceCapabilities.HardwareDisabled) + { + /* FIXME: Cleanup device */ + DeviceNode->Flags |= DNF_DISABLED; + return STATUS_PLUGPLAY_NO_DEVICE; + } + else + { + DeviceNode->Flags &= ~DNF_DISABLED; + } + + if (!DeviceCapabilities.UniqueID) + { + /* Device has not a unique ID. We need to prepend parent bus unique identifier */ + DPRINT("Instance ID is not unique\n"); + Status = IopGetParentIdPrefix(DeviceNode, &ParentIdPrefix); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IopGetParentIdPrefix() failed (Status 0x%08lx)\n", Status); + return Status; + } + } + + DPRINT("Sending IRP_MN_QUERY_ID.BusQueryInstanceID to device stack\n"); + + Stack.Parameters.QueryId.IdType = BusQueryInstanceID; + Status = IopInitiatePnpIrp(DeviceNode->PhysicalDeviceObject, + &IoStatusBlock, + IRP_MN_QUERY_ID, + &Stack); + if (NT_SUCCESS(Status)) + { + InformationString = (PWSTR)IoStatusBlock.Information; + + /* Append the instance id string */ + wcscat(InstancePath, L"\\"); + if (ParentIdPrefix.Length > 0) + { + /* Add information from parent bus device to InstancePath */ + wcscat(InstancePath, ParentIdPrefix.Buffer); + if (InformationString && *InformationString) + { + wcscat(InstancePath, L"&"); + } + } + if (InformationString) + { + wcscat(InstancePath, InformationString); + } + + /* + * FIXME: Check for valid characters, if there is invalid characters + * then bugcheck + */ + + if (InformationString) + { + ExFreePoolWithTag(InformationString, 0); + } + } + else + { + DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status); + } + RtlFreeUnicodeString(&ParentIdPrefix); + + if (!RtlCreateUnicodeString(InstancePathU, InstancePath)) + { + DPRINT1("RtlCreateUnicodeString failed\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + + return STATUS_SUCCESS; +} + /* * IopActionInterrogateDeviceStack @@ -1871,16 +1993,13 @@ IO_STATUS_BLOCK IoStatusBlock; PWSTR InformationString; PDEVICE_NODE ParentDeviceNode; - WCHAR InstancePath[MAX_PATH]; IO_STACK_LOCATION Stack; NTSTATUS Status; ULONG RequiredLength; LCID LocaleId; HANDLE InstanceKey = NULL; UNICODE_STRING ValueName; - UNICODE_STRING ParentIdPrefix = { 0, 0, NULL }; UNICODE_STRING InstancePathU; - DEVICE_CAPABILITIES DeviceCapabilities; PDEVICE_OBJECT OldDeviceObject; DPRINT("IopActionInterrogateDeviceStack(%p, %p)\n", DeviceNode, Context); @@ -1928,116 +2047,16 @@ * return STATUS_SUCCESS. */ - DPRINT("Sending IRP_MN_QUERY_ID.BusQueryDeviceID to device stack\n"); - - Stack.Parameters.QueryId.IdType = BusQueryDeviceID; - Status = IopInitiatePnpIrp(DeviceNode->PhysicalDeviceObject, - &IoStatusBlock, - IRP_MN_QUERY_ID, - &Stack); + Status = IopCreateDeviceInstancePath(DeviceNode, &InstancePathU); if (!NT_SUCCESS(Status)) { - DPRINT1("IopInitiatePnpIrp() failed (Status %x)\n", Status); + if (Status != STATUS_PLUGPLAY_NO_DEVICE) + { + DPRINT1("IopCreateDeviceInstancePath() failed with status 0x%lx\n", Status); + } /* We have to return success otherwise we abort the traverse operation */ return STATUS_SUCCESS; - } - - /* Copy the device id string */ - InformationString = (PWSTR)IoStatusBlock.Information; - wcscpy(InstancePath, InformationString); - - /* - * FIXME: Check for valid characters, if there is invalid characters - * then bugcheck. - */ - - ExFreePoolWithTag(InformationString, 0); - - DPRINT("Sending IRP_MN_QUERY_CAPABILITIES to device stack (after enumeration)\n"); - - Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities); - if (!NT_SUCCESS(Status)) - { - DPRINT1("IopInitiatePnpIrp() failed (Status 0x%08lx)\n", Status); - - /* We have to return success otherwise we abort the traverse operation */ - return STATUS_SUCCESS; - } - - /* This bit is only check after enumeration */ - if (DeviceCapabilities.HardwareDisabled) - { - /* FIXME: Cleanup device */ - DeviceNode->Flags |= DNF_DISABLED; - return STATUS_SUCCESS; - } - else - { - DeviceNode->Flags &= ~DNF_DISABLED; - } - - if (!DeviceCapabilities.UniqueID) - { - /* Device has not a unique ID. We need to prepend parent bus unique identifier */ - DPRINT("Instance ID is not unique\n"); - Status = IopGetParentIdPrefix(DeviceNode, &ParentIdPrefix); - if (!NT_SUCCESS(Status)) - { - DPRINT1("IopGetParentIdPrefix() failed (Status 0x%08lx)\n", Status); - - /* We have to return success otherwise we abort the traverse operation */ - return STATUS_SUCCESS; - } - } - - DPRINT("Sending IRP_MN_QUERY_ID.BusQueryInstanceID to device stack\n"); - - Stack.Parameters.QueryId.IdType = BusQueryInstanceID; - Status = IopInitiatePnpIrp(DeviceNode->PhysicalDeviceObject, - &IoStatusBlock, - IRP_MN_QUERY_ID, - &Stack); - if (NT_SUCCESS(Status)) - { - InformationString = (PWSTR)IoStatusBlock.Information; - - /* Append the instance id string */ - wcscat(InstancePath, L"\\"); - if (ParentIdPrefix.Length > 0) - { - /* Add information from parent bus device to InstancePath */ - wcscat(InstancePath, ParentIdPrefix.Buffer); - if (InformationString && *InformationString) - { - wcscat(InstancePath, L"&"); - } - } - if (InformationString) - { - wcscat(InstancePath, InformationString); - } - - /* - * FIXME: Check for valid characters, if there is invalid characters - * then bugcheck - */ - - if (InformationString) - { - ExFreePoolWithTag(InformationString, 0); - } - } - else - { - DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status); - } - RtlFreeUnicodeString(&ParentIdPrefix); - - if (!RtlCreateUnicodeString(&InstancePathU, InstancePath)) - { - DPRINT("No resources\n"); - /* FIXME: Cleanup and disable device */ } /* Verify that this is not a duplicate */
7 years, 9 months
1
0
0
0
[tfaber] 74023: [NTOS:PNP] - Avoid memory leaks in IopActionInterrogateDeviceStack. Noticed by Vadim Galyant. CORE-12732
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Mar 2 09:39:40 2017 New Revision: 74023 URL:
http://svn.reactos.org/svn/reactos?rev=74023&view=rev
Log: [NTOS:PNP] - Avoid memory leaks in IopActionInterrogateDeviceStack. Noticed by Vadim Galyant. CORE-12732 Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Thu Mar 2 09:39:40 2017 @@ -1869,6 +1869,7 @@ PVOID Context) { IO_STATUS_BLOCK IoStatusBlock; + PWSTR InformationString; PDEVICE_NODE ParentDeviceNode; WCHAR InstancePath[MAX_PATH]; IO_STACK_LOCATION Stack; @@ -1934,23 +1935,24 @@ &IoStatusBlock, IRP_MN_QUERY_ID, &Stack); - if (NT_SUCCESS(Status)) - { - /* Copy the device id string */ - wcscpy(InstancePath, (PWSTR)IoStatusBlock.Information); - - /* - * FIXME: Check for valid characters, if there is invalid characters - * then bugcheck. - */ - } - else + if (!NT_SUCCESS(Status)) { DPRINT1("IopInitiatePnpIrp() failed (Status %x)\n", Status); /* We have to return success otherwise we abort the traverse operation */ return STATUS_SUCCESS; } + + /* Copy the device id string */ + InformationString = (PWSTR)IoStatusBlock.Information; + wcscpy(InstancePath, InformationString); + + /* + * FIXME: Check for valid characters, if there is invalid characters + * then bugcheck. + */ + + ExFreePoolWithTag(InformationString, 0); DPRINT("Sending IRP_MN_QUERY_CAPABILITIES to device stack (after enumeration)\n"); @@ -1998,26 +2000,33 @@ &Stack); if (NT_SUCCESS(Status)) { + InformationString = (PWSTR)IoStatusBlock.Information; + /* Append the instance id string */ wcscat(InstancePath, L"\\"); if (ParentIdPrefix.Length > 0) { /* Add information from parent bus device to InstancePath */ wcscat(InstancePath, ParentIdPrefix.Buffer); - if (IoStatusBlock.Information && *(PWSTR)IoStatusBlock.Information) + if (InformationString && *InformationString) { wcscat(InstancePath, L"&"); } } - if (IoStatusBlock.Information) + if (InformationString) { - wcscat(InstancePath, (PWSTR)IoStatusBlock.Information); + wcscat(InstancePath, InformationString); } /* * FIXME: Check for valid characters, if there is invalid characters * then bugcheck */ + + if (InformationString) + { + ExFreePoolWithTag(InformationString, 0); + } } else { @@ -2076,13 +2085,14 @@ &IoStatusBlock, IRP_MN_QUERY_DEVICE_TEXT, &Stack); + InformationString = NT_SUCCESS(Status) ? (PWSTR)IoStatusBlock.Information + : NULL; /* This key is mandatory, so even if the Irp fails, we still write it */ RtlInitUnicodeString(&ValueName, L"DeviceDesc"); if (ZwQueryValueKey(InstanceKey, &ValueName, KeyValueBasicInformation, NULL, 0, &RequiredLength) == STATUS_OBJECT_NAME_NOT_FOUND) { - if (NT_SUCCESS(Status) && - IoStatusBlock.Information && - (*(PWSTR)IoStatusBlock.Information != 0)) + if (InformationString && + *InformationString != UNICODE_NULL) { /* This key is overriden when a driver is installed. Don't write the * new description if another one already exists */ @@ -2090,8 +2100,8 @@ &ValueName, 0, REG_SZ, - (PVOID)IoStatusBlock.Information, - ((ULONG)wcslen((PWSTR)IoStatusBlock.Information) + 1) * sizeof(WCHAR)); + InformationString, + ((ULONG)wcslen(InformationString) + 1) * sizeof(WCHAR)); } else { @@ -2112,6 +2122,11 @@ } } + if (InformationString) + { + ExFreePoolWithTag(InformationString, 0); + } + DPRINT("Sending IRP_MN_QUERY_DEVICE_TEXT.DeviceTextLocation to device stack\n"); Stack.Parameters.QueryDeviceText.DeviceTextType = DeviceTextLocationInformation; @@ -2122,18 +2137,21 @@ &Stack); if (NT_SUCCESS(Status) && IoStatusBlock.Information) { - DPRINT("LocationInformation: %S\n", (PWSTR)IoStatusBlock.Information); + InformationString = (PWSTR)IoStatusBlock.Information; + DPRINT("LocationInformation: %S\n", InformationString); RtlInitUnicodeString(&ValueName, L"LocationInformation"); Status = ZwSetValueKey(InstanceKey, &ValueName, 0, REG_SZ, - (PVOID)IoStatusBlock.Information, - ((ULONG)wcslen((PWSTR)IoStatusBlock.Information) + 1) * sizeof(WCHAR)); + InformationString, + ((ULONG)wcslen(InformationString) + 1) * sizeof(WCHAR)); if (!NT_SUCCESS(Status)) { DPRINT1("ZwSetValueKey() failed (Status %lx)\n", Status); } + + ExFreePoolWithTag(InformationString, 0); } else { @@ -2153,7 +2171,7 @@ DeviceNode->ChildBusNumber = BusInformation->BusNumber; DeviceNode->ChildInterfaceType = BusInformation->LegacyBusType; DeviceNode->ChildBusTypeIndex = IopGetBusTypeGuidIndex(&BusInformation->BusTypeGuid); - ExFreePool(BusInformation); + ExFreePoolWithTag(BusInformation, 0); } else {
7 years, 9 months
1
0
0
0
[gadamopoulos] 74022: [UXTHEME] -Fix parsing negative integers. Improves the situation of the start button with Lautus.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Thu Mar 2 08:24:20 2017 New Revision: 74022 URL:
http://svn.reactos.org/svn/reactos?rev=74022&view=rev
Log: [UXTHEME] -Fix parsing negative integers. Improves the situation of the start button with Lautus. Modified: trunk/reactos/dll/win32/uxtheme/msstyles.c Modified: trunk/reactos/dll/win32/uxtheme/msstyles.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/msstyles…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/msstyles.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/msstyles.c [iso-8859-1] Thu Mar 2 08:24:20 2017 @@ -942,7 +942,7 @@ int total = 0; BOOL gotNeg = FALSE; - while(cur < lpStringEnd && (*cur < '0' || *cur > '9' || *cur == '-')) cur++; + while(cur < lpStringEnd && ((*cur < '0' || *cur > '9') && *cur != '-')) cur++; if(cur >= lpStringEnd) { return FALSE; }
7 years, 9 months
1
0
0
0
[ekohl] 74021: [UMPNPMGR] Fix a property id for a call to NtPlugPlayControl().
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Mar 1 21:52:20 2017 New Revision: 74021 URL:
http://svn.reactos.org/svn/reactos?rev=74021&view=rev
Log: [UMPNPMGR] Fix a property id for a call to NtPlugPlayControl(). Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] Wed Mar 1 21:52:20 2017 @@ -946,7 +946,7 @@ #endif case CM_DRP_REMOVAL_POLICY: - PlugPlayData.Property = 0x12; // DevicePropertyRemovalPolicy + PlugPlayData.Property = 0x13; // DevicePropertyRemovalPolicy break; #if 0
7 years, 9 months
1
0
0
0
[ekohl] 74020: [SCHEDSVC] Set service status to SERVICE_STOP_PENDING before setting it to SERVICE_STOPPED.
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Mar 1 21:48:15 2017 New Revision: 74020 URL:
http://svn.reactos.org/svn/reactos?rev=74020&view=rev
Log: [SCHEDSVC] Set service status to SERVICE_STOP_PENDING before setting it to SERVICE_STOPPED. Modified: trunk/reactos/base/services/schedsvc/schedsvc.c Modified: trunk/reactos/base/services/schedsvc/schedsvc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/schedsvc/sch…
============================================================================== --- trunk/reactos/base/services/schedsvc/schedsvc.c [iso-8859-1] (original) +++ trunk/reactos/base/services/schedsvc/schedsvc.c [iso-8859-1] Wed Mar 1 21:48:15 2017 @@ -73,6 +73,7 @@ { case SERVICE_CONTROL_STOP: TRACE(" SERVICE_CONTROL_STOP received\n"); + UpdateServiceStatus(SERVICE_STOP_PENDING); /* Stop listening to incoming RPC messages */ RpcMgmtStopServerListening(NULL); UpdateServiceStatus(SERVICE_STOPPED); @@ -96,6 +97,7 @@ case SERVICE_CONTROL_SHUTDOWN: TRACE(" SERVICE_CONTROL_SHUTDOWN received\n"); + UpdateServiceStatus(SERVICE_STOP_PENDING); UpdateServiceStatus(SERVICE_STOPPED); return ERROR_SUCCESS;
7 years, 9 months
1
0
0
0
[ekohl] 74019: [USETUP] Fix unbootable system after recreating the boot partition Patch by Wim Hueskens. CORE-11232 #resolve #comment Thanks a lot!
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Mar 1 20:46:24 2017 New Revision: 74019 URL:
http://svn.reactos.org/svn/reactos?rev=74019&view=rev
Log: [USETUP] Fix unbootable system after recreating the boot partition Patch by Wim Hueskens. CORE-11232 #resolve #comment Thanks a lot! Modified: trunk/reactos/base/setup/usetup/partlist.c Modified: trunk/reactos/base/setup/usetup/partlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist…
============================================================================== --- trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] Wed Mar 1 20:46:24 2017 @@ -3045,6 +3045,13 @@ return; } + /* Clear the system disk and partition pointers if the system partition will be deleted */ + if (List->SystemPartition == List->CurrentPartition) + { + List->SystemDisk = NULL; + List->SystemPartition = NULL; + } + DiskEntry = List->CurrentDisk; PartEntry = List->CurrentPartition;
7 years, 9 months
1
0
0
0
[hbelusca] 74018: [USER32]: Now for the real fix: Initialize lpLibFileName and pCtx in User32CreateWindowEx prior to calling ClassNameToVersion. This avoid passing invalid parameters to VersionRegi...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Wed Mar 1 19:36:51 2017 New Revision: 74018 URL:
http://svn.reactos.org/svn/reactos?rev=74018&view=rev
Log: [USER32]: Now for the real fix: Initialize lpLibFileName and pCtx in User32CreateWindowEx prior to calling ClassNameToVersion. This avoid passing invalid parameters to VersionRegisterClass (and subsequent functions) afterwards. Fix suggested by Mark Jansen, thanks! CORE-12855 Modified: trunk/reactos/win32ss/user/user32/windows/window.c Modified: trunk/reactos/win32ss/user/user32/windows/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
============================================================================== --- trunk/reactos/win32ss/user/user32/windows/window.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/window.c [iso-8859-1] Wed Mar 1 19:36:51 2017 @@ -176,8 +176,8 @@ BOOL Unicode, ClassFound = FALSE; HWND Handle = NULL; LPCWSTR lpszClsVersion; - HANDLE pCtx; - LPCWSTR lpLibFileName; + LPCWSTR lpLibFileName = NULL; + HANDLE pCtx = NULL; #if 0 DbgPrint("[window] User32CreateWindowEx style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent);
7 years, 9 months
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Results per page:
10
25
50
100
200