Author: janderwald
Date: Wed Feb 29 10:59:48 2012
New Revision: 55917
URL:
http://svn.reactos.org/svn/reactos?rev=55917&view=rev
Log:
[USBEHCI]
- Fix stack corruption found by msvc
- Fix msvc build
Modified:
trunk/reactos/drivers/usb/usbehci/usb_request.cpp
Modified: trunk/reactos/drivers/usb/usbehci/usb_request.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usb_re…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/usb_request.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/usb_request.cpp [iso-8859-1] Wed Feb 29 10:59:48
2012
@@ -45,14 +45,14 @@
UCHAR InternalGetPidDirection();
NTSTATUS BuildControlTransferQueueHead(PQUEUE_HEAD * OutHead);
NTSTATUS BuildBulkTransferQueueHead(PQUEUE_HEAD * OutHead);
- NTSTATUS CreateDescriptor(PQUEUE_TRANSFER_DESCRIPTOR *OutDescriptor);
+ NTSTATUS STDMETHODCALLTYPE CreateDescriptor(PQUEUE_TRANSFER_DESCRIPTOR
*OutDescriptor);
NTSTATUS CreateQueueHead(PQUEUE_HEAD *OutQueueHead);
- UCHAR GetDeviceAddress();
+ UCHAR STDMETHODCALLTYPE GetDeviceAddress();
NTSTATUS BuildSetupPacket();
NTSTATUS BuildSetupPacketFromURB();
ULONG InternalCalculateTransferLength();
- NTSTATUS BuildTransferDescriptorChain(IN PQUEUE_HEAD QueueHead, IN PVOID
TransferBuffer, IN ULONG TransferBufferLength, IN UCHAR PidCode, IN UCHAR
InitialDataToggle, IN PQUEUE_TRANSFER_DESCRIPTOR AlternativeDescriptor, OUT
PQUEUE_TRANSFER_DESCRIPTOR * OutFirstDescriptor, OUT PQUEUE_TRANSFER_DESCRIPTOR *
OutLastDescriptor, OUT PUCHAR OutDataToggle, OUT PULONG OutTransferBufferOffset);
- VOID InitDescriptor(IN PQUEUE_TRANSFER_DESCRIPTOR CurrentDescriptor, IN PVOID
TransferBuffer, IN ULONG TransferBufferLength, IN UCHAR PidCode, IN UCHAR DataToggle, OUT
PULONG OutDescriptorLength);
+ NTSTATUS STDMETHODCALLTYPE BuildTransferDescriptorChain(IN PQUEUE_HEAD QueueHead, IN
PVOID TransferBuffer, IN ULONG TransferBufferLength, IN UCHAR PidCode, IN UCHAR
InitialDataToggle, OUT PQUEUE_TRANSFER_DESCRIPTOR * OutFirstDescriptor, OUT
PQUEUE_TRANSFER_DESCRIPTOR * OutLastDescriptor, OUT PUCHAR OutDataToggle, OUT PULONG
OutTransferBufferOffset);
+ VOID STDMETHODCALLTYPE InitDescriptor(IN PQUEUE_TRANSFER_DESCRIPTOR
CurrentDescriptor, IN PVOID TransferBuffer, IN ULONG TransferBufferLength, IN UCHAR
PidCode, IN UCHAR DataToggle, OUT PULONG OutDescriptorLength);
VOID DumpQueueHead(IN PQUEUE_HEAD QueueHead);
// constructor / destructor
@@ -565,6 +565,7 @@
}
VOID
+STDMETHODCALLTYPE
CUSBRequest::InitDescriptor(
IN PQUEUE_TRANSFER_DESCRIPTOR CurrentDescriptor,
IN PVOID TransferBuffer,
@@ -673,13 +674,13 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBRequest::BuildTransferDescriptorChain(
IN PQUEUE_HEAD QueueHead,
IN PVOID TransferBuffer,
IN ULONG TransferBufferLength,
IN UCHAR PidCode,
IN UCHAR InitialDataToggle,
- IN PQUEUE_TRANSFER_DESCRIPTOR AlternativeDescriptor,
OUT PQUEUE_TRANSFER_DESCRIPTOR * OutFirstDescriptor,
OUT PQUEUE_TRANSFER_DESCRIPTOR * OutLastDescriptor,
OUT PUCHAR OutDataToggle,
@@ -757,15 +758,6 @@
//
LastDescriptor->NextPointer = CurrentDescriptor->PhysicalAddr;
LastDescriptor = CurrentDescriptor;
-
- if (AlternativeDescriptor)
- {
- //
- // link to alternative next pointer
- //
- LastDescriptor->AlternateNextPointer =
AlternativeDescriptor->PhysicalAddr;
- }
-
}
else
{
@@ -929,7 +921,6 @@
m_TransferBufferLength,
InternalGetPidDirection(),
TRUE,
- NULL,
&FirstDescriptor,
&LastDescriptor,
NULL,
@@ -939,7 +930,12 @@
// FIXME handle errors
//
ASSERT(Status == STATUS_SUCCESS);
- ASSERT(DescriptorChainLength == m_TransferBufferLength);
+ if (m_TransferBufferLength != DescriptorChainLength)
+ {
+ DPRINT1("DescriptorChainLength %x\n", DescriptorChainLength);
+ DPRINT1("m_TransferBufferLength %x\n", m_TransferBufferLength);
+ ASSERT(FALSE);
+ }
//
// now link the descriptors
@@ -1125,7 +1121,6 @@
MaxTransferLength,
InternalGetPidDirection(),
m_EndpointDescriptor->DataToggle,
- NULL,
&FirstDescriptor,
&LastDescriptor,
&m_EndpointDescriptor->DataToggle,
@@ -1176,6 +1171,7 @@
//----------------------------------------------------------------------------------------
NTSTATUS
+STDMETHODCALLTYPE
CUSBRequest::CreateDescriptor(
PQUEUE_TRANSFER_DESCRIPTOR *OutDescriptor)
{
@@ -1430,7 +1426,7 @@
m_DescriptorPacket->wValue.LowByte =
Urb->UrbControlDescriptorRequest.Index;
m_DescriptorPacket->wValue.HiByte =
Urb->UrbControlDescriptorRequest.DescriptorType;
m_DescriptorPacket->wIndex.W =
Urb->UrbControlDescriptorRequest.LanguageId;
- m_DescriptorPacket->wLength =
Urb->UrbControlDescriptorRequest.TransferBufferLength;
+ m_DescriptorPacket->wLength =
(USHORT)Urb->UrbControlDescriptorRequest.TransferBufferLength;
m_DescriptorPacket->bmRequestType.B = 0x80;
break;