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
February 2012
----- 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
22 participants
577 discussions
Start a n
N
ew thread
[janderwald] 55818: [USBCCGP] - Fix retrieving string descriptors
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 22 21:26:36 2012 New Revision: 55818 URL:
http://svn.reactos.org/svn/reactos?rev=55818&view=rev
Log: [USBCCGP] - Fix retrieving string descriptors Modified: trunk/reactos/drivers/usb/usbccgp/descriptor.c trunk/reactos/drivers/usb/usbccgp/function.c trunk/reactos/drivers/usb/usbccgp/usbccgp.h Modified: trunk/reactos/drivers/usb/usbccgp/descriptor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/descri…
============================================================================== --- trunk/reactos/drivers/usb/usbccgp/descriptor.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbccgp/descriptor.c [iso-8859-1] Wed Feb 22 21:26:36 2012 @@ -92,6 +92,64 @@ // done // return Status; +} + +NTSTATUS +NTAPI +USBCCGP_GetStringDescriptor( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG DescriptorLength, + IN UCHAR DescriptorIndex, + IN LANGID LanguageId, + OUT PVOID *OutDescriptor) +{ + NTSTATUS Status; + PUSB_STRING_DESCRIPTOR StringDescriptor; + ULONG Size; + PVOID Buffer; + + // retrieve descriptor + Status = USBCCGP_GetDescriptor(DeviceObject, USB_STRING_DESCRIPTOR_TYPE, DescriptorLength, DescriptorIndex, LanguageId, OutDescriptor); + if (!NT_SUCCESS(Status)) + { + // failed + return Status; + } + + // get descriptor structure + StringDescriptor = (PUSB_STRING_DESCRIPTOR)*OutDescriptor; + + // sanity check + ASSERT(StringDescriptor->bLength < DescriptorLength - 2); + + if (StringDescriptor->bLength == 2) + { + // invalid descriptor + FreeItem(StringDescriptor); + return STATUS_DEVICE_DATA_ERROR; + } + + // calculate size + Size = StringDescriptor->bLength + sizeof(WCHAR); + + // allocate buffer + Buffer = AllocateItem(NonPagedPool, Size); + if (!Buffer) + { + // no memory + FreeItem(StringDescriptor); + return STATUS_INSUFFICIENT_RESOURCES; + } + + // copy result + RtlCopyMemory(Buffer, StringDescriptor->bString, Size - FIELD_OFFSET(USB_STRING_DESCRIPTOR, bString)); + + // free buffer + FreeItem(StringDescriptor); + + // store result + *OutDescriptor = (PVOID)Buffer; + return STATUS_SUCCESS; } Modified: trunk/reactos/drivers/usb/usbccgp/function.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/functi…
============================================================================== --- trunk/reactos/drivers/usb/usbccgp/function.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbccgp/function.c [iso-8859-1] Wed Feb 22 21:26:36 2012 @@ -365,8 +365,7 @@ // // get interface description // - Status = USBCCGP_GetDescriptor(FDODeviceExtension->NextDeviceObject, - USB_STRING_DESCRIPTOR_TYPE, + Status = USBCCGP_GetStringDescriptor(FDODeviceExtension->NextDeviceObject, 100 * sizeof(WCHAR), Descriptor->iFunction, 0x0409, //FIXME @@ -530,10 +529,9 @@ // // get interface description // - Status = USBCCGP_GetDescriptor(FDODeviceExtension->NextDeviceObject, - USB_STRING_DESCRIPTOR_TYPE, - 100 * sizeof(WCHAR), - Descriptor->iInterface, + Status = USBCCGP_GetStringDescriptor(FDODeviceExtension->NextDeviceObject, + 100 * sizeof(WCHAR), + Descriptor->iInterface, 0x0409, //FIXME (PVOID*)&DescriptionBuffer); if (!NT_SUCCESS(Status)) Modified: trunk/reactos/drivers/usb/usbccgp/usbccgp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/usbccg…
============================================================================== --- trunk/reactos/drivers/usb/usbccgp/usbccgp.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbccgp/usbccgp.h [iso-8859-1] Wed Feb 22 21:26:36 2012 @@ -84,6 +84,15 @@ IN LANGID LanguageId, OUT PVOID *OutDescriptor); +NTSTATUS +NTAPI +USBCCGP_GetStringDescriptor( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG DescriptorLength, + IN UCHAR DescriptorIndex, + IN LANGID LanguageId, + OUT PVOID *OutDescriptor); + ULONG CountInterfaceDescriptors( IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor);
12 years, 10 months
1
0
0
0
[spetreolle] 55817: [MEDIA/INF] Fix line endings.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Wed Feb 22 21:25:47 2012 New Revision: 55817 URL:
http://svn.reactos.org/svn/reactos?rev=55817&view=rev
Log: [MEDIA/INF] Fix line endings. Modified: trunk/reactos/media/inf/cdrom.inf trunk/reactos/media/inf/msmouse.inf trunk/reactos/media/inf/usb.inf trunk/reactos/media/inf/usbport.inf Modified: trunk/reactos/media/inf/cdrom.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/cdrom.inf?rev=55…
============================================================================== Binary files - no diff available. Modified: trunk/reactos/media/inf/msmouse.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/msmouse.inf?rev=…
============================================================================== Binary files - no diff available. Modified: trunk/reactos/media/inf/usb.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/usb.inf?rev=5581…
============================================================================== Binary files - no diff available. Modified: trunk/reactos/media/inf/usbport.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/usbport.inf?rev=…
============================================================================== Binary files - no diff available.
12 years, 10 months
1
0
0
0
[sginsberg] 55816: Missed this one...
by sginsberg@svn.reactos.org
Author: sginsberg Date: Wed Feb 22 21:22:13 2012 New Revision: 55816 URL:
http://svn.reactos.org/svn/reactos?rev=55816&view=rev
Log: Missed this one... Modified: trunk/reactos/ntoskrnl/mm/i386/page.c Modified: trunk/reactos/ntoskrnl/mm/i386/page.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Wed Feb 22 21:22:13 2012 @@ -549,7 +549,7 @@ { if(!MiSynchronizeSystemPde(PointerPde)) return FALSE; - return (BOOLEAN)PointerPte->u.Hard.Valid; + return PointerPte->u.Hard.Valid != 0; } return FALSE; }
12 years, 10 months
1
0
0
0
[sginsberg] 55815: [NTOSKRNL] Some misc fixes to make kernel compile warning-free with /W3. Also fix a bug that completely broke the ProcessWx86Information case for NtQueryInformationProcess by mis...
by sginsberg@svn.reactos.org
Author: sginsberg Date: Wed Feb 22 21:18:56 2012 New Revision: 55815 URL:
http://svn.reactos.org/svn/reactos?rev=55815&view=rev
Log: [NTOSKRNL] Some misc fixes to make kernel compile warning-free with /W3. Also fix a bug that completely broke the ProcessWx86Information case for NtQueryInformationProcess by missing to reference/dereference and acquiring the specified process' EPROCESS. Modified: trunk/reactos/ntoskrnl/io/iomgr/deviface.c trunk/reactos/ntoskrnl/io/iomgr/volume.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c trunk/reactos/ntoskrnl/mm/balance.c trunk/reactos/ntoskrnl/mm/i386/page.c trunk/reactos/ntoskrnl/mm/mminit.c trunk/reactos/ntoskrnl/ps/query.c Modified: trunk/reactos/ntoskrnl/io/iomgr/deviface.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/deviface…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/deviface.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/deviface.c [iso-8859-1] Wed Feb 22 21:18:56 2012 @@ -737,7 +737,9 @@ { PWSTR NewBuffer; ReturnBuffer.MaximumLength = (USHORT)max(ReturnBuffer.MaximumLength * 2, - ReturnBuffer.Length + KeyName.Length + 2 * sizeof(WCHAR)); + (USHORT)(ReturnBuffer.Length + + KeyName.Length + + 2 * sizeof(WCHAR))); NewBuffer = ExAllocatePool(PagedPool, ReturnBuffer.MaximumLength); if (!NewBuffer) { Modified: trunk/reactos/ntoskrnl/io/iomgr/volume.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/volume.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/volume.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/volume.c [iso-8859-1] Wed Feb 22 21:18:56 2012 @@ -1409,8 +1409,8 @@ } /* Set output string */ - DosName->Length = VolumePathPtr->MultiSzLength; - DosName->MaximumLength = VolumePathPtr->MultiSzLength + sizeof(UNICODE_NULL); + DosName->Length = (USHORT)VolumePathPtr->MultiSzLength; + DosName->MaximumLength = (USHORT)VolumePathPtr->MultiSzLength + sizeof(UNICODE_NULL); /* Our MOUNTMGR_VOLUME_PATHS will be used as output buffer */ DosName->Buffer = (PWSTR)VolumePathPtr; /* Move name at the begin, RtlMoveMemory is OK with overlapping */ 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] Wed Feb 22 21:18:56 2012 @@ -199,7 +199,7 @@ while (*IdBuffer) { - ULONG StringLength = (ULONG)wcslen(IdBuffer) + 1, Index; + USHORT StringLength = (USHORT)wcslen(IdBuffer) + 1, Index; IopFixupDeviceId(IdBuffer); @@ -247,7 +247,7 @@ ChildIdNameU.Buffer = IdBuffer; ChildIdNameU.MaximumLength = ChildIdNameU.Length = (StringLength - 1) * sizeof(WCHAR); RegKeyNameU.Buffer = BasicInfo->Name; - RegKeyNameU.MaximumLength = RegKeyNameU.Length = BasicInfo->NameLength; + RegKeyNameU.MaximumLength = RegKeyNameU.Length = (USHORT)BasicInfo->NameLength; if (RtlEqualUnicodeString(&ChildIdNameU, &RegKeyNameU, TRUE)) { Modified: trunk/reactos/ntoskrnl/mm/balance.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/balance.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] Wed Feb 22 21:18:56 2012 @@ -138,7 +138,7 @@ NTAPI MiTrimMemoryConsumer(ULONG Consumer, ULONG InitialTarget) { - LONG Target = InitialTarget; + ULONG Target = InitialTarget; ULONG NrFreedPages = 0; NTSTATUS Status; Modified: trunk/reactos/ntoskrnl/mm/i386/page.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Wed Feb 22 21:18:56 2012 @@ -217,7 +217,7 @@ KeMemoryBarrierWithoutFence(); /* Return, if we had success */ - return (BOOLEAN)SystemPde.u.Hard.Valid; + return SystemPde.u.Hard.Valid != 0; } NTSTATUS @@ -549,7 +549,7 @@ { if(!MiSynchronizeSystemPde(PointerPde)) return FALSE; - return PointerPte->u.Hard.Valid; + return (BOOLEAN)PointerPte->u.Hard.Valid; } return FALSE; } Modified: trunk/reactos/ntoskrnl/mm/mminit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=5…
============================================================================== --- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Wed Feb 22 21:18:56 2012 @@ -262,7 +262,7 @@ DPRINT1(" 0x%p - 0x%p\t%s\n", MmNonPagedPoolStart, (ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes, - "ARM³ Non Paged Pool"); + "ARM3 Non Paged Pool"); DPRINT1(" 0x%p - 0x%p\t%s\n", MiSystemViewStart, (ULONG_PTR)MiSystemViewStart + MmSystemViewSize, @@ -283,7 +283,7 @@ DPRINT1(" 0x%p - 0x%p\t%s\n", MmPagedPoolStart, (ULONG_PTR)MmPagedPoolStart + MmSizeOfPagedPoolInBytes, - "ARM³ Paged Pool"); + "ARM3 Paged Pool"); DPRINT1(" 0x%p - 0x%p\t%s\n", MmNonPagedSystemStart, MmNonPagedPoolExpansionStart, "System PTE Space"); Modified: trunk/reactos/ntoskrnl/ps/query.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=55…
============================================================================== --- trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] Wed Feb 22 21:18:56 2012 @@ -855,7 +855,7 @@ /* Protect write in SEH */ _SEH2_TRY { - /* Return the count of handles */ + /* Return debug port's handle */ *(PHANDLE)ProcessInformation = DebugPort; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -887,7 +887,7 @@ /* Protect write in SEH */ _SEH2_TRY { - /* Return the count of handles */ + /* Return FALSE -- we don't support this */ *(PULONG)ProcessInformation = FALSE; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -908,8 +908,14 @@ break; } - /* Indicate success */ - Status = STATUS_SUCCESS; + /* Reference the process */ + Status = ObReferenceObjectByHandle(ProcessHandle, + PROCESS_QUERY_INFORMATION, + PsProcessType, + PreviousMode, + (PVOID*)&Process, + NULL); + if (!NT_SUCCESS(Status)) break; /* Protect write in SEH */ _SEH2_TRY @@ -923,6 +929,9 @@ Status = _SEH2_GetExceptionCode(); } _SEH2_END; + + /* Dereference the process */ + ObDereferenceObject(Process); break; case ProcessWow64Information: @@ -1067,8 +1076,11 @@ PVOID ExceptionPort; ULONG Break; KAFFINITY ValidAffinity, Affinity = 0; - ULONG DefaultHardErrorMode = 0, BasePriority = 0, MemoryPriority = 0; - ULONG DisableBoost = 0, DebugFlags = 0, EnableFixup = 0, Boost = 0; + KPRIORITY BasePriority = 0; + UCHAR MemoryPriority = 0; + BOOLEAN DisableBoost = 0; + ULONG DefaultHardErrorMode = 0; + ULONG DebugFlags = 0, EnableFixup = 0, Boost = 0; ULONG NoExecute = 0, VdmPower = 0; BOOLEAN HasPrivilege; PLIST_ENTRY Next; @@ -1448,7 +1460,7 @@ /* Enter SEH for direct buffer read */ _SEH2_TRY { - BasePriority = *(PULONG)ProcessInformation; + BasePriority = *(KPRIORITY*)ProcessInformation; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -1674,7 +1686,7 @@ /* Enter SEH for direct buffer read */ _SEH2_TRY { - DisableBoost = *(PULONG)ProcessInformation; + DisableBoost = *(PBOOLEAN)ProcessInformation; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -1814,6 +1826,8 @@ /* Only supported on x86 */ #if defined (_X86_) Ke386SetIOPL(); +#else + Status = STATUS_NOT_IMPLEMENTED; #endif /* Done */ break;
12 years, 10 months
1
0
0
0
[tfaber] 55814: [USER32_WINETEST] - Do not depend on argument evaluation order and thus uninitialized values. Sent and applied upstream. Dedicated to Stefan
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Feb 22 21:12:59 2012 New Revision: 55814 URL:
http://svn.reactos.org/svn/reactos?rev=55814&view=rev
Log: [USER32_WINETEST] - Do not depend on argument evaluation order and thus uninitialized values. Sent and applied upstream. Dedicated to Stefan Modified: trunk/rostests/winetests/user32/msg.c Modified: trunk/rostests/winetests/user32/msg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/msg.c?re…
============================================================================== --- trunk/rostests/winetests/user32/msg.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/msg.c [iso-8859-1] Wed Feb 22 21:12:59 2012 @@ -11497,6 +11497,7 @@ CPINFOEXA cpinfo; UINT i, j, k; struct message wmCharSeq[2]; + BOOL ret; if (!pGetCPInfoExA) { @@ -11557,21 +11558,27 @@ /* posted message */ PostMessageA( hwnd, WM_CHAR, dbch[0], 0 ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); PostMessageA( hwnd, WM_CHAR, dbch[1], 0 ); - ok( PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == wch, "bad wparam %lx/%x\n", msg.wParam, wch ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* posted thread message */ PostThreadMessageA( GetCurrentThreadId(), WM_CHAR, dbch[0], 0 ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); PostMessageA( hwnd, WM_CHAR, dbch[1], 0 ); - ok( PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == wch, "bad wparam %lx/%x\n", msg.wParam, wch ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* sent message */ flush_sequence(); @@ -11579,7 +11586,8 @@ ok_sequence( WmEmptySeq, "no messages", FALSE ); SendMessageA( hwnd, WM_CHAR, dbch[1], 0 ); ok_sequence( wmCharSeq, "Unicode WM_CHAR", FALSE ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* sent message with timeout */ flush_sequence(); @@ -11587,7 +11595,8 @@ ok_sequence( WmEmptySeq, "no messages", FALSE ); SendMessageTimeoutA( hwnd, WM_CHAR, dbch[1], 0, SMTO_NORMAL, 0, &res ); ok_sequence( wmCharSeq, "Unicode WM_CHAR", FALSE ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* sent message with timeout and callback */ flush_sequence(); @@ -11595,7 +11604,8 @@ ok_sequence( WmEmptySeq, "no messages", FALSE ); SendMessageCallbackA( hwnd, WM_CHAR, dbch[1], 0, NULL, 0 ); ok_sequence( wmCharSeq, "Unicode WM_CHAR", FALSE ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* sent message with callback */ flush_sequence(); @@ -11603,7 +11613,8 @@ ok_sequence( WmEmptySeq, "no messages", FALSE ); SendMessageCallbackA( hwnd, WM_CHAR, dbch[1], 0, NULL, 0 ); ok_sequence( wmCharSeq, "Unicode WM_CHAR", FALSE ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* direct window proc call */ flush_sequence(); @@ -11629,23 +11640,28 @@ ok_sequence( WmEmptySeq, "no messages", FALSE ); SendMessageA( hwnd, WM_CHAR, dbch[1], 0 ); ok_sequence( wmCharSeq, "Unicode WM_CHAR", FALSE ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* interleaved post and send */ flush_sequence(); PostMessageA( hwnd2, WM_CHAR, dbch[0], 0 ); SendMessageA( hwnd2, WM_CHAR, dbch[0], 0 ); ok_sequence( WmEmptySeq, "no messages", FALSE ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); PostMessageA( hwnd, WM_CHAR, dbch[1], 0 ); ok_sequence( WmEmptySeq, "no messages", FALSE ); - ok( PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == wch, "bad wparam %lx/%x\n", msg.wParam, wch ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); SendMessageA( hwnd, WM_CHAR, dbch[1], 0 ); ok_sequence( wmCharSeq, "Unicode WM_CHAR", FALSE ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* interleaved sent message and winproc */ flush_sequence(); @@ -11685,46 +11701,58 @@ flush_sequence(); SendMessageA( hwnd2, WM_CHAR, (dbch[1] << 8) | dbch[0], 0 ); ok_sequence( wmCharSeq, "Unicode WM_CHAR", FALSE ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* other char messages are not magic */ PostMessageA( hwnd, WM_SYSCHAR, dbch[0], 0 ); - ok( PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.message == WM_SYSCHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == bad_wch, "bad wparam %lx/%x\n", msg.wParam, bad_wch ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); PostMessageA( hwnd, WM_DEADCHAR, dbch[0], 0 ); - ok( PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.message == WM_DEADCHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == bad_wch, "bad wparam %lx/%x\n", msg.wParam, bad_wch ); - ok( !PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* test retrieving messages */ PostMessageW( hwnd, WM_CHAR, wch, 0 ); - ok( PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == dbch[0], "bad wparam %lx/%x\n", msg.wParam, dbch[0] ); - ok( PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == dbch[1], "bad wparam %lx/%x\n", msg.wParam, dbch[0] ); - ok( !PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* message filters */ PostMessageW( hwnd, WM_CHAR, wch, 0 ); - ok( PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == dbch[0], "bad wparam %lx/%x\n", msg.wParam, dbch[0] ); /* message id is filtered, hwnd is not */ - ok( !PeekMessageA( &msg, hwnd, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE ), "no message\n" ); - ok( PeekMessageA( &msg, hwnd2, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageA( &msg, hwnd, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE ); + ok( !ret, "no message\n" ); + ret = PeekMessageA( &msg, hwnd2, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == dbch[1], "bad wparam %lx/%x\n", msg.wParam, dbch[0] ); - ok( !PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* mixing GetMessage and PostMessage */ PostMessageW( hwnd, WM_CHAR, wch, 0xbeef ); @@ -11736,34 +11764,41 @@ time = msg.time; pt = msg.pt; ok( time - GetTickCount() <= 100, "bad time %x\n", msg.time ); - ok( PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == dbch[1], "bad wparam %lx/%x\n", msg.wParam, dbch[0] ); ok( msg.lParam == 0xbeef, "bad lparam %lx\n", msg.lParam ); ok( msg.time == time, "bad time %x/%x\n", msg.time, time ); ok( msg.pt.x == pt.x && msg.pt.y == pt.y, "bad point %u,%u/%u,%u\n", msg.pt.x, msg.pt.y, pt.x, pt.y ); - ok( !PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); /* without PM_REMOVE */ PostMessageW( hwnd, WM_CHAR, wch, 0 ); - ok( PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ), "no message\n" ); + ret = PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ); + ok( ret, "no message\n" ); ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == dbch[0], "bad wparam %lx/%x\n", msg.wParam, dbch[0] ); - ok( PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == dbch[0], "bad wparam %lx/%x\n", msg.wParam, dbch[0] ); - ok( PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ), "no message\n" ); + ret = PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ); + ok( ret, "no message\n" ); ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == dbch[1], "bad wparam %lx/%x\n", msg.wParam, dbch[0] ); - ok( PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "no message\n" ); + ret = PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ); + ok( ret, "no message\n" ); ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == dbch[1], "bad wparam %lx/%x\n", msg.wParam, dbch[0] ); - ok( !PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ), "got message %x\n", msg.message ); + ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ); + ok( !ret, "got message %x\n", msg.message ); DestroyWindow(hwnd); DestroyWindow(hwnd2);
12 years, 10 months
1
0
0
0
[sginsberg] 55813: Some misc fixes to Prefast. [DDK] - ndis.h Don't use local variables with the same name as function parameters. [PSDK] - access.idl Remove incorrect annotation - usbioctl.h Not r...
by sginsberg@svn.reactos.org
Author: sginsberg Date: Wed Feb 22 20:58:20 2012 New Revision: 55813 URL:
http://svn.reactos.org/svn/reactos?rev=55813&view=rev
Log: Some misc fixes to Prefast. [DDK] - ndis.h Don't use local variables with the same name as function parameters. [PSDK] - access.idl Remove incorrect annotation - usbioctl.h Not really a Prefast issue, but switch to use ANYSIZE_ARRAY like we do everywhere else. - winddi.h EngQueryDeviceAttribute's 6th parameter is IN, not OUT - winefs.h Fix FileEncryptionStatus to use annotations. Its definition in winbase.h already has them and this caused a conflict. [WINE] - debug.h Remove unnecessary check (in ReactOS) that made Prefast sad. - test.h Disable a false-positive C28182. Modified: trunk/reactos/include/ddk/ndis.h trunk/reactos/include/psdk/access.idl trunk/reactos/include/psdk/usbioctl.h trunk/reactos/include/psdk/winddi.h trunk/reactos/include/psdk/winefs.h trunk/reactos/include/reactos/wine/debug.h trunk/reactos/include/reactos/wine/test.h Modified: trunk/reactos/include/ddk/ndis.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ndis.h?rev=558…
============================================================================== --- trunk/reactos/include/ddk/ndis.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/ndis.h [iso-8859-1] Wed Feb 22 20:58:20 2012 @@ -3577,20 +3577,20 @@ UINT Offset; UINT PacketLength; PNDIS_BUFFER NdisBuffer; - UINT PhysicalBufferCount = 0; - UINT TotalPacketLength = 0; + UINT _PhysicalBufferCount = 0; + UINT _TotalPacketLength = 0; UINT Count = 0; for (NdisBuffer = Packet->Private.Head; NdisBuffer != (PNDIS_BUFFER)NULL; NdisBuffer = NdisBuffer->Next) { - PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer); + _PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer); NdisQueryBufferOffset(NdisBuffer, &Offset, &PacketLength); - TotalPacketLength += PacketLength; + _TotalPacketLength += PacketLength; Count++; } - Packet->Private.PhysicalCount = PhysicalBufferCount; - Packet->Private.TotalLength = TotalPacketLength; + Packet->Private.PhysicalCount = _PhysicalBufferCount; + Packet->Private.TotalLength = _TotalPacketLength; Packet->Private.Count = Count; Packet->Private.ValidCounts = TRUE; } Modified: trunk/reactos/include/psdk/access.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/access.idl?re…
============================================================================== --- trunk/reactos/include/psdk/access.idl [iso-8859-1] (original) +++ trunk/reactos/include/psdk/access.idl [iso-8859-1] Wed Feb 22 20:58:20 2012 @@ -34,7 +34,7 @@ [call_as(AddRefAccessor)] HRESULT RemoteAddRefAccessor([in] HACCESSOR hAccessor, - [in, out, unique, annotation("__out_opt")] DBREFCOUNT *pcRefCount, + [in, out, unique] DBREFCOUNT *pcRefCount, [out] IErrorInfo **ppErrorInfoRem); [local] Modified: trunk/reactos/include/psdk/usbioctl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/usbioctl.h?re…
============================================================================== --- trunk/reactos/include/psdk/usbioctl.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/usbioctl.h [iso-8859-1] Wed Feb 22 20:58:20 2012 @@ -295,34 +295,34 @@ USHORT DeviceAddress; ULONG NumberOfOpenPipes; USB_CONNECTION_STATUS ConnectionStatus; - USB_PIPE_INFO PipeList[0]; + USB_PIPE_INFO PipeList[ANYSIZE_ARRAY]; } USB_NODE_CONNECTION_INFORMATION, *PUSB_NODE_CONNECTION_INFORMATION; typedef struct _USB_NODE_CONNECTION_DRIVERKEY_NAME { ULONG ConnectionIndex; ULONG ActualLength; - WCHAR DriverKeyName[1]; + WCHAR DriverKeyName[ANYSIZE_ARRAY]; } USB_NODE_CONNECTION_DRIVERKEY_NAME, *PUSB_NODE_CONNECTION_DRIVERKEY_NAME; typedef struct _USB_NODE_CONNECTION_NAME { ULONG ConnectionIndex; ULONG ActualLength; - WCHAR NodeName[1]; + WCHAR NodeName[ANYSIZE_ARRAY]; } USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME; typedef struct _USB_HUB_NAME { ULONG ActualLength; - WCHAR HubName[1]; + WCHAR HubName[ANYSIZE_ARRAY]; } USB_HUB_NAME, *PUSB_HUB_NAME; typedef struct _USB_ROOT_HUB_NAME { ULONG ActualLength; - WCHAR RootHubName[1]; + WCHAR RootHubName[ANYSIZE_ARRAY]; } USB_ROOT_HUB_NAME, *PUSB_ROOT_HUB_NAME; typedef struct _USB_HCD_DRIVERKEY_NAME { ULONG ActualLength; - WCHAR DriverKeyName[1]; + WCHAR DriverKeyName[ANYSIZE_ARRAY]; } USB_HCD_DRIVERKEY_NAME, *PUSB_HCD_DRIVERKEY_NAME; typedef struct _USB_DESCRIPTOR_REQUEST { @@ -334,7 +334,7 @@ USHORT wIndex; USHORT wLength; } SetupPacket; - UCHAR Data[0]; + UCHAR Data[ANYSIZE_ARRAY]; } USB_DESCRIPTOR_REQUEST, *PUSB_DESCRIPTOR_REQUEST; #if (_WIN32_WINNT >= 0x0501) @@ -358,7 +358,7 @@ USHORT DeviceAddress; ULONG NumberOfOpenPipes; USB_CONNECTION_STATUS ConnectionStatus; - USB_PIPE_INFO PipeList[0]; + USB_PIPE_INFO PipeList[ANYSIZE_ARRAY]; } USB_NODE_CONNECTION_INFORMATION_EX, *PUSB_NODE_CONNECTION_INFORMATION_EX; C_ASSERT(sizeof(USB_NODE_CONNECTION_INFORMATION_EX) == sizeof(USB_NODE_CONNECTION_INFORMATION)); @@ -542,7 +542,7 @@ typedef struct _USB_ACQUIRE_INFO { USB_NOTIFICATION_TYPE NotificationType; ULONG TotalSize; - WCHAR Buffer[1]; + WCHAR Buffer[ANYSIZE_ARRAY]; } USB_ACQUIRE_INFO, *PUSB_ACQUIRE_INFO; #if (_WIN32_WINNT >= 0x0600) @@ -577,7 +577,7 @@ BOOLEAN HubIsRootHub; USB_HUB_CAPABILITIES HubCapabilities; ULONG NumberOfHubPorts; - USB_HUB_PORT_INFORMATION PortInfo[1]; + USB_HUB_PORT_INFORMATION PortInfo[ANYSIZE_ARRAY]; } USB_HUB_DEVICE_INFO, *PUSB_HUB_DEVICE_INFO; typedef struct _USB_COMPOSITE_FUNCTION_INFO { @@ -592,7 +592,7 @@ USB_CONFIGURATION_DESCRIPTOR CurrentConfigDescriptor; UCHAR CurrentConfigurationValue; UCHAR NumberOfFunctions; - USB_COMPOSITE_FUNCTION_INFO FunctionInfo[1]; + USB_COMPOSITE_FUNCTION_INFO FunctionInfo[ANYSIZE_ARRAY]; } USB_COMPOSITE_DEVICE_INFO, *PUSB_COMPOSITE_DEVICE_INFO; typedef struct _USB_CONTROLLER_DEVICE_INFO { @@ -617,7 +617,7 @@ WCHAR SerialNumberId[128]; WCHAR PnpDeviceDescription[128]; ULONG NumberOfOpenPipes; - USB_PIPE_INFO PipeList[1]; + USB_PIPE_INFO PipeList[ANYSIZE_ARRAY]; } USB_DEVICE_INFO, *PUSB_DEVICE_INFO; typedef struct _USB_DEVICE_NODE_INFO { Modified: trunk/reactos/include/psdk/winddi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winddi.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/winddi.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winddi.h [iso-8859-1] Wed Feb 22 20:58:20 2012 @@ -2075,7 +2075,7 @@ _In_reads_bytes_(cjInSize) PVOID pvIn, _In_ ULONG cjInSize, _Out_writes_bytes_(cjOutSize) PVOID pvOut, - _Out_ ULONG cjOutSize); + _In_ ULONG cjOutSize); WIN32KAPI LARGE_INTEGER Modified: trunk/reactos/include/psdk/winefs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winefs.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/winefs.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winefs.h [iso-8859-1] Wed Feb 22 20:58:20 2012 @@ -48,8 +48,8 @@ ); BOOL WINAPI FileEncryptionStatus ( - LPCTSTR, - LPDWORD + _In_ LPCTSTR, + _Out_ LPDWORD ); DWORD WINAPI QueryUsersOnEncryptedFile ( Modified: trunk/reactos/include/reactos/wine/debug.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/debug…
============================================================================== --- trunk/reactos/include/reactos/wine/debug.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/wine/debug.h [iso-8859-1] Wed Feb 22 20:58:20 2012 @@ -217,7 +217,7 @@ static __inline const char *wine_dbgstr_longlong( ULONGLONG ll ) { - if (sizeof(ll) > sizeof(unsigned long) && ll >> 32) + if (/*sizeof(ll) > sizeof(unsigned long) &&*/ ll >> 32) /* ULONGLONG is always > long in ReactOS */ return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll ); else return wine_dbg_sprintf( "%lx", (unsigned long)ll ); } Modified: trunk/reactos/include/reactos/wine/test.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/test.…
============================================================================== --- trunk/reactos/include/reactos/wine/test.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/wine/test.h [iso-8859-1] Wed Feb 22 20:58:20 2012 @@ -539,6 +539,11 @@ for (test = winetest_testlist; test->name; test++) fprintf( stdout, " %s\n", test->name ); } +/* Disable false-positive claiming "test" would be NULL-dereferenced */ +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:28182) +#endif /* Run a named test, and return exit status */ static int run_test( const char *name ) @@ -569,6 +574,9 @@ return status; } +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* Display usage and exit */ static void usage( const char *argv0 )
12 years, 10 months
1
0
0
0
[janderwald] 55812: [USBEHCI] [USBOHCI] [USBUHCI] - Fix retrieving configuration index for real - Thanks to Thomas Faber
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 22 19:25:54 2012 New Revision: 55812 URL:
http://svn.reactos.org/svn/reactos?rev=55812&view=rev
Log: [USBEHCI] [USBOHCI] [USBUHCI] - Fix retrieving configuration index for real - Thanks to Thomas Faber Modified: trunk/reactos/drivers/usb/usbehci/usb_device.cpp trunk/reactos/drivers/usb/usbohci/usb_device.cpp trunk/reactos/drivers/usb/usbuhci/usb_device.cpp Modified: trunk/reactos/drivers/usb/usbehci/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usb_de…
============================================================================== --- trunk/reactos/drivers/usb/usbehci/usb_device.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/usb_device.cpp [iso-8859-1] Wed Feb 22 19:25:54 2012 @@ -1056,7 +1056,7 @@ // for(Index = 0; Index < m_DeviceDescriptor.bNumConfigurations; Index++) { - if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->iConfiguration == ConfigurationDescriptor->iConfiguration) + if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->bConfigurationValue == ConfigurationDescriptor->bConfigurationValue) { // // found configuration index @@ -1068,7 +1068,7 @@ if (!Found) { - DPRINT1("[USBUHCI] invalid configuration index %lu\n", ConfigurationDescriptor->iConfiguration); + DPRINT1("[USBUHCI] invalid configuration value %lu\n", ConfigurationDescriptor->bConfigurationValue); return STATUS_INVALID_PARAMETER; } Modified: trunk/reactos/drivers/usb/usbohci/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbohci/usb_de…
============================================================================== --- trunk/reactos/drivers/usb/usbohci/usb_device.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbohci/usb_device.cpp [iso-8859-1] Wed Feb 22 19:25:54 2012 @@ -1115,7 +1115,7 @@ // for(Index = 0; Index < m_DeviceDescriptor.bNumConfigurations; Index++) { - if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->iConfiguration == ConfigurationDescriptor->iConfiguration) + if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->bConfigurationValue == ConfigurationDescriptor->bConfigurationValue) { // // found configuration index @@ -1127,7 +1127,7 @@ if (!Found) { - DPRINT1("[USBUHCI] invalid configuration index %lu\n", ConfigurationDescriptor->iConfiguration); + DPRINT1("[USBUHCI] invalid configuration index %lu\n", ConfigurationDescriptor->bConfigurationValue); return STATUS_INVALID_PARAMETER; } Modified: trunk/reactos/drivers/usb/usbuhci/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbuhci/usb_de…
============================================================================== --- trunk/reactos/drivers/usb/usbuhci/usb_device.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbuhci/usb_device.cpp [iso-8859-1] Wed Feb 22 19:25:54 2012 @@ -1155,7 +1155,7 @@ // for(Index = 0; Index < m_DeviceDescriptor.bNumConfigurations; Index++) { - if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->iConfiguration == ConfigurationDescriptor->iConfiguration) + if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->bConfigurationValue == ConfigurationDescriptor->bConfigurationValue) { // // found configuration index @@ -1167,7 +1167,7 @@ if (!Found) { - DPRINT1("[USBUHCI] invalid configuration index %lu\n", ConfigurationDescriptor->iConfiguration); + DPRINT1("[USBUHCI] invalid configuration value %lu\n", ConfigurationDescriptor->bConfigurationValue); return STATUS_INVALID_PARAMETER; }
12 years, 10 months
1
0
0
0
[janderwald] 55811: [USBOHCI] [USBEHCI] [USBUHCI] - Don't assume iConfiguration value of configuration descriptor is zero based aligned - Fixes bugcheck in VmWare
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 22 18:57:49 2012 New Revision: 55811 URL:
http://svn.reactos.org/svn/reactos?rev=55811&view=rev
Log: [USBOHCI] [USBEHCI] [USBUHCI] - Don't assume iConfiguration value of configuration descriptor is zero based aligned - Fixes bugcheck in VmWare Modified: trunk/reactos/drivers/usb/CMakeLists.txt trunk/reactos/drivers/usb/usbehci/usb_device.cpp trunk/reactos/drivers/usb/usbohci/usb_device.cpp trunk/reactos/drivers/usb/usbuhci/usb_device.cpp Modified: trunk/reactos/drivers/usb/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/CMakeLists.txt…
============================================================================== --- trunk/reactos/drivers/usb/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/CMakeLists.txt [iso-8859-1] Wed Feb 22 18:57:49 2012 @@ -3,4 +3,5 @@ add_subdirectory(usbehci) add_subdirectory(usbhub) add_subdirectory(usbohci) -add_subdirectory(usbstor) +add_subdirectory(usbstor) +add_subdirectory(usbuhci) Modified: trunk/reactos/drivers/usb/usbehci/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usb_de…
============================================================================== --- trunk/reactos/drivers/usb/usbehci/usb_device.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/usb_device.cpp [iso-8859-1] Wed Feb 22 18:57:49 2012 @@ -1044,29 +1044,66 @@ ULONG InterfaceIndex, PipeIndex; USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup; NTSTATUS Status; - - // - // sanity checks - // - ASSERT(ConfigurationDescriptor->iConfiguration < m_DeviceDescriptor.bNumConfigurations); - ASSERT(ConfigurationDescriptor->iConfiguration == m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].ConfigurationDescriptor->iConfiguration); - - // - // sanity check - // - ASSERT(ConfigurationDescriptor->bNumInterfaces <= m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].ConfigurationDescriptor->bNumInterfaces); + UCHAR bConfigurationValue = 0; + ULONG ConfigurationIndex = 0, Index; + UCHAR Found = FALSE; + + + if (ConfigurationDescriptor) + { + // + // find configuration index + // + for(Index = 0; Index < m_DeviceDescriptor.bNumConfigurations; Index++) + { + if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->iConfiguration == ConfigurationDescriptor->iConfiguration) + { + // + // found configuration index + // + ConfigurationIndex = Index; + Found = TRUE; + } + } + + if (!Found) + { + DPRINT1("[USBUHCI] invalid configuration index %lu\n", ConfigurationDescriptor->iConfiguration); + return STATUS_INVALID_PARAMETER; + } + + // + // sanity check + // + ASSERT(ConfigurationDescriptor->bNumInterfaces <= m_ConfigurationDescriptors[ConfigurationIndex].ConfigurationDescriptor->bNumInterfaces); + + // + // get configuration value + // + bConfigurationValue = ConfigurationDescriptor->bConfigurationValue; + } // // now build setup packet // RtlZeroMemory(&CtrlSetup, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET)); CtrlSetup.bRequest = USB_REQUEST_SET_CONFIGURATION; - CtrlSetup.wValue.W = ConfigurationDescriptor->bConfigurationValue; + CtrlSetup.wValue.W = bConfigurationValue; // // select configuration // Status = CommitSetupPacket(&CtrlSetup, 0, 0, 0); + + if (!ConfigurationDescriptor) + { + // + // unconfigure request + // + DPRINT1("CUsbDevice::SelectConfiguration Unconfigure Request Status %x\n", Status); + m_ConfigurationIndex = 0; + return Status; + } // // informal debug print @@ -1081,14 +1118,14 @@ } // - // store configuration device index - // - m_ConfigurationIndex = ConfigurationDescriptor->iConfiguration; + // store new configuration device index + // + m_ConfigurationIndex = ConfigurationIndex; // // store configuration handle // - *ConfigurationHandle = &m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration]; + *ConfigurationHandle = &m_ConfigurationDescriptors[ConfigurationIndex]; // // copy interface info and pipe info @@ -1098,7 +1135,7 @@ // // sanity check: is the info pre-layed out // - PC_ASSERT(InterfaceInfo->NumberOfPipes == m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bNumEndpoints); + PC_ASSERT(InterfaceInfo->NumberOfPipes == m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bNumEndpoints); PC_ASSERT(InterfaceInfo->Length != 0); #ifdef _MSC_VER PC_ASSERT(InterfaceInfo->Length == FIELD_OFFSET(USBD_INTERFACE_INFORMATION, Pipes[InterfaceInfo->NumberOfPipes])); @@ -1107,10 +1144,10 @@ // // copy interface info // - InterfaceInfo->InterfaceHandle = (USBD_INTERFACE_HANDLE)&m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex]; - InterfaceInfo->Class = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceClass; - InterfaceInfo->SubClass = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceSubClass; - InterfaceInfo->Protocol = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceProtocol; + InterfaceInfo->InterfaceHandle = (USBD_INTERFACE_HANDLE)&m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex]; + InterfaceInfo->Class = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceClass; + InterfaceInfo->SubClass = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceSubClass; + InterfaceInfo->Protocol = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceProtocol; InterfaceInfo->Reserved = 0; // @@ -1121,16 +1158,16 @@ // // copy pipe info // - InterfaceInfo->Pipes[PipeIndex].MaximumPacketSize = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.wMaxPacketSize; - InterfaceInfo->Pipes[PipeIndex].EndpointAddress = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bEndpointAddress; - InterfaceInfo->Pipes[PipeIndex].Interval = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bInterval; - InterfaceInfo->Pipes[PipeIndex].PipeType = (USBD_PIPE_TYPE)m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bmAttributes; - InterfaceInfo->Pipes[PipeIndex].PipeHandle = (PVOID)&m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor; + InterfaceInfo->Pipes[PipeIndex].MaximumPacketSize = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.wMaxPacketSize; + InterfaceInfo->Pipes[PipeIndex].EndpointAddress = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bEndpointAddress; + InterfaceInfo->Pipes[PipeIndex].Interval = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bInterval; + InterfaceInfo->Pipes[PipeIndex].PipeType = (USBD_PIPE_TYPE)m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bmAttributes; + InterfaceInfo->Pipes[PipeIndex].PipeHandle = (PVOID)&m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor; // // data toggle is reset on configuration requests // - m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].DataToggle = FALSE; + m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].DataToggle = FALSE; } // Modified: trunk/reactos/drivers/usb/usbohci/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbohci/usb_de…
============================================================================== --- trunk/reactos/drivers/usb/usbohci/usb_device.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbohci/usb_device.cpp [iso-8859-1] Wed Feb 22 18:57:49 2012 @@ -1104,19 +1104,37 @@ USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup; NTSTATUS Status; UCHAR bConfigurationValue = 0; + ULONG ConfigurationIndex = 0, Index; + UCHAR Found = FALSE; + if (ConfigurationDescriptor) { // - // sanity checks - // - ASSERT(ConfigurationDescriptor->iConfiguration < m_DeviceDescriptor.bNumConfigurations); - ASSERT(ConfigurationDescriptor->iConfiguration == m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].ConfigurationDescriptor->iConfiguration); + // find configuration index + // + for(Index = 0; Index < m_DeviceDescriptor.bNumConfigurations; Index++) + { + if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->iConfiguration == ConfigurationDescriptor->iConfiguration) + { + // + // found configuration index + // + ConfigurationIndex = Index; + Found = TRUE; + } + } + + if (!Found) + { + DPRINT1("[USBUHCI] invalid configuration index %lu\n", ConfigurationDescriptor->iConfiguration); + return STATUS_INVALID_PARAMETER; + } // // sanity check // - ASSERT(ConfigurationDescriptor->bNumInterfaces <= m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].ConfigurationDescriptor->bNumInterfaces); + ASSERT(ConfigurationDescriptor->bNumInterfaces <= m_ConfigurationDescriptors[ConfigurationIndex].ConfigurationDescriptor->bNumInterfaces); // // get configuration value @@ -1159,14 +1177,14 @@ } // - // store configuration device index - // - m_ConfigurationIndex = ConfigurationDescriptor->iConfiguration; + // store new configuration device index + // + m_ConfigurationIndex = ConfigurationIndex; // // store configuration handle // - *ConfigurationHandle = &m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration]; + *ConfigurationHandle = &m_ConfigurationDescriptors[ConfigurationIndex]; // // copy interface info and pipe info @@ -1176,7 +1194,7 @@ // // sanity check: is the info pre-layed out // - PC_ASSERT(InterfaceInfo->NumberOfPipes == m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bNumEndpoints); + PC_ASSERT(InterfaceInfo->NumberOfPipes == m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bNumEndpoints); PC_ASSERT(InterfaceInfo->Length != 0); #ifdef _MSC_VER PC_ASSERT(InterfaceInfo->Length == FIELD_OFFSET(USBD_INTERFACE_INFORMATION, Pipes[InterfaceInfo->NumberOfPipes])); @@ -1185,10 +1203,10 @@ // // copy interface info // - InterfaceInfo->InterfaceHandle = (USBD_INTERFACE_HANDLE)&m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex]; - InterfaceInfo->Class = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceClass; - InterfaceInfo->SubClass = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceSubClass; - InterfaceInfo->Protocol = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceProtocol; + InterfaceInfo->InterfaceHandle = (USBD_INTERFACE_HANDLE)&m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex]; + InterfaceInfo->Class = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceClass; + InterfaceInfo->SubClass = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceSubClass; + InterfaceInfo->Protocol = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceProtocol; InterfaceInfo->Reserved = 0; // @@ -1199,16 +1217,16 @@ // // copy pipe info // - InterfaceInfo->Pipes[PipeIndex].MaximumPacketSize = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.wMaxPacketSize; - InterfaceInfo->Pipes[PipeIndex].EndpointAddress = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bEndpointAddress; - InterfaceInfo->Pipes[PipeIndex].Interval = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bInterval; - InterfaceInfo->Pipes[PipeIndex].PipeType = (USBD_PIPE_TYPE)m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bmAttributes; - InterfaceInfo->Pipes[PipeIndex].PipeHandle = (PVOID)&m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor; + InterfaceInfo->Pipes[PipeIndex].MaximumPacketSize = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.wMaxPacketSize; + InterfaceInfo->Pipes[PipeIndex].EndpointAddress = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bEndpointAddress; + InterfaceInfo->Pipes[PipeIndex].Interval = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bInterval; + InterfaceInfo->Pipes[PipeIndex].PipeType = (USBD_PIPE_TYPE)m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bmAttributes; + InterfaceInfo->Pipes[PipeIndex].PipeHandle = (PVOID)&m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor; // // data toggle is reset on configuration requests // - m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].DataToggle = FALSE; + m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].DataToggle = FALSE; } // Modified: trunk/reactos/drivers/usb/usbuhci/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbuhci/usb_de…
============================================================================== --- trunk/reactos/drivers/usb/usbuhci/usb_device.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbuhci/usb_device.cpp [iso-8859-1] Wed Feb 22 18:57:49 2012 @@ -1144,19 +1144,37 @@ USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup; NTSTATUS Status; UCHAR bConfigurationValue = 0; + ULONG ConfigurationIndex = 0, Index; + UCHAR Found = FALSE; + if (ConfigurationDescriptor) { // - // sanity checks - // - ASSERT(ConfigurationDescriptor->iConfiguration < m_DeviceDescriptor.bNumConfigurations); - ASSERT(ConfigurationDescriptor->iConfiguration == m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].ConfigurationDescriptor->iConfiguration); + // find configuration index + // + for(Index = 0; Index < m_DeviceDescriptor.bNumConfigurations; Index++) + { + if (m_ConfigurationDescriptors[Index].ConfigurationDescriptor->iConfiguration == ConfigurationDescriptor->iConfiguration) + { + // + // found configuration index + // + ConfigurationIndex = Index; + Found = TRUE; + } + } + + if (!Found) + { + DPRINT1("[USBUHCI] invalid configuration index %lu\n", ConfigurationDescriptor->iConfiguration); + return STATUS_INVALID_PARAMETER; + } // // sanity check // - ASSERT(ConfigurationDescriptor->bNumInterfaces <= m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].ConfigurationDescriptor->bNumInterfaces); + ASSERT(ConfigurationDescriptor->bNumInterfaces <= m_ConfigurationDescriptors[ConfigurationIndex].ConfigurationDescriptor->bNumInterfaces); // // get configuration value @@ -1199,14 +1217,14 @@ } // - // store configuration device index - // - m_ConfigurationIndex = ConfigurationDescriptor->iConfiguration; + // store new configuration device index + // + m_ConfigurationIndex = ConfigurationIndex; // // store configuration handle // - *ConfigurationHandle = &m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration]; + *ConfigurationHandle = &m_ConfigurationDescriptors[ConfigurationIndex]; // // copy interface info and pipe info @@ -1216,7 +1234,7 @@ // // sanity check: is the info pre-layed out // - PC_ASSERT(InterfaceInfo->NumberOfPipes == m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bNumEndpoints); + PC_ASSERT(InterfaceInfo->NumberOfPipes == m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bNumEndpoints); PC_ASSERT(InterfaceInfo->Length != 0); #ifdef _MSC_VER PC_ASSERT(InterfaceInfo->Length == FIELD_OFFSET(USBD_INTERFACE_INFORMATION, Pipes[InterfaceInfo->NumberOfPipes])); @@ -1225,10 +1243,10 @@ // // copy interface info // - InterfaceInfo->InterfaceHandle = (USBD_INTERFACE_HANDLE)&m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex]; - InterfaceInfo->Class = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceClass; - InterfaceInfo->SubClass = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceSubClass; - InterfaceInfo->Protocol = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceProtocol; + InterfaceInfo->InterfaceHandle = (USBD_INTERFACE_HANDLE)&m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex]; + InterfaceInfo->Class = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceClass; + InterfaceInfo->SubClass = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceSubClass; + InterfaceInfo->Protocol = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].InterfaceDescriptor.bInterfaceProtocol; InterfaceInfo->Reserved = 0; // @@ -1239,16 +1257,16 @@ // // copy pipe info // - InterfaceInfo->Pipes[PipeIndex].MaximumPacketSize = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.wMaxPacketSize; - InterfaceInfo->Pipes[PipeIndex].EndpointAddress = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bEndpointAddress; - InterfaceInfo->Pipes[PipeIndex].Interval = m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bInterval; - InterfaceInfo->Pipes[PipeIndex].PipeType = (USBD_PIPE_TYPE)m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bmAttributes; - InterfaceInfo->Pipes[PipeIndex].PipeHandle = (PVOID)&m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor; + InterfaceInfo->Pipes[PipeIndex].MaximumPacketSize = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.wMaxPacketSize; + InterfaceInfo->Pipes[PipeIndex].EndpointAddress = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bEndpointAddress; + InterfaceInfo->Pipes[PipeIndex].Interval = m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bInterval; + InterfaceInfo->Pipes[PipeIndex].PipeType = (USBD_PIPE_TYPE)m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor.bmAttributes; + InterfaceInfo->Pipes[PipeIndex].PipeHandle = (PVOID)&m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].EndPointDescriptor; // // data toggle is reset on configuration requests // - m_ConfigurationDescriptors[ConfigurationDescriptor->iConfiguration].Interfaces[InterfaceIndex].EndPoints[PipeIndex].DataToggle = FALSE; + m_ConfigurationDescriptors[ConfigurationIndex].Interfaces[InterfaceIndex].EndPoints[PipeIndex].DataToggle = FALSE; } //
12 years, 10 months
1
0
0
0
[janderwald] 55810: [USBUHCI] - Detect the size of the configuration descriptor before obtaining the full configuration descriptor - Fix integer overflow in BuildTransferDescriptorChain
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 22 18:34:39 2012 New Revision: 55810 URL:
http://svn.reactos.org/svn/reactos?rev=55810&view=rev
Log: [USBUHCI] - Detect the size of the configuration descriptor before obtaining the full configuration descriptor - Fix integer overflow in BuildTransferDescriptorChain Modified: trunk/reactos/drivers/usb/usbuhci/usb_device.cpp trunk/reactos/drivers/usb/usbuhci/usb_request.cpp Modified: trunk/reactos/drivers/usb/usbuhci/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbuhci/usb_de…
============================================================================== --- trunk/reactos/drivers/usb/usbuhci/usb_device.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbuhci/usb_device.cpp [iso-8859-1] Wed Feb 22 18:34:39 2012 @@ -787,7 +787,7 @@ CtrlSetup.wValue.LowByte = Index; CtrlSetup.wValue.HiByte = USB_CONFIGURATION_DESCRIPTOR_TYPE; CtrlSetup.wIndex.W = 0; - CtrlSetup.wLength = PAGE_SIZE; + CtrlSetup.wLength = sizeof(USB_CONFIGURATION_DESCRIPTOR); // // now build MDL describing the buffer @@ -810,7 +810,7 @@ // // commit packet // - Status = CommitSetupPacket(&CtrlSetup, 0, PAGE_SIZE, Mdl); + Status = CommitSetupPacket(&CtrlSetup, 0, sizeof(USB_CONFIGURATION_DESCRIPTOR), Mdl); if (!NT_SUCCESS(Status)) { // @@ -822,26 +822,66 @@ } // + // get configuration descriptor + // + ConfigurationDescriptor = (PUSB_CONFIGURATION_DESCRIPTOR)Buffer; + + // + // sanity checks + // + ASSERT(ConfigurationDescriptor->bLength == sizeof(USB_CONFIGURATION_DESCRIPTOR)); + ASSERT(ConfigurationDescriptor->wTotalLength <= PAGE_SIZE); + ASSERT(ConfigurationDescriptor->bNumInterfaces); + ASSERT(ConfigurationDescriptor->wTotalLength); + ASSERT(ConfigurationDescriptor->bDescriptorType == USB_CONFIGURATION_DESCRIPTOR_TYPE); + + // + // informal debug print + // + DumpConfigurationDescriptor(ConfigurationDescriptor); + + // + // build setup packet + // + CtrlSetup.bmRequestType._BM.Recipient = BMREQUEST_TO_DEVICE; + CtrlSetup.bmRequestType._BM.Type = BMREQUEST_STANDARD; + CtrlSetup.bmRequestType._BM.Reserved = 0; + CtrlSetup.bmRequestType._BM.Dir = BMREQUEST_DEVICE_TO_HOST; + CtrlSetup.bRequest = USB_REQUEST_GET_DESCRIPTOR; + CtrlSetup.wValue.LowByte = Index; + CtrlSetup.wValue.HiByte = USB_CONFIGURATION_DESCRIPTOR_TYPE; + CtrlSetup.wIndex.W = 0; + CtrlSetup.wLength = ConfigurationDescriptor->wTotalLength; + + // + // commit packet + // + Status = CommitSetupPacket(&CtrlSetup, 0, ConfigurationDescriptor->wTotalLength, Mdl); + if (!NT_SUCCESS(Status)) + { + // + // failed to issue request, cleanup + // + IoFreeMdl(Mdl); + ExFreePool(Buffer); + return Status; + } + + // // now free the mdl // IoFreeMdl(Mdl); - // - // get configuration descriptor - // - ConfigurationDescriptor = (PUSB_CONFIGURATION_DESCRIPTOR)Buffer; - - // - // informal debug print - // - DumpConfigurationDescriptor(ConfigurationDescriptor); // // sanity check // - PC_ASSERT(ConfigurationDescriptor->bLength == sizeof(USB_CONFIGURATION_DESCRIPTOR)); - PC_ASSERT(ConfigurationDescriptor->wTotalLength <= PAGE_SIZE); - PC_ASSERT(ConfigurationDescriptor->bNumInterfaces); + ASSERT(ConfigurationDescriptor->bLength == sizeof(USB_CONFIGURATION_DESCRIPTOR)); + ASSERT(ConfigurationDescriptor->wTotalLength <= PAGE_SIZE); + ASSERT(ConfigurationDescriptor->bNumInterfaces); + ASSERT(ConfigurationDescriptor->wTotalLength); + ASSERT(ConfigurationDescriptor->bDescriptorType == USB_CONFIGURATION_DESCRIPTOR_TYPE); + // // request is complete, initialize configuration descriptor Modified: trunk/reactos/drivers/usb/usbuhci/usb_request.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbuhci/usb_re…
============================================================================== --- trunk/reactos/drivers/usb/usbuhci/usb_request.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbuhci/usb_request.cpp [iso-8859-1] Wed Feb 22 18:34:39 2012 @@ -823,14 +823,14 @@ OUT PUCHAR OutDataToggle) { PUHCI_TRANSFER_DESCRIPTOR FirstDescriptor = NULL, CurrentDescriptor, LastDescriptor = NULL; - UCHAR TransferBufferOffset = 0; + ULONG TransferBufferOffset = 0; NTSTATUS Status; ULONG MaxPacketSize, CurrentBufferSize; // // FIXME FIXME FIXME FIXME FIXME // - MaxPacketSize = 64; //1280; + MaxPacketSize = 1280; do {
12 years, 10 months
1
0
0
0
[janderwald] 55809: [USBUHCI] - Queue dpc when the interrupt indicates completion of a transfer or an error interrupt - Implement checking if a queue head is complete - Free queue heads and associa...
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 22 17:24:43 2012 New Revision: 55809 URL:
http://svn.reactos.org/svn/reactos?rev=55809&view=rev
Log: [USBUHCI] - Queue dpc when the interrupt indicates completion of a transfer or an error interrupt - Implement checking if a queue head is complete - Free queue heads and associated endpoint descriptors Modified: trunk/reactos/drivers/usb/usbuhci/hardware.cpp trunk/reactos/drivers/usb/usbuhci/hardware.h trunk/reactos/drivers/usb/usbuhci/interfaces.h trunk/reactos/drivers/usb/usbuhci/usb_queue.cpp trunk/reactos/drivers/usb/usbuhci/usb_request.cpp Modified: trunk/reactos/drivers/usb/usbuhci/hardware.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbuhci/hardwa…
============================================================================== --- trunk/reactos/drivers/usb/usbuhci/hardware.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbuhci/hardware.cpp [iso-8859-1] Wed Feb 22 17:24:43 2012 @@ -686,7 +686,7 @@ m_QueueHead[Index]->PhysicalAddress = Address.LowPart; m_QueueHead[Index]->ElementPhysical = QH_TERMINATE; - if (Index > 1) + if (Index > 0) { // // link queue heads @@ -696,6 +696,48 @@ } } + DPRINT1("Index %lu QueueHead %p LinkPhysical %x ElementPhysical %x PhysicalAddress %x Request %x NextElementDescriptor %x\n", + 0, + m_QueueHead[0], + m_QueueHead[0]->LinkPhysical, + m_QueueHead[0]->ElementPhysical, + m_QueueHead[0]->PhysicalAddress, + m_QueueHead[0]->Request, + m_QueueHead[0]->NextElementDescriptor); + DPRINT1("Index %lu QueueHead %p LinkPhysical %x ElementPhysical %x PhysicalAddress %x Request %x NextElementDescriptor %x\n", + 1, + m_QueueHead[1], + m_QueueHead[1]->LinkPhysical, + m_QueueHead[1]->ElementPhysical, + m_QueueHead[1]->PhysicalAddress, + m_QueueHead[1]->Request, + m_QueueHead[1]->NextElementDescriptor); + + DPRINT1("Index %lu QueueHead %p LinkPhysical %x ElementPhysical %x PhysicalAddress %x Request %x NextElementDescriptor %x\n", + 2, + m_QueueHead[2], + m_QueueHead[2]->LinkPhysical, + m_QueueHead[2]->ElementPhysical, + m_QueueHead[2]->PhysicalAddress, + m_QueueHead[2]->Request, + m_QueueHead[2]->NextElementDescriptor); + DPRINT1("Index %lu QueueHead %p LinkPhysical %x ElementPhysical %x PhysicalAddress %x Request %x NextElementDescriptor %x\n", + 3, + m_QueueHead[3], + m_QueueHead[3]->LinkPhysical, + m_QueueHead[3]->ElementPhysical, + m_QueueHead[3]->PhysicalAddress, + m_QueueHead[3]->Request, + m_QueueHead[3]->NextElementDescriptor); + DPRINT1("Index %lu QueueHead %p LinkPhysical %x ElementPhysical %x PhysicalAddress %x Request %x NextElementDescriptor %x\n", + 4, + m_QueueHead[4], + m_QueueHead[4]->LinkPhysical, + m_QueueHead[4]->ElementPhysical, + m_QueueHead[4]->PhysicalAddress, + m_QueueHead[4]->Request, + m_QueueHead[4]->NextElementDescriptor); + // // terminate last queue head with stray descriptor // @@ -708,7 +750,7 @@ DPRINT1("[USBUHCI] Failed to allocate queue head %x Index %x\n", Status, Index); return Status; } - +#if 0 // // init stray descriptor // @@ -722,7 +764,7 @@ // m_QueueHead[4]->LinkPhysical = m_StrayDescriptor->PhysicalAddress; m_QueueHead[4]->NextLogicalDescriptor = m_StrayDescriptor; - +#endif // // allocate frame bandwidth array @@ -1271,7 +1313,14 @@ if (Acknowledge) { // + // acknowledge interrupt + // This->WriteRegister16(UHCI_USBSTS, Acknowledge); + + // + // queue dpc + // + KeInsertQueueDpc(&This->m_IntDpcObject, UlongToPtr(Status), NULL); } // @@ -1356,6 +1405,7 @@ IN PVOID SystemArgument2) { CUSBHardwareDevice *This; + ULONG Status; // // get parameters @@ -1363,8 +1413,24 @@ This = (CUSBHardwareDevice*)DeferredContext; DPRINT("OhciDefferedRoutine\n"); - ASSERT(FALSE); - + + // + // get status + // + Status = PtrToUlong(SystemArgument1); + if (Status & (UHCI_USBSTS_USBINT | UHCI_USBSTS_ERRINT)) + { + // + // a transfer finished, inform the queue + // + This->m_UsbQueue->TransferInterrupt(Status & UHCI_USBSTS_USBINT); + return; + } + + // + // other event + // + DPRINT1("[USBUHCI] Status %x not handled\n", Status); } VOID Modified: trunk/reactos/drivers/usb/usbuhci/hardware.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbuhci/hardwa…
============================================================================== --- trunk/reactos/drivers/usb/usbuhci/hardware.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbuhci/hardware.h [iso-8859-1] Wed Feb 22 17:24:43 2012 @@ -92,10 +92,11 @@ ULONG BufferPhysical; // pointer to the buffer // Software part - ULONG PhysicalAddress; // Physical address of this descriptor + ULONG PhysicalAddress; // Physical address of this descriptor PVOID NextLogicalDescriptor; - ULONG BufferSize; // Size of the buffer - PVOID BufferLogical; // Logical pointer to the buffer + ULONG BufferSize; // Size of the buffer + PVOID BufferLogical; // Logical pointer to the buffer + PVOID UserBuffer; }UHCI_TRANSFER_DESCRIPTOR, *PUHCI_TRANSFER_DESCRIPTOR; #define TD_NEXT_IS_QH 0x02 Modified: trunk/reactos/drivers/usb/usbuhci/interfaces.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbuhci/interf…
============================================================================== --- trunk/reactos/drivers/usb/usbuhci/interfaces.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbuhci/interfaces.h [iso-8859-1] Wed Feb 22 17:24:43 2012 @@ -437,6 +437,22 @@ // Description: returns device speed virtual USB_DEVICE_SPEED GetDeviceSpeed() = 0; + +//----------------------------------------------------------------------------------------- +// +// CompletionCallback +// +// Description: notifies request that the endpoint descriptor is complete + + virtual VOID CompletionCallback() = 0; + +//----------------------------------------------------------------------------------------- +// +// FreeEndpointDescriptor +// +// Description: frees the associated endpoint descriptor and its general descriptors + + virtual VOID FreeEndpointDescriptor(struct _UHCI_QUEUE_HEAD * OutDescriptor) = 0; }; @@ -505,6 +521,14 @@ // Description: aborts all pending requsts of an device virtual NTSTATUS AbortDevicePipe(UCHAR DeviceAddress, IN struct _USB_ENDPOINT * EndpointDescriptor) = 0; + +//----------------------------------------------------------------------------------------- +// +// TransferInterrupt +// +// Description: informs the queue that a interrupt completed + + virtual VOID TransferInterrupt(UCHAR ErrorInterrupt) = 0; }; Modified: trunk/reactos/drivers/usb/usbuhci/usb_queue.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbuhci/usb_qu…
============================================================================== --- trunk/reactos/drivers/usb/usbuhci/usb_queue.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbuhci/usb_queue.cpp [iso-8859-1] Wed Feb 22 17:24:43 2012 @@ -40,10 +40,16 @@ virtual NTSTATUS CancelRequests(); virtual NTSTATUS CreateUSBRequest(IUSBRequest **OutRequest); virtual NTSTATUS AbortDevicePipe(UCHAR DeviceAddress, IN struct _USB_ENDPOINT * EndpointDescriptor); + virtual VOID TransferInterrupt(UCHAR ErrorInterrupt); // local VOID LinkQueueHead(PUHCI_QUEUE_HEAD QueueHead, PUHCI_QUEUE_HEAD NextQueueHead); + VOID UnLinkQueueHead(PUHCI_QUEUE_HEAD PreviousQueueHead, PUHCI_QUEUE_HEAD NextQueueHead); + BOOLEAN IsQueueHeadComplete(PUHCI_QUEUE_HEAD QueueHead); + NTSTATUS AddQueueHead(PUHCI_QUEUE_HEAD NewQueueHead); + VOID QueueHeadCleanup(IN PUHCI_QUEUE_HEAD QueueHead, IN PUHCI_QUEUE_HEAD PreviousQueueHead, OUT PUHCI_QUEUE_HEAD *NextQueueHead); + // constructor / destructor CUSBQueue(IUnknown *OuterUnknown){} @@ -53,6 +59,7 @@ LONG m_Ref; // reference count KSPIN_LOCK m_Lock; // list lock PUSBHARDWAREDEVICE m_Hardware; // hardware + }; //================================================================================================= @@ -106,25 +113,23 @@ } NTSTATUS -CUSBQueue::AddUSBRequest( - IUSBRequest * Request) -{ - PUHCI_QUEUE_HEAD NewQueueHead, QueueHead = NULL; - NTSTATUS Status; - - DPRINT("CUSBQueue::AddUSBRequest\n"); - - // - // get queue head - // - Status = Request->GetEndpointDescriptor(&NewQueueHead); - if (!NT_SUCCESS(Status)) - { - // - // failed to create queue head - // - DPRINT1("[USBUHCI] Failed to create queue head %x\n", Status); - return Status; +CUSBQueue::AddQueueHead( + PUHCI_QUEUE_HEAD NewQueueHead) +{ + PUSBREQUEST Request; + PUHCI_QUEUE_HEAD QueueHead = NULL; + + + // + // get request + // + Request = (PUSBREQUEST)NewQueueHead->Request; + if (!Request) + { + // + // no request + // + return STATUS_INVALID_PARAMETER; } if (Request->GetTransferType() == USB_ENDPOINT_TYPE_CONTROL) @@ -184,6 +189,40 @@ // LinkQueueHead(QueueHead, NewQueueHead); return STATUS_SUCCESS; + +} + +NTSTATUS +CUSBQueue::AddUSBRequest( + IUSBRequest * Request) +{ + PUHCI_QUEUE_HEAD NewQueueHead; + NTSTATUS Status; + + // + // get queue head + // + Status = Request->GetEndpointDescriptor(&NewQueueHead); + if (!NT_SUCCESS(Status)) + { + // + // failed to create queue head + // + DPRINT1("[USBUHCI] Failed to create queue head %x\n", Status); + return Status; + } + + // + // sanity check + // + ASSERT(PVOID(Request) == NewQueueHead->Request); + + // + // add queue head + // + DPRINT1("AddUSBRequest Request %p\n", Request); + DPRINT1("NewQueueHead %p\n", NewQueueHead); + return AddQueueHead(NewQueueHead); } VOID @@ -198,6 +237,17 @@ QueueHead->NextLogicalDescriptor = (PVOID)NextQueueHead; } + +VOID +CUSBQueue::UnLinkQueueHead( + PUHCI_QUEUE_HEAD QueueHeadToRemove, + PUHCI_QUEUE_HEAD PreviousQueueHead) +{ + PreviousQueueHead->LinkPhysical = QueueHeadToRemove->LinkPhysical; + PreviousQueueHead->NextLogicalDescriptor = QueueHeadToRemove->NextLogicalDescriptor; +} + + NTSTATUS CUSBQueue::CancelRequests() { @@ -233,6 +283,218 @@ return Status; } +BOOLEAN +CUSBQueue::IsQueueHeadComplete( + IN PUHCI_QUEUE_HEAD QueueHead) +{ + PUHCI_TRANSFER_DESCRIPTOR Descriptor; + ULONG ErrorCount; + + if (QueueHead->NextElementDescriptor == NULL) + { + // + // empty queue head + // + DPRINT1("QueueHead %p empty element physical\n", QueueHead); + return FALSE; + } + + // + // check all descriptors + // + Descriptor = (PUHCI_TRANSFER_DESCRIPTOR)QueueHead->NextElementDescriptor; + while(Descriptor) + { + if (Descriptor->Status & TD_STATUS_ACTIVE) + { + // + // descriptor is still active + // + DPRINT1("Descriptor %p is active Status %x BufferSize %lu\n", Descriptor, Descriptor->Status, Descriptor->BufferSize); + return FALSE; + } + + if (Descriptor->Status & TD_ERROR_MASK) + { + // + // error happened + // + DPRINT1("[USBUHCI] Error detected at descriptor %p Physical %x\n", Descriptor, Descriptor->PhysicalAddress); + + // + // get error count + // + ErrorCount = (Descriptor->Status >> TD_ERROR_COUNT_SHIFT) & TD_ERROR_COUNT_MASK; + if (ErrorCount == 0) + { + // + // error retry count elapsed + // + DPRINT1("[USBUHCI] ErrorBuffer %x TimeOut %x Nak %x BitStuff %x\n", + Descriptor->Status & TD_STATUS_ERROR_BUFFER, + Descriptor->Status & TD_STATUS_ERROR_TIMEOUT, + Descriptor->Status & TD_STATUS_ERROR_NAK, + Descriptor->Status & TD_STATUS_ERROR_BITSTUFF); + return TRUE; + } + else if (Descriptor->Status & TD_STATUS_ERROR_BABBLE) + { + // + // babble error + // + DPRINT1("[USBUHCI] Babble detected\n"); + return TRUE; + } + else + { + // + // stall detected + // + DPRINT1("[USBUHCI] Stall detected\n"); + } + } + + // + // move to next descriptor + // + Descriptor = (PUHCI_TRANSFER_DESCRIPTOR)Descriptor->NextLogicalDescriptor; + } + + // + // request is complete + // + return TRUE; +} + +VOID +CUSBQueue::QueueHeadCleanup( + IN PUHCI_QUEUE_HEAD QueueHead, + IN PUHCI_QUEUE_HEAD PreviousQueueHead, + OUT PUHCI_QUEUE_HEAD *NextQueueHead) +{ + PUSBREQUEST Request; + PUHCI_QUEUE_HEAD NewQueueHead; + NTSTATUS Status; + + // + // unlink queue head + // + UnLinkQueueHead(QueueHead, PreviousQueueHead); + + // + // get next queue head + // + *NextQueueHead = (PUHCI_QUEUE_HEAD)PreviousQueueHead->NextLogicalDescriptor; + ASSERT(*NextQueueHead != QueueHead); + + // + // the queue head is complete, is the transfer now completed? + // + Request = (PUSBREQUEST)QueueHead->Request; + ASSERT(Request); + + // + // free queue head + // + DPRINT1("Request %p\n", Request); + Request->FreeEndpointDescriptor(QueueHead); + + // + // check if transfer is complete + // + if (Request->IsRequestComplete()) + { + // + // the transfer is complete + // + Request->CompletionCallback(); + Request->Release(); + return; + } + + // + // grab new queue head + // + Status = Request->GetEndpointDescriptor(&NewQueueHead); + if (!NT_SUCCESS(Status)) + { + // + // failed to get new queue head + // + DPRINT1("[USBUHCI] Failed to get new queue head with %x\n", Status); + Request->CompletionCallback(); + Request->Release(); + return; + } + + // + // Link queue head + // + Status = AddQueueHead(NewQueueHead); + if (!NT_SUCCESS(Status)) + { + // + // failed to get new queue head + // + DPRINT1("[USBUHCI] Failed to add queue head with %x\n", Status); + Request->CompletionCallback(); + Request->Release(); + return; + } + +} + +VOID +CUSBQueue::TransferInterrupt( + UCHAR ErrorInterrupt) +{ + KIRQL OldLevel; + PUHCI_QUEUE_HEAD QueueHead, PreviousQueueHead = NULL; + BOOLEAN IsComplete; + + // + // acquire lock + // + KeAcquireSpinLock(&m_Lock, &OldLevel); + + // + // get queue head + // + m_Hardware->GetQueueHead(UHCI_INTERRUPT_QUEUE, &QueueHead); + + while(QueueHead) + { + // + // is queue head complete + // + DPRINT1("QueueHead %p\n", QueueHead); + IsComplete = IsQueueHeadComplete(QueueHead); + if (IsComplete) + { + // + // cleanup queue head + // + QueueHeadCleanup(QueueHead, PreviousQueueHead, &QueueHead); + continue; + } + + // + // backup previous queue head + // + PreviousQueueHead = QueueHead; + + // + // get next queue head + // + QueueHead = (PUHCI_QUEUE_HEAD)QueueHead->NextLogicalDescriptor; + } + + // + // release lock + // + KeReleaseSpinLock(&m_Lock, OldLevel); +} + NTSTATUS CreateUSBQueue( PUSBQUEUE *OutUsbQueue) Modified: trunk/reactos/drivers/usb/usbuhci/usb_request.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbuhci/usb_re…
============================================================================== --- trunk/reactos/drivers/usb/usbuhci/usb_request.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbuhci/usb_request.cpp [iso-8859-1] Wed Feb 22 17:24:43 2012 @@ -46,7 +46,8 @@ virtual BOOLEAN IsQueueHeadComplete(struct _QUEUE_HEAD * QueueHead); virtual UCHAR GetInterval(); virtual USB_DEVICE_SPEED GetDeviceSpeed(); - + virtual VOID CompletionCallback(); + virtual VOID FreeEndpointDescriptor(struct _UHCI_QUEUE_HEAD * OutDescriptor); // local functions ULONG InternalGetTransferType(); @@ -829,7 +830,7 @@ // // FIXME FIXME FIXME FIXME FIXME // - MaxPacketSize = 1280; + MaxPacketSize = 64; //1280; do { @@ -857,7 +858,14 @@ // // copy buffer // - RtlCopyMemory(CurrentDescriptor->BufferLogical, TransferBuffer, CurrentBufferSize); + RtlCopyMemory(CurrentDescriptor->BufferLogical, (PVOID)((ULONG_PTR)TransferBuffer + TransferBufferOffset), CurrentBufferSize); + } + else + { + // + // store user buffer + // + CurrentDescriptor->UserBuffer = (PVOID)((ULONG_PTR)TransferBuffer + TransferBufferOffset); } if (!FirstDescriptor) @@ -1075,7 +1083,7 @@ Status = BuildTransferDescriptorChain(MmGetMdlVirtualAddress(m_TransferBufferMDL), m_TransferBufferLength, Direction ? TD_TOKEN_IN : TD_TOKEN_OUT, - FALSE, + TRUE, &FirstDescriptor, &LastDescriptor, &ChainDescriptorLength, @@ -1131,6 +1139,173 @@ return m_DeviceSpeed; } +VOID +CUSBRequest::FreeEndpointDescriptor( + struct _UHCI_QUEUE_HEAD * OutDescriptor) +{ + PUHCI_TRANSFER_DESCRIPTOR Descriptor, NextDescriptor; + ULONG ErrorCount; + + // + // grab first transfer descriptor + // + Descriptor = (PUHCI_TRANSFER_DESCRIPTOR)OutDescriptor->NextElementDescriptor; + while(Descriptor) + { + if (Descriptor->Status & TD_ERROR_MASK) + { + // + // error happened + // + DPRINT1("[USBUHCI] Error detected at descriptor %p Physical %x\n", Descriptor, Descriptor->PhysicalAddress); + + // + // get error count + // + ErrorCount = (Descriptor->Status >> TD_ERROR_COUNT_SHIFT) & TD_ERROR_COUNT_MASK; + if (ErrorCount == 0) + { + // + // error retry count elapsed + // + m_NtStatusCode = STATUS_UNSUCCESSFUL; + + if (Descriptor->Status & TD_STATUS_ERROR_BUFFER) + { + DPRINT1("[USBUHCI] Buffer Error detected in descriptor %p\n", Descriptor); + m_UrbStatusCode = USBD_STATUS_DATA_BUFFER_ERROR; + } + else if (Descriptor->Status & TD_STATUS_ERROR_TIMEOUT) + { + DPRINT1("[USBUHCI] Timeout detected in descriptor %p\n", Descriptor); + m_UrbStatusCode = USBD_STATUS_TIMEOUT; + } + else if (Descriptor->Status & TD_STATUS_ERROR_NAK) + { + DPRINT1("[USBUHCI] Unexpected pid detected in descriptor %p\n", Descriptor); + m_UrbStatusCode = USBD_STATUS_UNEXPECTED_PID; + } + else if (Descriptor->Status & TD_STATUS_ERROR_BITSTUFF) + { + DPRINT1("[USBUHCI] BitStuff detected in descriptor %p\n", Descriptor); + m_UrbStatusCode = USBD_STATUS_BTSTUFF; + } + } + else if (Descriptor->Status & TD_STATUS_ERROR_BABBLE) + { + // + // babble error + // + DPRINT1("[USBUHCI] Babble detected in descriptor %p\n", Descriptor); + m_UrbStatusCode = USBD_STATUS_BABBLE_DETECTED; + } + else + { + // + // stall detected + // + DPRINT1("[USBUHCI] Stall detected\n"); + m_UrbStatusCode = USBD_STATUS_STALL_PID; + } + } + else + { + // + // FIXME detect actual length + // + if (Descriptor->UserBuffer) + { + // + // copy contents back + // + RtlCopyMemory(Descriptor->UserBuffer, Descriptor->BufferLogical, Descriptor->BufferSize); + } + } + // + // move to next descriptor + // + NextDescriptor = (PUHCI_TRANSFER_DESCRIPTOR)Descriptor->NextLogicalDescriptor; + + // + // free endpoint descriptor + // + FreeDescriptor(Descriptor); + + // + // move to next + // + Descriptor = NextDescriptor; + } + + // + // now free queue head + // + m_DmaManager->Release(OutDescriptor, sizeof(UHCI_QUEUE_HEAD)); + +} + +VOID +CUSBRequest::CompletionCallback() +{ + PIO_STACK_LOCATION IoStack; + PURB Urb; + + DPRINT("CUSBRequest::CompletionCallback\n"); + + if (m_Irp) + { + // + // set irp completion status + // + m_Irp->IoStatus.Status = m_NtStatusCode; + + // + // get current irp stack location + // + IoStack = IoGetCurrentIrpStackLocation(m_Irp); + + // + // get urb + // + Urb = (PURB)IoStack->Parameters.Others.Argument1; + + // + // store urb status + // + Urb->UrbHeader.Status = m_UrbStatusCode; + + // + // Check if the MDL was created + // + if (!Urb->UrbBulkOrInterruptTransfer.TransferBufferMDL) + { + // + // Free Mdl + // + IoFreeMdl(m_TransferBufferMDL); + } + + // + // FIXME calculate length + // + + // + // complete request + // + IoCompleteRequest(m_Irp, IO_NO_INCREMENT); + } + else + { + // + // signal completion event + // + PC_ASSERT(m_CompletionEvent); + KeSetEvent(m_CompletionEvent, 0, FALSE); + } + +} + + //----------------------------------------------------------------------------------------- NTSTATUS InternalCreateUSBRequest(
12 years, 10 months
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
...
58
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Results per page:
10
25
50
100
200