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 RAS API functions use
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 as lpszErrorString.