SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory

Hi All,

I’m using an IOCTL_SCSI_PASS_THROUGH_DIRECT in user mode, and sometimes
DeviceIoControl call is failing with “Invalid Access To Memeory”. I am
allocating 64K databuffer using “malloc”. At first I thought the device
might
require certain alignment restrictions, but I queried the device’s bus
adapter which had an AlignmentMask of
0, which the documentation indicates as meaning byte alignment is
sufficient. I guess there is some issue with byte alignment of DataBuffer.

I am trying this stuff on Windows 2003 Server.

Can anybody suggest me way out?

Thanks and regards,
Kumsi.

In-Reality Software is now Symphony Services

Rajendrakumar L. Rajguru
Software Engineer

Phone: +91.20.403.2916 x454

Fax: +91.20.403.3048

Mobile: 9822191472

rajendra@in-reality.com

Symphony Services

A-103, Pune IT Park,
34, Aundh Road,
Bhau Patil Marg,
Bopodi,
Pune 411 020 India

www.symphonysv.com

This electronic transmission (and any attached documents) contains
information from Symphony Services and is for the sole use of the individual
or entity it is addressed to. If you receive this message in error, please
notify me and destroy the attached message (and all attached documents)
immediately.

Hi,

Are you reading from a CD-ROM by any chance?


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Rajendrakumar
Sent: 10 December 2004 09:52
To: Windows System Software Devs Interest List
Subject: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory

?
?
Hi All,
?
I’m using an IOCTL_SCSI_PASS_THROUGH_DIRECT in user mode, and sometimes DeviceIoControl call? is failing with “Invalid Access To Memeory”.? I am allocating 64K databuffer?using “malloc”. ?At first I thought the device might
require certain alignment restrictions, but I queried the device’s bus adapter which had an AlignmentMask? of
0, which the documentation indicates as meaning byte alignment is sufficient. I guess there is some issue with byte alignment of DataBuffer.
?
I am trying this stuff on Windows 2003 Server.
?
Can anybody suggest me way out?
?
Thanks and regards,
Kumsi.
?
In-Reality Software is now Symphony Services
?
Rajendrakumar L. Rajguru
Software Engineer
Phone: +91.20.403.2916 x454
Fax: +91.20.403.3048
Mobile: 9822191472
rajendra@in-reality.com
?
Symphony Services
A-103, Pune IT Park,
34, Aundh Road,
Bhau Patil Marg,
Bopodi,
Pune 411 020 India? ???
www.symphonysv.com
?
This electronic transmission (and any attached documents) contains information from Symphony Services and is for the sole use of the individual or entity it is addressed to. If you receive this message in error, please notify me and destroy the attached message (and all attached documents) immediately.
?

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email



This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email


You must pay attention to all of AlignmentMask, MaximumTransferLength,
and MaximumPhysicalPages of either STORAGE_ADAPTER_DESCRIPTOR or
IO_SCSI_CAPABILITIES.

Chuck

----- Original Message -----
From: “Rajendrakumar”
To: “Windows System Software Devs Interest List”
Sent: Friday, December 10, 2004 4:51 PM
Subject: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory

> Hi All,
>
> I’m using an IOCTL_SCSI_PASS_THROUGH_DIRECT in user mode, and
> sometimes
> DeviceIoControl call is failing with “Invalid Access To Memeory”. I
> am
> allocating 64K databuffer using “malloc”. At first I thought the
> device
> might
> require certain alignment restrictions, but I queried the device’s bus
> adapter which had an AlignmentMask of
> 0, which the documentation indicates as meaning byte alignment is
> sufficient. I guess there is some issue with byte alignment of
> DataBuffer.
>
> I am trying this stuff on Windows 2003 Server.
>
> Can anybody suggest me way out?
>
> Thanks and regards,
> Kumsi.

Here is detail information I get from IO_SCSI_CAPABILITIES

