Support WriteFileGather in driver

Hi,

Because of some incredible inefficient proprietary communication protocols
that I have to live with, I find myself having to use WriteFileGather in my
user mode driver to reduce the copy of memory. However, when I call
WriteFileGather, it always return ERROR_INVALID_PARAMETER without sending
the write request to my driver. I checked my parameters and they seem to
agree with SDK. My question is, is WriteFileGather used only on (disk or
network) file?

Here is the test code

SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
assert(sysinfo.dwPageSize == 0x1000);

PCHAR pMsgBuf = (PCHAR) VirtualAlloc(NULL, 0x4000, MEM_COMMIT,
PAGE_READWRITE);
FILE_SEGMENT_ELEMENT aSegmentArray[5] = {0};

for(int i=0; i<4; i++) {

aSegmentArray[i].Buffer = pMsgBuf + i*0x1000; }

OVERLAPPED ovlapped = {0};

ovlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

BOOL bRet = WriteFileGather(hDriver, aSegmentArray, 0x4000, NULL,
&ovlapped);

Thanks.

Bi

RE: [ntdev] RE: Looking for a WDM DMA Sample - platforms that translate DMA addressesI had seem problem with my ReadFile before. Hope to hear some comments.

zyh
----- Original Message -----
From: Bi Chen
To: NT Developers Interest List
Sent: Wednesday, October 02, 2002 3:26 PM
Subject: [ntdev] Support WriteFileGather in driver

Hi,

Because of some incredible inefficient proprietary communication protocols that I have to live with, I find myself having to use WriteFileGather in my user mode driver to reduce the copy of memory. However, when I call WriteFileGather, it always return ERROR_INVALID_PARAMETER without sending the write request to my driver. I checked my parameters and they seem to agree with SDK. My question is, is WriteFileGather used only on (disk or network) file?

Here is the test code

SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
assert(sysinfo.dwPageSize == 0x1000);

PCHAR pMsgBuf = (PCHAR) VirtualAlloc(NULL, 0x4000, MEM_COMMIT, PAGE_READWRITE);
FILE_SEGMENT_ELEMENT aSegmentArray[5] = {0};

for(int i=0; i<4; i++) {

aSegmentArray[i].Buffer = pMsgBuf + i*0x1000; }

OVERLAPPED ovlapped = {0};

ovlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

BOOL bRet = WriteFileGather(hDriver, aSegmentArray, 0x4000, NULL, &ovlapped);

Thanks.

Bi


You are currently subscribed to ntdev as: xxxxx@nexland.com
To unsubscribe send a blank email to %%email.unsub%%

Filesystem type device only.

-----Original Message-----
From: Bi Chen [mailto:xxxxx@AppStream.com]
Sent: Wednesday, October 02, 2002 3:26 PM
To: NT Developers Interest List
Subject: [ntdev] Support WriteFileGather in driver

Hi,

Because of some incredible inefficient proprietary communication protocols
that I have to live with, I find myself having to use WriteFileGather in my
user mode driver to reduce the copy of memory. However, when I call
WriteFileGather, it always return ERROR_INVALID_PARAMETER without sending
the write request to my driver. I checked my parameters and they seem to
agree with SDK. My question is, is WriteFileGather used only on (disk or
network) file?

Here is the test code

SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
assert(sysinfo.dwPageSize == 0x1000);

PCHAR pMsgBuf = (PCHAR) VirtualAlloc(NULL, 0x4000, MEM_COMMIT,
PAGE_READWRITE);
FILE_SEGMENT_ELEMENT aSegmentArray[5] = {0};
for(int i=0; i<4; i++) {
aSegmentArray[i].Buffer = pMsgBuf + i*0x1000; }
OVERLAPPED ovlapped = {0};
ovlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
BOOL bRet = WriteFileGather(hDriver, aSegmentArray, 0x4000, NULL,
&ovlapped);
Thanks.
Bi

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to %%email.unsub%%