Error_IO_Pending

  • Follow


When using my debugger, I am getting a "Error_IO_Pending" message.

I found this, but don't understand it all.

API calls that may take a significant amount of time to complete
(MgslTransmit, MgslReceive, MgslWaitEvent, MgslGetTraceEvent) require
that the application pass an application allocated OVERLAPPED
structure to the API. Initialize the hEvent member of the overlapped
structure with the handle of a WIN32 manual reset event allocated with
CreateEvent. Set the other members of the overlapped structure to
zero. If the API returns ERROR_IO_PENDING, monitor the event with the
WIN32 functions WaitForSingleObject or WaitForMultipleObjects. When
the API signals the event object, the call is complete and returned
information is valid.

For more information about the OVERLAPPED structure, WIN32 events, and
synchronization refer to the WIN32 SDK documentation.

Implement polling by calling WaitForSingleObject with a time-out of 0,
which returns immediately with the state of the event object.
Implement blocking by setting the time-out to the macro INFINITE,
causing WaitForSingleObject to return only after the API call has
completed. Pass a finite time-out to block until completion or the
expiration of the time-out.

The API calls that use asynchronous notification can have only one
pending instance of each API call. For example, if a MgslTransmit call
is pending, the application cannot call MgslTransmit again until the
original call completes. Different API calls, such as MgslTransmit and
MgslReceive, may be simultaneously pending. Calling an API function
that uses asynchronous notification while an instance of that API call
is already pending, results in a return code of ERROR_BUSY.
CAUTION:

When calling API routines which may not complete immediately
(MgslTransmit, MgslReceive, MgslWaitEvent, and/or MgslGetTraceEvent),
it is imperative that you not make a call to the same routine passing
the same OVERLAPPED structure and event object handle if the prior
call returns ERROR_IO_PENDING.

Every API call will either complete immediately, or at a later time.
If the call returns ERROR_IO_PENDING, the call will complete as some
later time. If the call can process the request immediately, the call
completes synchronously, in a timely fashion, returning to the
application.

Thus, if a call previously returned ERROR_IO_PENDING, and the
application erroneously makes the same call, passing the same
OVERLAPPED structure and event object handle, the API will determine
that an identical call is already in progress. As the call completes
immediately, with an ERROR_BUSY status, the event object will be
signaled, indicating the call has completed.

In this case, the second call completed with an error, and the first
call is still pending. But, the event object has been signalled, which
could cause the application to believe the first operation was
completed.



..data

Provider_Name   db  "Senta",0
Failed          db  "RegisterEventSource failed.",0
AppName         db  "SiegeWorks",0
string1         db  "An unhandled exception has occurred.",0 ; 36
bytes
;string2         db  " ",0
;string3         db  " ",0

stringpointers label dword
DWORD offset string1
;DWORD offset string2
;DWORD offset string3


..DATA?

hEventLog       HWND     ?
dwEventDataSize DWORD    ?


..code

start:


    push 	offset Provider_Name
    push 	NULL
    Call 	RegisterEventSource
    push    eax
    ;int 3

..IF eax == NULL
   ;invoke GetLastError
   ;invoke wsprintf, addr OutputBuffer, addr Failed, eax
   invoke  MessageBox, NULL, addr Failed, addr AppName, MB_OK
..ELSE

;mov [dwEventDataSize], (sizeof stringpointers)

 ; bRet = ::ReportEvent(m_hEventLog,		// event log source handle
 ; 						 wType,	// event type to log
 ; 						 0,				// event category
 ; 						 0x20000001L,		// event identifier (GENERIC_MESSAGE)
 ; 						 pSid,			// user security identifier (optional)
 ; 						 1,				// number of strings to merge with message
 ; 						 0,				// size of binary data, in bytes
 ; 						 lpStrings,			// array of strings to merge with message
 ; 						 NULL);			// address of binary data


pop     eax
mov     [hEventLog], eax ; copy handle for storage

invoke ReportEvent,hEventLog,EVENTLOG_INFORMATION_TYPE,0,20000001H,
NULL,1,sizeof string1,addr stringpointers,NULL

invoke DeregisterEventSource,hEventLog

..ENDIF
0
Reply Andy 2/8/2011 3:27:46 PM

On Feb 8, 10:27=A0am, Andy <chocolatemint77...@nospicedham.yahoo.com>
wrote:
> When using my debugger, I am getting a "Error_IO_Pending" message.
>
> I found this, but don't understand it all.
>
> API calls that may take a significant amount of time to complete
> (MgslTransmit, MgslReceive, MgslWaitEvent, MgslGetTraceEvent) require
> that the application pass an application allocated OVERLAPPED
> structure to the API. Initialize the hEvent member of the overlapped
> structure with the handle of a WIN32 manual reset event allocated with
> CreateEvent. Set the other members of the overlapped structure to
> zero. If the API returns ERROR_IO_PENDING, monitor the event with the
> WIN32 functions WaitForSingleObject or WaitForMultipleObjects. When
> the API signals the event object, the call is complete and returned
> information is valid.
>

I'm just guessing, but this is common enough that it just might be the
problem.  The standard heap is marked as "serialized" -- meaning any
code trying to access that memory will be temporarily halted if
another piece of code is accessing it at the same time.  The fix is
easy enough that it is worth giving a try.

Simply create your own heap (HeapCreate) and allocate your
"application allocated OVERLAPPED structure" from this new heap.

Hope that helps.

Nathan.
0
Reply Nathan 2/8/2011 3:55:12 PM


On Feb 8, 9:55=A0am, Nathan <nathancba...@nospicedham.gmail.com> wrote:
> On Feb 8, 10:27=A0am, Andy <chocolatemint77...@nospicedham.yahoo.com>
> wrote:
>
> > When using my debugger, I am getting a "Error_IO_Pending" message.
>
> > I found this, but don't understand it all.
>
> > API calls that may take a significant amount of time to complete
> > (MgslTransmit, MgslReceive, MgslWaitEvent, MgslGetTraceEvent) require
> > that the application pass an application allocated OVERLAPPED
> > structure to the API. Initialize the hEvent member of the overlapped
> > structure with the handle of a WIN32 manual reset event allocated with
> > CreateEvent. Set the other members of the overlapped structure to
> > zero. If the API returns ERROR_IO_PENDING, monitor the event with the
> > WIN32 functions WaitForSingleObject or WaitForMultipleObjects. When
> > the API signals the event object, the call is complete and returned
> > information is valid.
>
> I'm just guessing, but this is common enough that it just might be the
> problem. =A0The standard heap is marked as "serialized" -- meaning any
> code trying to access that memory will be temporarily halted if
> another piece of code is accessing it at the same time. =A0The fix is
> easy enough that it is worth giving a try.
>
> Simply create your own heap (HeapCreate) and allocate your
> "application allocated OVERLAPPED structure" from this new heap.
>
> Hope that helps.
>
> Nathan.

Thanks for your help.

I took your advice and used HeapCreate and HeapAlloc and that problem
is fixed.

I am now getting an Invalid_Parameter with this line in my code:

invoke ReportEvent,hEventLog,EVENTLOG_INFORMATION_TYPE,0,20000001H,
NULL,1,sizeof string1,addr stringpointers,NULL

Andy
0
Reply Andy 2/9/2011 3:34:31 PM

2 Replies
506 Views

(page loaded in 0.919 seconds)

Similiar Articles:













7/24/2012 3:10:26 PM


Reply: