MCPcopy Create free account
hub / github.com/NetHack/NetHack / VA_DECL

Function VA_DECL

outdated/sys/wince/winhack.c:240–275  ·  view source on GitHub ↗

misc functions */

Source from the content-addressed store, hash-verified

238
239/* misc functions */
240void error
241VA_DECL(const char *, s)
242{
243 TCHAR wbuf[1024];
244 char buf[1024];
245 DWORD last_error = GetLastError();
246
247 VA_START(s);
248 VA_INIT(s, const char *);
249 /* error() may get called before tty is initialized */
250 if (iflags.window_inited)
251 end_screen();
252
253 vsprintf(buf, s, VA_ARGS);
254 NH_A2W(buf, wbuf, sizeof(wbuf) / sizeof(wbuf[0]));
255 if (last_error > 0) {
256 LPVOID lpMsgBuf;
257 if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
258 | FORMAT_MESSAGE_FROM_SYSTEM
259 | FORMAT_MESSAGE_IGNORE_INSERTS,
260 NULL, last_error,
261 0, // Default language
262 (LPTSTR) &lpMsgBuf, 0, NULL)) {
263 _tcsncat(wbuf, TEXT("\nSystem Error: "),
264 sizeof(wbuf) / sizeof(wbuf[0]) - _tcslen(wbuf));
265 _tcsncat(wbuf, lpMsgBuf,
266 sizeof(wbuf) / sizeof(wbuf[0]) - _tcslen(wbuf));
267
268 // Free the buffer.
269 LocalFree(lpMsgBuf);
270 }
271 }
272 MessageBox(NULL, wbuf, TEXT("Error"), MB_OK | MB_ICONERROR);
273 VA_END();
274 exit(EXIT_FAILURE);
275}
276
277TCHAR *
278_get_cmd_arg(TCHAR *pCmdLine)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected