OpENer - Open Source EtherNet/IP(TM) I/O Target Stack  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
opener_error.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2009, Rockwell Automation, Inc.
3  * All rights reserved.
4  *
5  ******************************************************************************/
6 
13  #include <windows.h>
14 
15  #include "opener_error.h"
16 
18  return WSAGetLastError();
19 }
20 
21 char *GetErrorMessage(int error_number) {
22  char *error_message = NULL;
23  FormatMessage(
24  FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
25  NULL,
26  error_number,
27  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
28  &error_message,
29  0,
30  NULL);
31  return error_message;
32 }
33 
34 void FreeErrorMessage(char *error_message) {
35  LocalFree(error_message);
36 }
char * GetErrorMessage(int error_number)
Returns a human readable message for the given error number.
Definition: opener_error.c:21
This file includes the prototypes for error resolution functions like strerror_r or WSAGetLastError...
void FreeErrorMessage(char *error_message)
Frees the space of the error message generated by GetErrorMessage(int)
Definition: opener_error.c:34
int GetSocketErrorNumber()
Gets the error number or equivalent.
Definition: opener_error.c:17