Example #1
0
/*
 * This routine checks the error value and calls the WSA Windows Sockets
 * Error message function GetWSAErrorMessage below if it's within that range
 * since those messages are not available in the system error messages.
 */
char *
NTstrerror(int err, BOOL *bfreebuf) {
	char *retmsg = NULL;

	/* Copy the error value first in case of other errors */	
	DWORD errval = err; 

	*bfreebuf = FALSE;

	/* Get the Winsock2 error messages */
	if (errval >= WSABASEERR && errval <= (WSABASEERR + 1015)) {
		retmsg = GetWSAErrorMessage(errval);
		if (retmsg != NULL)
			return (retmsg);
	}
	/*
	 * If it's not one of the standard Unix error codes,
	 * try a system error message
	 */
	if (errval > (DWORD) _sys_nerr) {
		*bfreebuf = TRUE;
		return (FormatError(errval));
	} else {
		return (strerror(errval));
	}
}
Example #2
0
/*
 * This routine checks the error value and calls the WSA Windows Sockets
 * Error message function GetWSAErrorMessage below if it's within that range
 * since those messages are not available in the system error messages.
 */
static char *
isc__NTstrerror(int err) {
	char *retmsg = NULL;

	/* Copy the error value first in case of other errors */	
	DWORD errval = err; 

	/* Get the Winsock2 error messages */
	if (errval >= WSABASEERR && errval <= (WSABASEERR + 1015)) {
		retmsg = GetWSAErrorMessage(errval);
		if (retmsg != NULL)
			return (retmsg);
	}
	/*
	 * If it's not one of the standard Unix error codes,
	 * try a system error message
	 */
	if (errval > (DWORD) _sys_nerr) {
		return (FormatError(errval));
	} else {
		return (_sys_errlist[errval]);
	}
}