AlignmentMask = 0
MaximumTransferLength = 0x00FFFFFF
MaximumPhysicalPages = 0x00000081

Here is code fragment

PUCHAR
AllocateAlignedBuffer(ULONG size, ULONG Align)
{
PUCHAR ptr;

UINT_PTR Align64 = (UINT_PTR)Align;

fprintf(stderr,“Allignement = %d”, Align) ;
if (!Align) {
ptr = (PUCHAR)malloc(size);
}
else {
ptr = (PUCHAR)malloc(size + Align);
ptr = (PUCHAR)(((UINT_PTR)ptr + Align64) & ~Align64);
}
return ptr ;

}

int main() {




/*
Some Part of Main Function…
*/

dataBuffer = AllocateAlignedBuffer(sectorSize, capabilities.AlignmentMask);
if (dataBuffer == NULL) {
fprintf(stderr,“\n Can not allocate AlignedBuffer\n”) ;
return TR_ERROR ;
}
memcpy(dataBuffer,sectorSize) ;
ZeroMemory(&scsiCmd,sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER));

scsiCmd.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
scsiCmd.sptd.PathId = m_Handle.PathID;
scsiCmd.sptd.TargetId = m_Handle.Target ;
scsiCmd.sptd.Lun = m_Handle.Lun ;
scsiCmd.sptd.CdbLength = m_scsiCmdBuffer.SRB_CDBLen;
scsiCmd.sptd.SenseInfoLength = m_scsiCmdBuffer.SRB_SenseLen ;
scsiCmd.sptd.DataIn = m_scsiCmdBuffer.SRB_Flags;
scsiCmd.sptd.DataTransferLength = m_scsiCmdBuffer.SRB_BufLen ;
scsiCmd.sptd.TimeOutValue = USCSI_TIMEOUT ;
scsiCmd.sptd.DataBuffer = dataBuffer ;
scsiCmd.sptd.SenseInfoOffset =
offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER,ucSenseBuf) ;

if (m_scsiCmdBuffer.SRB_BufLen <
sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER))
length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER) ;
else
length = m_scsiCmdBuffer.SRB_BufLen ;

iRetVal = DeviceIoControl(m_Handle.Handle,
IOCTL_SCSI_PASS_THROUGH_DIRECT,
&scsiCmd,
length ,
&scsiCmd,
length,
&returned,
FALSE);




} //main Ends

Now I am not able to understand why it is failing sometimes with “Invalid
Access To Memory Location”…
How do I ensure that memory I am allocating is aligned properly and is
continuous if require.

Any suggestions form anybody?

Thanks in advance.

-Kumsi.

You must pay attention to all of AlignmentMask, MaximumTransferLength,
and MaximumPhysicalPages of either STORAGE_ADAPTER_DESCRIPTOR or
IO_SCSI_CAPABILITIES.

Chuck

----- Original Message -----
From: “Rajendrakumar”
To: “Windows System Software Devs Interest List”
Sent: Friday, December 10, 2004 4:51 PM
Subject: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory

> Hi All,
>
> I’m using an IOCTL_SCSI_PASS_THROUGH_DIRECT in user mode, and
> sometimes
> DeviceIoControl call is failing with “Invalid Access To Memeory”. I
> am
> allocating 64K databuffer using “malloc”. At first I thought the
> device
> might
> require certain alignment restrictions, but I queried the device’s bus
> adapter which had an AlignmentMask of
> 0, which the documentation indicates as meaning byte alignment is
> sufficient. I guess there is some issue with byte alignment of
> DataBuffer.
>
> I am trying this stuff on Windows 2003 Server.
>
> Can anybody suggest me way out?
>
> Thanks and regards,
> Kumsi.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: rajendra@in-reality.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

When you call DeviceIoControl(), use
sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER) in place of “length.” The
“length” value you compute is unnecessary.

