Compiling and Linking

When you develop a RAS application, you need to include the following header and library files to build your application:

  • Ras.h Contains the function prototypes and data structures used by RAS API functions
  • Raserror.h Contains predefined error codes used in RAS API functions when they fail
  • Rasapi32.lib Library of all RAS API functions

Raserror.h lists quite a few predefined error codes. In this file, you will notice an error description string associated with each error code used in RAS. RAS features a useful function named RasGetErrorString that allows you to programmatically retrieve the error strings associated with specific RAS error codes. RasGetErrorString is defined as

 DWORD RasGetErrorString( UINT uErrorValue, LPTSTR lpszErrorString, DWORD cBufSize ); 

The uErrorValue parameter receives a specific RAS error code returned from a RAS function. The lpszErrorString parameter is an application-supplied buffer that will receive the error string associated with the error code in uErrorValue. You should make your buffer large enough to hold an error string; otherwise, this function will fail with error ERROR_INSUFFICIENT_BUFFER. We recommend setting your buffer size to at least 256 characters, which should accommodate any RAS error string available today. The final parameter, cBufSize, is the size of the buffer you supplied to lpszErrorString.



Network Programming for Microsoft Windows
Linux Server Hacks, Volume Two: Tips & Tools for Connecting, Monitoring, and Troubleshooting
ISBN: 735615799
EAN: 2147483647
Year: 1998
Pages: 159

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net