RE: Simple questio on Buffered I/O



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
.



Relevant Pages

  • RE: Simple questio on Buffered I/O
    ... Try calling CreateEvent with FALSE as the second parameter. ... structure to the non-signalled state. ... > Is there any dependency on input buffer & output Buffer in buffered mechanism? ...
    (microsoft.public.development.device.drivers)
  • Re: C# System.String Memory Usage [TCP IP Connections]
    ... If you're getting 5x the TCPIP performance by calling GC.Collect, ... suffering very badly from heap fragmentation due to all the pinning that's ... call "GC.Collect" is just before you're forced to grow your buffer pool. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: C# System.String Memory Usage [TCP IP Connections]
    ... If you're getting 5x the TCPIP performance by calling GC.Collect, ... suffering very badly from heap fragmentation due to all the pinning that's ... "GC.Collect" is just before you're forced to grow your buffer pool. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Winsock -> Out of stack space
    ... there is a calling to same routine again and again. ... Regarding removing loop from dataarrival event: ... > remove it from the buffer. ... If no complete request is found let the event ...
    (microsoft.public.vb.controls)
  • Re: MmGetSystemAddressForMdlSafe
    ... Why are you calling it with priority set to High? ... The function can fail when there's not enough kernel address space avaialble to map the buffer. ... MDLs always describe locked memory ranges - if you have one you don't need to lock it. ... Do i need to lock and MDL before calling this function? ...
    (microsoft.public.win32.programmer.kernel)