More hints:

  1. Do not bother setting PathId, TargetId, or Lun. These are implicit
    in the device object handle passed to DeviceIoControl(). The driver
    overwrites these values.

  2. Set SenseInfoLength to sizeof(ucSenseBuf). I don’t see why you would
    need to change this value at run time.

Chuck

----- Original Message -----
From: “Rajendrakumar”
To: “Windows System Software Devs Interest List”
Sent: Friday, December 10, 2004 7:48 PM
Subject: RE: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory

>
>
>
> Here is detail information I get from IO_SCSI_CAPABILITIES
>
> AlignmentMask = 0
> MaximumTransferLength = 0x00FFFFFF
> MaximumPhysicalPages = 0x00000081
>
>
>
>
>
> Here is code fragment
>
>
>
> PUCHAR
> AllocateAlignedBuffer(ULONG size, ULONG Align)
> {
> PUCHAR ptr;
>
> UINT_PTR Align64 = (UINT_PTR)Align;
>
> fprintf(stderr,“Allignement = %d”, Align) ;
> if (!Align) {
> ptr = (PUCHAR)malloc(size);
> }
> else {
> ptr = (PUCHAR)malloc(size + Align);
> ptr = (PUCHAR)(((UINT_PTR)ptr + Align64) & ~Align64);
> }
> return ptr ;
>
> }
>
> int main() {
>
> …
> …
> …
> /*
> Some Part of Main Function…
> */
>
> dataBuffer = AllocateAlignedBuffer(sectorSize,
> capabilities.AlignmentMask);
> if (dataBuffer == NULL) {
> fprintf(stderr,“\n Can not allocate AlignedBuffer\n”) ;
> return TR_ERROR ;
> }
> memcpy(dataBuffer,sectorSize) ;
> ZeroMemory(&scsiCmd,sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER));
>
> scsiCmd.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
> scsiCmd.sptd.PathId = m_Handle.PathID;
> scsiCmd.sptd.TargetId = m_Handle.Target ;
> scsiCmd.sptd.Lun = m_Handle.Lun ;
> scsiCmd.sptd.CdbLength = m_scsiCmdBuffer.SRB_CDBLen;
> scsiCmd.sptd.SenseInfoLength = m_scsiCmdBuffer.SRB_SenseLen ;
> scsiCmd.sptd.DataIn = m_scsiCmdBuffer.SRB_Flags;
> scsiCmd.sptd.DataTransferLength = m_scsiCmdBuffer.SRB_BufLen ;
> scsiCmd.sptd.TimeOutValue = USCSI_TIMEOUT ;
> scsiCmd.sptd.DataBuffer = dataBuffer ;
> scsiCmd.sptd.SenseInfoOffset =
> offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER,ucSenseBuf) ;
>
> if (m_scsiCmdBuffer.SRB_BufLen <
> sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER))
> length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER) ;
> else
> length = m_scsiCmdBuffer.SRB_BufLen ;
>
> iRetVal = DeviceIoControl(m_Handle.Handle,
> IOCTL_SCSI_PASS_THROUGH_DIRECT,
> &scsiCmd,
> length ,
> &scsiCmd,
> length,
> &returned,
> FALSE);
>
>
> …
> …
> …
> } //main Ends
>
>
>
> Now I am not able to understand why it is failing sometimes with
> “Invalid
> Access To Memory Location”…
> How do I ensure that memory I am allocating is aligned properly and is
> continuous if require.
>
> Any suggestions form anybody?
>
> Thanks in advance.
>
> -Kumsi.
>
>
>
>
>>You must pay attention to all of AlignmentMask, MaximumTransferLength,
>>and MaximumPhysicalPages of either STORAGE_ADAPTER_DESCRIPTOR or
>>IO_SCSI_CAPABILITIES.
>
>>Chuck
>
> ----- Original Message -----
> From: “Rajendrakumar”
> To: “Windows System Software Devs Interest List”
> Sent: Friday, December 10, 2004 4:51 PM
> Subject: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory
>
>
>> Hi All,
>>
>> I’m using an IOCTL_SCSI_PASS_THROUGH_DIRECT in user mode, and
>> sometimes
>> DeviceIoControl call is failing with “Invalid Access To Memeory”. I
>> am
>> allocating 64K databuffer using “malloc”. At first I thought the
>> device
>> might
>> require certain alignment restrictions, but I queried the device’s
>> bus
>> adapter which had an AlignmentMask of
>> 0, which the documentation indicates as meaning byte alignment is
>> sufficient. I guess there is some issue with byte alignment of
>> DataBuffer.
>>
>> I am trying this stuff on Windows 2003 Server.
>>
>> Can anybody suggest me way out?
>>
>> Thanks and regards,
>> Kumsi.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: rajendra@in-reality.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@cbatson.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Thanks Chuck,

