16bit Command Line application ignores keyboard input after a few minutes.

T

Tritech

Our company has a 16bit command line application that works fine under XP
and was working fine under Vista until, we believe, service pack 1 was
installed. The program works initially to accept keyboard input but seems to
ignore any keyboard input after a few minutes of the PC being left with no
activity. We have tested this on Windows Vista and Windows 7 and have
exactly the same issue. We have created a very basic program that would
allow you to type characters and exit when Enter is pressed. I have narrowed
the time delay before the program freezes down to about 4 minutes of
inactivity. This will cause the program to not respond to any key presses on
the keyboard and has to be closed by clicking on the x in the top right
corner.
I am wondering if anyone else is having this issue and also if there is a
fix for this? (Perhaps a registry key timeout setting?)

Below is a copy of the source code we used for our simple program. The
program is written in Microsoft C version 5. We are using an Int 16h
Function 00h BIOS call to read the keyboard character. Any help on this
would be greatly appreciated. If you need the .exe file or the source code
as a file then let me know and I can email to you.


#include <string.h>
#include <bios.h>

static void BVsetcpos(int row, int col);
static void BVwtac(int amt, int chr, int att);
static int BKread(int *scanp);

#define A_NORM 0x07
#define A_INTENSE 0x0F
#define A_INVERSE 0x70

/* DOS Video */
#define DOS_VIDEO 0x10 /* DOS Interrupt */
#define F_SETCPOS 0x02 /* AX */
#define F_WTAC 0x09 /* AX */

/* DOS Keyboard */
#define DOS_KBD 0x16 /* DOS Interrupt */
#define F_READ 0x00 /* AX */

int nextch = 0; /* extended character code saved from
keyboard read */

void main(int argc, char *argv[])
{
int ch;
int row, col;

row = col = 10;
do {
BVsetcpos(row, col);
ch = BKread(&nextch);
if (ch >=' ' && ch <='~') {
BVwtac(1, ch, A_INTENSE);
if (col < 79) col++;
}
} while (ch != 10 && ch != 13);
}

/*--------------------------------------------------------------------------
--
NKread - read keyboard character and scan code
----------------------------------------------------------------------------
*/
static int BKread(int *scanp)
{
union REGS inr, outr;

inr.h.ah = F_READ; // F_READ == 0x00
int86(DOS_KBD, &inr, &outr); // DOS_KBD == 0x16
*scanp = outr.h.ah;
return ((int)outr.h.al);
}

/*--------------------------------------------------------------------------
--
BVsetcpos - set cursor position
----------------------------------------------------------------------------
*/
static void BVsetcpos(int row, int col)
{
union REGS inr, outr;

inr.h.ah = F_SETCPOS; // F_SETCPOS == 0x02
inr.h.dh = (unsigned char)row;
inr.h.dl = (unsigned char)col;
inr.h.bh = 0;
int86(DOS_VIDEO, &inr, &outr); // DOS_VIDEO == 0x10
}

/*--------------------------------------------------------------------------
--
BVwtac - write attribute and character
----------------------------------------------------------------------------
*/
static void BVwtac(int amt, int chr, int att)
{
union REGS inr, outr;

inr.h.ah = F_WTAC; // F_WTAC == 0x09
inr.h.al = (unsigned char)chr;
inr.h.bh = 0;
inr.h.bl = (unsigned char)att;
inr.x.cx = (unsigned)amt;
int86(DOS_VIDEO, &inr, &outr); // DOS_VIDEO == 0x10
}
 
G

Gene E. Bloch

Our company has a 16bit command line application that works fine under XP
and was working fine under Vista until, we believe, service pack 1 was
installed. The program works initially to accept keyboard input but seems to
ignore any keyboard input after a few minutes of the PC being left with no
activity. We have tested this on Windows Vista and Windows 7 and have
exactly the same issue. We have created a very basic program that would
allow you to type characters and exit when Enter is pressed. I have narrowed
the time delay before the program freezes down to about 4 minutes of
inactivity. This will cause the program to not respond to any key presses on
the keyboard and has to be closed by clicking on the x in the top right
corner.
I am wondering if anyone else is having this issue and also if there is a
fix for this? (Perhaps a registry key timeout setting?)

Below is a copy of the source code we used for our simple program. The
program is written in Microsoft C version 5. We are using an Int 16h
Function 00h BIOS call to read the keyboard character. Any help on this
would be greatly appreciated. If you need the .exe file or the source code
as a file then let me know and I can email to you.
<SNIP>

Would running a virtual machine (Microsoft has a free one) with DOS in it
solve your problem?

You could choose a DOS virtual machine or a virtual machine with an older
version of Windows, whichever works better for you. 16-bit software is
supposed to not work with Vista 64.
 
T

Tritech

We are running under 32bit Vista. We are aware that it will run under
Virtual PC but as this is a mainstream application this is not ideal due to
both the need to start virtual PC each morning and the requirement for the
extra licences required for the virtual PC operating system (it would need
to be XP or 2000 to allow domain access to the server where the application
and, more importantly, data is held). We are also aware that the application
does not run under 64bit Vista but this is not an immediate concern.

As stated out application was working fine under Vista until service pack 1
came along. Further investigations have shown that when working the NTDVM
uses CPU when a key is pressed then returns to idle. This continues to be
case even when the application has frozen. It would appear that something
goes wrong in NTDVM no longer passing the key press to the application.
 
T

Tim Quan [MSFT]

Hi,

Is the NTDVM you mentioned NTVDM (NT Virtual Dos Machine)?

16-bit applications must work within the DOS environment. NTVDM stands for
NT Virtual Dos Machine.

Now I suggest performing a Clean Boot to test the result:

Clean boot
=================
Let's disable all startup items and third party services when booting. This
method will help us determine if this issue is caused by a loading program
or service. Please perform the following steps:

1. Click the Start Button type "msconfig" (without quotation marks) in the
Start Search box, and then press Enter.

Note: If prompted, please click Continue on the User Account Control (UAC)
window.

2. Click the "Services" tab, check the "Hide All Microsoft Services" box
and click "Disable All" (if it is not gray).
3. Click the "Startup" tab, click "Disable All" and click "OK".

Then, restart the computer. When the "System Configuration Utility" window
appears, please check the "Don't show this message or launch the System
Configuration Utility when Windows starts" box and click OK.

Please test this issue in the Clean Boot environment, if the issue
disappears in the Clean Boot environment, we can use a 50/50 approach to
quickly narrow down which entry is causing the issue.

If the issue persists, you can uninstall SP1 to test the issue. You can
also try a System Restore to restore the system to a state before the issue
occurred.

If this issue does not occur after uninstall SP1, I am afraid that your
16-bit application is probably not fully compatible with SP1.

This issue can be also caused by viruses. Please update your anti-virus
programs to the latest version and perform a virus scan.

Please try the suggestions above and provide me with an update at your
earliest convenience. If anything is unclear, or if you have any questions
or concerns regarding the issue, feel free to let me know.

Tim Quan - MSFT
 
T

Tim Quan [MSFT]

Hi,

How are things going? I have not heard back from you in a few days and
wanted to check on the status of the issue. Please let me know how things
turned out.

Tim Quan - MSFT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top