RasCustomScriptExecuteFn callback function (ras.h)

RAS calls the RasCustomScriptExecute function when establishing a connection for a phone-book entry that has the RASEO_CustomScript option set.

Syntax

RasCustomScriptExecuteFn Rascustomscriptexecutefn;

DWORD Rascustomscriptexecutefn(
  [in] HANDLE hPort,
  [in] LPCWSTR lpszPhonebook,
  [in] LPCWSTR lpszEntryName,
  [in] PFNRASGETBUFFER pfnRasGetBuffer,
  [in] PFNRASFREEBUFFER pfnRasFreeBuffer,
  [in] PFNRASSENDBUFFER pfnRasSendBuffer,
  [in] PFNRASRECEIVEBUFFER pfnRasReceiveBuffer,
  [in] PFNRASRETRIEVEBUFFER pfnRasRetrieveBuffer,
  [in] HWND hWnd,
  [in] RASDIALPARAMS *pRasDialParams,
       PVOID pvReserved
)
{...}

Parameters

[in] hPort

Handle to the port on which the connection is established. Use this handle when sending or receiving data on the port.

[in] lpszPhonebook

Pointer to a Unicode string that contains the path to the phone book in which the entry for the connection resides.

[in] lpszEntryName

Pointer to a Unicode string that contains the name of the entry that was dialed to establish the connection.

[in] pfnRasGetBuffer

Pointer to a function of type PFNRASGETBUFFER. The custom-scripting DLL should use this function to allocate memory to send data to the server.

[in] pfnRasFreeBuffer

Pointer to a function of type PFNRASFREEBUFFER. The custom-scripting DLL should use this function to free memory allocated by the pfnRasGetBuffer function.

[in] pfnRasSendBuffer

Pointer to a function of type PFNRASSENDBUFFER. The custom-scripting DLL uses this function to communicate with the server over the specified port.

[in] pfnRasReceiveBuffer

Pointer to a function of type PFNRASRECEIVEBUFFER. The custom-scripting DLL uses this function to communicate with the server over the specified port.

[in] pfnRasRetrieveBuffer

Pointer to a function of type PFNRASRETRIEVEBUFFER. The custom-scripting DLL uses this function to communicate with the server over the specified port.

[in] hWnd

Handle to a window that the custom-scripting DLL can use to present a user interface to the user.

[in] pRasDialParams

Pointer to a Unicode RASDIALPARAMS structure. This structure contains the authentication credentials for the user. The custom-scripting DLL can modify the szUserName, szPassword, and szDomain members of this structure. The Point-to-Point Protocol (PPP) will use whatever is stored in these members when RasCustomScriptExecute returns.

pvReserved

Return value

If the function succeeds, the return value should be ERROR_SUCCESS.

If the function fails, the return value should be an appropriate error code from Winerror.h or Raserror.h.

Remarks

When RAS calls RasCustomScriptExecute, the pRasDialParams parameter will point to the Unicode RASDIALPARAMS structure. That is, the structure contains only Unicode strings.

In some cases, the szUserName of the RASDIALPARAMS structure will be an empty string. In these cases, the custom-scripting DLL should use the Unicode version of the GetUserName function to obtain the name of the current user.

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

See also

RAS Custom-Scripting

RasFreeBuffer

RasGetBuffer

RasReceiveBuffer

RasRetrieveBuffer

RasSendBuffer