It works. There was some issue with Length I guess. I am yet to test it
rigorously.
But Thanks again.
Kumsi.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Chuck Batson
Sent: Friday, December 10, 2004 6:41 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory

When you call DeviceIoControl(), use
sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER) in place of “length.” The
“length” value you compute is unnecessary.

More hints:

  1. Do not bother setting PathId, TargetId, or Lun. These are implicit
    in the device object handle passed to DeviceIoControl(). The driver
    overwrites these values.

  2. Set SenseInfoLength to sizeof(ucSenseBuf). I don’t see why you would
    need to change this value at run time.

Chuck

----- Original Message -----
From: “Rajendrakumar”
To: “Windows System Software Devs Interest List”
Sent: Friday, December 10, 2004 7:48 PM
Subject: RE: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory

>
>
>
> Here is detail information I get from IO_SCSI_CAPABILITIES
>
> AlignmentMask = 0
> MaximumTransferLength = 0x00FFFFFF
> MaximumPhysicalPages = 0x00000081
>
>
>
>
>
> Here is code fragment
>
>
>
> PUCHAR
> AllocateAlignedBuffer(ULONG size, ULONG Align)
> {
> PUCHAR ptr;
>
> UINT_PTR Align64 = (UINT_PTR)Align;
>
> fprintf(stderr,“Allignement = %d”, Align) ;
> if (!Align) {
> ptr = (PUCHAR)malloc(size);
> }
> else {
> ptr = (PUCHAR)malloc(size + Align);
> ptr = (PUCHAR)(((UINT_PTR)ptr + Align64) & ~Align64);
> }
> return ptr ;
>
> }
>
> int main() {
>
> …
> …
> …
> /*
> Some Part of Main Function…
> */
>
> dataBuffer = AllocateAlignedBuffer(sectorSize,
> capabilities.AlignmentMask);
> if (dataBuffer == NULL) {
> fprintf(stderr,“\n Can not allocate AlignedBuffer\n”) ;
> return TR_ERROR ;
> }
> memcpy(dataBuffer,sectorSize) ;
> ZeroMemory(&scsiCmd,sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER));
>
> scsiCmd.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
> scsiCmd.sptd.PathId = m_Handle.PathID;
> scsiCmd.sptd.TargetId = m_Handle.Target ;
> scsiCmd.sptd.Lun = m_Handle.Lun ;
> scsiCmd.sptd.CdbLength = m_scsiCmdBuffer.SRB_CDBLen;
> scsiCmd.sptd.SenseInfoLength = m_scsiCmdBuffer.SRB_SenseLen ;
> scsiCmd.sptd.DataIn = m_scsiCmdBuffer.SRB_Flags;
> scsiCmd.sptd.DataTransferLength = m_scsiCmdBuffer.SRB_BufLen ;
> scsiCmd.sptd.TimeOutValue = USCSI_TIMEOUT ;
> scsiCmd.sptd.DataBuffer = dataBuffer ;
> scsiCmd.sptd.SenseInfoOffset =
> offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER,ucSenseBuf) ;
>
> if (m_scsiCmdBuffer.SRB_BufLen <
> sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER))
> length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER) ;
> else
> length = m_scsiCmdBuffer.SRB_BufLen ;
>
> iRetVal = DeviceIoControl(m_Handle.Handle,
> IOCTL_SCSI_PASS_THROUGH_DIRECT,
> &scsiCmd,
> length ,
> &scsiCmd,
> length,
> &returned,
> FALSE);
>
>
> …
> …
> …
> } //main Ends
>
>
>
> Now I am not able to understand why it is failing sometimes with
> “Invalid
> Access To Memory Location”…
> How do I ensure that memory I am allocating is aligned properly and is
> continuous if require.
>
> Any suggestions form anybody?
>
> Thanks in advance.
>
> -Kumsi.
>
>
>
>
>>You must pay attention to all of AlignmentMask, MaximumTransferLength,
>>and MaximumPhysicalPages of either STORAGE_ADAPTER_DESCRIPTOR or
>>IO_SCSI_CAPABILITIES.
>
>>Chuck
>
> ----- Original Message -----
> From: “Rajendrakumar”
> To: “Windows System Software Devs Interest List”
> Sent: Friday, December 10, 2004 4:51 PM
> Subject: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory
>
>
>> Hi All,
>>
>> I’m using an IOCTL_SCSI_PASS_THROUGH_DIRECT in user mode, and
>> sometimes
>> DeviceIoControl call is failing with “Invalid Access To Memeory”. I
>> am
>> allocating 64K databuffer using “malloc”. At first I thought the
>> device
>> might
>> require certain alignment restrictions, but I queried the device’s
>> bus
>> adapter which had an AlignmentMask of
>> 0, which the documentation indicates as meaning byte alignment is
>> sufficient. I guess there is some issue with byte alignment of
>> DataBuffer.
>>
>> I am trying this stuff on Windows 2003 Server.
>>
>> Can anybody suggest me way out?
>>
>> Thanks and regards,
>> Kumsi.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: rajendra@in-reality.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@cbatson.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: rajendra@in-reality.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Note that the “MaximumTransferLength” (16MB) problably is not be
achievable since MaximumPhysicalPages would limit you to 516KB (129
pages) if all pages were discontiguous. Also, are you going to a real
SCSI device, or is this ATA. If ATA, I’m surprised the AlignmentMask is
not a “1”, and you may want to treat it as such just to play it safe.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rajendrakumar
Sent: Friday, December 10, 2004 4:49 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory

