I am trying to port a old wdm driver to UMDF and ran into a problem. I hope
some WDF experts out there can shed some lights for me.
Basically, there is a structure defines as follows:
typedef struct _VendorRequest
{
UINT32 xxx;
UINT32 yyy;
PVOID pDataBuffer ;
UINT32 dataLength;
} SVendorRequest, *PSVendorRequest;
and applications is trying to pass this structure as input buffer when
calling DeviceIoControl
PSVendorRequest vr = (PSVendorRequest) malloc(sizeof (SVendorRequest) + 8);
vr->xxx = xxx;
vr->yyy = yyy;
vr->pDataBuffer = (uint8_t *)(vr + 1) ;
vr->dataLength = 8;
ptr = (uint8_t *)(vr + 1);
ptr[0] = something;
ptr[1] = something;
ptr[2] = something;
ptr[3] = something;
ptr[4] = something;
ptr[5] = something;
ptr[6] = something;
ptr[7] = something;
dwInSize = sizeof(SVendorRequest);
dwInSize += vr->dataLength;
DeviceIoControl((HANDLE) handle,
IOCTL_VENDOR_REQUEST_EX,
(LPVOID) regParam, // Ptr to InBuffer
dwInSize, // Length of InBuffer
NULL, // Ptr to OutBuffer
0, // Length of OutBuffer
(LPDWORD) &nBytesRead,
0);
The problem is: when the intput buffer gets to the OnDeviceIoControl
function in my UMDF driver, all the structure members xxx, yyy and dataLength
are all correct, but the pDataBuffer is either pointing to some invalid
addresses, or all the data become 0.
I have tried both Buffered IO or Direct IO but both of them have the same
problem. However, the same method works with KMDF and WDM driver.
I am just wondering has anyone out there seen this problem before?
Thanks in advance.
G.
there is a typo in my previous post, the correct DeviceIoControl code should
be:
DeviceIoControl((HANDLE) handle,
IOCTL_VENDOR_REQUEST_EX,
(LPVOID) vr, // Ptr to InBuffer
--
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
"gti4ever" <gti4...@discussions.microsoft.com> wrote in message
news:856B6E72-12D5-44B1...@microsoft.com...
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4734 (20100101) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4734 (20100101) __________
The message was checked by ESET NOD32 Antivirus.
I digged into this issue further and found there is a way to do
METHOD_NEITHER stuff in UMDF. You will have to add UmdfMethodNeitherAction =
Copy to your INF file.
I will try that later and see if it works.
G.
"Don Burn" wrote:
> .
>
typedef struct _VendorRequest
{
UINT32 xxx;
UINT32 yyy;
UINT8 pDataBuffer[10] ;
} SVendorRequest, *PSVendorRequest;
Now I can use this structure to pass data to the lower KMDF driver to set
some registers. However, if I try to read registers, the pDataBuffer always
returns all 0s. I put breakpoint in the lower KMDF driver and did see the
right register value got copied to the pDataBuffer but when the io control
returned from UMDF, the buffer is still 0.
What did I do wrong? How does UMDF handle the buffered IO? If the same data
can be passed in as input buffer, how come the data can't be returned in the
same buffer?
G
d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"gti4ever" <gti4...@discussions.microsoft.com> wrote in message
news:9062FEB8-4E68-445D...@microsoft.com...
Thank you Doron and Don for the answers and helps, my new driver is up and
running now.
I am still curious to see how UMDF handles METHOD_NEITHER, but that is low
priority now.
G.
d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"gti4ever" <gti4...@discussions.microsoft.com> wrote in message
news:C9C82D72-9A83-456E...@microsoft.com...