3.1.4.1.66 ApiGetNotify (Opnum 65)

(Protocol Version 2) The ApiGetNotify method instructs the server to retrieve the first queued event indication from the designated version 1 notification port. The server MUST NOT complete this method until an indication has been queued to the port or the port has been closed through a separate call to the ApiUnblockGetNotifyCall (section 3.1.4.1.107) method or the ApiCloseNotify (section 3.1.4.1.57).

The server MUST NOT return the following CLUSTER_CHANGE (section 2.2.2.7) enumeration values in the dwFilter parameter: CLUSTER_CHANGE_REGISTRY_SUBTREE, CLUSTER_CHANGE_CLUSTER_STATE, CLUSTER_CHANGE_CLUSTER_RECONNECT, or CLUSTER_CHANGE_HANDLE_CLOSE.

The server SHOULD accept an ApiGetNotify request if its protocol server state is read-only, and MUST accept the request for processing if it is in the read/write state, as specified in section 3.1.1.

 error_status_t ApiGetNotify(
   [in] HNOTIFY_RPC hNotify,
   [in] DWORD Timeout,
   [out] DWORD *dwNotifyKey,
   [out] DWORD *dwFilter,
   [out] DWORD *dwStateSequence,
   [out, string] LPWSTR *Name
 );

hNotify: An HNOTIFY_RPC (section 2.2.1.6) context handle that was obtained in a previous ApiCreateNotify (section 3.1.4.1.56) method call.

Timeout: The amount of time, in milliseconds, the call will wait in the server for an event indication to be posted to the port. The server MUST initialize the GetNotify timer associated with the notification port to this value. If no indication is received before the GetNotify timer expires the server MUST complete the method with status WAIT_TIMEOUT (0x00000102). The server MUST cancel the GetNotify timer upon completing the method for any other reason.

dwNotifyKey: The address of a 32-bit integer that the server MUST write upon successful completion of this method. The value was supplied as the dwNotifyKey parameter in a previous call to one of the following methods: ApiAddNotifyCluster (section 3.1.4.1.58), ApiAddNotifyNode (section 3.1.4.1.59), ApiAddNotifyGroup (section 3.1.4.1.60), ApiAddNotifyResource (section 3.1.4.1.61), ApiAddNotifyKey (section 3.1.4.1.62), ApiAddNotifyNetwork (section 3.1.4.1.90), ApiAddNotifyNetInterface (section 3.1.4.1.99), ApiReAddNotifyNode (section 3.1.4.1.63), ApiReAddNotifyGroup (section 3.1.4.1.64), ApiReAddNotifyResource (section 3.1.4.1.65), ApiReAddNotifyNetwork (section 3.1.4.1.91), or ApiReAddNotifyNetInterface (section 3.1.4.1.100).

dwFilter: The address of a 32-bit integer value that the server MUST write upon successful completion of this method, which contains the CLUSTER_CHANGE (section 2.2.2.7) enumeration value, as specified in section 2.2.2.7, indicating the type of event. The value MUST match one or more filter blocks that were provided in a previous call to one of the following methods: ApiAddNotifyCluster (section 3.1.4.1.58), ApiAddNotifyNode (section 3.1.4.2.59), ApiAddNotifyGroup (section 3.1.4.1.60), ApiAddNotifyResource (section 3.1.4.2.61), ApiAddNotifyKey (section 3.1.4.1.62), ApiAddNotifyNetwork (section 3.1.4.1.90), ApiAddNotifyNetInterface (section 3.1.4.1.99), ApiReAddNotifyNode (section 3.1.4.1.63), ApiReAddNotifyGroup (section 3.1.4.1.64), ApiReAddNotifyResource (section 3.1.4.1.65), ApiReAddNotifyNetwork (section 3.1.4.1.91), or ApiReAddNotifyNetInterface (section 3.1.4.1.100).

dwStateSequence: The address of a 32-bit integer value that the server MUST write upon successful completion of this method. The client MUST retain this value for reuse when calling any of the following methods: ApiReAddNotifyNode (section 3.1.4.1.63), ApiReAddNotifyGroup (section 3.1.4.1.64), ApiReAddNotifyResource (section 3.1.4.1.65), ApiReAddNotifyNetwork (section 3.1.4.1.91), or ApiReAddNotifyNetInterface (section 3.1.4.1.100).

Name: The address of a pointer where the server MUST write, upon successful completion of this method, the address of a Unicode string buffer that contains the name of the object to which the event pertains. If a name is not associated with the event, then the buffer contains the null Unicode string.

Return Values: The method MUST return the following error codes for the specified conditions.

Return value/code

Description

0x00000000

ERROR_SUCCESS

Success.

0x00000006

ERROR_INVALID_HANDLE

The data that is pointed to by the hNotify parameter does not represent a valid HNOTIFY_RPC (section 2.2.1.6) context handle.

0x00000103

ERROR_NO_MORE_ITEMS

The notify port represented by the hNotify parameter has been closed.

0x00000001

ERROR_INVALID_FUNCTION

Either the ApiCloseNotify (section 3.1.4.1.57) method or the ApiUnblockGetNotifyCall (section 3.1.4.1.107) method has been called in another thread. The client SHOULD kill the notification thread.

0x00000102

WAIT_TIMEOUT

The time designated by the Timeout parameter expired before an event indication was posted to the port.

For any other condition, this method MUST return a value that is not one of the values listed in the preceding table. The client MUST behave in one consistent, identical manner for all values that are not listed in the preceding table. The client SHOULD treat errors specified in section 3.2.4.6 as recoverable errors and initiate the reconnect procedure as specified in section 3.2.4.6.