Here is detail information I get from IO_SCSI_CAPABILITIES

AlignmentMask = 0
MaximumTransferLength = 0x00FFFFFF
MaximumPhysicalPages = 0x00000081

Here is code fragment

PUCHAR
AllocateAlignedBuffer(ULONG size, ULONG Align)
{
PUCHAR ptr;

UINT_PTR Align64 = (UINT_PTR)Align;

fprintf(stderr,“Allignement = %d”, Align) ;
if (!Align) {
ptr = (PUCHAR)malloc(size);
}
else {
ptr = (PUCHAR)malloc(size + Align);
ptr = (PUCHAR)(((UINT_PTR)ptr + Align64) & ~Align64);
}
return ptr ;

}

int main() {




/*
Some Part of Main Function…
*/

dataBuffer = AllocateAlignedBuffer(sectorSize,
capabilities.AlignmentMask);
if (dataBuffer == NULL) {
fprintf(stderr,“\n Can not allocate AlignedBuffer\n”) ;
return TR_ERROR ;
}
memcpy(dataBuffer,sectorSize) ;
ZeroMemory(&scsiCmd,sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER));

scsiCmd.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
scsiCmd.sptd.PathId = m_Handle.PathID;
scsiCmd.sptd.TargetId = m_Handle.Target ;
scsiCmd.sptd.Lun = m_Handle.Lun ;
scsiCmd.sptd.CdbLength = m_scsiCmdBuffer.SRB_CDBLen;
scsiCmd.sptd.SenseInfoLength = m_scsiCmdBuffer.SRB_SenseLen ;
scsiCmd.sptd.DataIn = m_scsiCmdBuffer.SRB_Flags;
scsiCmd.sptd.DataTransferLength = m_scsiCmdBuffer.SRB_BufLen ;
scsiCmd.sptd.TimeOutValue = USCSI_TIMEOUT ;
scsiCmd.sptd.DataBuffer = dataBuffer ;
scsiCmd.sptd.SenseInfoOffset =
offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER,ucSenseBuf) ;

