ReactOS 0.4.16-dev-588-gf07ea94
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 186 of file tnerror.cpp.

187{
188 DWORD dwLastError = GetLastError();
189
190 const int cbLastError = 1024;
191 TCHAR szLastError[cbLastError];
193 szLastError, cbLastError, 0);
194
195 LPTSTR lpszStrings[2];
196 lpszStrings[0] = szError;
197 lpszStrings[1] = szLastError;
198
199 const int cbErrorString = 1024;
200 TCHAR szErrorString[cbErrorString];
203 szErrorString, cbErrorString, (va_list*)lpszStrings);
204
206 time(&dwTime);
207 char* szTime = ctime(&dwTime);
208 szTime[19] = 0;
209
210 // printf("E %s %s", szTime + 11, szErrorString);
211 char * buf;
212 buf = new char [ 3 + strlen(szTime) - 11 + strlen(szErrorString) + 5 ];
213 sprintf( buf,"E %s %s", szTime + 11, szErrorString);
214 printit(buf);
215 delete [] buf;
216}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * va_list
Definition: acmsvcex.h:78
#define MSG_ERROR
Definition: resource.h:10
__kernel_time_t time_t
Definition: linux.h:252
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
__u16 ctime
Definition: mkdosfs.c:4
__u16 time
Definition: mkdosfs.c:8
#define sprintf(buf, format,...)
Definition: sprintf.c:55
DWORD dwTime
Definition: solitaire.cpp:27
TCHAR szTime[64]
Definition: solitaire.cpp:20
int printit(const char *it)
Definition: tnerror.cpp:58
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
#define FormatMessage
Definition: winbase.h:3820
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:449
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:450
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:448
char TCHAR
Definition: xmlstorage.h:189
CHAR * LPTSTR
Definition: xmlstorage.h:192

◆ printit()

int printit ( const char it)

Definition at line 58 of file tnerror.cpp.

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}
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
int get_output_redir() const
Definition: tnconfig.h:43
#define NULL
Definition: types.h:112
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
TConfig ini
Definition: tnconfig.cpp:45
#define STD_OUTPUT_HANDLE
Definition: winbase.h:294
#define WriteConsole
Definition: wincon.h:784

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().

◆ printm()

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

Definition at line 125 of file tnerror.cpp.

126{
127 int Result = 0;
128
129 HMODULE hModule = 0;
130 if (szModule)
131 hModule = LoadLibrary(szModule);
132
133 va_list Ellipsis;
134 va_start(Ellipsis, dwMessageId);
135#ifdef __REACTOS__
136 LPWSTR pszMessage = NULL;
137 DWORD dwMessage = 0;
138
139 if(fSystem) {
142 LANG_USER_DEFAULT, (LPWSTR)&pszMessage, 128, &Ellipsis);
143 } else {
144 // we will use a string table.
145 WCHAR wszString[256];
146 if(LoadStringW(0, dwMessageId, wszString, sizeof(wszString) / sizeof(*wszString)))
148 FORMAT_MESSAGE_FROM_STRING, wszString, dwMessageId,
149 LANG_USER_DEFAULT, (LPWSTR)&pszMessage, sizeof(wszString) / sizeof(*wszString), &Ellipsis);
150 }
151#else
152 LPTSTR pszMessage = 0;
153 DWORD dwMessage = 0;
154 if(fSystem) {
157 LANG_USER_DEFAULT, (LPTSTR)&pszMessage, 128, &Ellipsis);
158 } else {
159 // we will use a string table.
160 char szString[256];
161 if(LoadString(0, dwMessageId, szString, sizeof(szString)))
163 FORMAT_MESSAGE_FROM_STRING, szString, dwMessageId,
164 LANG_USER_DEFAULT, (LPTSTR)&pszMessage, 256, &Ellipsis);
165 }
166#endif
167
168 va_end(Ellipsis);
169
170 if (szModule)
172
173 if (dwMessage) {
174#ifdef __REACTOS__
175 Result = wprintit(pszMessage);
176#else
177 Result = printit(pszMessage);
178#endif
179 LocalFree(pszMessage);
180 }
181
182 return Result;
183}
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
HMODULE hModule
Definition: animate.c:44
#define FreeLibrary(x)
Definition: compat.h:748
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:447
#define LoadLibrary
Definition: winbase.h:3887
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:445
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define LoadString
Definition: winuser.h:5831
_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:409
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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().

Variable Documentation

◆ Telnet_Redir

int Telnet_Redir
extern