Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.os.os2.programmer.misc > #1793

Re: win32 via odin

From Paul Edwards <mutazilah@gmail.com>
Newsgroups comp.os.os2.programmer.misc
Subject Re: win32 via odin
Date 2023-12-20 10:35 +0800
Organization A noiseless patient Spider
Message-ID <ultju1$d6rl$1@dont-email.me> (permalink)
References (2 earlier) <83234834-db2d-42ac-8bc6-0fcf631f53b9n@googlegroups.com> <7ee4e13c-63ae-4c02-a17d-b183c5045e92n@googlegroups.com> <e48bb3c4-e0c0-409f-b13b-c172afb74b47n@googlegroups.com> <fc31cff0-19f8-4a52-a14b-976c91b3387an@googlegroups.com> <79c75676-6bce-4df4-83fd-50327e0d81a8n@googlegroups.com>

Show all headers | View raw


On 16/07/23 11:43, xhajt03 wrote:
> On July 16, 2023 at 2:56:32 +0200, Paul Edwards wrote:

 >> I think the VIO thing is what is swallowing the ESC character.
 >> And what I need to do is switch to standard streams.

 > I don't think that you can ever get cursor keys from stdin under OS/2
 > - only regular characters are delivered that way. You'd need to use
 > the (16-bit) kbdcalls with thunking, or some wrapper around it
 > EMXWRAP.DLL from EMX runtime, or something else).

...

>> Ideally I wouldn't rely on that and would switch to 32-bit
>> DosDevIOCtl:
>>
>> bsedos.h: APIRET APIENTRY DosDevIOCtl(HFILE,ULONG,ULONG,PVOID,ULONG,PULONG,PVOID,ULONG,PULONG);
>>
>> (note APIENTRY, not APIENTRY16)
>
> No, you can't (not to my knowledge anyway, and no OS/2 console programs would ever do that).

Ok, I have spent the last 5 months doing nothing
else other than researching this issue. Not even
sleeping or eating.

I did drink Jolt Cola though.

And I've finally got a sign of hope, but not
yet fully proven.

This is compiled with Microsoft C 6.0
and run under Windows 2000:

D:\devel\pdos\pdpclib>mstest
about to open
rc is 0, handle is 3
rc from focus is 0
about to get status1
rc is 0, state is 9
about to set status1
rc is 0
about to set status2
rc is 0
about to get status
rc is 0, state is 6
about to do stringin
rc is 0, char1 is e0, char2 is e0
about to charin
rc is 0, char is e0
about to ioctl1
rc is 87
chchar is e0, chscan is 48
about to ioctl2
rc is 0
about to DosRead
rc 5, len 0, bytes e0 e0 0

D:\devel\pdos\pdpclib>mstest
about to open
rc is 0, handle is 3
rc from focus is 0
about to get status1
rc is 0, state is 9
about to set status1
rc is 0
about to set status2
rc is 0
about to get status
rc is 0, state is 6
about to do stringin
rc is 0, char1 is e0, char2 is e0
about to charin
rc is 0, char is e0
about to ioctl1
rc is 87
chchar is e0, chscan is 50
about to ioctl2
rc is 0
about to DosRead
rc 5, len 0, bytes e0 e0 0

D:\devel\pdos\pdpclib>


That x'48' is when I was pressing cursor up
continuously. The x'50' was when I was pressing
cursor down continuously.

I still need to see if I can replace those
other Kbd functions with DosDevIoCtl and I
still need to prove 32-bit under OS/2 2.0+.

The trick was that I needed to open a keyboard
and also I needed to set focus to it.

As to no OS/2 program ever doing this - I'm
hoping to start a movement. :-)


D:\devel\pdos\pdpclib>cl /Lp mstest.c
Microsoft (R) C Optimizing Compiler Version 6.00A
Copyright (c) Microsoft Corp 1984-1990. All rights reserved.

mstest.c

Microsoft (R) Segmented-Executable Linker  Version 5.10
Copyright (C) Microsoft Corp 1984-1990.  All rights reserved.

Object Modules [.OBJ]: mstest.obj /farcall
Run File [mstest.exe]: "mstest.exe" /noi
List File [NUL.MAP]: NUL
Libraries [.LIB]: /NOD:SLIBCE SLIBCEP.LIB
Definitions File [NUL.DEF]: ;

D:\devel\pdos\pdpclib>



#include <stdio.h>

#define INCL_DOS
#define INCL_DOSDEVICES
#define INCL_KBD
#include <os2.h>

