win32gui support still needs to be developed.
#ifdef WIN32CON
#define PORT_DEBUG /* include ability to debug international keyboard issues */
+#define SAFERHANGUP /* Define SAFERHANGUP to delay hangup processing
+ * until the main command loop. 'safer' because it
+ * avoids certain cheats and also avoids losing
+ * objects being thrown when the hangup occurs.
+ */
#endif
/* The following is needed for prototypes of certain functions */
int *mod;
coord *cc;
{
+#if defined(SAFERHANGUP)
+ DWORD dwWait;
+#endif
int ch;
boolean valid = 0, done = 0;
while (!done) {
+#if defined(SAFERHANGUP)
+ dwWait = WaitForSingleObjectEx(
+ hConIn, // event object to wait for
+ INFINITE, // waits indefinitely
+ TRUE); // alertable wait enabled
+ if (dwWait == WAIT_FAILED) return '\033';
+#endif
ReadConsoleInput(hConIn,ir,1,count);
if (mode == 0) {
if ((ir->EventType == KEY_EVENT) && ir->Event.KeyEvent.bKeyDown) {
extern HANDLE hConIn;
extern INPUT_RECORD ir;
+extern struct sinfo program_state;
+
char dllname[512];
char *shortdllname;
int *mod;
coord *cc;
{
+#if defined(SAFERHANGUP)
+ DWORD dwWait;
+#endif
int ch;
boolean valid = 0, done = 0;
while (!done) {
+
+#if defined(SAFERHANGUP)
+ dwWait = WaitForSingleObjectEx(
+ hConIn, // event object to wait for
+ INFINITE, // waits indefinitely
+ TRUE); // alertable wait enabled
+ if (dwWait == WAIT_FAILED) return '\033';
+#endif
ReadConsoleInput(hConIn,ir,1,count);
if (mode == 0) {
if ((ir->EventType == KEY_EVENT) && ir->Event.KeyEvent.bKeyDown) {
boolean numpad;
coord *cc;
{
+#if defined(SAFERHANGUP)
+ DWORD dwWait;
+#endif
int ch;
boolean valid = 0, done = 0;
while (!done) {
*count = 0;
- WaitForSingleObject(hConIn, INFINITE);
+ dwWait = WaitForSingleObject(hConIn, INFINITE);
+#if defined(SAFERHANGUP)
+ if (dwWait == WAIT_FAILED) return '\033';
+#endif
PeekConsoleInput(hConIn,ir,1,count);
if (mode == 0) {
if ((ir->EventType == KEY_EVENT) && ir->Event.KeyEvent.bKeyDown) {
#ifndef NOSAVEONHANGUP
hangup(0);
#endif
-#if 0
- clearlocks();
- terminate(EXIT_FAILURE);
+#if defined(SAFERHANGUP)
+ CloseHandle(hConIn); /* trigger WAIT_FAILED */
+ return TRUE;
#endif
default:
return FALSE;
int mod;
coord cc;
DWORD count;
- return pCheckInput(hConIn, &ir, &count, iflags.num_pad, 0, &mod, &cc);
+ return (program_state.done_hup) ?
+ '\033' :
+ pCheckInput(hConIn, &ir, &count, iflags.num_pad, 0, &mod, &cc);
}
int
int ch;
coord cc;
DWORD count;
- ch = pCheckInput(hConIn, &ir, &count, iflags.num_pad, 1, mod, &cc);
+ ch = (program_state.done_hup) ?
+ '\033' :
+ pCheckInput(hConIn, &ir, &count, iflags.num_pad, 1, mod, &cc);
if (!ch) {
*x = cc.x;
*y = cc.y;