ReactOS  0.4.12-dev-18-gf469aca
tnerror.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int printm (LPTSTR szModule, BOOL fSystem, DWORD dwMessageId,...)
 
void LogErrorConsole (LPTSTR szError)
 
int printit (const char *it)
 

Variables

int Telnet_Redir
 

Function Documentation

◆ LogErrorConsole()

void LogErrorConsole ( LPTSTR  szError)

Definition at line 125 of file tnerror.cpp.

126 {
127  DWORD dwLastError = GetLastError();
128 
129  const int cbLastError = 1024;
130  TCHAR szLastError[cbLastError];
132  szLastError, cbLastError, 0);
133 
134  LPTSTR lpszStrings[2];
135  lpszStrings[0] = szError;
136  lpszStrings[1] = szLastError;
137 
138  const int cbErrorString = 1024;
139  TCHAR szErrorString[cbErrorString];
142  szErrorString, cbErrorString, (va_list*)lpszStrings);
143 
144  time_t dwTime;
145  time(&dwTime);
146  char* szTime = ctime(&dwTime);
147  szTime[19] = 0;
148 
149  // printf("E %s %s", szTime + 11, szErrorString);
150  char * buf;
151  buf = new char [ 3 + strlen(szTime) - 11 + strlen(szErrorString) + 5 ];
152  sprintf( buf,"E %s %s", szTime + 11, szErrorString);
153  printit(buf);
154  delete [] buf;
155 }
TCHAR szTime[64]
Definition: solitaire.cpp:18
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:405
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
__u16 time
Definition: mkdosfs.c:366
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define sprintf(buf, format,...)
Definition: sprintf.c:55
char * va_list
Definition: acmsvcex.h:78
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:403
DWORD dwTime
Definition: solitaire.cpp:25
char TCHAR
Definition: xmlstorage.h:189
__u16 ctime
Definition: mkdosfs.c:362
unsigned long DWORD
Definition: ntddk_ex.h:95
int printit(const char *it)
Definition: tnerror.cpp:58
#define FormatMessage
Definition: winbase.h:3609
__kernel_time_t time_t
Definition: linux.h:252
#define MSG_ERROR
Definition: resource.h:10
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50

◆ printit()

int printit ( const char it)

Definition at line 58 of file tnerror.cpp.

Referenced by TConsole::Beep(), cfgets(), Telnet::Connect(), TMapLoader::Display(), TMapLoader::Load(), LogErrorConsole(), LogInfoConsole(), LogWarningConsole(), main(), TTelnetHandler::ParseIAC(), TConfig::print_aliases(), TConfig::print_groups(), TConfig::print_value(), TConfig::print_vars(), printm(), printUsage(), and telCommandLine().

58  {
59  DWORD numwritten;
60  if (!ini.get_output_redir()) {
61  if (!WriteConsole(
62  GetStdHandle(STD_OUTPUT_HANDLE), // handle of a console screen buffer
63  it, // address of buffer to write from
64  strlen(it), // number of characters to write
65  &numwritten, // address of number of characters written
66  0 // reserved
67  )) return -1;
68  // FIX ME!!! We need to tell the console that the cursor has moved.
69  // Does this mean making Console global?
70  // Paul Brannan 6/14/98
71  // Console.sync();
72  }else{
73  if (!WriteFile(
74  GetStdHandle(STD_OUTPUT_HANDLE), // handle of a console screen buffer
75  it, // address of buffer to write from
76  strlen(it), // number of characters to write
77  &numwritten, // address of number of characters written
78  NULL // no overlapped I/O
79  )) return -1;
80  }
81  return 0;
82 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
smooth NULL
Definition: ftsmooth.c:416
TConfig ini
Definition: tnconfig.cpp:45
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
#define STD_OUTPUT_HANDLE
Definition: winbase.h:265
int get_output_redir() const
Definition: tnconfig.h:43
#define WriteConsole
Definition: wincon.h:772

◆ printm()

int printm ( LPTSTR  szModule,
BOOL  fSystem,
DWORD  dwMessageId,
  ... 
)

Definition at line 84 of file tnerror.cpp.

Referenced by Telnet::Connect(), TMapLoader::Display(), Telnet::DoInit(), getLongComment(), TTelnetHandler::Go(), TConfig::init(), TMapLoader::Load(), TMapLoader::LoadCharMap(), TMapLoader::LoadGlobal(), Telnet::LoadKeyMap(), main(), Telnet::NewProcess(), Telnet::Open(), printUsage(), TConfig::Process_Params(), Telnet::SwitchKeyMap(), and telCommandLine().

85 {
86  int Result = 0;
87 
88  HMODULE hModule = 0;
89  if (szModule)
90  hModule = LoadLibrary(szModule);
91 
92  va_list Ellipsis;
93  va_start(Ellipsis, dwMessageId);
94 
95  LPTSTR pszMessage = 0;
96  DWORD dwMessage = 0;
97  if(fSystem) {
99  FORMAT_MESSAGE_FROM_SYSTEM, hModule, dwMessageId,
100  LANG_USER_DEFAULT, (LPTSTR)&pszMessage, 128, &Ellipsis);
101  } else {
102  // we will use a string table.
103  char szString[256];
104  if(LoadString(0, dwMessageId, szString, sizeof(szString)))
106  FORMAT_MESSAGE_FROM_STRING, szString, dwMessageId,
107  LANG_USER_DEFAULT, (LPTSTR)&pszMessage, 256, &Ellipsis);
108  }
109 
110  va_end(Ellipsis);
111 
112  if (szModule)
113  FreeLibrary(hModule);
114 
115  if (dwMessage) {
116 
117  Result = printit(pszMessage);
118  LocalFree(pszMessage);
119  }
120 
121  return Result;
122 }
#define LoadLibrary
Definition: winbase.h:3676
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:402
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define va_end(ap)
Definition: acmsvcex.h:90
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
char * va_list
Definition: acmsvcex.h:78
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define FreeLibrary(x)
Definition: compat.h:405
unsigned long DWORD
Definition: ntddk_ex.h:95
int printit(const char *it)
Definition: tnerror.cpp:58
#define FormatMessage
Definition: winbase.h:3609
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define LoadString
Definition: winuser.h:5685
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
HMODULE hModule
Definition: animate.c:44

Variable Documentation

◆ Telnet_Redir

int Telnet_Redir