RE: Simple questio on Buffered I/O
- From: "JimE" <JimE@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 18 Jun 2006 04:03:47 GMT
Try calling CreateEvent with FALSE as the second parameter. Setting
bManualReset to TRUE requires calling ResetEvent to set the overlapped
structure to the non-signalled state. WaitForSingleObject is likely returning
immediately because the object is already signalled.
"Vijay" wrote:
Application.
--------------
buff[256]
for(bus=0;bus<256;bus++)
for(dev=0;dev<32;dev++)
for(fun=0;fun<8;fun++)
ReadConfig(bus,dev,fun,buff);
print(output);
dll
----
ReadConfig(bud,dev,fn,*output)
{
Overlapped ol;
ol.hEvent=CreateEvent(NULL, TRUE, FALSE, NULL);
if( ! deviceIoControl( h, ioctl ,&inp, inputlen, &output ,outputLen, &ol))
{
dwWaitResult = WaitForSingleObject(
ol.hEvent, // handle to event
INFINITE); // two-second time-out interval
switch (dwWaitResult)
{
case WAIT_OBJECT_0:
ResetEvent(ol.hEvent);
break;
// Cannot get mutex ownership due to time-out.
case WAIT_TIMEOUT:
printf("\nTimeOut");
numread = 0;
break ;
// Got ownership of the abandoned mutex object.
case WAIT_ABANDONED:
numread = 0;
printf("\nAbondoned");
break;
}
}
else
{
printf("IOCTL_PCIE_READ_CONFIG done ");
printf("*** Device IO CONTROL Done!!!!!!!!!!!!!!!\n");
}
}
}
when i run the application
I recieve 0xCCCCCCCC in the user buffer..
In IRP_MJ_DEVICE_CONTROL handler is complete Irp Saying STATUS_PENDING.
& in startIO i get the irp & complete it .
I am able to view the contents of Irp->AssociatedIrp.SystemBuffer filled
with relavent values.but not in the application??
How an overlapped operation in Win32 done..? i mean every call should the
Overlapped structure hEvent be called with CreateEvent & on Signaled state
Calling ResetEvent...?
I tried without Overlapped.. Just in the IRP_MJ_DEVICE_CONTROL handler i
tried to complete the IRP..
In this case the arguments which i passed to deviceIocontrol was itself
getting corrupted??
i tried to print the arguments before the call DeviceIOcontrol..
Busno & dev number & function number is some garbage value..it prints some
negative values??
Is there any dependency on input buffer & output Buffer in buffered mechanism?
Then why it is not working is biggest puzzle to me.
Any suggestion will be of Great help
--
Vijay
PIC ,Bangalore
- Follow-Ups:
- Re: Simple questio on Buffered I/O
- From: Alexander Grigoriev
- Re: Simple questio on Buffered I/O
- From: Mark Roddy
- Re: Simple questio on Buffered I/O
- References:
- Simple questio on Buffered I/O
- From: Vijay
- Simple questio on Buffered I/O
- Prev by Date: LNK2019 errors w/ Visual Studio 2003 & DDK 3790
- Next by Date: Re: FilterGraphics
- Previous by thread: Simple questio on Buffered I/O
- Next by thread: Re: Simple questio on Buffered I/O
- Index(es):
Relevant Pages
|