RasGetErrorString
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 |
); |
|
Parameters
uErrorValue
Specifies the
error value of interest. These are values returned by one of the RAS functions:
those listed in the RAS header file.
lpszErrorString
Points to a
buffer that the function will write the error string to. This parameter must
not be NULL.
cBufSize
Specifies the
size, in characters, of the buffer pointed to by lpszErrorString.
Return Values
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
Remarks
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.
See Also