if (m_scsiCmdBuffer.SRB_BufLen <
sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER))
length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER) ;
else
length = m_scsiCmdBuffer.SRB_BufLen ;

iRetVal = DeviceIoControl(m_Handle.Handle,
IOCTL_SCSI_PASS_THROUGH_DIRECT,
&scsiCmd,
length ,
&scsiCmd,
length,
&returned,
FALSE);




} //main Ends

Now I am not able to understand why it is failing sometimes with
“Invalid
Access To Memory Location”…
How do I ensure that memory I am allocating is aligned properly and is
continuous if require.

Any suggestions form anybody?

Thanks in advance.

-Kumsi.

You must pay attention to all of AlignmentMask, MaximumTransferLength,
and MaximumPhysicalPages of either STORAGE_ADAPTER_DESCRIPTOR or
IO_SCSI_CAPABILITIES.

Chuck

----- Original Message -----
From: “Rajendrakumar”
To: “Windows System Software Devs Interest List”
Sent: Friday, December 10, 2004 4:51 PM
Subject: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory

> Hi All,
>
> I’m using an IOCTL_SCSI_PASS_THROUGH_DIRECT in user mode, and
> sometimes
> DeviceIoControl call is failing with “Invalid Access To Memeory”. I
> am
> allocating 64K databuffer using “malloc”. At first I thought the
> device
> might
> require certain alignment restrictions, but I queried the device’s bus
> adapter which had an AlignmentMask of
> 0, which the documentation indicates as meaning byte alignment is
> sufficient. I guess there is some issue with byte alignment of
> DataBuffer.
>
> I am trying this stuff on Windows 2003 Server.
>
> Can anybody suggest me way out?
>
> Thanks and regards,
> Kumsi.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: rajendra@in-reality.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Try allocating with VirtualAlloc. This will give you a page-aligned buffer.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Rajendrakumar
To: Windows System Software Devs Interest List
Sent: Friday, December 10, 2004 12:51 PM
Subject: [ntdev] SCSI_PASS_THROUGH_DIRECT Invalid Access To Memeory

Hi All,

I’m using an IOCTL_SCSI_PASS_THROUGH_DIRECT in user mode, and sometimes DeviceIoControl call is failing with “Invalid Access To Memeory”. I am allocating 64K databuffer using “malloc”. At first I thought the device might
require certain alignment restrictions, but I queried the device’s bus adapter which had an AlignmentMask of
0, which the documentation indicates as meaning byte alignment is sufficient. I guess there is some issue with byte alignment of DataBuffer.

I am trying this stuff on Windows 2003 Server.

Can anybody suggest me way out?

Thanks and regards,
Kumsi.

In-Reality Software is now Symphony Services

Rajendrakumar L. Rajguru
Software Engineer

Phone: +91.20.403.2916 x454

Fax: +91.20.403.3048

Mobile: 9822191472

rajendra@in-reality.com

Symphony Services

A-103, Pune IT Park,
34, Aundh Road,
Bhau Patil Marg,
Bopodi,
Pune 411 020 India

www.symphonysv.com

This electronic transmission (and any attached documents) contains information from Symphony Services and is for the sole use of the individual or entity it is addressed to. If you receive this message in error, please notify me and destroy the attached message (and all attached documents) immediately.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com