int main(void)
{
USHORT rc;
ULONG tempRead;
USHORT parm = 1;
ULONG parmlen = sizeof parm;
KBDKEYINFO cd;
ULONG datalen = 0;
unsigned char data[200];
unsigned char parmdata[200];
/* WORD */ SHORT parmword = 1;
BYTE bb = 0x80;
static KBDINFO kinfo;
static STRINGINBUF si;
HKBD hk = 0;
USHORT len;

#if 1
printf("about to open\n");
rc = KbdOpen(&hk);
printf("rc is %d, handle is %x\n", rc, (int)hk);

rc = KbdGetFocus(IO_WAIT, hk);
printf("rc from focus is %d\n", rc);

#endif

/*kinfo.cb = 10;*/
/*kinfo.fsMask = 0;*/
memset(&kinfo, 0x00, sizeof kinfo);
kinfo.cb = 10;
kinfo.fsMask = 0xffffU;
printf("about to get status1\n");
rc = KbdGetStatus(&kinfo, /* 0 */ hk);
printf("rc is %d, state is %x\n", rc, kinfo.fsMask /* kinfo.fsState */);

kinfo.cb = 10;
/*kinfo.fsState = 2;*/
kinfo.fsMask = 2;
printf("about to set status1\n");
rc = KbdSetStatus(&kinfo, hk);
printf("rc is %d\n", rc);

kinfo.cb = 10;
/*kinfo.fsState = 4;*/
kinfo.fsMask = 4;
printf("about to set status2\n");
rc = KbdSetStatus(&kinfo, hk);
printf("rc is %d\n", rc);

kinfo.cb = 10;
kinfo.fsMask = 0xffffU;
/*kinfo.fsMask = 0;*/
/*memset(&kinfo, 0x00, sizeof kinfo);*/
kinfo.cb = 10;
printf("about to get status\n");
rc = KbdGetStatus(&kinfo, hk);
printf("rc is %d, state is %x\n", rc, kinfo.fsMask /* kinfo.fsState */);

si.cb = 2;
printf("about to do stringin\n");
rc = KbdStringIn(data, &si, 0, hk);
printf("rc is %d, char1 is %x, char2 is %x\n", rc, data[0], data[1]);

printf("about to charin\n");
rc = KbdCharIn(&cd, 0, hk);
printf("rc is %d, char is %x\n", rc, cd.chChar);

printf("about to ioctl1\n");
rc = DosDevIOCtl(&bb,
                  &cd, /* &parmword, */
                  0x51, /* function */
                  4, /* category - 4 = keyboard - not supported in FAPI */
                  hk); /* handle */

printf("rc is %d\n", rc);
printf("chchar is %x, chscan is %x\n", cd.chChar, cd.chScan);

printf("about to ioctl2\n");
rc = DosDevIOCtl(&cd,
                  &parmword,
                  0x74, /* function */
                  4, /* category - 4 = keyboard - not supported in FAPI */
                  hk); /* handle */
printf("rc is %d\n", rc);

printf("about to DosRead\n");
rc = DosRead(hk, data, 3, &len);
printf("rc %d, len %d, bytes %x %x %x\n", rc, len, data[0], data[1], 
data[2]);
return 0;
}


BFN. Paul.

Back to comp.os.os2.programmer.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-13 13:46 -0700
  Re: win32 via odin Dave Yeo <dave.r.yeo@gmail.com> - 2023-07-13 20:30 -0700
    Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-14 22:02 -0700
      Re: win32 via odin xhajt03 <xhajt03@gmail.com> - 2023-07-15 15:34 -0700
        Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-15 16:05 -0700
          Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-15 17:56 -0700
            Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-15 18:29 -0700
            Re: win32 via odin xhajt03 <xhajt03@gmail.com> - 2023-07-15 20:43 -0700
              Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-15 23:17 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-15 23:47 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-16 02:20 -0700
                Re: win32 via odin xhajt03 <xhajt03@gmail.com> - 2023-07-16 03:58 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-16 09:03 -0700
                Re: win32 via odin xhajt03 <xhajt03@gmail.com> - 2023-07-16 14:51 -0700
              Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-12-20 10:35 +0800
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-12-20 14:16 +0800
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-12-20 16:24 +0800
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-12-20 20:10 +0800
            Re: win32 via odin Dave Yeo <dave.r.yeo@gmail.com> - 2023-07-16 20:30 -0700
          Re: win32 via odin Dave Yeo <dave.r.yeo@gmail.com> - 2023-07-16 20:44 -0700
            Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-16 21:11 -0700
              Re: win32 via odin Dave Yeo <dave.r.yeo@gmail.com> - 2023-07-16 23:04 -0700
                Re: win32 via odin Dave Yeo <dave.r.yeo@gmail.com> - 2023-07-16 23:11 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-17 07:07 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-17 07:13 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-17 07:48 -0700
                Re: win32 via odin Paul Edwards <mutazilah@gmail.com> - 2023-07-17 16:50 -0700

csiph-web