The RasSecurityDialogReceive function starts an asynchronous operation that receives a remote user’s response to a security challenge. The response is the input that the user typed in a terminal window on the remote computer. A third-party RAS security DLL calls this function as part of its authentication of the remote user.
To call this function, you must first call the LoadLibrary function to load RASMAN.DLL. Then call the GetProcAddress function to get the DLL’s RasSecurityDialogReceive entry point.
DWORD WINAPI RasSecurityDialogReceive(
HPORT hPort, |
// RAS handle to the port |
PBYTE pBuffer, |
// pointer to buffer that receives the user’s response |
PWORD pBufferLength, |
// returns size, in bytes, of the data received |
DWORD Timeout, |
// time-out period, in seconds |
HANDLE hEvent |
// event that is signaled when operation is finished |
); |
If this value is zero, there is no time-out period; that is, the RAS server
does not signal the event object until the receive operation has been
completed.
If the function is successful, the return value is PENDING (defined in RASERROR.H). This indicates that the receive operation is in progress.
If an error occurs, the return value is one of the error codes defined in RASERROR.H or WINERROR.H. GetLastError does not provide extended error information.
After calling the RasSecurityDialogSend function to send a security challenge to the remote user, the security DLL must call the RasSecurityDialogReceive function to get the user’s response.
The RasSecurityDialogReceive function is asynchronous. When the function returns, the security DLL must use one of the wait functions, such as WaitForSingleObject, to wait for the hEvent event object to be signaled. The RAS server signals the event object when the receive operation has been completed or when the time-out interval has elapsed. If the receive operation is successful, the pBuffer buffer contains the response from the remote user, and the pBufferLength parameter indicates the number of bytes received. If the remote user sends more bytes than will fit in the buffer, the RAS server buffers the excess bytes and returns them in the next RasSecurityDialogReceive call.
You can use the Timeout parameter to specify a time-out interval. If the time-out elapses, the RAS server signals the event object, and the pBufferLength parameter indicates that zero bytes were transferred. Alternatively, you can set Timeout to zero, and specify a time-out interval in the wait function that you use to wait for the event object to be signaled.
When a security DLL is authenticating a remote user, the connection operation on the remote computer enters a RASCS_Interactive paused state. The message sent by RasSecurityDialogSend is displayed as output in a terminal window on the remote computer. The response received by RasSecurityDialogReceive is the input that the remote user types in the terminal window. The RASCS_Interactive value is defined in the RASCONNSTATE enumeration.
CreateEvent, GetProcAddress, LoadLibrary, RASCONNSTATE, RasSecurityDialogSend, WaitForSingleObject