The RasGetErrorString function obtains an error message string for a specified RAS error value.
DWORD RasGetErrorString (
UINT uErrorValue, |
// error to get string for |
LPTSTR lpszErrorString, |
// buffer to hold error string |
DWORD cBufSize |
// size, in characters, of buffer |
); |
If the function succeeds, the return value is zero.
If the function fails, the return value is a nonzero error value. This value is ERROR_INVALID_PARAMETER or the GetLastError value returned from the functions GlobalAlloc or LoadString. The function does not set a thread’s last error information; that is, there is no GetLastError information set by the RasGetErrorString function.
There is no way to determine in advance the exact size in characters of an error message, and thus the size of buffer required. Error messages will generally be 80 characters or fewer in size; a buffer size of 256 characters will always be adequate. A buffer of insufficient size causes the RasGetErrorString function to fail, returning ERROR_INSUFFICIENT_BUFFER. Note that buffer sizes are specified in characters, not bytes; thus, the Unicode version of RasGetErrorString requires a 512 byte buffer to guarantee that every error message will fit.