<div class="content" name="RpcRegisterAsyncNotification" uuid="bb3d1c58-f397-472e-82ed-44c242846464"><p>The RpcRegisterAsyncNotification method registers for an
event or events happening on a <span><a href="c41d3367-04c9-4c93-babf-9b5de834eb29#gt_b416f72e-cf04-4d80-bf93-f5753f3b0998" data-linktype="relative-path">terminal server</a></span>. The
caller MUST call <span><a href="81d5ba34-2ae4-4614-9aca-8deb1eb7a0a1" data-linktype="relative-path">RpcWaitAsyncNotification</a></span>
after calling RpcRegisterAsyncNotification to wait for the notification. No
special permissions are required to call this method.</p><dl>
<dd>
<div><pre> HRESULT RpcRegisterAsyncNotification(
   [in] handle_t hBinding,
   [in] LONG SessionId,
   [in] TNotificationId Mask,
   [out] NOTIFY_HANDLE* phNotify
 );
</pre></div>
</dd></dl><p><b>hBinding: </b> The <span><a href="c41d3367-04c9-4c93-babf-9b5de834eb29#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span> binding <span><a href="c41d3367-04c9-4c93-babf-9b5de834eb29#gt_5044babb-08e3-4bb9-bc12-fe8f542b05ee" data-linktype="relative-path">handle</a></span>.
For more information, see <span><a href="https://go.microsoft.com/fwlink/?LinkId=93771" data-linktype="external">[MSDN-RPCBIND]</a></span>.</p><p><b>SessionId: </b> The ID of the session for which to
wait for notification. If the value is -1, the call will register for
notification for all sessions running on the terminal server. This MUST NOT be
the session ID of any of the <span><a href="c41d3367-04c9-4c93-babf-9b5de834eb29#gt_1e5aa0c2-4617-4d7a-969e-a7091c415c8d" data-linktype="relative-path">listener</a></span> sessions.</p><p><b>Mask: </b> Specifies the type of notification to
wait for. This is of the type <span><a href="f8f4a0d1-98da-4125-994d-206d4198f03c" data-linktype="relative-path">TNotificationId</a></span>.</p><p><b>phNotify: </b>Handle to the notification object.
For more information, see <span><a href="557683a8-2f4a-416a-bb15-fa353fdc4aed" data-linktype="relative-path">NOTIFY_HANDLE</a></span>.</p><p><b>Return Values: </b> The method MUST return S_OK
(0x00000000) on success; otherwise, it MUST return an implementation-specific
negative value.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 S_OK</td>
  <td>Successful completion.</td>
 </tr></tbody></table>
</dd></dl><p> </p></div>