RPC_ASYNC_STATE

The RPC_ASYNC_STATE structure holds the state of an asynchronous remote procedure call. PRPC_ASYNC_STATE is a handle to this structure, used to wait for, query, reply to, or cancel asynchronous calls.

typedef struct _RPC_ASYNC_STATE {
  unsigned int    Size;
  unsigned long    Signature;
  long    Lock;
  void *    StubInfo
  void *    UserInfo
  void *    RuntimeInfo
  RPC_ASYNC_EVENT    Event
  RPC_NOTIFICATION_TYPES    NotificationType
  union {    
     struct {    
        PFN_RPCNOTIFICATION_ROUTINE    NotificationRoutine;
        HANDLE     hThread;
               }     APC;
     struct {    
        HANDLE     hIOPort;
        DWORD    dwNumberOfBytesTransferred;
        DWORD     dwCompletionKey;
        LPOVERLAPPED    lpOverlapped;
               }            IOC;
     struct {    
        HWND     hWnd;
        UINT     Msg
              }     HWND;//not implemented in Beta1
     HANDLE     hEvent;
     PFN_RPCNOTIFICATION_ROUTINE     NotificationRoutine;
          }     u;
  long     Reserved[4];
} RPC_ASYNC_STATE, *PRPC_ASYNC_STATE ;
Size

The size, in bytes, of this structure. The run-time environment sets this field when RpcAsyncInitializeHandle is called. Do not modify this field.

Signature

The run-time environment sets this field when RpcAsyncInitializeHandle is called. Do not modify this field.

Lock;

The run-time environment sets this field when RpcAsyncInitializeHandle is called. Do not modify this field.

StubInfo
Reserved for use by the stubs. Do not use this field.
UserInfo
Use this field for any application-specific information that you want to keep track of in this structure.
RuntimeInfo
Reserved for use by the RPC run-time environment. Do not use this field.
Event
Specifies the type of event that occurred. The RPC run-time environment sets this field.
NotificationType
Specifies the kind of notification in use. See the Remarks section below for a description of notification types.
APC
Structure used for notification by Windows asynchronous procedure call (APC).
NotificationRoutine
Calls the user-defined APC notification routine.
hThread
The handle to the thread making the asynchronous call. A value of zero indicates the current thread.
IOC
Structure used for notification by I/O completion port.
hIOPort
Handle to the I/O completion port.
dwNumberOfBytesTransferred
Set by the calling application (either client or server).
dwCompletionKey
Set by the calling application (either client or server).
lpOverlapped
The address of the OVERLAPPED structure containing state information needed for I/O completion..
HWND
Structure used for notification by Windows message. LPARAM points to the asynchronous handle for the call. Not implemented in Windows NT 5.0 Beta 1.
hWnd
Identifies the window to which the message should be posted.
Msg
The message to be posted.
hEvent
Handle used for notification by an event.
NotificationRoutine
DCOM uses this internally for direct callbacks. Do not use this field.
Reserved[4]
Reserved for compatibility with future versions, if any. Do not use this field.

Remarks

The client allocates space for the RPC_ASYNC_STATE structure and an associated handle, and calls RpcAsyncInitializeHandle to initialize the structure. After the run-time environment has successfully initialized the structure, the client initializes the NotificationType, NotificationRoutine, hThread and UserInfo fields. The notification type may be any one of the following:

Notification Type Description
RpcNotificationTypeNone There is no notification.
RpcNotificationTypeEvent Notification by event.
RpcNotificationTypeApc Notification by Win32 Asynchronous Procedure Calls.
RpcNotificationTypeIoc Notification by I/O completion port.
RpcNotificationTypeHwnd Notification by Windows message.

See Also

Asynchronous RPC, RpcAsyncAbortCall, RpcAsyncCancelCall, RpcAsyncCompleteCall, RpcAsyncGetCallHandle, RpcAsyncGetCallStatus, RpcAsyncInitializeHandle, RpcAsyncRegisterInfo, RpcServerTestCancel