PFNRASRECEIVEBUFFER callback function (ras.h)
The custom-scripting DLL calls the RasReceiveBuffer function to inform RAS that it is ready to receive data from the server over the specified port.
The PFNRASRECEIVEBUFFER type defines a pointer to this callback function. RasReceiveBuffer is a placeholder for the application-defined function name.
Syntax
PFNRASRECEIVEBUFFER Pfnrasreceivebuffer;
DWORD Pfnrasreceivebuffer(
HANDLE hPort,
PBYTE pBuffer,
PDWORD pdwSize,
DWORD dwTimeOut,
HANDLE hEvent
)
{...}
Parameters
hPort
Handle to the port on which to receive the data. This handle should be the handle passed in by RAS as the first parameter of the RasCustomScriptExecute function.
pBuffer
Pointer to a buffer to receive the data from the port specified by the hPort parameter. Obtain this buffer using RasGetBuffer function.
pdwSize
Pointer to a DWORD variable that receives the size of the data returned in the buffer pointed to by the pBuffer parameter.
dwTimeOut
hEvent
Handle to an event object that RAS will signal when the received data is available.
Return value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value can be one of the following error codes.
Value | Meaning |
---|---|
|
The pointer to the buffer passed in the pBuffer parameter is invalid. |
|
The handle specified by the hPort parameter is invalid. |
Remarks
RasReceiveBuffer is an asynchronous function. RasReceiveBuffer returns immediately even if the data is not yet available. The custom-scripting DLL must wait on the event object specified by the hEvent parameter. When the data is available, RAS signals this event. The custom-scripting DLL should then call the RasRetrieveBuffer function to obtain the data. The custom-scripting DLL may pass the same buffer pointer in RasRetrieveBuffer that it passed in RasReceiveBuffer.
RAS also signals the event object if, for some reason, the port is disconnected before the data is posted. In this case, RasRetrieveBuffer returns an error defined in Raserror.h, that indicates the cause of the failure.
The custom-scripting DLL calls RasReceiveBuffer through a function pointer. The function pointer is passed to the custom-scripting DLL as a parameter when RAS calls the DLL's implementation of RasCustomScriptExecute.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | ras.h |